Skip to content

Commit

Permalink
fix(demo): improve ssr demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherPHolder committed Mar 18, 2024
1 parent 5dc761a commit 37dd1bc
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ControllerComponent } from '../misc/controller.component';
import { IconTester } from '../misc/icon-tester.service';
import { SUPPORTED_ICONS } from '../misc/icon-data';
import { BaseDemoComponent } from '../misc/base-demo.component';
import { DEMO_ROUTE } from '../misc/constants';

@Component({
standalone: true,
Expand All @@ -31,6 +32,7 @@ import { BaseDemoComponent } from '../misc/base-demo.component';
export class AngularComponent extends BaseDemoComponent {
constructor() {
super();
this.tester.activeDemo.set(DEMO_ROUTE.ANGULAR);
this.tester.defineSet(
SUPPORTED_ICONS.map((i) => `assets/svg-icons/${i}.svg`)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SUPPORTED_ICONS } from '../misc/icon-data';

import { AllIcons } from './ant-icons';
import { BaseDemoComponent } from '../misc/base-demo.component';
import { DEMO_ROUTE } from '../misc/constants';

@Component({
standalone: true,
Expand All @@ -33,6 +34,7 @@ import { BaseDemoComponent } from '../misc/base-demo.component';
export class AntComponent extends BaseDemoComponent {
constructor(private iconService: IconService) {
super();
this.tester.activeDemo.set(DEMO_ROUTE.ANT);
this.tester.defineSet(SUPPORTED_ICONS);
this.iconService.addIcon(...(AllIcons));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ControllerComponent } from '../misc/controller.component';
import { IconTester } from '../misc/icon-tester.service';
import { SUPPORTED_ICONS } from '../misc/icon-data';
import { BaseDemoComponent } from '../misc/base-demo.component';
import { DEMO_ROUTE } from '../misc/constants';

@Component({
standalone: true,
Expand All @@ -31,6 +32,7 @@ import { BaseDemoComponent } from '../misc/base-demo.component';
export class FastIconRouteComponent extends BaseDemoComponent {
constructor() {
super();
this.tester.activeDemo.set(DEMO_ROUTE.FAST_SVG);
this.tester.defineSet(SUPPORTED_ICONS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { faCircleUser } from '@fortawesome/free-solid-svg-icons';
import { ControllerComponent } from '../misc/controller.component';
import { IconTester } from '../misc/icon-tester.service';
import { BaseDemoComponent } from '../misc/base-demo.component';
import { DEMO_ROUTE } from '../misc/constants';

@Component({
standalone: true,
Expand All @@ -31,6 +32,7 @@ import { BaseDemoComponent } from '../misc/base-demo.component';
export class FontAwesomeComponent extends BaseDemoComponent {
constructor() {
super();
this.tester.activeDemo.set(DEMO_ROUTE.FONT_AWESOME);
this.tester.defineSet([
faCircleUser,
faCircleUser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { IonIcon } from '@ionic/angular/standalone';
import { ControllerComponent } from '../misc/controller.component';
import { SUPPORTED_ICONS } from '../misc/icon-data';
import { BaseDemoComponent } from '../misc/base-demo.component';
import { DEMO_ROUTE } from '../misc/constants';

@Component({
standalone: true,
Expand All @@ -30,6 +31,7 @@ import { BaseDemoComponent } from '../misc/base-demo.component';
export class IonicComponent extends BaseDemoComponent {
constructor() {
super();
this.tester.activeDemo.set(DEMO_ROUTE.IONIC);
this.tester.defineSet(
SUPPORTED_ICONS.map((i) => `assets/svg-icons/${i}.svg`)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ControllerComponent } from '../misc/controller.component';
import { IconTester } from '../misc/icon-tester.service';
import { SUPPORTED_ICONS } from '../misc/icon-data';
import { BaseDemoComponent } from '../misc/base-demo.component';
import { DEMO_ROUTE } from '../misc/constants';

@Component({
standalone: true,
Expand Down Expand Up @@ -35,6 +36,7 @@ export class MaterialComponent extends BaseDemoComponent {
private matIconRegistry: MatIconRegistry,
) {
super();
this.tester.activeDemo.set(DEMO_ROUTE.MATERIAL);
this.tester.defineSet(SUPPORTED_ICONS);
SUPPORTED_ICONS.forEach((i) => {
this.matIconRegistry.addSvgIcon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class BaseDemoComponent implements OnInit {
protected tester = inject(IconTester);

ngOnInit() {
this.tester.activeDemo.set('angular');
this.tester.activeLayoutSetting.set(this.layout() as any);
this.tester.iconListCount.set(this.count());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, signal } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Router } from '@angular/router';
import { IconDefinition } from '@fortawesome/free-solid-svg-icons';
import { LAYOUT_SETTING, LayoutSetting } from './constants';

Expand All @@ -12,7 +12,7 @@ export class IconTester {

icons?: string[] | IconDefinition[];

constructor(private activatedRoute: ActivatedRoute, private router: Router) {}
constructor(private router: Router) {}

setLayout(setting: LayoutSetting) {
this.activeLayoutSetting.set(setting);
Expand All @@ -34,8 +34,7 @@ export class IconTester {

private updateLocation(): void {
this.router.navigate(
[this.activeDemo(), this.activeLayoutSetting(), this.iconListCount()],
{ relativeTo: this.activatedRoute }
[this.activeDemo(), this.activeLayoutSetting(), this.iconListCount()]
);
}
}

0 comments on commit 37dd1bc

Please sign in to comment.