Manual Reference Source

basic/modal/Confirm.js

  1. /**
  2. * Created by kinneretzin on 18/10/2016.
  3. */
  4.  
  5. import React, { Component } from 'react';
  6.  
  7. import { Confirm as ConfirmSemanticUiReact } from 'semantic-ui-react';
  8.  
  9. /**
  10. * Confirm is a wrapper component to present simple Yes/No confirmation modal window.
  11. *
  12. * It wraps [Semantic UI-React's Confirm component](https://react.semantic-ui.com/addons/confirm),
  13. * so all properties of that component (eg. content, header, ...) can be used here.
  14. *
  15. * ## Access
  16. * `Stage.Basic.Confirm`
  17. *
  18. * ## Usage
  19. * ![Confirm](manual/asset/modals/Confirm_0.png)
  20. * ```
  21. * <Confirm content='Are you sure you want to remove this blueprint?'
  22. * open={true}
  23. * onConfirm={()=>{}}
  24. * onCancel={()=>{}} />
  25. * ```
  26. */
  27. export default class Confirm extends Component {
  28. static defaultProps = {
  29. className: ''
  30. };
  31.  
  32. render() {
  33. const { confirmButton, cancelButton, className, ...rest } = this.props;
  34.  
  35. return (
  36. <ConfirmSemanticUiReact
  37. {...rest}
  38. confirmButton={confirmButton || 'Yes'}
  39. cancelButton={cancelButton || 'No'}
  40. className={`confirmModal ${className}`}
  41. />
  42. );
  43. }
  44. }