Skip to content

Commit

Permalink
fix(sbb-timetable-occupancy-icon): enable SSR rendering (#2260)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeripeierSBB committed Dec 4, 2023
1 parent 7fddd42 commit cc5e0f9
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ export class SbbTimetableOccupancyIcon extends SbbIconBase {
}

let icon = `utilization-${this.occupancy}`;
if (window.matchMedia('(forced-colors: active)').matches) {
if (globalThis.window?.matchMedia('(forced-colors: active)').matches) {
// high contrast
icon += '-high-contrast';
} else if (this.negative || window.matchMedia('(prefer-color-scheme: dark)').matches) {
} else if (
this.negative ||
globalThis.window?.matchMedia('(prefer-color-scheme: dark)').matches
) {
// dark
icon += '-negative';
}
Expand Down

0 comments on commit cc5e0f9

Please sign in to comment.