@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
45 lines (43 loc) • 1.89 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DragPreview = void 0;
var _react = _interopRequireDefault(require("react"));
var _primitives = require("@atlaskit/primitives");
var _DragInMotionIcon = require("../icons/DragInMotionIcon");
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
var boxStyles = (0, _primitives.xcss)({
borderColor: 'color.border.focused',
borderStyle: 'solid',
borderRadius: 'radius.small',
borderWidth: 'border.width.focused',
backgroundColor: 'color.blanket.selected'
});
var DragPreview = exports.DragPreview = function DragPreview(_ref) {
var direction = _ref.direction,
width = _ref.width,
height = _ref.height;
var marginLeft = direction === 'row' ? -14 : width / 2 - 14;
var marginTop = direction === 'row' ? height / 2 - 14 : -10;
var transform = direction === 'row' ? 'rotate(90deg)' : 'none';
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
xcss: boxStyles,
style: {
width: "".concat(width, "px"),
height: "".concat(height, "px")
}
}, /*#__PURE__*/_react.default.createElement(_DragInMotionIcon.DragInMotionIcon, {
style: {
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
position: 'absolute',
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
marginLeft: "".concat(marginLeft, "px"),
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
marginTop: "".concat(marginTop, "px"),
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
transform: transform
}
}));
};