Skip to content

Commit

Permalink
fix the rightsidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
sstraatemans committed Nov 7, 2024
1 parent 4f11e02 commit 0d3c3cb
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 8 deletions.
6 changes: 1 addition & 5 deletions packages/apps/dev-wallet/src/App/Layout/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ export const SideBar: FC = () => {
</Button>
}
>
<ContextMenuItem
onClick={() => navigate('/profile')}
label="Profile"
/>
<ContextMenuItem
endVisual={<MonoLogout />}
label="Logout"
Expand All @@ -140,12 +136,12 @@ export const SideBar: FC = () => {
label="Change theme"
>
<Button
isCompact
variant="transparent"
onPress={() => toggleTheme()}
startVisual={
theme === 'dark' ? <MonoDarkMode /> : <MonoLightMode />
}
isCompact={!isExpanded}
/>
</SideBarItem>
</SideBarItemsInline>
Expand Down
49 changes: 48 additions & 1 deletion packages/libs/kode-ui/src/patterns/SideBarLayout/aside.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,58 @@ import {
} from './../../styles';
import { minHeaderHeight } from './styles.css';

export const asideWrapperTempClass = recipe({
base: [
{
position: 'relative',
paddingBlockEnd: token('spacing.md'),
backgroundColor: token('color.background.base.default'),
},
responsiveStyle({
xs: {
display: 'none',
},

xxl: {
display: 'flex',
width: '370px',
minWidth: '370px',
transform: 'translateX(0%)',
marginInlineEnd: token('spacing.md'),
zIndex: 0,
},
}),
],
variants: {
expanded: {
true: {
opacity: 1,
transform: 'translateX(0%)',
pointerEvents: 'auto',
},
false: [
{
opacity: 0,
pointerEvents: 'none',
},
responsiveStyle({
xxl: {
display: 'none',
},
}),
],
},
},
});

export const asideWrapperClass = recipe({
base: [
{
position: 'fixed',
paddingBlockEnd: token('spacing.md'),
backgroundColor: token('color.background.base.default'),
gridRow: '2/5',
zIndex: 1,
},
responsiveStyle({
xs: {
Expand All @@ -35,12 +80,14 @@ export const asideWrapperClass = recipe({
maxWidth: '370px',
},
xxl: {
position: 'relative',
position: 'fixed',
top: minHeaderHeight,
width: '370px',
minWidth: '370px',
transform: 'translateX(0%)',
marginInlineEnd: token('spacing.md'),
zIndex: 0,
height: `calc(100dvh - ${minHeaderHeight})`,
},
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
asideHeaderCloseButtonWrapperClass,
asideHeadingClass,
asideWrapperClass,
asideWrapperTempClass,
menuBackdropClass,
} from '../aside.css';
import type { ISideBarLayoutLocation } from '../types';
Expand Down Expand Up @@ -35,8 +36,8 @@ export const SideBarAside: FC<{
}, [ref.current]);

useEffect(() => {
setIsRightAsideExpanded(!!location?.hash);
}, [location?.hash]);
setIsRightAsideExpanded(false);
}, [location.url]);

return (
<>
Expand All @@ -47,6 +48,11 @@ export const SideBarAside: FC<{
})}
onClick={handleExpand}
/>
<Stack
className={asideWrapperTempClass({
expanded: isRightAsideExpanded,
})}
></Stack>
<aside
className={asideWrapperClass({
expanded: isRightAsideExpanded,
Expand Down

0 comments on commit 0d3c3cb

Please sign in to comment.