diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-04-16 16:08:49 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-04-16 16:41:30 +0200 |
| commit | 5a6e4eea16047083e2de0e91a1b3ed9be8d6eb68 (patch) | |
| tree | ea0c5390aca73907aade5321f30cb7bf8d3ab1cb /src/components/atoms/layout | |
| parent | daffe6e8b9e2021ffb9d006482143bc4db985f02 (diff) | |
refactor: support React 18
I replaced the deprecated VFC type with FC type and made all children
explicits.
Formatjs is still not compatible with React 18 so I need to skip type
checking when comitting. There are some type errors because of
IntlProvider in Storybook stories.
Diffstat (limited to 'src/components/atoms/layout')
| -rw-r--r-- | src/components/atoms/layout/copyright.tsx | 4 | ||||
| -rw-r--r-- | src/components/atoms/layout/main.tsx | 6 | ||||
| -rw-r--r-- | src/components/atoms/layout/no-script.tsx | 4 | ||||
| -rw-r--r-- | src/components/atoms/layout/notice.tsx | 4 | ||||
| -rw-r--r-- | src/components/atoms/layout/section.tsx | 4 |
5 files changed, 13 insertions, 9 deletions
diff --git a/src/components/atoms/layout/copyright.tsx b/src/components/atoms/layout/copyright.tsx index 76252ee..f70695d 100644 --- a/src/components/atoms/layout/copyright.tsx +++ b/src/components/atoms/layout/copyright.tsx @@ -1,4 +1,4 @@ -import { ReactNode, VFC } from 'react'; +import { FC, ReactNode } from 'react'; import styles from './copyright.module.scss'; export type CopyrightDates = { @@ -32,7 +32,7 @@ export type CopyrightProps = { * * Renders a copyright information (owner, dates, license icon). */ -const Copyright: VFC<CopyrightProps> = ({ owner, dates, icon }) => { +const Copyright: FC<CopyrightProps> = ({ owner, dates, icon }) => { const getFormattedDate = (date: string) => { const datetime = new Date(date).toISOString(); diff --git a/src/components/atoms/layout/main.tsx b/src/components/atoms/layout/main.tsx index 4549328..d92a5c7 100644 --- a/src/components/atoms/layout/main.tsx +++ b/src/components/atoms/layout/main.tsx @@ -1,7 +1,11 @@ -import { FC } from 'react'; +import { FC, ReactNode } from 'react'; export type MainProps = { /** + * The main body. + */ + children: ReactNode; + /** * Set additional classnames to the main element. */ className?: string; diff --git a/src/components/atoms/layout/no-script.tsx b/src/components/atoms/layout/no-script.tsx index 6358cf8..a503e0c 100644 --- a/src/components/atoms/layout/no-script.tsx +++ b/src/components/atoms/layout/no-script.tsx @@ -1,4 +1,4 @@ -import { VFC } from 'react'; +import { FC } from 'react'; import styles from './no-script.module.scss'; export type NoScriptProps = { @@ -12,7 +12,7 @@ export type NoScriptProps = { position?: 'initial' | 'top'; }; -const NoScript: VFC<NoScriptProps> = ({ message, position = 'initial' }) => { +const NoScript: FC<NoScriptProps> = ({ message, position = 'initial' }) => { const positionClass = styles[`noscript--${position}`]; return <div className={`${styles.noscript} ${positionClass}`}>{message}</div>; diff --git a/src/components/atoms/layout/notice.tsx b/src/components/atoms/layout/notice.tsx index b6e09c5..115bd9c 100644 --- a/src/components/atoms/layout/notice.tsx +++ b/src/components/atoms/layout/notice.tsx @@ -1,4 +1,4 @@ -import { VFC } from 'react'; +import { FC } from 'react'; import styles from './notice.module.scss'; export type NoticeKind = 'error' | 'info' | 'success' | 'warning'; @@ -19,7 +19,7 @@ export type NoticeProps = { * * Render a colored message depending on notice kind. */ -const Notice: VFC<NoticeProps> = ({ kind, message }) => { +const Notice: FC<NoticeProps> = ({ kind, message }) => { const kindClass = `wrapper--${kind}`; return ( diff --git a/src/components/atoms/layout/section.tsx b/src/components/atoms/layout/section.tsx index f1bbb34..cb727ff 100644 --- a/src/components/atoms/layout/section.tsx +++ b/src/components/atoms/layout/section.tsx @@ -1,4 +1,4 @@ -import { ReactNode, VFC } from 'react'; +import { FC, ReactNode } from 'react'; import Heading from '../headings/heading'; import styles from './section.module.scss'; @@ -32,7 +32,7 @@ export type SectionProps = { * * Render a section element. */ -const Section: VFC<SectionProps> = ({ +const Section: FC<SectionProps> = ({ className = '', content, title, |
