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

Match chrome (header and sidebar nav) to new docs #790

Merged
merged 43 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7535420
updates header nav content and layout
mperrotti Oct 15, 2024
de95bbc
moves search input to sidebar and updates functionality
mperrotti Oct 15, 2024
4155f70
fixes dropdown text/icon color
mperrotti Oct 16, 2024
a2e47c0
Merge branch 'main' of github.com:primer/brand into mp/match-header-t…
mperrotti Oct 16, 2024
3f056c8
updates site name to Primer Marketing UI
mperrotti Oct 18, 2024
ff26e55
updates site name to Primer Brand UI
mperrotti Oct 18, 2024
24791e9
update Marketing UI to Brand UI in header nav
mperrotti Oct 18, 2024
d30c5bc
updates sidebar spacing to match primer-docs
mperrotti Oct 18, 2024
bf1bb1a
updates sidebar width to match primer-docs
mperrotti Oct 18, 2024
92c3335
fix bug where Brand UI wasn't appearing in the header
mperrotti Oct 22, 2024
07980c5
updates landing page to match primer-docs
mperrotti Oct 22, 2024
1d6f02e
Merge branch 'main' of github.com:primer/brand into mp/match-header-t…
mperrotti Oct 23, 2024
35363c8
updates sidebar nav to use Mona Sans
mperrotti Oct 23, 2024
da9662a
adjusts layout for wide viewports
mperrotti Oct 24, 2024
fd62a82
rm commented CSS
mperrotti Oct 24, 2024
007d305
updates hero header text
mperrotti Oct 24, 2024
a8fc265
Merge branch 'main' of github.com:primer/brand into mp/match-header-t…
mperrotti Dec 2, 2024
ba21aa5
revises to match latest primer-docs chrome
mperrotti Dec 3, 2024
e1c1af4
Update apps/docs/src/@primer/gatsby-theme-doctocat/components/hero.js
mperrotti Dec 3, 2024
9bdf123
Update apps/docs/src/@primer/gatsby-theme-doctocat/components/header.…
mperrotti Dec 3, 2024
e88e8bb
Update apps/docs/src/@primer/gatsby-theme-doctocat/components/hero.js
mperrotti Dec 3, 2024
eb84cdb
Update apps/docs/src/@primer/gatsby-theme-doctocat/components/hero.js
mperrotti Dec 3, 2024
c04c96e
Update apps/docs/src/components/navigation/navigation.module.css
mperrotti Dec 3, 2024
f581db8
Update apps/docs/src/@primer/gatsby-theme-doctocat/components/header.…
mperrotti Dec 3, 2024
f3641b6
Update apps/docs/src/@primer/gatsby-theme-doctocat/components/header.…
mperrotti Dec 3, 2024
3219e8b
Update apps/docs/src/components/side-panel/side-panel.module.css
mperrotti Dec 3, 2024
f7a1714
adds site name to sidebar, minor CSS var usage tweaks
mperrotti Dec 3, 2024
3150eb3
more tweaks
mperrotti Dec 3, 2024
5761af1
manually style side sheet for narrow viewports
mperrotti Dec 3, 2024
fe6cd79
fix dropdown font size
mperrotti Dec 4, 2024
055a50d
adjust width of main content container of landing page
mperrotti Dec 4, 2024
576e9b1
Merge branch 'main' into mp/match-header-to-new-docs
mperrotti Dec 4, 2024
79f826a
update top nav items to match
mperrotti Dec 5, 2024
4f2d41f
Merge branch 'mp/match-header-to-new-docs' of github.com:primer/brand…
mperrotti Dec 5, 2024
0eb9ead
Update apps/docs/src/components/side-panel/side-panel.tsx
mperrotti Dec 5, 2024
fb971f0
Update apps/docs/src/components/side-panel/side-panel.tsx
mperrotti Dec 5, 2024
99be9e2
prevents top nav from sorting
mperrotti Dec 5, 2024
9ebfffa
Merge branch 'mp/match-header-to-new-docs' of github.com:primer/brand…
mperrotti Dec 5, 2024
0bb5abf
Merge branch 'main' into mp/match-header-to-new-docs
mperrotti Dec 5, 2024
5bee80d
fixes top nav hover styles
mperrotti Dec 5, 2024
83cf70c
Merge branch 'mp/match-header-to-new-docs' of github.com:primer/brand…
mperrotti Dec 5, 2024
bdda3f3
Merge branch 'main' of github.com:primer/brand into mp/match-header-t…
mperrotti Dec 5, 2024
20734ae
Merge branch 'main' into mp/match-header-to-new-docs
mperrotti Dec 9, 2024
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
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}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this link to Primer Brand docs? Our users rarely need to go to the homepage or product docs so it feels intuitive to send them to the root. Ideally it would work like our marketing pages, where clicking on the title text takes you back to Primer Brand UI homepage and clicking the Logo icon will take you back to primer.style. What do you think?

Screen.Recording.2024-12-03.at.09.54.17.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to keep this as a link to root. One of the main purposes of the docs redesign is to make all of the Primer docs feel like they live in one big site.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mperrotti 👋🏽 After a conversation with @tallys, we’d like to send the users to the root, as suggested by @rezrah, and insulate Primer Brand from Primer to reduce dependencies.

<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,47 @@
.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: var(--brand-borderWidth-thin) solid
var(--brand-color-border-muted);
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-weight: var(--base-text-weight-semibold);
color: var(--brand-color-text-default);
font-family: var(--brand-fontStack-sansSerif);
padding-inline-end: var(--base-size-12);
}

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

@media (max-width: 1012px) {
.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,38 @@
.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: var(--breakpoint-xlarge, 80rem);
margin: 0 auto;
width: 100%;
padding: 0 var(--base-size-48);

@media screen and (max-width: 64rem) {
padding: 0;
}
}
57 changes: 25 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,31 @@
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="h1" size="3">
Primer Brand UI
</Heading>
<Text as="p" variant="muted" size="300">
Primer Brand is GitHub's design system for creating marketing websites and digital experiences.
</Text>
</Stack>
<div className={styles.HeroImage}>
<img
width="256"
alt="3d illustration, showing a side profile of Mona the GitHub Mascot gazing towards the sky"
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,60 @@
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'
import styles from './nav-items.module.css'

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>
<div className={styles.NavList__Container}>
<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>
</div>
</>
)
}

export default NavItems
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* NavList style overrides needed because NavList uses hard-coded pixel values instead of rem-based CSS variables */
.NavList__Container li span {
font-size: var(--brand-text-size-100);
}

.NavList__Container li a span,
.NavList__Container li button span {
font-size: var(--brand-text-size-200);
line-height: var(--brand-text-lineHeight-200);
}
/* END NavList overrides */
Loading
Loading