diff --git a/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/EditChallenge.js b/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/EditChallenge.js index 15ff1f665..3aac6d51e 100644 --- a/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/EditChallenge.js +++ b/src/components/AdminPane/Manage/ManageChallenges/EditChallenge/EditChallenge.js @@ -10,7 +10,8 @@ import _get from 'lodash/get' import { FormattedMessage, injectIntl } from 'react-intl' import { Link } from 'react-router-dom' import Steps from '../../../../Bulma/Steps' -import StepNavigation from '../../../../Bulma/StepNavigation' +import StepNavigation + from '../../../../Bulma/StepNavigation/StepNavigation' import { CustomFieldTemplate, MarkdownDescriptionField } from '../../../../Bulma/RJSFFormFieldAdapter/RJSFFormFieldAdapter' @@ -141,6 +142,13 @@ export class EditChallenge extends Component { } } + cancel = () => { + _isObject(this.props.challenge) ? + this.props.history.push( + `/admin/project/${this.props.project.id}/challenge/${this.props.challenge.id}`) : + this.props.history.push(`/admin/project/${this.props.project.id}`) + } + /** Receive updates to the form data, along with any validation errors */ changeHandler = ({formData, errors}) => { this.setState({ @@ -292,7 +300,7 @@ export class EditChallenge extends Component { + finish={this.finish} cancel={this.cancel} /> ) } diff --git a/src/components/AdminPane/Manage/ManageProjects/EditProject/EditProject.js b/src/components/AdminPane/Manage/ManageProjects/EditProject/EditProject.js index 4e41dccc6..497f8e0e1 100644 --- a/src/components/AdminPane/Manage/ManageProjects/EditProject/EditProject.js +++ b/src/components/AdminPane/Manage/ManageProjects/EditProject/EditProject.js @@ -46,6 +46,12 @@ export class EditProject extends Component { } } + cancel = () => { + _isObject(this.props.project) ? + this.props.history.push(`/admin/project/${this.props.project.id}`) : + this.props.history.push('/admin/manage') + } + render() { const projectData = _merge({}, this.props.project, this.state.formData) @@ -86,6 +92,12 @@ export class EditProject extends Component { onChange={this.changeHandler} onSubmit={this.finish}>
+ + + + +
+ {this.props.activeStep > 0 && -

- } + } - {this.props.activeStep < this.props.steps.length - 1 && -

+ {this.props.activeStep < this.props.steps.length - 1 && -

- } + } - {this.props.activeStep === this.props.steps.length - 1 && -

+ {this.props.activeStep === this.props.steps.length - 1 && -

- } + } +
) } @@ -68,6 +71,8 @@ Steps.propTypes = { nextStep: PropTypes.func.isRequired, /** Invoked when user clicks the finish button on the final step */ finish: PropTypes.func.isRequired, + /** Invoked when the user clicks the cancel button */ + cancel: PropTypes.func.isRequired, } Steps.defaultProps = { diff --git a/src/components/Bulma/StepNavigation/StepNavigation.scss b/src/components/Bulma/StepNavigation/StepNavigation.scss new file mode 100644 index 000000000..da4c26807 --- /dev/null +++ b/src/components/Bulma/StepNavigation/StepNavigation.scss @@ -0,0 +1,6 @@ +@import 'variables.scss'; + +.step-navigation { + display: flex; + justify-content: space-between; +} diff --git a/src/theme.scss b/src/theme.scss index dbb17bec5..8b7bd164c 100644 --- a/src/theme.scss +++ b/src/theme.scss @@ -208,6 +208,16 @@ button.is-primary.is-loading { } } +.button-group { + button.button { + margin-right: 10px; + + &:last-child { + margin-right: 0; + } + } +} + .full-width { width: 100%; }