UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: lint fix
Arghya Das717d472bb599
diff --git a/public/r/highlighter-demo.json b/public/r/highlighter-demo.jsonindex 50122af6..e13eb98c 100644--- a/public/r/highlighter-demo.json+++ b/public/r/highlighter-demo.json@@ -19,7 +19,7 @@},{"path": "registry/magicui/highlighter.tsx",- "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { annotate } from \"rough-notation\";\nimport type React from \"react\";\n\n// Define available annotation actions\ntype AnnotationAction =\n | \"highlight\"\n | \"underline\"\n | \"box\"\n | \"circle\"\n | \"strike-through\"\n | \"crossed-off\"\n | \"bracket\";\n\n// Custom TypeScript interface for supported props\ninterface HighlighterProps {\n children: React.ReactNode;\n action?: AnnotationAction;\n color?: string;\n strokeWidth?: number;\n animationDuration?: number;\n iterations?: number;\n padding?: number;\n multiline?: boolean;\n}\n\nexport function Highlighter({\n children,\n action = \"highlight\",\n color = \"#ffd1dc\", // Default pink color\n strokeWidth = 1.5,\n animationDuration = 600,\n iterations = 2,\n padding = 2,\n multiline = true,\n}: HighlighterProps) {\n const elementRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n const element = elementRef.current;\n if (element) {\n const annotation = annotate(element, {\n type: action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n });\n\n annotation.show();\n\n // Store the current element in closure for cleanup\n return () => {\n if (element) {\n annotate(element, { type: action }).remove();\n }\n };\n }\n }, [\n action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n ]);\n\n return (\n <span ref={elementRef} className=\"relative inline-block bg-transparent\">\n {children}\n </span>\n );\n}\n",+ "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { useInView } from \"motion/react\";\nimport { annotate } from \"rough-notation\";\nimport type React from \"react\";\n\ntype AnnotationAction =\n | \"highlight\"\n | \"underline\"\n | \"box\"\n | \"circle\"\n | \"strike-through\"\n | \"crossed-off\"\n | \"bracket\";\n\ninterface HighlighterProps {\n children: React.ReactNode;\n action?: AnnotationAction;\n color?: string;\n strokeWidth?: number;\n animationDuration?: number;\n iterations?: number;\n padding?: number;\n multiline?: boolean;\n isView?: boolean;\n}\n\nexport function Highlighter({\n children,\n action = \"highlight\",\n color = \"#ffd1dc\",\n strokeWidth = 1.5,\n animationDuration = 600,\n iterations = 2,\n padding = 2,\n multiline = true,\n isView = false,\n}: HighlighterProps) {\n const elementRef = useRef<HTMLSpanElement>(null);\n const isInView = useInView(elementRef, {\n once: true,\n margin: \"-10%\",\n });\n\n // If isView is false, always show. If isView is true, wait for inView\n const shouldShow = !isView || isInView;\n\n useEffect(() => {\n if (!shouldShow) return;\n\n const element = elementRef.current;\n if (!element) return;\n\n const annotation = annotate(element, {\n type: action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n });\n\n annotation.show();\n\n return () => {\n if (element) {\n annotate(element, { type: action }).remove();\n }\n };\n }, [\n shouldShow,\n action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n ]);\n\n return (\n <span ref={elementRef} className=\"relative inline-block bg-transparent\">\n {children}\n </span>\n );\n}\n","type": "registry:ui","target": "components/magicui/highlighter.tsx"}diff --git a/public/r/highlighter.json b/public/r/highlighter.jsonindex 9d7001e7..e7d17be5 100644--- a/public/r/highlighter.json+++ b/public/r/highlighter.json@@ -10,7 +10,7 @@"files": [{"path": "registry/magicui/highlighter.tsx",- "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { annotate } from \"rough-notation\";\nimport type React from \"react\";\n\n// Define available annotation actions\ntype AnnotationAction =\n | \"highlight\"\n | \"underline\"\n | \"box\"\n | \"circle\"\n | \"strike-through\"\n | \"crossed-off\"\n | \"bracket\";\n\n// Custom TypeScript interface for supported props\ninterface HighlighterProps {\n children: React.ReactNode;\n action?: AnnotationAction;\n color?: string;\n strokeWidth?: number;\n animationDuration?: number;\n iterations?: number;\n padding?: number;\n multiline?: boolean;\n}\n\nexport function Highlighter({\n children,\n action = \"highlight\",\n color = \"#ffd1dc\", // Default pink color\n strokeWidth = 1.5,\n animationDuration = 600,\n iterations = 2,\n padding = 2,\n multiline = true,\n}: HighlighterProps) {\n const elementRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n const element = elementRef.current;\n if (element) {\n const annotation = annotate(element, {\n type: action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n });\n\n annotation.show();\n\n // Store the current element in closure for cleanup\n return () => {\n if (element) {\n annotate(element, { type: action }).remove();\n }\n };\n }\n }, [\n action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n ]);\n\n return (\n <span ref={elementRef} className=\"relative inline-block bg-transparent\">\n {children}\n </span>\n );\n}\n",+ "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { useInView } from \"motion/react\";\nimport { annotate } from \"rough-notation\";\nimport type React from \"react\";\n\ntype AnnotationAction =\n | \"highlight\"\n | \"underline\"\n | \"box\"\n | \"circle\"\n | \"strike-through\"\n | \"crossed-off\"\n | \"bracket\";\n\ninterface HighlighterProps {\n children: React.ReactNode;\n action?: AnnotationAction;\n color?: string;\n strokeWidth?: number;\n animationDuration?: number;\n iterations?: number;\n padding?: number;\n multiline?: boolean;\n isView?: boolean;\n}\n\nexport function Highlighter({\n children,\n action = \"highlight\",\n color = \"#ffd1dc\",\n strokeWidth = 1.5,\n animationDuration = 600,\n iterations = 2,\n padding = 2,\n multiline = true,\n isView = false,\n}: HighlighterProps) {\n const elementRef = useRef<HTMLSpanElement>(null);\n const isInView = useInView(elementRef, {\n once: true,\n margin: \"-10%\",\n });\n\n // If isView is false, always show. If isView is true, wait for inView\n const shouldShow = !isView || isInView;\n\n useEffect(() => {\n if (!shouldShow) return;\n\n const element = elementRef.current;\n if (!element) return;\n\n const annotation = annotate(element, {\n type: action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n });\n\n annotation.show();\n\n return () => {\n if (element) {\n annotate(element, { type: action }).remove();\n }\n };\n }, [\n shouldShow,\n action,\n color,\n strokeWidth,\n animationDuration,\n iterations,\n padding,\n multiline,\n ]);\n\n return (\n <span ref={elementRef} className=\"relative inline-block bg-transparent\">\n {children}\n </span>\n );\n}\n","type": "registry:ui","target": "components/magicui/highlighter.tsx"}