Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions example/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
import React, { Component, PropTypes } from 'react';
import s from './style.scss';
import ProgressTemplate from './ProgressTemplate';
import './style.scss';
import React, { Component, PropTypes } from 'react'
import s from './style.scss'
import ProgressTemplate from './ProgressTemplate'
import './style.scss'

export default class App extends Component {
render() {
render () {
return (
<div className={s.root}>
<div className={s.h1}>React Sweet Progress</div>
<div className={s.h2}>https://github.com/abraztsov/react-sweet-progress</div>
<div className={s.circles}>

<ProgressTemplate
percent={100}
type="circle"
/>
type='circle'
theme={{
active: {
color: 'red',
outlineColor: 'orange'
}
}}
/>
<ProgressTemplate
type="circle"
type='circle'
theme={{
success: {
symbol: '🤰',
Expand All @@ -32,16 +39,16 @@ export default class App extends Component {
/>
<ProgressTemplate
percent={100}
type="circle"
status="error"
type='circle'
status='error'
strokeWidth={3}
/>
</div>
<ProgressTemplate
percent={70}
/>
<ProgressTemplate
status="error"
status='error'
percent={40}
/>
<ProgressTemplate
Expand Down
41 changes: 34 additions & 7 deletions example/ProgressTemplate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component, PropTypes } from 'react';
import { Progress } from '../src';
import React, {Component, PropTypes} from 'react';
import {Progress} from '../src';
import './style.scss';

export default class ProgressTemplate extends Component {
Expand All @@ -12,16 +12,29 @@ export default class ProgressTemplate extends Component {
}

onDecClick = () => {
this.setState({ percent: this.state.percent - 10 > 0 ? this.state.percent - 10 : 0 });
this.setState({
percent: this.state.percent - 10 > 0
? this.state.percent - 10
: 0
});
}

onIncClick = () => {
this.setState({ percent: this.state.percent + 10 < 100 ? this.state.percent + 10 : 100 });
this.setState({
percent: this.state.percent + 10 < 100
? this.state.percent + 10
: 100
});
}

render() {
return (
<div style={{ display: 'flex', alignItems: 'center', margin: '0 0 20px 0' }}>
<div
style={{
display: 'flex',
alignItems: 'center',
margin: '0 0 20px 0'
}}>
<button onClick={this.onDecClick}>-</button>
<button onClick={this.onIncClick}>+</button>
<Progress
Expand All @@ -31,8 +44,22 @@ export default class ProgressTemplate extends Component {
type={this.props.type}
width={this.props.width}
strokeWidth={this.props.strokeWidth}
style={{ margin: '0 0 0 10px' }}
/>
style={{
circle: {
margin: '0 0 0 10px',
color: 'black'
},
value:{

'margin-right':'2px',
'font-size':'40px'
},
percent:{
'font-size':'20px',
'position':'relative',
'top':'10px'
}
}}/>
</div>
)
}
Expand Down
Loading