Skip to content

Commit aceeed4

Browse files
committed
chore: add icons to theme selector
Update the Theme select button to render an icon next to the label via an ng-template. Signed-off-by: Alex Piatakov <alex.piatakov@swirldslabs.com>
1 parent 6570882 commit aceeed4

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

frontend/src/app/services/app-theme.service.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export type AppTheme = 'light' | 'dark' | 'system';
55
export interface AppThemeOption {
66
label: string;
77
value: AppTheme;
8+
icon: string;
89
}
910

1011
const APP_THEME_STORAGE_KEY = 'GUARDIAN_APP_THEME';
@@ -16,9 +17,9 @@ const DARK_CLASS = 'guardian-theme-dark';
1617
})
1718
export class AppThemeService implements OnDestroy {
1819
public readonly themes: AppThemeOption[] = [
19-
{ label: 'Light', value: 'light' },
20-
{ label: 'Dark', value: 'dark' },
21-
{ label: 'System', value: 'system' }
20+
{ label: 'Light', value: 'light', icon: 'pi pi-sun' },
21+
{ label: 'Dark', value: 'dark', icon: 'pi pi-moon' },
22+
{ label: 'System', value: 'system', icon: 'pi pi-desktop' }
2223
];
2324

2425
private currentTheme: AppTheme = 'light';

frontend/src/app/views/root-profile/root-profile.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@
219219
optionLabel="label"
220220
optionValue="value"
221221
styleClass="profile-theme-select">
222+
<ng-template let-item pTemplate="item">
223+
<i [class]="item.icon"></i>
224+
<span>{{ item.label }}</span>
225+
</ng-template>
222226
</p-selectbutton>
223227
</div>
224228

frontend/src/app/views/root-profile/root-profile.component.scss

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,20 @@ button[disabled] {
615615
color: var(--color-grey-5, #848fa9);
616616
}
617617

618-
:host ::ng-deep .profile-theme-select {
619-
.p-togglebutton {
618+
:host ::ng-deep p-selectbutton {
619+
p-togglebutton {
620620
padding: 4px 10px;
621-
font-size: 12px;
621+
}
622+
623+
p-togglebutton > span {
624+
display: flex;
625+
align-items: center;
626+
gap: 6px;
627+
}
628+
629+
p-togglebutton i,
630+
p-togglebutton span {
631+
font-size: 14px !important;
622632
}
623633
}
624634

0 commit comments

Comments
 (0)