Skip to content

Commit 2d843c6

Browse files
dev(printing): add cards with works
1 parent 10d553b commit 2d843c6

File tree

2 files changed

+122
-2
lines changed

2 files changed

+122
-2
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<template lang="pug">
2+
v-card.printing-card.fill-height.d-flex.flex-column(v-box-shadow='6')
3+
v-lazy
4+
v-img.rounded-t(
5+
:src='`/src/nuxt-app/printing/${item.slug}/${item.cover}`',
6+
:alt='titleLocale(item).title',
7+
contain
8+
)
9+
10+
.grow
11+
v-card-title {{ titleLocale(item).title }}
12+
v-card-subtitle {{ formatDate(item.date) }}
13+
v-card-text(v-if='titleLocale(item).desc') {{ titleLocale(item).desc }}
14+
15+
// ANCHOR process
16+
v-expansion-panels(flat, tile, accordion)
17+
v-expansion-panel.transparent(v-if='imgContent.length')
18+
v-expansion-panel-header.px-4
19+
v-card-subtitle.pa-0.caption {{ $tc('process', 1) + ' + ' + $tc('result', 1).toLowerCase() }}
20+
v-icon(right, small) {{ mdiSwapHorizontal }}
21+
v-expansion-panel-content.px-0
22+
v-slide-group.px-4(:show-arrows='!$vuetify.breakpoint.xs')
23+
v-slide-item(v-for='(p, i) in imgContent', :key='i')
24+
v-dialog(max-width='80vw', content-class='overflow-hidden')
25+
template(#activator='{ on: openImg }')
26+
v-sheet.d-flex.flex-column.mx-2.text-center.pa-2.cursor-pointer(
27+
outlined,
28+
rounded
29+
)
30+
v-img.mb-1.grow(
31+
:src='p.src',
32+
contain,
33+
max-width='200',
34+
v-on='openImg'
35+
)
36+
i.text-caption {{ p.caption }}
37+
v-sheet
38+
v-lazy
39+
v-img(:src='p.src', contain)
40+
</template>
41+
42+
<script>
43+
import { mdiSwapHorizontal } from '@mdi/js'
44+
45+
export default {
46+
name: 'PrintingCard',
47+
props: {
48+
item: {
49+
type: Object,
50+
default: () => ({}),
51+
},
52+
},
53+
data: () => ({
54+
mdiSwapHorizontal,
55+
}),
56+
computed: {
57+
imgContent() {
58+
const path = '/src/nuxt-app/printing'
59+
const p = this.item.folders.process || []
60+
const r = this.item.folders.result || []
61+
62+
const process = () => {
63+
return p?.map((e) => {
64+
return {
65+
src: `${path}/${this.item.slug}/process/${e}`,
66+
caption: e.split('.')[0],
67+
}
68+
})
69+
}
70+
71+
const result = () => {
72+
return r?.map((e) => {
73+
return {
74+
src: `${path}/${this.item.slug}/result/${e}`,
75+
caption: e.split('.')[0],
76+
}
77+
})
78+
}
79+
80+
return process().concat(result()) || []
81+
},
82+
},
83+
methods: {
84+
titleLocale(item) {
85+
if (this.$i18n.locale === 'ru') {
86+
return {
87+
title: item.titleRu,
88+
desc: item.descRu,
89+
}
90+
} else if (this.$i18n.locale === 'en') {
91+
return {
92+
title: item.titleEn,
93+
desc: item.descEn,
94+
}
95+
}
96+
},
97+
formatDate(date) {
98+
const options = { year: 'numeric', month: 'long', day: 'numeric' }
99+
return new Date(date).toLocaleDateString(`${this.$i18n.locale}`, options)
100+
},
101+
},
102+
}
103+
</script>
104+
105+
<style lang="sass">
106+
.printing-card
107+
.v-slide-group
108+
&__next,
109+
&__prev
110+
min-width: 1.5rem
111+
112+
&:hover
113+
background-color: rgb(0 0 0 / 12%)
114+
115+
.v-expansion-panel-content
116+
&.px-0
117+
.v-expansion-panel-content
118+
&__wrap
119+
padding-inline: 0
120+
</style>

pages/works/printing/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
cols='12',
3838
md='6'
3939
)
40-
//- lazy-s-pages-printing-card(:item='item')
40+
lazy-s-pages-printing-card(:item='item')
4141
lazy-s-works-not-found(v-else, :message='$t("works.works-not-found")')
4242
</template>
4343

@@ -79,7 +79,7 @@ export default {
7979
},
8080
computed: {
8181
localeItems() {
82-
return this.printLocale ?? []
82+
return this.printLocale.filter((e) => !e.hide) ?? []
8383
},
8484
},
8585
}

0 commit comments

Comments
 (0)