mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 09:35:56 -05:00
Add progress indicators
This commit is contained in:
parent
1fba322d01
commit
e062096445
4 changed files with 69 additions and 41 deletions
|
@ -1,44 +1,28 @@
|
||||||
var classNames = require('classnames');
|
var classNames = require('classnames');
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
|
|
||||||
module.exports = {
|
require('./stepnavigation.scss');
|
||||||
StepNavigationIndicator: React.createClass({
|
|
||||||
type: 'StepNavigationIndicator',
|
var StepNavigation = React.createClass({
|
||||||
propTypes: {
|
type: 'Navigation',
|
||||||
selected: React.PropTypes.bool,
|
render: function () {
|
||||||
active: React.PropTypes.bool
|
return (
|
||||||
},
|
<ul className={classNames('step-navigation', this.props.className)}>
|
||||||
getDefaultProps: function () {
|
{Array.apply(null, Array(this.props.steps)).map(function (v, step) {
|
||||||
return {
|
return (
|
||||||
selected: false,
|
<li key={step}
|
||||||
active: false
|
className={classNames({
|
||||||
};
|
active: step < this.props.active,
|
||||||
},
|
selected: step === this.props.active
|
||||||
render: function () {
|
})}
|
||||||
var classes = classNames(
|
>
|
||||||
'indicator',
|
<div className="indicator" />
|
||||||
{
|
</li>
|
||||||
'selected': this.props.selected,
|
);
|
||||||
'active': this.props.selected
|
}.bind(this))}
|
||||||
},
|
</ul>
|
||||||
this.props.className
|
);
|
||||||
);
|
}
|
||||||
return (
|
});
|
||||||
<li {... this.props} className={classes} />
|
|
||||||
);
|
module.exports = StepNavigation;
|
||||||
}
|
|
||||||
}),
|
|
||||||
StepNavigation: React.createClass({
|
|
||||||
type: 'Navigation',
|
|
||||||
render: function () {
|
|
||||||
var classes = classNames(
|
|
||||||
'step-navigation',
|
|
||||||
this.props.className);
|
|
||||||
return (
|
|
||||||
<ul className={classes}>
|
|
||||||
{this.props.children}
|
|
||||||
</ul>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
31
src/components/stepnavigation/stepnavigation.scss
Normal file
31
src/components/stepnavigation/stepnavigation.scss
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
@import "../../colors";
|
||||||
|
@import "../../frameless";
|
||||||
|
|
||||||
|
.step-navigation {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 8px / $em;
|
||||||
|
padding: 4px / $em;
|
||||||
|
|
||||||
|
.indicator {
|
||||||
|
border-radius: 4px / $em;
|
||||||
|
background-color: $ui-white;
|
||||||
|
width: 8px / $em;
|
||||||
|
height: 8px / $em;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
.indicator {
|
||||||
|
background-color: $ui-aqua;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.selected {
|
||||||
|
border: 1px solid $ui-white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ var RadioGroup = require('../../components/forms/radio-group.jsx');
|
||||||
var Select = require('../../components/forms/select.jsx');
|
var Select = require('../../components/forms/select.jsx');
|
||||||
var Slide = require('../../components/slide/slide.jsx');
|
var Slide = require('../../components/slide/slide.jsx');
|
||||||
var Spinner = require('../../components/spinner/spinner.jsx');
|
var Spinner = require('../../components/spinner/spinner.jsx');
|
||||||
|
var StepNavigation = require('../../components/stepnavigation/stepnavigation.jsx');
|
||||||
var TextArea = require('../../components/forms/textarea.jsx');
|
var TextArea = require('../../components/forms/textarea.jsx');
|
||||||
|
|
||||||
var DEFAULT_COUNTRY = 'us';
|
var DEFAULT_COUNTRY = 'us';
|
||||||
|
@ -124,6 +125,7 @@ module.exports = {
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
||||||
</Slide>
|
</Slide>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -200,6 +202,7 @@ module.exports = {
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
||||||
</Slide>
|
</Slide>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -230,6 +233,7 @@ module.exports = {
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
||||||
</Slide>
|
</Slide>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -268,6 +272,7 @@ module.exports = {
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
||||||
</Slide>
|
</Slide>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -341,6 +346,7 @@ module.exports = {
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
||||||
</Slide>
|
</Slide>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -451,6 +457,7 @@ module.exports = {
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
||||||
</Slide>
|
</Slide>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -476,6 +483,7 @@ module.exports = {
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
||||||
</Slide>
|
</Slide>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -512,6 +520,7 @@ module.exports = {
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
||||||
</Slide>
|
</Slide>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.step-navigation {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.demographics-checkbox-is-robot {
|
.demographics-checkbox-is-robot {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue