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

UnderlineNav2: Take the listing html structure back to its original state #3559

Merged
merged 1 commit into from
Jul 27, 2023
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
13 changes: 1 addition & 12 deletions src/UnderlineNav2/UnderlineNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,7 @@ export const UnderlineNav = forwardRef(
ref={navRef}
>
<NavigationList sx={ulStyles} ref={listRef} role="list">
{listItems.map(listItem => {
return (
<Box
key={listItem.props.children}
as="li"
sx={{display: 'flex', flexDirection: 'column', alignItems: 'center'}}
>
{listItem}
</Box>
)
})}

{listItems}
{menuItems.length > 0 && (
<MoreMenuListItem ref={moreMenuRef}>
{!onlyMenuVisible && <Box sx={getDividerStyle(theme)}></Box>}
Expand Down
72 changes: 37 additions & 35 deletions src/UnderlineNav2/UnderlineNavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,43 +114,45 @@ export const UnderlineNavItem = forwardRef(
)

return (
<Link
ref={ref}
as={Component}
href={href}
aria-current={ariaCurrent}
onKeyDown={keyDownHandler}
onClick={clickHandler}
sx={merge<BetterSystemStyleObject>(getLinkStyles(theme, ariaCurrent), sxProp as SxProp)}
{...props}
>
{iconsVisible && Icon && (
<Box as="span" data-component="icon" sx={iconWrapStyles}>
<Icon />
</Box>
)}
{children && (
<Box
as="span"
data-component="text"
data-content={children}
sx={Boolean(ariaCurrent) && ariaCurrent !== 'false' ? {fontWeight: 600} : {}}
>
{children}
</Box>
)}
{loadingCounters ? (
<Box as="span" data-component="counter" sx={counterStyles}>
<LoadingCounter />
</Box>
) : (
counter !== undefined && (
<Box as="li" sx={{display: 'flex', flexDirection: 'column', alignItems: 'center'}}>
<Link
ref={ref}
as={Component}
href={href}
aria-current={ariaCurrent}
onKeyDown={keyDownHandler}
onClick={clickHandler}
sx={merge<BetterSystemStyleObject>(getLinkStyles(theme, ariaCurrent), sxProp as SxProp)}
{...props}
>
{iconsVisible && Icon && (
<Box as="span" data-component="icon" sx={iconWrapStyles}>
<Icon />
</Box>
)}
{children && (
<Box
as="span"
data-component="text"
data-content={children}
sx={Boolean(ariaCurrent) && ariaCurrent !== 'false' ? {fontWeight: 600} : {}}
>
{children}
</Box>
)}
{loadingCounters ? (
<Box as="span" data-component="counter" sx={counterStyles}>
<CounterLabel>{counter}</CounterLabel>
<LoadingCounter />
</Box>
)
)}
</Link>
) : (
counter !== undefined && (
<Box as="span" data-component="counter" sx={counterStyles}>
<CounterLabel>{counter}</CounterLabel>
</Box>
)
)}
</Link>
</Box>
)
},
) as PolymorphicForwardRefComponent<'a', UnderlineNavItemProps>
Expand Down