-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add collection for contributors
- Loading branch information
1 parent
1b1efe2
commit 8bbd35a
Showing
7 changed files
with
78 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
import { Icon } from '@astrojs/starlight/components'; | ||
interface Props { | ||
name: string; | ||
twitter?: string; | ||
linkedin?: string; | ||
github?: string; | ||
} | ||
const { name, twitter, linkedin, github } = Astro.props; | ||
--- | ||
|
||
<p class="contributor"> | ||
Created by {name} | ||
{twitter && <a href={twitter}><Icon class='icon' name="twitter" size="0.75rem" /></a>} | ||
{linkedin && <a href={linkedin}><Icon class='icon' name="linkedin" size="0.75rem" /></a>} | ||
{github && <a href={github}><Icon class='icon' name="github" size="0.75rem" /></a>} | ||
|
||
</p> | ||
|
||
<style> | ||
.contributor { | ||
display: flex; | ||
gap: 0.5rem; | ||
align-items: center; | ||
margin-top: -1rem; | ||
font-size: var(--sl-text-xs); | ||
color: var(--sl-color-gray-3); | ||
} | ||
|
||
.icon { | ||
vertical-align: middle; | ||
color: var(--sl-color-gray-3); | ||
|
||
&:hover { | ||
color: var(--sl-color-accent-high) | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema'; | ||
import { defineCollection, z } from 'astro:content'; | ||
import { defineCollection, reference, z } from 'astro:content'; | ||
|
||
export const collections = { | ||
docs: defineCollection({ | ||
schema: (ctx) => | ||
docsSchema()(ctx).extend({ | ||
badge: z.enum(['stable', 'unstable', 'experimental']).optional(), | ||
contributor: z.string().optional(), | ||
}), | ||
const contributors = defineCollection({ | ||
type: 'data', | ||
schema: z.object({ | ||
name: z.string(), | ||
twitter: z.string().url().optional(), | ||
linkedin: z.string().url().optional(), | ||
github: z.string().url().optional(), | ||
}), | ||
i18n: defineCollection({ type: 'data', schema: i18nSchema() }), | ||
}); | ||
|
||
const docs = defineCollection({ | ||
schema: (ctx) => | ||
docsSchema()(ctx).extend({ | ||
badge: z.enum(['stable', 'unstable', 'experimental']).optional(), | ||
contributor: reference('contributors').optional(), | ||
}), | ||
}); | ||
|
||
const i18n = defineCollection({ type: 'data', schema: i18nSchema() }); | ||
|
||
export const collections = { | ||
docs: docs, | ||
i18n: i18n, | ||
contributors: contributors, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "Thomas Laforge", | ||
"twitter": "https://twitter.com/laforge_toma", | ||
"linkedin": "https://www.linkedin.com/in/thomas-laforge-2b05a945/", | ||
"github": "https://github.com/tomalaforge" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters