Skip to content

Commit daa39fe

Browse files
committed
refactor(custom-lite-grid): update sample to include themes
1 parent b0257de commit daa39fe

File tree

2 files changed

+46
-31
lines changed

2 files changed

+46
-31
lines changed
Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,47 @@
1+
@use "igniteui-angular/theming" as *;
2+
13
:host {
2-
contain: content;
4+
--ig-size: 2;
5+
6+
contain: content;
37
}
48

59
.grid-lite-wrapper {
6-
width: 100%;
7-
height: 100%;
10+
width: 100%;
11+
height: 100%;
812
}
913

1014
.theme-switcher {
11-
margin-bottom: 2rem;
15+
margin-bottom: 2rem;
1216
}
1317

1418
igc-grid-lite {
15-
min-height: 400px;
16-
--ig-size: 2;
19+
min-height: rem(400px);
1720
}
1821

19-
// Custom light theme
20-
igc-grid-lite.custom-light {
21-
--ig-primary-500: #c1292e;
22-
--ig-secondary-500: #f1d302;
23-
--ig-surface-500: #fdfffc;
24-
--ig-gray-500: #235789;
22+
$my-light-palette: palette(
23+
$primary: #c1292e,
24+
$secondary: #f1d302,
25+
$surface: #fdfffc,
26+
$gray: #235789,
27+
);
28+
29+
$my_dark_palette: palette(
30+
$primary: #ddd020,
31+
$secondary: #d5896f,
32+
$surface: #031d44,
33+
$gray: #04395e,
34+
);
35+
36+
.custom-light {
37+
@include palette($my_light_palette);
38+
@include typography('"Roboto", sans-serif', $bootstrap-type-scale);
2539
}
2640

27-
// Custom dark theme
28-
igc-grid-lite.custom-dark {
29-
--ig-primary-500: #ddd020;
30-
--ig-secondary-500: #d5896f;
31-
--ig-surface-500: #031d44;
32-
--ig-gray-500: #04395e;
41+
.custom-dark {
42+
@include palette($my_dark_palette);
43+
@include typography(
44+
'"Merriweather Sans", sans-serif',
45+
$bootstrap-type-scale
46+
);
3347
}

src/app/grid-lite/grid-lite-styling-custom/grid-lite-styling-custom.component.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, CUSTOM_ELEMENTS_SCHEMA, OnInit, inject } from '@angular/core';
1+
import { Component, CUSTOM_ELEMENTS_SCHEMA, OnInit, inject, ViewEncapsulation } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { defineComponents, IgcSwitchComponent } from 'igniteui-webcomponents';
44
import { IgcGridLite } from 'igniteui-grid-lite';
@@ -11,25 +11,26 @@ defineComponents(IgcSwitchComponent);
1111
selector: 'app-grid-lite-styling-custom',
1212
templateUrl: './grid-lite-styling-custom.component.html',
1313
styleUrls: ['./grid-lite-styling-custom.component.scss'],
14+
encapsulation: ViewEncapsulation.None,
1415
imports: [CommonModule],
1516
schemas: [CUSTOM_ELEMENTS_SCHEMA]
1617
})
1718
export class GridLiteStylingCustomComponent implements OnInit {
1819
private dataService = inject(GridLiteDataService);
19-
20+
2021
public data: ProductInfo[] = [];
2122
public columns: any[] = [];
2223
public theme: 'dark' | 'light' = 'dark';
2324

2425
ngOnInit() {
2526
this.data = this.dataService.generateProducts(50);
26-
27+
2728
this.columns = [
28-
{
29-
key: 'name',
30-
headerText: 'Product',
31-
filter: true,
32-
sort: true
29+
{
30+
key: 'name',
31+
headerText: 'Product',
32+
filter: true,
33+
sort: true
3334
},
3435
{
3536
key: 'price',
@@ -38,15 +39,15 @@ export class GridLiteStylingCustomComponent implements OnInit {
3839
filter: true,
3940
sort: true
4041
},
41-
{
42-
key: 'sold',
43-
type: 'number',
42+
{
43+
key: 'sold',
44+
type: 'number',
4445
headerText: 'Sold',
4546
filter: true,
4647
sort: true
4748
},
48-
{
49-
key: 'total',
49+
{
50+
key: 'total',
5051
headerText: 'Total',
5152
type: 'number',
5253
filter: true,

0 commit comments

Comments
 (0)