new-personal-site/components/lib/layout/Span.tsx

34 lines
893 B
TypeScript
Raw Normal View History

2024-12-09 15:36:17 +00:00
import { DetailedHTMLProps, HTMLAttributes } from "react";
import { twMerge } from "tailwind-merge";
/**
* # Span element
* @className twui-span
*/
export default function Span({
size,
variant,
...props
}: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement> & {
size?: "normal" | "small" | "smaller" | "large" | "larger";
variant?: "normal" | "faded";
}) {
return (
<span
{...props}
className={twMerge(
"text-base",
size == "small" && "text-sm",
size == "smaller" && "text-xs",
size == "large" && "text-lg",
size == "larger" && "text-xl",
variant == "faded" && "opacity-50",
"twui-span",
props.className
)}
>
{props.children}
</span>
);
}