UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
feat: add blur in text component (#18) (#44)
Abderrahman ES-SEBYITYd187eb59acf7
diff --git a/config/docs.ts b/config/docs.tsindex f9866e56..94023c24 100644--- a/config/docs.ts+++ b/config/docs.ts@@ -163,6 +163,12 @@ export const docsConfig: DocsConfig = {items: [],label: "New",},+ {+ title: "Blur In",+ href: `/docs/components/blur-in`,+ items: [],+ label: "New",+ },],},{diff --git a/content/docs/components/blur-in.mdx b/content/docs/components/blur-in.mdxnew file mode 100644index 00000000..82f3a4f4--- /dev/null+++ b/content/docs/components/blur-in.mdx@@ -0,0 +1,32 @@+---+title: Blur In+date: 2024-05-23+description: An animated text component that blurs in the text.+author: abdrahmanES1+published: true+---++<ComponentPreview name="blur-in-demo" />++<Steps>++### Installation++Copy and paste the following code into your project.++```text+components/magicui/blur-in.tsx+```++<ComponentSource name="blur-in" />++</Steps>++## Props++| Prop | Type | Description | Default |+| --------- | ------ | ---------------------------------------------- | -------------------------------------------------------------------------------------------- |+| className | string | The class name to be applied to the component | |+| duration | number | Durations (seconds) for the animation | 1 |+| word | string | The word to be animated | |+| variant | object | Custom animation variants for motion component | `hidden: { filter: "blur(10px)", opacity: 0 }, visible: { filter: "blur(0px)", opacity: 1 }` |diff --git a/content/docs/components/wavy-text.mdx b/content/docs/components/wavy-text.mdxindex 6df64f6c..c11a97b8 100644--- a/content/docs/components/wavy-text.mdx+++ b/content/docs/components/wavy-text.mdx@@ -24,10 +24,10 @@ components/magicui/wavy-text.tsx## Props-| Prop | Type | Description | Default |-| --------- | ------ | -------------------------------------------------- | ------- |-| className | string | The class name to be applied to the component | |-| duration | number | Duration (seconds) for the animation | 0.5 |-| delay | number | Duration (seconds) for stagger between each letter | 0.02 |-| words | string | The word to be animated | |-| variant | object | Custom animation variants for motion component | {} |+| Prop | Type | Description | Default |+| --------- | ------ | -------------------------------------------------- | ---------------------------------------- |+| className | string | The class name to be applied to the component | |+| duration | number | Durations (seconds) for the animation | 0.5 |+| delay | number | Duration (seconds) for stagger between each letter | 0.02 |+| words | string | The word to be animated | |+| variant | object | Custom animation variants for motion component | ` hidden: { y: 10 },visible: { y: -10 }` |diff --git a/registry/components/example/blur-in-demo.tsx b/registry/components/example/blur-in-demo.tsxnew file mode 100644index 00000000..da2f7528--- /dev/null+++ b/registry/components/example/blur-in-demo.tsx@@ -0,0 +1,10 @@+import BlurIn from "../magicui/blur-in";+const BlurInDemo = () => {+ return (+ <BlurIn+ word="Blur In"+ className="text-4xl font-bold text-black dark:text-white"+ />+ );+};+export default BlurInDemo;diff --git a/registry/components/magicui/blur-in.tsx b/registry/components/magicui/blur-in.tsxnew file mode 100644index 00000000..e003669f--- /dev/null+++ b/registry/components/magicui/blur-in.tsx@@ -0,0 +1,37 @@+"use client";+import { motion } from "framer-motion";+import { cn } from "@/lib/utils";++interface BlurIntProps {+ word: string;+ className?: string;+ variant?: {+ hidden: { filter: string; opacity: number };+ visible: { filter: string; opacity: number };+ };+ duration?: number;+}+const BlurIn = ({ word, className, variant, duration = 1 }: BlurIntProps) => {+ const defaultVariants = {+ hidden: { filter: "blur(10px)", opacity: 0 },+ visible: { filter: "blur(0px)", opacity: 1 },+ };+ const combinedVariants = variant || defaultVariants;++ return (+ <motion.h1+ initial="hidden"+ animate="visible"+ transition={{ duration }}+ variants={combinedVariants}+ className={cn(+ className,+ "font-display text-center text-4xl font-bold tracking-[-0.02em] drop-shadow-sm md:text-7xl md:leading-[5rem]",+ )}+ >+ {word}+ </motion.h1>+ );+};++export default BlurIn;diff --git a/registry/index.tsx b/registry/index.tsxindex 36153dd8..72617868 100644--- a/registry/index.tsx+++ b/registry/index.tsx@@ -152,6 +152,11 @@ const ui: Registry = {type: "components:ui",files: ["registry/components/magicui/wavy-text.tsx"],},+ "blur-in": {+ name: "blur-in",+ type: "components:ui",+ files: ["registry/components/magicui/blur-in.tsx"],+ },};const example: Registry = {@@ -591,6 +596,15 @@ const example: Registry = {() => import("@/registry/components/example/wavy-text-demo"),),},++ "blur-in-demo": {+ name: "blur-in-demo",+ type: "components:example",+ files: ["registry/components/example/blur-in-demo.tsx"],+ component: React.lazy(+ () => import("@/registry/components/example/blur-in-demo"),+ ),+ },};export const registry: Registry = {