Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ui-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-core/ui-components",
"version": "1.4.3",
"version": "1.4.4",
"type": "module",
"exports": {
"./*": [
Expand Down
17 changes: 11 additions & 6 deletions packages/ui-components/src/Containers/NavBar/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import type { Meta as MetaObj, StoryObj } from '@storybook/react-webpack5';
type Story = StoryObj<typeof NavBar>;
type Meta = MetaObj<typeof NavBar>;

export const Default: Story = {
args: {
as: 'a',
Logo: 'a',
pathname: '/',
const common = {
as: 'a',
Logo: 'a',
pathname: '/',

children: <a>Some other child</a>,
children: <a>Some other child</a>,
} as const;

export const Default: Story = {
args: {
...common,
navItems: [
{
text: 'Learn',
Expand Down Expand Up @@ -42,4 +45,6 @@ export const Default: Story = {
},
};

export const NoNavItems: Story = { args: common };

export default { component: NavBar } as Meta;
35 changes: 18 additions & 17 deletions packages/ui-components/src/Containers/NavBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const navInteractionIcons = {
};

type NavbarProps = {
navItems: Array<{
navItems?: Array<{
text: FormattedMessage;
link: string;
target?: HTMLAttributeAnchorTarget | undefined;
Expand Down Expand Up @@ -61,29 +61,30 @@ const NavBar: FC<PropsWithChildren<NavbarProps>> = ({
</div>

<input
className={classNames(['peer', style.sidebarItemToggler])}
className={classNames('peer', style.sidebarItemToggler)}
id="sidebarItemToggler"
type="checkbox"
onChange={e => setIsMenuOpen(() => e.target.checked)}
aria-label={sidebarItemTogglerAriaLabel}
tabIndex={-1}
/>

<div className={`${style.main} hidden peer-checked:flex`}>
<div className={style.navItems}>
{navItems.map(({ text, link, target }) => (
<NavItem
pathname={pathname}
as={Component}
key={link}
href={link}
target={target}
>
{text}
</NavItem>
))}
</div>

<div className={classNames(style.main, `hidden peer-checked:flex`)}>
{navItems && (
<div className={style.navItems}>
{navItems.map(({ text, link, target }) => (
<NavItem
pathname={pathname}
as={Component}
key={link}
href={link}
target={target}
>
{text}
</NavItem>
))}
</div>
)}
<div className={style.actionsWrapper}>{children}</div>
</div>
</nav>
Expand Down
Loading