text.tsx 601 B

12345678910111213141516171819202122
  1. "use client";
  2. import type { ComponentRenderProps } from "./types";
  3. import { baseClass, getCustomClass } from "./utils";
  4. export function Text({ element }: ComponentRenderProps) {
  5. const { props } = element;
  6. const customClass = getCustomClass(props);
  7. const textVariant = props.variant as string;
  8. const textClass =
  9. textVariant === "caption"
  10. ? "text-[10px]"
  11. : textVariant === "muted"
  12. ? "text-xs text-muted-foreground"
  13. : "text-xs";
  14. return (
  15. <p className={`${textClass} text-left ${baseClass} ${customClass}`}>
  16. {props.content as string}
  17. </p>
  18. );
  19. }