zarm-web
Version:
基于 React 的桌面端UI库
40 lines (37 loc) • 870 B
JavaScript
import React, { Component } from 'react';
import cn from 'classnames';
import Icon from '../icon';
class Option extends Component {
render() {
const {
children,
checked,
disabled,
onDoubleClick,
showCheckIcon,
onChange
} = this.props;
const cls = cn({
'za-option__list': true,
'is-checked': checked,
'is-disabled': disabled
});
return React.createElement("li", {
className: cls,
style: {
paddingRight: showCheckIcon ? 25 : 10
},
onClick: e => onChange && onChange(e),
onDoubleClick: onDoubleClick
}, children, showCheckIcon && checked && React.createElement(Icon, {
className: "checked-icon",
theme: "primary",
type: "right"
}));
}
}
Option.defaultProps = {
isDisabled: false,
onChange: () => {}
};
export default Option;