1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-01-11 03:02:56 -05:00

properly merge multiple class names

This commit is contained in:
2022-01-20 10:38:18 -05:00
parent 0462428a54
commit 2162e9d563
10 changed files with 47 additions and 34 deletions

View File

@@ -1,3 +1,4 @@
import classNames from "classnames";
import type { HTMLAttributes } from "react";
import styles from "./Heading.module.css";
@@ -8,7 +9,7 @@ type Props = HTMLAttributes<HTMLHeadingElement> & {
const Heading = ({ as: Component, children, ...rest }: Props) => {
return (
<Component className={`${styles.heading} ${styles[Component] || ""}`} {...rest}>
<Component className={classNames(styles.heading, styles[Component])} {...rest}>
{children}
</Component>
);