-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use dayjs format and update styling in smart search TimeFrame component.
- Loading branch information
Showing
2 changed files
with
39 additions
and
13 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
33 changes: 25 additions & 8 deletions
33
src/features/smartSearch/components/inputs/StyledDatePicker.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 |
---|---|---|
@@ -1,15 +1,32 @@ | ||
import dayjs from 'dayjs'; | ||
import { useTheme } from '@mui/material'; | ||
import { DatePicker, DatePickerProps } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
const styles = { | ||
fontSize: 'typography.h4.fontSize', | ||
padding: 0, | ||
width: '12rem', | ||
}; | ||
|
||
const StyledDatePicker: React.FC<DatePickerProps<Date>> = ( | ||
const StyledDatePicker: React.FC<DatePickerProps<dayjs.Dayjs>> = ( | ||
props | ||
): React.ReactElement => { | ||
return <DatePicker {...props} slotProps={{ textField: { sx: styles } }} />; | ||
const theme = useTheme(); | ||
return ( | ||
<DatePicker | ||
{...props} | ||
slotProps={{ | ||
textField: { | ||
inputProps: { | ||
sx: { | ||
fontSize: theme.typography.h4.fontSize, | ||
padding: 0, | ||
}, | ||
}, | ||
sx: { | ||
paddingRight: 1, | ||
paddingTop: '1px', | ||
width: '15rem', | ||
}, | ||
variant: 'standard', | ||
}, | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export default StyledDatePicker; |