Skip to content

Commit

Permalink
SelectPanel: Fix font weight from active styles for modern ActionList…
Browse files Browse the repository at this point in the history
… (behind feature flag) (#5033)

* remove font weight from active styles

* Create thin-planes-grow.md

* update snapshots

* test(vrt): update snapshots

---------

Co-authored-by: siddharthkp <siddharthkp@users.noreply.github.com>
  • Loading branch information
siddharthkp and siddharthkp authored Sep 30, 2024
1 parent 6671a20 commit 0b83fe9
Show file tree
Hide file tree
Showing 25 changed files with 26 additions and 21 deletions.
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 @@ -627,7 +627,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 @@ -724,7 +724,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 @@ -1146,7 +1146,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 @@ -1243,7 +1243,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 @@ -1651,7 +1651,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 @@ -1769,7 +1769,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

0 comments on commit 0b83fe9

Please sign in to comment.