mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 17:58:55 +00:00
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { useState } from "react";
|
|
import { Tabs } from "../Tabs";
|
|
import { Transition } from "@headlessui/react";
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
import {
|
|
faChevronLeft,
|
|
faChevronRight,
|
|
} from "@fortawesome/pro-solid-svg-icons";
|
|
|
|
interface Props {
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export const SidePanel = ({children}:Props) => {
|
|
const [isVisible, setIsVisible] = useState(true);
|
|
|
|
return (
|
|
<div className="relative border-l border-l-ui-panel-border bg-ui-panel">
|
|
<button
|
|
onClick={() => setIsVisible(!isVisible)}
|
|
className="hover:bg-ui-controls-button absolute left-[-25px] top-1/2 flex rounded-l-lg bg-ui-controls px-2 py-3 align-middle text-sm text-white transition duration-150 ease-in-out"
|
|
>
|
|
<FontAwesomeIcon icon={isVisible ? faChevronRight : faChevronLeft} />
|
|
</button>
|
|
<Transition
|
|
show={isVisible}
|
|
enter="transition-transform duration-300"
|
|
enterFrom="translate-x-full"
|
|
enterTo="translate-x-0"
|
|
leave="transition-transform duration-300"
|
|
leaveFrom="translate-x-0"
|
|
leaveTo="translate-x-full"
|
|
>
|
|
|
|
{children}
|
|
|
|
</Transition>
|
|
</div>
|
|
|
|
);
|
|
};
|