-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OF#4917] Update buttons styling (buttons position) #787
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import {ButtonGroup} from '@utrecht/button-group-react'; | ||
import {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 = ({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's bikeshedding, but I'm not convinced that Maybe |
||
canSubmitStep, | ||
canSubmitForm, | ||
canSuspendForm, | ||
isLastStep, | ||
isCheckingLogic, | ||
isAuthenticated, | ||
hideAbortButton, | ||
onNavigatePrevPage, | ||
onFormSave, | ||
previousPage, | ||
onDestroySession, | ||
}) => { | ||
const showSubmitButton = !(canSubmitForm === SUBMISSION_ALLOWED.noWithoutOverview && isLastStep); | ||
|
||
return ( | ||
<ButtonGroup className="utrecht-button-group--distanced" direction="column"> | ||
{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 was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self-reminder -> switch to this package in the renderer