mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2026-01-15 12:15:02 +00:00
Refactor Metadata
This commit is contained in:
19
components/pages/Metadata.tsx
Normal file
19
components/pages/Metadata.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import Head from 'next/head';
|
||||
import {
|
||||
description as packageDescription,
|
||||
name as packageName
|
||||
} from 'package.json';
|
||||
import type { FC } from 'react';
|
||||
import type { MetadataProps } from 'types/components/pages/Metadata';
|
||||
|
||||
const Metadata: FC<MetadataProps> = ({
|
||||
description = packageDescription,
|
||||
title = packageName
|
||||
}) => (
|
||||
<Head>
|
||||
<meta name="description" content={description} />
|
||||
<title>{title}</title>
|
||||
</Head>
|
||||
);
|
||||
|
||||
export default Metadata;
|
||||
@@ -1,16 +1,12 @@
|
||||
import Metadata from 'components/pages/Metadata';
|
||||
import StyledApp from 'components/pages/StyledApp';
|
||||
import type { AppProps } from 'next/app';
|
||||
import Head from 'next/head';
|
||||
import { description, name } from 'package.json';
|
||||
import type { ReactElement } from 'react';
|
||||
|
||||
export default function App({ Component, pageProps }: AppProps): ReactElement {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{name}</title>
|
||||
<meta name="description" content={description} />
|
||||
</Head>
|
||||
<Metadata />
|
||||
<StyledApp>
|
||||
<Component {...pageProps} />
|
||||
</StyledApp>
|
||||
|
||||
4
types/components/pages/Metadata.ts
Normal file
4
types/components/pages/Metadata.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export type MetadataProps = {
|
||||
description?: string;
|
||||
title?: string;
|
||||
};
|
||||
Reference in New Issue
Block a user