From f77e3e3c9d1a6e5fe3e00fdd6950696868403573 Mon Sep 17 00:00:00 2001 From: Sergey Andrievskiy Date: Fri, 9 Oct 2020 14:26:03 +0300 Subject: [PATCH] refactor: move dialog buttons to main info section Prevents copy/paste of .btn styles --- .../main-info-section.component.html | 8 ++- .../main-info-section.component.scss | 15 ++++- .../main-info-section.component.ts | 16 ++++- .../download-admin.component.html | 3 - .../download-admin.component.scss | 59 ------------------- .../download-admin.component.ts | 24 -------- .../components/premium/premium.component.html | 3 - .../components/premium/premium.component.scss | 59 ------------------- .../components/premium/premium.component.ts | 26 -------- docs/app/shared/landing-shared.module.ts | 4 -- 10 files changed, 33 insertions(+), 184 deletions(-) delete mode 100644 docs/app/shared/components/download-admin/download-admin.component.html delete mode 100644 docs/app/shared/components/download-admin/download-admin.component.scss delete mode 100644 docs/app/shared/components/download-admin/download-admin.component.ts delete mode 100644 docs/app/shared/components/premium/premium.component.html delete mode 100644 docs/app/shared/components/premium/premium.component.scss delete mode 100644 docs/app/shared/components/premium/premium.component.ts diff --git a/docs/app/pages/home/main-info-section/main-info-section.component.html b/docs/app/pages/home/main-info-section/main-info-section.component.html index d3e487c0..a5b7a206 100644 --- a/docs/app/pages/home/main-info-section/main-info-section.component.html +++ b/docs/app/pages/home/main-info-section/main-info-section.component.html @@ -41,7 +41,11 @@ - - + + diff --git a/docs/app/pages/home/main-info-section/main-info-section.component.scss b/docs/app/pages/home/main-info-section/main-info-section.component.scss index a17d871a..e81c17a9 100644 --- a/docs/app/pages/home/main-info-section/main-info-section.component.scss +++ b/docs/app/pages/home/main-info-section/main-info-section.component.scss @@ -133,8 +133,9 @@ cursor: pointer; text-transform: uppercase; - &.btn-demo { - margin-left: 1em; + &.btn-demo, + &.btn-download, + &.btn-download-premium { color: #ffffff; background-color: nb-theme(color-active-fg); box-shadow: nb-theme(shadow-btn); @@ -155,6 +156,16 @@ &:active { box-shadow: nb-theme(shadow-active-btn); } + + &.btn-demo { + margin-left: 1em; + } + } + + .btn-download, + .btn-download-premium { + margin-top: 1rem; + width: 100%; } @include media-breakpoint-down(xxl) { diff --git a/docs/app/pages/home/main-info-section/main-info-section.component.ts b/docs/app/pages/home/main-info-section/main-info-section.component.ts index b2e611e6..9066f8b9 100644 --- a/docs/app/pages/home/main-info-section/main-info-section.component.ts +++ b/docs/app/pages/home/main-info-section/main-info-section.component.ts @@ -5,9 +5,12 @@ */ import { Component, OnDestroy, Input } from '@angular/core'; -import { NbMediaBreakpoint, NbMediaBreakpointsService, NbThemeService } from '@nebular/theme'; +import { NbDialogService, NbMediaBreakpoint, NbMediaBreakpointsService, NbThemeService } from '@nebular/theme'; import { takeWhile } from 'rxjs/operators'; +import { DownloadFormComponent } from '../../../shared/components/download-form/download-form.component'; +import { PremiumFormComponent } from '../../../shared/components/premium-form/premium-form.component'; + @Component({ selector: 'ngx-landing-main-info', templateUrl: './main-info-section.component.html', @@ -15,7 +18,8 @@ import { takeWhile } from 'rxjs/operators'; }) export class MainInfoSectionComponent implements OnDestroy { constructor(themeService: NbThemeService, - breakpointService: NbMediaBreakpointsService) { + breakpointService: NbMediaBreakpointsService, + private dialogService: NbDialogService) { this.breakpoints = breakpointService.getBreakpointsMap(); themeService.onMediaQueryChange() .pipe(takeWhile(() => this.alive)) @@ -42,4 +46,12 @@ export class MainInfoSectionComponent implements OnDestroy { public ngOnDestroy() { this.alive = false; } + + openDownloadDialog() { + this.dialogService.open(DownloadFormComponent); + } + + openDownloadPremiumDialog() { + this.dialogService.open(PremiumFormComponent); + } } diff --git a/docs/app/shared/components/download-admin/download-admin.component.html b/docs/app/shared/components/download-admin/download-admin.component.html deleted file mode 100644 index 24fdaed4..00000000 --- a/docs/app/shared/components/download-admin/download-admin.component.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/docs/app/shared/components/download-admin/download-admin.component.scss b/docs/app/shared/components/download-admin/download-admin.component.scss deleted file mode 100644 index 75c0a5de..00000000 --- a/docs/app/shared/components/download-admin/download-admin.component.scss +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @license - * Copyright Akveo. All Rights Reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - */ - -@import '../../../@theme/styles/themes'; -@import '~@nebular/theme/styles/global/breakpoints'; - -@include nb-install-component() { - .btn { - font-family: nb-theme(font-main), sans-serif; - border-radius: 3px; - border: none; - background: #ffffff; - color: #000000; - padding: 1.125rem 0; - box-shadow: nb-theme(shadow-default); - cursor: pointer; - text-transform: uppercase; - - &.btn-download { - margin-left: 1em; - color: #ffffff; - background-color: nb-theme(color-active-fg); - box-shadow: nb-theme(shadow-btn); - - &:hover { - box-shadow: nb-theme(shadow-hover-green-btn); - } - - &:active { - box-shadow: nb-theme(shadow-active-green-btn); - } - } - - &.btn-download { - margin-left: 0; - margin-top: 1rem; - width: 100%; - } - - &:hover { - box-shadow: nb-theme(shadow-hover-btn); - } - - &:active { - box-shadow: nb-theme(shadow-active-btn); - } - } - - @include media-breakpoint-down(md) { - .btn { - font-size: 0.7rem; - padding-bottom: 1rem; - padding-top: 1rem; - } - } -} diff --git a/docs/app/shared/components/download-admin/download-admin.component.ts b/docs/app/shared/components/download-admin/download-admin.component.ts deleted file mode 100644 index 62e4fc05..00000000 --- a/docs/app/shared/components/download-admin/download-admin.component.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @license - * Copyright Akveo. All Rights Reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - */ - -import { Component } from '@angular/core'; -import { NbDialogService } from '@nebular/theme'; -import { DownloadFormComponent } from '../download-form/download-form.component'; - -@Component({ - selector: 'ngx-download-admin', - templateUrl: './download-admin.component.html', - styleUrls: ['./download-admin.component.scss'], -}) -export class DownloadAdminComponent { - - constructor(private dialogService: NbDialogService) { - } - - openDialog() { - this.dialogService.open(DownloadFormComponent); - } -} diff --git a/docs/app/shared/components/premium/premium.component.html b/docs/app/shared/components/premium/premium.component.html deleted file mode 100644 index 3d78bf20..00000000 --- a/docs/app/shared/components/premium/premium.component.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/docs/app/shared/components/premium/premium.component.scss b/docs/app/shared/components/premium/premium.component.scss deleted file mode 100644 index 75c0a5de..00000000 --- a/docs/app/shared/components/premium/premium.component.scss +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @license - * Copyright Akveo. All Rights Reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - */ - -@import '../../../@theme/styles/themes'; -@import '~@nebular/theme/styles/global/breakpoints'; - -@include nb-install-component() { - .btn { - font-family: nb-theme(font-main), sans-serif; - border-radius: 3px; - border: none; - background: #ffffff; - color: #000000; - padding: 1.125rem 0; - box-shadow: nb-theme(shadow-default); - cursor: pointer; - text-transform: uppercase; - - &.btn-download { - margin-left: 1em; - color: #ffffff; - background-color: nb-theme(color-active-fg); - box-shadow: nb-theme(shadow-btn); - - &:hover { - box-shadow: nb-theme(shadow-hover-green-btn); - } - - &:active { - box-shadow: nb-theme(shadow-active-green-btn); - } - } - - &.btn-download { - margin-left: 0; - margin-top: 1rem; - width: 100%; - } - - &:hover { - box-shadow: nb-theme(shadow-hover-btn); - } - - &:active { - box-shadow: nb-theme(shadow-active-btn); - } - } - - @include media-breakpoint-down(md) { - .btn { - font-size: 0.7rem; - padding-bottom: 1rem; - padding-top: 1rem; - } - } -} diff --git a/docs/app/shared/components/premium/premium.component.ts b/docs/app/shared/components/premium/premium.component.ts deleted file mode 100644 index 66a6719a..00000000 --- a/docs/app/shared/components/premium/premium.component.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @license - * Copyright Akveo. All Rights Reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - */ - -import { Component } from '@angular/core'; -import {NbDialogService} from '@nebular/theme'; -import {PremiumFormComponent} from '../premium-form/premium-form.component'; - -@Component({ - selector: 'ngx-premium', - templateUrl: './premium.component.html', - styleUrls: ['./premium.component.scss'], -}) -export class PremiumComponent { - - - constructor(private dialogService: NbDialogService) { - } - - openDialog() { - this.dialogService.open(PremiumFormComponent); - } - -} diff --git a/docs/app/shared/landing-shared.module.ts b/docs/app/shared/landing-shared.module.ts index 96717414..df1c34a2 100644 --- a/docs/app/shared/landing-shared.module.ts +++ b/docs/app/shared/landing-shared.module.ts @@ -4,16 +4,12 @@ import { MaterialThemeLinkComponent } from './components/material-theme-link/mat import { CapitalizePipe } from './pipes/capitalize.pipe'; import { EvaIconsPipe } from './pipes/eva-icons.pipe'; import { RouterModule } from '@angular/router'; -import { DownloadAdminComponent } from './components/download-admin/download-admin.component'; import { DownloadFormComponent } from './components/download-form/download-form.component'; -import { PremiumComponent } from './components/premium/premium.component'; import { PremiumFormComponent } from './components/premium-form/premium-form.component'; const component = [ MaterialThemeLinkComponent, - DownloadAdminComponent, DownloadFormComponent, - PremiumComponent, PremiumFormComponent, ]; const pipes = [