1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-18 16:05:33 -04:00

use memo more wisely

This commit is contained in:
2022-01-22 10:06:24 -05:00
parent 224358fd68
commit d06ebfcf60
11 changed files with 70 additions and 107 deletions

View File

@@ -8,44 +8,15 @@ type Props = HTMLAttributes<HTMLHeadingElement> & {
className?: string;
};
const Heading = ({ as: Component, children, className, ...rest }: Props) => {
return (
<Component className={classNames(styles.heading, styles[Component], className)} {...rest}>
{children}
</Component>
);
const Heading = ({ as: Component, className, ...rest }: Props) => {
return <Component className={classNames(styles.heading, styles[Component], className)} {...rest} />;
};
// TODO: do this less manually...
export const H1 = ({ children, ...rest }: Props) => (
<Heading as="h1" {...rest}>
{children}
</Heading>
);
export const H2 = ({ children, ...rest }: Props) => (
<Heading as="h2" {...rest}>
{children}
</Heading>
);
export const H3 = ({ children, ...rest }: Props) => (
<Heading as="h3" {...rest}>
{children}
</Heading>
);
export const H4 = ({ children, ...rest }: Props) => (
<Heading as="h4" {...rest}>
{children}
</Heading>
);
export const H5 = ({ children, ...rest }: Props) => (
<Heading as="h5" {...rest}>
{children}
</Heading>
);
export const H6 = ({ children, ...rest }: Props) => (
<Heading as="h6" {...rest}>
{children}
</Heading>
);
export const H1 = (props: Props) => <Heading as="h1" {...props} />;
export const H2 = (props: Props) => <Heading as="h2" {...props} />;
export const H3 = (props: Props) => <Heading as="h3" {...props} />;
export const H4 = (props: Props) => <Heading as="h4" {...props} />;
export const H5 = (props: Props) => <Heading as="h5" {...props} />;
export const H6 = (props: Props) => <Heading as="h6" {...props} />;
export default Heading;