diff --git a/packages/ui/src/assets/icons/switch-icon.svg b/packages/ui/src/assets/icons/switch-icon.svg new file mode 100644 index 000000000..bda10c435 --- /dev/null +++ b/packages/ui/src/assets/icons/switch-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/ui/src/components/TextLink/index.module.scss b/packages/ui/src/components/TextLink/index.module.scss index 1d87c12ad..988a20df7 100644 --- a/packages/ui/src/components/TextLink/index.module.scss +++ b/packages/ui/src/components/TextLink/index.module.scss @@ -3,7 +3,12 @@ .link { cursor: pointer; -webkit-tap-highlight-color: transparent; + display: inline-flex; + justify-content: center; + > svg { + margin-right: _.unit(2); + } &.primary { color: var(--color-brand-default); diff --git a/packages/ui/src/components/TextLink/index.tsx b/packages/ui/src/components/TextLink/index.tsx index 3ecf38e2a..caaf55e21 100644 --- a/packages/ui/src/components/TextLink/index.tsx +++ b/packages/ui/src/components/TextLink/index.tsx @@ -11,15 +11,17 @@ export type Props = AnchorHTMLAttributes & { className?: string; children?: ReactNode; text?: TFuncKey; + icon?: ReactNode; type?: 'primary' | 'secondary'; } & Partial; -const TextLink = ({ className, children, text, type = 'primary', to, ...rest }: Props) => { +const TextLink = ({ className, children, text, icon, type = 'primary', to, ...rest }: Props) => { const { t } = useTranslation(); if (to) { return ( + {icon} {children ?? (text ? t(text) : '')} ); @@ -27,6 +29,7 @@ const TextLink = ({ className, children, text, type = 'primary', to, ...rest }: return ( + {icon} {children ?? (text ? t(text) : '')} ); diff --git a/packages/ui/src/containers/PasswordSignInForm/PasswordlessSignInLink.tsx b/packages/ui/src/containers/PasswordSignInForm/PasswordlessSignInLink.tsx index d826ef01f..b27a13b06 100644 --- a/packages/ui/src/containers/PasswordSignInForm/PasswordlessSignInLink.tsx +++ b/packages/ui/src/containers/PasswordSignInForm/PasswordlessSignInLink.tsx @@ -1,6 +1,7 @@ import { SignInIdentifier } from '@logto/schemas'; import { useContext, useEffect } from 'react'; +import SwitchIcon from '@/assets/icons/switch-icon.svg'; import TextLink from '@/components/TextLink'; import { PageContext } from '@/hooks/use-page-context'; import useSendVerificationCode from '@/hooks/use-send-verification-code'; @@ -31,6 +32,7 @@ const PasswordlessSignInLink = ({ className, method, value }: Props) => { } onClick={() => { clearErrorMessage(); void onSubmit(method === SignInIdentifier.Email ? { email: value } : { phone: value }); diff --git a/packages/ui/src/containers/PasswordSignInForm/index.module.scss b/packages/ui/src/containers/PasswordSignInForm/index.module.scss index b0eef7aef..e4b862cfb 100644 --- a/packages/ui/src/containers/PasswordSignInForm/index.module.scss +++ b/packages/ui/src/containers/PasswordSignInForm/index.module.scss @@ -9,11 +9,14 @@ .inputField, .link, - .switch, .formErrors { margin-bottom: _.unit(4); } + .switch { + margin-top: _.unit(4); + } + .link, .switch { align-self: start; diff --git a/packages/ui/src/containers/PasswordSignInForm/index.tsx b/packages/ui/src/containers/PasswordSignInForm/index.tsx index 594fa53f3..b39db3da0 100644 --- a/packages/ui/src/containers/PasswordSignInForm/index.tsx +++ b/packages/ui/src/containers/PasswordSignInForm/index.tsx @@ -91,12 +91,12 @@ const PasswordSignInForm = ({ /> )} +