Skip to content

UnderlineNav2: Remove selectionVariant prop from stories and refactor accordingly #3393

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

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions src/ActionList/Visuals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type VisualProps = SxProp & React.HTMLAttributes<HTMLSpanElement>
export const LeadingVisualContainer: React.FC<React.PropsWithChildren<VisualProps>> = ({sx = {}, ...props}) => {
return (
<Box
data-component="ActionList.LeadingVisual"
as="span"
sx={merge(
{
Expand Down
2 changes: 0 additions & 2 deletions src/UnderlineNav2/UnderlineNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ export const UnderlineNav = forwardRef(
variant = 'default',
loadingCounters = false,
children,
...props
}: UnderlineNavProps,
forwardedRef,
) => {
Expand Down Expand Up @@ -370,7 +369,6 @@ export const UnderlineNav = forwardRef(
ref={containerRef}
id={disclosureWidgetId}
sx={merge({display: isWidgetOpen ? 'block' : 'none'}, menuStyles)}
{...props}
>
{actions.map((action, index) => {
const {children: actionElementChildren, ...actionElementProps} = action.props
Expand Down
6 changes: 1 addition & 5 deletions src/UnderlineNav2/UnderlineNav2.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ const items: {navigation: string; icon: React.FC<IconProps>; counter?: number |
export const OverflowTemplate = ({initialSelectedIndex = 1}: {initialSelectedIndex?: number}) => {
const [selectedIndex, setSelectedIndex] = React.useState<number | null>(initialSelectedIndex)
return (
<UnderlineNav
aria-label="Repository"
// @ts-ignore UnderlineNav does not take selectionVariant prop, but we need to pass it to the underlying ActionList so it doesn't show Selections.
selectionVariant={undefined}
>
<UnderlineNav aria-label="Repository">
{items.map((item, index) => (
<UnderlineNav.Item
key={item.navigation}
Expand Down
2 changes: 1 addition & 1 deletion src/UnderlineNav2/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const getLinkStyles = (

export const menuItemStyles = {
// This is needed to hide the selected check icon on the menu item. https://github.com/primer/react/blob/main/src/ActionList/Selection.tsx#L32
'& > span': {
'& span[data-component="ActionList.LeadingVisual"]': {
display: 'none',
},
// To reset the style when the menu items are rendered as react router links
Expand Down