@ant-design/happy-work-theme
Version:
Ant Design happy work theme
42 lines (41 loc) • 1.35 kB
JavaScript
import { ConfigProvider } from 'antd';
import useEvent from "rc-util/es/hooks/useEvent";
import * as React from 'react';
import DotEffect from "./DotEffect";
import { unstableRender } from "./_utils/unstable-render";
export default function HappyProvider(props) {
var children = props.children,
disabled = props.disabled;
var showEffect = useEvent(function (target, info) {
var token = info.token,
hashId = info.hashId;
// Create holder
var holder = document.createElement('div');
holder.style.position = 'absolute';
holder.style.left = "0px";
holder.style.top = "0px";
document.body.appendChild(holder);
var unmount = unstableRender( /*#__PURE__*/React.createElement(DotEffect, {
target: target,
token: token,
hashId: hashId,
onFinish: function onFinish() {
unmount().then(function () {
var _holder$parentElement;
(_holder$parentElement = holder.parentElement) === null || _holder$parentElement === void 0 || _holder$parentElement.removeChild(holder);
});
}
}), holder);
});
var waveConfig = React.useMemo(function () {
if (disabled) {
return {};
}
return {
showEffect: showEffect
};
}, [disabled]);
return /*#__PURE__*/React.createElement(ConfigProvider, {
wave: waveConfig
}, children);
}