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:
parent
c126a4072a
commit
f94857f5bd
2 changed files with 4 additions and 7 deletions
|
@ -44,7 +44,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.actions {
|
.actionButtons {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: _.unit(2);
|
gap: _.unit(2);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -5,8 +5,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { toast } from 'react-hot-toast';
|
import { toast } from 'react-hot-toast';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import Copy from '@/assets/icons/copy.svg';
|
import CopyToClipboard from '@/ds-components/CopyToClipboard';
|
||||||
import IconButton from '@/ds-components/IconButton';
|
|
||||||
import { onKeyDownHandler } from '@/utils/a11y';
|
import { onKeyDownHandler } from '@/utils/a11y';
|
||||||
|
|
||||||
import { logtoDarkTheme, defaultOptions } from './config.js';
|
import { logtoDarkTheme, defaultOptions } from './config.js';
|
||||||
|
@ -110,11 +109,9 @@ function MonacoCodeEditor({ className, actions, models }: Props) {
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.actions}>
|
<div className={styles.actionButtons}>
|
||||||
{actions}
|
{actions}
|
||||||
<IconButton size="small" onClick={handleCodeCopy}>
|
<CopyToClipboard variant="icon" value={editorRef.current?.getValue() ?? ''} />
|
||||||
<Copy />
|
|
||||||
</IconButton>
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div ref={containerRef} className={styles.editorContainer}>
|
<div ref={containerRef} className={styles.editorContainer}>
|
||||||
|
|
Loading…
Reference in a new issue