chore: drop unused date picker field

This commit is contained in:
Ben Furber
2024-08-08 12:42:41 +01:00
committed by benfurber
parent ff8eaa967b
commit 200de22ee6
3 changed files with 0 additions and 60 deletions

View File

@@ -1,12 +0,0 @@
import { FieldDatepicker } from './FieldDatepicker'
import type { Meta, StoryFn } from '@storybook/react'
export default {
title: 'Forms/FieldDatepicker',
component: FieldDatepicker,
} as Meta<typeof FieldDatepicker>
export const Default: StoryFn<typeof FieldDatepicker> = () => (
<FieldDatepicker meta={{}} input={{} as any} />
)

View File

@@ -1,47 +0,0 @@
import { Input, Text } from 'theme-ui'
import type { FieldRenderProps } from 'react-final-form'
// any props can be passed to field and down to child component
// input and meta props come from react field render props and will be
// picked up by typing
type FieldProps = FieldRenderProps<any, any> & { children?: React.ReactNode }
export interface Props extends FieldProps {
// additional fields intending to pass down
disabled?: boolean
children?: React.ReactNode
'data-cy'?: string
customOnBlur?: (event: any) => void
customChange?: (location: any) => void
}
export const FieldDatepicker = ({
input,
meta,
customChange,
...rest
}: Props) => {
return (
<>
<Input
type="date"
variant={meta.error && meta.touched ? 'error' : 'input'}
{...input}
{...rest}
onChange={(date) => {
input.onChange(date)
if (customChange) {
customChange(date)
}
input.onBlur()
}}
/>
{meta.error && meta.touched ? (
<Text sx={{ fontSize: 0, margin: 1, color: 'error' }}>
{meta.error}
</Text>
) : null}
</>
)
}

View File

@@ -21,7 +21,6 @@ export { DownloadStaticFile } from './DownloadStaticFile/DownloadStaticFile'
export { EditComment } from './EditComment/EditComment' export { EditComment } from './EditComment/EditComment'
export { ElWithBeforeIcon } from './ElWithBeforeIcon/ElWithBeforeIcon' export { ElWithBeforeIcon } from './ElWithBeforeIcon/ElWithBeforeIcon'
export { ExternalLink } from './ExternalLink/ExternalLink' export { ExternalLink } from './ExternalLink/ExternalLink'
export { FieldDatepicker } from './FieldDatepicker/FieldDatepicker'
export { FieldInput } from './FieldInput/FieldInput' export { FieldInput } from './FieldInput/FieldInput'
export { FieldTextarea } from './FieldTextarea/FieldTextarea' export { FieldTextarea } from './FieldTextarea/FieldTextarea'
export { Guidelines } from './Guidelines/Guidelines' export { Guidelines } from './Guidelines/Guidelines'