feat(client): convert class components to functional components (#43226)

This commit is contained in:
awu43
2021-10-26 22:47:47 -07:00
committed by GitHub
parent fbc0ea8742
commit fa9fb61f6a
10 changed files with 632 additions and 747 deletions

View File

@@ -9,30 +9,35 @@ interface HTMLProps {
preBodyComponents?: React.ReactNode[];
}
export default class HTML extends React.Component<HTMLProps> {
render(): JSX.Element {
return (
<html id='__fcc-html' {...this.props.htmlAttributes} lang='en'>
<head>
<meta charSet='utf-8' />
<meta content='ie=edge' httpEquiv='x-ua-compatible' />
<meta
content='width=device-width, initial-scale=1.0, shrink-to-fit=no'
name='viewport'
/>
{this.props.headComponents}
</head>
<body {...this.props.bodyAttributes}>
{this.props.preBodyComponents}
<div
className='tex2jax_ignore'
dangerouslySetInnerHTML={{ __html: this.props.body }}
id='___gatsby'
key={'body'}
/>
{this.props.postBodyComponents}
</body>
</html>
);
}
export default function HTML({
body,
bodyAttributes,
headComponents,
htmlAttributes,
postBodyComponents,
preBodyComponents
}: HTMLProps): JSX.Element {
return (
<html id='__fcc-html' {...htmlAttributes} lang='en'>
<head>
<meta charSet='utf-8' />
<meta content='ie=edge' httpEquiv='x-ua-compatible' />
<meta
content='width=device-width, initial-scale=1.0, shrink-to-fit=no'
name='viewport'
/>
{headComponents}
</head>
<body {...bodyAttributes}>
{preBodyComponents}
<div
className='tex2jax_ignore'
dangerouslySetInnerHTML={{ __html: body }}
id='___gatsby'
key={'body'}
/>
{postBodyComponents}
</body>
</html>
);
}