Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions components/color-theme/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export class MDNColorTheme extends L10nMixin(LitElement) {
super();
/** @type {import("./types.js").ColorScheme} */
this._mode = "light dark";
this._options = Object.entries({
this._options = {
"light dark": this.l10n("theme-default")`OS default`,
light: this.l10n`Light`,
dark: this.l10n`Dark`,
});
};
}

/** @param {MouseEvent} event */
Expand All @@ -43,6 +43,10 @@ export class MDNColorTheme extends L10nMixin(LitElement) {
}
}

get _theme() {
return this._options[this._mode] ?? this.l10n`Theme`;
}

/**
* @param {import("lit").PropertyValues<this>} changedProperties
*/
Expand Down Expand Up @@ -70,15 +74,15 @@ export class MDNColorTheme extends L10nMixin(LitElement) {
type="button"
aria-label=${this.l10n`Switch color theme`}
>
<span>${this.l10n`Theme`}</span>
<span>${this._theme}</span>
</button>
<div
slot="dropdown"
class="color-theme__dropdown"
id="color-theme__dropdown"
>
<ul class="color-theme__list">
${this._options.map(
${Object.entries(this._options).map(
([mode, option]) =>
html`<li>
<button
Expand Down
Loading