Skip to content

Commit f847fae

Browse files
committed
Testing VPCardLink.vue
1 parent 2793926 commit f847fae

File tree

7 files changed

+125
-4
lines changed

7 files changed

+125
-4
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<script setup>
2+
const props = defineProps({
3+
title: { type: String, required: true },
4+
href: { type: String, required: true },
5+
text: { type: String, default: '' },
6+
src: { type: String, default: '' },
7+
})
8+
9+
const isExternal = /^https?:\/\//.test(props.href)
10+
</script>
11+
12+
<template>
13+
<a
14+
class="link-card no-icon"
15+
:href="props.href"
16+
:target="isExternal ? '_blank' : null"
17+
:rel="isExternal ? 'noopener noreferrer' : null"
18+
>
19+
<div class="link-card-content">
20+
<img class="link-card-logo" v-if="props.src" :src="props.src" :alt="props.title" />
21+
<div class="link-card-text">
22+
<div class="link-card-title">{{ title }}</div>
23+
<div class="link-card-desc">{{ text || href }}</div>
24+
</div>
25+
</div>
26+
</a>
27+
</template>
28+
29+
<style scoped>
30+
.link-card {
31+
display: block;
32+
background-color: var(--vp-c-bg-soft);
33+
border-radius: 12px;
34+
padding: 1em;
35+
margin-top: 20px;
36+
margin-bottom: 1em;
37+
text-decoration: none;
38+
border: 2px solid transparent;
39+
transition: border-color 0.25s ease;
40+
color: inherit;
41+
}
42+
43+
.link-card:hover {
44+
border-color: var(--vp-c-brand-1);
45+
}
46+
47+
.link-card-content {
48+
display: flex;
49+
align-items: center;
50+
gap: 1em;
51+
}
52+
53+
.link-card-logo {
54+
color: var(--vp-c-text-1);
55+
width: 3em;
56+
height: 3em;
57+
flex-shrink: 0;
58+
border-radius: 10px;
59+
}
60+
61+
.link-card-text {
62+
flex: 1;
63+
min-width: 0;
64+
}
65+
66+
.link-card-title {
67+
color: var(--vp-c-text-1);
68+
font-weight: bold;
69+
font-size: 1em;
70+
white-space: nowrap;
71+
overflow: hidden;
72+
text-overflow: ellipsis;
73+
}
74+
75+
.link-card-desc {
76+
color: var(--vp-c-text-2);
77+
font-size: 0.9em;
78+
white-space: nowrap;
79+
overflow: hidden;
80+
text-overflow: ellipsis;
81+
}
82+
83+
@media (max-width: 639px) {
84+
.link-card-title {
85+
font-size: 0.95em;
86+
}
87+
88+
.link-card-desc {
89+
font-size: 0.85em;
90+
max-width: 90%;
91+
}
92+
93+
.link-card {
94+
padding: 0.75em;
95+
}
96+
97+
.link-card-logo {
98+
width: 2.5em;
99+
height: 2.5em;
100+
}
101+
}
102+
</style>

.vitepress/theme/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import DefaultTheme from 'vitepress/theme'
22
import './custom.css'
33

4+
import VPCardLink from './components/VPCardLink.vue'
5+
46
import VPSwiper from '@cssnr/vitepress-swiper'
57
import '@cssnr/vitepress-swiper/style.css'
68

@@ -9,6 +11,7 @@ export default {
911
...DefaultTheme,
1012

1113
enhanceApp({ app }) {
14+
app.component('VPCardLink', VPCardLink)
1215
app.component('VPSwiper', VPSwiper)
1316
},
1417
}

docs/clients/android.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ A Native Android Application is Available.
44

55
[[toc]]
66

7-
More details on GitHub: https://github.com/django-files/android-client
7+
<VPCardLink
8+
title="Visit GitHub for More Info"
9+
href="https://github.com/django-files/android-client"
10+
src="/images/logos/github.png"
11+
/>
812

913
## Install
1014

docs/clients/browser.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ A Web Extension is available for all major browsers including Firefox Android.
44

55
[[toc]]
66

7-
More details on GitHub: https://github.com/django-files/web-extension
7+
<VPCardLink
8+
title="Visit GitHub for More Info"
9+
href="https://github.com/django-files/web-extension"
10+
src="/images/logos/github.png"
11+
/>
812

913
## Install
1014

docs/clients/cli.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ A CLI is available for Python 3 from [PyPi](https://pypi.org/project/zipline-cli
44

55
[[toc]]
66

7-
More details on GitHub: https://github.com/cssnr/zipline-cli
7+
<VPCardLink
8+
title="Visit GitHub for More Info"
9+
href="https://github.com/django-files/cssnr/zipline-cli"
10+
src="/images/logos/github.png"
11+
/>
812

913
## Install
1014

docs/clients/ios.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ A Native iOS Application is Available.
44

55
[[toc]]
66

7-
More details on GitHub: https://github.com/django-files/ios-client
7+
<VPCardLink
8+
title="Visit GitHub for More Info"
9+
href="https://github.com/django-files/ios-client"
10+
src="/images/logos/github.png"
11+
/>
812

913
## Install
1014

1.18 KB
Loading

0 commit comments

Comments
 (0)