diff --git a/src/app/@theme/styles/material/_material-dark.scss b/src/app/@theme/styles/material/_material-dark.scss index f9a692a4..524f7e01 100644 --- a/src/app/@theme/styles/material/_material-dark.scss +++ b/src/app/@theme/styles/material/_material-dark.scss @@ -4,8 +4,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. */ - @import '~@nebular/theme/styles/core/functions'; - @import '~@nebular/theme/styles/core/mixins'; +@import '~@nebular/theme/styles/core/functions'; +@import '~@nebular/theme/styles/core/mixins'; $theme: ( color-primary-100: #fff2f7, diff --git a/src/app/@theme/styles/material/_material.scss b/src/app/@theme/styles/material/_material.scss index 282c15da..1273145b 100644 --- a/src/app/@theme/styles/material/_material.scss +++ b/src/app/@theme/styles/material/_material.scss @@ -1,9 +1,19 @@ -@import './ripple'; +@import '~@angular/material/theming'; @include nb-install() { - @include ngx-ripple(); + @include nb-for-theme(material-dark) { + $custom-dark-theme: mat-dark-theme(mat-palette($mat-pink), mat-palette($mat-blue-grey)); + @include angular-material-theme($custom-dark-theme); + } + + @include nb-for-theme(material-light) { + $custom-light-theme: mat-light-theme(mat-palette($mat-indigo), mat-palette($mat-pink)); + @include angular-material-theme($custom-light-theme); + } @include nb-for-themes(material-dark, material-light) { + @include mat-core(); + nb-layout-header { box-shadow: nb-theme(header-shadow) !important; background-color: nb-theme(color-primary-default) !important; diff --git a/src/app/@theme/styles/material/_ripple.scss b/src/app/@theme/styles/material/_ripple.scss deleted file mode 100644 index 6e01c1f9..00000000 --- a/src/app/@theme/styles/material/_ripple.scss +++ /dev/null @@ -1,25 +0,0 @@ -@mixin ngx-ripple() { - .mat-ripple { - overflow: hidden; - position: relative; - - &:not(:empty) { - transform: translateZ(0); - } - - &.mat-ripple-unbounded{ - overflow: visible; - } - } - - .mat-ripple-element { - position: absolute; - border-radius: 50%; - pointer-events: none; - transition: opacity, transform 0ms cubic-bezier(0, 0, 0.2, 1); - transform: scale(0); - // switch ripple color depending on selected theme - background-color: nb-theme(background-alternative-color-4); - opacity: .1; - } -} \ No newline at end of file diff --git a/src/app/@theme/styles/theme.material-dark.ts b/src/app/@theme/styles/material/theme.material-dark.ts similarity index 100% rename from src/app/@theme/styles/theme.material-dark.ts rename to src/app/@theme/styles/material/theme.material-dark.ts diff --git a/src/app/@theme/styles/theme.material-light.ts b/src/app/@theme/styles/material/theme.material-light.ts similarity index 100% rename from src/app/@theme/styles/theme.material-light.ts rename to src/app/@theme/styles/material/theme.material-light.ts diff --git a/src/app/@theme/theme.module.ts b/src/app/@theme/theme.module.ts index dc5593c9..f5731098 100644 --- a/src/app/@theme/theme.module.ts +++ b/src/app/@theme/theme.module.ts @@ -39,8 +39,8 @@ import { DEFAULT_THEME } from './styles/theme.default'; import { COSMIC_THEME } from './styles/theme.cosmic'; import { CORPORATE_THEME } from './styles/theme.corporate'; import { DARK_THEME } from './styles/theme.dark'; -import { MATERIAL_LIGHT_THEME } from './styles/theme.material-light'; -import { MATERIAL_DARK_THEME } from './styles/theme.material-dark'; +import { MATERIAL_LIGHT_THEME } from './styles/material/theme.material-light'; +import { MATERIAL_DARK_THEME } from './styles/material/theme.material-dark'; const NB_MODULES = [ NbLayoutModule, diff --git a/src/app/pages/forms/buttons/buttons.component.html b/src/app/pages/forms/buttons/buttons.component.html index 9ad1b934..394e9424 100644 --- a/src/app/pages/forms/buttons/buttons.component.html +++ b/src/app/pages/forms/buttons/buttons.component.html @@ -119,5 +119,11 @@ + + + + + + diff --git a/src/app/pages/forms/buttons/buttons.component.ts b/src/app/pages/forms/buttons/buttons.component.ts index f839321e..089ec9f6 100644 --- a/src/app/pages/forms/buttons/buttons.component.ts +++ b/src/app/pages/forms/buttons/buttons.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; -import { NbComponentShape, NbComponentSize, NbComponentStatus } from '@nebular/theme'; +import { NbComponentShape, NbComponentSize, NbComponentStatus, NbThemeService } from '@nebular/theme'; +import { Subscription } from 'rxjs'; @Component({ selector: 'ngx-buttons', @@ -7,7 +8,23 @@ import { NbComponentShape, NbComponentSize, NbComponentStatus } from '@nebular/t templateUrl: './buttons.component.html', }) export class ButtonsComponent { - statuses: NbComponentStatus[] = [ 'primary', 'success', 'info', 'warning', 'danger' ]; - shapes: NbComponentShape[] = [ 'rectangle', 'semi-round', 'round' ]; - sizes: NbComponentSize[] = [ 'tiny', 'small', 'medium', 'large', 'giant' ]; + public constructor(private readonly themeService: NbThemeService) {} + + private readonly subscription: Subscription = new Subscription(); + + public readonly statuses: NbComponentStatus[] = [ 'primary', 'success', 'info', 'warning', 'danger' ]; + public readonly shapes: NbComponentShape[] = [ 'rectangle', 'semi-round', 'round' ]; + public readonly sizes: NbComponentSize[] = [ 'tiny', 'small', 'medium', 'large', 'giant' ]; + public materialThemeActivated: boolean = false; + + public ngOnInit(): void { + this.subscription.add(this.themeService.onThemeChange().subscribe(theme => { + const themeName: string = theme?.name || ''; + this.materialThemeActivated = themeName.startsWith('material'); + })); + } + + public ngOnDestroy(): void { + this.subscription.unsubscribe(); + } } diff --git a/src/app/pages/forms/buttons/material-buttons/material-buttons.component.html b/src/app/pages/forms/buttons/material-buttons/material-buttons.component.html new file mode 100644 index 00000000..fad8a0f1 --- /dev/null +++ b/src/app/pages/forms/buttons/material-buttons/material-buttons.component.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/app/pages/forms/buttons/material-buttons/material-buttons.component.scss b/src/app/pages/forms/buttons/material-buttons/material-buttons.component.scss new file mode 100644 index 00000000..1b59761d --- /dev/null +++ b/src/app/pages/forms/buttons/material-buttons/material-buttons.component.scss @@ -0,0 +1,3 @@ +button { + margin: 0.5rem; +} \ No newline at end of file diff --git a/src/app/pages/forms/buttons/material-buttons/material-buttons.component.ts b/src/app/pages/forms/buttons/material-buttons/material-buttons.component.ts new file mode 100644 index 00000000..6062551b --- /dev/null +++ b/src/app/pages/forms/buttons/material-buttons/material-buttons.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'ngx-material-buttons', + templateUrl: './material-buttons.component.html', + styleUrls: ['./material-buttons.component.scss'] +}) +export class MaterialButtonsComponent {} \ No newline at end of file diff --git a/src/app/pages/forms/form-inputs/form-inputs.component.html b/src/app/pages/forms/form-inputs/form-inputs.component.html index 7bb23392..a17368a9 100644 --- a/src/app/pages/forms/form-inputs/form-inputs.component.html +++ b/src/app/pages/forms/form-inputs/form-inputs.component.html @@ -85,3 +85,8 @@ +
+
+ +
+
\ No newline at end of file diff --git a/src/app/pages/forms/form-inputs/form-inputs.component.ts b/src/app/pages/forms/form-inputs/form-inputs.component.ts index 4ec7045a..1e720912 100644 --- a/src/app/pages/forms/form-inputs/form-inputs.component.ts +++ b/src/app/pages/forms/form-inputs/form-inputs.component.ts @@ -1,13 +1,30 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy, OnInit } from '@angular/core'; +import { NbThemeService } from '@nebular/theme'; +import { Subscription } from 'rxjs'; @Component({ selector: 'ngx-form-inputs', styleUrls: ['./form-inputs.component.scss'], templateUrl: './form-inputs.component.html', }) -export class FormInputsComponent { +export class FormInputsComponent implements OnInit, OnDestroy { + public constructor(private readonly themeService: NbThemeService) {} - starRate = 2; - heartRate = 4; - radioGroupValue = 'This is value 2'; + private readonly subscription: Subscription = new Subscription(); + + public materialThemeActivated: boolean = false; + public starRate: number = 2; + public heartRate: number = 4; + public radioGroupValue: string = 'This is value 2'; + + public ngOnInit(): void { + this.subscription.add(this.themeService.onThemeChange().subscribe(theme => { + const themeName: string = theme?.name || ''; + this.materialThemeActivated = themeName.startsWith('material'); + })); + } + + public ngOnDestroy(): void { + this.subscription.unsubscribe(); + } } diff --git a/src/app/pages/forms/form-inputs/material-inputs/material-inputs.component.html b/src/app/pages/forms/form-inputs/material-inputs/material-inputs.component.html new file mode 100644 index 00000000..326bcd07 --- /dev/null +++ b/src/app/pages/forms/form-inputs/material-inputs/material-inputs.component.html @@ -0,0 +1,58 @@ + + Angular Material + +
+
+ + Input + + hint + + + + Select + + Option 1 + Option 2 + Option 3 + + hint + + + + Datepicker + + + + hint + +
+
+ + Textarea + + hint + + +
+ + +
+ +
+ + +
+ +
+ + + Option 1 + Option 2 + Option 3 + +
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/forms/form-inputs/material-inputs/material-inputs.component.scss b/src/app/pages/forms/form-inputs/material-inputs/material-inputs.component.scss new file mode 100644 index 00000000..196861ec --- /dev/null +++ b/src/app/pages/forms/form-inputs/material-inputs/material-inputs.component.scss @@ -0,0 +1,16 @@ +:host { + display: block; +} + +.input-example { + display: block; + margin-top: 1rem; + + label, mat-radio-button { + margin-right: 1rem; + } + + textarea { + min-height: 3rem; + } +} \ No newline at end of file diff --git a/src/app/pages/forms/form-inputs/material-inputs/material-inputs.component.ts b/src/app/pages/forms/form-inputs/material-inputs/material-inputs.component.ts new file mode 100644 index 00000000..1891d539 --- /dev/null +++ b/src/app/pages/forms/form-inputs/material-inputs/material-inputs.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'ngx-material-inputs', + templateUrl: './material-inputs.component.html', + styleUrls: ['./material-inputs.component.scss'] +}) +export class MaterialInputsComponent {} \ No newline at end of file diff --git a/src/app/pages/forms/forms.module.ts b/src/app/pages/forms/forms.module.ts index a7b93962..52487d11 100644 --- a/src/app/pages/forms/forms.module.ts +++ b/src/app/pages/forms/forms.module.ts @@ -15,11 +15,37 @@ import { ThemeModule } from '../../@theme/theme.module'; import { FormsRoutingModule } from './forms-routing.module'; import { FormsComponent } from './forms.component'; import { FormInputsComponent } from './form-inputs/form-inputs.component'; +import { MaterialInputsComponent } from './form-inputs/material-inputs/material-inputs.component'; import { FormLayoutsComponent } from './form-layouts/form-layouts.component'; import { DatepickerComponent } from './datepicker/datepicker.component'; import { ButtonsComponent } from './buttons/buttons.component'; +import { MaterialButtonsComponent } from './buttons/material-buttons/material-buttons.component'; import { FormsModule as ngFormsModule } from '@angular/forms'; +import { MatNativeDateModule } from '@angular/material/core'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatSelectModule } from '@angular/material/select'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatCheckboxModule } from '@angular/material/checkbox'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; +import { MatRadioModule } from '@angular/material/radio'; +import { MatButtonModule } from '@angular/material/button'; +import { MatButtonToggleModule } from '@angular/material/button-toggle'; + +const materialModules = [ + MatFormFieldModule, + MatInputModule, + MatSelectModule, + MatNativeDateModule, + MatDatepickerModule, + MatCheckboxModule, + MatSlideToggleModule, + MatRadioModule, + MatButtonModule, + MatButtonToggleModule, +]; + @NgModule({ imports: [ ThemeModule, @@ -35,6 +61,7 @@ import { FormsModule as ngFormsModule } from '@angular/forms'; NbSelectModule, NbIconModule, ngFormsModule, + ...materialModules, ], declarations: [ FormsComponent, @@ -42,6 +69,8 @@ import { FormsModule as ngFormsModule } from '@angular/forms'; FormInputsComponent, FormLayoutsComponent, DatepickerComponent, + MaterialInputsComponent, + MaterialButtonsComponent, ], }) export class FormsModule { }