Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- PAT
- 클라우드
- Docker-compose
- 실습
- 개념
- kubernetes
- OpenStack
- IaaS
- nodejs
- git
- 용어정리
- Javascript
- 도커
- RAPA
- network
- 명령어
- mysql
- gns3
- PaaS
- MongoDB
- node.js
- 네트워크
- 쿠버네티스
- docker
- worker
- Docker Swarm
- dockerfile
- 이론
- RAID
- express
Archives
- Today
- Total
융융이'Blog
ProTypes 사용 예시 본문
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.oneOfType([
PropTypes.number,
PropTypes.string
]),
icon: PropTypes.string,
color: PropTypes.string,
value: PropTypes.string,
children: PropTypes.node,
className: PropTypes.string,
cssModule: PropTypes.object,
invert: PropTypes.bool,
};
const defaultProps = {
header: '0',
icon: 'icon-people',
color: 'info',
value: '25',
children: 'Visitors',
invert: false,
};
class Widget04 extends Component {
render() {
const { className, cssModule, header, icon, color, value, children, invert, ...attributes } = this.props;
// demo purposes only
const progress = { style: '', color: color, value: value };
const card = { style: '', bgColor: '', icon: icon };
if (invert) {
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 mt-3 mb-0', progress.style);
return (
<Card className={classes} {...attributes}>
<CardBody>
<div className="h1 text-muted text-right mb-2">
<i className={card.icon}></i>
</div>
<div className="h4 mb-0">{header}</div>
<small className="text-muted text-uppercase font-weight-bold">{children}</small>
<Progress className={progress.style} color={progress.color} value={progress.value} />
</CardBody>
</Card>
);
}
}
Widget04.propTypes = propTypes;
Widget04.defaultProps = defaultProps;
export default Widget04;
'2022이전 > React' 카테고리의 다른 글
Axios.post에 headers 추가하기 (0) | 2020.02.19 |
---|---|
React event.Target.value가 undefined 나올때 (0) | 2020.02.18 |
handleChange 간단하게 구현하기(State, setState이용) (0) | 2020.02.17 |
리액트+FireBase 연동 디플로이(react & firebase deploy) (0) | 2020.02.15 |
REACT_FRONT_END 의 폴더구성 (0) | 2020.02.03 |