From a110e067909a1a34c53d8cb7cbac1a51b36a5da9 Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Thu, 19 Sep 2024 21:27:30 +0300 Subject: [PATCH] chore(demo): color recalculate color in table (#8984) --- .../markup/colors/examples/table/index.html | 63 +++++++++---------- .../markup/colors/examples/table/index.less | 1 + .../markup/colors/examples/table/index.ts | 9 ++- .../demo/src/modules/markup/colors/index.html | 37 ++++++++--- .../demo/src/modules/markup/colors/index.ts | 6 +- 5 files changed, 70 insertions(+), 46 deletions(-) diff --git a/projects/demo/src/modules/markup/colors/examples/table/index.html b/projects/demo/src/modules/markup/colors/examples/table/index.html index 6827870fcf5b..3b89c4a92056 100644 --- a/projects/demo/src/modules/markup/colors/examples/table/index.html +++ b/projects/demo/src/modules/markup/colors/examples/table/index.html @@ -2,37 +2,34 @@ *ngFor="let color of colors" class="color" > - -

- - Copy - - {{ color }} -

- - -
- - -
- - Copy - - {{ getValue(color) }} -
- + + +

+ + Copy + + {{ color }} +

+ + +
+ + +
+ + Copy + + {{ value }} +
+ +
diff --git a/projects/demo/src/modules/markup/colors/examples/table/index.less b/projects/demo/src/modules/markup/colors/examples/table/index.less index 989d1c6202dd..ab899a57ca06 100644 --- a/projects/demo/src/modules/markup/colors/examples/table/index.less +++ b/projects/demo/src/modules/markup/colors/examples/table/index.less @@ -32,6 +32,7 @@ block-size: 3rem; border-radius: 100%; overflow: hidden; + box-shadow: inset 0 0 0 1px var(--tui-border-normal); } .name { diff --git a/projects/demo/src/modules/markup/colors/examples/table/index.ts b/projects/demo/src/modules/markup/colors/examples/table/index.ts index 1aef9d79e6d3..0b20aba594cc 100644 --- a/projects/demo/src/modules/markup/colors/examples/table/index.ts +++ b/projects/demo/src/modules/markup/colors/examples/table/index.ts @@ -4,7 +4,8 @@ import {Component, inject, Input} from '@angular/core'; import {changeDetection} from '@demo/emulate/change-detection'; import {WA_WINDOW} from '@ng-web-apis/common'; import {TuiDocCopy} from '@taiga-ui/addon-doc'; -import {tuiInjectElement, tuiPure} from '@taiga-ui/cdk'; +import {TUI_PLATFORM, tuiInjectElement, tuiPure} from '@taiga-ui/cdk'; +import {TUI_DARK_MODE} from '@taiga-ui/core'; @Component({ standalone: true, @@ -17,12 +18,16 @@ import {tuiInjectElement, tuiPure} from '@taiga-ui/cdk'; export class TableColors { private readonly win = inject(WA_WINDOW); private readonly styles = this.win.getComputedStyle(tuiInjectElement()); + protected readonly darkMode = inject(TUI_DARK_MODE); @Input() public colors: readonly string[] = []; + @Input({required: true}) + public tuiPlatform = inject(TUI_PLATFORM, {skipSelf: true}); + @tuiPure - protected getValue(variable: string): string { + protected getValue(variable: string, _p: string, _d: boolean): string { return this.styles.getPropertyValue(variable); } } diff --git a/projects/demo/src/modules/markup/colors/index.html b/projects/demo/src/modules/markup/colors/index.html index 1e8c844d08bd..4ffc112abb8f 100644 --- a/projects/demo/src/modules/markup/colors/index.html +++ b/projects/demo/src/modules/markup/colors/index.html @@ -40,39 +40,58 @@

-
+
-
+
-
+
-
+
-
+
diff --git a/projects/demo/src/modules/markup/colors/index.ts b/projects/demo/src/modules/markup/colors/index.ts index 69ad27f6948e..e6d4d4ab1a1c 100644 --- a/projects/demo/src/modules/markup/colors/index.ts +++ b/projects/demo/src/modules/markup/colors/index.ts @@ -1,9 +1,9 @@ -import {Component} from '@angular/core'; +import {Component, inject} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {changeDetection} from '@demo/emulate/change-detection'; import {TuiDemo} from '@demo/utils'; import {TuiPlatform} from '@taiga-ui/cdk'; -import {TuiGroup} from '@taiga-ui/core'; +import {TUI_DARK_MODE, TuiGroup} from '@taiga-ui/core'; import {TuiBlock} from '@taiga-ui/kit'; import {BACKGROUNDS, CHARTS, OTHERS, STATUSES, TEXT} from './constants'; @@ -17,6 +17,8 @@ import {TableColors} from './examples/table'; changeDetection, }) export default class Page { + protected readonly darkMode = inject(TUI_DARK_MODE); + protected readonly basicImportsLess = import( './examples/import/basic-imports-less.md?raw' );