Skip to content

Commit

Permalink
chore(ui): remove flag images (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
mercs600 committed Oct 15, 2021
1 parent 5606b8b commit 53eff0e
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 61 deletions.
1 change: 0 additions & 1 deletion packages/nuxt-typo3-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"body-scroll-lock": "^3.1.5",
"nuxt-typo3-ce": "^0.0.2",
"sanitize.css": "^12.0.1",
"svg-country-flags": "^1.2.10",
"vue-mq": "^1.0.1",
"vue-svgicon": "^3.2.9"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,9 @@
v-on="$listeners"
>
<template #label="{label}">
<img
v-if="getFlagImage(label.twoLetterIsoCode)"
class="flag"
width="28"
:alt="label.navigationTitle"
:src="getFlagImage(label.twoLetterIsoCode)"
/>
<span v-else class="flag flag--label">
<span class="flag flag--label">
{{ label.twoLetterIsoCode }}
</span>
<span class="label">
{{ label.title }}
</span>
</template>
</UiNavigationList>
</template>
Expand All @@ -41,12 +31,6 @@ export default defineComponent({
links: {
type: Array as PropType<UiNavigationLanguageLinks>,
required: true
},
preset: {
type: Object as PropType<Record<string, string>>,
default: () => ({
en: require(`svg-country-flags/svg/gb.svg`)
})
}
},
computed: {
Expand All @@ -67,20 +51,6 @@ export default defineComponent({
return [current] || this.links
}
},
methods: {
getFlagImage (twoLetterIsoCode: string): string | undefined {
try {
if (
Object.prototype.hasOwnProperty.call(this.preset, twoLetterIsoCode)
) {
return this.preset[twoLetterIsoCode]
}
return require(`assets/flags/${twoLetterIsoCode}.svg`)
} catch {
return undefined
}
}
}
})
</script>
Expand All @@ -102,20 +72,12 @@ export default defineComponent({
}
.flag {
height: var(--space-4);
text-transform: uppercase;
margin-right: var(--space-3);
@include media-query($ui-navbar-break-on) {
margin-right: 0;
}
&--label {
display: none;
@include media-query($ui-navbar-break-on) {
display: initial;
}
}
}
.ui-navigation-list {
Expand Down
14 changes: 1 addition & 13 deletions packages/nuxt-typo3-theme/src/nuxt/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const defaults: TYPO3ThemeOptions = {
css: true,
googleFonts: true,
layouts: true,
overrideLocalComponents: false,
flags: true
overrideLocalComponents: false
}

const NuxtTypo3Theme: Module = async function (options: TYPO3ThemeOptions) {
Expand All @@ -27,17 +26,6 @@ const NuxtTypo3Theme: Module = async function (options: TYPO3ThemeOptions) {
this.nuxt.options.css.push('nuxt-typo3-theme/src/styles/core.scss')
}

if (this.nuxt?.options?.typo3?.i18n?.locales) {
this.nuxt.options.typo3.i18n.locales.forEach((locale: string) => {
try {
fs.copy(
require.resolve(`svg-country-flags/svg/${locale}.svg`),
`assets/flags/${locale}.svg`
)
} catch (err: unknown) {}
})
}

if (options.googleFonts && !modulesList.includes('@nuxtjs/google-fonts')) {
this.addModule([
'@nuxtjs/google-fonts',
Expand Down
2 changes: 0 additions & 2 deletions packages/nuxt-typo3-theme/src/nuxt/module.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ interface TYPO3ThemeOptions {
layouts?: boolean | string[]
/** use global components to override locals in specific scope */
overrideLocalComponents?: boolean | string[]
/** copy flags from svg-country-flags */
flags?: boolean
}

export { TYPO3ThemeOptions }
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22485,11 +22485,6 @@ supports-color@^7.0.0, supports-color@^7.1.0:
dependencies:
has-flag "^4.0.0"

svg-country-flags@^1.2.10:
version "1.2.10"
resolved "https://registry.yarnpkg.com/svg-country-flags/-/svg-country-flags-1.2.10.tgz#b1b94e9f08f065d7b3d0ff9ab359898edd4dd3b0"
integrity sha512-xrqwo0TYf/h2cfPvGpjdSuSguUbri4vNNizBnwzoZnX0xGo3O5nGJMlbYEp7NOYcnPGBm6LE2axqDWSB847bLw==

svg-tags@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764"
Expand Down

0 comments on commit 53eff0e

Please sign in to comment.