Skip to content

Commit

Permalink
feat: add footer
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed Oct 7, 2021
1 parent df2b296 commit e6e5a70
Show file tree
Hide file tree
Showing 9 changed files with 422 additions and 251 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module.exports = {
'yml/quotes': ['error', { prefer: 'single' }],
},
settings: {
// 'vue-i18n': {
// localeDir: './locales/*.json',
// },
'vue-i18n': {
localeDir: './locales/*.json',
},
},
}
64 changes: 64 additions & 0 deletions components/AppLink.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<template>
<a
v-if="to.match(/^((ftp|http(s)?):\/\/|(mailto):)/)"
class="items-center inline-flex rounded"
:class="{ 'text-link-dark dark:text-link-bright': isColored }"
:href="to"
:rel="
[...(nofollow ? ['nofollow'] : []), 'noopener', 'noreferrer'].join(' ')
"
target="_blank"
@click="$emit('click')"
>
<FontAwesomeIcon
v-if="iconId"
:class="{ 'mr-2': $slots.default }"
:icon="iconId"
/>
<slot />
</a>
<nuxt-link
v-else
:append="append"
class="rounded"
:class="{ 'text-link-dark dark:text-link-bright': isColored }"
:to="to"
@click.native="$emit('click')"
>
<FontAwesomeIcon
v-if="iconId"
:class="{ 'mr-2': $slots.default }"
:icon="iconId"
/>
<slot />
</nuxt-link>
</template>

<script lang="ts">
import { defineComponent, PropType } from '@nuxtjs/composition-api'
export default defineComponent({
props: {
append: {
default: false,
type: Boolean,
},
iconId: {
default: undefined,
type: Array as PropType<string[] | undefined>,
},
isColored: {
default: true,
type: Boolean,
},
nofollow: {
default: false,
type: Boolean,
},
to: {
required: true,
type: String,
},
},
})
</script>
61 changes: 61 additions & 0 deletions components/loader/LoaderImage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<template>
<img
v-if="srcWhenLoaded"
:alt="alt"
:class="{ 'rounded-full': rounded }"
:src="srcWhenLoaded"
/>
<div v-else>
<!-- Wrapping div is required as target for class names defined on the linking element. -->
<LoaderIndicatorPing />
</div>
</template>

<script lang="ts">
import { defineComponent, PropType } from '@nuxtjs/composition-api'
export default defineComponent({
props: {
alt: {
required: true,
type: String,
},
rounded: {
default: undefined,
type: Boolean as PropType<boolean | undefined>,
},
src: {
required: true,
type: String,
},
},
data() {
return {
srcWhenLoaded: undefined as string | undefined,
}
},
async fetch() {
await this.updateSource()
},
watch: {
async src() {
await this.updateSource()
},
},
methods: {
async updateSource() {
this.srcWhenLoaded = process.server
? this.src
: await new Promise<string>((resolve) => {
const img = new Image()
img.onload = () => {
resolve(img.src)
}
img.src = this.src
})
},
},
})
</script>
8 changes: 8 additions & 0 deletions components/loader/indicator/LoaderIndicatorPing.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template>
<div class="flex h-full items-center justify-center">
<div
class="animate-ping bg-gray-500 h-1/2 rounded-full w-1/2"
:title="$t('globalLoading')"
/>
</div>
</template>
7 changes: 1 addition & 6 deletions layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<template>
<div>
<main>
<nuxt />
</main>
<!-- <Footer /> -->
</div>
<nuxt />
</template>

<script lang="ts">
Expand Down
12 changes: 8 additions & 4 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,14 @@ export default {
},
locales: LOCALES,
vueI18n: {
// messages: {
// de: localeDe,
// en: localeEn,
// },
messages: {
de: {
globalLoading: 'Lade...',
},
en: {
globalLoading: 'Loading...',
},
},
silentFallbackWarn: true,
},
vueI18nLoader: true,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@nuxtjs/robots": "2.5.0",
"@nuxtjs/sitemap": "2.4.0",
"@tailwindcss/typography": "0.4.1",
"consola": "2.15.3",
"core-js": "3.18.2",
"nuxt": "2.15.8",
"nuxt-healthcheck": "1.0.1",
Expand Down

0 comments on commit e6e5a70

Please sign in to comment.