Skip to content

Commit 49f793f

Browse files
committed
change property name and update document
1 parent dc77f4a commit 49f793f

File tree

7 files changed

+129
-112
lines changed

7 files changed

+129
-112
lines changed

README.md

Lines changed: 50 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ Layout manager not to give margins to components
1414

1515
To install, you can use [npm](https://npmjs.org/) or [yarn](https://yarnpkg.com):
1616

17-
$ npm install react-layout-manager
17+
$ npm install -S react-layout-manager
1818
$ yarn add react-layout-manager
1919

2020
## Usage
2121

2222
Example:
2323

2424
```jsx
25-
import RLM from 'ReactLayoutManager';
25+
import RLM from 'react-layout-manager';
2626

2727
<RLM
2828
width={[100, '100%']}
@@ -31,9 +31,7 @@ import RLM from 'ReactLayoutManager';
3131
{
3232
breakpoint: 480,
3333
settings: {
34-
width: [100, '100%'],
35-
isWrap: true,
36-
horizontalSpace: 0,
34+
wrap: true,
3735
wrapVerticalSpace: 5,
3836
},
3937
},
@@ -63,8 +61,8 @@ import RLM from 'ReactLayoutManager';
6361
innerWidth={50}
6462
verticalAlign="middle"
6563
align="center"
66-
isVisible
67-
isWrap
64+
visible
65+
wrap
6866
responsive={[
6967
{
7068
breakpoint: 480,
@@ -81,10 +79,12 @@ import RLM from 'ReactLayoutManager';
8179

8280
## Examples
8381

82+
Demo Source:
83+
8484
```jsx
8585
import React, { Component } from 'react';
8686
import styled from 'styled-components';
87-
import RLM from './components/ReactLayoutManager';
87+
import RLM from 'react-layout-manager';
8888

8989
const Input = styled.input`
9090
width: 100%;
@@ -109,20 +109,6 @@ const Label = styled.div`
109109
font-size: 12px;
110110
font-weight: bold;
111111
`;
112-
const Main = () => (
113-
<RLM
114-
verticalSpace={10}
115-
innerWidth={500}
116-
align="center"
117-
>
118-
<EmailBlock />
119-
<TelBlock />
120-
<PasswordBlock />
121-
<BirthdayBlock />
122-
<PostalCodeBlock />
123-
<CardNumberBlock />
124-
</RLM>
125-
);
126112
const EmailBlock = () => (
127113
<RLM
128114
width={[100, '100%']}
@@ -131,9 +117,7 @@ const EmailBlock = () => (
131117
{
132118
breakpoint: 480,
133119
settings: {
134-
width: [100, '100%'],
135-
isWrap: true,
136-
horizontalSpace: 0,
120+
wrap: true,
137121
wrapVerticalSpace: 5,
138122
},
139123
},
@@ -150,6 +134,25 @@ const EmailBlock = () => (
150134
</RLM>
151135
</RLM>
152136
);
137+
const TelBlock = () => (
138+
<RLM
139+
width={[100, 160]}
140+
horizontalSpace={5}
141+
responsive={[
142+
{
143+
breakpoint: 480,
144+
settings: {
145+
width: '100%',
146+
wrap: true,
147+
wrapVerticalSpace: 5,
148+
},
149+
},
150+
]}
151+
>
152+
<Label>Tel</Label>
153+
<Input placeholder="090XXXXXXXX" />
154+
</RLM>
155+
);
153156
const PasswordBlock = () => (
154157
<RLM
155158
width={[100, 240]}
@@ -158,8 +161,8 @@ const PasswordBlock = () => (
158161
{
159162
breakpoint: 480,
160163
settings: {
161-
width: [100, '100%'],
162-
isWrap: true,
164+
width: '100%',
165+
wrap: true,
163166
wrapVerticalSpace: 5,
164167
},
165168
},
@@ -177,7 +180,7 @@ const BirthdayBlock = () => (
177180
{
178181
breakpoint: 480,
179182
settings: {
180-
isWrap: true,
183+
wrap: true,
181184
wrapVerticalSpace: 5,
182185
},
183186
},
@@ -204,26 +207,6 @@ const BirthdayBlock = () => (
204207
</RLM>
205208
</RLM>
206209
);
207-
const TelBlock = () => (
208-
<RLM
209-
width={[100, 160]}
210-
horizontalSpace={5}
211-
responsive={[
212-
{
213-
breakpoint: 480,
214-
settings: {
215-
width: [100, '100%'],
216-
isWrap: true,
217-
horizontalSpace: 0,
218-
wrapVerticalSpace: 5,
219-
},
220-
},
221-
]}
222-
>
223-
<Label>Tel</Label>
224-
<Input placeholder="090XXXXXXXX" />
225-
</RLM>
226-
);
227210
const PostalCodeBlock = () => (
228211
<RLM
229212
width={[100, '100%']}
@@ -232,7 +215,7 @@ const PostalCodeBlock = () => (
232215
{
233216
breakpoint: 480,
234217
settings: {
235-
isWrap: true,
218+
wrap: true,
236219
wrapVerticalSpace: 5,
237220
},
238221
},
@@ -265,7 +248,7 @@ const CardNumberBlock = () => (
265248
{
266249
breakpoint: 480,
267250
settings: {
268-
isWrap: true,
251+
wrap: true,
269252
wrapVerticalSpace: 5,
270253
},
271254
},
@@ -280,10 +263,9 @@ const CardNumberBlock = () => (
280263
{
281264
breakpoint: 480,
282265
settings: {
283-
width: ['100%', 10, '100%'],
284-
horizontalSpace: 0,
285-
isWrap: true,
286-
isVisible: [true, false, true],
266+
width: ['100%', null, '100%'],
267+
wrap: true,
268+
visible: [true, false, true],
287269
},
288270
},
289271
]}
@@ -308,6 +290,20 @@ const CardNumberBlock = () => (
308290
</RLM>
309291
</RLM>
310292
);
293+
const Main = () => (
294+
<RLM
295+
verticalSpace={10}
296+
innerWidth={500}
297+
align="center"
298+
>
299+
<EmailBlock />
300+
<TelBlock />
301+
<PasswordBlock />
302+
<BirthdayBlock />
303+
<PostalCodeBlock />
304+
<CardNumberBlock />
305+
</RLM>
306+
);
311307

312308
class App extends Component {
313309
render() {

config/webpack.config.prod.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ module.exports = {
260260
// CRL: added externals block for library
261261
externals: {
262262
'react': 'react',
263-
'react-dom': 'react-dom'
263+
'react-dom': 'react-dom',
264+
'styled-components': 'styled-components',
264265
},
265266
// Some libraries import Node modules but don't use them in the browser.
266267
// Tell Webpack to provide empty mocks for them so importing them works.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-layout-manager",
3-
"version": "0.1.3",
3+
"version": "0.1.5",
44
"description": "Layout manager not to give margins to components",
55
"homepage": "http://osamu38.github.io/react-layout-manager",
66
"bugs": {

src/demo/App.js

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ const EmailBlock = () => (
4747
{
4848
breakpoint: 480,
4949
settings: {
50-
width: [100, '100%'],
51-
isWrap: true,
52-
horizontalSpace: 0,
50+
wrap: true,
5351
wrapVerticalSpace: 5,
5452
},
5553
},
@@ -66,6 +64,25 @@ const EmailBlock = () => (
6664
</RLM>
6765
</RLM>
6866
);
67+
const TelBlock = () => (
68+
<RLM
69+
width={[100, 160]}
70+
horizontalSpace={5}
71+
responsive={[
72+
{
73+
breakpoint: 480,
74+
settings: {
75+
width: '100%',
76+
wrap: true,
77+
wrapVerticalSpace: 5,
78+
},
79+
},
80+
]}
81+
>
82+
<Label>Tel</Label>
83+
<Input placeholder="090XXXXXXXX" />
84+
</RLM>
85+
);
6986
const PasswordBlock = () => (
7087
<RLM
7188
width={[100, 240]}
@@ -74,8 +91,8 @@ const PasswordBlock = () => (
7491
{
7592
breakpoint: 480,
7693
settings: {
77-
width: [100, '100%'],
78-
isWrap: true,
94+
width: '100%',
95+
wrap: true,
7996
wrapVerticalSpace: 5,
8097
},
8198
},
@@ -93,7 +110,7 @@ const BirthdayBlock = () => (
93110
{
94111
breakpoint: 480,
95112
settings: {
96-
isWrap: true,
113+
wrap: true,
97114
wrapVerticalSpace: 5,
98115
},
99116
},
@@ -120,26 +137,6 @@ const BirthdayBlock = () => (
120137
</RLM>
121138
</RLM>
122139
);
123-
const TelBlock = () => (
124-
<RLM
125-
width={[100, 160]}
126-
horizontalSpace={5}
127-
responsive={[
128-
{
129-
breakpoint: 480,
130-
settings: {
131-
width: [100, '100%'],
132-
isWrap: true,
133-
horizontalSpace: 0,
134-
wrapVerticalSpace: 5,
135-
},
136-
},
137-
]}
138-
>
139-
<Label>Tel</Label>
140-
<Input placeholder="090XXXXXXXX" />
141-
</RLM>
142-
);
143140
const PostalCodeBlock = () => (
144141
<RLM
145142
width={[100, '100%']}
@@ -148,7 +145,7 @@ const PostalCodeBlock = () => (
148145
{
149146
breakpoint: 480,
150147
settings: {
151-
isWrap: true,
148+
wrap: true,
152149
wrapVerticalSpace: 5,
153150
},
154151
},
@@ -181,7 +178,7 @@ const CardNumberBlock = () => (
181178
{
182179
breakpoint: 480,
183180
settings: {
184-
isWrap: true,
181+
wrap: true,
185182
wrapVerticalSpace: 5,
186183
},
187184
},
@@ -196,10 +193,9 @@ const CardNumberBlock = () => (
196193
{
197194
breakpoint: 480,
198195
settings: {
199-
width: ['100%', 10, '100%'],
200-
horizontalSpace: 0,
201-
isWrap: true,
202-
isVisible: [true, false, true],
196+
width: ['100%', null, '100%'],
197+
wrap: true,
198+
visible: [true, false, true],
203199
},
204200
},
205201
]}

src/lib/components/ReactLayoutManager.jsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ import LayoutManagerChildInner from './LayoutManagerChildInner';
1212

1313
export default class ReactLayoutManager extends Component {
1414
static defaultProps = {
15+
children: null,
1516
horizontalSpace: 0,
17+
verticalSpace: 0,
1618
wrapVerticalSpace: 0,
17-
align: null,
18-
children: null,
19-
width: 0,
20-
innerWidth: 0,
19+
width: null,
20+
innerWidth: null,
2121
verticalAlign: null,
22-
isVisible: true,
23-
isWrap: false,
22+
align: null,
23+
visible: true,
24+
wrap: false,
25+
responsive: [],
2426
}
2527
render() {
2628
const {
@@ -31,10 +33,10 @@ export default class ReactLayoutManager extends Component {
3133
width,
3234
innerWidth,
3335
verticalAlign,
34-
responsive,
3536
align,
36-
isVisible,
37-
isWrap,
37+
visible,
38+
wrap,
39+
responsive,
3840
} = this.props;
3941
const parseWidth = parsePropertyToNumber(width);
4042
const parseHorizontalSpace = parsePropertyToNumber(horizontalSpace);
@@ -62,8 +64,8 @@ export default class ReactLayoutManager extends Component {
6264
parseVerticalSpace,
6365
wrapVerticalSpace,
6466
parseVerticalAlign,
65-
isVisible,
66-
isWrap,
67+
visible,
68+
wrap,
6769
childrenLength,
6870
isLastChild,
6971
i,

0 commit comments

Comments
 (0)