From 39d2fcc94ccd73db489590e1c327a6b34e0e73a3 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 6 May 2021 20:20:37 +0000 Subject: feat(global): :star: --- src/App.vue | 13 +++++++++++++ src/main.ts | 9 +++++++++ src/mixins.ts | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/router/index.ts | 27 +++++++++++++++++++++++++++ src/shims-vue.d.ts | 6 ++++++ src/styles/main.scss | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ src/views/Home.vue | 33 +++++++++++++++++++++++++++++++++ src/views/Language.vue | 26 ++++++++++++++++++++++++++ src/views/Languages.vue | 24 ++++++++++++++++++++++++ 9 files changed, 234 insertions(+) create mode 100644 src/App.vue create mode 100644 src/main.ts create mode 100644 src/mixins.ts create mode 100644 src/router/index.ts create mode 100644 src/shims-vue.d.ts create mode 100644 src/styles/main.scss create mode 100644 src/views/Home.vue create mode 100644 src/views/Language.vue create mode 100644 src/views/Languages.vue (limited to 'src') diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..7d3a0b8 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,13 @@ + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..e001a8f --- /dev/null +++ b/src/main.ts @@ -0,0 +1,9 @@ +import { createApp } from 'vue'; +import App from './App.vue'; +import router from './router'; + +import 'normalize.css/normalize.css'; +import 'sakura.css/scss/sakura-dark.scss'; +import './styles/main.scss'; + +createApp(App).use(router).mount('#app'); diff --git a/src/mixins.ts b/src/mixins.ts new file mode 100644 index 0000000..bea2fca --- /dev/null +++ b/src/mixins.ts @@ -0,0 +1,47 @@ +import { Options, Vue } from 'vue-class-component'; + +@Options({}) +export default class APIExtendableLanguage extends Vue { + isLoading = true; + + images: any; + + language = ''; + + languages: any; + + random: any; + + async fetchImages(): Promise { + fetch(`http://localhost/api/v1/language?lang=${this.language}`, { + method: 'GET', + }) + .then((response) => response.json()) + .then((response) => { + this.images = response; + this.isLoading = false; + }); + } + + async fetchLanguages(): Promise { + fetch('http://localhost/api/v1/languages', { + method: 'GET', + }) + .then((response) => response.json()) + .then((response) => { + this.languages = response; + this.isLoading = false; + }); + } + + async fetchRandom(): Promise { + fetch('http://localhost/api/v1/random', { + method: 'GET', + }) + .then((response) => response.json()) + .then((response) => { + this.random = response; + this.isLoading = false; + }); + } +} diff --git a/src/router/index.ts b/src/router/index.ts new file mode 100644 index 0000000..c0fabee --- /dev/null +++ b/src/router/index.ts @@ -0,0 +1,27 @@ +import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'; +import Home from '../views/Home.vue'; + +const routes: Array = [ + { + path: '/', + name: 'Home', + component: Home, + }, + { + path: '/language/:lang', + name: 'Language', + component: () => import('../views/Language.vue'), + }, + { + path: '/languages', + name: 'languages', + component: () => import('../views/Languages.vue'), + }, +]; + +const router = createRouter({ + history: createWebHistory(process.env.BASE_URL), + routes, +}); + +export default router; diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts new file mode 100644 index 0000000..3804a43 --- /dev/null +++ b/src/shims-vue.d.ts @@ -0,0 +1,6 @@ +/* eslint-disable */ +declare module '*.vue' { + import type { DefineComponent } from 'vue' + const component: DefineComponent<{}, {}, any> + export default component +} diff --git a/src/styles/main.scss b/src/styles/main.scss new file mode 100644 index 0000000..42fdfb6 --- /dev/null +++ b/src/styles/main.scss @@ -0,0 +1,49 @@ +html { + scroll-behavior: smooth; + overflow: scroll; + overflow-x: hidden; +} +body { + max-width: 58em; +} + +img { + border-radius: 5px; +} + +#random-image { + img { + height: 20em; + } + a:hover { + border-bottom: none; + } +} + +::-webkit-scrollbar { + width: 0px; + background: transparent; +} + +.image-rack { + text-align: center; + list-style-type: none; +} + +#image-rack-item { + display: inline; + padding: 10px; + + a:hover { + border-bottom: none; + } + + img { + width: 20%; + transition: 0.25s;; + } + img:hover { + opacity: 0.75; + width: 25%; + } +} diff --git a/src/views/Home.vue b/src/views/Home.vue new file mode 100644 index 0000000..d70e565 --- /dev/null +++ b/src/views/Home.vue @@ -0,0 +1,33 @@ + + + diff --git a/src/views/Language.vue b/src/views/Language.vue new file mode 100644 index 0000000..ca5bbfb --- /dev/null +++ b/src/views/Language.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/views/Languages.vue b/src/views/Languages.vue new file mode 100644 index 0000000..41074ca --- /dev/null +++ b/src/views/Languages.vue @@ -0,0 +1,24 @@ + + + -- cgit v1.2.3