Skip to content

Commit 018233e

Browse files
committed
fix: getStyle() add nullish check
1 parent 9705b0a commit 018233e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Diff for: src/app/views/dashboard/dashboard-charts-data.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class DashboardChartsData {
2929
initMainChart(period: string = 'Month') {
3030
const brandSuccess = getStyle('--cui-success') ?? '#4dbd74';
3131
const brandInfo = getStyle('--cui-info') ?? '#20a8d8';
32-
const brandInfoBg = hexToRgba(getStyle('--cui-info'), 10) ?? '#20a8d8';
32+
const brandInfoBg = hexToRgba(brandInfo, 10);
3333
const brandDanger = getStyle('--cui-danger') || '#f86c6b';
3434

3535
// mainChart

Diff for: src/app/views/theme/colors.component.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ export class ColorsComponent implements OnInit, AfterViewInit {
1616

1717
public themeColors(): void {
1818
Array.from(this.document.querySelectorAll('.theme-color')).forEach(
19-
// @ts-ignore
20-
(el: HTMLElement) => {
21-
const background = getStyle('background-color', el);
19+
(element: Element) => {
20+
const htmlElement = element as HTMLElement;
21+
const background = getStyle('background-color', htmlElement) ?? '#fff';
2222
const table = this.renderer.createElement('table');
2323
table.innerHTML = `
24-
<table class='table w-100'>
24+
<table class="table w-100">
2525
<tr>
26-
<td class='text-muted'>HEX:</td>
27-
<td class='font-weight-bold'>${rgbToHex(background)}</td>
26+
<td class="text-muted">HEX:</td>
27+
<td class="font-weight-bold">${rgbToHex(background)}</td>
2828
</tr>
2929
<tr>
30-
<td class='text-muted'>RGB:</td>
31-
<td class='font-weight-bold'>${background}</td>
30+
<td class="text-muted">RGB:</td>
31+
<td class="font-weight-bold">${background}</td>
3232
</tr>
3333
</table>
3434
`;
35-
this.renderer.appendChild(el.parentNode, table);
35+
this.renderer.appendChild(htmlElement.parentNode, table);
3636
// @ts-ignore
3737
// el.parentNode.appendChild(table);
3838
}
@@ -49,8 +49,8 @@ export class ColorsComponent implements OnInit, AfterViewInit {
4949
@Component({
5050
selector: 'app-theme-color',
5151
template: `
52-
<c-col xl='2' md='4' sm='6' xs='12' class='my-4 ms-4'>
53-
<div [ngClass]='colorClasses' style='padding-top: 75%;'></div>
52+
<c-col xl="2" md="4" sm="6" xs="12" class="my-4 ms-4">
53+
<div [ngClass]="colorClasses" style="padding-top: 75%;"></div>
5454
<ng-content></ng-content>
5555
</c-col>
5656
`

0 commit comments

Comments
 (0)