diff --git a/src/content/TextAnimations/SplitText/SplitText.jsx b/src/content/TextAnimations/SplitText/SplitText.jsx index b32a5523..fb655762 100644 --- a/src/content/TextAnimations/SplitText/SplitText.jsx +++ b/src/content/TextAnimations/SplitText/SplitText.jsx @@ -155,50 +155,13 @@ const SplitText = ({ willChange: 'transform, opacity' }; const classes = `split-parent ${className}`; - switch (tag) { - case 'h1': - return ( -

- {text} -

- ); - case 'h2': - return ( -

- {text} -

- ); - case 'h3': - return ( -

- {text} -

- ); - case 'h4': - return ( -

- {text} -

- ); - case 'h5': - return ( -
- {text} -
- ); - case 'h6': - return ( -
- {text} -
- ); - default: - return ( -

- {text} -

- ); - } + const Tag = (tag || 'p'); + + return ( + + {text} + + ); }; return renderTag(); }; diff --git a/src/tailwind/TextAnimations/SplitText/SplitText.jsx b/src/tailwind/TextAnimations/SplitText/SplitText.jsx index ce934826..a3d4849d 100644 --- a/src/tailwind/TextAnimations/SplitText/SplitText.jsx +++ b/src/tailwind/TextAnimations/SplitText/SplitText.jsx @@ -150,50 +150,13 @@ const SplitText = ({ willChange: 'transform, opacity' }; const classes = `split-parent overflow-hidden inline-block whitespace-normal ${className}`; - switch (tag) { - case 'h1': - return ( -

- {text} -

- ); - case 'h2': - return ( -

- {text} -

- ); - case 'h3': - return ( -

- {text} -

- ); - case 'h4': - return ( -

- {text} -

- ); - case 'h5': - return ( -
- {text} -
- ); - case 'h6': - return ( -
- {text} -
- ); - default: - return ( -

- {text} -

- ); - } + const Tag = (tag || 'p'); + + return ( + + {text} + + ); }; return renderTag(); }; diff --git a/src/ts-default/TextAnimations/SplitText/SplitText.tsx b/src/ts-default/TextAnimations/SplitText/SplitText.tsx index 23f2264f..87da3f61 100644 --- a/src/ts-default/TextAnimations/SplitText/SplitText.tsx +++ b/src/ts-default/TextAnimations/SplitText/SplitText.tsx @@ -165,50 +165,13 @@ const SplitText: React.FC = ({ willChange: 'transform, opacity' }; const classes = `split-parent ${className}`; - switch (tag) { - case 'h1': - return ( -

- {text} -

- ); - case 'h2': - return ( -

- {text} -

- ); - case 'h3': - return ( -

- {text} -

- ); - case 'h4': - return ( -

- {text} -

- ); - case 'h5': - return ( -
- {text} -
- ); - case 'h6': - return ( -
- {text} -
- ); - default: - return ( -

- {text} -

- ); - } + const Tag = (tag || 'p') as React.ElementType; + + return ( + + {text} + + ); }; return renderTag(); }; diff --git a/src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx b/src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx index 605d941f..1eac2ba0 100644 --- a/src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx +++ b/src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx @@ -155,6 +155,7 @@ const SplitText: React.FC = ({ } ); + const renderTag = () => { const style: React.CSSProperties = { textAlign, @@ -162,52 +163,17 @@ const SplitText: React.FC = ({ willChange: 'transform, opacity' }; const classes = `split-parent overflow-hidden inline-block whitespace-normal ${className}`; - switch (tag) { - case 'h1': - return ( -

- {text} -

- ); - case 'h2': - return ( -

- {text} -

- ); - case 'h3': - return ( -

- {text} -

- ); - case 'h4': - return ( -

- {text} -

- ); - case 'h5': - return ( -
- {text} -
- ); - case 'h6': - return ( -
- {text} -
- ); - default: - return ( -

- {text} -

- ); - } + const Tag = (tag || 'p') as React.ElementType; + + return ( + + {text} + + ); }; + + return renderTag(); };