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
7 changes: 7 additions & 0 deletions .changeset/cool-balloons-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/gatsby-theme-doctocat': patch
---

- Move the heading out of the sidebar Navigation. This fixes the extra divider on top of the navigation.
- Remove extra space below the heading when there's no status or external links
- Remove extra space when there's no Breadcrumbs
140 changes: 70 additions & 70 deletions theme/src/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,77 +107,77 @@ function Layout({children, pageContext, path}) {
) : null}
<Box sx={{width: '100%', maxWidth: '960px'}}>
<Box as="main" id="skip-nav" sx={{mb: 4}}>
<Breadcrumbs sx={{mb: 4}}>
{breadcrumbData.length > 1
? breadcrumbData.map(item => (
<Breadcrumbs.Item key={item.url} href={item.url} selected={path === item.url}>
{item.title}
</Breadcrumbs.Item>
))
: null}
</Breadcrumbs>
<Box sx={{alignItems: 'center', display: 'flex'}}>
<Heading as="h1" sx={{fontSize: 7}}>
{title}
</Heading>
</Box>
{breadcrumbData.length > 1 ? (
<Breadcrumbs sx={{mb: 4}}>
{breadcrumbData.map(item => (
<Breadcrumbs.Item key={item.url} href={item.url} selected={path === item.url}>
{item.title}
</Breadcrumbs.Item>
))}
</Breadcrumbs>
) : null}
<Heading as="h1" sx={{fontSize: 7}}>
{title}
</Heading>
{description ? <Box sx={{fontSize: 3, mb: 3}}>{description}</Box> : null}
<Box
sx={{
display: 'flex',
flexWrap: 'wrap',
columnGap: 3,
mb: 7,
mt: 2,
rowGap: 3,
alignItems: 'center',
fontSize: 1
}}
>
{status ? (
<Box
as={'ul'}
sx={{
display: 'flex',
gap: 1,
alignItems: 'center',
m: 0,
p: 0,
paddingInline: 0,
listStyle: 'none'
}}
>
<li>
<StatusLabel status={status} />
</li>
<li>
<AccessibilityLabel a11yReviewed={a11yReviewed} />
</li>
</Box>
) : null}
{source || storybook || lookbook || figma || rails || react ? (
<Box
as={'ul'}
sx={{
display: 'flex',
flexWrap: 'wrap',
gap: 4,
alignItems: 'center',
m: 0,
p: 0,
paddingInline: 0,
listStyle: 'none'
}}
>
{source ? <SourceLink href={source} /> : null}
{lookbook ? <LookbookLink href={lookbook} /> : null}
{storybook ? <StorybookLink href={storybook} /> : null}
{react ? <ReactLink href={react} /> : null}
{rails ? <RailsLink href={rails} /> : null}
{figma ? <FigmaLink href={figma} /> : null}
</Box>
) : null}
</Box>
{status || source || storybook || lookbook || figma || rails || react ? (
<Box
sx={{
display: 'flex',
flexWrap: 'wrap',
columnGap: 3,
mb: 7,
mt: 2,
rowGap: 3,
alignItems: 'center',
fontSize: 1
}}
>
{status ? (
<Box
as={'ul'}
sx={{
display: 'flex',
gap: 1,
alignItems: 'center',
m: 0,
p: 0,
paddingInline: 0,
listStyle: 'none'
}}
>
<li>
<StatusLabel status={status} />
</li>
<li>
<AccessibilityLabel a11yReviewed={a11yReviewed} />
</li>
</Box>
) : null}
{source || storybook || lookbook || figma || rails || react ? (
<Box
as={'ul'}
sx={{
display: 'flex',
flexWrap: 'wrap',
gap: 4,
alignItems: 'center',
m: 0,
p: 0,
paddingInline: 0,
listStyle: 'none'
}}
>
{source ? <SourceLink href={source} /> : null}
{lookbook ? <LookbookLink href={lookbook} /> : null}
{storybook ? <StorybookLink href={storybook} /> : null}
{react ? <ReactLink href={react} /> : null}
{rails ? <RailsLink href={rails} /> : null}
{figma ? <FigmaLink href={figma} /> : null}
</Box>
) : null}
</Box>
) : null}
</Box>
{pageContext.tableOfContents.items ? (
<Box
Expand Down
6 changes: 3 additions & 3 deletions theme/src/components/nav-items.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ function NavItem({href, children}) {
function NavItems({items}) {
return (
<>
<VisuallyHidden>
<h3>Site navigation</h3>
</VisuallyHidden>
<NavList aria-label="Site">
<VisuallyHidden>
<h3>Site navigation</h3>
</VisuallyHidden>
{items.map(item => (
<React.Fragment key={item.title}>
{item.children ? (
Expand Down