-
Notifications
You must be signed in to change notification settings - Fork 830
DateRangePickerDay: selected class on wrapping divs #2006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@tpeek This is already possible with the
diff --git a/lib/src/DateRangePicker/DateRangePickerDay.tsx b/lib/src/DateRangePicker/DateRangePickerDay.tsx
index f4bdabf6..ae6e4607 100644
--- a/lib/src/DateRangePicker/DateRangePickerDay.tsx
+++ b/lib/src/DateRangePicker/DateRangePickerDay.tsx
@@ -43,7 +43,7 @@ const useStyles = makeStyles(
'&:first-child': startBorderStyle,
'&:last-child': endBorderStyle,
},
- rangeIntervalDayHighlightStart: {
+ highlightStart: {
...startBorderStyle,
paddingLeft: 0,
marginLeft: DAY_MARGIN / 2,
@@ -124,7 +124,7 @@ export const PureDateRangeDay = ({
className={clsx(classes.root, {
[classes.rangeIntervalDayHighlight]: shouldRenderHighlight,
[classes.rangeIntervalDayHighlightEnd]: isEndOfHighlighting || isEndOfMonth,
- [classes.rangeIntervalDayHighlightStart]: isStartOfHighlighting || isStartOfMonth,
+ [classes.highlightStart]: isStartOfHighlighting || isStartOfMonth,
})}
>
<div
diff --git a/lib/src/DateRangePicker/DateRangePickerDay.tsx b/lib/src/DateRangePicker/DateRangePickerDay.tsx
index 48094361..37d58e44 100644
--- a/lib/src/DateRangePicker/DateRangePickerDay.tsx
+++ b/lib/src/DateRangePicker/DateRangePickerDay.tsx
@@ -43,6 +43,7 @@ const useStyles = makeStyles(
'&:first-child': startBorderStyle,
'&:last-child': endBorderStyle,
},
+ /* Styles applied to the root element when the highlight starts on this day. */
highlightStart: {
...startBorderStyle,
paddingLeft: 0,
import { PickersRangeDay, DateRangePicker } from '@material-ui/pickers';
function MyPickersRangeDay(props) {
return <PickersRangeDay {...props} />
}
<DateRangePicker slotComponents={{ PickersRangeDay: MyPickersRangeDay }} />
I'm 💯 for exploring these 7 changes further, the ease of customization is important. |
The
|
@tpeek Ok, so we would need an item 8: differentiate these two states. |
Summary 💡
Right now, the classes are the same for a highlighted day at the beginning (or end) of a week, a month, or a selected range. It would be great if we had the ability to style a day highlight differently if it was at the beginning (or end) of a selected range.
Examples 🌈
Here's a visual:
The beginning and end of weeks and months are squared, while the beginning and end of the preview/highlighted range are rounded.
Motivation 🔦
I'm able to get most of the way with some creative and complicated css, but being able to target the divs at the beginning and end of a range would allow me to simplify the css greatly and match the design completely.
The text was updated successfully, but these errors were encountered: