diff --git a/components/KindCard/components/Container.tsx b/components/KindCard/components/Container.tsx index ae100a2..00d6eee 100644 --- a/components/KindCard/components/Container.tsx +++ b/components/KindCard/components/Container.tsx @@ -1,6 +1,5 @@ "use client"; -import Image from "next/image"; -import Link from "next/link"; +import { useRef, useEffect, useState } from "react"; import { RiMoreFill } from "react-icons/ri"; import { Card, CardContent, CardHeader } from "@/components/ui/card"; import { formatDate } from "@/lib/utils/dates"; @@ -13,6 +12,7 @@ import Tags from "./Tags"; import DropDownMenu from "@/components/DropDownMenu"; import { removeDuplicates } from "@/lib/utils"; import { type KindCardProps } from ".."; +import { cn } from "@/lib/utils"; type OptionLink = { href: string; @@ -37,6 +37,19 @@ export default function Container({ actionOptions = [], event, }: CreatorCardProps) { + const contentRef = useRef(null); + const [expandButton, setExpandButton] = useState(null); + const [showFull, setShowFull] = useState(false); + useEffect(() => { + if (contentRef.current) { + if (contentRef.current.scrollHeight > 350) { + setExpandButton(true); + } else { + setExpandButton(false); + } + } + }, [contentRef.current]); + if (!event) { return ( @@ -90,8 +103,23 @@ export default function Container({ - + {children} + {!showFull && expandButton && ( +
+
+ {/*
*/} + +
+ )}
{!!contentTags?.length ? (