fix: add Layers to the dropdown

This commit is contained in:
Tolulope Adetula 2021-05-24 10:09:43 +01:00
parent b95ff2001e
commit 4ac85a7fd9

View File

@ -4,6 +4,7 @@ import Select from "react-select";
import { WrappedFieldInputProps } from "redux-form";
import { theme } from "constants/DefaultTheme";
import { SelectComponentsConfig } from "react-select/src/components";
import { LayersContext } from "../../../constants/Layers";
export type DropdownProps = {
options: Array<{
@ -50,15 +51,19 @@ const selectStyles = {
padding: "5px",
}),
indicatorSeparator: () => ({}),
menuPortal: (styles: any) => ({ ...styles, zIndex: 1000 }),
};
export function BaseDropdown(props: DropdownProps) {
const layer = React.useContext(LayersContext);
const { customSelectStyles, input } = props;
const menuPortalStyle = {
menuPortal: (styles: any) => ({ ...styles, zIndex: layer.max }),
};
return (
<Select
menuPortalTarget={document.body}
styles={{ ...selectStyles, ...customSelectStyles }}
styles={{ ...selectStyles, ...customSelectStyles, ...menuPortalStyle }}
{...input}
isDisabled={props.isDisabled}
isSearchable={props.isSearchable}