Modal.js 1.5 KiB
Newer Older
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause

import React from 'react';
import PropTypes from 'prop-types';
Luke Schoen's avatar
Luke Schoen committed
import { Image as SUIImage, Modal as SUIModal } from 'semantic-ui-react';

export const Modal = ({
Axel Chalon's avatar
Axel Chalon committed
  buttons,
  children,
  description,
  fullscreen,
Axel Chalon's avatar
Axel Chalon committed
  link,
  title,
  visible
}) => (
  <div className='alert-wrapper'>
    <SUIModal
Luke Schoen's avatar
Luke Schoen committed
      className={`alert-screen-wrapper ${fullscreen ? '-full-screen' : ''}`}
      open={visible}
    >
      <div className={`alert-screen ${fullscreen ? '-full-screen' : ''}`}>
        <SUIModal.Content image className='alert-screen-content'>
          {icon && (
            <SUIImage
              alt='loading'
Axel Chalon's avatar
Axel Chalon committed
              className='alert-screen_image'
              size='medium'
              src={icon}
Axel Chalon's avatar
Axel Chalon committed
              wrapped
          <SUIModal.Description className='alert-screen_text'>
Luke Schoen's avatar
Luke Schoen committed
            <h1>{title}</h1>
            <p>{description}</p>
Luke Schoen's avatar
Luke Schoen committed
            <p>{link || null}</p>
          </SUIModal.Description>
        </SUIModal.Content>
      </div>
    </SUIModal>
Luke Schoen's avatar
Luke Schoen committed
    <div>{children}</div>
  </div>
);

Modal.propTypes = {
Axel Chalon's avatar
Axel Chalon committed
  buttons: PropTypes.node,
  children: PropTypes.node,
  description: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
  fullscreen: PropTypes.bool,
Axel Chalon's avatar
Axel Chalon committed
  icon: PropTypes.string,
Luke Schoen's avatar
Luke Schoen committed
  link: PropTypes.node,
  title: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
  visible: PropTypes.bool
};