Skip to content

Commit

Permalink
feat(icons): create module for icons
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosanif committed Feb 5, 2022
1 parent 44f24a6 commit 74664ea
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 52 deletions.
19 changes: 3 additions & 16 deletions src/app/features/about/about.module.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { faTwitter } from '@fortawesome/free-brands-svg-icons';
import { faStar } from '@fortawesome/free-solid-svg-icons';
import { TuiButtonModule } from '@taiga-ui/core';

import { IconModule } from '../../shared/ui/icon/icon.module';
import { AboutComponent } from './about.component';

const routes: Routes = [{ path: '', component: AboutComponent }];

@NgModule({
imports: [
CommonModule,
TuiButtonModule,
FontAwesomeModule,
RouterModule.forChild(routes),
],
imports: [CommonModule, TuiButtonModule, RouterModule.forChild(routes), IconModule],
declarations: [AboutComponent],
})
export class AboutModule {
private icons = [faStar, faTwitter];

constructor(faIconLibrary: FaIconLibrary) {
faIconLibrary.addIcons(...this.icons);
}
}
export class AboutModule {}
14 changes: 3 additions & 11 deletions src/app/features/home/home.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { faGithub } from '@fortawesome/free-brands-svg-icons';
import { faBook, faLink } from '@fortawesome/free-solid-svg-icons';
import { TuiButtonModule, TuiHintModule, TuiLinkModule } from '@taiga-ui/core';
import { TuiAvatarModule } from '@taiga-ui/kit';

import { IconModule } from '../../shared/ui/icon/icon.module';
import { HomeComponent } from './home.component';

const routes: Routes = [{ path: '', component: HomeComponent }];
Expand All @@ -18,15 +16,9 @@ const routes: Routes = [{ path: '', component: HomeComponent }];
TuiLinkModule,
TuiHintModule,
TuiAvatarModule,
FontAwesomeModule,
RouterModule.forChild(routes),
IconModule,
],
declarations: [HomeComponent],
})
export class HomeModule {
private icons = [faGithub, faBook, faLink];

constructor(faIconLibrary: FaIconLibrary) {
faIconLibrary.addIcons(...this.icons);
}
}
export class HomeModule {}
18 changes: 3 additions & 15 deletions src/app/shared/ui/footer/footer.module.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
import {
faGithub,
faMediumM,
faTwitter,
faLinkedinIn,
} from '@fortawesome/free-brands-svg-icons';
import { TuiLinkModule } from '@taiga-ui/core';

import { IconModule } from '../icon/icon.module';
import { FooterComponent } from './footer.component';

@NgModule({
imports: [CommonModule, FontAwesomeModule, TuiLinkModule],
imports: [CommonModule, TuiLinkModule, IconModule],
declarations: [FooterComponent],
exports: [FooterComponent],
})
export class FooterModule {
private icons = [faGithub, faMediumM, faTwitter, faLinkedinIn];

constructor(faIconLibrary: FaIconLibrary) {
faIconLibrary.addIcons(...this.icons);
}
}
export class FooterModule {}
13 changes: 3 additions & 10 deletions src/app/shared/ui/header/header.module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { faGithub } from '@fortawesome/free-brands-svg-icons';
import {
TuiButtonModule,
TuiHostedDropdownModule,
Expand All @@ -12,6 +10,7 @@ import {
} from '@taiga-ui/core';
import { TuiAvatarModule } from '@taiga-ui/kit';

import { IconModule } from '../icon/icon.module';
import { HeaderComponent } from './header.component';

@NgModule({
Expand All @@ -24,15 +23,9 @@ import { HeaderComponent } from './header.component';
TuiAvatarModule,
TuiSvgModule,
TuiHintModule,
FontAwesomeModule,
IconModule,
],
declarations: [HeaderComponent],
exports: [HeaderComponent],
})
export class HeaderModule {
private icons = [faGithub];

constructor(faIconLibrary: FaIconLibrary) {
faIconLibrary.addIcons(...this.icons);
}
}
export class HeaderModule {}
21 changes: 21 additions & 0 deletions src/app/shared/ui/icon/icon.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
import {
faGithub,
faMediumM,
faTwitter,
faLinkedinIn,
} from '@fortawesome/free-brands-svg-icons';
import { faStar, faBook, faLink } from '@fortawesome/free-solid-svg-icons';

@NgModule({
imports: [FontAwesomeModule],
exports: [FontAwesomeModule],
})
export class IconModule {
private icons = [faGithub, faMediumM, faTwitter, faLinkedinIn, faStar, faBook, faLink];

constructor(faIconLibrary: FaIconLibrary) {
faIconLibrary.addIcons(...this.icons);
}
}

0 comments on commit 74664ea

Please sign in to comment.