Match styles of Select for date picker
Signed-off-by: Niklas Granander <ngranander@spotify.com>
This commit is contained in:
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user