23
app/components/ExtendedDropdown/ExtendedDropdownLink.js
Executable file
23
app/components/ExtendedDropdown/ExtendedDropdownLink.js
Executable file
@@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { DropdownContext } from 'reactstrap/es/DropdownContext';
|
||||
|
||||
const ExtendedDropdownLink = (props) => {
|
||||
const { children, ...otherProps } = props;
|
||||
|
||||
return (
|
||||
<DropdownContext.Consumer>
|
||||
{
|
||||
({ toggle }) => (
|
||||
<Link { ...otherProps } onClick={ () => { toggle(); } }>
|
||||
{ children }
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
</DropdownContext.Consumer>
|
||||
);
|
||||
};
|
||||
ExtendedDropdownLink.propTypes = { ...Link.propTypes };
|
||||
ExtendedDropdownLink.defaultProps = { ...Link.defaultProps };
|
||||
|
||||
export { ExtendedDropdownLink };
|
Reference in New Issue
Block a user