Skip to content

Commit

Permalink
refactor: extract footer as a component
Browse files Browse the repository at this point in the history
  • Loading branch information
cxzlw committed Dec 1, 2024
1 parent 52752a1 commit 43c0c10
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 50 deletions.
1 change: 1 addition & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
FooterBar: typeof import('./src/components/FooterBar.vue')['default']
IMdiTranslate: typeof import('~icons/mdi/translate')['default']
LanguageSwitch: typeof import('./src/components/LanguageSwitch.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
Expand Down
4 changes: 4 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<main>
<RouterView />
</main>

<footer>
<FooterBar />
</footer>
</template>
<script setup lang="ts">
import { useLocalStorage, useTitle } from "@vueuse/core";
Expand Down
50 changes: 50 additions & 0 deletions src/components/FooterBar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<script setup lang="ts">
import { useI18n } from "vue-i18n";
let { t } = useI18n();
</script>
<template>
<var-divider>
<var-icon name="heart-outline" style="margin: 0 16px; color: pink" />
</var-divider>
<div class="footer flex items-center justify-center">
<span
>{{ new Date().getFullYear() }} MtF.im is made with
<var-icon name="heart" color="pink"
/></span>
</div>
<div class="footer flex items-center justify-center">
<span
><a href="/user-agreement">{{
t("footer.user-agreement")
}}</a></span
>
<var-divider vertical />
<span
><a href="/privacy-policy">{{
t("footer.privacy-policy")
}}</a></span
>
<var-divider vertical />
<span
><a href="//mtf.im/about-us">{{ t("footer.about-us") }}</a></span
>
</div>
</template>
<style scoped>
.footer {
color: #333;
}
.footer a {
font-size: 14px;
color: #888;
text-decoration: none;
}
.footer span {
font-size: 14px;
color: #888;
text-decoration: none;
}
</style>
2 changes: 1 addition & 1 deletion src/components/LanguageSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</var-menu-select>
</div>
</template>
<script setup>
<script setup lang="ts">
import i18n from "../i18n/i18n.ts";
let locale = i18n.global.locale;
</script>
Expand Down
2 changes: 0 additions & 2 deletions src/views/auth/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ async function login() {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
width: 100vw;
}
.board {
Expand Down
2 changes: 0 additions & 2 deletions src/views/auth/SignUpView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ async function signup() {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
width: 100vw;
}
.board {
Expand Down
45 changes: 0 additions & 45 deletions src/views/authorize/AuthorizeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -206,32 +206,6 @@ var scope_detail = data.scope.split(" ").map(get_scope_detail);
</var-paper>
</div>
</var-space>
<var-divider>
<var-icon name="heart-outline" style="margin: 0 16px; color: pink" />
</var-divider>
<div class="footer">
<span
>{{ new Date().getFullYear() }} MtF.im is made with
<var-icon name="heart" color="pink"
/></span>
</div>
<div class="footer">
<span
><a href="/user-agreement">{{
t("footer.user-agreement")
}}</a></span
>
<var-divider vertical />
<span
><a href="/privacy-policy">{{
t("footer.privacy-policy")
}}</a></span
>
<var-divider vertical />
<span
><a href="//mtf.im/about-us">{{ t("footer.about-us") }}</a></span
>
</div>
</template>

<style scoped>
Expand Down Expand Up @@ -272,23 +246,4 @@ var scope_detail = data.scope.split(" ").map(get_scope_detail);
background-color: var(--color-danger);
color: white;
}
.footer {
display: flex;
justify-content: center;
align-items: center;
color: #333;
}
.footer a {
font-size: 14px;
color: #888;
text-decoration: none;
}
.footer span {
font-size: 14px;
color: #888;
text-decoration: none;
}
</style>

0 comments on commit 43c0c10

Please sign in to comment.