Skip to content

Commit a35a223

Browse files
committed
Update ESLint configuration, enhance PWA settings, and refactor global styles
1 parent ceb5427 commit a35a223

File tree

6 files changed

+34
-21
lines changed

6 files changed

+34
-21
lines changed

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default [
7777
'import/no-duplicates': 'off',
7878
'no-use-before-define': 'off',
7979
'@typescript-eslint/no-use-before-define': ['error'],
80-
80+
'@typescript-eslint/no-explicit-any': 'off',
8181
'@typescript-eslint/explicit-function-return-type': [
8282
'error',
8383
{

next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports = withPWA({
1010
},
1111
pwa: {
1212
dest: 'public',
13+
disable: process.env.NODE_ENV === 'development',
14+
register: true,
15+
skipWaiting: true,
1316
},
1417
basePath: '/react-timestamper',
1518
});

pages/_app.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@ import Head from 'next/head';
22
import { AppProps } from 'next/app';
33
import Router from 'next/router';
44
import { DefaultSeo } from 'next-seo';
5-
import {Lato} from 'next/font/google';
65
import SEO from '../next-seo.config';
76

87
import GloalStyle from '../src/styles/global';
98

109
import { pageview } from '../src/services/ga';
1110

12-
const lato = Lato({ weight: ['400', '700'], subsets: ['latin'] });
13-
1411
Router.events.on(
1512
'routeChangeComplete',
1613
(url) => process.env.NODE_ENV === 'production' && pageview(url),
@@ -86,13 +83,6 @@ const MyApp: React.FC<AppProps> = ({ Component, pageProps }) => (
8683
/>
8784

8885
<meta name="apple-mobile-web-app-capable" content="yes" />
89-
90-
<style jsx global>{`
91-
* {
92-
font-family: ${lato.style.fontFamily};
93-
}
94-
`}</style>
95-
9686
</Head>
9787
<DefaultSeo {...SEO} />
9888
<Component {...pageProps} />

pages/_document.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
import Document, { Html, Head, Main, NextScript, DocumentContext } from 'next/document';
1+
import Document, {
2+
Html,
3+
Head,
4+
Main,
5+
NextScript,
6+
DocumentContext,
7+
} from 'next/document';
28

3-
import { GA_TRACKING_ID } from '../src/services/ga';
49
import { ServerStyleSheet } from 'styled-components';
10+
import { GA_TRACKING_ID } from '../src/services/ga';
511

612
export default class MyDocument extends Document {
7-
static async getInitialProps(ctx: DocumentContext) {
13+
static async getInitialProps(ctx: DocumentContext): Promise<{
14+
styles: JSX.Element;
15+
html: string;
16+
head?: JSX.Element[];
17+
}> {
818
const sheet = new ServerStyleSheet();
919
const originalRenderPage = ctx.renderPage;
1020
try {
@@ -14,8 +24,14 @@ export default class MyDocument extends Document {
1424
sheet.collectStyles(<App {...props} />),
1525
});
1626
const initialProps = await Document.getInitialProps(ctx);
27+
28+
const head = initialProps.head?.filter(
29+
(element) => element !== null,
30+
) as JSX.Element[];
31+
1732
return {
1833
...initialProps,
34+
head,
1935
styles: (
2036
<>
2137
{initialProps.styles}
@@ -27,7 +43,7 @@ export default class MyDocument extends Document {
2743
sheet.seal();
2844
}
2945
}
30-
46+
3147
render(): JSX.Element {
3248
return (
3349
<Html lang="en">

src/@types/common.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
declare interface Window {
2-
gtag: any;
2+
gtag: (
3+
command: string,
4+
eventName: string,
5+
eventParams?: { [key: string]: any },
6+
) => void;
37
}

src/styles/global.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
import { Lato } from 'next/font/google';
12
import { createGlobalStyle } from 'styled-components';
23

4+
const lato = Lato({ weight: ['400', '700'], subsets: ['latin'] });
5+
36
export default createGlobalStyle`
47
* {
58
margin: 0;
69
padding: 0;
710
outline: 0;
811
box-sizing: border-box;
12+
font-family: ${lato.style.fontFamily};
913
}
1014
1115
html, body, #__next {
@@ -18,16 +22,12 @@ export default createGlobalStyle`
1822
-webkit-font-smoothing: antialised;
1923
}
2024
21-
body, input, button {
22-
font: 16px Lato, serif;
23-
}
24-
2525
#root {
2626
margin: 0 auto;
2727
}
2828
2929
h1, h2, h3, h4, h5, h6, strong {
30-
font-weight: 500;
30+
font-weight: 700;
3131
}
3232
3333
button {

0 commit comments

Comments
 (0)