Skip to content

Commit cc09253

Browse files
authored
refactor: Light and dark themes (#588)
1 parent ee37904 commit cc09253

File tree

14 files changed

+354
-135
lines changed

14 files changed

+354
-135
lines changed

sdk-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"comment_sdk_config": "This is the configuration file for the Angular SDK",
33
"sdk_optional_configs_doc_comment": "See the document(link below) for more details on all the available config settings",
44
"sdk_optional_configs_doc": "https://docs.pega.com/bundle/constellation-sdk/page/constellation-sdks/sdks/configuring-sdk-config-json.html",
5+
"theme": "dark",
56
"authConfig": {
67
"authService": "pega",
78

src/app/_samples/embedded/embedded.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
align-items: center;
66
height: 100%;
77
width: 100%;
8-
background-color: var(--app-background-color);
98
position: fixed;
109
z-index: 99999;
1110
top: 0px;
1211
left: 0px;
1312
opacity: 0.5;
13+
background-color: var(--mat-sys-background);
1414
}
1515

1616
.progress-spinner {

src/app/_samples/embedded/embedded.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ export class EmbeddedComponent implements OnInit, OnDestroy {
6060
// Add event listener for when logged in and constellation bootstrap is loaded
6161
document.addEventListener('SdkConstellationReady', () => this.handleSdkConstellationReady());
6262

63-
const { authConfig } = await getSdkConfig();
63+
const { authConfig, theme } = await getSdkConfig();
64+
document.body.classList.remove(...['light', 'dark']);
65+
document.body.classList.add(theme || 'dark');
6466

6567
initializeAuthentication(authConfig);
6668

src/app/_samples/embedded/header/header.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
.psdk-aside {
1111
height: calc(100% - 64px);
1212
width: 12.5rem;
13-
border-right: 1px solid var(--app-neutral-light-color);
13+
border-right: 1px solid var(--mat-sys-outline-variant);
1414
}
1515

1616
.psdk-main {

src/app/_samples/embedded/main-screen/main-screen.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
.mc-work-button {
2626
font-size: 22px;
27-
color: var(--app-primary-color);
27+
color: var(--mat-sys-primary);
2828
text-decoration: underline;
2929
padding-top: 10px;
3030
}

src/app/_samples/embedded/resolution-screen/resolution-screen.component.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
border-top-left-radius: 10px;
1515
border-top-right-radius: 10px;
1616
padding: 30px;
17-
color: var(--app-form-color);
1817
font-weight: bold;
1918
font-size: 60px;
2019
}
@@ -33,8 +32,7 @@
3332
}
3433

3534
.mc-chat-button {
36-
color: var(--app-form-color);
37-
background-color: var(--app-secondary-color);
35+
color: var(--mat-sys-surface-container);
3836
font-size: 25px;
3937
font-weight: bold;
4038
border-radius: 25px;

src/app/_samples/embedded/shopping-card/shopping-card.component.scss

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@
99
justify-content: space-around;
1010
width: 210px;
1111
height: 70px;
12-
background-color: var(--app-swtach-package-background);
12+
background-color: var(--app-swatch-package-background);
13+
color: var(--mat-sys-on-primary);
1314
padding: 5px;
1415
}
1516

1617
.mc-swatch-package .mc-swatch-play {
1718
letter-spacing: normal;
18-
color: var(--app-form-color);
1919
font-size: 25px;
2020
}
2121

2222
.mc-swatch-package .mc-swatch-level {
2323
letter-spacing: normal;
24-
color: var(--app-form-color);
2524
font-size: 28px;
2625
font-weight: bold;
2726
}
@@ -38,21 +37,18 @@
3837

3938
.mc-swatch-channels .mc-swatch-count {
4039
letter-spacing: normal;
41-
color: var(--app-form-color);
4240
font-size: 40px;
4341
font-weight: bold;
4442
}
4543

4644
.mc-swatch-channels .mc-swatch-label {
4745
letter-spacing: normal;
48-
color: var(--app-form-color);
4946
font-size: 17px;
5047
}
5148

5249
.mc-swatch-body {
5350
letter-spacing: normal;
54-
border: 1px solid var(--app-neutral-light-color);
55-
background-color: var(--app-swatch-background);
51+
border: 1px solid var(--mat-sys-outline-variant);
5652
display: flex;
5753
flex-direction: column;
5854
align-items: center;
@@ -77,21 +73,21 @@
7773
}
7874

7975
.mc-swatch-body .mc-swatch-from {
80-
color: var(--app-primary-color);
76+
color: var(--mat-sys-primary);
8177
text-align: right;
8278
}
8379

8480
.mc-swatch-body .mc-swatch-currency {
8581
letter-spacing: normal;
86-
color: var(--app-primary-color);
82+
color: var(--mat-sys-primary);
8783
font-size: 30px;
8884
font-weight: bold;
8985
font-family: Tahoma;
9086
}
9187

9288
.mc-swatch-body .mc-swatch-dollars {
9389
letter-spacing: normal;
94-
color: var(--app-primary-color);
90+
color: var(--mat-sys-primary);
9591
font-size: 90px;
9692
font-weight: bold;
9793
font-family: Tahoma;
@@ -104,14 +100,14 @@
104100

105101
.mc-swatch-body .mc-swatch-cents {
106102
letter-spacing: normal;
107-
color: var(--app-primary-color);
103+
color: var(--mat-sys-primary);
108104
font-size: 20px;
109105
font-weight: bold;
110106
}
111107

112108
.mc-swatch-body .mc-swatch-shop-button {
113-
color: var(--app-form-color);
114-
background-color: var(--app-secondary-color);
109+
color: var(--mat-sys-on-primary);
110+
background-color: var(--mat-sys-primary);
115111
font-size: 25px;
116112
font-weight: bold;
117113
border-radius: 25px;

src/app/_samples/full-portal/full-portal.component.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
align-items: center;
1010
height: 100%;
1111
width: 100%;
12-
background-color: var(--app-background-color);
1312
position: fixed;
1413
z-index: 99999;
1514
top: 0rem;
@@ -35,12 +34,10 @@
3534
text-align: center;
3635
font-weight: 500;
3736
letter-spacing: 0.5px;
38-
color: var(--app-error-light-color);
3937
}
4038

4139
.portal-load-error .portal-name {
4240
font-style: italic;
43-
color: var(--app-warning-color-dark);
4441
}
4542

4643
.logout-btn {
@@ -52,27 +49,22 @@
5249
border: 3px solid var(--app-neutral-color);
5350
border-radius: 10px;
5451
padding: 8px 2em;
55-
color: var(--app-warning-color);
5652
font-weight: 500;
5753
letter-spacing: 0.5px;
5854
cursor: pointer;
5955
}
6056

6157
.logout-btn:hover {
62-
background: var(--app-warning-color-dark);
63-
color: var(--app-form-color);
6458
}
6559

6660
.portals-list {
6761
display: flex;
6862
justify-content: center;
6963
align-content: center;
7064
gap: 1em;
71-
color: var(--app-primary-light-color);
7265
text-decoration: underline;
7366
}
7467

7568
.portal-list-item:hover {
7669
cursor: pointer;
77-
color: var(--app-primary-dark-color);
7870
}

src/app/_samples/full-portal/full-portal.component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ export class FullPortalComponent implements OnInit, OnDestroy {
5555
private scservice: ServerConfigService
5656
) {}
5757

58-
ngOnInit() {
59-
this.scservice.readSdkConfig().then(() => {
60-
this.initialize();
61-
});
58+
async ngOnInit() {
59+
const { theme } = await this.scservice.readSdkConfig();
60+
document.body.classList.remove(...['light', 'dark']);
61+
document.body.classList.add(theme || 'dark');
62+
this.initialize();
6263
}
6364

6465
ngOnDestroy() {

src/app/_samples/simple-portal/navigation/navigation.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
.psdk-aside {
3030
height: calc(100% - 64px);
3131
width: 12.5rem;
32-
border-right: 1px solid lightgray;
32+
border-right: 1px solid var(--mat-sys-outline-variant);
3333
}
3434

3535
.psdk-main {

0 commit comments

Comments
 (0)