Fix minor styling issues with CollapsibleCard

This commit is contained in:
Jared Schoeny
2025-12-22 17:39:05 -10:00
parent 627836b448
commit a7daaff8f6
3 changed files with 10 additions and 5 deletions

View File

@@ -7,16 +7,17 @@ interface CollapsibleCardProps {
title: string;
children: ReactNode;
defaultExpanded?: boolean;
className?: string;
}
export default function CollapsibleCard({ title, children, defaultExpanded = false }: CollapsibleCardProps) {
export default function CollapsibleCard({ title, children, defaultExpanded = false, className }: CollapsibleCardProps) {
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
return (
<div className="card-simple p-4 sm:p-5">
<div className={`px-4 sm:px-5 ${className}`}>
<button
onClick={() => setIsExpanded(!isExpanded)}
className="w-full flex items-center justify-between gap-2 text-left hover:opacity-80 transition-opacity"
className="py-4 sm:py-5 hover:cursor-pointer w-full flex items-center justify-between gap-2 text-left group-hover:opacity-80 transition-opacity"
aria-expanded={isExpanded}
>
<h2 className="text-sm font-semibold text-foreground/90">{title}</h2>
@@ -30,7 +31,7 @@ export default function CollapsibleCard({ title, children, defaultExpanded = fal
</button>
<div
className={`grid transition-all duration-300 ease-in-out ${
isExpanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
isExpanded ? "grid-rows-[1fr] pb-4 sm:pb-5" : "grid-rows-[0fr]"
}`}
>
<div className="overflow-hidden">