From ea4a65ca854f1efe3d3ac9ac65db9342bf11f757 Mon Sep 17 00:00:00 2001 From: AlekseyPortnyagin Date: Wed, 27 Mar 2024 12:27:50 +0500 Subject: [PATCH] chore(demo): migrate documentation page `stepper` to standalone components --- projects/demo/src/modules/app/app.routes.ts | 12 +++----- .../components/stepper/examples/1/index.ts | 3 ++ .../components/stepper/examples/2/index.ts | 4 +++ .../components/stepper/examples/3/index.ts | 4 +++ .../components/stepper/stepper.component.ts | 16 +++++++++- .../components/stepper/stepper.module.ts | 30 ------------------- 6 files changed, 30 insertions(+), 39 deletions(-) delete mode 100644 projects/demo/src/modules/components/stepper/stepper.module.ts diff --git a/projects/demo/src/modules/app/app.routes.ts b/projects/demo/src/modules/app/app.routes.ts index 0530febd9779..5d06d4685198 100644 --- a/projects/demo/src/modules/app/app.routes.ts +++ b/projects/demo/src/modules/app/app.routes.ts @@ -1010,15 +1010,11 @@ export const ROUTES: Routes = [ title: 'Slider', }, }, - { + route({ path: 'navigation/stepper', - loadChildren: async () => - (await import('../components/stepper/stepper.module')) - .ExampleTuiStepperModule, - data: { - title: 'Stepper', - }, - }, + loadComponent: async () => import('../components/stepper/stepper.component'), + title: 'Stepper', + }), { path: 'components/preview', loadChildren: async () => diff --git a/projects/demo/src/modules/components/stepper/examples/1/index.ts b/projects/demo/src/modules/components/stepper/examples/1/index.ts index d80109752625..bc689fa3b586 100644 --- a/projects/demo/src/modules/components/stepper/examples/1/index.ts +++ b/projects/demo/src/modules/components/stepper/examples/1/index.ts @@ -1,9 +1,12 @@ import {Component} from '@angular/core'; import {changeDetection} from '@demo/emulate/change-detection'; import {encapsulation} from '@demo/emulate/encapsulation'; +import {TuiStepperModule} from '@taiga-ui/kit'; @Component({ + standalone: true, selector: 'tui-stepper-example-1', + imports: [TuiStepperModule], templateUrl: './index.html', encapsulation, changeDetection, diff --git a/projects/demo/src/modules/components/stepper/examples/2/index.ts b/projects/demo/src/modules/components/stepper/examples/2/index.ts index 414710cc139b..e4f066be6349 100644 --- a/projects/demo/src/modules/components/stepper/examples/2/index.ts +++ b/projects/demo/src/modules/components/stepper/examples/2/index.ts @@ -1,9 +1,13 @@ +import {NgForOf} from '@angular/common'; import {Component} from '@angular/core'; import {changeDetection} from '@demo/emulate/change-detection'; import {encapsulation} from '@demo/emulate/encapsulation'; +import {TuiStepperModule} from '@taiga-ui/kit'; @Component({ + standalone: true, selector: 'tui-stepper-example-2', + imports: [TuiStepperModule, NgForOf], templateUrl: './index.html', encapsulation, changeDetection, diff --git a/projects/demo/src/modules/components/stepper/examples/3/index.ts b/projects/demo/src/modules/components/stepper/examples/3/index.ts index 8757e5b5ac6d..12c1adeccd97 100644 --- a/projects/demo/src/modules/components/stepper/examples/3/index.ts +++ b/projects/demo/src/modules/components/stepper/examples/3/index.ts @@ -1,9 +1,13 @@ +import {NgForOf} from '@angular/common'; import {Component} from '@angular/core'; import {changeDetection} from '@demo/emulate/change-detection'; import {encapsulation} from '@demo/emulate/encapsulation'; +import {TuiStepperModule} from '@taiga-ui/kit'; @Component({ + standalone: true, selector: 'tui-stepper-example-3', + imports: [TuiStepperModule, NgForOf], templateUrl: './index.html', styleUrls: ['./index.less'], encapsulation, diff --git a/projects/demo/src/modules/components/stepper/stepper.component.ts b/projects/demo/src/modules/components/stepper/stepper.component.ts index b61532cb72db..c1e0f8678019 100644 --- a/projects/demo/src/modules/components/stepper/stepper.component.ts +++ b/projects/demo/src/modules/components/stepper/stepper.component.ts @@ -1,15 +1,29 @@ import {Component} from '@angular/core'; import {changeDetection} from '@demo/emulate/change-detection'; import type {TuiDocExample} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule} from '@taiga-ui/addon-doc'; import type {TuiOrientation} from '@taiga-ui/core'; import type {TuiStepState} from '@taiga-ui/kit'; +import {TuiStepperModule} from '@taiga-ui/kit'; + +import {TuiStepperExample1} from './examples/1'; +import {TuiStepperExample2} from './examples/2'; +import {TuiStepperExample3} from './examples/3'; @Component({ + standalone: true, selector: 'example-tui-stepper', + imports: [ + TuiStepperExample1, + TuiStepperExample2, + TuiStepperExample3, + TuiStepperModule, + TuiAddonDocModule, + ], templateUrl: './stepper.template.html', changeDetection, }) -export class ExampleTuiStepperComponent { +export default class ExampleTuiStepperComponent { protected readonly exampleModule = import('./examples/import/import-module.md?raw'); protected readonly exampleHtml = import('./examples/import/insert-template.md?raw'); diff --git a/projects/demo/src/modules/components/stepper/stepper.module.ts b/projects/demo/src/modules/components/stepper/stepper.module.ts deleted file mode 100644 index ae4f672ffa00..000000000000 --- a/projects/demo/src/modules/components/stepper/stepper.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {RouterModule} from '@angular/router'; -import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; -import {TuiLinkModule} from '@taiga-ui/core'; -import {TuiStepperModule} from '@taiga-ui/kit'; - -import {TuiStepperExample1} from './examples/1'; -import {TuiStepperExample2} from './examples/2'; -import {TuiStepperExample3} from './examples/3'; -import {ExampleTuiStepperComponent} from './stepper.component'; - -@NgModule({ - imports: [ - CommonModule, - RouterModule, - TuiStepperModule, - TuiLinkModule, - TuiAddonDocModule, - RouterModule.forChild(tuiGenerateRoutes(ExampleTuiStepperComponent)), - ], - declarations: [ - ExampleTuiStepperComponent, - TuiStepperExample1, - TuiStepperExample2, - TuiStepperExample3, - ], - exports: [ExampleTuiStepperComponent], -}) -export class ExampleTuiStepperModule {}