stadtratmonitor-vue/src/App.vue

71 lines
1.6 KiB
Vue
Raw Normal View History

2023-06-07 17:31:37 +02:00
<script lang="ts">
2023-06-21 18:51:54 +02:00
import MainMenu from '@/components/MainMenu.vue'
import SearchBar from '@/components/SearchBar.vue'
import FooterMenu from '@/components/FooterMenu.vue'
export type Papers = {
body: string
content: string
name: string
resolution: string
originator: string
paper_type: string
published_at: string
reference: string
url: string
}
2023-06-07 17:31:37 +02:00
export default {
components: {
MainMenu,
2023-06-17 21:16:05 +02:00
SearchBar,
2023-06-14 18:12:42 +02:00
FooterMenu,
2023-06-07 22:12:45 +02:00
},
data() {
return {
applicationName: this.applicationName,
2023-06-14 18:12:42 +02:00
cityName: this.cityName,
search: {
value: '',
type: '',
},
2023-06-21 18:51:54 +02:00
apiUri: 'https://raw.githubusercontent.com/CodeforLeipzig/stadtratmonitor/master/input.json',
papers: [] as Papers[],
2023-06-14 22:51:55 +02:00
paperFilter: {
type: '',
originator: '',
},
2023-06-07 22:12:45 +02:00
}
2023-06-21 18:51:54 +02:00
},
methods: {
async fetchData() {
this.papers = await (await fetch(this.apiUri)).json()
},
},
created() {
this.fetchData()
},
2023-06-07 17:31:37 +02:00
}
2023-06-16 15:27:45 +02:00
</script>
2023-06-07 17:31:37 +02:00
<template>
2023-06-16 15:27:12 +02:00
<header class="w-screen flex flex-col place-content-center bg-background-100 dark:bg-background-900 text-text-900 dark:text-text-100">
<div class="flex flex-row place-content-center">
2023-06-21 18:51:54 +02:00
<h1 class="p-2 text-xl">
<RouterLink to="/">{{ applicationName }} {{ cityName }}</RouterLink></h1>
2023-06-14 18:12:42 +02:00
<MainMenu />
</div>
2023-06-17 21:16:05 +02:00
<SearchBar
2023-06-14 18:12:42 +02:00
@searchSubmit="(type) => search.type = type"
@searchQuery="(query) => search.value = query"
/>
2023-06-07 17:31:37 +02:00
</header>
2023-06-14 22:51:55 +02:00
<main class="flex flex-row max-w-5xl m-auto">
2023-06-14 18:12:42 +02:00
2023-06-21 18:51:54 +02:00
</main>
<RouterView :papers="papers"></RouterView>
2023-06-14 18:12:42 +02:00
<footer>
2023-06-21 18:51:54 +02:00
<!-- <FooterMenu /> -->
2023-06-14 18:12:42 +02:00
</footer>
2023-06-07 17:31:37 +02:00
</template>