mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
33 lines
756 B
TypeScript
33 lines
756 B
TypeScript
import {
|
|
faChevronDown,
|
|
faChevronRight,
|
|
} from "@fortawesome/free-solid-svg-icons";
|
|
import React, { useState } from "react";
|
|
import { Button, Collapse } from "react-bootstrap";
|
|
import { Icon } from "./Icon";
|
|
|
|
interface IProps {
|
|
text: string;
|
|
}
|
|
|
|
export const CollapseButton: React.FC<React.PropsWithChildren<IProps>> = (
|
|
props: React.PropsWithChildren<IProps>
|
|
) => {
|
|
const [open, setOpen] = useState(false);
|
|
|
|
return (
|
|
<div>
|
|
<Button
|
|
onClick={() => setOpen(!open)}
|
|
className="minimal collapse-button"
|
|
>
|
|
<Icon icon={open ? faChevronDown : faChevronRight} />
|
|
<span>{props.text}</span>
|
|
</Button>
|
|
<Collapse in={open}>
|
|
<div>{props.children}</div>
|
|
</Collapse>
|
|
</div>
|
|
);
|
|
};
|