mirror of
https://github.com/zoriya/flood.git
synced 2025-12-20 06:05:15 +00:00
Add custom scrollbar to sidepanel and torrent list
This commit is contained in:
43
client/source/scripts/components/ui/CustomScrollbars.js
Normal file
43
client/source/scripts/components/ui/CustomScrollbars.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import classnames from 'classnames';
|
||||
import React from 'react';
|
||||
import {Scrollbars} from 'react-custom-scrollbars';
|
||||
|
||||
export default class CustomScrollbar extends React.Component {
|
||||
getHorizontalThumb(props) {
|
||||
return (
|
||||
<div {...props}
|
||||
className="scrollbars__thumb scrollbars__thumb--horizontal"/>
|
||||
);
|
||||
}
|
||||
|
||||
getVerticalThumb(props) {
|
||||
return (
|
||||
<div {...props}
|
||||
className="scrollbars__thumb scrollbars__thumb--vertical"/>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
let classes = classnames('scrollbars', {
|
||||
[this.props.className]: this.props.className,
|
||||
'is-inverted': this.props.inverted
|
||||
});
|
||||
|
||||
return (
|
||||
<Scrollbars
|
||||
className={classes}
|
||||
ref="scrollbar"
|
||||
renderThumbHorizontal={this.getHorizontalThumb}
|
||||
renderThumbVertical={this.getVerticalThumb}
|
||||
onScroll={this.props.scrollHandler}>
|
||||
{this.props.children}
|
||||
</Scrollbars>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
CustomScrollbar.defaultProps = {
|
||||
className: '',
|
||||
inverted: false,
|
||||
scrollHandler: null
|
||||
};
|
||||
Reference in New Issue
Block a user