All files / components/ui text.tsx

100% Statements 2/2
100% Branches 3/3
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                      97x   97x              
import type { ElementType } from "react";
import { TEXT_VARIANT_CLASSES } from "@/constants/text";
import type { TextProps } from "@/types/text";
import { cn } from "@/utils/class-name";
 
export function Text<T extends ElementType = "p">({
  as,
  variant = "body",
  className,
  ...props
}: TextProps<T>) {
  const Component = as ?? "p";
 
  return (
    <Component
      className={cn(TEXT_VARIANT_CLASSES[variant], className)}
      {...props}
    />
  );
}