UNPKG

react-scroll-shadow

Version:

Pure CSS shadow to indicate more content in scrollable area

42 lines (41 loc) 1.91 kB
"use strict"; 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 __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var react_1 = require("react"); var styled_1 = require("./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(styled_1.ScrollableWrapper, { size: shadowSize, topShadowActiveColor: topShadowColors.active, bottomShadowActiveColor: bottomShadowColors.active }, React.createElement(styled_1.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; }(react_1.Component)); exports.ScrollShadow = ScrollShadow; exports.default = ScrollShadow;