mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-27 12:42:28 +02:00
refactor: using react hooks
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { graphql, StaticQuery } from 'gatsby';
|
||||
import { getContactHref } from '../../../utils';
|
||||
import styles from './Author.module.scss';
|
||||
import { useSiteMetadata } from '../../../hooks';
|
||||
|
||||
export const PureAuthor = ({ data }: Object) => {
|
||||
const { author } = data.site.siteMetadata;
|
||||
const Author = () => {
|
||||
const { author } = useSiteMetadata();
|
||||
|
||||
return (
|
||||
<div className={styles['author']}>
|
||||
@@ -24,25 +24,4 @@ export const PureAuthor = ({ data }: Object) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const Author = () => (
|
||||
<StaticQuery
|
||||
query={graphql`
|
||||
query AuthorQuery {
|
||||
site {
|
||||
siteMetadata {
|
||||
author {
|
||||
name
|
||||
bio
|
||||
contacts {
|
||||
twitter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`}
|
||||
render={(data) => <PureAuthor data={data} />}
|
||||
/>
|
||||
);
|
||||
|
||||
export default Author;
|
||||
|
Reference in New Issue
Block a user