mirror of
https://github.com/logto-io/logto.git
synced 2025-02-24 22:05:56 -05:00
refactor(console): the swap icon should be fixed in the sign-in method item (#2361)
This commit is contained in:
parent
23315de00f
commit
d1a5592872
3 changed files with 16 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
import classNames from 'classnames';
|
||||
import { nanoid } from 'nanoid';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useState } from 'react';
|
||||
|
@ -12,13 +13,14 @@ type Props = {
|
|||
label?: ReactNode;
|
||||
// eslint-disable-next-line react/boolean-prop-naming
|
||||
disabled: boolean;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
const Checkbox = ({ value, onChange, label, disabled }: Props) => {
|
||||
const Checkbox = ({ value, onChange, label, disabled, className }: Props) => {
|
||||
const [id, setId] = useState(nanoid());
|
||||
|
||||
return (
|
||||
<div className={styles.checkbox}>
|
||||
<div className={classNames(styles.checkbox, className)}>
|
||||
<input
|
||||
id={id}
|
||||
type="checkbox"
|
||||
|
|
|
@ -53,6 +53,7 @@ const SignInMethodItem = ({
|
|||
)}
|
||||
>
|
||||
<Checkbox
|
||||
className={styles.checkBox}
|
||||
label={t('sign_in_exp.sign_up_and_sign_in.sign_in.password_auth')}
|
||||
value={password}
|
||||
disabled={!isPasswordCheckable}
|
||||
|
@ -63,6 +64,7 @@ const SignInMethodItem = ({
|
|||
{identifier !== SignInIdentifier.Username && (
|
||||
<>
|
||||
<IconButton
|
||||
className={styles.swapButton}
|
||||
tooltip="sign_in_exp.sign_up_and_sign_in.sign_in.auth_swap_tip"
|
||||
onClick={() => {
|
||||
onToggleVerificationPrimary(identifier);
|
||||
|
@ -71,6 +73,7 @@ const SignInMethodItem = ({
|
|||
<SwitchArrowIcon />
|
||||
</IconButton>
|
||||
<Checkbox
|
||||
className={styles.checkBox}
|
||||
label={t('sign_in_exp.sign_up_and_sign_in.sign_in.verification_code_auth')}
|
||||
value={verificationCode}
|
||||
disabled={!isVerificationCodeCheckable}
|
||||
|
|
|
@ -36,6 +36,15 @@
|
|||
padding: 0 _.unit(2);
|
||||
flex-grow: 1;
|
||||
|
||||
.checkBox {
|
||||
flex-grow: 1;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.swapButton {
|
||||
margin-right: _.unit(4);
|
||||
}
|
||||
|
||||
&.verifyCodePrimary {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue