1
0
Fork 0
blog/src/components/molecules/Vcard.tsx

54 lines
1.3 KiB
TypeScript
Raw Normal View History

2020-05-22 14:38:19 +02:00
import React, { ReactElement } from 'react'
2019-10-02 13:35:50 +02:00
import { graphql, useStaticQuery } from 'gatsby'
2021-03-06 02:58:10 +01:00
import { getSrc } from 'gatsby-plugin-image'
2023-01-29 22:58:19 +01:00
import { useSiteMetadata } from '../../hooks/useSiteMetadata'
2019-11-17 14:18:49 +01:00
import IconLinks from './Networks'
import * as styles from './Vcard.module.css'
2019-10-02 13:35:50 +02:00
2019-11-24 14:29:25 +01:00
const query = graphql`
query Avatar {
2019-11-24 14:29:25 +01:00
avatar: allFile(filter: { name: { eq: "avatar" } }) {
edges {
node {
childImageSharp {
2021-03-06 02:58:10 +01:00
gatsbyImageData(
layout: CONSTRAINED
width: 80
height: 80
quality: 85
)
2019-11-24 14:29:25 +01:00
}
}
}
}
}
`
2020-05-22 14:38:19 +02:00
export default function Vcard(): ReactElement {
const data = useStaticQuery<Queries.AvatarQuery>(query)
2019-11-24 14:29:25 +01:00
const { author, rss, jsonfeed } = useSiteMetadata()
2023-01-26 19:36:45 +01:00
const { mastodon, twitter, github, name, uri } = author
2021-03-06 02:58:10 +01:00
const avatar = getSrc(data.avatar.edges[0].node)
2023-01-26 19:36:45 +01:00
const links = [mastodon, github, twitter, rss, jsonfeed]
2019-11-24 14:29:25 +01:00
2019-10-02 13:35:50 +02:00
return (
2021-03-04 22:53:35 +01:00
<>
2021-03-06 02:58:10 +01:00
<img
className={styles.avatar}
2021-03-06 02:58:10 +01:00
src={avatar}
width="80"
height="80"
alt="avatar"
/>
<p className={styles.description}>
2019-10-02 13:35:50 +02:00
Blog of designer &amp; developer{' '}
<a className="fn" rel="author" href={uri}>
{name}
</a>
</p>
<IconLinks links={links} />
2021-03-04 22:53:35 +01:00
</>
2019-10-02 13:35:50 +02:00
)
}