diff --git a/.changeset/quick-beans-join.md b/.changeset/quick-beans-join.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/quick-beans-join.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/apps/dev-wallet/src/App/Layout/SideBar.tsx b/packages/apps/dev-wallet/src/App/Layout/SideBar.tsx index c70ad3c6b6..26af24fdcd 100644 --- a/packages/apps/dev-wallet/src/App/Layout/SideBar.tsx +++ b/packages/apps/dev-wallet/src/App/Layout/SideBar.tsx @@ -1,12 +1,14 @@ import { + MonoApps, + MonoBackupTable, MonoContacts, MonoContrast, - MonoDashboardCustomize, + MonoKey, MonoLogout, MonoNetworkCheck, + MonoSignature, + MonoSwapHoriz, MonoTableRows, - MonoWallet, - MonoWindow, } from '@kadena/kode-icons/system'; import { NetworkSelector } from '@/Components/NetworkSelector/NetworkSelector'; @@ -57,38 +59,39 @@ export const SideBar: FC = () => { navigation={ <> } + visual={} label="Dashboard" component={Link} href="/" /> - } label="My Wallets"> - - - } label="Transactions"> - - - } label="Utilities"> - - - + } + label="Transfer" + component={Link} + href="/transfer" + /> + + } + label="Sig Builder" + component={Link} + href="/sig-builder" + /> + + } + label="Transactions" + component={Link} + href="/transactions" + /> + + } + /> } @@ -96,6 +99,13 @@ export const SideBar: FC = () => { component={Link} href="/contacts" /> + + } + label="Backup" + component={Link} + href="/backup-recovery-phrase/write-down" + /> } context={ diff --git a/packages/apps/dev-wallet/src/pages/home/home-page.tsx b/packages/apps/dev-wallet/src/pages/home/home-page.tsx index 1d60013ef1..641708cb05 100644 --- a/packages/apps/dev-wallet/src/pages/home/home-page.tsx +++ b/packages/apps/dev-wallet/src/pages/home/home-page.tsx @@ -42,10 +42,10 @@ export function HomePage() { }> Dashboard - + Welcome back - {profile?.name} - + {profile?.name} + Wallet Activities diff --git a/packages/libs/kode-ui/src/patterns/SideBarLayout/SideBarLayout.stories.tsx b/packages/libs/kode-ui/src/patterns/SideBarLayout/SideBarLayout.stories.tsx index 6c6970521f..f1d5295062 100644 --- a/packages/libs/kode-ui/src/patterns/SideBarLayout/SideBarLayout.stories.tsx +++ b/packages/libs/kode-ui/src/patterns/SideBarLayout/SideBarLayout.stories.tsx @@ -103,15 +103,13 @@ const InnerLayout = () => { } - appContext={ - } - label="Mainnet" - href="javascript:void()" - /> - } navigation={ <> + } + label="Mainnet" + href="javascript:void()" + /> } label="My Wallet"> = ({ visual, @@ -24,6 +24,7 @@ export const SideBarItem: FC = ({ children, href, component, + tree, }) => { const { isExpanded, handleSetExpanded, isActiveUrl } = useLayout(); const isMediumDevice = useMedia(breakpoints.md, true); @@ -42,86 +43,39 @@ export const SideBarItem: FC = ({ handlePress(e as unknown as PressEvent); }; - const renderChildren = () => { + const render = (isExpanded: boolean) => { + const LinkWrapper = component ? component : Anchor; return ( - <> - - {children} - - - {children} - - - ); - }; - - const renderMobile = () => { - const Component = href ? Link : Button; - return ( - - {label} - - ); - }; - - const renderDeskTopNotExpanded = () => { - const Component = href ? Link : Button; - return ( - - ); - }; - - const renderDeskTopExpanded = () => { - const Component = href ? Link : Button; - return ( - - {label} - + {visual && {visual}} + {isExpanded && label} + ); }; + if (children) return children; + return (
  • - <> - {children ? ( - renderChildren() - ) : ( - <> - - {renderMobile()} - - - {!isExpanded - ? renderDeskTopNotExpanded() - : renderDeskTopExpanded()} - - - )} - + + {render(true)} + + + {render(isExpanded)} + + + {tree}
  • ); }; diff --git a/packages/libs/kode-ui/src/patterns/SideBarLayout/components/SideBarTree.tsx b/packages/libs/kode-ui/src/patterns/SideBarLayout/components/SideBarTree.tsx index ddafa91306..4ee5940cba 100644 --- a/packages/libs/kode-ui/src/patterns/SideBarLayout/components/SideBarTree.tsx +++ b/packages/libs/kode-ui/src/patterns/SideBarLayout/components/SideBarTree.tsx @@ -1,15 +1,12 @@ import type { FC } from 'react'; import React, { useEffect, useState } from 'react'; import { useMedia } from 'react-use'; -import { listItemClass } from '../sidebar.css'; -import type { PressEvent } from './../../../components/Button'; -import { Link } from './../../../components/Link'; -import { Media } from './../../../components/Media'; +import { Stack } from './../../../components'; import { breakpoints } from './../../../styles'; import { useLayout } from './LayoutProvider'; import type { ISideBarItemProps } from './SideBarItem'; +import { SideBarItem } from './SideBarItem'; import { sidebartreeListClass } from './sidebartree.css'; -import { SideBarTreeWrapper } from './SideBarTreeWrapper'; const LOCALSTORAGEKEY = 'sidemenu'; @@ -28,8 +25,6 @@ export const SideBarTree: FC = ({ visual, label, children, - href, - component, }) => { const { isExpanded, handleSetExpanded } = useLayout(); @@ -48,10 +43,14 @@ export const SideBarTree: FC = ({ setIsMounted(true); return; } - if (!isExpanded) setTreeIsExpanded(false); + if (!isExpanded) { + setTreeIsExpanded(false); + } else { + setTreeIsExpanded(getLocalStorageToggle(label)); + } }, [isExpanded]); - const toggleTree = (e: PressEvent) => { + const toggleTree = () => { if (!isExpanded) handleSetExpanded(true); const innerExpanded = !treeisExpaned; @@ -59,54 +58,17 @@ export const SideBarTree: FC = ({ setTreeIsExpanded(innerExpanded); }; - const Component = href ? Link : SideBarTreeWrapper; - return ( -
  • - <> - - - {label} - - - - {!isExpanded ? ( - - ) : ( - - {label} - - )} - - - {children && isExpanded && treeisExpaned && ( -
      {children}
    - )} - -
  • + + {children} + ) + } + > + ); }; diff --git a/packages/libs/kode-ui/src/patterns/SideBarLayout/components/SideBarTreeItem.tsx b/packages/libs/kode-ui/src/patterns/SideBarLayout/components/SideBarTreeItem.tsx index 44dd1c81c7..d542c84631 100644 --- a/packages/libs/kode-ui/src/patterns/SideBarLayout/components/SideBarTreeItem.tsx +++ b/packages/libs/kode-ui/src/patterns/SideBarLayout/components/SideBarTreeItem.tsx @@ -42,6 +42,7 @@ export const SideBarTreeItem: FC = ({ const { handleSetExpanded, isActiveUrl } = useLayout(); const isMediumDevice = useMedia(breakpoints.md, true); const handlePress: MouseEventHandler = (e) => { + console.log(22222, isMediumDevice); if (!isMediumDevice) { handleSetExpanded(false); } diff --git a/packages/libs/kode-ui/src/patterns/SideBarLayout/sidebar.css.ts b/packages/libs/kode-ui/src/patterns/SideBarLayout/sidebar.css.ts index 4fff8459bf..5190095ac8 100644 --- a/packages/libs/kode-ui/src/patterns/SideBarLayout/sidebar.css.ts +++ b/packages/libs/kode-ui/src/patterns/SideBarLayout/sidebar.css.ts @@ -170,13 +170,62 @@ export const listClass = recipe({ export const listItemClass = style([ atoms({ - display: 'flex', - flexDirection: 'column', width: '100%', }), {}, ]); +export const sidebartreeItemClass = recipe({ + base: { + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + width: '100%', + gap: token('spacing.md'), + borderRadius: token('spacing.sm'), + textDecoration: 'none', + fontSize: token('typography.fontSize.sm'), + paddingBlock: token('spacing.sm'), + cursor: 'pointer', + + selectors: { + '&:hover': { + backgroundColor: token('color.background.base.@active'), + opacity: '.8', + }, + }, + }, + variants: { + isExpanded: { + true: { + paddingInline: token('spacing.md'), + }, + false: { + justifyContent: 'center', + paddingInline: 0, + }, + }, + isActive: { + true: { + backgroundColor: token('color.background.base.@active'), + color: token('color.link.base.default'), + }, + false: { + color: token('color.text.gray.bolder'), + }, + }, + }, +}); + +globalStyle(`${sidebartreeItemClass()}[data-isactive="true"] svg`, { + color: token('color.link.base.default'), + width: '12px', +}); +globalStyle(`${sidebartreeItemClass()}[data-isactive="false"] svg`, { + color: token('color.text.gray.bolder'), + width: '12px', +}); + export const listItemInlineClass = style([ atoms({ display: 'flex', @@ -195,11 +244,11 @@ export const listNotExpandedClass = style([ }), ]); -globalStyle(`${listItemClass} button`, { - justifyContent: 'flex-start', - flex: 1, -}); -globalStyle(`${listItemClass} a`, { justifyContent: 'flex-start', flex: 1 }); +// globalStyle(`${listItemClass} button`, { +// justifyContent: 'flex-start', +// flex: 1, +// }); +// globalStyle(`${listItemClass} a`, { justifyContent: 'flex-start', flex: 1 }); export const headerWrapperClass = recipe({ base: [ diff --git a/packages/libs/kode-ui/src/patterns/SideBarLayout/utils.tsx b/packages/libs/kode-ui/src/patterns/SideBarLayout/utils.tsx new file mode 100644 index 0000000000..070fdd8e8b --- /dev/null +++ b/packages/libs/kode-ui/src/patterns/SideBarLayout/utils.tsx @@ -0,0 +1,20 @@ +import React, { forwardRef } from 'react'; +import type { IButtonProps, ILinkProps } from 'src/components'; + +export const Anchor = forwardRef( + ({ children, ...props }, ref) => ( + + {children} + + ), +); +Anchor.displayName = 'Anchor'; + +export const Button = forwardRef( + ({ children, ...props }, ref) => ( + + ), +); +Button.displayName = 'Button'; diff --git a/packages/libs/kode-ui/src/styles/tokens/contract.css.ts b/packages/libs/kode-ui/src/styles/tokens/contract.css.ts index 9f8edf719d..a72a656db2 100644 --- a/packages/libs/kode-ui/src/styles/tokens/contract.css.ts +++ b/packages/libs/kode-ui/src/styles/tokens/contract.css.ts @@ -688,6 +688,67 @@ export const tokens = createThemeContract({ */ toast: '', }, + effect: { + shadow: { + /** + * This is the shadow 1 description + * @light `"4px 0.5rem tokens.kda.foundation.size.n2 4px #000000"` + * @dark `"4px 0.5rem tokens.kda.foundation.size.n2 4px #000000"` + */ + level1: '', + /** + * This is the shadow 2 description + * @light `"4rem 4rem tokens.kda.foundation.size.n2 2rem #000000"` + * @dark `"4rem 4rem tokens.kda.foundation.size.n2 2rem #000000"` + */ + level2: '', + /** + * This is the shadow 3 description updated + * @light `"0px 0px tokens.kda.foundation.size.n2 24px #000000"` + * @dark `"0px 0px tokens.kda.foundation.size.n2 24px #000000"` + */ + level3: '', + }, + }, + icon: { + size: { + /** + * @light {@link tokens.kda.foundation.size.n3} + * @dark {@link tokens.kda.foundation.size.n3} + */ + xxs: '', + /** + * @light {@link tokens.kda.foundation.size.n4} + * @dark {@link tokens.kda.foundation.size.n4} + */ + xs: '', + /** + * @light {@link tokens.kda.foundation.size.n5} + * @dark {@link tokens.kda.foundation.size.n5} + */ + sm: '', + /** + * @light {@link tokens.kda.foundation.size.n6} + * @dark {@link tokens.kda.foundation.size.n6} + */ + base: '', + /** + * @light {@link tokens.kda.foundation.size.n8} + * @dark {@link tokens.kda.foundation.size.n8} + */ + lg: '', + /** + * @light {@link tokens.kda.foundation.size.n10} + * @dark {@link tokens.kda.foundation.size.n10} + */ + xl: '', + /** + * @light {@link tokens.kda.foundation.size.n16} + * @dark {@link tokens.kda.foundation.size.n16} + */ + xxl: '', + }, + }, color: { accent: { /** @@ -3408,12 +3469,32 @@ export const tokens = createThemeContract({ * @dark {@link tokens.kda.foundation.color.neutral.n100@alpha40} */ default: '', + /** + * @light {@link tokens.kda.foundation.color.neutral.n60} + * @dark {@link tokens.kda.foundation.color.neutral.n60} + */ + lighter: '', + /** + * @light {@link tokens.kda.foundation.color.neutral.n80} + * @dark {@link tokens.kda.foundation.color.neutral.n80} + */ + bolder: '', inverse: { /** * @light {@link tokens.kda.foundation.color.neutral.n0@alpha40} * @dark {@link tokens.kda.foundation.color.neutral.n0@alpha40} */ default: '', + /** + * @light {@link tokens.kda.foundation.color.neutral.n40} + * @dark {@link tokens.kda.foundation.color.neutral.n40} + */ + lighter: '', + /** + * @light {@link tokens.kda.foundation.color.neutral.n20} + * @dark {@link tokens.kda.foundation.color.neutral.n20} + */ + bolder: '', }, }, brand: { @@ -4940,67 +5021,6 @@ export const tokens = createThemeContract({ maxWidth: '', }, }, - effect: { - shadow: { - /** - * This is the shadow 1 description - * @light `"4px 0.5rem tokens.kda.foundation.size.n2 4px #000000"` - * @dark `"4px 0.5rem tokens.kda.foundation.size.n2 4px #000000"` - */ - level1: '', - /** - * This is the shadow 2 description - * @light `"4rem 4rem tokens.kda.foundation.size.n2 2rem #000000"` - * @dark `"4rem 4rem tokens.kda.foundation.size.n2 2rem #000000"` - */ - level2: '', - /** - * This is the shadow 3 description updated - * @light `"0px 0px tokens.kda.foundation.size.n2 24px #000000"` - * @dark `"0px 0px tokens.kda.foundation.size.n2 24px #000000"` - */ - level3: '', - }, - }, - icon: { - size: { - /** - * @light {@link tokens.kda.foundation.size.n3} - * @dark {@link tokens.kda.foundation.size.n3} - */ - xxs: '', - /** - * @light {@link tokens.kda.foundation.size.n4} - * @dark {@link tokens.kda.foundation.size.n4} - */ - xs: '', - /** - * @light {@link tokens.kda.foundation.size.n5} - * @dark {@link tokens.kda.foundation.size.n5} - */ - sm: '', - /** - * @light {@link tokens.kda.foundation.size.n6} - * @dark {@link tokens.kda.foundation.size.n6} - */ - base: '', - /** - * @light {@link tokens.kda.foundation.size.n8} - * @dark {@link tokens.kda.foundation.size.n8} - */ - lg: '', - /** - * @light {@link tokens.kda.foundation.size.n10} - * @dark {@link tokens.kda.foundation.size.n10} - */ - xl: '', - /** - * @light {@link tokens.kda.foundation.size.n16} - * @dark {@link tokens.kda.foundation.size.n16} - */ - xxl: '', - }, - }, typography: { family: { /** diff --git a/packages/libs/kode-ui/src/styles/tokens/dark.css.ts b/packages/libs/kode-ui/src/styles/tokens/dark.css.ts index f3b03e8bf5..8eaccd6f73 100644 --- a/packages/libs/kode-ui/src/styles/tokens/dark.css.ts +++ b/packages/libs/kode-ui/src/styles/tokens/dark.css.ts @@ -188,6 +188,24 @@ export const darkThemeValues = { sticky: '100', toast: '10000', }, + effect: { + shadow: { + level1: `4px 0.5rem ${tokens.kda.foundation.size.n2} 4px #000000`, + level2: `4rem 4rem ${tokens.kda.foundation.size.n2} 2rem #000000`, + level3: `0px 0px ${tokens.kda.foundation.size.n2} 24px #000000`, + }, + }, + icon: { + size: { + xxs: tokens.kda.foundation.size.n3, + xs: tokens.kda.foundation.size.n4, + sm: tokens.kda.foundation.size.n5, + base: tokens.kda.foundation.size.n6, + lg: tokens.kda.foundation.size.n8, + xl: tokens.kda.foundation.size.n10, + xxl: tokens.kda.foundation.size.n16, + }, + }, color: { accent: { blue: tokens.kda.foundation.color.palette.blue.n50, @@ -904,8 +922,12 @@ export const darkThemeValues = { }, gray: { default: tokens.kda.foundation.color.neutral['n100@alpha40'], + lighter: tokens.kda.foundation.color.neutral.n60, + bolder: tokens.kda.foundation.color.neutral.n80, inverse: { default: tokens.kda.foundation.color.neutral['n0@alpha40'], + lighter: tokens.kda.foundation.color.neutral.n40, + bolder: tokens.kda.foundation.color.neutral.n20, }, }, brand: { @@ -1292,24 +1314,6 @@ export const darkThemeValues = { maxWidth: '42.5rem', }, }, - effect: { - shadow: { - level1: `4px 0.5rem ${tokens.kda.foundation.size.n2} 4px #000000`, - level2: `4rem 4rem ${tokens.kda.foundation.size.n2} 2rem #000000`, - level3: `0px 0px ${tokens.kda.foundation.size.n2} 24px #000000`, - }, - }, - icon: { - size: { - xxs: tokens.kda.foundation.size.n3, - xs: tokens.kda.foundation.size.n4, - sm: tokens.kda.foundation.size.n5, - base: tokens.kda.foundation.size.n6, - lg: tokens.kda.foundation.size.n8, - xl: tokens.kda.foundation.size.n10, - xxl: tokens.kda.foundation.size.n16, - }, - }, typography: { family: { primaryFont: 'Inter', diff --git a/packages/libs/kode-ui/src/styles/tokens/light.css.ts b/packages/libs/kode-ui/src/styles/tokens/light.css.ts index 1ae38636fd..7963493822 100644 --- a/packages/libs/kode-ui/src/styles/tokens/light.css.ts +++ b/packages/libs/kode-ui/src/styles/tokens/light.css.ts @@ -188,6 +188,24 @@ export const lightThemeValues = { sticky: '100', toast: '10000', }, + effect: { + shadow: { + level1: `4px 0.5rem ${tokens.kda.foundation.size.n2} 4px #000000`, + level2: `4rem 4rem ${tokens.kda.foundation.size.n2} 2rem #000000`, + level3: `0px 0px ${tokens.kda.foundation.size.n2} 24px #000000`, + }, + }, + icon: { + size: { + xxs: tokens.kda.foundation.size.n3, + xs: tokens.kda.foundation.size.n4, + sm: tokens.kda.foundation.size.n5, + base: tokens.kda.foundation.size.n6, + lg: tokens.kda.foundation.size.n8, + xl: tokens.kda.foundation.size.n10, + xxl: tokens.kda.foundation.size.n16, + }, + }, color: { accent: { blue: tokens.kda.foundation.color.palette.blue.n50, @@ -904,8 +922,12 @@ export const lightThemeValues = { }, gray: { default: tokens.kda.foundation.color.neutral['n100@alpha40'], + lighter: tokens.kda.foundation.color.neutral.n60, + bolder: tokens.kda.foundation.color.neutral.n80, inverse: { default: tokens.kda.foundation.color.neutral['n0@alpha40'], + lighter: tokens.kda.foundation.color.neutral.n40, + bolder: tokens.kda.foundation.color.neutral.n20, }, }, brand: { @@ -1292,24 +1314,6 @@ export const lightThemeValues = { maxWidth: '42.5rem', }, }, - effect: { - shadow: { - level1: `4px 0.5rem ${tokens.kda.foundation.size.n2} 4px #000000`, - level2: `4rem 4rem ${tokens.kda.foundation.size.n2} 2rem #000000`, - level3: `0px 0px ${tokens.kda.foundation.size.n2} 24px #000000`, - }, - }, - icon: { - size: { - xxs: tokens.kda.foundation.size.n3, - xs: tokens.kda.foundation.size.n4, - sm: tokens.kda.foundation.size.n5, - base: tokens.kda.foundation.size.n6, - lg: tokens.kda.foundation.size.n8, - xl: tokens.kda.foundation.size.n10, - xxl: tokens.kda.foundation.size.n16, - }, - }, typography: { family: { primaryFont: 'Inter',