-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[open-formulieren/open-forms#4917] Updated buttons styling
- Loading branch information
Showing
20 changed files
with
225 additions
and
373 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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// TODO: this can be removed when we upgrade the Utrecht react library. Now it's not possible to use the | ||
// css rules we need. | ||
import '@utrecht/button-group-css'; | ||
import {ButtonGroup, LinkButton as UtrechtButtonLink} from '@utrecht/component-library-react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import AbortButton from 'components/AbortButton'; | ||
import {OFButton} from 'components/Button'; | ||
import FAIcon from 'components/FAIcon'; | ||
import {Literal} from 'components/Literal'; | ||
import Loader from 'components/Loader'; | ||
import PreviousLink from 'components/PreviousLink'; | ||
import {SUBMISSION_ALLOWED} from 'components/constants'; | ||
|
||
const ButtonsGroup = ({ | ||
canSubmitStep, | ||
canSubmitForm, | ||
canSuspendForm, | ||
isLastStep, | ||
isCheckingLogic, | ||
isAuthenticated, | ||
hideAbortButton, | ||
onNavigatePrevPage, | ||
onFormSave, | ||
previousPage, | ||
onDestroySession, | ||
}) => { | ||
const showSubmitButton = !(canSubmitForm === SUBMISSION_ALLOWED.noWithoutOverview && isLastStep); | ||
|
||
return ( | ||
<ButtonGroup className="utrecht-button-group--column" role="group"> | ||
{showSubmitButton && ( | ||
<OFButton | ||
type="submit" | ||
appearance="primary-action-button" | ||
name="next" | ||
disabled={!canSubmitStep} | ||
className="openforms-button-with-icon" | ||
> | ||
{isCheckingLogic ? ( | ||
<Loader modifiers={['centered', 'only-child', 'small', 'gray']} /> | ||
) : ( | ||
<> | ||
<Literal name="nextText" /> | ||
<FAIcon icon="arrow-right-long" /> | ||
</> | ||
)} | ||
</OFButton> | ||
)} | ||
|
||
{previousPage && ( | ||
<PreviousLink to={previousPage} onClick={onNavigatePrevPage} position="end" /> | ||
)} | ||
|
||
{/* TODO: refactor: `const canSuspendForm = onFormSave === undefined` - this does not | ||
need to be its own prop */} | ||
{canSuspendForm && ( | ||
<UtrechtButtonLink | ||
name="save" | ||
onClick={onFormSave} | ||
className="utrecht-link-button--openforms" | ||
> | ||
<FAIcon icon="arrow-right-long" /> | ||
<Literal name="saveText" /> | ||
</UtrechtButtonLink> | ||
)} | ||
|
||
{!hideAbortButton && ( | ||
<AbortButton isAuthenticated={isAuthenticated} onDestroySession={onDestroySession} /> | ||
)} | ||
</ButtonGroup> | ||
); | ||
}; | ||
|
||
ButtonsGroup.propTypes = { | ||
canSubmitStep: PropTypes.bool.isRequired, | ||
canSubmitForm: PropTypes.string.isRequired, | ||
canSuspendForm: PropTypes.bool.isRequired, | ||
isLastStep: PropTypes.bool.isRequired, | ||
isCheckingLogic: PropTypes.bool.isRequired, | ||
isAuthenticated: PropTypes.bool.isRequired, | ||
hideAbortButton: PropTypes.bool, | ||
onNavigatePrevPage: PropTypes.func, | ||
onFormSave: PropTypes.func.isRequired, | ||
previousPage: PropTypes.string, | ||
onDestroySession: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default ButtonsGroup; |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.