Skip to content

Commit

Permalink
✨ add Blank component
Browse files Browse the repository at this point in the history
  • Loading branch information
Yago committed Aug 10, 2020
1 parent 4810a28 commit 1b4d517
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@
"./src"
]
},
"react": {
"version": "detect"
},
"typescript": {
"alwaysTryTypes": true,
"project": "./"
}
},
"react": {
"version": "detect"
}
}
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": false
"source.fixAll.eslint": true
},
"eslint.enable": true
}
1 change: 1 addition & 0 deletions playground/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"import/resolver": {
"node": {
"paths": [
"./playground/src",
"./src"
]
}
Expand Down
23 changes: 23 additions & 0 deletions playground/src/components/Blank/Blank.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { mount, shallow, configure } from 'enzyme';
import Blank from './Blank';
import Adapter from 'enzyme-adapter-react-16';

configure({ adapter: new Adapter() });

const wrapper = mount(<Blank />);

describe('Blank', () => {
it('should be defined', () => {
expect(Blank).toBeDefined();
});

it('should render correctly', () => {
const dom = shallow(<Blank />);
expect(dom).toMatchSnapshot();
});

// it('should update hooks', () => {
// wrapper.simulate('click');
// });
});
6 changes: 6 additions & 0 deletions playground/src/components/Blank/Blank.styles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { css } from '@emotion/core';
import tw from 'twin.macro';

export default css`
${tw`bg-indigo-200`}
`;
15 changes: 15 additions & 0 deletions playground/src/components/Blank/Blank.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @jsx jsx */
import React from 'react';
import { jsx } from '@emotion/core';

import styles from './Blank.styles';

const Blank = (): JSX.Element => {
const title = 'Hello world';

return <div css={styles}>{title}</div>;
};

Blank.defaultProps = {};

export default Blank;
1 change: 1 addition & 0 deletions playground/src/components/Blank/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Blank';
10 changes: 2 additions & 8 deletions playground/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ import React from 'react';
import { jsx } from '@emotion/core';
import tw from 'twin.macro';

import type { TypeA } from 'types';

const Example: TypeA = {
name: 'next',
};
import Blank from 'components/Blank';

const Home = (): JSX.Element => (
<div>
<h1>
<p>{Example.name}</p>
</h1>
<Blank />
</div>
);

Expand Down

0 comments on commit 1b4d517

Please sign in to comment.