Skip to content

Commit 145ca11

Browse files
authored
[F] Fix Carousel.vue splideimg (#32)
1 parent 376b0f6 commit 145ca11

2 files changed

Lines changed: 84 additions & 37 deletions

File tree

content/Carousel.vue

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,9 @@ import '@splidejs/vue-splide/css/skyblue';
33
import { defineClientComponent, useData } from 'vitepress';
44
import { computed } from 'vue';
55
6-
const photos: { url: string; alt: Record<string, string> }[] = [
7-
{
8-
url: 'https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/100.jpg',
9-
alt: { en: 'Events Photo -- All rights reserved', 'zh-Hans': '活动照片,保留所有权利' },
10-
}, {
11-
url: 'https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/96.jpg',
12-
alt: { en: 'Events Photo -- All rights reserved', 'zh-Hans': '活动照片,保留所有权利' },
13-
}, {
14-
url: 'https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/95.jpg',
15-
alt: { en: 'Events Photo -- All rights reserved', 'zh-Hans': '活动照片,保留所有权利' },
16-
}, {
17-
url: 'https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/94.jpg',
18-
alt: { en: 'Events Photo -- All rights reserved', 'zh-Hans': '活动照片,保留所有权利' },
19-
}, {
20-
url: 'https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/47.jpg',
21-
alt: { en: 'Events Photo -- All rights reserved', 'zh-Hans': '活动照片,保留所有权利' },
22-
}, {
23-
url: 'https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/44.jpg',
24-
alt: { en: 'Events Photo -- All rights reserved', 'zh-Hans': '活动照片,保留所有权利' },
25-
},
26-
{
27-
url: 'https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/4.jpg',
28-
alt: { en: 'Events Photo -- All rights reserved', 'zh-Hans': '活动照片,保留所有权利' },
29-
},
30-
{
31-
url: 'https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/1.jpg',
32-
alt: { en: 'Events Photo -- All rights reserved', 'zh-Hans': '活动照片,保留所有权利' },
33-
},
34-
{
35-
url: 'https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/2.jpg',
36-
alt: { en: 'Events Photo -- All rights reserved', 'zh-Hans': '活动照片,保留所有权利' },
37-
},
38-
{
39-
url: 'https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/3.jpg',
40-
alt: { en: 'Events Photo -- All rights reserved', 'zh-Hans': '活动照片,保留所有权利' },
41-
},
42-
];
6+
import photosData from './photos.json';
7+
8+
const photos: { url: string; alt: Record<string, string> }[] = photosData;
439
4410
export default defineClientComponent(async () => {
4511
const data = useData();
@@ -76,6 +42,10 @@ export default defineClientComponent(async () => {
7642
.splideimg {
7743
border: 1px solid var(--vp-c-bg-soft);
7844
border-radius: 12px;
45+
max-height: 70vh;
46+
max-width: 100%;
47+
width: auto;
48+
object-fit: contain;
7949
transition:
8050
border-color 0.25s,
8151
background-color 0.25s;
@@ -84,4 +54,9 @@ export default defineClientComponent(async () => {
8454
.splideimg:hover {
8555
border-color: var(--vp-c-brand-1);
8656
}
57+
58+
/* Override VitePress default list styling that misaligns the pagination buttons */
59+
.splide__pagination li {
60+
margin-top: 0 !important;
61+
}
8762
</style>

content/photos.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
[
2+
{
3+
"url": "https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/100.jpg",
4+
"alt": {
5+
"en": "Events Photo -- All rights reserved",
6+
"zh-Hans": "活动照片,保留所有权利"
7+
}
8+
},
9+
{
10+
"url": "https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/96.jpg",
11+
"alt": {
12+
"en": "Events Photo -- All rights reserved",
13+
"zh-Hans": "活动照片,保留所有权利"
14+
}
15+
},
16+
{
17+
"url": "https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/95.jpg",
18+
"alt": {
19+
"en": "Events Photo -- All rights reserved",
20+
"zh-Hans": "活动照片,保留所有权利"
21+
}
22+
},
23+
{
24+
"url": "https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/94.jpg",
25+
"alt": {
26+
"en": "Events Photo -- All rights reserved",
27+
"zh-Hans": "活动照片,保留所有权利"
28+
}
29+
},
30+
{
31+
"url": "https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/47.jpg",
32+
"alt": {
33+
"en": "Events Photo -- All rights reserved",
34+
"zh-Hans": "活动照片,保留所有权利"
35+
}
36+
},
37+
{
38+
"url": "https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/44.jpg",
39+
"alt": {
40+
"en": "Events Photo -- All rights reserved",
41+
"zh-Hans": "活动照片,保留所有权利"
42+
}
43+
},
44+
{
45+
"url": "https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/4.jpg",
46+
"alt": {
47+
"en": "Events Photo -- All rights reserved",
48+
"zh-Hans": "活动照片,保留所有权利"
49+
}
50+
},
51+
{
52+
"url": "https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/1.jpg",
53+
"alt": {
54+
"en": "Events Photo -- All rights reserved",
55+
"zh-Hans": "活动照片,保留所有权利"
56+
}
57+
},
58+
{
59+
"url": "https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/2.jpg",
60+
"alt": {
61+
"en": "Events Photo -- All rights reserved",
62+
"zh-Hans": "活动照片,保留所有权利"
63+
}
64+
},
65+
{
66+
"url": "https://eu2.contabostorage.com/176b8434127b4d90bfb1360e128e586c:oneamongus/about-us/3.jpg",
67+
"alt": {
68+
"en": "Events Photo -- All rights reserved",
69+
"zh-Hans": "活动照片,保留所有权利"
70+
}
71+
}
72+
]

0 commit comments

Comments
 (0)