Add "material theme link" component

This commit is contained in:
eugene-sinitsyn 2020-03-12 13:31:36 +03:00 committed by Sergey Andrievskiy
parent d0b58820be
commit f39f10c12d
18 changed files with 135 additions and 32 deletions

View file

@ -9,6 +9,7 @@
</div>
<div class="section middle">
<nb-menu [items]="headerMenu"></nb-menu>
<ng-content></ng-content>
<a routerLink="/" fragment="backend-bundles" class="backend-bundles eva-parent-hover">
<i [innerHTML]="'gift-outline' | eva: { width: 24, height: 24, fill: '#ff4d6b', animationType: 'shake' }"></i>
<span>Backend Bundles</span>

View file

@ -1,11 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'ngxCapitalize' })
export class CapitalizePipe implements PipeTransform {
transform(input: string): string {
return input && input.length
? (input.charAt(0).toUpperCase() + input.slice(1).toLowerCase())
: input;
}
}

View file

@ -1,50 +0,0 @@
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { DomSanitizer } from '@angular/platform-browser';
import { Pipe, PipeTransform } from '@angular/core';
import { icons } from 'eva-icons';
@Pipe({ name: 'eva' })
export class EvaIconsPipe implements PipeTransform {
private defaultOptions = {
height: 24,
width: 24,
fill: 'inherit',
animationHover: true,
animationInfinity: false,
};
constructor(private sanitizer: DomSanitizer) {}
transform(icon: string,
options: {
height: number;
width: number;
fill: string;
animationType?: string;
animationHover?: boolean;
animationInfinity?: boolean;
},
) {
const mergedOptions = {
...this.defaultOptions,
...options,
};
const { width, height, fill, animationType, animationHover, animationInfinity } = mergedOptions;
const animation = animationType ?
{ type: animationType, hover: animationHover, infinite: animationInfinity } :
null;
return this.sanitizer.bypassSecurityTrustHtml(icons[icon].toSvg({
width,
height,
fill,
animation,
}));
}
}

View file

@ -9,6 +9,17 @@ import { ModuleWithProviders, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { LazyLoadImageModule } from 'ng-lazyload-image';
import {
NbLayoutModule,
NbThemeModule,
NbMenuModule,
NbCheckboxModule,
NbCardModule,
NbSidebarModule,
NbTabsetModule,
} from '@nebular/theme';
import { LandingSharedModule } from '../shared/landing-shared.module';
// components
import {
@ -26,21 +37,6 @@ import {
import { ngxLandingServices } from './services';
// services
// pipes
import { EvaIconsPipe } from './pipes/eva-icons.pipe';
import { CapitalizePipe } from './pipes/capitalize.pipe';
// pipes
import {
NbLayoutModule,
NbThemeModule,
NbMenuModule,
NbCheckboxModule,
NbCardModule,
NbSidebarModule,
NbTabsetModule,
} from '@nebular/theme';
const BASE_MODULES = [
CommonModule,
FormsModule,
@ -67,14 +63,10 @@ const COMPONENTS = [
NgxDocsFooterComponent,
];
const PIPES = [
EvaIconsPipe,
CapitalizePipe,
];
@NgModule({
imports: [
RouterModule,
LandingSharedModule,
...BASE_MODULES,
@ -82,8 +74,6 @@ const PIPES = [
],
declarations: [
...COMPONENTS,
...PIPES,
],
exports: [
RouterModule,
@ -93,10 +83,6 @@ const PIPES = [
...NB_MODULES,
...COMPONENTS,
...PIPES,
],
entryComponents: [
],
})
export class NgxLandingThemeModule {