Skip to content

Instantly share code, notes, and snippets.

@alex-boom
Created March 10, 2021 17:38
Show Gist options
  • Save alex-boom/6a1ffaae04753bd043415b35d3700121 to your computer and use it in GitHub Desktop.
Save alex-boom/6a1ffaae04753bd043415b35d3700121 to your computer and use it in GitHub Desktop.
import React, { useState } from "react";
import { Button, Modal } from "antd";
const EditModal = ({ children, nameBtn = 'Button', titleModal = 'Modal Title' }) => {
const [ modalVisible, setModalVisible ] = useState(false);
return (
<>
<Button className='ml-auto' type="primary" onClick={ () => setModalVisible(true) }>{ nameBtn }</Button>
<Modal
title={ titleModal }
centered
visible={ modalVisible }
onOk={ () => setModalVisible(false) }
onCancel={ () => setModalVisible(false) }
>
{ children }
</Modal>
</>
)
}
export default EditModal;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment