-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add Previous button to steps
- Loading branch information
1 parent
412ca6e
commit f1d92ed
Showing
15 changed files
with
149 additions
and
35 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -58,8 +58,4 @@ | |
text-align: center; | ||
} | ||
} | ||
|
||
> .give-obw-button { | ||
margin-top: 52px; | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -49,8 +49,4 @@ | |
text-align: center; | ||
} | ||
} | ||
|
||
> .give-obw-button { | ||
margin-top: 52px; | ||
} | ||
} |
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
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
27 changes: 15 additions & 12 deletions
27
assets/src/js/admin/onboarding-wizard/components/button/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,27 +1,30 @@ | ||
// Import vendor dependencies | ||
import PropTypes from 'prop-types'; | ||
import cx from 'classnames'; | ||
|
||
// Import styles | ||
import './style.scss'; | ||
|
||
const Button = ( { onClick, testId, children } ) => { | ||
return ( | ||
<button className="give-obw-button" data-givewp-test={ testId } onClick={ onClick }> | ||
{ children } | ||
</button> | ||
); | ||
const Button = ({className, onClick, testId, children}) => { | ||
return ( | ||
<button className={cx('give-obw-button', className)} data-givewp-test={testId} onClick={onClick}> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
Button.propTypes = { | ||
onClick: PropTypes.func, | ||
testId: PropTypes.string, | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
onClick: PropTypes.func, | ||
testId: PropTypes.string, | ||
children: PropTypes.node, | ||
}; | ||
|
||
Button.defaultProps = { | ||
onClick: null, | ||
testId: null, | ||
children: null, | ||
className: null, | ||
onClick: null, | ||
testId: null, | ||
children: null, | ||
}; | ||
|
||
export default Button; |
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
13 changes: 8 additions & 5 deletions
13
assets/src/js/admin/onboarding-wizard/components/icons/chevron/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,9 +1,12 @@ | ||
const Chevron = () => { | ||
return ( | ||
<svg width="8" height="13" viewBox="0 0 8 13" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M7.07257 7.21484C7.31866 6.96875 7.31866 6.55859 7.07257 6.3125L1.76788 0.980469C1.49445 0.734375 1.08429 0.734375 0.838196 0.980469L0.20929 1.60938C-0.0368042 1.85547 -0.0368042 2.26562 0.20929 2.53906L4.42023 6.75L0.20929 10.9883C-0.0368042 11.2617 -0.0368042 11.6719 0.20929 11.918L0.838196 12.5469C1.08429 12.793 1.49445 12.793 1.76788 12.5469L7.07257 7.21484Z" fill="white" /> | ||
</svg> | ||
); | ||
return ( | ||
<svg width="8" height="13" viewBox="0 0 8 13" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
d="M7.07257 7.21484C7.31866 6.96875 7.31866 6.55859 7.07257 6.3125L1.76788 0.980469C1.49445 0.734375 1.08429 0.734375 0.838196 0.980469L0.20929 1.60938C-0.0368042 1.85547 -0.0368042 2.26562 0.20929 2.53906L4.42023 6.75L0.20929 10.9883C-0.0368042 11.2617 -0.0368042 11.6719 0.20929 11.918L0.838196 12.5469C1.08429 12.793 1.49445 12.793 1.76788 12.5469L7.07257 7.21484Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default Chevron; |
53 changes: 53 additions & 0 deletions
53
assets/src/js/admin/onboarding-wizard/components/previous-button/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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Import vendor dependencies | ||
import PropTypes from 'prop-types'; | ||
import {__} from '@wordpress/i18n'; | ||
|
||
// Import store dependencies | ||
import {useStoreValue} from '../../app/store'; | ||
import {goToStep} from '../../app/store/actions'; | ||
|
||
// Import utilities | ||
// Import components | ||
import Button from '../button'; | ||
import Chevron from '../icons/chevron'; | ||
|
||
// Import styles | ||
import './style.scss'; | ||
|
||
const PreviousButton = ({label, testId, clickCallback}) => { | ||
const [{currentStep}, dispatch] = useStoreValue(); | ||
|
||
if (currentStep === 0) { | ||
return; | ||
} | ||
|
||
return ( | ||
<Button | ||
className="give-obw-button--reverse give-obw-button--secondary" | ||
testId={testId} | ||
onClick={() => { | ||
clickCallback(); | ||
dispatch(goToStep(currentStep - 1)); | ||
}} | ||
> | ||
{label} | ||
<span className="give-obw-previous-button__icon"> | ||
<Chevron /> | ||
</span> | ||
</Button> | ||
); | ||
}; | ||
|
||
PreviousButton.propTypes = { | ||
label: PropTypes.string, | ||
testId: PropTypes.string, | ||
clickCallback: PropTypes.func, | ||
}; | ||
|
||
PreviousButton.defaultProps = { | ||
label: __('Previous', 'give'), | ||
testId: null, | ||
clickCallback: () => {}, | ||
}; | ||
|
||
export default PreviousButton; |
8 changes: 8 additions & 0 deletions
8
assets/src/js/admin/onboarding-wizard/components/previous-button/style.scss
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.give-obw-button { | ||
cursor: pointer; | ||
transition: 200ms all ease; | ||
} | ||
.give-obw-previous-button__icon { | ||
margin: 0 14px 0 0; | ||
rotate: 180deg; | ||
} |
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 |
---|---|---|
|
@@ -46,4 +46,8 @@ | |
font-weight: 400; | ||
} | ||
} | ||
|
||
.givewp-select__control { | ||
width: 100%; | ||
} | ||
} |
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