Match styles of Select for date picker

Signed-off-by: Niklas Granander <ngranander@spotify.com>
This commit is contained in:
Niklas Granander
2021-08-12 11:56:34 +02:00
parent 8aed3a5beb
commit 9dd49cfd3b
@@ -18,6 +18,7 @@ import {
createStyles,
InputBase,
InputProps,
makeStyles,
Theme,
Typography,
withStyles,
@@ -50,6 +51,13 @@ const BootstrapInput = withStyles((theme: Theme) =>
}),
)(InputBase);
const useStyles = makeStyles({
root: {
display: 'flex',
flexDirection: 'column',
},
});
interface DatePickerProps {
label: string;
onDateChange?: (date: string) => void;
@@ -59,16 +67,19 @@ export const DatePickerComponent = ({
label,
onDateChange,
...inputProps
}: InputProps & DatePickerProps) => (
<>
<Typography variant="button">{label}</Typography>
<br />
<BootstrapInput
inputProps={{ 'aria-label': label }}
type="date"
fullWidth
onChange={event => onDateChange?.(event.target.value)}
{...inputProps}
/>
</>
);
}: InputProps & DatePickerProps) => {
const classes = useStyles();
return (
<div className={classes.root}>
<Typography variant="button">{label}</Typography>
<BootstrapInput
inputProps={{ 'aria-label': label }}
type="date"
fullWidth
onChange={event => onDateChange?.(event.target.value)}
{...inputProps}
/>
</div>
);
};