-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve send to recipient form, add route priority select
- Loading branch information
Showing
10 changed files
with
159 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { InputBase } from '@mui/material'; | ||
import { inputBaseClasses } from '@mui/material/InputBase'; | ||
import { alpha, styled } from '@mui/material/styles'; | ||
|
||
export const Input = styled(InputBase)(({ theme }) => ({ | ||
backgroundColor: theme.palette.mode === 'light' ? theme.palette.common.white : theme.palette.grey[900], | ||
borderRadius: 8, | ||
borderWidth: 2, | ||
borderStyle: 'solid', | ||
borderColor: theme.palette.grey[300], | ||
paddingRight: '14px', | ||
transition: theme.transitions.create([ | ||
'border-color', | ||
'background-color', | ||
'box-shadow', | ||
]), | ||
[`& .${inputBaseClasses.input}`]: { | ||
padding: '8.5px 0 8.5px 14px', | ||
}, | ||
[`&.${inputBaseClasses.focused}`]: { | ||
boxShadow: `${alpha(theme.palette.primary.main, 0.25)} 0 0 0 0.2rem`, | ||
borderColor: theme.palette.primary.main, | ||
}, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Select as MuiSelect } from '@mui/material'; | ||
import { inputBaseClasses } from '@mui/material/InputBase'; | ||
import { outlinedInputClasses } from '@mui/material/OutlinedInput'; | ||
import { alpha, styled } from '@mui/material/styles'; | ||
|
||
export const Select = styled(MuiSelect)(({ theme }) => ({ | ||
backgroundColor: theme.palette.mode === 'light' ? theme.palette.common.white : theme.palette.grey[900], | ||
borderRadius: 8, | ||
borderWidth: 2, | ||
borderStyle: 'solid', | ||
borderColor: theme.palette.grey[300], | ||
transition: theme.transitions.create([ | ||
'border-color', | ||
'background-color', | ||
'box-shadow', | ||
]), | ||
[`& .${inputBaseClasses.input}`]: { | ||
padding: '8.5px 14px', | ||
}, | ||
[`& .${outlinedInputClasses.notchedOutline}`]: { | ||
display: 'none', | ||
}, | ||
[`&.${inputBaseClasses.focused}`]: { | ||
boxShadow: `${alpha(theme.palette.primary.main, 0.25)} 0 0 0 0.2rem`, | ||
borderColor: theme.palette.primary.main, | ||
}, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Box, Checkbox, FormControl, FormControlLabel } from '@mui/material'; | ||
import { useFormContext, useWatch } from 'react-hook-form'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Input } from './Input'; | ||
|
||
export const SendToRecipientForm: React.FC = () => { | ||
const { t } = useTranslation(); | ||
const { register, formState: { isSubmitting } } = useFormContext(); | ||
const sendToRecipientChecked = useWatch({ | ||
name: 'isSendToRecipient', | ||
defaultValue: false, | ||
}); | ||
|
||
if (!sendToRecipientChecked) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Box> | ||
<FormControl variant="standard" fullWidth disabled={isSubmitting}> | ||
<Input | ||
size="small" | ||
placeholder={t(`swap.form.recipientsAddress`, { chain: 'ETH' })} | ||
inputProps={{ ...register('recipientsAddress') }} | ||
required | ||
/> | ||
</FormControl> | ||
<Box my={1}> | ||
<FormControlLabel | ||
control={<Checkbox required {...register('isAddressConfirmed')} />} | ||
label={t(`swap.form.correctnessConfirmation`) as string} | ||
disabled={isSubmitting} | ||
/> | ||
</Box> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,14 @@ | ||
import { InputBase } from '@mui/material'; | ||
import { inputBaseClasses } from '@mui/material/InputBase'; | ||
import { alpha, styled } from '@mui/material/styles'; | ||
import { styled } from '@mui/material/styles'; | ||
import { Input } from './Input'; | ||
|
||
export const SwapInput = styled(InputBase)(({ theme }) => ({ | ||
export const SwapInput = styled(Input)({ | ||
borderRadius: '0 0 8px 8px', | ||
backgroundColor: theme.palette.mode === 'light' ? theme.palette.common.white : theme.palette.grey[900], | ||
borderWidth: '1px 2px 2px 2px', | ||
borderStyle: 'solid', | ||
borderColor: theme.palette.grey[300], | ||
paddingRight: '14px', | ||
transition: theme.transitions.create([ | ||
'border-color', | ||
'background-color', | ||
'box-shadow', | ||
]), | ||
[`& .${inputBaseClasses.input}`]: { | ||
padding: '8.5px 0 8.5px 14px', | ||
}, | ||
[`&.${inputBaseClasses.focused}`]: { | ||
boxShadow: `${alpha(theme.palette.primary.main, 0.25)} 0 0 0 0.2rem`, | ||
borderColor: theme.palette.primary.main, | ||
}, | ||
'& input[type="number"]::-webkit-outer-spin-button, & input[type="number"]::-webkit-inner-spin-button': { | ||
WebkitAppearance: 'none', | ||
margin: 0, | ||
}, | ||
'& input[type="number"]': { | ||
MozAppearance: 'textfield', | ||
}, | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters