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

Multiple level dropdowns #194

Merged
merged 10 commits into from
Jul 23, 2024
Merged

Multiple level dropdowns #194

merged 10 commits into from
Jul 23, 2024

Conversation

aparlato
Copy link
Collaborator

@aparlato aparlato commented Jul 9, 2024

Description

This PR enables style presets to have a second nested level to help organize long lists of styles. We do not allow more than two levels of nesting.

TODO

  • Apply same treatment to branch options
    • I'm debating if it makes sense to apply a similar treatment here, always treat styles for a branch pattern as a multi-dropdown, or do nothing
    • Ended up giving this as default behavior to branchPatterns
  • Add documentation of syntax

Closes #193

QA steps

  • Set up your local.js config to include style presets like the following:
    const stylePresets = [
        {
        id: 'mapbox-outdoors',
        name: 'Mapbox Outdoors',
        type: 'maplibre-gl',
        renderer: 'maplibre-gl',
        url: 'mapbox://styles/mapbox/outdoors-v11',
      },
      {
        name: 'Data viz styles',
        type: 'sublist',
        presets: [
          {
            id: 'mapbox-light',
            name: 'Mapbox Light',
            type: 'mapbox-gl',
            url: 'mapbox://styles/mapbox/light-v10',
          },
          {
            id: 'mapbox-dark',
            name: 'Mapbox Dark',
            type: 'mapbox-gl',
            url: 'mapbox://styles/mapbox/dark-v10',
          },
        ],
      },
    ]
    
  • Confirm that selecting a nested style works as expected
  • Confirm on refresh that the dropdown finds the nested style
  • Confirm all dropdowns work (switched all to the sveltestrap library for consistency)

Author checklist

Create the PR

  • Fill out PR template
  • Make sure you've added a CHANGELOG entry under "Unreleased"
  • Request a review
  • Make any requested changes and get approval

After approval

  • Merge any changes from main into your branch, resolve any conflicts
  • Squash & merge changes into main
  • Delete branch

@aparlato aparlato marked this pull request as ready for review July 9, 2024 22:27
@aparlato aparlato requested a review from ebrelsford July 9, 2024 22:28
Copy link
Contributor

@ebrelsford ebrelsford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great and useful!

Any chance we can handle this horizontal overflow?

image

Otherwise lgtm.

@aparlato
Copy link
Collaborator Author

@ebrelsford I've got the list items to truncate and made labels not go over their container (and also adjusted whether it's a drop-down or drop-up based on screen position) but I'm having trouble getting the toggle itself to use truncation due to how its implemented in the library.

It's basically a div with an ::after property for the triangle so the ellipsis doesn't work as I expect. Any suggestion here or should we just move forward with it as-is:
image

@aparlato aparlato requested a review from ebrelsford July 17, 2024 14:58
@aparlato
Copy link
Collaborator Author

@ebrelsford nevermind the above, I figured out how to make the ellipsis work correctly here!

@aparlato aparlato merged commit 14bc271 into main Jul 23, 2024
@aparlato aparlato deleted the multi-level-dropdowns branch July 23, 2024 15:30
@aparlato aparlato mentioned this pull request Jul 23, 2024
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.

Multi-level dropdowns
2 participants