Skip to content

Commit

Permalink
sort login method
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh committed Oct 31, 2023
1 parent 5e0d87d commit be4ed20
Showing 1 changed file with 34 additions and 25 deletions.
59 changes: 34 additions & 25 deletions src/pages/TrueSightV2/pages/RegisterWhitelist/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import styled from 'styled-components'
import { ButtonLight, ButtonPrimary } from 'components/Button'
import Column from 'components/Column'
import DownloadWalletModal from 'components/DownloadWalletModal'
import { useActiveWeb3React } from 'hooks'
import useLogin from 'hooks/useLogin'
import useTheme from 'hooks/useTheme'
import { useValidateEmail } from 'pages/NotificationCenter/NotificationPreference'
Expand All @@ -18,40 +19,48 @@ const Wrapper = styled(Column)`
width: 340px;
gap: 16px;
align-items: center;
${({ theme }) => theme.mediaWidth.upToSmall`
width: 100%;
`};
`

export default function SignInForm() {
const { signIn } = useLogin()
const { account } = useActiveWeb3React()
const theme = useTheme()
const openDownloadWalletModal = useOpenModal(ApplicationModal.DOWNLOAD_WALLET)
const { inputEmail, errorInput, onChangeEmail } = useValidateEmail('')
return (
<Wrapper>
<InputEmail
value={inputEmail}
hasError={!!errorInput}
onChange={onChangeEmail}
style={{ height: 36, width: '100%' }}
isVerifiedEmail
/>
<ButtonPrimary
onClick={() => inputEmail && !errorInput && signIn({ loginMethod: LoginMethod.EMAIL, account: inputEmail })}
height={'36px'}
>
<Trans>Sign-In</Trans>
</ButtonPrimary>
<Wrapper style={{ flexDirection: account ? 'column-reverse' : 'column' }}>
<Column gap="16px" width={'100%'}>
<InputEmail
value={inputEmail}
hasError={!!errorInput}
onChange={onChangeEmail}
style={{ height: 36, width: '100%' }}
isVerifiedEmail
/>
<ButtonPrimary
onClick={() => inputEmail && !errorInput && signIn({ loginMethod: LoginMethod.EMAIL, account: inputEmail })}
height={'36px'}
>
<Trans>Sign-In with Email</Trans>
</ButtonPrimary>
</Column>
<OrDivider />
<ButtonLight onClick={() => signIn()} height={'36px'}>
<Trans>Sign-In with Wallet</Trans>
</ButtonLight>
<Text color={theme.subText} fontSize={'12px'}>
<Trans>
Don&apos;t have a wallet?{' '}
<Text as="span" sx={{ cursor: 'pointer' }} color={theme.primary} onClick={openDownloadWalletModal}>
Get started here
</Text>
</Trans>
</Text>
<Column gap="16px" width={'100%'} alignItems={'center'}>
<ButtonLight onClick={() => signIn()} height={'36px'}>
<Trans>Sign-In with Wallet</Trans>
</ButtonLight>
<Text color={theme.subText} fontSize={'12px'}>
<Trans>
Don&apos;t have a wallet?{' '}
<Text as="span" sx={{ cursor: 'pointer' }} color={theme.primary} onClick={openDownloadWalletModal}>
Get started here
</Text>
</Trans>
</Text>
</Column>
<DownloadWalletModal />
</Wrapper>
)
Expand Down

0 comments on commit be4ed20

Please sign in to comment.