-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add radio,checkbox,select w/o testand doc
- Loading branch information
Showing
8 changed files
with
230 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Created by n7best on 16/2/25. | ||
*/ | ||
|
||
|
||
|
||
import React, { Component, PropTypes } from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
export default class Checkbox extends React.Component { | ||
|
||
render() { | ||
const { className, ...others } = this.props; | ||
const cls = classNames({ | ||
weui_check: true, | ||
[className]: className | ||
}); | ||
|
||
return ( | ||
<div> | ||
<input className={cls} type="checkbox" {...others}/> | ||
<i className="weui_icon_checked"></i> | ||
</div> | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Created by n7best on 16/2/25. | ||
*/ | ||
|
||
|
||
|
||
import React, { Component, PropTypes } from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
export default class Radio extends React.Component { | ||
|
||
render() { | ||
const { className, ...others } = this.props; | ||
const cls = classNames({ | ||
weui_check: true, | ||
[className]: className | ||
}); | ||
|
||
return ( | ||
<div> | ||
<input className={cls} type="radio" {...others}/> | ||
<span className="weui_icon_checked"></span> | ||
</div> | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Created by n7best on 16/2/25. | ||
*/ | ||
|
||
|
||
|
||
import React, { Component, PropTypes } from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
export default class Select extends React.Component { | ||
static propTypes = { | ||
data: React.PropTypes.array | ||
}; | ||
|
||
static defaultProps = { | ||
data: [] | ||
}; | ||
|
||
renderData(data) { | ||
return data.map((item,i) => { | ||
return <option | ||
key={i} | ||
value={item.value} | ||
{...item} | ||
> | ||
{item.label} | ||
</option>; | ||
}); | ||
} | ||
|
||
render() { | ||
const { className, data, children, ...others } = this.props; | ||
const cls = classNames({ | ||
weui_select: true, | ||
[className]: className | ||
}); | ||
|
||
return ( | ||
<select className={cls} {...others}> | ||
{data.length > 0 ? this.renderData(data) : children} | ||
</select> | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters