Skip to content

Commit f0c2ea8

Browse files
committed
feat(grid-sample): have the auto derived foreground functionality in grid-theme-builder sample
1 parent e355370 commit f0c2ea8

3 files changed

Lines changed: 41 additions & 16 deletions

File tree

src/app/grid-theme-builder/grid-theme-builder.sample.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
</span>
1111
<span class="color-picker-item">
1212
<label for="gridForeground">Foreground</label>
13-
<input id="gridForeground" type="color" [value]="gridForeground()" (input)="gridForeground.set($any($event.target).value)" />
13+
@if (gridForeground()) {
14+
<input id="gridForeground" type="color" [value]="gridForeground()" (input)="gridForeground.set($any($event.target).value)" />
15+
<button (click)="resetForeground()" title="Reset to auto"></button>
16+
} @else {
17+
<button class="no-color" (click)="gridForeground.set('#1E2A35')" title="Auto (click to override)"></button>
18+
}
1419
</span>
1520
<span class="color-picker-item">
1621
<label for="gridAccentColor">Accent Color</label>

src/app/grid-theme-builder/grid-theme-builder.sample.scss

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,9 @@
1111
grid-theme(
1212
$schema: vars.$schema,
1313
$background: #f7f4f0,
14-
$foreground: #1E2A35,
1514
$accent-color: #5B8F8A
1615
)
1716
);
18-
19-
// @include tokens(
20-
// grid-theme(
21-
// $schema: vars.$schema,
22-
// $background: #092444,
23-
// $foreground: #f1f4ed,
24-
// $accent-color: #d66620
25-
// )
26-
// );
2717
}
2818

2919
.color-pickers {
@@ -40,10 +30,39 @@
4030
font-size: 14px;
4131

4232
input[type='color'] {
43-
background: transparent;
33+
-webkit-appearance: none;
34+
appearance: none;
4435
width: 36px;
4536
height: 36px;
46-
border: none;
37+
border: 1px solid currentColor;
38+
padding: 0;
4739
cursor: pointer;
40+
41+
&::-webkit-color-swatch-wrapper { padding: 0; }
42+
&::-webkit-color-swatch { border: none; }
43+
&::-moz-color-swatch { border: none; }
44+
}
45+
46+
.no-color {
47+
position: relative;
48+
width: 36px;
49+
height: 36px;
50+
border: 1px solid currentColor;
51+
background: transparent;
52+
cursor: pointer;
53+
54+
&::before,
55+
&::after {
56+
content: '';
57+
position: absolute;
58+
inset: 0;
59+
margin: auto;
60+
width: 1px;
61+
height: 70%;
62+
background: red;
63+
}
64+
65+
&::before { transform: rotate(45deg); }
66+
&::after { transform: rotate(-45deg); }
4867
}
4968
}

src/app/grid-theme-builder/grid-theme-builder.sample.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, OnInit, signal, viewChild } from '@angular/core';
2-
32
import { SAMPLE_DATA } from '../shared/sample-data';
4-
53
import { IGX_GRID_DIRECTIVES, IgxActionStripComponent, IgxGridComponent, IgxNumberSummaryOperand, IgxSummaryResult } from 'igniteui-angular';
64

75
class EmployeesSummary extends IgxNumberSummaryOperand {
@@ -36,7 +34,10 @@ export class GridThemeBuilderSampleComponent implements OnInit, AfterViewInit {
3634
public ngAfterViewInit(): void {
3735
const styles = getComputedStyle(this.sampleEl().nativeElement);
3836
this.gridBackground.set(styles.getPropertyValue('--ig-grid-background').trim());
39-
this.gridForeground.set(styles.getPropertyValue('--ig-grid-foreground').trim());
4037
this.gridAccentColor.set(styles.getPropertyValue('--ig-grid-accent-color').trim());
4138
}
39+
40+
protected resetForeground(): void {
41+
this.gridForeground.set('');
42+
}
4243
}

0 commit comments

Comments
 (0)