Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 7 additions & 44 deletions src/content/TextAnimations/SplitText/SplitText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,50 +155,13 @@ const SplitText = ({
willChange: 'transform, opacity'
};
const classes = `split-parent ${className}`;
switch (tag) {
case 'h1':
return (
<h1 ref={ref} style={style} className={classes}>
{text}
</h1>
);
case 'h2':
return (
<h2 ref={ref} style={style} className={classes}>
{text}
</h2>
);
case 'h3':
return (
<h3 ref={ref} style={style} className={classes}>
{text}
</h3>
);
case 'h4':
return (
<h4 ref={ref} style={style} className={classes}>
{text}
</h4>
);
case 'h5':
return (
<h5 ref={ref} style={style} className={classes}>
{text}
</h5>
);
case 'h6':
return (
<h6 ref={ref} style={style} className={classes}>
{text}
</h6>
);
default:
return (
<p ref={ref} style={style} className={classes}>
{text}
</p>
);
}
const Tag = (tag || 'p');

return (
<Tag ref={ref} style={style} className={classes}>
{text}
</Tag>
);
};
return renderTag();
};
Expand Down
51 changes: 7 additions & 44 deletions src/tailwind/TextAnimations/SplitText/SplitText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<h1 ref={ref} style={style} className={classes}>
{text}
</h1>
);
case 'h2':
return (
<h2 ref={ref} style={style} className={classes}>
{text}
</h2>
);
case 'h3':
return (
<h3 ref={ref} style={style} className={classes}>
{text}
</h3>
);
case 'h4':
return (
<h4 ref={ref} style={style} className={classes}>
{text}
</h4>
);
case 'h5':
return (
<h5 ref={ref} style={style} className={classes}>
{text}
</h5>
);
case 'h6':
return (
<h6 ref={ref} style={style} className={classes}>
{text}
</h6>
);
default:
return (
<p ref={ref} style={style} className={classes}>
{text}
</p>
);
}
const Tag = (tag || 'p');

return (
<Tag ref={ref} style={style} className={classes}>
{text}
</Tag>
);
};
return renderTag();
};
Expand Down
51 changes: 7 additions & 44 deletions src/ts-default/TextAnimations/SplitText/SplitText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,50 +165,13 @@ const SplitText: React.FC<SplitTextProps> = ({
willChange: 'transform, opacity'
};
const classes = `split-parent ${className}`;
switch (tag) {
case 'h1':
return (
<h1 ref={ref} style={style} className={classes}>
{text}
</h1>
);
case 'h2':
return (
<h2 ref={ref} style={style} className={classes}>
{text}
</h2>
);
case 'h3':
return (
<h3 ref={ref} style={style} className={classes}>
{text}
</h3>
);
case 'h4':
return (
<h4 ref={ref} style={style} className={classes}>
{text}
</h4>
);
case 'h5':
return (
<h5 ref={ref} style={style} className={classes}>
{text}
</h5>
);
case 'h6':
return (
<h6 ref={ref} style={style} className={classes}>
{text}
</h6>
);
default:
return (
<p ref={ref} style={style} className={classes}>
{text}
</p>
);
}
const Tag = (tag || 'p') as React.ElementType;

return (
<Tag ref={ref} style={style} className={classes}>
{text}
</Tag>
);
};
return renderTag();
};
Expand Down
54 changes: 10 additions & 44 deletions src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,59 +155,25 @@ const SplitText: React.FC<SplitTextProps> = ({
}
);


const renderTag = () => {
const style: React.CSSProperties = {
textAlign,
wordWrap: 'break-word',
willChange: 'transform, opacity'
};
const classes = `split-parent overflow-hidden inline-block whitespace-normal ${className}`;
switch (tag) {
case 'h1':
return (
<h1 ref={ref} style={style} className={classes}>
{text}
</h1>
);
case 'h2':
return (
<h2 ref={ref} style={style} className={classes}>
{text}
</h2>
);
case 'h3':
return (
<h3 ref={ref} style={style} className={classes}>
{text}
</h3>
);
case 'h4':
return (
<h4 ref={ref} style={style} className={classes}>
{text}
</h4>
);
case 'h5':
return (
<h5 ref={ref} style={style} className={classes}>
{text}
</h5>
);
case 'h6':
return (
<h6 ref={ref} style={style} className={classes}>
{text}
</h6>
);
default:
return (
<p ref={ref} style={style} className={classes}>
{text}
</p>
);
}
const Tag = (tag || 'p') as React.ElementType;

return (
<Tag ref={ref} style={style} className={classes}>
{text}
</Tag>
);
};



return renderTag();
};

Expand Down