Skip to content

Commit

Permalink
feat(datepicker): Eva style (#1366)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

Following theme properties were renamed:
datepicker-fg -> datepicker-text-color
datepicker-bg -> datepicker-background-color
datepicker-border -> datepicker-border-color
datepicker-border-radius -> datepicker-border-radius
  • Loading branch information
yggg committed May 27, 2019
1 parent 8c16fc4 commit d0c28a0
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
$arrow-size: nb-theme(datepicker-arrow-size);
$arrow-content-size: calc(#{$arrow-size} - 2px);

border: 2px solid nb-theme(datepicker-border);
border: 2px solid nb-theme(datepicker-border-color);
border-radius: nb-theme(datepicker-border-radius);
background: nb-theme(datepicker-bg);
background: nb-theme(datepicker-background-color);
box-shadow: nb-theme(datepicker-shadow);

.primitive-overlay {
color: nb-theme(datepicker-fg);
color: nb-theme(datepicker-text-color);
}

.arrow {
border-left: $arrow-size solid transparent;
border-right: $arrow-size solid transparent;
border-bottom: $arrow-size solid nb-theme(datepicker-border);
border-bottom: $arrow-size solid nb-theme(datepicker-border-color);


&::after {
Expand All @@ -33,7 +33,7 @@
left: calc(50% - #{$arrow-content-size});
border-left: $arrow-content-size solid transparent;
border-right: $arrow-content-size solid transparent;
border-bottom: $arrow-content-size solid nb-theme(datepicker-bg);
border-bottom: $arrow-content-size solid nb-theme(datepicker-background-color);
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/framework/theme/styles/themes/_default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1365,12 +1365,12 @@ $theme: (
select-option-disabled-opacity: 0.3,
select-option-padding: 0.75rem 1.5rem,

datepicker-fg: color-fg-heading,
datepicker-bg: color-bg,
datepicker-border: color-success,
datepicker-border-radius: radius,
datepicker-text-color: text-dark-color,
datepicker-background-color: color-white,
datepicker-border-color: color-primary,
datepicker-border-radius: 0.75rem,
datepicker-shadow: none,
datepicker-arrow-size: 11px,
datepicker-arrow-size: 0.6875rem,

radio-width: 1.125rem,
radio-height: 1.125rem,
Expand Down
31 changes: 31 additions & 0 deletions src/playground/with-layout/datepicker/datepicker-example.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
nb-card-body {
text-align: center;
}

input {
width: 100%;
}

input:nth-of-type(2) {
margin-top: 1rem;
}

@media screen and (min-width: 31em) {
input {
width: 21.875rem;
}

.two-inputs input {
width: calc(50% - 0.5rem);
}
.two-inputs input:last-of-type {
margin-top: 0;
margin-left: 1rem;
}
}

@media screen and (min-width: 50.25em) {
.two-inputs input {
width: 21.875rem;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,17 @@ import { FormControl } from '@angular/forms';
@Component({
selector: 'nb-datepicker-forms',
template: `
<div>
<input nbInput placeholder="Form Picker" [nbDatepicker]="formcontrol" [formControl]="formControl">
<nb-datepicker #formcontrol></nb-datepicker>
<nb-card size="large">
<nb-card-body class="two-inputs">
<input nbInput placeholder="Form Picker" [nbDatepicker]="formcontrol" [formControl]="formControl">
<nb-datepicker #formcontrol></nb-datepicker>
<input nbInput placeholder="Form Picker" [nbDatepicker]="ngmodel" [(ngModel)]="ngModelDate">
<nb-datepicker #ngmodel></nb-datepicker>
</div>
<input nbInput placeholder="Form Picker" [nbDatepicker]="ngmodel" [(ngModel)]="ngModelDate">
<nb-datepicker #ngmodel></nb-datepicker>
</nb-card-body>
</nb-card>
`,
styles: [`
:host {
display: flex;
justify-content: center;
align-content: center;
height: 40rem;
}
:host input {
width: 21.875rem;
}
`],
styleUrls: ['./datepicker-example.scss'],
})
export class DatepickerFormsComponent {
formControl = new FormControl(new Date());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,14 @@ import { Component } from '@angular/core';
@Component({
selector: 'nb-datepicker-showcase',
template: `
<div>
<input nbInput placeholder="Form Picker" [nbDatepicker]="formpicker">
<nb-datepicker #formpicker></nb-datepicker>
</div>
<nb-card size="large">
<nb-card-body>
<input nbInput placeholder="Form Picker" [nbDatepicker]="formpicker">
<nb-datepicker #formpicker></nb-datepicker>
</nb-card-body>
</nb-card>
`,
styles: [`
:host {
display: flex;
justify-content: center;
align-content: center;
height: 40rem;
}
:host input {
width: 21.875rem;
}
`],
styleUrls: ['./datepicker-example.scss'],
})
export class DatepickerShowcaseComponent {
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,14 @@ import { NbDateService } from '@nebular/theme';
@Component({
selector: 'nb-datepicker-validation',
template: `
<div>
<input nbInput placeholder="Form Picker" [nbDatepicker]="picker">
<nb-datepicker #picker [min]="min" [max]="max"></nb-datepicker>
</div>
<nb-card size="large">
<nb-card-body>
<input nbInput placeholder="Form Picker" [nbDatepicker]="picker">
<nb-datepicker #picker [min]="min" [max]="max"></nb-datepicker>
</nb-card-body>
</nb-card>
`,
styles: [`
:host {
display: flex;
justify-content: center;
align-content: center;
height: 40rem;
}
:host input {
width: 21.875rem;
}
`],
styleUrls: ['./datepicker-example.scss'],
})
export class DatepickerValidationComponent {
min: Date;
Expand Down
3 changes: 2 additions & 1 deletion src/playground/with-layout/datepicker/datepicker.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NbDatepickerModule, NbInputModule } from '@nebular/theme';
import { NbCardModule, NbDatepickerModule, NbInputModule } from '@nebular/theme';
import { DatepickerRoutingModule } from './datepicker-routing.module';
import { DatepickerFormsComponent } from './datepicker-forms.component';
import { DatepickerShowcaseComponent } from './datepicker-showcase.component';
Expand All @@ -26,6 +26,7 @@ import { RangepickerShowcaseComponent } from './rangepicker-showcase.component';
NbDatepickerModule.forRoot(),
NbInputModule,
DatepickerRoutingModule,
NbCardModule,
],
})
export class DatepickerModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,14 @@ import { Component } from '@angular/core';
@Component({
selector: 'nb-rangepicker-showcase',
template: `
<div>
<input nbInput placeholder="Form Picker" [nbDatepicker]="formpicker">
<nb-rangepicker #formpicker></nb-rangepicker>
</div>
<nb-card size="large">
<nb-card-body>
<input nbInput placeholder="Form Picker" [nbDatepicker]="formpicker">
<nb-rangepicker #formpicker></nb-rangepicker>
</nb-card-body>
</nb-card>
`,
styles: [`
:host {
display: flex;
justify-content: center;
align-content: center;
height: 40rem;
}
:host input {
width: 21.875rem;
}
`],
styleUrls: ['./datepicker-example.scss'],
})
export class RangepickerShowcaseComponent {
}

0 comments on commit d0c28a0

Please sign in to comment.