diff --git a/ui-v2/src/components/ui/typography.stories.tsx b/ui-v2/src/components/ui/typography.stories.tsx new file mode 100644 index 000000000000..1414f1f47360 --- /dev/null +++ b/ui-v2/src/components/ui/typography.stories.tsx @@ -0,0 +1,34 @@ +import type { Meta, StoryObj } from "@storybook/react"; + +import { Typography } from "./typography"; + +const meta: Meta = { + title: "UI/Typography", + component: Typography, + parameters: { + docs: { + description: { + component: "Typography is used as your basic text component", + }, + }, + }, +}; +export default meta; + +type Story = StoryObj; + +export const Usage: Story = { + render: () => { + return ( +
+ h1 Typography + h2 Typography + h3 Typography + h4 Typography + bodyLarge Typography + body Typography + bodySmall Typography +
+ ); + }, +}; diff --git a/ui-v2/src/components/ui/typography.tsx b/ui-v2/src/components/ui/typography.tsx new file mode 100644 index 000000000000..7df605bb9408 --- /dev/null +++ b/ui-v2/src/components/ui/typography.tsx @@ -0,0 +1,76 @@ +import { cn } from "@/lib/utils"; +import { forwardRef } from "react"; + +type Variant = "h1" | "h2" | "h3" | "h4" | "bodyLarge" | "body" | "bodySmall"; + +type Props = { + className?: string; + variant?: Variant; + children: React.ReactNode; +}; + +export const Typography = forwardRef( + ({ variant = "body", className, children }, ref) => { + switch (variant) { + case "h1": + return ( +

+ {children} +

+ ); + case "h2": + return ( +

+ {children} +

+ ); + case "h3": + return ( +

+ {children} +

+ ); + case "h4": + return ( +

+ {children} +

+ ); + + case "bodyLarge": + return ( +

+ {children} +

+ ); + + case "bodySmall": + return ( +

+ {children} +

+ ); + + case "body": + default: + return ( +

+ {children} +

+ ); + } + }, +); +Typography.displayName = "Typography";