Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base map legends #2647

Open
wants to merge 12 commits into
base: next
Choose a base branch
from
Open

Base map legends #2647

wants to merge 12 commits into from

Conversation

kwongz
Copy link
Contributor

@kwongz kwongz commented Oct 10, 2024

Description

Map Legends

(Video Recording not properly catching show legend transition)

Screen.Recording.2024-10-10.191938.mp4
Screen.Recording.2024-10-10.193343.mp4
  1. Takes in data column from Value prop to create legend
  2. Categorical Legends output distinct strings and map them to colorPallete (handles null values)
  3. Scalar Legends create a color gradient scale based on numerical max and min values
  4. Default color handling + max/min fmt
  5. Legend positioning (bottomLeft, bottomRight, topLeft, topRight)
  6. New single legend design
  7. Moved Legend component into Basemaps
  8. Refactored Legend component
  9. Dynamic Categorical and Scalar Legends based on legenType Prop
  10. Multi-Legend added for BaseMap
  11. Smoother animations and transitions

Checklist

  • For UI or styling changes, I have added a screenshot or gif showing before & after
  • I have added a changeset
  • I have added to the docs where applicable
  • I have added to the VS Code extension where applicable

Copy link

changeset-bot bot commented Oct 10, 2024

🦋 Changeset detected

Latest commit: bce3372

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@evidence-dev/core-components Patch
my-evidence-project Patch
e2e-spa Patch
e2e-themes Patch
@evidence-dev/components Patch
evidence-test-environment Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2024 5:31pm
next-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2024 5:31pm

Copy link

netlify bot commented Oct 10, 2024

Deploy Preview for evidence-test-env ready!

Name Link
🔨 Latest commit bce3372
🔍 Latest deploy log https://app.netlify.com/sites/evidence-test-env/deploys/670ea52ac854a200087c13ab
😎 Deploy Preview https://deploy-preview-2647--evidence-test-env.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 10, 2024

Deploy Preview for next-docs-evidence ready!

Name Link
🔨 Latest commit bce3372
🔍 Latest deploy log https://app.netlify.com/sites/next-docs-evidence/deploys/670ea52a4733780008b962c1
😎 Deploy Preview https://deploy-preview-2647--next-docs-evidence.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 10, 2024

Deploy Preview for evidence-development-workspace ready!

Name Link
🔨 Latest commit bce3372
🔍 Latest deploy log https://app.netlify.com/sites/evidence-development-workspace/deploys/670ea52ac854a200087c13ad
😎 Deploy Preview https://deploy-preview-2647--evidence-development-workspace.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kwongz
Copy link
Contributor Author

kwongz commented Oct 10, 2024

found a weird bug occurring on local docs and not on storybook, duplicate legend data causes double legends

image

@kwongz
Copy link
Contributor Author

kwongz commented Oct 11, 2024

i noticed the init function was running multiple times, (3 -2)

Current solution:

Move init() to onMount, seems to also speed up map rendering

just uncertain about other consequences, but looks good now

Update: Solved with 2nd await init() then block, as well as legend data duplicate update handling for dev mode

@kwongz kwongz requested review from zachstence and hughess and removed request for zachstence October 11, 2024 17:28
@kwongz
Copy link
Contributor Author

kwongz commented Oct 11, 2024

Looking into default legend rendering for maps

@kwongz
Copy link
Contributor Author

kwongz commented Oct 11, 2024

@hughess

Issue

Looking into legends as default, but legends depend on Value prop which is not required for maps.

image

I think a nice solution is the legend comes with the Value prop, and users can control showing the legend with a noLegend prop

Solution

Legend w/ Default

image

image

No legend

image

image

@kwongz
Copy link
Contributor Author

kwongz commented Oct 11, 2024

@zachstence

Just spoke with @hughess, would we be able to get rid of the text, and add a icon to represent the map with a label for screen readers?

@kwongz
Copy link
Contributor Author

kwongz commented Oct 15, 2024

@hughess

Update

  1. Legends only require value prop, to hide legend legend=false
  2. After talking to @zachstence we would like to pitch the chevron with screen readers for accessibility
  3. overflow fix for category legends
Screen.Recording.2024-10-15.112545.mp4

Summary Other fixes:

  1. No more duplicate legend rendering in docs
  2. Aligned multi legend scalar and category padding

@kwongz kwongz marked this pull request as ready for review October 15, 2024 15:30
@kwongz
Copy link
Contributor Author

kwongz commented Oct 15, 2024

image

Currently, Legends appear when legends=true && value=!undefined.

  • Is there a better way to instruct the user on this?
  • Alternatively, should legend not rely on value? instead, render a legend with 'No data"?

@kwongz
Copy link
Contributor Author

kwongz commented Oct 15, 2024

image

custom color example, color prop makes all areas the same color.

Should we handle this? or should we and users use the legend=false prop for this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant