import "./toggle.css";
import { useToggle } from "./use-toggle.ts";

export function Toggle({ children }) {
  const { open, toggle } = useToggle();
  return (
    <div className="toggle">
      <button aria-expanded={open} onClick={toggle}>
        {open ? "Hide details" : "Show details"}
      </button>
      {open && <div className="toggle-content">{children}</div>}
    </div>
  );
}