UNPKG

chowa

Version:

UI component library based on React

42 lines (41 loc) 1.77 kB
/** * @license chowa v1.1.3 * * Copyright (c) Chowa Techonlogies Co.,Ltd.(http://www.chowa.cn). * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const PropTypes = require("prop-types"); const classnames_1 = require("classnames"); const utils_1 = require("../utils"); const TimelineItem = (props) => { const { children, className, style, icon, placement, color } = props; const componentClass = classnames_1.default({ [utils_1.preClass('timeline-item')]: true, [utils_1.preClass('timeline-item-with-icon')]: utils_1.isExist(icon), [utils_1.preClass(`timeline-item-${placement}`)]: true, [className]: utils_1.isExist(className) }); return (React.createElement("li", { className: componentClass, style: style }, React.createElement("div", { className: utils_1.preClass('timeline-item-header') }, icon && React.createElement("span", { className: utils_1.preClass('timeline-item-icon'), style: color ? { color } : null }, icon), !icon && React.createElement("span", { className: utils_1.preClass('timeline-item-dot'), style: color ? { backgroundColor: color } : null })), React.createElement("div", { className: utils_1.preClass('timeline-item-content') }, children))); }; TimelineItem.propTypes = { className: PropTypes.string, style: PropTypes.object, icon: PropTypes.node, color: PropTypes.string, placement: PropTypes.oneOf(['left', 'right']) }; TimelineItem.defaultProps = { placement: 'left' }; exports.default = TimelineItem;