Skip to content

Commit

Permalink
- Fix alignment to the edge of sidebar menu. Everything should have c…
Browse files Browse the repository at this point in the history
…orrect alignment now.
  • Loading branch information
mattias800 committed Sep 7, 2023
1 parent 2c98325 commit 968747c
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export const Overview = () => {
</SidebarMenuCollapsible>
</SidebarMenuCollapsible>

<SidebarMenuCollapsible label={"No icon"}>
<SidebarMenuLink label={"Level 2"} onClick={onClick} />
</SidebarMenuCollapsible>

<SidebarMenuHeading label={"Support"} />
<SidebarMenuLink
leftIcon={faBook}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const SidebarMenu: React.FC<SidebarMenuProps> = ({

return (
<Box
indent={2}
indent={1}
className={cx(
styles.sidebarMenu,
collapsed ? styles.collapsed : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export const SidebarMenuCloseButtonRow: React.FC<
SidebarMenuCloseButtonRowProps
> = ({ onClick }) => {
return (
<Row justifyContent={"space-between"} alignItems={"center"} flex={1}>
<Row
justifyContent={"space-between"}
alignItems={"center"}
flex={1}
indent={1}
>
<FlatButton leftIcon={stenaTimes} onClick={onClick} variant={"danger"} />
<StenaFlag className={styles.stenaFlag} />
</Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@ export const SidebarMenuCollapsible: React.FC<SidebarMenuCollapsibleProps> = ({
background={"var(--current-background-color)"}
aria-expanded={expanded}
>
<Box width={"100%"}>
<Box
width={"100%"}
borderRadius={"99rem"}
overflow={"hidden"}
justifyContent={"space-between"}
<Box
width={"100%"}
borderRadius={"99rem"}
overflow={"hidden"}
justifyContent={"space-between"}
>
<button
className={innerClassName}
style={innerStyle}
onClick={() => setExpanded(!expanded)}
>
<button
className={innerClassName}
style={innerStyle}
onClick={() => setExpanded(!expanded)}
>
<Row justifyContent={"space-between"}>
<Row>
{leftIcon ? (
<Row justifyContent={"space-between"} indent={2}>
<Row>
{leftIcon && (
<>
<Box
width={"var(--swui-sidebar-menu-item-height)"}
alignItems={"center"}
justifyContent={"center"}
width={"16px"}
>
<Icon
icon={leftIcon}
Expand All @@ -73,33 +73,31 @@ export const SidebarMenuCollapsible: React.FC<SidebarMenuCollapsibleProps> = ({
data-hover={true}
/>
</Box>
) : (
<Indent num={1} />
)}
<Text variant={"bold"} className={styles.label}>
{label}
</Text>
</Row>
<Row>
<Icon
icon={expanded ? faChevronUp : faChevronDown}
size={12}
color={cssColor("--lhds-color-blue-600")}
/>
<Indent />
</Row>
<Indent />
</>
)}
<Text variant={"bold"} className={styles.label}>
{label}
</Text>
</Row>
</button>
</Box>
<Row>
<Icon
icon={expanded ? faChevronUp : faChevronDown}
size={12}
color={cssColor("--lhds-color-blue-600")}
/>
</Row>
</Row>
</button>
</Box>

{expanded && (
<Indent>
<>
<Space />
<SidebarMenuCollapsibleGroupBox indent={indent}>
{children}
</SidebarMenuCollapsibleGroupBox>
</Indent>
</>
)}
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const SidebarMenuHeading: React.FC<SidebarMenuHeadingProps> = ({
label,
}) => {
return (
<Box height={"32px"} justifyContent={"center"}>
<Box height={"32px"} justifyContent={"center"} indent={1}>
<Space />
<Text variant={"overline"} size={"smaller"}>
{label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const SidebarMenuLink: React.FC<SidebarMenuLinkProps> = ({

const innerChildren = (
<Row spacing={1} flex={1} alignItems={"center"}>
{!hasContentLeft && <Indent />}
<Indent num={hasContentLeft ? 0.5 : 1} />
<ButtonContent
label={label}
loading={loading}
Expand Down

0 comments on commit 968747c

Please sign in to comment.