refactor: remove useless config for absolute paths and improve components exports

This commit is contained in:
Walid 2022-04-12 14:47:21 +00:00
parent f46690690c
commit 9d672e3cf3
No known key found for this signature in database
GPG Key ID: 4BDA1ABD227F9279
4 changed files with 6 additions and 15 deletions

View File

@ -1,9 +1,9 @@
// eslint-disable-next-line @next/next/no-document-import-in-page // eslint-disable-next-line @next/next/no-document-import-in-page
import { Head } from 'next/document' import { Head } from 'next/document'
import { projectConfig } from '@/utils/config' import { projectConfig } from 'utils/config'
const CommonHead = (): JSX.Element => { export const CommonHead = (): JSX.Element => {
return ( return (
<Head> <Head>
{/* Link Tags */} {/* Link Tags */}
@ -62,5 +62,3 @@ const CommonHead = (): JSX.Element => {
</Head> </Head>
) )
} }
export default CommonHead

View File

@ -1,6 +1,6 @@
import Head from 'next/head' import Head from 'next/head'
import { projectConfig } from '@/utils/config' import { projectConfig } from 'utils/config'
interface HeadProps { interface HeadProps {
longName?: string longName?: string
@ -10,8 +10,7 @@ interface HeadProps {
const NextHead: React.FC<HeadProps> = (props) => { const NextHead: React.FC<HeadProps> = (props) => {
const { const {
longName = projectConfig.longName, longName = projectConfig.longName,
shortName = projectConfig.shortName, shortName = projectConfig.shortName
children
} = props } = props
return ( return (
@ -23,8 +22,6 @@ const NextHead: React.FC<HeadProps> = (props) => {
</title> </title>
<meta name='viewport' content='width=device-width, initial-scale=1.0' /> <meta name='viewport' content='width=device-width, initial-scale=1.0' />
{children}
</Head> </Head>
) )
} }

View File

@ -1,6 +1,6 @@
import Document, { Html, Main, NextScript } from 'next/document' import Document, { Html, Main, NextScript } from 'next/document'
import CommonHead from '@/components/Head/CommonHead' import { CommonHead } from 'components/Head/CommonHead'
class MyDocument extends Document { class MyDocument extends Document {
render(): JSX.Element { render(): JSX.Element {

View File

@ -17,11 +17,7 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"moduleResolution": "node", "moduleResolution": "node",
"lib": ["dom", "dom.iterable", "esnext"], "lib": ["dom", "dom.iterable", "esnext"],
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true
"paths": {
"@/components/*": ["components/*"],
"@/utils/*": ["utils/*"]
}
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["dist", ".next", "out", "next.config.js"] "exclude": ["dist", ".next", "out", "next.config.js"]