Files
website/node_modules/@astrojs/starlight/components/SocialIcons.astro
2024-05-06 17:15:30 -04:00

34 lines
719 B
Plaintext

---
import config from 'virtual:starlight/user-config';
import Icon from '../user-components/Icon.astro';
import type { Props } from '../props';
type Platform = keyof NonNullable<typeof config.social>;
type SocialConfig = NonNullable<NonNullable<typeof config.social>[Platform]>;
const links = Object.entries(config.social || {}) as [Platform, SocialConfig][];
---
{
links.length > 0 && (
<>
{links.map(([platform, { label, url }]) => (
<a href={url} rel="me" class="sl-flex">
<span class="sr-only">{label}</span>
<Icon name={platform} />
</a>
))}
</>
)
}
<style>
a {
color: var(--sl-color-text-accent);
padding: 0.5em;
margin: -0.5em;
}
a:hover {
opacity: 0.66;
}
</style>