Skip to content

Commit 1a75823

Browse files
committed
add size option to circle component
1 parent bb91772 commit 1a75823

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/components/Circle/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ import './style.css'
44

55
export default class Circle extends Component {
66
render() {
7-
return <div className="lds-circle" style={{ background: this.props.color }}></div>
7+
const { color, size } = this.props;
8+
return <div className="lds-circle" style={{ background: color, width: size, height: size }}></div>
89
}
910
}
1011

1112
Circle.propTypes = {
1213
/** hex color */
1314
color: PropTypes.string,
15+
/** size in pixel */
16+
size: PropTypes.number,
1417
}
1518

1619
Circle.defaultProps = {
1720
color: '#7f58af',
21+
size: 64,
1822
}

src/components/Circle/style.css

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
.lds-circle {
22
display: inline-block;
3-
width: 64px;
4-
height: 64px;
53
margin: 8px;
64
border-radius: 50%;
75
animation: lds-circle 2.4s cubic-bezier(0, 0.2, 0.8, 1) infinite;

0 commit comments

Comments
 (0)