File tree Expand file tree Collapse file tree
packages/ui-components/src/Containers/NavBar Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939 }
4040
4141 . sidebarItemTogglerLabel {
42- @apply block
42+ @apply ml-auto
43+ block
4344 cursor-pointer
44- xl:hidden;
45-
46- . navInteractionIcon {
47- @apply size-6;
48- }
45+ xl:hidden; /* Push toggler to the right if Logo exists */
4946 }
5047 }
5148
49+ . navInteractionIcon {
50+ @apply size-6;
51+ }
52+
5253 . sidebarItemToggler {
5354 @apply absolute
5455 right-4
6263 . main {
6364 @apply flex-1
6465 flex-col
65- justify-between
6666 gap-4
6767 xl:flex
6868 xl:flex-row
69- xl:items-center;
69+ xl:items-center
70+ xl:justify-between;
7071 }
7172
7273 . navItems {
8687
8788 . actionsWrapper {
8889 @apply flex
90+ w-full
8991 flex-row
9092 flex-wrap
9193 items-center
9597 border-neutral-200
9698 p-4
9799 sm:flex-nowrap
100+ xl:ml-auto
98101 xl:basis-96
99102 xl:border-0
100103 xl:p-0
Original file line number Diff line number Diff line change 1+ import Logo from '#ui/Common/NodejsLogo' ;
2+ import SearchModal from '#ui/Common/Search/Modal' ;
13import NavBar from '#ui/Containers/NavBar' ;
24
35import type { Meta as MetaObj , StoryObj } from '@storybook/react-webpack5' ;
46
57type Story = StoryObj < typeof NavBar > ;
68type Meta = MetaObj < typeof NavBar > ;
79
8- const common = {
9- as : 'a' ,
10- Logo : 'a' ,
11- pathname : '/' ,
10+ export const Default : Story = {
11+ args : {
12+ as : 'a' ,
13+ Logo,
14+ pathname : '/' ,
15+ children : < SearchModal client = { null } placeholder = "Search the docs..." /> ,
16+ navItems : [
17+ {
18+ text : 'Learn' ,
19+ link : '/' ,
20+ } ,
21+ {
22+ text : 'About' ,
23+ link : '/about' ,
24+ } ,
25+ {
26+ text : 'Docs' ,
27+ link : '/docs' ,
28+ } ,
29+ {
30+ text : 'Download' ,
31+ link : '/download' ,
32+ } ,
33+ {
34+ text : 'Blog' ,
35+ link : '/blog' ,
36+ } ,
37+ {
38+ text : 'Certification' ,
39+ link : 'https://openjsf.org/certification' ,
40+ } ,
41+ ] ,
42+ } ,
43+ } ;
1244
13- children : < a > Some other child</ a > ,
14- } as const ;
45+ export const NoNavItems : Story = {
46+ args : {
47+ as : 'a' ,
48+ Logo,
49+ pathname : '/' ,
50+ children : < SearchModal client = { null } placeholder = "Search the docs..." /> ,
51+ } ,
52+ } ;
1553
16- export const Default : Story = {
54+ export const NoLogo : Story = {
1755 args : {
18- ...common ,
56+ as : 'a' ,
57+ pathname : '/' ,
58+ children : < SearchModal client = { null } placeholder = "Search the docs..." /> ,
1959 navItems : [
2060 {
2161 text : 'Learn' ,
@@ -45,6 +85,12 @@ export const Default: Story = {
4585 } ,
4686} ;
4787
48- export const NoNavItems : Story = { args : common } ;
88+ export const NoLogoNoNavItems : Story = {
89+ args : {
90+ as : 'a' ,
91+ pathname : '/' ,
92+ children : < SearchModal client = { null } placeholder = "Search the docs..." /> ,
93+ } ,
94+ } ;
4995
5096export default { component : NavBar } as Meta ;
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ type NavbarProps = {
3939 link : string ;
4040 target ?: HTMLAttributeAnchorTarget | undefined ;
4141 } > ;
42- Logo : ElementType ;
42+ Logo ? : ElementType ;
4343 as : LinkLike ;
4444 pathname : string ;
4545 sidebarItemTogglerAriaLabel : string ;
@@ -61,13 +61,15 @@ const NavBar: FC<PropsWithChildren<NavbarProps>> = ({
6161 < nav className = { styles . container } >
6262 < div className = { styles . innerContainer } >
6363 < div className = { styles . nodeIconAndMobileItemsToggler } >
64- < Component
65- className = { styles . nodeIconWrapper }
66- href = "/"
67- aria-label = "Home"
68- >
69- < Logo />
70- </ Component >
64+ { Logo && (
65+ < Component
66+ className = { styles . nodeIconWrapper }
67+ href = "/"
68+ aria-label = "Home"
69+ >
70+ < Logo />
71+ </ Component >
72+ ) }
7173
7274 < Label . Root
7375 className = { styles . sidebarItemTogglerLabel }
You can’t perform that action at this time.
0 commit comments