Skip to content

Commit 4e5bbf5

Browse files
lasfindanilowoz
authored andcommitted
Remove custom components (#48)
* Remove custom components #46 * return <rect/> and <circle/> in stories, update readme.md, return test for 'when type is custom' * fix indentation, move 'when type is custom' test from 'Type props are used' block
1 parent 6c0a586 commit 4e5bbf5

File tree

8 files changed

+22
-112
lines changed

8 files changed

+22
-112
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ your custom loaders
4646

4747
```jsx
4848
// import the component
49-
import ContentLoader, { Rect, Circle } from 'react-content-loader'
49+
import ContentLoader from 'react-content-loader'
5050

5151
const MyLoader = () => {
5252
return (
5353
<ContentLoader height={140} speed={1} primaryColor={'#333'} secondaryColor={'#999'}>
54-
<Circle x={195} y={30} radius={30} />
55-
<Rect x={50} y={80} height={10} radius={5} width={300} />
56-
<Rect x={75} y={100} height={10} radius={5} width={250} />
54+
<rect x="80" y="17" rx="4" ry="4" width="300" height="13" />
55+
<rect x="82" y="44" rx="3" ry="3" width="250" height="10" />
56+
<circle cx="35" cy="35" r="35" />
5757
</ContentLoader>
5858
)
5959
}

src/custom/Circle.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/custom/Rect.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ import InstagramStyle from './stylized/InstagramStyle'
88
import CodeStyle from './stylized/CodeStyle'
99
import ListStyle from './stylized/ListStyle'
1010
import BulletListStyle from './stylized/BulletListStyle'
11-
// Custom
12-
import Rect from './custom/Rect'
13-
import Circle from './custom/Circle'
1411

1512
export type Props = {
1613
style: { [key: string]: any },
@@ -60,4 +57,3 @@ ContentLoader.defaultProps = {
6057
};
6158

6259
export default ContentLoader
63-
export { Rect, Circle }

stories/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from 'react'
33
import { storiesOf } from '@storybook/react'
44

55
import ContentLoader from '../src/index'
6-
import { Rect, Circle } from '../src/index'
76

87
let defaultStyle = {
98
width: 400,
@@ -16,9 +15,9 @@ const Container = props => <div style={defaultStyle}>{props.children}</div>
1615
const MyLoader = () => {
1716
return (
1817
<ContentLoader height={140} speed={1} primaryColor={'#333'} secondaryColor={'#999'}>
19-
<Circle x={195} y={30} radius={30} />
20-
<Rect x={50} y={80} height={10} radius={5} width={300} />
21-
<Rect x={75} y={100} height={10} radius={5} width={250} />
18+
<rect x="80" y="17" rx="4" ry="4" width="300" height="13" />
19+
<rect x="82" y="44" rx="3" ry="3" width="250" height="10" />
20+
<circle cx="35" cy="35" r="35" />
2221
</ContentLoader>
2322
)
2423
}

tests/custom/Circle.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

tests/custom/Rect.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

tests/index.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import FacebookStyle from '../src/stylized/FacebookStyle'
1515
import InstagramStyle from '../src/stylized/InstagramStyle'
1616
import CodeStyle from '../src/stylized/CodeStyle'
1717

18-
import Rect from '../src/custom/Rect'
19-
import Circle from '../src/custom/Circle'
20-
2118
describe('<ContentLoader />:', () => {
2219
describe('Type props are used', () => {
2320
describe('when type is facebook', () => {
@@ -52,18 +49,21 @@ describe('<ContentLoader />:', () => {
5249
})
5350
})
5451

55-
describe('when type is custom', () => {
56-
const wrapper = mount(
57-
<ContentLoader>
58-
<Rect />
59-
<Circle />
60-
</ContentLoader>
61-
)
62-
63-
it('should render custom element', () => {
64-
expect(wrapper).to.have.descendants(Rect)
65-
expect(wrapper).to.have.descendants(Circle)
66-
})
52+
})
53+
54+
describe('when type is custom', () => {
55+
56+
const wrapper = mount(
57+
<ContentLoader>
58+
<rect x="80" y="17" rx="4" ry="4" width="300" height="13" />
59+
<rect x="82" y="44" rx="3" ry="3" width="250" height="10" />
60+
<circle cx="35" cy="35" r="35" />
61+
</ContentLoader>
62+
)
63+
64+
it('should render custom element', () => {
65+
expect(wrapper.find('rect')).to.have.length(3)
66+
expect(wrapper.find('circle')).to.have.length(1)
6767
})
6868
})
6969

0 commit comments

Comments
 (0)