KawAnime/pages/news.vue

158 lines
3.1 KiB
Vue
Raw Normal View History

2017-04-15 14:16:14 +00:00
<template>
2017-05-13 14:38:17 +00:00
<v-container fluid>
<loader v-if="!$store.state.news.length"></loader>
<v-container fluid v-else>
<v-row class="news-container">
<v-col xs12 class="refresh-button-container">
<v-btn icon
class="refresh-button"
@click.native="refresh()">
<v-icon large>refresh</v-icon>
</v-btn>
</v-col>
<v-col xs12
class="elem elevation-3"
v-ripple="true"
v-for="item in $store.state.news" :key="item.name">
<v-row>
<v-col xs12>
<h3 class="title">{{ item.title }}</h3>
</v-col>
<v-col md2 xs3 class="image">
<img :src="item.image" height="220" max-width="20%"/>
</v-col>
<v-col md10 xs9>
<v-row>
<v-col xs12><p class="synopsis">{{ item.text }}</p></v-col>
</v-row>
<v-row xs12 class="link">
<div class="button-container">
<v-btn secondary block @click.native="open(item.link)">Open</v-btn>
</div>
</v-row>
</v-col>
</v-row>
</v-col>
</v-row>
</v-container>
</v-container>
2017-04-15 14:16:14 +00:00
</template>
<script>
2017-05-13 14:38:17 +00:00
import Loader from '~components/loader.vue'
2017-04-15 14:16:14 +00:00
export default {
head () {
return {
title: 'News',
meta: [
{ hid: 'description', name: 'description', content: 'Anime world news' }
]
}
},
2017-05-13 14:38:17 +00:00
data () {
2017-04-15 14:16:14 +00:00
return {}
},
2017-05-13 14:38:17 +00:00
components: {
2017-04-15 14:16:14 +00:00
Loader
2017-05-13 14:38:17 +00:00
},
2017-04-15 14:16:14 +00:00
methods: {
2017-05-13 14:38:17 +00:00
open (link) {
this.$store.dispatch('openNewsLink', link)
2017-04-15 14:16:14 +00:00
},
2017-05-13 14:38:17 +00:00
refresh () {
2017-04-15 14:16:14 +00:00
console.log('Ok')
this.$store.dispatch('refreshNews')
}
}
}
</script>
<style scoped>
2017-05-13 14:38:17 +00:00
/* ----- Refresh button ----- */
.refresh-button-container
{
display: inline-block;
text-align: right;
margin-top: 5px;
margin-bottom: 2px;
padding-right: 3%;
}
.refresh-button
{
display: inline-block;
}
/* Needed */
/*noinspection CssUnusedSymbol*/
.icon--large
{
height: 2.5rem;
}
/* ---------- ELEM ---------- */
.news-container
{
padding: 0 2% 1% 2%;
}
.elem
{
position: relative;
margin-bottom: 15px;
padding: 0;
background-color: rgb(60, 60, 60);
color: rgba(255, 255, 255, 0.8);
}
.elem:hover
{
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12) !important;
}
.news-container h3
{
color: rgba(255, 255, 255, 0.8);
}
.title
{
line-height: 24px;
2017-05-13 14:38:17 +00:00
margin-top: 10px;
padding-left: 2%;
padding-right: 2%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.image
{
height: 220px;
}
.synopsis
{
padding-top: 2%;
height: 150px;
}
.link
{
height: 50%;
width: 100%;
text-align: right;
display: inline-block;
padding: 0 5% 0 10%;
}
.button-container
{
display: inline-block;
width: 15%;
}
</style>