1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 05:41:17 -04:00

properly merge multiple class names

This commit is contained in:
2022-01-20 10:38:18 -05:00
parent 0462428a54
commit 2162e9d563
10 changed files with 47 additions and 34 deletions

View File

@@ -11,9 +11,10 @@ const cx = classNames.bind(styles);
type Props = {
source: ReactNode;
timeout?: number;
className?: string;
};
const CopyButton = ({ source, timeout = 2000 }: Props) => {
const CopyButton = ({ source, timeout = 2000, className }: Props) => {
const [copied, setCopied] = useState(false);
const handleCopy = (e) => {
@@ -43,7 +44,7 @@ const CopyButton = ({ source, timeout = 2000 }: Props) => {
return (
<button
className={cx({ copy: true, success: !!copied })}
className={cx({ copy: true, success: !!copied }, className)}
title="Copy to clipboard"
aria-label="Copy to clipboard"
onClick={handleCopy}