style: Change clicked bg color

Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
Tim Hårek Andreassen 2024-04-12 12:01:19 +02:00
parent 3c3a847668
commit 32065b3eda
No known key found for this signature in database
GPG Key ID: E59C7734F0E10EB5
1 changed files with 2 additions and 1 deletions

View File

@ -13,7 +13,7 @@ type Props = {
} & JSX.HTMLAttributes<HTMLButtonElement>; } & JSX.HTMLAttributes<HTMLButtonElement>;
export default function CopyButton(props: Props) { export default function CopyButton(props: Props) {
const { copyText, disabled = false, children, ...buttonProps } = props; const { copyText, disabled = false, children, className = "", ...buttonProps } = props;
const [clicked, setClicked] = useState(false); const [clicked, setClicked] = useState(false);
const startReset = () => { const startReset = () => {
@ -30,6 +30,7 @@ export default function CopyButton(props: Props) {
startReset(); startReset();
}} }}
disabled={!IS_BROWSER || disabled} disabled={!IS_BROWSER || disabled}
className={`${className} ${clicked ? "bg-green-500" : ""}`}
{...buttonProps} {...buttonProps}
> >
{clicked {clicked