Skip to content

Commit

Permalink
web-vitals is supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitardanailov committed Oct 4, 2022
1 parent 3ea77cf commit e85820d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
32 changes: 21 additions & 11 deletions website/layouts/MainLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,32 @@ import styled from 'styled-components'
import PageTemplate from './components/PageTemplate'
import PageHolder from './components/PageHolder'

import {onLCP, onFID, onCLS} from 'web-vitals'

const Container = styled.section`
position: relative;
min-height: 100%;
`

const MainLayout = Page => () => (
<Container>
<PageTemplate>
<PageHolder>
<Page />
</PageHolder>
</PageTemplate>

<MainFooter />
</Container>
)
const Page = function () {
onCLS(console.log)
onFID(console.log)
onLCP(console.log)

return (
<Container>
<PageTemplate>
<PageHolder>
<Page />
</PageHolder>
</PageTemplate>

<MainFooter />
</Container>
)
}

const MainLayout = Page

export default MainLayout
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"react-window": "^1.8.6",
"styled-components": "5.1.1",
"typed.js": "^2.0.12",
"web-vitals": "^3.0.2",
"xstate": "^4.11.0"
}
}

0 comments on commit e85820d

Please sign in to comment.