Skip to content

Sort: Replace sort selector with popup card containing sort options#667

Open
mchen11077 wants to merge 1 commit into
masterfrom
feature/579-sort-card
Open

Sort: Replace sort selector with popup card containing sort options#667
mchen11077 wants to merge 1 commit into
masterfrom
feature/579-sort-card

Conversation

@mchen11077

Copy link
Copy Markdown
Contributor

Fixes #579

截屏2026-06-15 上午11 44 55

Summary

  • Replace the toolbar sort dropdown with a SortPopupCard that contains Sort By, Secondary Sort By, and Sort Direction.
  • Remove the corresponding sort controls from View Settings.
  • Remove the unused showLabel prop from SortBySelector.

@mchen11077 mchen11077 requested a review from a team as a code owner June 15, 2026 18:45
@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare Pages preview

@conradarcturus conradarcturus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Some minor edits but otherwise lgtm.

Do you think we should add any explanations to the component or is it okay just as selectors?

body={() => (
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.5em' }}>
<SortBySelector />
<SecondarySortBySelector />

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.

description="Change how items are sorted."
title="Sort"
body={() => (
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.5em' }}>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's keep the selectors in line, add

              width: 'max-content',
              alignItems: 'flex-end',

const { sortBy } = usePageParams();

return (
<div className="selector" style={{ gap: '0.25em' }}>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Add flexWrap: 'nowrap'

<ArrowDownUpIcon size="1.2em" />
<PopupCard
buttonLabel={<>{sortBy} ▶</>}
buttonClassName="selected"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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
buttonClassName="selected"
buttonClassName="primary"

<PopupCard
buttonLabel={<>{sortBy} ▶</>}
buttonClassName="selected"
buttonStyle={getOptionStyle(SelectorDisplay.Dropdown, true, PositionInGroup.Standalone)}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Interesting use! makes sense. Thanks for re-using styles.

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.

Change sort to a card

2 participants