UNPKG

@brizy/ui

Version:
19 lines (18 loc) 960 B
import React, { useContext } from "react"; import AntSelect from "antd/lib/select"; import { FrameContentContext } from "../..//Frame/FrameContent"; import { BRZ_PREFIX } from "../../constants"; export const ToolbarSelect = (props) => { const { value, onChange, placeholder, disabled, children, getContainer, open } = props; const context = useContext(FrameContentContext); const handleGetContainer = () => { if (typeof getContainer === "function") { return getContainer(); } if (context.node) { return context.node; } return document.body; }; return (React.createElement(AntSelect, { className: `${BRZ_PREFIX}-toolbar__select`, dropdownClassName: `${BRZ_PREFIX}-toolbar__select__dropdown`, value: value, open: open, onChange: onChange, disabled: disabled, getPopupContainer: handleGetContainer, placeholder: placeholder, listHeight: 228, listItemHeight: 38 }, children)); };