UNPKG

@atlaskit/editor-plugin-toolbar

Version:

Toolbar plugin for @atlaskit/editor-core

24 lines 1.29 kB
import React from 'react'; import { useEditorToolbar } from '@atlaskit/editor-common/toolbar'; import { PrimaryToolbar as PrimaryToolbarBase } from '@atlaskit/editor-toolbar'; import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals'; var isFullPage = function isFullPage(editorAppearance) { return editorAppearance === 'full-page' || editorAppearance === 'full-width'; }; var getBreakpointPreset = function getBreakpointPreset(breakpointPreset, editorAppearance) { if (breakpointPreset) { return breakpointPreset; } return editorAppearance && isFullPage(editorAppearance) ? 'fullpage' : 'reduced'; }; export var PrimaryToolbar = function PrimaryToolbar(_ref) { var children = _ref.children, breakpointPreset = _ref.breakpointPreset; var _useEditorToolbar = useEditorToolbar(), editorAppearance = _useEditorToolbar.editorAppearance; return /*#__PURE__*/React.createElement(PrimaryToolbarBase, { testId: expValEquals('editor_a11y__primary-toolbar-aria-label_fy27', 'isEnabled', true) ? 'editor-primary-toolbar' : undefined, label: expValEquals('editor_a11y__primary-toolbar-aria-label_fy27', 'isEnabled', true) ? undefined : 'Primary Toolbar', breakpointPreset: getBreakpointPreset(breakpointPreset, editorAppearance) }, children); };