-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2597907
commit e96a3a4
Showing
4 changed files
with
37 additions
and
53 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
28 changes: 28 additions & 0 deletions
28
frontend/src/features/Mission/components/MissionForm/ActionForm/shared/DatePickerField.tsx
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,28 @@ | ||
import { HIDDEN_ERROR } from '@features/Mission/components/MissionForm/constants' | ||
import { FieldError, FormikDatePicker, useNewWindow } from '@mtes-mct/monitor-ui' | ||
import { useFormikContext } from 'formik' | ||
|
||
import type { MissionActionFormValues } from '../../types' | ||
|
||
export function DatePickerField() { | ||
const { newWindowContainerRef } = useNewWindow() | ||
const { errors } = useFormikContext<MissionActionFormValues>() | ||
|
||
const error = errors.actionDatetimeUtc | ||
|
||
return ( | ||
<> | ||
<FormikDatePicker | ||
baseContainer={newWindowContainerRef.current} | ||
isErrorMessageHidden | ||
isLight | ||
isRequired | ||
isStringDate | ||
label="Date et heure du contrôle" | ||
name="actionDatetimeUtc" | ||
withTime | ||
/> | ||
{error && error !== HIDDEN_ERROR && <FieldError>{error}</FieldError>} | ||
</> | ||
) | ||
} |