mirror of
https://github.com/kogakure/website-astro-stefanimhoff.de.git
synced 2026-02-03 20:15:27 +00:00
chore: replace EmailLink with preact component
This commit is contained in:
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
import { Sprite } from 'astro-icon';
|
|
||||||
|
|
||||||
import { TextLink } from '../components';
|
|
||||||
|
|
||||||
export interface Props {
|
|
||||||
icon?: boolean;
|
|
||||||
text?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { text = 'Email', icon = true, ...props } = Astro.props;
|
|
||||||
---
|
|
||||||
|
|
||||||
<TextLink class="group" href="#protected-email" data-email-link {...props}>
|
|
||||||
{text}
|
|
||||||
{
|
|
||||||
icon && (
|
|
||||||
<span class="more-icon relative inline-flex mis-[0.2em] block-start-[0.3em] inline-start-[0.2em]">
|
|
||||||
<Sprite
|
|
||||||
name="ri:mail-send-line"
|
|
||||||
aria-hidden="true"
|
|
||||||
class="h-icon w-icon transition-transform duration-500 ease-in-out group-hover:translate-x-1 group-focus:translate-x-1"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</TextLink>
|
|
||||||
30
src/components/EmailLink.tsx
Normal file
30
src/components/EmailLink.tsx
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import type { FunctionalComponent, JSX } from 'preact';
|
||||||
|
|
||||||
|
import { TextLink } from '.';
|
||||||
|
import { MailSend } from './icons';
|
||||||
|
|
||||||
|
interface Props extends Omit<JSX.HTMLAttributes<HTMLAnchorElement>, 'icon'> {
|
||||||
|
text?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EmailLinkProps extends Props {
|
||||||
|
icon?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const EmailLink: FunctionalComponent<EmailLinkProps> = ({
|
||||||
|
icon = true,
|
||||||
|
text = 'Email',
|
||||||
|
...props
|
||||||
|
}) => (
|
||||||
|
<TextLink class="group" href="#protected-email" data-email-link {...props}>
|
||||||
|
{text}
|
||||||
|
{icon && (
|
||||||
|
<span class="more-icon relative inline-flex mis-[0.2em] block-start-[0.3em] inline-start-[0.2em]">
|
||||||
|
<MailSend
|
||||||
|
aria-hidden="true"
|
||||||
|
class="icon h-icon w-icon transition-transform duration-500 ease-in-out group-hover:translate-x-1 group-focus:translate-x-1"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</TextLink>
|
||||||
|
);
|
||||||
@@ -11,6 +11,7 @@ export * from './DisplayBox';
|
|||||||
export * from './Divider';
|
export * from './Divider';
|
||||||
export * from './DoughnutChart';
|
export * from './DoughnutChart';
|
||||||
export * from './DownloadLink';
|
export * from './DownloadLink';
|
||||||
|
export * from './EmailLink';
|
||||||
export * from './Figure';
|
export * from './Figure';
|
||||||
export * from './Flag';
|
export * from './Flag';
|
||||||
export * from './Headline';
|
export * from './Headline';
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { YouTube } from '@astro-community/astro-embed-youtube';
|
import { YouTube } from '@astro-community/astro-embed-youtube';
|
||||||
|
|
||||||
import EmailLink from './components/EmailLink.astro';
|
|
||||||
import Image from './components/Image.astro';
|
import Image from './components/Image.astro';
|
||||||
import MarkdownImage from './components/MarkdownImage.astro';
|
import MarkdownImage from './components/MarkdownImage.astro';
|
||||||
import Picture from './components/Picture.astro';
|
import Picture from './components/Picture.astro';
|
||||||
@@ -18,6 +17,7 @@ import {
|
|||||||
DisplayBox,
|
DisplayBox,
|
||||||
Divider,
|
Divider,
|
||||||
DownloadLink,
|
DownloadLink,
|
||||||
|
EmailLink,
|
||||||
Figure,
|
Figure,
|
||||||
Flag,
|
Flag,
|
||||||
Headline,
|
Headline,
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { animation, animationDelay } from '../data/site';
|
|||||||
|
|
||||||
import GridLayout from '../layouts/GridLayout.astro';
|
import GridLayout from '../layouts/GridLayout.astro';
|
||||||
import PageTitle from '../components/PageTitle.astro';
|
import PageTitle from '../components/PageTitle.astro';
|
||||||
import EmailLink from '../components/EmailLink.astro';
|
|
||||||
import {
|
import {
|
||||||
Divider,
|
Divider,
|
||||||
DownloadLink,
|
DownloadLink,
|
||||||
|
EmailLink,
|
||||||
Headline,
|
Headline,
|
||||||
ListItem,
|
ListItem,
|
||||||
Subheadline,
|
Subheadline,
|
||||||
|
|||||||
Reference in New Issue
Block a user