Skip to content

Commit

Permalink
fix: motion-reacct types
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan-Gilliam committed Dec 12, 2024
1 parent 15a10c6 commit 7cdf262
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 28 deletions.
2 changes: 1 addition & 1 deletion apps/www/public/registry/styles/default/expandable.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"files": [
{
"name": "gradient-heading.tsx",
"content": "import React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst headingVariants = cva(\n \"tracking-tight pb-3 bg-clip-text text-transparent\",\n {\n variants: {\n variant: {\n default:\n \"bg-gradient-to-t from-neutral-700 to-neutral-800 dark:from-stone-200 dark:to-neutral-200\",\n pink: \"bg-gradient-to-t from-accent to-accent/90 dark:from-stone-200 dark:to-neutral-200\",\n light: \"bg-gradient-to-t from-neutral-200 to-neutral-300\",\n secondary:\n \"bg-gradient-to-t from-neutral-500 to-neutral-600 dark:from-stone-200 dark:to-neutral-200\",\n },\n size: {\n default: \"text-2xl sm:text-3xl lg:text-4xl\",\n xxs: \"text-base sm:text-lg lg:text-lg\",\n xs: \"text-lg sm:text-xl lg:text-2xl\",\n sm: \"text-xl sm:text-2xl lg:text-3xl\",\n md: \"text-2xl sm:text-3xl lg:text-4xl\",\n lg: \"text-3xl sm:text-4xl lg:text-5xl\",\n xl: \"text-4xl sm:text-5xl lg:text-6xl\",\n xxl: \"text-5xl sm:text-6xl lg:text-[6rem]\",\n xxxl: \"text-5xl sm:text-6xl lg:text-[8rem]\",\n },\n weight: {\n default: \"font-bold\",\n thin: \"font-thin\",\n base: \"font-base\",\n semi: \"font-semibold\",\n bold: \"font-bold\",\n black: \"font-black\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n weight: \"default\",\n },\n }\n)\n\nexport interface HeadingProps extends VariantProps<typeof headingVariants> {\n asChild?: boolean\n children: React.ReactNode\n className?: string\n}\n\nconst GradientHeading = React.forwardRef<HTMLHeadingElement, HeadingProps>(\n ({ asChild, variant, weight, size, className, children, ...props }, ref) => {\n const Comp = asChild ? Slot : \"h3\" // default to 'h3' if not a child\n return (\n <Comp ref={ref} {...props} className={className}>\n <span className={cn(headingVariants({ variant, size, weight }))}>\n {children}\n </span>\n </Comp>\n )\n }\n)\n\nGradientHeading.displayName = \"GradientHeading\"\n\n// Manually define the variant types\nexport type Variant = \"default\" | \"pink\" | \"light\" | \"secondary\"\nexport type Size =\n | \"default\"\n | \"xxs\"\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"xxl\"\n | \"xxxl\"\nexport type Weight = \"default\" | \"thin\" | \"base\" | \"semi\" | \"bold\" | \"black\"\n\nexport { GradientHeading, headingVariants }\n"
"content": "import React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst headingVariants = cva(\n \"tracking-tight pb-3 bg-clip-text text-transparent\",\n {\n variants: {\n variant: {\n default:\n \"bg-gradient-to-t from-neutral-700 to-neutral-800 dark:from-stone-200 dark:to-neutral-200\",\n pink: \"bg-gradient-to-t from-accent to-accent/90 dark:from-stone-200 dark:to-neutral-200\",\n light: \"bg-gradient-to-t from-neutral-200 to-neutral-300\",\n secondary:\n \"bg-gradient-to-t from-neutral-500 to-neutral-600 dark:from-stone-200 dark:to-neutral-200\",\n },\n size: {\n default: \"text-2xl sm:text-3xl lg:text-4xl\",\n xxs: \"text-base sm:text-lg lg:text-lg\",\n xs: \"text-lg sm:text-xl lg:text-2xl\",\n sm: \"text-xl sm:text-2xl lg:text-3xl\",\n md: \"text-2xl sm:text-3xl lg:text-4xl\",\n lg: \"text-3xl sm:text-4xl lg:text-5xl\",\n xl: \"text-4xl sm:text-5xl lg:text-6xl\",\n xll: \"text-5xl sm:text-6xl lg:text-[5.4rem] leading-[0.5rem] lg:leading-[0.5rem] \",\n xxl: \"text-5xl sm:text-6xl lg:text-[6rem]\",\n xxxl: \"text-5xl sm:text-6xl lg:text-[8rem]\",\n },\n weight: {\n default: \"font-bold\",\n thin: \"font-thin\",\n base: \"font-base\",\n semi: \"font-semibold\",\n bold: \"font-bold\",\n black: \"font-black\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n weight: \"default\",\n },\n }\n)\n\nexport interface HeadingProps extends VariantProps<typeof headingVariants> {\n asChild?: boolean\n children: React.ReactNode\n className?: string\n}\n\nconst GradientHeading = React.forwardRef<HTMLHeadingElement, HeadingProps>(\n ({ asChild, variant, weight, size, className, children, ...props }, ref) => {\n const Comp = asChild ? Slot : \"h3\" // default to 'h3' if not a child\n return (\n <Comp ref={ref} {...props} className={className}>\n <span className={cn(headingVariants({ variant, size, weight }))}>\n {children}\n </span>\n </Comp>\n )\n }\n)\n\nGradientHeading.displayName = \"GradientHeading\"\n\n// Manually define the variant types\nexport type Variant = \"default\" | \"pink\" | \"light\" | \"secondary\"\nexport type Size =\n | \"default\"\n | \"xxs\"\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"xxl\"\n | \"xxxl\"\nexport type Weight = \"default\" | \"thin\" | \"base\" | \"semi\" | \"bold\" | \"black\"\n\nexport { GradientHeading, headingVariants }\n"
}
],
"type": "components:ui"
Expand Down
Loading

0 comments on commit 7cdf262

Please sign in to comment.