mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
hide ellipsis if non-expandable
This commit is contained in:
1 parent
9a78323372
commit
bedd8f1740
1 file changed
+2
-2
@@ -7,11 +7,11 @@ interface Props {
|
||||
export const TextExpander: React.FC<Props> = ({ text }) => {
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
|
||||
const shortText = text.slice(0, 250) + "...";
|
||||
const shortText = text.slice(0, 250);
|
||||
|
||||
return (
|
||||
<>
|
||||
{expanded ? text : shortText}
|
||||
{expanded || text.length <= 250 ? text : shortText + "..."}
|
||||
{text.length > 250 && (
|
||||
<button
|
||||
className="btn-link fw-medium p-0 ps-1"
|
||||
|
||||
Reference in new issue
Block a user