Skip to content
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

feat: update range styles #2180

Merged
merged 8 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/contexts/selection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export function SelectionProvider(providerProps: PropsWithChildren) {

function isStartOfRange(date: Date) {
if (!isDateRange(value)) return false;
return Boolean(value.from && isSameDay(value.from, date));
return Boolean(value.from && isSameDay(value.from, date) && value.to);
}

function isEndOfRange(date: Date) {
Expand Down
27 changes: 14 additions & 13 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -352,29 +352,30 @@
}

.rdp-range_start {
border-start-end-radius: 0;
border-end-end-radius: 0;
background: var(--rdp-range-start-background);
}

.rdp-range_start.rdp-selected,
.rdp-range_end.rdp-selected,
.rdp-range_middle.rdp-selected {
border-color: transparent;
.rdp-range_start .rdp-day_date {
background-color: var(--rdp-range-background-color);
color: var(--rdp-range-color);
}

.rdp-range_end {
border-start-start-radius: 0;
border-end-start-radius: 0;
.rdp-range_middle .rdp-day_date {
border-color: transparent;
border: unset;
border-radius: unset;
background-color: var(--rdp-range-middle-background-color);
color: var(--rdp-range-color);
font: var(--rdp-range-middle-font);
}

.rdp-range_end.rdp-range_start {
border-radius: var(--rdp-day-border-radius);
.rdp-range_end {
background: var(--rdp-range-end-background);
}

.rdp-range_middle {
border-radius: 0;
.rdp-range_end .rdp-day_date {
background-color: var(--rdp-range-background-color);
color: var(--rdp-range-color);
}

.rdp-focusable {
Expand Down
Loading