removed createElement and used JSX

This commit is contained in:
Foster Irwin 2022-02-04 09:34:27 -07:00
parent e534c0eeeb
commit 0c4a61007e

View file

@ -2,17 +2,13 @@ import React from 'react';
export const HeaderText = ({type, text, link}): JSX.Element => {
const anchor = React.createElement(
'a',
{className: "hash-link", href: `#${link}`, title: "Direct link to heading"}
)
const Header = type;
const heading = React.createElement(
type || 'h1',
link ? {className: "anchor anchorWithHideOnScrollNavbar_node_modules-@docusaurus-theme-classic-lib-next-theme-Heading-styles-module"} : null,
text, link ? anchor : null
)
return heading
return (
<Header className="anchor anchorWithHideOnScrollNavbar_node_modules-@docusaurus-theme-classic-lib-next-theme-Heading-styles-module">
{text}
{link ? <a className="hash-link" href={`#${link}`} title="Direct link to heading"/> : null}
</Header>
);
};