Skip to content

Commit f010263

Browse files
committed
docs: sponsors colors
1 parent bae55c9 commit f010263

File tree

5 files changed

+48
-43
lines changed

5 files changed

+48
-43
lines changed
Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
11
<template>
22
<h3>{{ name }} Sponsors</h3>
33

4-
<a
5-
v-for="sponsor in list"
6-
:key="sponsor.href"
7-
:href="sponsor.href"
8-
:title="sponsor.alt"
9-
target="_blank"
10-
rel="sponsored noopener"
11-
:style="{ width: size + 'px' }"
12-
class="sponsor_wrapper"
13-
>
14-
<img
15-
:src="sponsor.imgSrcLight"
16-
:alt="sponsor.alt"
4+
<p>
5+
<a
6+
v-for="sponsor in list"
7+
:key="sponsor.href"
8+
:href="sponsor.href"
9+
:title="sponsor.alt"
10+
target="_blank"
11+
rel="sponsored noopener"
1712
:style="{ width: size + 'px' }"
18-
/>
19-
</a>
20-
<br />
21-
<br />
13+
class="sponsor_wrapper"
14+
>
15+
<img
16+
:src="sponsor.imgSrc"
17+
:class="sponsor.imgSrcLight === imgSrcDark && 'invert-colors'"
18+
:alt="sponsor.alt"
19+
:style="{ width: size + 'px' }"
20+
/>
21+
</a>
22+
</p>
2223
</template>
2324

24-
<script>
25+
<script setup lang="ts">
2526
import sponsors from './sponsors.json'
27+
import { isDark } from '../theme/dark-theme'
28+
import { computed, defineProps } from 'vue'
29+
import type { PropType } from 'vue'
2630
27-
export default {
28-
name: 'HomeSponsorsGroup',
29-
30-
props: {
31-
name: {
32-
type: String,
33-
required: true,
34-
},
35-
size: {
36-
type: [Number, String],
37-
default: 140,
38-
},
31+
const props = defineProps({
32+
name: {
33+
type: String as PropType<'gold' | 'platinum' | 'silver' | 'bronze'>,
34+
required: true,
3935
},
40-
41-
computed: {
42-
list() {
43-
return sponsors[this.name.toLowerCase()]
44-
},
36+
size: {
37+
type: [Number, String],
38+
default: 140,
4539
},
46-
}
40+
})
41+
42+
const list = computed(() =>
43+
sponsors[props.name.toLowerCase()].map(sponsor => ({
44+
...sponsor,
45+
imgSrc: isDark.value ? sponsor.imgSrcDark : sponsor.imgSrcLight,
46+
}))
47+
)
4748
</script>
4849

4950
<style scoped>
@@ -59,6 +60,10 @@ export default {
5960
transition: background-color 300ms ease-in-out;
6061
}
6162
63+
p {
64+
margin: 0;
65+
}
66+
6267
h3 {
6368
margin: 0 0 10px;
6469
}
@@ -69,16 +74,12 @@ img {
6974
opacity: 0.66;
7075
}
7176
72-
html.dark img {
77+
html:not(.light) img.invert-colors {
7378
filter: invert(1) grayscale(100%);
7479
}
7580
7681
img:hover {
7782
filter: none !important;
7883
opacity: 1;
7984
}
80-
81-
/* html.dark .sponsor_wrapper:hover {
82-
background-color: var(--c-text-light);
83-
}*/
8485
</style>

docs/.vitepress/components/sponsors.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
{
44
"href": "https://passionatepeople.io/",
55
"alt": "Passionate People",
6-
"imgSrcLight": "https://img2.storyblok.com/672x0/filters::format(webp)/f/86387/x/21aa32ed18/logo-normal.svg",
7-
"imgSrcDark": "https://img2.storyblok.com/0x200/filters::format(webp)/f/86387/x/4cf6a70a8c/logo-white-text.svg"
6+
"imgSrcLight": "/sponsors/passionate-people-light.png",
7+
"imgSrcDark": "/sponsors/passionate-people-dark.png"
88
},
99
{
1010
"href": "https://vuejobs.com/?utm_source=vuerouter&utm_campaign=sponsor",

docs/.vitepress/theme/dark-theme.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { ref } from 'vue'
2+
3+
// dark mode is not supported here
4+
export const isDark = ref(false)
35.8 KB
Loading
50.7 KB
Loading

0 commit comments

Comments
 (0)