Skip to content

Commit 8b3c850

Browse files
committed
Change how Social Media Buttons work on Desktop vs. Mobile
1 parent 4607970 commit 8b3c850

1 file changed

Lines changed: 28 additions & 7 deletions

File tree

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
11
---
2-
const { hoverColor, url } = Astro.props;
2+
import { Icon } from 'astro-icon/components';
3+
4+
interface Props {
5+
href: string;
6+
label: string;
7+
icon: string;
8+
hoverColor?: string;
9+
}
10+
11+
const { href, label, icon, hoverColor } = Astro.props;
312
---
413

514
<a
6-
href={url}
15+
href={href}
716
target='_blank'
817
rel='noopener noreferrer'
9-
style={`--hover-color: ${hoverColor};`}
10-
class='group not-prose flex h-9 w-9 items-center justify-center cursor-pointer transition-all duration-150 hover:scale-105 active:scale-95'
18+
aria-label={label}
19+
style={hoverColor && `--hover-color: ${hoverColor};`}
20+
class='group relative not-prose flex w-full items-center justify-center gap-3 rounded-lg border border-gray-400 px-4 py-3 dark:border-gray-200 cursor-pointer transition-all duration-150 hover:scale-105 active:scale-95 md:h-9 md:w-9 md:border-0 md:gap-0 md:px-0 md:py-0'
1121
>
12-
<div class='transition-colors duration-150 group-hover:text-(--hover-color) dark:group-hover:text-gray-50'>
13-
<slot />
14-
</div>
22+
<Icon
23+
name={icon}
24+
class='h-6 w-6 shrink-0 transition-colors duration-150 group-hover:text-(--hover-color) dark:group-hover:text-gray-50 md:h-8 md:w-8'
25+
aria-hidden='true'
26+
/>
27+
<span class='text-base md:hidden'>
28+
{label}
29+
</span>
30+
<span
31+
aria-hidden='true'
32+
class='pointer-events-none hidden md:absolute md:top-full md:left-1/2 md:mt-2 md:-translate-x-1/2 md:whitespace-nowrap md:rounded md:bg-gray-900 md:px-2 md:py-1 md:text-xs md:text-white md:opacity-0 md:transition-opacity md:duration-150 md:group-hover:opacity-100 md:group-focus-visible:opacity-100 md:dark:bg-gray-100 md:dark:text-gray-900 md:block'
33+
>
34+
{label}
35+
</span>
1536
</a>

0 commit comments

Comments
 (0)