@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
29 lines • 972 B
JavaScript
import React from 'react';
// eslint-disable-next-line @atlaskit/design-system/use-spotlight-package
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({
pulse,
radius = 3,
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);
}