Skip to content

Commit

Permalink
Merge pull request #2 from weui/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
n7best committed Feb 25, 2016
2 parents ae3e4f4 + 7e6e7d1 commit 03ae5b4
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 20 deletions.
7 changes: 5 additions & 2 deletions example/component/page.less
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@

html, body, .container {
height: 100%;
overflow: hidden;
}

body {
background-color: #FBF9FE;
}

.container{
overflow: hidden;
}

.page {
position: absolute;
top: 0;
Expand Down Expand Up @@ -79,4 +82,4 @@ body {
opacity: 0.01;
transform: translate3d(100%, 0, 0);
}
}
}
13 changes: 12 additions & 1 deletion example/pages/cell/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import { ButtonArea,
Icon,
Input,
Label,
TextArea
TextArea,
Switch
} from '../../../src/index';
import Page from '../../component/page';
import iconSrc from './images/icon.png';
Expand Down Expand Up @@ -114,6 +115,16 @@ export default class CellDemo extends React.Component {
</Cell>
</Cells>

<CellsTitle>开关</CellsTitle>
<Form>
<FormCell switch>
<CellBody>标题文字</CellBody>
<CellFooter>
<Switch/>
</CellFooter>
</FormCell>
</Form>

<Form>
<FormCell>
<CellHeader>
Expand Down
7 changes: 4 additions & 3 deletions src/components/form/form_cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ export default class FormCell extends React.Component {
};

render() {
const { className, children, vcode, warn, ...others } = this.props;
const { className, children, ...others } = this.props;
const cls = classNames({
weui_cell: true,
weui_vcode: vcode,
weui_cell_warn: warn,
weui_vcode: this.props.vcode,
weui_cell_warn: this.props.warn,
weui_cell_switch: this.props.switch,
[className]: className
});

Expand Down
8 changes: 6 additions & 2 deletions src/components/form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
import Form from './form';
import FormCell from './form_cell';
import TextArea from './textarea';
import Input from './input';
import Switch from './switch';

export default {
Form,
FormCell,
TextArea
};
TextArea,
Input,
Switch
};
File renamed without changes.
30 changes: 30 additions & 0 deletions src/components/form/switch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Created by BearJ on 16/2/18.
*/



import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';

export default class Switch extends React.Component {
static propTypes = {
defaultValue: PropTypes.string
};

static defaultProps = {
defaultValue: undefined
};

render() {
const { className, ...others } = this.props;
const cls = classNames({
weui_switch: true,
[className]: className
});

return (
<input className={cls} type="checkbox" {...others}/>
);
}
};
9 changes: 0 additions & 9 deletions src/components/input/index.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import {Button, ButtonArea} from './components/button/index';
import {Cells, CellsTitle, CellsTips, Cell, CellHeader, CellBody, CellFooter} from './components/cell/index';
import Mask from './components/mask/index';
import {Form, FormCell, TextArea} from './components/form/index';
import Input from './components/input/index';
import {Form, FormCell, TextArea, Input, Switch} from './components/form/index';
import Label from './components/label/index';
import Toast from './components/toast/index';
import Progress from './components/progress/index';
Expand All @@ -32,6 +31,7 @@ export default {
FormCell,
Input,
TextArea,
Switch,
Label,
Toast,
Progress,
Expand All @@ -44,4 +44,4 @@ export default {
Grid,
GridIcon,
GridLabel
};
};

0 comments on commit 03ae5b4

Please sign in to comment.