Skip to content

Commit

Permalink
docs: show vite sponsors (#12621)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Mar 30, 2023
1 parent d026a65 commit 51f68f9
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
55 changes: 53 additions & 2 deletions docs/.vitepress/theme/components/HomeSponsors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,59 @@ const { data } = useSponsor()
<VPHomeSponsors
v-if="data"
message="Vite is free and open source, made possible by wonderful sponsors."
action-text="Become a sponsor"
action-link="https://github.com/sponsors/yyx990803"
:data="data"
/>
<div class="action">
<a
class="sponsor"
href="https://github.com/sponsors/vitejs"
target="_blank"
rel="noreferrer"
>
Sponsor Vite
</a>
<a
class="sponsor"
href="https://github.com/sponsors/yyx990803"
target="_blank"
rel="noreferrer"
>
Sponsor Evan You
</a>
</div>
</template>

<style scoped>
.action {
display: flex;
justify-content: center;
gap: 1rem;
padding-top: 4rem;
}
.sponsor {
/* .VPButton */
display: inline-block;
border: 1px solid transparent;
text-align: center;
font-weight: 600;
white-space: nowrap;
transition: color 0.25s, border-color 0.25s, background-color 0.25s;
/* .VPButton.medium */
border-radius: 20px;
padding: 0 20px;
line-height: 38px;
font-size: 14px;
/* .VPButton.sponsor */
border-color: var(--vp-button-sponsor-border);
color: var(--vp-button-sponsor-text);
background-color: var(--vp-button-sponsor-bg);
}
.sponsor:hover {
/* .VPButton.sponsor:hover */
border-color: var(--vp-button-sponsor-hover-border);
color: var(--vp-button-sponsor-hover-text);
background-color: var(--vp-button-sponsor-hover-bg);
}
</style>
7 changes: 6 additions & 1 deletion docs/.vitepress/theme/composables/sponsor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ const data = ref()
const dataHost = 'https://sponsors.vuejs.org'
const dataUrl = `${dataHost}/vite.json`

// no sponsors yet :(
const viteSponsors: Pick<Sponsors, 'gold'> = {
gold: [],
}

export function useSponsor() {
onMounted(async () => {
if (data.value) {
Expand Down Expand Up @@ -48,7 +53,7 @@ function mapSponsors(sponsors: Sponsors) {
{
tier: 'Gold Sponsors',
size: 'medium',
items: mapImgPath(sponsors['gold']),
items: viteSponsors['gold'].concat(mapImgPath(sponsors['gold'])),
},
]
}
Expand Down

0 comments on commit 51f68f9

Please sign in to comment.