sepia-search-motore-di-rice.../client/src/components/Header.vue

143 lines
3.0 KiB
Vue
Raw Normal View History

2020-08-27 14:44:21 +02:00
<template>
<div>
<header>
2020-09-02 10:17:50 +02:00
<interface-language-dropdown class="interface-language-dropdown"></interface-language-dropdown>
2020-09-18 16:29:32 +02:00
<h1>
<span v-if="configLoaded && !titleImageUrl">{{indexName}}</span>
<img class="title-image" v-if="configLoaded && titleImageUrl" v-bind:src="titleImageUrl" v-bind:alt="indexName" />
</h1>
<template v-if="!smallFormat">
<h4>
<div v-translate>A search engine of <a href="https://joinpeertube.org" target="_blank">PeerTube</a> videos and channels</div>
2020-08-27 14:44:21 +02:00
<div v-translate>Developed by <a href="https://framasoft.org" target="_blank">Framasoft</a></div>
</h4>
2020-09-18 16:47:17 +02:00
<img class="search-home" v-bind:src="searchImageUrl" alt="">
</template>
2020-08-27 14:44:21 +02:00
</header>
</div>
</template>
<style lang="scss">
@import '../scss/_variables';
header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-bottom: 30px;
font-family: monospace;
2020-09-02 10:17:50 +02:00
.interface-language-dropdown {
width: 20px;
position: absolute;
right: 10px;
top: 10px;
}
.search-home {
2020-08-27 14:44:21 +02:00
width: 300px;
2020-09-16 10:54:52 +02:00
height: 250px;
2020-08-27 14:44:21 +02:00
margin: 30px 0 0 0;
}
h1 {
font-size: 50px;
2020-09-16 10:54:52 +02:00
// Because it's loaded dynamically
min-height: 70px;
2020-08-27 14:44:21 +02:00
margin: 0;
text-align: center;
}
2020-09-18 16:29:32 +02:00
.title-image {
max-width: 500px;
}
2020-08-27 14:44:21 +02:00
h4 {
font-weight: normal;
margin: 0;
text-align: center;
2020-09-18 15:06:14 +02:00
line-height: 25px;
2020-08-27 14:44:21 +02:00
a {
color: #000;
font-weight: $font-semibold;
}
}
@media screen and (max-width: $small-screen) {
h1 {
font-size: 30px;
2020-09-21 09:59:25 +02:00
margin-top: 20px;
2020-08-27 14:44:21 +02:00
margin-bottom: 10px;
2020-09-21 09:59:25 +02:00
min-height: unset;
}
h4 {
font-size: 15px !important;
line-height: initial;
div:first-child {
margin-bottom: 5px;
}
2020-08-27 14:44:21 +02:00
}
img {
width: 100%;
max-width: 300px;
}
}
}
2020-09-21 13:57:05 +02:00
@media screen and (max-height: 400px) {
.search-home {
display: none;
}
}
2020-08-27 14:44:21 +02:00
</style>
<script lang="ts">
import Vue from 'vue'
2020-09-18 16:29:32 +02:00
import { getConfig } from '../shared/config'
import { buildApiUrl } from '../shared/utils'
2020-09-02 10:17:50 +02:00
import InterfaceLanguageDropdown from './InterfaceLanguageDropdown.vue'
2020-08-27 14:44:21 +02:00
export default Vue.extend({
2020-09-02 10:17:50 +02:00
components: {
'interface-language-dropdown': InterfaceLanguageDropdown
},
2020-09-18 16:29:32 +02:00
data () {
return {
configLoaded: false,
titleImageUrl: '',
searchImageUrl: ''
}
},
2020-08-27 14:44:21 +02:00
props: {
indexName: String,
smallFormat: Boolean,
2020-09-18 16:29:32 +02:00
},
async mounted () {
const config = await getConfig()
this.titleImageUrl = config.searchInstanceNameImage
? buildApiUrl(config.searchInstanceNameImage)
: ''
this.searchImageUrl = config.searchInstanceSearchImage
? buildApiUrl(config.searchInstanceSearchImage)
: buildApiUrl('/img/search-home.png')
this.configLoaded = true
2020-08-27 14:44:21 +02:00
}
})
</script>