| 1 |
import { css } from '@patternfly/react-styles'; |
| 2 |
import styles from '@patternfly/react-styles/css/components/Wizard/wizard'; |
| 3 |
import { Button, ButtonVariant } from '../../../components/Button'; |
| 4 |
import { WizardStep } from './Wizard'; |
| 5 |
import { ActionList, ActionListGroup, ActionListItem } from '../../../components/ActionList'; |
| 6 |
export interface WizardFooterInternalProps { |
| 7 |
onNext: any; |
| 8 |
onBack: any; |
| 9 |
onClose: any; |
| 10 |
isValid: boolean; |
| 11 |
firstStep: boolean; |
| 12 |
activeStep: WizardStep; |
| 13 |
nextButtonText: React.ReactNode; |
| 14 |
backButtonText: React.ReactNode; |
| 15 |
cancelButtonText: React.ReactNode; |
| 16 |
} |
| 17 |
|
| 18 |
export const WizardFooterInternal: React.FunctionComponent<WizardFooterInternalProps> = ({ |
| 19 |
onNext, |
| 20 |
onBack, |
| 21 |
onClose, |
| 22 |
isValid, |
| 23 |
firstStep, |
| 24 |
activeStep, |
| 25 |
nextButtonText, |
| 26 |
backButtonText, |
| 27 |
cancelButtonText |
| 28 |
}: WizardFooterInternalProps) => ( |
| 29 |
<footer className={css(styles.wizardFooter)}> |
| 30 |
<ActionList> |
| 31 |
<ActionListGroup> |
| 32 |
{!activeStep.hideBackButton && ( |
| 33 |
<ActionListItem> |
| 34 |
<Button variant={ButtonVariant.secondary} onClick={onBack} isDisabled={firstStep}> |
| 35 |
{backButtonText} |
| 36 |
</Button> |
| 37 |
</ActionListItem> |
| 38 |
)} |
| 39 |
<ActionListItem> |
| 40 |
<Button variant={ButtonVariant.primary} type="submit" onClick={onNext} isDisabled={!isValid}> |
| 41 |
{nextButtonText} |
| 42 |
</Button> |
| 43 |
</ActionListItem> |
| 44 |
</ActionListGroup> |
| 45 |
{!activeStep.hideCancelButton && ( |
| 46 |
<ActionListGroup> |
| 47 |
<ActionListItem> |
| 48 |
<Button variant={ButtonVariant.link} onClick={onClose}> |
| 49 |
{cancelButtonText} |
| 50 |
</Button> |
| 51 |
</ActionListItem> |
| 52 |
</ActionListGroup> |
| 53 |
)} |
| 54 |
</ActionList> |
| 55 |
</footer> |
| 56 |
); |
| 57 |
WizardFooterInternal.displayName = 'WizardFooterInternal'; |