diff --git a/docs/app/pages/home/banner/banner.component.scss b/docs/app/pages/home/banner/banner.component.scss new file mode 100644 index 00000000..71b31bbc --- /dev/null +++ b/docs/app/pages/home/banner/banner.component.scss @@ -0,0 +1,82 @@ +/** + * @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'; + +:host { + position: fixed; + @include nb-ltr(right, 10px); + @include nb-rtl(left, 10px); + top: 80px; + border-radius: 5px; + background-color: #dc5425; + box-shadow: 0 2px 4px 0 rgba(189, 93, 60, 0.54); + z-index: 99999999; + + .heading-with-icon { + display: flex; + align-items: center; + } + + .icon { + height: auto; + width: 77px; + margin: 0 26px; + } + + .banner-heading { + font-size: 14px; + line-height: 20px; + font-weight: 700; + margin: 0; + color: #ffffff; + } + + .banner-content { + padding-top: 36px; + padding-bottom: 36px; + } + + .close-button { + background: none; + border: none; + cursor: pointer; + margin-bottom: auto; + padding: 10px; + color: #ffffff; + } + + .nb-close { + font-size: 24px; + font-weight: 600; + } + + .cta { + margin: 8px 0 0; + font-size: 14px; + color: #ffffff; + } + + .cta-link { + font-size: 10px; + border-radius: 2px; + display: inline-block; + padding: 4px 16px; + margin: 0 10px; + text-transform: uppercase; + font-weight: 700; + background: #ffffff; + color: #000000; + } + + @media screen and (max-width: 991px) { + top: 20px; + } + + @media screen and (max-width: 767px) { + display: none; + } +} diff --git a/docs/app/pages/home/banner/banner.component.ts b/docs/app/pages/home/banner/banner.component.ts new file mode 100644 index 00000000..80eddab3 --- /dev/null +++ b/docs/app/pages/home/banner/banner.component.ts @@ -0,0 +1,63 @@ +/** + * @license + * Copyright Akveo. All Rights Reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + */ + +import { Component, HostBinding, Inject, OnInit } from '@angular/core'; +import { NB_WINDOW } from '@nebular/theme'; + +const HIDE_BANNER_KEY = 'HIDE_PRODUCT_HUNT_BANNER'; + +@Component({ + selector: 'ngx-release-banner', + template: ` +
+ `, + styleUrls: ['./banner.component.scss'], +}) +export class BannerComponent implements OnInit { + + storage: Storage; + + @HostBinding('attr.hidden') + isHidden: true | null = null; + + @HostBinding('attr.dir') + dir = 'ltr'; + + constructor( + @Inject(NB_WINDOW) private window, + ) {} + + ngOnInit() { + this.storage = this.window.localStorage; + + this.isHidden = this.storage && this.storage.getItem(HIDE_BANNER_KEY) + ? true + : null; + } + + closeBanner() { + if (this.storage) { + this.storage.setItem(HIDE_BANNER_KEY, 'true'); + } + this.isHidden = true; + } +} diff --git a/docs/app/pages/home/landing-home.component.html b/docs/app/pages/home/landing-home.component.html index 64cb1186..4af48655 100644 --- a/docs/app/pages/home/landing-home.component.html +++ b/docs/app/pages/home/landing-home.component.html @@ -5,7 +5,7 @@- Don't forget to - - check out - - and star our repo :) -
`, styleUrls: ['./banner.component.scss'], }) -export class BannerComponent implements OnInit, OnDestroy { +export class BannerComponent implements OnInit { - private alive = true; storage: Storage; - isDarkTheme: boolean; @HostBinding('attr.hidden') isHidden: true | null = null; @@ -40,7 +44,6 @@ export class BannerComponent implements OnInit, OnDestroy { constructor( @Inject(NB_WINDOW) private window, - private themeService: NbThemeService, ) {} ngOnInit() { @@ -49,11 +52,6 @@ export class BannerComponent implements OnInit, OnDestroy { this.isHidden = this.storage && this.storage.getItem(HIDE_BANNER_KEY) ? true : null; - - this.isDarkTheme = this.themeService.currentTheme === 'cosmic'; - this.themeService.onThemeChange() - .pipe(takeWhile(() => this.alive)) - .subscribe(({ name }) => this.isDarkTheme = name === 'cosmic'); } closeBanner() { @@ -62,12 +60,4 @@ export class BannerComponent implements OnInit, OnDestroy { } this.isHidden = true; } - - getBellPath() { - return `assets/images/bell${this.isDarkTheme ? '' : '-white'}.svg`; - } - - ngOnDestroy() { - this.alive = false; - } } diff --git a/src/app/@theme/styles/styles.scss b/src/app/@theme/styles/styles.scss index dac33370..6721bfb0 100644 --- a/src/app/@theme/styles/styles.scss +++ b/src/app/@theme/styles/styles.scss @@ -15,8 +15,6 @@ @import './bootstrap-rtl'; -@import '../components/banner/banner.component.theme'; - // install the framework and custom global styles @include nb-install() { @@ -28,8 +26,6 @@ // loading progress bar @include ngx-pace-theme(); - @include ngx-release-banner-component(); - // fixed in rc.9 and can be removed after upgrade .custom-control .custom-control-indicator { border-radius: 50%; // TODO: quickfix for https://github.com/akveo/nebular/issues/275 diff --git a/src/assets/images/product-hunt-cat.png b/src/assets/images/product-hunt-cat.png new file mode 100644 index 00000000..e06b88c8 Binary files /dev/null and b/src/assets/images/product-hunt-cat.png differ