0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

refactor(console): replace copy button with CopyToClipboard component

replace copy button with CopyToClipboard component
This commit is contained in:
simeng-li 2024-03-08 10:43:36 +08:00
parent c126a4072a
commit f94857f5bd
No known key found for this signature in database
GPG key ID: 14EA7BB1541E8075
2 changed files with 4 additions and 7 deletions

View file

@ -44,7 +44,7 @@
}
}
.actions {
.actionButtons {
display: flex;
gap: _.unit(2);
align-items: center;

View file

@ -5,8 +5,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { toast } from 'react-hot-toast';
import { useTranslation } from 'react-i18next';
import Copy from '@/assets/icons/copy.svg';
import IconButton from '@/ds-components/IconButton';
import CopyToClipboard from '@/ds-components/CopyToClipboard';
import { onKeyDownHandler } from '@/utils/a11y';
import { logtoDarkTheme, defaultOptions } from './config.js';
@ -110,11 +109,9 @@ function MonacoCodeEditor({ className, actions, models }: Props) {
</div>
))}
</div>
<div className={styles.actions}>
<div className={styles.actionButtons}>
{actions}
<IconButton size="small" onClick={handleCodeCopy}>
<Copy />
</IconButton>
<CopyToClipboard variant="icon" value={editorRef.current?.getValue() ?? ''} />
</div>
</header>
<div ref={containerRef} className={styles.editorContainer}>