diff --git a/packages/console/src/components/Alert/index.module.scss b/packages/console/src/components/Alert/index.module.scss new file mode 100644 index 000000000..fae19b8b6 --- /dev/null +++ b/packages/console/src/components/Alert/index.module.scss @@ -0,0 +1,35 @@ +@use '@/scss/underscore' as _; + +.alert { + padding: _.unit(3) _.unit(4); + margin: _.unit(2) 0; + font: var(--font-body-medium); + display: flex; + border-radius: 8px; + align-items: center; + + .icon { + width: 20px; + height: 20px; + } + + .content { + flex: 1; + margin: 0 _.unit(3); + } + + .action { + a { + color: var(--color-text); + text-decoration: underline; + } + } + + &.info { + background: var(--color-surface-variant); + + .icon { + color: var(--color-neutral-variant-60); + } + } +} diff --git a/packages/console/src/components/Alert/index.tsx b/packages/console/src/components/Alert/index.tsx new file mode 100644 index 000000000..250a0a0b9 --- /dev/null +++ b/packages/console/src/components/Alert/index.tsx @@ -0,0 +1,33 @@ +import { I18nKey } from '@logto/phrases'; +import classNames from 'classnames'; +import React, { ReactNode } from 'react'; + +import LinkButton from '@/components/LinkButton'; +import Info from '@/icons/Info'; + +import * as styles from './index.module.scss'; + +type Props = { + severity?: 'info'; + children?: ReactNode; + action?: I18nKey; + href?: string; +}; + +const Alert = ({ children, action, href, severity = 'info' }: Props) => { + return ( +
+
+ +
+
{children}
+ {action && href && ( +
+ +
+ )} +
+ ); +}; + +export default Alert; diff --git a/packages/console/src/icons/Info.tsx b/packages/console/src/icons/Info.tsx new file mode 100644 index 000000000..79f112bbb --- /dev/null +++ b/packages/console/src/icons/Info.tsx @@ -0,0 +1,20 @@ +import React from 'react'; + +const Info = () => ( + + + + + +); + +export default Info; diff --git a/packages/phrases/src/locales/en.ts b/packages/phrases/src/locales/en.ts index 310fc085b..34812c2d8 100644 --- a/packages/phrases/src/locales/en.ts +++ b/packages/phrases/src/locales/en.ts @@ -407,6 +407,11 @@ const translation = { }, }, }, + setup_warning: { + setup: 'Set up', + no_connector: + 'You haven’t set up any social connectors yet. Your sign in experience won’t go live until you finish the settings first. ', + }, }, settings: { title: 'settings', diff --git a/packages/phrases/src/locales/zh-cn.ts b/packages/phrases/src/locales/zh-cn.ts index 0333176be..37e19fb8b 100644 --- a/packages/phrases/src/locales/zh-cn.ts +++ b/packages/phrases/src/locales/zh-cn.ts @@ -403,6 +403,10 @@ const translation = { }, }, }, + setup_warning: { + setup: '设置', + no_connector: '你尚未添加社交登录连接器。你需要先完成设置才能启用。', + }, }, settings: { title: '设置',