import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Card, CardBody, Progress } from 'reactstrap'; import classNames from 'classnames'; import { mapToCssModules } from 'reactstrap/lib/utils'; const propTypes = { header: PropTypes.string, mainText: PropTypes.string, smallText: PropTypes.string, color: PropTypes.string, value: PropTypes.string, children: PropTypes.node, className: PropTypes.string, cssModule: PropTypes.object, variant: PropTypes.string, }; const defaultProps = { header: '89.9%', mainText: 'Lorem ipsum...', smallText: 'Lorem ipsum dolor sit amet enim.', value: '25', variant: '', }; class Widget01 extends Component { render() { const { className, cssModule, header, mainText, smallText, color, value, children, variant, ...attributes } = this.props; const progress = { style: '', color: color, value: value }; const card = { style: '', bgColor: '' }; if (variant === 'inverse') { progress.style = 'progress-white'; progress.color = ''; card.style = 'text-white'; card.bgColor = 'bg-' + color; } const classes = mapToCssModules(classNames(className, card.style, card.bgColor), cssModule); progress.style = classNames('progress-xs my-3', progress.style); return (
{header}
{mainText}
{smallText}
{children}
); } } Widget01.propTypes = propTypes; Widget01.defaultProps = defaultProps; export default Widget01;