Debian Codegraph @

node/@patternfly/react-core/src/deprecated/components/Wizard/WizardHeader.tsx

raw
1 import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
2 import { css } from '@patternfly/react-styles';
3 import { Button } from '../../../components/Button';
4 import RhMicronsCloseIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-close-icon';
5
6 export interface WizardHeaderProps {
7 /** Callback function called when the X (Close) button is clicked */
8 onClose?: () => void;
9 /** Title of the wizard */
10 title: string;
11 /** Description of the wizard */
12 description?: React.ReactNode;
13 /** Component type of the description */
14 descriptionComponent?: 'div' | 'p';
15 /** Flag indicating whether the close button should be in the header */
16 hideClose?: boolean;
17 /** Aria-label applied to the X (Close) button */
18 closeButtonAriaLabel?: string;
19 /** id for the title */
20 titleId?: string;
21 /** id for the description */
22 descriptionId?: string;
23 }
24
25 export const WizardHeader: React.FunctionComponent<WizardHeaderProps> = ({
26 onClose = () => undefined,
27 title,
28 description,
29 hideClose,
30 closeButtonAriaLabel,
31 titleId,
32 descriptionComponent: Component = 'div',
33 descriptionId
34 }: WizardHeaderProps) => (
35 <div className={css(styles.wizardHeader)}>
36 {!hideClose && (
37 <div className={css(styles.wizardClose)}>
38 <Button variant="plain" aria-label={closeButtonAriaLabel} onClick={onClose} icon={<RhMicronsCloseIcon />} />
39 </div>
40 )}
41 <div className={css(styles.wizardTitle)}>
42 <h2 className={css(styles.wizardTitleText)} id={titleId}>
43 {title || <>&nbsp;</>}
44 </h2>
45 </div>
46 {description && (
47 <Component className={css(styles.wizardDescription)} id={descriptionId}>
48 {description}
49 </Component>
50 )}
51 </div>
52 );
53 WizardHeader.displayName = 'WizardHeader';