Skip to content

Commit

Permalink
fix hotjar NPS stylesheet import(#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
annarhughes committed Nov 6, 2023
1 parent 76a216a commit 026c2bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/components/Head.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const Head = ({ title, description, ogDescription, ogImage, ogTitle, ogImageAlt
<NextHead>
<title key="title">{title} | YSM</title>
<link rel="icon" href="/favicon.png" />
<link href="https://bloom.chayn.co/hotjarNPS.css" rel="stylesheet" type="text/css" />
<meta name="description" content={description} />
<meta property="og:url" content={isBrowser ? window.location.href : null} />
<meta property="og:type" content="website" />
Expand Down
17 changes: 10 additions & 7 deletions src/pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
/* eslint-disable react/jsx-filename-extension */
import { ServerStyleSheets } from '@material-ui/core/styles';
import Document, {
Head, Html, Main, NextScript,
} from 'next/document';
import Document, { Head, Html, Main, NextScript } from 'next/document';
import React from 'react';

export default class MyDocument extends Document {
render() {
return (
<Html lang="en">
<Head>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito&display=swap" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Nunito&display=swap"
/>
<link href="https://bloom.chayn.co/hotjarNPS.css" rel="stylesheet" type="text/css" />
</Head>
<body>
<Main />
Expand All @@ -25,9 +27,10 @@ MyDocument.getInitialProps = async (ctx) => {
const sheets = new ServerStyleSheets();
const originalRenderPage = ctx.renderPage;

ctx.renderPage = () => originalRenderPage({
enhanceApp: (App) => (props) => sheets.collect(<App {...props} />),
});
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App) => (props) => sheets.collect(<App {...props} />),
});

const initialProps = await Document.getInitialProps(ctx);

Expand Down

0 comments on commit 026c2bc

Please sign in to comment.