UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

55 lines 1.76 kB
import MinusIcon from '@atlaskit/icon/core/minus'; import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card'; import SmartLinkEmbedIcon from '@atlaskit/icon/core/smart-link-embed'; import SmartLinkInlineIcon from '@atlaskit/icon/core/smart-link-inline'; import { cardMessages as messages } from '../messages'; import { IconCard } from './ui/assets/card'; import { IconEmbed } from './ui/assets/embed'; import { IconInline } from './ui/assets/inline'; import { IconUrl } from './ui/assets/url'; var appearancePropsMap = { url: { title: messages.urlTitle, icon: MinusIcon, iconFallback: IconUrl }, inline: { title: messages.inlineTitle, icon: SmartLinkInlineIcon, iconFallback: IconInline }, block: { title: messages.blockTitle, icon: SmartLinkCardIcon, iconFallback: IconCard }, embed: { title: messages.embedTitle, icon: SmartLinkEmbedIcon, iconFallback: IconEmbed } }; export var getButtonGroupOption = function getButtonGroupOption(intl, dispatchCommand, _ref) { var disabled = _ref.disabled, _onClick = _ref.onClick, selected = _ref.selected, appearance = _ref.appearance, testId = _ref.testId, tooltip = _ref.tooltip; var _appearancePropsMap = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'], title = _appearancePropsMap.title, icon = _appearancePropsMap.icon, iconFallback = _appearancePropsMap.iconFallback; return { title: intl.formatMessage(title), icon: icon, iconFallback: iconFallback, onClick: function onClick() { return dispatchCommand(_onClick); }, disabled: Boolean(disabled), tooltipContent: tooltip || null, testId: testId, selected: selected }; };