react-admin-component
Version:
react library
21 lines • 908 B
JavaScript
import React, { useRef, useLayoutEffect } from 'react';
import classNames from 'classnames';
var prefix = 'rac_tab_inkbar';
var recorder = 0;
var TabInkbar = function (props) {
var _a;
var offsetLeft = props.offsetLeft, targetWidth = props.targetWidth;
var inkRef = useRef(null);
useLayoutEffect(function () {
if (inkRef.current) {
recorder++;
var offsetWidth = inkRef.current.offsetWidth;
inkRef.current.style.transform = "translate3d(" + (offsetLeft +
targetWidth / 2 -
offsetWidth / 2) + "px, 0px, 0px)";
}
}, [offsetLeft, targetWidth]);
return (React.createElement("div", { className: classNames(prefix, (_a = {}, _a[prefix + "-animate"] = recorder > 0, _a), props.className), style: props.style, ref: inkRef }));
};
export default TabInkbar;
//# sourceMappingURL=index.js.map