mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-09-16 18:35:33 -04:00
properly merge multiple class names
This commit is contained in:
@@ -1,19 +1,8 @@
|
||||
.copy {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 0.65em;
|
||||
line-height: 1;
|
||||
color: var(--medium-dark);
|
||||
background-color: var(--background-inner);
|
||||
border: 1px solid var(--kinda-light);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.copy:hover {
|
||||
color: var(--link);
|
||||
}
|
||||
|
||||
.success {
|
||||
color: var(--success) !important;
|
||||
}
|
||||
|
@@ -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}
|
||||
|
Reference in New Issue
Block a user