-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove ability to navigate through steps and re-style navig…
…ation bar
- Loading branch information
1 parent
293fa5f
commit 412ca6e
Showing
3 changed files
with
42 additions
and
43 deletions.
There are no files selected for viewing
53 changes: 25 additions & 28 deletions
53
assets/src/js/admin/onboarding-wizard/components/step-link/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,46 @@ | ||
// Import vendor dependencies | ||
import PropTypes from 'prop-types'; | ||
import cx from 'classnames'; | ||
|
||
// Import store dependencies | ||
import { useStoreValue } from '../../app/store'; | ||
import {useStoreValue} from '../../app/store'; | ||
|
||
// Import utilities | ||
import { goToStep } from '../../app/store/actions'; | ||
|
||
// Import components | ||
import Checkmark from '../checkmark'; | ||
|
||
// Import styles | ||
import './style.scss'; | ||
|
||
const StepLink = ( { title, stepNumber } ) => { | ||
const [ { currentStep }, dispatch ] = useStoreValue(); | ||
const progressBarStyle = { | ||
width: currentStep <= stepNumber ? '0%' : '100%', | ||
}; | ||
|
||
return ( | ||
<div className="give-obw-step-link" data-givewp-test="navigation-step"> | ||
<button className="give-obw-step-button" onClick={ () => dispatch( goToStep( stepNumber ) ) }> | ||
<div className={ `give-obw-step-icon${ currentStep >= stepNumber ? ' give-obw-step-icon--green' : '' }` }> | ||
{ currentStep <= stepNumber ? stepNumber : <Checkmark index={ stepNumber } /> } | ||
</div> | ||
<div className="give-obw-step-title"> | ||
{ title } | ||
</div> | ||
</button> | ||
<div className="give-obw-step-progress"> | ||
<div className="give-obw-step-progress-bar" style={ progressBarStyle }></div> | ||
</div> | ||
</div> | ||
); | ||
const StepLink = ({title, stepNumber}) => { | ||
const [{currentStep}, dispatch] = useStoreValue(); | ||
const progressBarStyle = { | ||
width: currentStep <= stepNumber ? '0%' : '100%', | ||
}; | ||
|
||
return ( | ||
<div className="give-obw-step-link" data-givewp-test="navigation-step"> | ||
<div className={cx('give-obw-step-button', {'give-obw-step-button--current': currentStep === stepNumber})}> | ||
<div className={cx('give-obw-step-icon', {'give-obw-step-icon--done': currentStep > stepNumber})}> | ||
{currentStep <= stepNumber ? stepNumber : <Checkmark index={stepNumber} />} | ||
</div> | ||
<div className="give-obw-step-title">{title}</div> | ||
</div> | ||
<div className="give-obw-step-progress"> | ||
<div className="give-obw-step-progress-bar" style={progressBarStyle}></div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
StepLink.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
stepNumber: PropTypes.number.isRequired, | ||
title: PropTypes.string.isRequired, | ||
stepNumber: PropTypes.number.isRequired, | ||
}; | ||
|
||
StepLink.defaultProps = { | ||
title: null, | ||
stepNumber: null, | ||
title: null, | ||
stepNumber: null, | ||
}; | ||
|
||
export default StepLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ | |
display: flex; | ||
align-items: center; | ||
margin: 10px 40px; | ||
gap: 20px; | ||
} |