@@ -2,34 +2,12 @@ import React from 'react'
22import { BaseStyles , themeGet , Box } from '@primer/react'
33import styled , { createGlobalStyle } from 'styled-components'
44import { SKIP_NAV } from './constants'
5- import { Helmet } from 'react-helmet'
65import Slugger from 'github-slugger'
76import Header from './components/header'
87import Sidebar from './components/sidebar'
98import Link from './components/link'
10- import useSiteMetdata from './hooks/use-site-metadata'
11- import usePage , { PageProvider } from './hooks/use-page'
12- import getLayout from './layout'
13-
14- const Head = ( ) => {
15- const { frontmatter} = usePage ( )
16- const siteMetadata = useSiteMetdata ( )
17-
18- const title = [ frontmatter . title , siteMetadata . title ] . filter ( Boolean ) . join ( ' | ' )
19- const description = frontmatter . description || siteMetadata . description
20-
21- return (
22- < Helmet >
23- < title > { title } </ title >
24- < meta name = "description" content = { description } />
25- < meta property = "og:title" content = { title } />
26- < meta property = "og:description" content = { description } />
27- < meta property = "og:image" content = { siteMetadata . imageUrl } />
28- < meta property = "twitter:card" content = "summary_large_image" />
29- < html lang = { siteMetadata . lang } />
30- </ Helmet >
31- )
32- }
9+ import { PageProvider } from './hooks/use-page'
10+ import Layout from './layout'
3311
3412const SkipLinkBase = props => (
3513 < Link
@@ -46,6 +24,10 @@ const SkipLinkBase = props => (
4624 </ Link >
4725)
4826
27+ // The following rules are to ensure that the element
28+ // is visually hidden, unless it has focus. This is the recommended
29+ // way to hide content from:
30+ // https://webaim.org/techniques/css/invisiblecontent/#techniques
4931export const SkipLink = styled ( SkipLinkBase ) `
5032 z-index: 20;
5133 width: auto;
@@ -54,11 +36,6 @@ export const SkipLink = styled(SkipLinkBase)`
5436 position: absolute;
5537 overflow: hidden;
5638
57- // The following rules are to ensure that the element
58- // is visually hidden, unless it has focus. This is the recommended
59- // way to hide content from:
60- // https://webaim.org/techniques/css/invisiblecontent/#techniques
61-
6239 &:not(:focus) {
6340 clip: rect(1px, 1px, 1px, 1px);
6441 clip-path: inset(50%);
@@ -90,13 +67,12 @@ const PageElement = ({element, props}) => {
9067 < SkipLink />
9168 < PageProvider value = { page } >
9269 < Box sx = { { display : 'flex' , flexDirection : 'column' , minHeight : '100vh' } } >
93- < Head />
9470 < Header />
9571 < Box sx = { { zIndex : 0 , display : 'flex' , flex : '1 1 auto' , flexDirection : 'row' } } role = "main" >
9672 < Box sx = { { display : [ 'none' , null , null , 'block' ] } } >
9773 < Sidebar />
9874 </ Box >
99- { React . createElement ( getLayout ( page ) , { key : 'layout' , ... props } , element ) }
75+ < Layout > { element } </ Layout >
10076 </ Box >
10177 </ Box >
10278 </ PageProvider >
0 commit comments