react-scroll-shadow
Version:
Pure CSS shadow to indicate more content in scrollable area
40 lines (39 loc) • 1.82 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import * as React from 'react';
import { Component } from 'react';
import { ScrollableContent, ScrollableWrapper } from './styled';
var ScrollShadow = (function (_super) {
__extends(ScrollShadow, _super);
function ScrollShadow() {
return _super !== null && _super.apply(this, arguments) || this;
}
ScrollShadow.prototype.render = function () {
var _a = this.props, children = _a.children, height = _a.height, bottomShadowColors = _a.bottomShadowColors, topShadowColors = _a.topShadowColors, shadowSize = _a.shadowSize;
var style = { height: height };
return (React.createElement(ScrollableWrapper, { size: shadowSize, topShadowActiveColor: topShadowColors.active, bottomShadowActiveColor: bottomShadowColors.active },
React.createElement(ScrollableContent, { size: shadowSize, topShadowInactiveColor: topShadowColors.inactive, bottomShadowInactiveColor: bottomShadowColors.inactive, style: style }, children)));
};
ScrollShadow.defaultProps = {
shadowSize: 2,
bottomShadowColors: {
inactive: 'white',
active: 'gray'
},
topShadowColors: {
inactive: 'white',
active: 'gray'
}
};
return ScrollShadow;
}(Component));
export { ScrollShadow };
export default ScrollShadow;