Skip to content

fix(pf4): wix wizard buttons layout #1507

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

Merged
merged 1 commit into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/common/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const mapper = {
WizardNavItem: 'Wizard',
WizardNav: 'Wizard',
WizardBody: 'Wizard',
WizardHeader: 'Wizard'
WizardHeader: 'Wizard',
ActionListGroup: 'ActionList',
ActionListItem: 'ActionList',
};

const blueprintMapper = {
Expand Down
3 changes: 3 additions & 0 deletions packages/common/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const devConfig = {
process: 'process/browser.js'
})
],
devServer: {
port: 3000,
},
module: {
rules: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Button } from '@patternfly/react-core';
import { Button, ActionList, ActionListGroup, ActionListItem } from '@patternfly/react-core';
import selectNext from '@data-driven-forms/common/wizard/select-next';
import { FormSpy } from '@data-driven-forms/react-form-renderer';

Expand Down Expand Up @@ -30,43 +30,53 @@
conditionalSubmitFlag,
}) => (
<footer className={`pf-v6-c-wizard__footer ${buttonsClassName ? buttonsClassName : ''}`}>
{Buttons ? (
<Buttons
disableBack={disableBack}
handlePrev={handlePrev}
nextStep={nextStep}
handleNext={handleNext}
buttonsClassName={buttonsClassName}
buttonLabels={{ cancel, submit, back, next }}
renderNextButton={(args) => (
<NextButton {...formOptions} handleNext={handleNext} nextStep={nextStep} nextLabel={next} submitLabel={submit} {...args} />
)}
selectNext={selectNext}
/>
) : (
<FormSpy>
{() => (
<React.Fragment>
<NextButton
{...formOptions}
conditionalSubmitFlag={conditionalSubmitFlag}
handleNext={handleNext}
nextStep={nextStep}
nextLabel={next}
submitLabel={submit}
/>
<Button type="button" variant="secondary" isDisabled={disableBack} onClick={handlePrev}>
{back}
</Button>
<div className="pf-v6-c-wizard__footer-cancel">
<Button type="button" variant="link" onClick={formOptions.onCancel}>
{cancel}
</Button>
</div>
</React.Fragment>
)}
</FormSpy>
)}
<ActionList>
{Buttons ? (
<Buttons
disableBack={disableBack}
handlePrev={handlePrev}
nextStep={nextStep}
handleNext={handleNext}
buttonsClassName={buttonsClassName}
buttonLabels={{ cancel, submit, back, next }}
renderNextButton={(args) => (
<NextButton {...formOptions} handleNext={handleNext} nextStep={nextStep} nextLabel={next} submitLabel={submit} {...args} />

Check warning on line 43 in packages/pf4-component-mapper/src/wizard/wizard-components/step-buttons.js

View check run for this annotation

Codecov / codecov/patch

packages/pf4-component-mapper/src/wizard/wizard-components/step-buttons.js#L43

Added line #L43 was not covered by tests
)}
selectNext={selectNext}
/>
) : (
<FormSpy>
{() => (
<React.Fragment>
<ActionListGroup>
<ActionListItem>
<NextButton
{...formOptions}
conditionalSubmitFlag={conditionalSubmitFlag}
handleNext={handleNext}
nextStep={nextStep}
nextLabel={next}
submitLabel={submit}
/>
</ActionListItem>
<ActionListItem>
<Button type="button" variant="secondary" isDisabled={disableBack} onClick={handlePrev}>
{back}
</Button>
</ActionListItem>
</ActionListGroup>
<ActionListGroup>
<ActionListItem>
<Button type="button" variant="link" onClick={formOptions.onCancel}>
{cancel}
</Button>
</ActionListItem>
</ActionListGroup>
</React.Fragment>
)}
</FormSpy>
)}
</ActionList>
</footer>
);

Expand Down