Text.svelte 688 B

12345678910111213141516171819202122
  1. <script lang="ts">
  2. import type { BaseComponentProps } from "@json-render/svelte";
  3. import type { ShadcnProps } from "./catalog.js";
  4. interface Props extends BaseComponentProps<ShadcnProps<"Text">> {}
  5. let { props }: Props = $props();
  6. const className = $derived(
  7. props.variant === "caption"
  8. ? "text-xs text-muted-foreground"
  9. : props.variant === "muted"
  10. ? "text-sm text-muted-foreground"
  11. : props.variant === "lead"
  12. ? "text-lg text-foreground"
  13. : props.variant === "code"
  14. ? "rounded bg-muted px-1 py-0.5 font-mono text-sm"
  15. : "text-sm text-foreground",
  16. );
  17. </script>
  18. <p class={className}>{props.text}</p>