Skip to content

Commit

Permalink
breadcrumbs with a network badge
Browse files Browse the repository at this point in the history
  • Loading branch information
sstraatemans committed Nov 7, 2024
1 parent 780e1b7 commit 3e03fab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IBreadcrumbsProps } from '@kadena/kode-ui';
import { useWallet } from '@/modules/wallet/wallet.hook';
import { Badge, IBreadcrumbsProps } from '@kadena/kode-ui';
import { SideBarBreadcrumbs as SideBarBreadcrumbsUI } from '@kadena/kode-ui/patterns';
import React, { FC } from 'react';
import { Link } from 'react-router-dom';
Expand All @@ -7,14 +8,19 @@ export const SideBarBreadcrumbs: FC<IBreadcrumbsProps> = ({
children,
...props
}) => {
const { activeNetwork } = useWallet();

return (
<SideBarBreadcrumbsUI {...props}>
{React.Children.map(children, (child) => {
if (!React.isValidElement(child)) {
return null;
}
return React.cloneElement(child, { ...child.props, component: Link });
})}
<>
<Badge size="sm" style="highContrast">{`${activeNetwork?.name}`}</Badge>
{React.Children.map(children, (child) => {
if (!React.isValidElement(child)) {
return null;
}
return React.cloneElement(child, { ...child.props, component: Link });
})}
</>
</SideBarBreadcrumbsUI>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,4 @@ export const navClass = style([

globalStyle(`${navClass} svg`, {
width: '20px',
color: token('color.text.gray.default'),
});

0 comments on commit 3e03fab

Please sign in to comment.