-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Target Date Field added to withdrawals forms.
-Field added in both createForm.tsx and editForm.tsx. -Added targetDate in gql/withdrawals.d.ts types. -Created SelectDate.tsx file for the custom element.
- Loading branch information
Showing
5 changed files
with
937 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,35 @@ | ||
import React from 'react' | ||
import { useField } from 'formik' | ||
import { useTranslation } from 'next-i18next' | ||
|
||
import { TextFieldProps } from '@mui/material' | ||
|
||
import { translateError } from 'common/form/useForm' | ||
import { TranslatableField } from 'common/form/validation' | ||
import FormTextField from 'components/common/form/FormTextField' | ||
|
||
type Props = { | ||
name: string | ||
} & TextFieldProps | ||
|
||
export default function SelectDate({ name, ...textFieldProps }: Props) { | ||
const { t } = useTranslation('withdrawals') | ||
|
||
const [field, meta] = useField(name) | ||
|
||
const helperText = meta.touched ? translateError(meta.error as TranslatableField, t) : '' | ||
|
||
return ( | ||
<FormTextField | ||
{...textFieldProps} | ||
{...field} | ||
type="date" | ||
variant="outlined" | ||
fullWidth | ||
InputLabelProps={{ shrink: true }} | ||
error={Boolean(meta.error) && Boolean(meta.touched)} | ||
label={t('targetDate')} | ||
helperText={helperText} | ||
/> | ||
) | ||
} |
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