-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds some finishing touches to @olayway's work to allow the mobile nav to render arbitrary children which can be useful for things like site-wide navigation. Also adds some stories to demonstrate the new functionality and migrates to the Storybook NextJs 'framework' which allows the Nav component to be rendered in a story with all the routing automatically stubbed and taken care of.
- Loading branch information
1 parent
f7f03fd
commit 7b38ce1
Showing
6 changed files
with
7,034 additions
and
3,327 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,160 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import React from 'react'; | ||
|
||
import { NavTitle } from './NavTitle'; | ||
import { Nav } from './Nav'; | ||
import { SiteToc } from '../SiteToc'; | ||
|
||
const meta: Meta<typeof NavTitle> = { | ||
component: NavTitle, | ||
tags: ['autodocs'], | ||
const meta: Meta<typeof Nav> = { | ||
component: Nav, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof NavTitle>; | ||
type Story = StoryObj<typeof Nav>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
title: 'Title', | ||
logo: 'https://via.placeholder.com/50', | ||
}, | ||
args: { | ||
title: 'Title', | ||
logo: 'https://via.placeholder.com/50', | ||
}, | ||
}; | ||
|
||
export const WithVersion: Story = { | ||
args: { | ||
title: 'Title', | ||
logo: 'https://via.placeholder.com/50', | ||
version: 'Alpha', | ||
export const MobileWithChildren: Story = { | ||
parameters: { | ||
viewport: { | ||
defaultViewport: 'mobile1', | ||
}, | ||
}, | ||
args: { | ||
title: 'Title', | ||
logo: 'https://via.placeholder.com/50', | ||
links: [ | ||
{ | ||
name: 'Home', | ||
href: '/', | ||
}, | ||
{ | ||
name: 'About', | ||
href: '/about', | ||
}, | ||
{ | ||
name: 'Blog', | ||
href: '/blog', | ||
}, | ||
], | ||
children: <SiteToc currentPath="about" nav={getNav()} />, | ||
}, | ||
}; | ||
|
||
function getNav() { | ||
return [ | ||
{ | ||
name: 'about', | ||
href: 'about', | ||
}, | ||
{ | ||
name: 'page2', | ||
href: 'page2', | ||
}, | ||
{ | ||
name: 'page3', | ||
href: 'page3', | ||
}, | ||
{ | ||
name: 'page4', | ||
href: 'page4', | ||
}, | ||
{ | ||
name: 'page5', | ||
href: 'page5', | ||
}, | ||
{ | ||
name: 'page6', | ||
href: 'page6', | ||
}, | ||
{ | ||
name: 'page7', | ||
href: 'page7', | ||
}, | ||
{ | ||
name: 'page8', | ||
href: 'page8', | ||
}, | ||
{ | ||
name: 'page9', | ||
href: 'page9', | ||
}, | ||
{ | ||
name: 'Blog', | ||
path: 'blog', | ||
level: 0, | ||
children: [ | ||
{ | ||
name: 'My SEO blog post fail', | ||
href: 'blog/blog-post-fail', | ||
}, | ||
{ | ||
name: 'Schedule Your Social marketing', | ||
href: 'blog/schedule-your-social-marketing', | ||
}, | ||
], | ||
}, | ||
{ | ||
name: 'Dev', | ||
path: 'dev', | ||
level: 0, | ||
children: [ | ||
{ | ||
name: 'columns-vs-flex-vs-grid', | ||
href: 'dev/columns-vs-flex-vs-grid', | ||
}, | ||
{ | ||
name: 'how-to-test-web-apps', | ||
href: 'dev/how-to-test-web-apps', | ||
}, | ||
{ | ||
name: 'instance-type', | ||
href: 'dev/instance-type', | ||
}, | ||
], | ||
}, | ||
{ | ||
name: 'Marketing', | ||
path: 'marketing', | ||
level: 0, | ||
children: [ | ||
{ | ||
name: 'seo', | ||
href: 'marketing/seo', | ||
}, | ||
], | ||
}, | ||
{ | ||
name: 'Productivity', | ||
path: 'productivity', | ||
level: 0, | ||
children: [ | ||
{ | ||
name: 'effective-macos-task-management', | ||
href: 'productivity/effective-macos-task-management', | ||
}, | ||
{ | ||
name: 'productivity-system', | ||
href: 'productivity/productivity-system', | ||
}, | ||
], | ||
}, | ||
{ | ||
name: 'Tech', | ||
path: 'tech', | ||
level: 0, | ||
children: [ | ||
{ | ||
name: 'roll-your-own-personal-backups', | ||
href: 'tech/roll-your-own-personal-backups', | ||
}, | ||
], | ||
}, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { NavTitle } from './NavTitle'; | ||
|
||
const meta: Meta<typeof NavTitle> = { | ||
component: NavTitle, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof NavTitle>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
title: 'Title', | ||
logo: 'https://via.placeholder.com/50', | ||
}, | ||
}; | ||
|
||
export const WithVersion: Story = { | ||
args: { | ||
title: 'Title', | ||
logo: 'https://via.placeholder.com/50', | ||
version: 'Alpha', | ||
}, | ||
}; |