@plteam/chat-ui
Version:
CUI Kit is a free and open-source library for creating AI assistant chat interfaces, built with React, Material UI, and TypeScript
34 lines (33 loc) • 1.28 kB
JavaScript
import * as React from 'react';
import SimpleBar from 'simplebar-react';
import 'simplebar-react/dist/simplebar.min.css';
import { styled } from '@mui/material/styles';
export const simpleBarClasses = {
contentWrapper: 'simplebar-content-wrapper',
content: 'simplebar-content',
track: 'simplebar-track',
hover: 'simplebar-hover',
scrollbarVisibleBefore: 'simplebar-visible:before',
};
const SimpleBarStyled = styled(SimpleBar, {
shouldForwardProp: (propName) => propName !== 'maxContent'
})(({ maxContent }) => ({
[`& .${simpleBarClasses.contentWrapper}`]: {
minWidth: maxContent ? 'max-content' : undefined,
},
[`& .${simpleBarClasses.track}`]: {
[`& .${simpleBarClasses.scrollbarVisibleBefore}`]: {
opacity: 0.25,
transition: 'opacity 0.3s'
},
[`&.${simpleBarClasses.hover}`]: {
[`& .${simpleBarClasses.scrollbarVisibleBefore}`]: {
opacity: 0.5,
},
},
},
}));
const SimpleScrollbar = ({ style, children, maxContent }) => {
return (React.createElement(SimpleBarStyled, { forceVisible: true, style: style, autoHide: false, maxContent: maxContent }, children));
};
export default SimpleScrollbar;