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(calendar): make all class names unique #3115

Merged
merged 9 commits into from
Nov 26, 2018
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<ng-template let-result #defaultHeader>
<span class="date-text">{{ getFormattedDate().weekday }},&nbsp;</span>
<span class="date-text">{{ getFormattedDate().monthday }}</span>
<span>{{ getFormattedDate().weekday }},&nbsp;</span>
<span>{{ getFormattedDate().monthday }}</span>
</ng-template>

<ng-template let-result #defaultMonth>
<span (click)="activeViewYear()" class="date__el">
<span (click)="activeViewYear()" class="igx-calendar-picker__date">
{{ formattedMonth(viewDate) }}
</span>
<span (click)="activeViewDecade()" class="date__el">
<span (click)="activeViewDecade()" class="igx-calendar-picker__date">
{{ formattedYear(viewDate) }}
</span>
</ng-template>
Expand All @@ -21,15 +21,15 @@ <h2 class="igx-calendar__header-date">
</div>

<div *ngIf="isDefaultView" class="igx-calendar__body" [@animateView]="activeView" (swiperight)="previousMonth()" (swipeleft)="nextMonth()">
<div class="igx-calendar__body-picker">
<div class="prev" (click)="previousMonth()">
<div class="igx-calendar-picker">
<div class="igx-calendar-picker__prev" (click)="previousMonth()">
<igx-icon fontSet="material">keyboard_arrow_left</igx-icon>
</div>
<div class="date">
<div>
<ng-container *ngTemplateOutlet="subheaderTemplate ? subheaderTemplate : defaultMonth; context: context">
</ng-container>
</div>
<div class="next" (click)="nextMonth()">
<div class="igx-calendar-picker__next" (click)="nextMonth()">
<igx-icon fontSet="material">keyboard_arrow_right</igx-icon>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ describe('IgxCalendar', () => {
year: 'numeric'
};
const defaultViews = { day: false, month: true, year: false };
const bodyMonth = dom.query(By.css('.date .date__el'));
const bodyMonth = dom.query(By.css('.igx-calendar-picker__date'));
const headerYear = dom.query(By.css('.igx-calendar__header-year'));
const bodyYear = dom.queryAll(By.css('.date .date__el'))[1];
const bodyYear = dom.queryAll(By.css('.igx-calendar-picker__date'))[1];
const headerWeekday = dom.queryAll(By.css('.igx-calendar__header-date span'))[0];
const headerDate = dom.queryAll(By.css('.igx-calendar__header-date span'))[1];

Expand Down Expand Up @@ -300,9 +300,9 @@ describe('IgxCalendar', () => {
fixture.componentInstance.model = new Date();
fixture.detectChanges();

const bodyMonth = dom.query(By.css('.date .date__el'));
const bodyMonth = dom.query(By.css('.igx-calendar-picker__date'));
const headerYear = dom.query(By.css('.igx-calendar__header-year'));
const bodyYear = dom.queryAll(By.css('.date .date__el'))[1];
const bodyYear = dom.queryAll(By.css('.igx-calendar-picker__date'))[1];
const headerWeekday = dom.queryAll(By.css('.igx-calendar__header-date span'))[0];
const headerDate = dom.queryAll(By.css('.igx-calendar__header-date span'))[1];
let bodyWeekday = dom.query(By.css('.igx-calendar__label'));
Expand Down Expand Up @@ -362,7 +362,7 @@ describe('IgxCalendar', () => {
});

it('Calendar DOM structure - year view | month view', () => {
const collection = dom.queryAll(By.css('.date__el'));
const collection = dom.queryAll(By.css('.igx-calendar-picker__date'));
const monthButton = collection[0];
const yearButton = collection[1];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,6 @@
@extend %cal-body-display !optional;
}

@include e(body-picker) {
@extend %cal-picker-display !optional;

@include b(date) {
@extend %cal-picker-date !optional;

@include e(el) {
@extend %cal-header-date-el--hover !optional;
}
}

@include b(prev) {
@extend %cal-picker-arrow !optional;
}

@include b(next) {
@extend %cal-picker-arrow !optional;
}
}

@include e(body-row) {
@extend %cal-row-display !optional;
}
Expand Down Expand Up @@ -166,3 +146,19 @@
}
}
}

@include b(igx-calendar-picker) {
@extend %cal-picker-display !optional;

@include e(date) {
@extend %cal-picker-date !optional;
}

@include e(prev) {
@extend %cal-picker-arrow !optional;
}

@include e(next) {
@extend %cal-picker-arrow !optional;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,6 @@
background: --var($theme, 'content-background');
overflow: hidden;
outline: none;

&[dir='rtl'] {
.prev,
.next {
@extend %cal-picker-arrow--rtl;
}
}
}

%cal-display--vertical {
Expand All @@ -275,7 +268,7 @@
display: flex;
margin: $cal-header-date-margin;

.date-text {
> span {
@include ellipsis();
}
}
Expand All @@ -284,14 +277,6 @@
flex-flow: column nowrap;
}

%cal-header-date-el--hover {
&:hover,
&:focus {
color: --var($theme, 'picker-text-hover-color');
cursor: pointer;
}
}

%cal-picker-display {
display: flex;
height: em(56px);
Expand All @@ -311,15 +296,21 @@
&:hover {
color: --var($theme, 'picker-arrow-hover-color');
}
}

%cal-picker-arrow--rtl {
transform: scaleX(-1);
[dir='rtl'] & {
transform: scaleX(-1);
}
}

%cal-picker-date {
color: --var($theme, 'picker-text-color');
text-align: center;

&:hover,
&:focus {
color: --var($theme, 'picker-text-hover-color');
cursor: pointer;
}
}

%cal-body-display {
Expand Down