mirror of
https://github.com/logto-io/logto.git
synced 2025-02-24 22:05:56 -05:00
fix(console): use icon button in copytoclipboard (#1440)
This commit is contained in:
parent
d4a37d7a38
commit
f8a9743b2e
2 changed files with 6 additions and 11 deletions
|
@ -26,15 +26,7 @@
|
|||
cursor: text;
|
||||
|
||||
.copyIcon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: _.unit(3);
|
||||
color: var(--color-icon);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: var(--color-text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import { TFuncKey, useTranslation } from 'react-i18next';
|
|||
|
||||
import Copy from '@/icons/Copy';
|
||||
|
||||
import IconButton from '../IconButton';
|
||||
import Tooltip from '../Tooltip';
|
||||
import * as styles from './index.module.scss';
|
||||
|
||||
|
@ -26,7 +27,7 @@ const CopyToClipboard = ({ value, className, variant = 'contained' }: Props) =>
|
|||
});
|
||||
}, []);
|
||||
|
||||
const copy: MouseEventHandler<HTMLDivElement> = async () => {
|
||||
const copy: MouseEventHandler<HTMLButtonElement> = async () => {
|
||||
setCopyState('copying');
|
||||
await navigator.clipboard.writeText(value);
|
||||
setCopyState('copied');
|
||||
|
@ -41,8 +42,10 @@ const CopyToClipboard = ({ value, className, variant = 'contained' }: Props) =>
|
|||
>
|
||||
<div className={styles.row}>
|
||||
{variant === 'icon' ? null : value}
|
||||
<div ref={copyIconReference} className={styles.copyIcon} onClick={copy}>
|
||||
<Copy />
|
||||
<div ref={copyIconReference} className={styles.copyIcon}>
|
||||
<IconButton onClick={copy}>
|
||||
<Copy />
|
||||
</IconButton>
|
||||
</div>
|
||||
<Tooltip
|
||||
anchorRef={copyIconReference}
|
||||
|
|
Loading…
Add table
Reference in a new issue