-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Add side nav, dabble in mobile responsiveness (#857)
- Loading branch information
Showing
18 changed files
with
682 additions
and
43 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -2,5 +2,6 @@ module.exports = { | |
plugins: { | ||
'postcss-import': {}, | ||
'@tailwindcss/postcss': {}, | ||
'postcss-custom-media': {}, | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@import 'docs/src/breakpoints.css'; | ||
|
||
@layer components { | ||
.SidebarLayoutRoot { | ||
--sidebar-width: 17.5rem; | ||
|
||
display: grid; | ||
align-items: start; | ||
padding: 0 3rem; | ||
grid-template-columns: 1fr; | ||
|
||
@media (--show-side-nav) { | ||
padding: 0; | ||
grid-template-columns: var(--sidebar-width) 1fr; | ||
} | ||
|
||
@media (--show-quick-nav) { | ||
grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width); | ||
} | ||
} | ||
|
||
.SidebarLayoutMain { | ||
padding-top: 3rem; | ||
padding-bottom: 5rem; | ||
min-width: 0; | ||
margin: 0 auto; | ||
|
||
@media (--show-side-nav) { | ||
margin-left: 0; | ||
margin-right: 3rem; | ||
} | ||
|
||
@media (--show-quick-nav) { | ||
margin: 0; | ||
} | ||
} | ||
} |
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,9 +1,163 @@ | ||
import * as React from 'react'; | ||
import * as SideNav from 'docs/src/components/SideNav'; | ||
import * as QuickNav from 'docs/src/components/quick-nav/QuickNav'; | ||
import './layout.css'; | ||
|
||
export default function Layout({ children }: React.PropsWithChildren) { | ||
return ( | ||
<div className="px-8 pt-12 pb-20"> | ||
<div className="relative mx-auto max-w-[768px]">{children}</div> | ||
<div className="SidebarLayoutRoot"> | ||
<SideNav.Root> | ||
{nav.map((section) => ( | ||
<SideNav.Section key={section.label}> | ||
<SideNav.Heading>{section.label}</SideNav.Heading> | ||
<SideNav.List> | ||
{section.links.map((link) => ( | ||
<SideNav.Item key={link.href} href={link.href}> | ||
{link.label} | ||
</SideNav.Item> | ||
))} | ||
</SideNav.List> | ||
</SideNav.Section> | ||
))} | ||
</SideNav.Root> | ||
|
||
<main className="SidebarLayoutMain"> | ||
<QuickNav.Container>{children}</QuickNav.Container> | ||
</main> | ||
</div> | ||
); | ||
} | ||
|
||
const nav = [ | ||
{ | ||
label: 'Overview', | ||
links: [ | ||
{ | ||
label: 'Quick start', | ||
href: '/new/overview/quick-start', | ||
}, | ||
{ | ||
label: 'Accessibility', | ||
href: '/new/overview/accessibility', | ||
}, | ||
{ | ||
label: 'Releases', | ||
href: '/new/overview/releases', | ||
}, | ||
{ | ||
label: 'About', | ||
href: '/new/overview/about', | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'Handbook', | ||
links: [ | ||
{ | ||
label: 'Styling', | ||
href: '/new/handbook/styling', | ||
}, | ||
{ | ||
label: 'Animation', | ||
href: '/new/handbook/animation', | ||
}, | ||
{ | ||
label: 'Composition', | ||
href: '/new/handbook/composition', | ||
}, | ||
{ | ||
label: 'Migrating from Radix', | ||
href: '/new/handbook/migrating-from-radix', | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'Components', | ||
links: [ | ||
{ | ||
label: 'Alert Dialog', | ||
href: '/new/components/alert-dialog', | ||
}, | ||
{ | ||
label: 'Checkbox', | ||
href: '/new/components/checkbox', | ||
}, | ||
{ | ||
label: 'Checkbox Group', | ||
href: '/new/components/checkbox group', | ||
}, | ||
{ | ||
label: 'Collapsible', | ||
href: '/new/components/collapsible', | ||
}, | ||
{ | ||
label: 'Combobox', | ||
href: '/new/components/combobox', | ||
}, | ||
{ | ||
label: 'Datepicker', | ||
href: '/new/components/datepicker', | ||
}, | ||
{ | ||
label: 'Dialog', | ||
href: '/new/components/dialog', | ||
}, | ||
{ | ||
label: 'Field', | ||
href: '/new/components/field', | ||
}, | ||
{ | ||
label: 'Fieldset', | ||
href: '/new/components/fieldset', | ||
}, | ||
{ | ||
label: 'Form', | ||
href: '/new/components/form', | ||
}, | ||
{ | ||
label: 'Menu', | ||
href: '/new/components/menu', | ||
}, | ||
{ | ||
label: 'Number Field', | ||
href: '/new/components/number-field', | ||
}, | ||
{ | ||
label: 'Popover', | ||
href: '/new/components/popover', | ||
}, | ||
{ | ||
label: 'Preview Card', | ||
href: '/new/components/preview-card', | ||
}, | ||
{ | ||
label: 'Progress', | ||
href: '/new/components/progress', | ||
}, | ||
{ | ||
label: 'Radio Group', | ||
href: '/new/components/radio-group', | ||
}, | ||
{ | ||
label: 'Separator', | ||
href: '/new/components/separator', | ||
}, | ||
{ | ||
label: 'Slider', | ||
href: '/new/components/slider', | ||
}, | ||
{ | ||
label: 'Switch', | ||
href: '/new/components/switch', | ||
}, | ||
{ | ||
label: 'Tabs', | ||
href: '/new/components/tabs', | ||
}, | ||
{ | ||
label: 'Tooltip', | ||
href: '/new/components/tooltip', | ||
}, | ||
], | ||
}, | ||
]; |
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,17 +1,90 @@ | ||
html { | ||
color-scheme: light dark; | ||
@import 'docs/src/breakpoints.css'; | ||
|
||
/* macOS overscroll background */ | ||
background-color: #000; | ||
} | ||
@layer base { | ||
html { | ||
color-scheme: light dark; | ||
|
||
/* macOS overscroll background */ | ||
background-color: var(--color-gray-50); | ||
} | ||
|
||
body { | ||
min-width: 360px; | ||
line-height: 1.5; | ||
background-color: var(--color-background); | ||
color: var(--color-foreground); | ||
} | ||
|
||
body { | ||
min-width: 360px; | ||
line-height: 1.5; | ||
background-color: var(--color-background); | ||
color: var(--color-foreground); | ||
::selection { | ||
background-color: var(--color-selection); | ||
} | ||
} | ||
|
||
::selection { | ||
background-color: var(--color-selection); | ||
@layer components { | ||
.RootLayout { | ||
/* Padding starts with 2rem, and climbs up to 3rem between 640px and 960px */ | ||
--root-layout-padding-x: round(clamp(2rem, 5vw, 3rem), 1px); | ||
|
||
z-index: 0; | ||
position: relative; | ||
padding-inline: var(--root-layout-padding-x); | ||
|
||
&::before, | ||
&::after { | ||
content: ''; | ||
position: absolute; | ||
background-color: var(--color-gridline); | ||
height: 1px; | ||
right: 0; | ||
left: 0; | ||
} | ||
|
||
&::before { | ||
top: 3rem; | ||
margin-top: -1px; | ||
} | ||
|
||
&::after { | ||
bottom: 3rem; | ||
margin-bottom: -1px; | ||
} | ||
} | ||
|
||
.RootLayoutContainer { | ||
position: relative; | ||
display: flex; | ||
margin-inline: auto; | ||
min-height: 100dvh; | ||
max-width: calc(var(--breakpoint-max-layout-width) - var(--root-layout-padding-x) * 2); | ||
flex-direction: column; | ||
padding-top: 3rem; | ||
padding-bottom: 3rem; | ||
|
||
&::before, | ||
&::after { | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
width: 1px; | ||
background-color: var(--color-gridline); | ||
} | ||
|
||
&::before { | ||
left: 0; | ||
margin-left: -1px; | ||
} | ||
|
||
&::after { | ||
right: 0; | ||
margin-right: -1px; | ||
} | ||
} | ||
|
||
.RootLayoutContent { | ||
display: flex; | ||
flex-grow: 1; | ||
flex-direction: column; | ||
background-color: var(--color-content); | ||
} | ||
} |
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
Oops, something went wrong.