Upgrade to Gatsby v2

This commit is contained in:
alxshelepenok
2018-11-09 20:08:48 +03:00
parent e83dfc6dff
commit 8b92891329
204 changed files with 18708 additions and 3904 deletions

View File

@@ -0,0 +1,32 @@
import React from 'react';
import { Link } from 'gatsby';
import profilePic from '../../../pages/photo.jpg';
import styles from './Author.module.scss';
const Author = ({ author, isIndex }) => (
<div className={styles['author']}>
<Link to="/">
<img
src={profilePic}
className={styles['author__photo']}
width="75"
height="75"
alt={author.name}
/>
</Link>
{ isIndex ? (
<h1 className={styles['author__title']}>
<Link className={styles['author__title-link']} to="/">{author.name}</Link>
</h1>
) :
<h2 className={styles['author__title']}>
<Link className={styles['author__title-link']} to="/">{author.name}</Link>
</h2>
}
<p className={styles['author__subtitle']}>{author.bio}</p>
</div>
);
export default Author;

View File

@@ -0,0 +1,36 @@
@import '../../../assets/scss/variables';
@import '../../../assets/scss/mixins';
.author {
&__photo {
display: inline-block;
margin-bottom: 0;
border-radius: 50%;
background-clip: padding-box
}
&__title {
font-size: $typographic-base-font-size * 1.125;
font-weight: 600;
@include line-height(1.125);
@include margin(.5, 0, .5, 0);
&-link {
color: $color-base;
&:hover,
&:focus {
color: $color-base
}
}
}
&__subtitle {
color: $color-gray;
@include line-height(1);
@include margin-bottom(1)
}
}

View File

@@ -0,0 +1,17 @@
import React from 'react';
import renderer from 'react-test-renderer';
import Author from './Author';
describe('Author', () => {
const props = {
author: {
name: 'test',
bio: 'test'
}
};
it('renders correctly', () => {
const tree = renderer.create(<Author {...props} />).toJSON();
expect(tree).toMatchSnapshot();
});
});

View File

@@ -0,0 +1,34 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Author renders correctly 1`] = `
<div
className="author"
>
<Link
to="/"
>
<img
alt="test"
className="author__photo"
height="75"
src="file"
width="75"
/>
</Link>
<h2
className="author__title"
>
<Link
className="author__title-link"
to="/"
>
test
</Link>
</h2>
<p
className="author__subtitle"
>
test
</p>
</div>
`;

View File

@@ -0,0 +1 @@
export { default } from './Author';