UNPKG

@activecollab/components

Version:

ActiveCollab Components

29 lines (28 loc) 1.1 kB
import React from "react"; import classNames from "classnames"; import { StyledToolbar } from "./Toolbar.styles"; import { Portal } from "../../helpers"; export function Toolbar(_ref) { let _ref$open = _ref.open, open = _ref$open === void 0 ? false : _ref$open, _ref$renderInPortal = _ref.renderInPortal, renderInPortal = _ref$renderInPortal === void 0 ? true : _ref$renderInPortal, children = _ref.children, className = _ref.className, style = _ref.style; // Abstract content with default values. const TOOLBAR_CONTENT = /*#__PURE__*/React.createElement(StyledToolbar, { className: classNames("c-toolbar", className), role: "toolbar", tabIndex: -1, "aria-orientation": "horizontal", "aria-modal": "true", style: style }, children); // If `renderInPortal` prop is present, render toolbar content in Portal. // default: true if (renderInPortal) open ? /*#__PURE__*/React.createElement(Portal, null, TOOLBAR_CONTENT) : null; return open ? TOOLBAR_CONTENT : null; } Toolbar.displayName = "Toolbar"; //# sourceMappingURL=Toolbar.js.map