@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
28 lines • 1.01 kB
JavaScript
import React from 'react';
import { SpotlightPulse } from '@atlaskit/onboarding';
/**
* Wraps children with {@link SpotlightPulse} component.
*
* It adds pulse effect to children if `pulse` is `true`.
*
* This custom component exists because the {@link SpotlightPulse} with `pulse={false}` renders extra `div` around `children`.
* We want to keep `children` as it is if there is no `pulse`.
*/
export function Pulse(_ref) {
var pulse = _ref.pulse,
_ref$radius = _ref.radius,
radius = _ref$radius === void 0 ? 3 : _ref$radius,
children = _ref.children;
if (pulse) {
return (
/*#__PURE__*/
// SpotlightPulse shows pulse effect if `pulse` is `undefined`.
// That's why we need to cast `pulse` to `false` if it's `undefined`.
React.createElement(SpotlightPulse, {
radius: radius,
pulse: pulse !== null && pulse !== void 0 ? pulse : false
}, children)
);
}
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
}