mirror of
https://github.com/fergalmoran/onearmy-community-platform.git
synced 2025-12-22 09:37:54 +00:00
chore: drop unused date picker field
This commit is contained in:
@@ -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} />
|
|
||||||
)
|
|
||||||
@@ -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}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -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'
|
||||||
|
|||||||
Reference in New Issue
Block a user