@atlaskit/editor-plugin-show-diff
Version:
ShowDiff plugin for @atlaskit/editor-core
37 lines • 1.75 kB
JavaScript
/* IndicatorBar.tsx generated by @compiled/babel-plugin v3.0.2 */
import "./IndicatorBar.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { fg } from '@atlaskit/platform-feature-flags/fg';
import { getAccentBorderColor } from '../../pm-plugins/decorations/colorSchemes/factory';
import { colorSchemeRegistry } from '../../pm-plugins/decorations/colorSchemes/schemes';
import { AnchorDocMarginKey } from '../../pm-plugins/decorations/decorationKeys';
const barStyles = null;
const barAlwaysVisibleStyles = null;
const getIndicatorColor = (colorScheme, isInserted) => {
if (colorScheme === undefined || colorScheme === 'standard' || colorScheme === 'traditional' || isInserted === undefined) {
return "var(--ds-border-information, #357DE8)";
}
return getAccentBorderColor(colorSchemeRegistry[colorScheme][isInserted ? 'insertColor' : 'deleteColor']);
};
export function IndicatorBar({
anchorTop,
anchorBottom,
anchorLeft,
anchorLeftFallback,
colorScheme,
isInserted
}) {
const leftAnchors = [anchorLeft, anchorLeftFallback, AnchorDocMarginKey].filter(Boolean).map(anchor => `anchor(--${anchor} left)`).join(', ');
return /*#__PURE__*/React.createElement("span", {
"data-testid": "diff-indicator-bar",
style: {
backgroundColor: getIndicatorColor(colorScheme, isInserted),
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
left: `min(${leftAnchors})`,
top: `anchor(--${anchorTop} top)`,
bottom: `anchor(--${anchorBottom} bottom)`
},
className: ax(["_2rko1rr0 _kqswstnw _1bsb1l7b _lcxvglyw _18u0mgjw _17c61i8t _19pk196n _otyr196n", fg('platform_editor_ai_show_diff_patch_2') && "_17c6oga4"])
});
}