@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
28 lines • 723 B
JavaScript
import React from 'react';
import { appearancePropsMap } from './link-toolbar-button-group-options';
export const getDropdownOption = (intl, dispatchCommand, {
disabled,
onClick,
selected,
appearance,
testId,
tooltip,
description
}) => {
const {
title,
icon: Icon
} = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'];
return {
title: intl.formatMessage(title),
icon: /*#__PURE__*/React.createElement(Icon, {
label: intl.formatMessage(title)
}),
onClick: () => dispatchCommand(onClick),
disabled: Boolean(disabled),
testId,
selected,
tooltip: tooltip !== null && tooltip !== void 0 ? tooltip : '',
description
};
};