Skip to content

Commit 9bfd0d9

Browse files
committed
feat: add <CssResetPoorMan>
1 parent 86e9e7f commit 9bfd0d9

File tree

6 files changed

+77
-0
lines changed

6 files changed

+77
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ const MyComponent = mock();
5050
- [`<CssResetMinimalistic>`](./docs/reset/CssResetMinimalistic.md)
5151
- [`<CssResetMinimalistic2>`](./docs/reset/CssResetMinimalistic2.md)
5252
- [`<CssResetMinimalistic3>`](./docs/reset/CssResetMinimalistic3.md)
53+
- [`<CssResetPoorMan>`](./docs/reset/CssResetPoorMan.md)
5354
- Other
5455
- [`<Resolve>`](./docs/Resolve.md)

docs/reset/CssResetPoorMan.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# `<CssResetPoorMan>`
2+
3+
## Usage
4+
5+
Simply render it in your React app
6+
7+
```jsx
8+
import CssResetPoorMan from 'mol-fe-react/lib/reset/CssResetPoorMan';
9+
10+
<CssResetPoorMan />
11+
```
12+
13+
## Contents
14+
15+
```js
16+
{
17+
'html,body': {
18+
pad: 0,
19+
mar: 0,
20+
},
21+
html: {
22+
fz: '1em',
23+
},
24+
body: {
25+
fz: '100%',
26+
},
27+
'a img,a:link img,a:visited img': {
28+
bd: 0,
29+
},
30+
}
31+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`<CssResetPoorMan> renders as expected 1`] = `"<style>html,body{padding:0;margin:0;}html{font-size:1em;}body{font-size:100%;}a img,a:link img,a:visited img{border:0;}</style>"`;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {createElement as h} from 'react';
2+
import {renderToStaticMarkup} from 'react-dom/server';
3+
import CssResetPoorMan from '..';
4+
5+
describe('<CssResetPoorMan>', () => {
6+
it('renders as expected', () => {
7+
const html = renderToStaticMarkup(h(CssResetPoorMan));
8+
9+
expect(html).toMatchSnapshot();
10+
});
11+
});

src/reset/CssResetPoorMan/index.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import createCssResetComponent from '../createCssResetComponent';
2+
3+
export const css = {
4+
'html,body': {
5+
pad: 0,
6+
mar: 0,
7+
},
8+
html: {
9+
fz: '1em',
10+
},
11+
body: {
12+
fz: '100%',
13+
},
14+
'a img,a:link img,a:visited img': {
15+
bd: 0,
16+
},
17+
};
18+
19+
const CssResetPoorMan = createCssResetComponent(css);
20+
21+
export default CssResetPoorMan;

src/reset/CssResetPoorMan/story.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {createElement as h} from 'react';
2+
import {storiesOf} from '@storybook/react';
3+
import {action} from '@storybook/addon-actions';
4+
import {linkTo} from '@storybook/addon-links';
5+
import CssResetPoorMan from '.';
6+
7+
storiesOf('reset', module)
8+
.add('CssResetPoorMan', () =>
9+
h(CssResetPoorMan)
10+
);

0 commit comments

Comments
 (0)