Small fixes, Fix lint, Expand dropdown to have correct style and add icon

This commit is contained in:
Hannah dagemark 2026-09-29 12:28:13 +02:00
commit c1d8ff9049
8 changed files with 70 additions and 27 deletions

View file

@ -1,19 +1,47 @@
import { useState } from "react";
import Button from "./Button";
import React from "react";
import { ArrowRightIcon } from "@heroicons/react/24/outline";
export default function Dropdown({ children }: { children: React.ReactNode }) {
import Button from "./Button";
import RoundedContainer from "./RoundedContainer";
export default function Dropdown({
title,
mode,
children,
}: {
title?: string;
mode?: "DARK" | "LIGHT";
children: React.ReactNode;
}) {
const [dropped, setDropped] = useState<boolean>(false);
const [degrees, setDegrees] = useState<number>(0);
return (
<div>
<Button
title="Drop down"
mode="DARK"
title={title ? title : ""}
mode={mode}
onClick={() => {
setDropped(!dropped);
if (degrees < 90) {
setDegrees(90);
} else {
setDegrees(0);
}
}}
></Button>
{dropped && <div>{children}</div>}
icon={
<ArrowRightIcon
className={`size-4 transition-transform rotate-${degrees}`}
/>
}
/>
<RoundedContainer
slim={true}
className={`${!dropped && "invisible"} absolute z-10 flex flex-col gap-2 transition-discrete duration-150 ease-out`}
>
{children}
</RoundedContainer>
</div>
);
}