mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-27 12:42:28 +02:00
Upgrade to Gatsby v2
This commit is contained in:
10
src/components/Icon/Icon.js
Normal file
10
src/components/Icon/Icon.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import React from 'react';
|
||||
import styles from './Icon.module.scss';
|
||||
|
||||
const Icon = ({ icon }) => (
|
||||
<svg className={styles['icon']} viewBox={icon.viewBox}>
|
||||
<path d={icon.path} />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export default Icon;
|
19
src/components/Icon/Icon.module.scss
Normal file
19
src/components/Icon/Icon.module.scss
Normal file
@@ -0,0 +1,19 @@
|
||||
.icon {
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
stroke-width: 0;
|
||||
stroke: currentColor;
|
||||
fill: currentColor;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
speak: none;
|
||||
margin-right: .2em;
|
||||
text-align: center;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1em;
|
||||
margin-left: .2em;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
17
src/components/Icon/Icon.test.js
Normal file
17
src/components/Icon/Icon.test.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
import Icon from './Icon';
|
||||
|
||||
describe('Icon', () => {
|
||||
const props = {
|
||||
icon: {
|
||||
viewBox: '0 0 0 0',
|
||||
path: '',
|
||||
}
|
||||
};
|
||||
|
||||
it('renders correctly', () => {
|
||||
const tree = renderer.create(<Icon {...props} />).toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
});
|
12
src/components/Icon/__snapshots__/Icon.test.js.snap
Normal file
12
src/components/Icon/__snapshots__/Icon.test.js.snap
Normal file
@@ -0,0 +1,12 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Icon renders correctly 1`] = `
|
||||
<svg
|
||||
className="icon"
|
||||
viewBox="0 0 0 0"
|
||||
>
|
||||
<path
|
||||
d=""
|
||||
/>
|
||||
</svg>
|
||||
`;
|
1
src/components/Icon/index.js
Normal file
1
src/components/Icon/index.js
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './Icon';
|
Reference in New Issue
Block a user