Skip to content

Commit 0b189b3

Browse files
authored
fix: spacing on sidebar (#595)
1 parent b251e7d commit 0b189b3

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"editor.codeActionsOnSave": {
3-
"source.fixAll.eslint": true
3+
"source.fixAll.eslint": "explicit"
44
},
55
"eslint.validate": ["javascript", "typescript"],
66
"eslint.workingDirectories": [

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"build:fix:storybook": "perl -pi -w -e 's/%40/@/g;' storybook-static/index.html",
1414
"storybook:serve-static": "yarn build:storybook && http-server storybook-static",
1515
"build": "npx tsc --declaration",
16+
"build:watch": "npx tsc --declaration --watch",
1617
"clean": "rimraf storybook-static dist",
1718
"test": "vitest --run",
1819
"test:watch": "vitest",
@@ -142,4 +143,4 @@
142143
"lint-staged": {
143144
"./src/**/*.{js,jsx,ts,tsx}": "prettier --write"
144145
}
145-
}
146+
}

src/components/SidebarExpandButton.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type MouseEvent } from 'react'
22

3-
import { HamburgerMenuCollapseIcon, HamburgerMenuIcon } from '../icons'
3+
import { HamburgerMenuCollapseIcon, HamburgerMenuCollapsedIcon } from '../icons'
44

55
import { useSidebar } from './Sidebar'
66
import SidebarItem from './SidebarItem'
@@ -19,9 +19,32 @@ function SidebarExpandButton() {
1919
setIsExpanded((x: boolean) => !x)
2020
}}
2121
>
22-
{isExpanded ? <HamburgerMenuCollapseIcon /> : <HamburgerMenuIcon />}
22+
{isExpanded ? (
23+
<HamburgerMenuCollapseIcon />
24+
) : (
25+
<HamburgerMenuCollapsedIcon />
26+
)}
2327
</SidebarItem>
2428
)
2529
}
2630

31+
// in case we want to animate it later
32+
// const AnimatedHamburgerIcon = styled(HamburgerMenuCollapsedIcon)<{
33+
// isExpanded: boolean
34+
// }>`
35+
// animation: ${() => flipAnimation} 0.1s;
36+
// transform: ${({ isExpanded }) => (isExpanded ? 'scaleX(-1)' : 'scaleX(1)')};
37+
// animation-direction: ${({ isExpanded }) =>
38+
// isExpanded ? 'normal' : 'reverse'};
39+
// `
40+
41+
// const flipAnimation = keyframes`
42+
// 0% {
43+
// transform: scaleX(1);
44+
// }
45+
// 100% {
46+
// transform: scaleX(-1);
47+
// }
48+
// `
49+
2750
export default SidebarExpandButton

src/components/SidebarItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const ItemSC = styled.div<{
8383
textDecoration: 'none',
8484
whiteSpace: 'nowrap',
8585
width: $isHorizontal ? undefined : '100%',
86-
height: $isHorizontal ? undefined : 40,
86+
height: $isHorizontal ? undefined : 32,
8787
flexGrow: 0,
8888
padding: $isHorizontal ? undefined : theme.spacing.small,
8989
borderRadius: '3px',

0 commit comments

Comments
 (0)