34
app/components/UncontrolledModal/UncontrolledModalClose.js
Executable file
34
app/components/UncontrolledModal/UncontrolledModalClose.js
Executable file
@@ -0,0 +1,34 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button } from 'reactstrap';
|
||||
|
||||
import { Consumer } from './context';
|
||||
|
||||
const UncontrolledModalClose = (props) => {
|
||||
const { tag, ...otherProps } = props;
|
||||
const Tag = tag;
|
||||
|
||||
return (
|
||||
<Consumer>
|
||||
{
|
||||
(value) => (
|
||||
<Tag
|
||||
{ ...otherProps }
|
||||
onClick={ () => value.toggleModal() }
|
||||
/>
|
||||
)
|
||||
}
|
||||
</Consumer>
|
||||
)
|
||||
};
|
||||
UncontrolledModalClose.propTypes = {
|
||||
tag: PropTypes.oneOfType([
|
||||
PropTypes.func,
|
||||
PropTypes.string
|
||||
])
|
||||
};
|
||||
UncontrolledModalClose.defaultProps = {
|
||||
tag: Button
|
||||
};
|
||||
|
||||
export { UncontrolledModalClose };
|
Reference in New Issue
Block a user