Skip to content

Commit 90387d9

Browse files
committed
toggle works, nice animations missing
1 parent 971269a commit 90387d9

File tree

4 files changed

+42
-19
lines changed

4 files changed

+42
-19
lines changed

.eslintrc.frontend.yml

+1
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,4 @@ overrides:
128128
rules:
129129
import/no-extraneous-dependencies: off
130130
react/jsx-props-no-spreading: off
131+
react-hooks/rules-of-hooks: off

apps/frontend/ui/src/layout/partials/Sidebar/func.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
SearchFilled,
66
HandshakeFilled,
77
ChevronLeftFilled,
8+
ChevronRightFilled,
89
} from "@fluentui/react-icons";
910

1011
import { Flex, Divider, TabList, Tab, Tooltip, Button } from "@lib-components";
@@ -15,7 +16,7 @@ import useSidebarClasses from "@app-ui/layout/partials/Sidebar/styles";
1516
type TProps = {
1617
defaultTab: "overview" | "browse" | "contribute";
1718
isExpanded: boolean;
18-
toggleExpandAction: (isExpanded: boolean) => void;
19+
toggleExpandAction: () => void;
1920
overviewTabAction: () => void;
2021
browseTabAction: () => void;
2122
};
@@ -79,7 +80,13 @@ export default function Sidebar({
7980
</TabList>
8081
</Flex>
8182
</Flex>
82-
<Button icon={<ChevronLeftFilled />} appearance="subtle" size="small" />
83+
<Button
84+
className={classes.buttonOverride}
85+
icon={isExpanded ? <ChevronLeftFilled /> : <ChevronRightFilled />}
86+
appearance="subtle"
87+
size="small"
88+
onClick={toggleExpandAction}
89+
/>
8390
</Flex>
8491
);
8592
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useState } from "react";
2+
13
import type { Meta, StoryObj } from "@storybook/react";
24

35
import Sidebar from "@app-ui/layout/partials/Sidebar";
@@ -10,7 +12,9 @@ const meta: Meta = {
1012
args: {
1113
defaultTab: "overview",
1214
isExpanded: true,
13-
toggleExpandAction: (_: boolean) => _,
15+
toggleExpandAction: () => {},
16+
overviewTabAction: () => {},
17+
browseTabAction: () => {},
1418
},
1519
};
1620

@@ -19,23 +23,33 @@ export default meta;
1923
type TStory = StoryObj<typeof Sidebar>;
2024

2125
export const Index: TStory = {
22-
render: (args) => (
23-
<div
24-
style={{
25-
display: "flex",
26-
backgroundColor: "black",
27-
gap: "1rem",
28-
padding: "1rem",
29-
height: "700px",
30-
}}
31-
>
32-
<Sidebar {...args} />
26+
render: (args) => {
27+
const [isExpanded, setIsExpanded] = useState(true);
28+
29+
return (
3330
<div
3431
style={{
35-
width: "100%",
36-
backgroundColor: tokens.colorNeutralBackground1,
32+
display: "flex",
33+
backgroundColor: "black",
34+
gap: "1rem",
35+
padding: "1rem",
36+
height: "700px",
3737
}}
38-
/>
39-
</div>
40-
),
38+
>
39+
<Sidebar
40+
{...args}
41+
toggleExpandAction={() => {
42+
setIsExpanded(!isExpanded);
43+
}}
44+
isExpanded={isExpanded}
45+
/>
46+
<div
47+
style={{
48+
width: "100%",
49+
backgroundColor: tokens.colorNeutralBackground1,
50+
}}
51+
/>
52+
</div>
53+
);
54+
},
4155
};

apps/frontend/ui/src/layout/partials/Sidebar/styles.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const useSidebarClasses = makeStyles({
55
backgroundColor: tokens.colorNeutralBackground1,
66
borderRadius: tokens.borderRadiusLarge,
77
},
8+
buttonOverride: {},
89
});
910

1011
export default useSidebarClasses;

0 commit comments

Comments
 (0)