Sha256: ead6f43ee185062b18119b80c62f17389c4e32a348a85f82a5fa66d27c4c6543

Contents?: true

Size: 1.53 KB

Versions: 10

Compression:

Stored size: 1.53 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Button, Modal, Icon } from 'patternfly-react';

const Dialog = (props) => {
  const buttons = (props.buttons)
    ? props.buttons
    : (
      <Button
        key="cancel"
        bsStyle="default"
        className="btn-cancel"
        onClick={props.onCancel}
      >
        {props.cancelLabel}
      </Button>
    );
  return (
    <Modal show={props.show}>
      <Modal.Header>
        <Button
          className="close"
          onClick={props.onCancel}
          aria-hidden="true"
          aria-label={props.cancelLabel}
        >
          <Icon type="pf" name="close" />
        </Button>
        <Modal.Title>{props.title}</Modal.Title>
      </Modal.Header>
      <Modal.Body>
        {/* eslint-disable react/no-danger */}
        <p dangerouslySetInnerHTML={props.dangerouslySetInnerHTML}>
          {props.message}
        </p>
        {/* eslint-enable react/no-danger */}
      </Modal.Body>
      <Modal.Footer>
        {buttons}
      </Modal.Footer>
    </Modal>
  );
};

Dialog.propTypes = {
  show: PropTypes.bool.isRequired,
  onCancel: PropTypes.func.isRequired,
  message: PropTypes.string,
  title: PropTypes.string.isRequired,
  cancelLabel: PropTypes.string,
  dangerouslySetInnerHTML: PropTypes.shape({}),
  buttons: PropTypes.oneOfType([
    PropTypes.arrayOf(PropTypes.node),
    PropTypes.node,
  ]),
};

Dialog.defaultProps = {
  cancelLabel: __('Ok'),
  dangerouslySetInnerHTML: undefined,
  message: undefined,
  buttons: undefined,
};

export default Dialog;

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katello-3.8.1 webpack/move_to_foreman/components/common/Dialog/Dialog.js
katello-3.7.1.1 webpack/move_to_foreman/components/common/Dialog/Dialog.js
katello-3.7.1 webpack/move_to_foreman/components/common/Dialog/Dialog.js
katello-3.8.0 webpack/move_to_foreman/components/common/Dialog/Dialog.js
katello-3.8.0.rc3 webpack/move_to_foreman/components/common/Dialog/Dialog.js
katello-3.8.0.rc2 webpack/move_to_foreman/components/common/Dialog/Dialog.js
katello-3.7.0 webpack/move_to_foreman/components/common/Dialog/Dialog.js
katello-3.8.0.rc1 webpack/move_to_foreman/components/common/Dialog/Dialog.js
katello-3.7.0.rc2 webpack/move_to_foreman/components/common/Dialog/Dialog.js
katello-3.7.0.rc1 webpack/move_to_foreman/components/common/Dialog/Dialog.js