mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
Merge pull request #5623 from logto-io/yemq-prd-700-prd-701-fix-code-editor-action-button-styles
chore(console,toolkit): update custom JWT details page code editor action buttons style
This commit is contained in:
commit
7fecc0f3d5
5 changed files with 46 additions and 3 deletions
|
@ -1,18 +1,22 @@
|
|||
import classNames from 'classnames';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import RedoIcon from '@/assets/icons/redo.svg';
|
||||
|
||||
import ActionButton from './index';
|
||||
import * as styles from './index.module.scss';
|
||||
|
||||
type Props = {
|
||||
className?: string;
|
||||
onClick: () => void;
|
||||
};
|
||||
|
||||
function CodeRestoreButton({ onClick }: Props) {
|
||||
function CodeRestoreButton({ className, onClick }: Props) {
|
||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
|
||||
return (
|
||||
<ActionButton
|
||||
className={classNames(className, styles.actionButton)}
|
||||
actionTip={t('jwt_claims.restore')}
|
||||
actionSuccessTip={t('jwt_claims.restored')}
|
||||
icon={<RedoIcon />}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
@use '@/scss/underscore' as _;
|
||||
|
||||
.actionButton {
|
||||
border-radius: 6px;
|
||||
}
|
|
@ -43,8 +43,31 @@
|
|||
|
||||
.actionButtons {
|
||||
display: flex;
|
||||
gap: _.unit(2);
|
||||
gap: _.unit(3);
|
||||
align-items: center;
|
||||
background: none;
|
||||
|
||||
svg {
|
||||
color: var(--color-code-grey);
|
||||
}
|
||||
|
||||
.iconButton {
|
||||
transition: background 0.2s ease-in-out;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: var(--color-overlay-dark-bg-hover);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: var(--color-overlay-dark-bg-pressed);
|
||||
}
|
||||
|
||||
// TODO (LOG-8602): Remove the default left margin of CopyToClipboard copyToolTipAnchor component.
|
||||
div[class*='copyToolTipAnchor'] {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,7 @@ function MonacoCodeEditor({
|
|||
<div className={styles.actionButtons}>
|
||||
{enabledActions.includes('restore') && (
|
||||
<CodeRestoreButton
|
||||
className={styles.iconButton}
|
||||
onClick={() => {
|
||||
if (activeModel && value !== activeModel.defaultValue) {
|
||||
onChange?.(activeModel.defaultValue);
|
||||
|
@ -166,7 +167,11 @@ function MonacoCodeEditor({
|
|||
/>
|
||||
)}
|
||||
{enabledActions.includes('copy') && (
|
||||
<CopyToClipboard variant="icon" value={editorRef.current?.getValue() ?? ''} />
|
||||
<CopyToClipboard
|
||||
variant="icon"
|
||||
value={editorRef.current?.getValue() ?? ''}
|
||||
className={styles.iconButton}
|
||||
/>
|
||||
)}
|
||||
{actionButtons}
|
||||
</div>
|
||||
|
|
|
@ -170,6 +170,9 @@
|
|||
--color-overlay-primary-pressed: rgba(93, 52, 242, 12%); // 12% Primary-40
|
||||
--color-function-n-overlay-primary-focused: rgba(93, 52, 242, 16%); // 16% Primary-40
|
||||
--color-overlay-danger-hover: rgba(186, 27, 27, 8%); // 8% Error-40
|
||||
--color-overlay-dark-bg-hover: rgba(255, 255, 255, 12%); // 12% static white
|
||||
--color-overlay-dark-bg-pressed: rgba(255, 255, 255, 18%); // 18% static white
|
||||
--color-overlay-dark-bg-focused: rgba(255, 255, 255, 24%); // 24% static white
|
||||
|
||||
// Shadows
|
||||
--shadow-1: 0 4px 8px rgba(0, 0, 0, 8%);
|
||||
|
@ -391,6 +394,9 @@
|
|||
--color-overlay-primary-pressed: rgba(202, 190, 255, 12%); // 12% Primary-40
|
||||
--color-function-n-overlay-primary-focused: rgba(202, 190, 255, 16%); // 16% Primary-40
|
||||
--color-overlay-danger-hover: rgba(186, 27, 27, 8%); // 8% Error-40
|
||||
--color-overlay-dark-bg-hover: rgba(255, 255, 255, 12%); // 12% static white
|
||||
--color-overlay-dark-bg-pressed: rgba(255, 255, 255, 18%); // 18% static white
|
||||
--color-overlay-dark-bg-focused: rgba(255, 255, 255, 24%); // 24% static white
|
||||
|
||||
// Shadows
|
||||
--shadow-1: 0 4px 8px rgba(0, 0, 0, 8%);
|
||||
|
|
Loading…
Add table
Reference in a new issue