Skip to content

Commit

Permalink
Merge pull request #619 from codaco/fix/form-wizard-styling
Browse files Browse the repository at this point in the history
Emphasize form wizard pips
  • Loading branch information
bryfox authored Aug 1, 2018
2 parents cf47a8a + 3b66e71 commit 522e307
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/components/Pips.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
*/
const Pips = (props) => {
const {
large,
count,
currentIndex,
} = props;
Expand All @@ -17,8 +18,10 @@ const Pips = (props) => {
pips.push(<div key={index} className={classes} />);
}

const className = `pips ${large ? 'pips--large' : ''}`;

return (
<div className="pips">
<div className={className}>
<div className="pips__pips">
{ pips }
</div>
Expand All @@ -27,13 +30,15 @@ const Pips = (props) => {
};

Pips.propTypes = {
large: PropTypes.bool,
count: PropTypes.number,
currentIndex: PropTypes.number,
};

Pips.defaultProps = {
count: 0,
currentIndex: 0,
large: false,
};

export default Pips;
2 changes: 1 addition & 1 deletion src/containers/FormWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class FormWizard extends Component {
return (
<div className="form-wizard">
<div className="form-wizard__pips">
<Pips count={this.shownFields().length} currentIndex={this.state.fieldIndex} />
<Pips count={this.shownFields().length} currentIndex={this.state.fieldIndex} large />
</div>
<div className="form-wizard__previous">
{this.state.fieldIndex !== 0 && <Icon name="form-arrow-left" onClick={this.previousField} />}
Expand Down
10 changes: 10 additions & 0 deletions src/containers/__tests__/__snapshots__/PromptSwiper.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ShallowWrapper {
<Pips
count={2}
currentIndex={0}
large={false}
/>
</div>
<div
Expand Down Expand Up @@ -84,6 +85,7 @@ ShallowWrapper {
<Pips
count={2}
currentIndex={0}
large={false}
/>
</div>
<div
Expand Down Expand Up @@ -117,6 +119,7 @@ ShallowWrapper {
<Pips
count={2}
currentIndex={0}
large={false}
/>
</div>,
<div
Expand Down Expand Up @@ -146,6 +149,7 @@ ShallowWrapper {
"children": <Pips
count={2}
currentIndex={0}
large={false}
/>,
"className": "prompts__pips",
},
Expand All @@ -157,6 +161,7 @@ ShallowWrapper {
"props": Object {
"count": 2,
"currentIndex": 0,
"large": false,
},
"ref": null,
"rendered": null,
Expand Down Expand Up @@ -243,6 +248,7 @@ ShallowWrapper {
<Pips
count={2}
currentIndex={0}
large={false}
/>
</div>
<div
Expand Down Expand Up @@ -280,6 +286,7 @@ ShallowWrapper {
<Pips
count={2}
currentIndex={0}
large={false}
/>
</div>
<div
Expand Down Expand Up @@ -313,6 +320,7 @@ ShallowWrapper {
<Pips
count={2}
currentIndex={0}
large={false}
/>
</div>,
<div
Expand Down Expand Up @@ -342,6 +350,7 @@ ShallowWrapper {
"children": <Pips
count={2}
currentIndex={0}
large={false}
/>,
"className": "prompts__pips",
},
Expand All @@ -353,6 +362,7 @@ ShallowWrapper {
"props": Object {
"count": 2,
"currentIndex": 0,
"large": false,
},
"ref": null,
"rendered": null,
Expand Down
17 changes: 16 additions & 1 deletion src/styles/components/_pips.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.pips {
$block: pips;

.#{$block} {
$pip-size: 10px;
$large-pip-size: 15px;

&__pips {
height: $pip-size;
Expand Down Expand Up @@ -27,4 +30,16 @@
background-color: palette('light-background');
}
}

&--large {
.#{$block}__pip {
border: 1px solid var(--primary);
height: $large-pip-size;
width: $large-pip-size;

&--active {
background-color: var(--primary);
}
}
}
}

0 comments on commit 522e307

Please sign in to comment.