-
Notifications
You must be signed in to change notification settings - Fork 13
Sort: Replace sort selector with popup card containing sort options #667
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: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,39 @@ | ||||||
| import { ArrowDownUpIcon } from 'lucide-react'; | ||||||
| import React from 'react'; | ||||||
|
|
||||||
| import PopupCard from '@features/layers/popupcard/PopupCard'; | ||||||
| import { SelectorDisplay } from '@features/params/ui/SelectorDisplayContext'; | ||||||
| import { getOptionStyle } from '@features/params/ui/SelectorOption'; | ||||||
| import usePageParams from '@features/params/usePageParams'; | ||||||
|
|
||||||
| import { PositionInGroup } from '@shared/lib/PositionInGroup'; | ||||||
|
|
||||||
| import SecondarySortBySelector from './SecondarySortBySelector'; | ||||||
| import SortBySelector from './SortBySelector'; | ||||||
| import SortDirectionSelector from './SortDirectionSelector'; | ||||||
|
|
||||||
| const SortPopupCard: React.FC = () => { | ||||||
| const { sortBy } = usePageParams(); | ||||||
|
|
||||||
| return ( | ||||||
| <div className="selector" style={{ gap: '0.25em' }}> | ||||||
| <ArrowDownUpIcon size="1.2em" /> | ||||||
| <PopupCard | ||||||
| buttonLabel={<>{sortBy} ▶</>} | ||||||
| buttonClassName="selected" | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The semantic category you want here is "primary". Selected should be only used when there are multiple options.
Suggested change
|
||||||
| buttonStyle={getOptionStyle(SelectorDisplay.Dropdown, true, PositionInGroup.Standalone)} | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting use! makes sense. Thanks for re-using styles. |
||||||
| description="Change how items are sorted." | ||||||
| title="Sort" | ||||||
| body={() => ( | ||||||
| <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5em' }}> | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep the selectors in line, add |
||||||
| <SortBySelector /> | ||||||
| <SecondarySortBySelector /> | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The label right now is "Secondary Sort By" do you think the label "Tie breaker" would be easier to understand? Otherwise we can keep it as-is. |
||||||
| <SortDirectionSelector /> | ||||||
| </div> | ||||||
| )} | ||||||
| /> | ||||||
| </div> | ||||||
| ); | ||||||
| }; | ||||||
|
|
||||||
| export default SortPopupCard; | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
flexWrap: 'nowrap'