Files
evidencija-rezija/app/ui/InfoBox.tsx
Nikola Derežić 985fb4bc41 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>
2025-11-26 13:51:17 +01:00

24 lines
1.1 KiB
TypeScript

import { ChevronDownIcon, ChevronUpIcon, QuestionMarkCircleIcon } from "@heroicons/react/24/outline";
import { useTranslations } from "next-intl";
import { FC, ReactNode } from "react";
export const InfoBox: FC<{
children: ReactNode;
title?: string;
}> = ({ children, title }) => {
const t = useTranslations("info-box");
return (
<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 group-open:animate-[animateDown_0.2s_linear_forwards]">{children}</div>
</details>
)
}