mirror of
https://github.com/logto-io/logto.git
synced 2025-02-03 21:48:55 -05:00
style(ui): update notification style (#2265)
This commit is contained in:
parent
0f068d372c
commit
ab9936c74e
3 changed files with 26 additions and 37 deletions
|
@ -4,20 +4,30 @@
|
||||||
padding: _.unit(3) _.unit(4);
|
padding: _.unit(3) _.unit(4);
|
||||||
font: var(--font-body-2);
|
font: var(--font-body-2);
|
||||||
color: var(--color-type-primary);
|
color: var(--color-type-primary);
|
||||||
background: var(--color-alert-99);
|
|
||||||
margin: 0 auto _.unit(2);
|
margin: 0 auto _.unit(2);
|
||||||
@include _.flex_row;
|
@include _.flex_row;
|
||||||
|
|
||||||
&:focus-visible {
|
.icon {
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
color: var(--color-alert-70);
|
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
margin-right: _.unit(3);
|
margin-right: _.unit(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.alert {
|
||||||
|
background: var(--color-alert-99);
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
color: var(--color-alert-70);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.info {
|
||||||
|
background: var(--color-neutral-variant-80);
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
color: var(--color-neutral-variant-60);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.message {
|
.message {
|
||||||
|
@ -26,8 +36,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.link {
|
.link {
|
||||||
text-decoration: underline;
|
|
||||||
cursor: pointer;
|
|
||||||
max-width: 20%;
|
max-width: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,10 +43,4 @@
|
||||||
.notification {
|
.notification {
|
||||||
border-radius: var(--radius);
|
border-radius: var(--radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
.link {
|
|
||||||
&:hover {
|
|
||||||
color: var(--color-brand-default);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +1,23 @@
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
import InfoIcon from '@/assets/icons/info-icon.svg';
|
import InfoIcon from '@/assets/icons/info-icon.svg';
|
||||||
import { onKeyDownHandler } from '@/utils/a11y';
|
|
||||||
|
|
||||||
|
import TextLink from '../TextLink';
|
||||||
import * as styles from './index.module.scss';
|
import * as styles from './index.module.scss';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
className?: string;
|
className?: string;
|
||||||
message: string;
|
message: string;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
type?: 'info' | 'alert';
|
||||||
};
|
};
|
||||||
|
|
||||||
const Notification = ({ className, message, onClose }: Props) => {
|
const Notification = ({ className, message, onClose, type = 'info' }: Props) => {
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(styles.notification, className)}>
|
<div className={classNames(styles.notification, styles[type], className)}>
|
||||||
<InfoIcon className={styles.icon} />
|
<InfoIcon className={styles.icon} />
|
||||||
<div className={styles.message}>{message}</div>
|
<div className={styles.message}>{message}</div>
|
||||||
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
<TextLink text="action.got_it" className={styles.link} onClick={onClose} />
|
||||||
<a
|
|
||||||
role="button"
|
|
||||||
tabIndex={0}
|
|
||||||
className={styles.link}
|
|
||||||
onClick={onClose}
|
|
||||||
onKeyDown={onKeyDownHandler({
|
|
||||||
Esc: onClose,
|
|
||||||
Enter: onClose,
|
|
||||||
' ': onClose,
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
{t('action.got_it')}
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
--color-neutral-95: #eff1f1;
|
--color-neutral-95: #eff1f1;
|
||||||
--color-neutral-100: #fff;
|
--color-neutral-100: #fff;
|
||||||
|
|
||||||
|
--color-neutral-variant-60: #928f9a;
|
||||||
--color-neutral-variant-80: #e5e1ec;
|
--color-neutral-variant-80: #e5e1ec;
|
||||||
|
|
||||||
--color-danger-30: #930006;
|
--color-danger-30: #930006;
|
||||||
|
@ -104,6 +105,7 @@
|
||||||
--color-neutral-99: #191c1d;
|
--color-neutral-99: #191c1d;
|
||||||
--color-neutral-100: #000;
|
--color-neutral-100: #000;
|
||||||
|
|
||||||
|
--color-neutral-variant-60: #928f9a;
|
||||||
--color-neutral-variant-80: #5f5d67;
|
--color-neutral-variant-80: #5f5d67;
|
||||||
--color-neutral-variant-90: #47464e;
|
--color-neutral-variant-90: #47464e;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue