-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
Copy pathThemeListItem.vue
140 lines (119 loc) Β· 2.51 KB
/
ThemeListItem.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<script setup lang="ts">
import { computed } from 'vue'
import { VTLink } from '@vue/theme'
import ThemeProduct from './ThemeProduct.vue'
const props = defineProps<{
provider: Record<string, any>
}>()
const description = computed(() => {
// replace markdown link to html tag.
// [name](https://...) -> <a href="https://...">name</a>
return props.provider.description.replace(
/\[([^\]]+)\]\(([^\)]+)\)/g,
'<a href="$2" class="link" target="_blank" rel="noopener">$1</a>'
)
})
</script>
<template>
<section class="ThemeListItem">
<h2 class="title">{{ provider.name }}</h2>
<p class="description" v-html="description" />
<div class="container">
<div class="products">
<div v-for="product in provider.products" :key="product.name" class="product">
<ThemeProduct :product="product" />
</div>
</div>
</div>
<div class="action">
<VTLink class="action-link" :href="provider.seeMoreUrl" no-icon>
See More Themes from {{ provider.name }}
</VTLink>
</div>
</section>
</template>
<style scoped>
.ThemeListItem {
border-top: 1px solid var(--vt-c-divider-light);
padding-top: 16px;
}
@media (min-width: 768px) {
.ThemeListItem {
padding-top: 24px;
}
}
.title {
font-size: 20px;
font-weight: 500;
transition: color 0.25s;
}
.description {
padding-top: 8px;
font-size: 14px;
font-weight: 500;
max-width: 512px;
color: var(--vt-c-text-2);
transition: color 0.25s;
}
.description :deep(.link) {
color: var(--vt-c-brand);
transition: color 0.25s;
}
.description :deep(.link:hover) {
color: var(--vt-c-brand-dark);
}
.container {
margin: 0 auto;
padding-top: 32px;
max-width: 304px;
}
@media (min-width: 640px) {
.container {
max-width: 632px;
}
}
@media (min-width: 960px) {
.container {
max-width: 960px;
}
}
.products {
display: flex;
flex-wrap: wrap;
margin: -16px -12px;
}
.product {
flex-shrink: 0;
padding: 16px 12px;
width: 100%;
}
@media (min-width: 640px) {
.product {
width: 50%;
}
}
@media (min-width: 960px) {
.product {
width: calc(100% / 3);
}
}
.action {
padding-top: 40px;
text-align: center;
}
.action-link {
display: inline-block;
border: 1px solid var(--vt-c-brand);
border-radius: 24px;
padding: 0 24px;
line-height: 48px;
font-size: 14px;
font-weight: 500;
color: var(--vt-c-brand);
transition: border-color 0.25s, color 0.25s;
}
.action-link:hover {
border-color: var(--vt-c-brand-dark);
color: var(--vt-c-brand-dark);
}
</style>