apps/web: pass children to buttons

This commit is contained in:
vchikalkin 2024-07-18 19:45:38 +03:00
parent 3bdfbbbfb1
commit cc8b59011c
3 changed files with 9 additions and 9 deletions

View File

@ -14,12 +14,12 @@ export function DefaultForm() {
} = useContext(FormStateContext);
if (step === 'login' && user) {
return <ButtonLoading />;
return <ButtonLoading>Подождите...</ButtonLoading>;
}
return (
<BaseForm onSubmit={(data) => handleLogin(data)}>
<ButtonLogin />
<ButtonLogin>Войти</ButtonLogin>
</BaseForm>
);
}

View File

@ -9,7 +9,7 @@ type Props = ButtonHTMLAttributes<HTMLButtonElement>;
export function ButtonLogin(props: Props) {
return (
<button className={styles['button-submit']} type="submit" {...props}>
Войти
{props.children}
</button>
);
}
@ -19,7 +19,7 @@ export function ButtonLoading(props: Props) {
<button disabled type="button" className={styles['button-submit']} {...props}>
<div className={styles['loading-wrapper']}>
<Spinner alt="spinner" className={styles['spinner-icon']} />
Подождите...
{props.children}
</div>
</button>
);
@ -50,7 +50,7 @@ export function ButtonTelegramLogin(props: Props) {
height={22}
alt="Telegram icon"
/>
Ожидаем подтверждения...
{props.children}
</button>
);
}

View File

@ -16,13 +16,13 @@ export function TelegramForm() {
} = useContext(FormStateContext);
if (step === 'login' && user) {
return <ButtonLoading />;
return <ButtonLoading>Подождите...</ButtonLoading>;
}
if (step === 'telegram') {
return (
<BaseForm onSubmit={() => handleTelegramLogin()}>
<ButtonTelegram>Войти как &nbsp;{user?.displayName}</ButtonTelegram>
<ButtonTelegram>Войти через Telegram</ButtonTelegram>
</BaseForm>
);
}
@ -30,14 +30,14 @@ export function TelegramForm() {
if (step === 'telegram-login') {
return (
<BaseForm onSubmit={() => {}}>
<ButtonTelegramLogin />
<ButtonTelegramLogin>Ожидаем подтверждения...</ButtonTelegramLogin>
</BaseForm>
);
}
return (
<BaseForm onSubmit={(data) => handleLogin(data)}>
<ButtonLogin />
<ButtonLogin>Далее</ButtonLogin>
</BaseForm>
);
}