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

SelectPanel: Fix font weight from active styles for modern ActionList (behind feature flag) #5033

Merged
merged 4 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thin-planes-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

SelectPanel: Fix font weight from active styles for modern ActionList (behind feature flag)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/react/src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export const Item = React.forwardRef<HTMLLIElement, ActionListItemProps>(

/** Active styles */
...(active ? activeStyles : {}), // NavList
'&[data-is-active-descendant]': activeStyles, // SelectPanel
'&[data-is-active-descendant]': {...activeStyles, fontWeight: 'normal'}, // SelectPanel

...(!buttonSemantics ? hoverStyles : {}),
}
Expand Down
16 changes: 8 additions & 8 deletions packages/react/src/NavList/__snapshots__/NavList.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ exports[`NavList renders a simple list 1`] = `
}

.c2[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -233,7 +233,7 @@ exports[`NavList renders a simple list 1`] = `
}

.c7[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -613,7 +613,7 @@ exports[`NavList renders with groups 1`] = `
}

.c6[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -710,7 +710,7 @@ exports[`NavList renders with groups 1`] = `
}

.c11[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -1124,7 +1124,7 @@ exports[`NavList.Item with NavList.SubNav does not have active styles if SubNav
}

.c11[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -1221,7 +1221,7 @@ exports[`NavList.Item with NavList.SubNav does not have active styles if SubNav
}

.c4[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -1629,7 +1629,7 @@ exports[`NavList.Item with NavList.SubNav has active styles if SubNav contains t
}

.c11[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -1747,7 +1747,7 @@ exports[`NavList.Item with NavList.SubNav has active styles if SubNav contains t
}

.c4[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down
12 changes: 6 additions & 6 deletions packages/react/src/SelectPanel/SelectPanel.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ function getColorCircle(color: string) {
}
}

const items = [
{leadingVisual: getColorCircle('#a2eeef'), text: 'enhancement', id: 1},
{leadingVisual: getColorCircle('#d73a4a'), text: 'bug', id: 2},
{leadingVisual: getColorCircle('#0cf478'), text: 'good first issue', id: 3},
const items: ItemInput[] = [
{leadingVisual: getColorCircle('#a2eeef'), text: 'enhancement', description: 'New feature or request', id: 1},
{leadingVisual: getColorCircle('#d73a4a'), text: 'bug', description: "Something isn't working", id: 2},
{leadingVisual: getColorCircle('#0cf478'), text: 'good first issue', description: 'Good for newcomers', id: 3},
{leadingVisual: getColorCircle('#ffd78e'), text: 'design', id: 4},
{leadingVisual: getColorCircle('#ff0000'), text: 'blocker', id: 5},
{leadingVisual: getColorCircle('#a4f287'), text: 'backend', id: 6},
{leadingVisual: getColorCircle('#8dc6fc'), text: 'frontend', id: 7},
]
].map(item => ({...item, descriptionVariant: 'block'}))

export const Default = () => {
const [selected, setSelected] = React.useState<ItemInput[]>([items[0], items[1]])
const [filter, setFilter] = React.useState('')
const filteredItems = items.filter(item => item.text.toLowerCase().startsWith(filter.toLowerCase()))
const filteredItems = items.filter(item => item.text?.toLowerCase().startsWith(filter.toLowerCase()))
const [open, setOpen] = useState(false)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ exports[`snapshots renders a menu that contains an item to add to the menu 1`] =
}

.c3[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -1603,7 +1603,7 @@ exports[`snapshots renders a multiselect input 1`] = `
}

.c3[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -2382,7 +2382,7 @@ exports[`snapshots renders a multiselect input with selected menu items 1`] = `
}

.c3[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -2479,7 +2479,7 @@ exports[`snapshots renders a multiselect input with selected menu items 1`] = `
}

.c8[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -3202,7 +3202,7 @@ exports[`snapshots renders a single select input 1`] = `
}

.c3[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down Expand Up @@ -3689,7 +3689,7 @@ exports[`snapshots renders with a custom text input component 1`] = `
}

.c3[data-is-active-descendant] {
font-weight: 600;
font-weight: 400;
background-color: var(--control-transparent-bgColor-selected,var(--color-action-list-item-default-selected-bg,rgba(208,215,222,0.24)));
}

Expand Down
Loading