Skip to content

Commit

Permalink
fix: spacing on sidebar (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsladerman authored May 17, 2024
1 parent b251e7d commit 0b189b3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"eslint.validate": ["javascript", "typescript"],
"eslint.workingDirectories": [
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"build:fix:storybook": "perl -pi -w -e 's/%40/@/g;' storybook-static/index.html",
"storybook:serve-static": "yarn build:storybook && http-server storybook-static",
"build": "npx tsc --declaration",
"build:watch": "npx tsc --declaration --watch",
"clean": "rimraf storybook-static dist",
"test": "vitest --run",
"test:watch": "vitest",
Expand Down Expand Up @@ -142,4 +143,4 @@
"lint-staged": {
"./src/**/*.{js,jsx,ts,tsx}": "prettier --write"
}
}
}
27 changes: 25 additions & 2 deletions src/components/SidebarExpandButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type MouseEvent } from 'react'

import { HamburgerMenuCollapseIcon, HamburgerMenuIcon } from '../icons'
import { HamburgerMenuCollapseIcon, HamburgerMenuCollapsedIcon } from '../icons'

import { useSidebar } from './Sidebar'
import SidebarItem from './SidebarItem'
Expand All @@ -19,9 +19,32 @@ function SidebarExpandButton() {
setIsExpanded((x: boolean) => !x)
}}
>
{isExpanded ? <HamburgerMenuCollapseIcon /> : <HamburgerMenuIcon />}
{isExpanded ? (
<HamburgerMenuCollapseIcon />
) : (
<HamburgerMenuCollapsedIcon />
)}
</SidebarItem>
)
}

// in case we want to animate it later
// const AnimatedHamburgerIcon = styled(HamburgerMenuCollapsedIcon)<{
// isExpanded: boolean
// }>`
// animation: ${() => flipAnimation} 0.1s;
// transform: ${({ isExpanded }) => (isExpanded ? 'scaleX(-1)' : 'scaleX(1)')};
// animation-direction: ${({ isExpanded }) =>
// isExpanded ? 'normal' : 'reverse'};
// `

// const flipAnimation = keyframes`
// 0% {
// transform: scaleX(1);
// }
// 100% {
// transform: scaleX(-1);
// }
// `

export default SidebarExpandButton
2 changes: 1 addition & 1 deletion src/components/SidebarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const ItemSC = styled.div<{
textDecoration: 'none',
whiteSpace: 'nowrap',
width: $isHorizontal ? undefined : '100%',
height: $isHorizontal ? undefined : 40,
height: $isHorizontal ? undefined : 32,
flexGrow: 0,
padding: $isHorizontal ? undefined : theme.spacing.small,
borderRadius: '3px',
Expand Down

0 comments on commit 0b189b3

Please sign in to comment.