Skip to content

Commit

Permalink
feat: Add sponsors
Browse files Browse the repository at this point in the history
Signed-off-by: Avior <[email protected]>
  • Loading branch information
Aviortheking committed Jun 12, 2024
1 parent f99c52b commit e1f3219
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
3 changes: 3 additions & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import tailwind from "@astrojs/tailwind"
export default defineConfig({
integrations: [starlight({
title: 'TCGdex API Docs',
components: {
TableOfContents: './src/components/TableOfContents.astro',
},
logo: {
dark: './src/assets/logo-dark.svg',
light: './src/assets/logo-light.svg',
Expand Down
14 changes: 14 additions & 0 deletions src/assets/sponsors/dzeio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions src/components/Sponsors.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
import { Image } from 'astro:assets'
import LogoDzeio from '../assets/sponsors/dzeio.svg'
const sponsors: Array<{
name: string
img?: ImageMetadata
url?: string
size?: 'large' | 'small'
}> = [
{
name: 'Dzeio', // Custom Sponsor
img: LogoDzeio,
url: 'https://dzeio.com',
size: 'large'
}
]
---

<section class="mt-6">
<p>Sponsors</p>
<div class="flex flex-wrap rounded-xl overflow-hidden gap-1 w-full mt-2">
{sponsors.map(sponsor => (
<a href={sponsor.url} class={sponsor.size ?? ''} target="_blank">
<article>
{sponsor.img ? (
<Image height={sponsor.size === 'large' ? 24 : 14} src={sponsor.img} alt={`Logo ${sponsor.name}`}/>
) : (
<p class:list={["font-bold text-black text-center", {'text-xl w-full': sponsor.size === 'large', 'text-sm': sponsor.size !== 'large'}]}>{sponsor.name}</p>
)}
</article>
</a>
))}
</div>
<a href="https://github.com/sponsors/tcgdex" target="_blank" class="font-light text-sm italic">Sponsor the project</a>
</section>

<style>
div a {
width: 34%;
height: 100%;
flex-grow: 1;
height: 68px;
}
a.large {
width: 100%;
}
article {
display: flex;
background-color: var(--sl-color-gray-6);
justify-content: center;
align-items: center;
padding: 1.5rem;
height: 68px;
width: 100%;
transition: all 0.1s linear;
}
article:hover {
background-color: var(--sl-color-gray-1);
}
:root[data-theme='light'] article {
background-color: var(--sl-color-gray-7);
}
:root[data-theme='light'] article:hover {
background-color: var(--sl-color-gray-6);
}
article:hover :global(img) {
filter: none !important;
}
:root article :global(img) {
filter: grayscale(1) ;
transition: all 0.1s linear;
}
</style>
7 changes: 7 additions & 0 deletions src/components/TableOfContents.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
import Default from '@astrojs/starlight/components/TableOfContents.astro'
import Sponsors from './Sponsors.astro'
---

<Default {...Astro.props as any}><slot/></Default>
<Sponsors/>

0 comments on commit e1f3219

Please sign in to comment.