mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-02-27 11:04:01 -05:00
feat(client): convert class components to functional components (#43226)
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user