Skip to content

Commit a6c303c

Browse files
committed
docs: improve sponsors section
1 parent c07112b commit a6c303c

File tree

3 files changed

+68
-12026
lines changed

3 files changed

+68
-12026
lines changed
Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<template>
22
<div class="sponsors">
3-
<h4>GitHub Silver Sponsors</h4>
4-
<p class="sponsor-section">
3+
<h4>Sponsors</h4>
4+
<div class="sponsor-section silver">
55
<a
6+
class="sponsor-item"
67
:href="sponsor.url"
78
target="_blank"
89
rel="noopener"
910
v-for="sponsor in sponsors"
11+
:key="sponsor.id"
1012
>
11-
<img :src="sponsor.imgUrl" />
13+
<img :src="sponsor.imgUrl" :alt="sponsor.name" />
1214
</a>
13-
</p>
15+
<a href="/donate" class="sponsor-item action">Your logo</a>
16+
</div>
1417
</div>
1518
</template>
1619

@@ -19,13 +22,15 @@ import { ref } from 'vue'
1922
2023
const sponsors = ref([
2124
{
25+
id: 1,
2226
name: 'Worksome',
2327
imgUrl: '/assets/img/sponsors/worksome.svg',
2428
url: 'https://www.worksome.com',
2529
description:
2630
'Hire and manage talent globally with automated contracts and payroll.'
2731
},
2832
{
33+
id: 2,
2934
name: 'BairesDev',
3035
imgUrl: '/assets/img/sponsors/bairesdev.png',
3136
url: 'https://www.bairesdev.com/sponsoring-open-source-projects/',
@@ -40,23 +45,67 @@ const sponsors = ref([
4045
}
4146
4247
.sponsors h4 {
43-
text-align: center;
48+
/* text-align: center; */
4449
color: var(--c-text-lighter);
4550
}
4651
47-
.sponsors .sponsor-section {
48-
text-align: center;
49-
margin-top: 0;
52+
.sponsors .sponsor-section.silver {
53+
/* text-align: center;
54+
margin-top: 0; */
55+
--max-width: 240px;
56+
display: grid;
57+
grid-template-columns: repeat(auto-fill, minmax(var(--max-width), 1fr));
58+
column-gap: 4px;
5059
}
5160
52-
.sponsors .sponsor-section a {
53-
margin: 10px 20px;
61+
@media (max-width: 720px) {
62+
.sponsors .sponsor-section.silver {
63+
--max-width: 180px;
64+
}
65+
}
66+
67+
@media (max-width: 480px) {
68+
.sponsors .sponsor-section.silver {
69+
--max-width: 150px;
70+
}
5471
}
5572
56-
.sponsors .sponsor-section a,
57-
.sponsors .sponsor-section img {
58-
max-width: 180px;
59-
display: inline-block;
60-
vertical-align: middle;
73+
.sponsors .sponsor-item {
74+
/* margin: 10px 20px; */
75+
background-color: #f9f9f9;
76+
margin: 2px 0;
77+
display: flex;
78+
justify-content: space-around;
79+
align-items: center;
80+
border-radius: 2px;
81+
transition: background-color 0.2s ease;
82+
height: calc(var(--max-width) / 2 - 50px);
83+
}
84+
85+
.dark .sponsors .sponsor-item {
86+
background-color: #242424;
87+
}
88+
.dark .sponsors img {
89+
filter: grayscale(1) invert(1);
90+
}
91+
92+
.dark .sponsors .sponsor-item:hover {
93+
color: #213547;
94+
background-color: #f1f1f1;
95+
}
96+
.dark .sponsors .sponsor-item:hover img {
97+
filter: none;
98+
}
99+
100+
.sponsors img {
101+
max-width: calc(var(--max-width) - 30px);
102+
max-height: calc(var(--max-width) / 2 - 20px);
103+
}
104+
.sponsors .action {
105+
font-size: 13px;
106+
color: var(--c-text-lighter);
107+
}
108+
.dark .sponsors .action {
109+
color: white;
61110
}
62111
</style>

docs/.vuepress/layouts/components/CarbonAds.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async function loadCarbonAds() {
1919
const s = document.createElement('script')
2020
s.id = SCRIPT_ID
2121
s.src = `//cdn.carbonads.com/carbon.js?serve=${ACCOUNT_ID}&placement=${PLACEMENT}`
22-
carbonAdsElementRef.value.appendChild(s)
22+
carbonAdsElementRef?.value?.appendChild(s)
2323
}
2424
2525
onMounted(() => {
@@ -28,7 +28,9 @@ onMounted(() => {
2828
2929
watch(route, () => {
3030
if (!isNullish(document.querySelector('#carbonads'))) {
31-
carbonAdsElementRef.value.innerHTML = ''
31+
if (carbonAdsElementRef && carbonAdsElementRef.value) {
32+
carbonAdsElementRef.value.innerHTML = ''
33+
}
3234
loadCarbonAds()
3335
}
3436
})

0 commit comments

Comments
 (0)