Skip to content

Commit

Permalink
chore(@clayui/core): LPD-40160 Add storybook example of CMS Product M…
Browse files Browse the repository at this point in the history
…enu in VerticalNav
  • Loading branch information
pat270 committed Nov 27, 2024
1 parent 80bc139 commit 9514573
Showing 1 changed file with 148 additions and 0 deletions.
148 changes: 148 additions & 0 deletions packages/clay-core/stories/VerticalNav.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import Button from '@clayui/button';
import React, {useState} from 'react';

Check failure on line 7 in packages/clay-core/stories/VerticalNav.stories.tsx

View workflow job for this annotation

GitHub Actions / test

imports must be sorted by module name (expected: "@clayui/button" << "@clayui/icon" << "@clayui/link" << "react")

import ClayButton, {ClayButtonWithIcon} from '@clayui/button';

Check failure on line 9 in packages/clay-core/stories/VerticalNav.stories.tsx

View workflow job for this annotation

GitHub Actions / test

modules must be imported only once (duplicate import: "@clayui/button")

Check failure on line 9 in packages/clay-core/stories/VerticalNav.stories.tsx

View workflow job for this annotation

GitHub Actions / test

imports must be grouped (unexpected blank line before: "@clayui/button")

Check failure on line 9 in packages/clay-core/stories/VerticalNav.stories.tsx

View workflow job for this annotation

GitHub Actions / test

'ClayButton' is defined but never used. Allowed unused vars must match /^_/u
import ClayIcon from '@clayui/icon';
import ClayLink from '@clayui/link';

Check failure on line 11 in packages/clay-core/stories/VerticalNav.stories.tsx

View workflow job for this annotation

GitHub Actions / test

'ClayLink' is defined but never used. Allowed unused vars must match /^_/u

import {VerticalNav} from '../src';

type Item = {
Expand Down Expand Up @@ -434,6 +438,109 @@ const items_long = [
},
];

const items_cms_product_menu = [
{
href: '#home',
icon: 'home',
label: 'Home',
},
{
href: '#analytics',
icon: 'analytics',
label: 'Analytics',
},
{
itemClass: 'mt-3',
items: [
{
href: '#all',
icon: 'sheets',
label: 'All',
},
{
href: '#content',
icon: 'catalog',
label: 'Content',
},
{
href: '#files',
icon: 'documents-and-media',
label: 'Files',
},
],
label: 'Assets',
},
{
href: '#shared-with-me',
icon: 'users',
itemClass: 'mt-3',
label: 'Shared With Me',
},
{
itemClass: 'mt-3',
items: [
{
href: '#structures',
icon: 'edit-layout',
label: 'Structures',
},
{
href: '#collections',
icon: 'books',
label: 'Collections',
},
{
href: '#categorization',
icon: 'vocabulary',
label: 'Categorization',
},
{
href: '#workflow',
icon: 'workflow',
label: 'Workflow',
},
],
label: 'Admin',
},
{
itemClass: 'mt-3',
items: [
{
href: '#marketing',
label: 'Marketing',
sticker: {
displayType: 'danger',
label: 'M',
},
},
{
href: '#campaigns',
label: 'Campaigns',
sticker: {
displaytype: 'primary',
label: 'C',
},
},
{
href: '#all-spaces',
icon: 'box-container',
label: 'All Spaces',
},
],
label: 'Spaces',
plusButton: {
ariaLabel: 'New Space',
title: 'New Space',
},
},
{
href: '#recycle-bin',
icon: 'trash',
itemClass: 'mt-3',
label: 'Recycle Bin',
},
] as Array<Item>;

export default {
title: 'Design System/Components/VerticalNav',
};
Expand Down Expand Up @@ -485,3 +592,44 @@ export const ControlledExpandedKeys = () => {
</>
);
};

export const Primary = () => {
return (
<VerticalNav
active="Home"
displayType="primary"
items={items_cms_product_menu}
>
{(item) => (
<VerticalNav.Item
href={item.href}
items={item.items}
key={item.label}
>
<div className="autofit-row">
{item.icon && (
<div className="autofit-col">
<ClayIcon symbol={item.icon} />
</div>
)}
<div className="autofit-col autofit-col-expand">
{item.label}
</div>
{item.plusButton && (
<div className="autofit-col">
<ClayButtonWithIcon
aria-label={item.plusButton.ariaLabel}
displayType="secondary"
monospaced
size="xs"
symbol="plus"
title={item.plusButton.title}
/>
</div>
)}
</div>
</VerticalNav.Item>
)}
</VerticalNav>
);
};

0 comments on commit 9514573

Please sign in to comment.