Skip to content

Commit

Permalink
[CCUBE=415][JAZZ|RL] Remove redundant first child check, rename style…
Browse files Browse the repository at this point in the history
… props
  • Loading branch information
Quek Ruo Ling committed Sep 22, 2023
1 parent 36d579e commit 82bf200
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/navbar/navbar-items.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ interface StyleProps {
$selected: boolean;
}

interface ItemStyleProps {
interface WrapperStyleProps {
$alignLeft: boolean;
}

interface ItemStyleProps {
$hideNavBranding: boolean;
}

// =============================================================================
// WRAPPER
// =============================================================================

export const Wrapper = styled.ul<ItemStyleProps>`
export const Wrapper = styled.ul<WrapperStyleProps>`
display: flex;
list-style: none;
position: relative;
Expand Down Expand Up @@ -53,7 +57,7 @@ export const LinkItem = styled.li<ItemStyleProps>`
:first-child {
// negative margin to preserve touch target size for link
margin-left: ${(props) => (props.$alignLeft ? "-0.5rem" : "0")};
margin-left: ${(props) => (props.$hideNavBranding ? "-0.5rem" : "0")};
}
${MediaQuery.MaxWidth.tablet} {
Expand Down
6 changes: 4 additions & 2 deletions src/navbar/navbar-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ export const NavbarItems = <T,>({
selectedIndex >= 0 &&
selectedIndex === index &&
showSubMenu;
const alignLeft = index === 0 && hideNavBranding;
return (
<LinkItem key={index} $alignLeft={alignLeft}>
<LinkItem
key={index}
$hideNavBranding={hideNavBranding}
>
<Link
data-testid={testId}
weight={textWeight}
Expand Down

0 comments on commit 82bf200

Please sign in to comment.