Skip to content

Commit 75a6fd0

Browse files
Moved home page to "home", splited stores.
1 parent 41f0ab5 commit 75a6fd0

File tree

25 files changed

+303
-22
lines changed

25 files changed

+303
-22
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
2+
import { namespace } from 'vuex-class';
3+
import FeedCard from '@/components/activity/feed_card/FeedCard.vue';
4+
import { IArticle } from '@/data/articles';
5+
6+
// Utilities
7+
@Component({ components: { FeedCard } })
8+
export default class Feed extends Vue {
9+
private layout: number[] = [2, 2, 2, 2, 2, 2, 2];
10+
private page: number = 1;
11+
12+
@namespace('activity').State('articles') articles!: IArticle[];
13+
14+
get pages() {
15+
return Math.ceil(this.articles.length / 11);
16+
}
17+
18+
get paginatedArticles() {
19+
const start = (this.page - 1) * 4;
20+
const stop = this.page * 4;
21+
22+
return this.articles.slice(start, stop);
23+
}
24+
25+
@Watch('page') onPageChanged(value: number, oldValue: number) {
26+
window.scrollTo(0, 0);
27+
}
28+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<template>
2+
<v-container class="grid-list-xl">
3+
<v-row class="wrap"
4+
dense>
5+
<v-col sm="6">
6+
<v-row dense>
7+
<feed-card :key="paginatedArticles[0].title"
8+
:size="1"
9+
:height="'100%'"
10+
:value="paginatedArticles[0]">
11+
</feed-card>
12+
</v-row>
13+
</v-col>
14+
<v-col sm="6">
15+
<v-row dense>
16+
<feed-card v-for="(article, i) in paginatedArticles"
17+
:key="article.title"
18+
:height="'100%'"
19+
:size="layout[i]"
20+
:value="article">
21+
22+
</feed-card>
23+
</v-row>
24+
</v-col>
25+
</v-row>
26+
</v-container>
27+
</template>
28+
29+
<script type="ts"
30+
src="./Feed.ts" />
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.v-image__image {
2+
transition: .3s linear;
3+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
2+
3+
// Utilities
4+
@Component({})
5+
export default class FeedCard extends Vue {
6+
@Prop({ required: true }) size!: number;
7+
@Prop({ default: () => ({}) }) value!: Object;
8+
@Prop() maxHeight!: number | string;
9+
@Prop() height!: number | string;
10+
get colMd() {
11+
switch (this.size) {
12+
case 1: {
13+
return 12;
14+
}
15+
case 2: {
16+
return 6;
17+
}
18+
case 3: {
19+
return 4;
20+
}
21+
case 4: {
22+
return 3;
23+
}
24+
}
25+
}
26+
27+
public get cardHeight() {
28+
return this.height === undefined ? undefined : this.height;
29+
}
30+
31+
public get cardMaxHeight() {
32+
return this.maxHeight === undefined ? undefined : this.maxHeight;
33+
}
34+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<template>
2+
<v-col sm="12"
3+
:md="colMd">
4+
<base-card class="d-flex mx-auto"
5+
:height="height"
6+
:max-height="maxHeight"
7+
href="#!">
8+
<v-img :src="require(`@/assets/articles/${value.hero}`)"
9+
class="lighten-2"
10+
aspect-ratio="1.3333"
11+
gradient="rgba(0, 0, 0, .42), rgba(0, 0, 0, .42)">
12+
</v-img>
13+
</base-card>
14+
</v-col>
15+
</template>
16+
17+
<script lang="ts"
18+
src="./FeedCard.ts" />
19+
20+
<style lang="scss"
21+
src="./FeedCard.scss"
22+
scoped />
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { Vue, Component } from 'vue-property-decorator';
2+
3+
@Component({})
4+
export default class Sponsor extends Vue {
5+
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<v-col>
3+
4+
111111111111
5+
</v-col>
6+
</template>
7+
8+
<script lang="ts"
9+
src="./Sponsor.ts" />
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.v-image__image {
2+
transition: .3s linear;
3+
}

src/components/home/feed_card/FeedCard.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ export default class FeedCard extends Vue {
77
@Prop({ default: () => ({}) }) value!: Object;
88

99
get colMd() {
10-
return this.analyzeColMd();
11-
}
12-
13-
private analyzeColMd() {
14-
if (this.size === 2) {
15-
return 6;
16-
}
17-
if (this.size === 3) {
18-
return 4;
10+
switch (this.size) {
11+
case 1: {
12+
return 12;
13+
}
14+
case 2: {
15+
return 6;
16+
}
17+
case 3: {
18+
return 4;
19+
}
1920
}
2021
}
22+
2123
};

src/components/home/feed_card/FeedCard.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,8 @@
4141
</v-col>
4242
</template>
4343

44-
<style scoped>
45-
.v-image__image {
46-
transition: .3s linear;
47-
}
48-
</style>
49-
5044
<script lang="ts"
5145
src="./FeedCard.ts" />
46+
47+
<style lang="scss"
48+
src="./FeedCard.scss" />

0 commit comments

Comments
 (0)