Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE YET] Match header to new docs #790

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions apps/docs/content/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {LinkExternalIcon} from '@primer/octicons-react'

<PRCBox
sx={{
p: 5,
mt: 5,
}}
>
<Heading as="h4">Primer Brand</Heading>
<Text as="p">Read the installation instructions to get started.</Text>
<Text as="p" size="300">
Read the installation instructions to get started.
</Text>
<PRCBox
sx={{
mt: 4,
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const path = require('path')

module.exports = {
siteMetadata: {
title: 'Primer Brand',
title: 'Primer Brand UI',
header: {
title: 'Primer Design System',
title: 'Primer Brand UI',
},
shortName: '',
description: 'React components for GitHub marketing pages',
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/scripts/components-with-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ export const supportedComponents = [
'Button',
'ComparisonTable',
'FAQ',
'Image',
'Heading',
'Image',
'Label',
'Pillar',
'SectionIntro',
'Stack',
'Statistic',
'Testimonial',
'Text',
'Statistic',
'Timeline',
'Animate',
'RiverBreakout',
'River',
'RiverBreakout',
]
22 changes: 22 additions & 0 deletions apps/docs/src/@primer/gatsby-theme-doctocat/components/header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import styles from './header.module.css'
import {MarkGithubIcon} from '@primer/octicons-react'
import {Navigation} from '../../../components/navigation/navigation'
import {SidePanel} from '../../../components/side-panel/side-panel'

export const HEADER_HEIGHT = 56

export default function Header() {
return (
<header className={styles.PageHeader}>
<a href="https://primer.style/" className={styles.SiteTitle}>
<MarkGithubIcon size={24} />
<span className={styles.Title}>Primer</span>
</a>
<Navigation />
<div className={styles.SidePanel}>
<SidePanel />
</div>
</header>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.PageHeader {
position: sticky;
top: 0;
width: 100%;
display: flex;
align-items: center;
padding: var(--base-size-16) var(--base-size-24) var(--base-size-16)
var(--base-size-24);
border-bottom: 1px solid var(--borderColor-default, #d1d9e0);
background: var(--brand-color-canvas-default);
z-index: 1;
}

.SiteTitle {
display: flex;
gap: var(--base-size-8);
align-items: center;
text-decoration: none;
}

.SiteTitle svg {
fill: var(--brand-color-text-default);
}

.Title {
display: inline-block;
font-size: var(--text-body-size-large);
font-weight: var(--base-text-weight-semibold);
color: var(--fgColor-default, #1f2328);
font-family: var(--brand-fontStack-sansSerif);
}

.SidePanel {
display: none;
margin-left: auto;
}

@media (max-width: 768px) {
.PageHeader {
padding: var(--base-size-16);
}

.SidePanel {
display: block;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react'
import {Head, Header, Hero, Sidebar} from '@primer/gatsby-theme-doctocat'
import PageFooter from '@primer/gatsby-theme-doctocat/src/components/page-footer'
import {Stack} from '@primer/react-brand'
import styles from './hero-layout.module.css'

function HeroLayout({children, pageContext}) {
let {additionalContributors} = pageContext.frontmatter

if (!additionalContributors) {
additionalContributors = []
}

return (
<div className={styles.HeroPageWrapper}>
<Head />
<Header />
<div className={styles.HeroLayoutWrapper}>
<div className={styles.HeroLayoutSidebarWrapper}>
<Sidebar />
</div>
<main id="skip-nav" className={styles.HeroLayoutMain}>
<div className={styles.LandingPageLayout}>
<Stack gap={{narrow: 'spacious', regular: 'normal'}}>
<Hero />
{children}
<PageFooter
editUrl={pageContext.editUrl}
contributors={pageContext.contributors.concat(
additionalContributors.map((login) => ({login})),
)}
/>
</Stack>
</div>
</main>
</div>
</div>
)
}

export default HeroLayout
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.HeroPageWrapper {
flex-direction: column;
min-height: 100vh;
display: flex;
}

.HeroLayoutWrapper {
display: flex;
flex: 1 1 auto;
flex-direction: row;
}

.HeroLayoutSidebarWrapper {
display: block;

@media screen and (max-width: 64rem) {
display: none;
}
}

.HeroLayoutMain {
padding: var(--base-size-24);
width: 100%;
@media screen and (max-width: 48rem) {
padding-bottom: 0;
}
}

.LandingPageLayout {
max-width: 1340px;
margin: 0 auto;
width: 100%;
}
58 changes: 26 additions & 32 deletions apps/docs/src/@primer/gatsby-theme-doctocat/components/hero.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
import {Box as PRCBox, Heading, Text, ThemeProvider} from '@primer/react'
import React from 'react'
import {Container} from '@primer/gatsby-theme-doctocat'
import heroIllustration from '../primer-components-hero.svg'
import {version} from '../../../../../../packages/react/package'
import {Heading, Stack, Text} from '@primer/react-brand'
import styles from './hero.module.css'

export default function Hero() {
return (
<ThemeProvider colorMode="night" nightScheme="dark_dimmed">
<PRCBox bg="canvas.default" py={6}>
<Container>
<Heading
sx={{
color: 'accent.fg',
fontSize: 7,
lineHeight: 'condensed',
pb: 3,
m: 0,
}}
>
Primer Brand
</Heading>
<Text
as="p"
fontFamily="mono"
mt={0}
mb={2}
color="fg.muted"
fontSize={2}
>
v{version}
</Text>
<img src={heroIllustration} alt="" width="100%" />
</Container>
</PRCBox>
</ThemeProvider>
<Stack
padding="none"
gap="spacious"
direction="horizontal"
alignItems="center"
justifyContent="space-between"
>
<Stack gap="normal" padding="none">
<Heading as="h2" size="3">
Primer Brand UI
</Heading>
<Text as="p" variant="muted" size="300">
Primer Brand is a GitHub's design system for creating React-based
marketing websites and digital experiences.
</Text>
</Stack>
<div className={styles.HeroImage}>
<img
width="256"
alt="Mona"
src="https://github.com/user-attachments/assets/e9a4d7f8-8e61-4f45-a1a7-466848df6dda"
/>
</div>
</Stack>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.HeroImage {
flex-shrink: 0;
@media screen and (max-width: 64rem) {
display: none;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import {NavList} from '@primer/react/drafts'
import {useLocation} from '@reach/router'
import {Link as GatsbyLink, withPrefix} from 'gatsby'
import React from 'react'
import VisuallyHidden from '@primer/gatsby-theme-doctocat/src/components/visually-hidden'

function NavItem({href, children}) {
const location = useLocation()
const isCurrent = withPrefix(href) === location.pathname
return (
<NavList.Item
as={GatsbyLink}
to={href}
aria-current={isCurrent ? 'page' : null}
>
{children}
</NavList.Item>
)
}

function NavItems({items}) {
return (
<>
<VisuallyHidden>
<h3>Site navigation</h3>
</VisuallyHidden>
<NavList aria-label="Site">
{items.map((item) => (
<React.Fragment key={item.title}>
{item.children ? (
<NavList.Group title={item.title}>
{item.children.map((child) => (
<NavItem key={child.title} href={child.url}>
{child.title}
{child.children ? (
<NavList.SubNav>
{child.children.map((subChild) => (
<NavItem key={subChild.title} href={subChild.url}>
{subChild.title}
</NavItem>
))}
</NavList.SubNav>
) : null}
</NavItem>
))}
</NavList.Group>
) : (
<NavItem href={item.url}>{item.title}</NavItem>
)}
</React.Fragment>
))}
</NavList>
</>
)
}

export default NavItems
Loading
Loading