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

fix(datepicker): remove hardcoded bg-light #3351

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/datepicker/datepicker-month-view.scss
Expand Up @@ -20,6 +20,8 @@ ngb-datepicker-month-view {
&-weekdays {
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
border-radius: 0;
background-color: #f8f9fa;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing bg-light class but you are also introducing a hard coded background color. Why not set on parent background color and in custom css it can be overridden?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.ngb-datepicker-month-view-weekdays is a custom-class publicly available.
You can override the background-color by defining your own. Isn't it enough ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can but I have to override for each including header, week, weekday, day using !important

background-color: var(--light);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'var' was a good idea, but unfortunately we can't use this functionality as ng-bootstrap supports IE >= 10

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var is already in use:

&-weekday {
color: #5bc0de;
color: var(--info);
}

Do it like this maybe better?

}
&-day,
&-weekday,
Expand Down
2 changes: 1 addition & 1 deletion src/datepicker/datepicker-month-view.ts
Expand Up @@ -10,7 +10,7 @@ import {DayTemplateContext} from './datepicker-day-template-context';
encapsulation: ViewEncapsulation.None,
styleUrls: ['./datepicker-month-view.scss'],
template: `
<div *ngIf="showWeekdays" class="ngb-dp-week ngb-dp-weekdays bg-light">
<div *ngIf="showWeekdays" class="ngb-dp-week ngb-dp-weekdays">
<div *ngIf="showWeekNumbers" class="ngb-dp-weekday ngb-dp-showweek"></div>
<div *ngFor="let w of month.weekdays" class="ngb-dp-weekday small" role="columnheader">
{{ i18n.getWeekdayShortName(w) }}
Expand Down
2 changes: 2 additions & 0 deletions src/datepicker/datepicker.scss
Expand Up @@ -22,6 +22,7 @@ ngb-datepicker {
border-radius: .25rem .25rem 0 0;
padding-top: .25rem;
background-color: #f8f9fa;
background-color: var(--light);
}

&-months {
Expand All @@ -37,6 +38,7 @@ ngb-datepicker {
line-height: 2rem;
text-align: center;
background-color: #f8f9fa;
background-color: var(--light);
}

& + & {
Expand Down