Skip to content

Commit

Permalink
fix: language flag icons showing with incorrect colors
Browse files Browse the repository at this point in the history
(ex. germany white instead of black)
  • Loading branch information
budak7273 committed Oct 11, 2024
1 parent 0fe6243 commit e135b97
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/lib/components/general/TranslationDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@
export const { t } = getTranslate();
const languages = {
type language = {
name: string;
flag: string;
style?: string;
};
// cspell:disable
const languages: Record<string, language> = {
en: {
name: 'English',
flag: '🇺🇳'
},
de: {
name: 'Deutsch',
flag: '🇩🇪'
flag: '🇩🇪',
style: 'text-black'
},
fr: {
name: 'Français',
Expand Down Expand Up @@ -54,6 +62,7 @@
flag: '🇹🇼'
}
} as const;
// cspell:enable
const lang = writable<string>((browser && localStorage.getItem('language')) || $tolgee.getLanguage());
lang.subscribe((l) => {
Expand All @@ -73,7 +82,7 @@

<button class="variant-ghost-primary btn btn-sm grid grid-flow-col" use:popup={languageMenuBox}>
<span>{languages[$lang].name}</span>
<span class="text-xl">{languages[$lang].flag}</span>
<span class={`text-xl ${languages[$lang]?.style ?? 'text-white'}`}>{languages[$lang].flag}</span>
</button>

<div class="card w-48 py-2 shadow-xl" data-popup="languageMenuBox">
Expand All @@ -83,7 +92,7 @@
<li class:bg-primary-active-token={$lang === k}>
<button class="w-full" on:click={() => lang.set(k)}>
<span>{v.name}</span>
<span class="text-xl text-white">{v.flag}</span>
<span class="text-xl ${v?.style ?? 'text-white'}">{v.flag}</span>
</button>
</li>
{/each}
Expand Down

0 comments on commit e135b97

Please sign in to comment.