@brizy/ui
Version:
React elements in Brizy style
12 lines (11 loc) • 869 B
JavaScript
import React, { forwardRef, useMemo } from "react";
import Scrollbars from "react-custom-scrollbars";
import { Thumb } from "./components/Thumb";
import { View } from "./components/View";
import { wrapperStyles } from "./utils";
import { BRZ_PREFIX } from "../constants";
export const LegacyScrollBar = forwardRef(function LegacyScrollBar({ children, autoHeightMax, theme, autoHide }, ref) {
const renderThumbsMemo = useMemo(() => Thumb(theme), [theme]);
const renderViewMemo = useMemo(() => View(autoHeightMax), [autoHeightMax]);
return (React.createElement(Scrollbars, { ref: ref, className: `${BRZ_PREFIX}-scrollbar__wrapper`, style: wrapperStyles, renderThumbHorizontal: renderThumbsMemo, renderThumbVertical: renderThumbsMemo, renderView: renderViewMemo, autoHeight: !!autoHeightMax, autoHeightMax: autoHeightMax, autoHide: autoHide }, children));
});