style: Change clicked bg color
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
parent
3c3a847668
commit
32065b3eda
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue