Add smooth open/close animation to InfoBox component

Implements a slide-down fade-in animation when the InfoBox expands, improving the user experience with smooth visual transitions.

Changes:
- Add animateDown keyframe animation to Tailwind config
- Apply animation to InfoBox content div when opened
- Animation includes opacity fade, vertical slide, and max-height transition
- Update InfoBox width to use responsive sizing (17rem on mobile, 28rem on larger screens)
- Change icon color to green for better visual consistency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-26 13:51:17 +01:00
parent 364a12f9d6
commit 985fb4bc41
2 changed files with 14 additions and 2 deletions

View File

@@ -10,13 +10,13 @@ export const InfoBox: FC<{
const t = useTranslations("info-box");
return (
<details className="group border border-gray-800 rounded-lg p-2 mb-1 max-w-md">
<details className="group border border-gray-800 rounded-lg p-2 mb-1 w-[17rem] sm:w-[28rem]">
<summary className="flex cursor-pointer items-center justify-between">
<span className="font-bold"><QuestionMarkCircleIcon className="w-6 h-6 inline mr-1 mt-[-.3em] text-green-300" /> {title ?? t("default-title")}</span>
<span className="ml-2 text-sm text-gray-500 group-open:hidden"><ChevronDownIcon className="w-5 h-5 inline" /></span>
<span className="ml-2 text-sm text-gray-500 hidden group-open:inline"><ChevronUpIcon className="w-5 h-5 inline" /></span>
</summary>
<div className="mt-2 italic text-sm text-gray-400">{children}</div>
<div className="mt-2 italic text-sm text-gray-400 group-open:animate-[animateDown_0.2s_linear_forwards]">{children}</div>
</details>
)
}

View File

@@ -25,6 +25,18 @@ const config: Config = {
transform: 'translateX(100%)',
},
},
animateDown: {
'0%': {
opacity: '0',
transform: 'translateY(-15px)',
maxHeight: '0px',
},
'100%': {
opacity: '1',
transform: 'translateY(0)',
maxHeight: '200px',
},
},
},
},
plugins: [