@atlaskit/side-navigation
Version:
A highly composable side navigation component that supports nested views.
51 lines (50 loc) • 2.6 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.innerContainerCSS = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _constants = require("../../common/constants");
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var scrollIndicatorMaskZIndex = 2;
var scrollIndicatorHeight = 2;
var scrollIndicatorBorderRadius = '1px';
var innerContainerCSS = exports.innerContainerCSS = function innerContainerCSS(opts) {
return _objectSpread(_objectSpread({
display: 'flex',
overflow: 'auto',
width: '100%',
position: 'relative',
boxSizing: 'border-box',
flexDirection: 'column'
}, !opts.showTopScrollIndicator && {
'&::before': {
borderRadius: "var(--ds-radius-xsmall, ".concat(scrollIndicatorBorderRadius, ")"),
content: "''",
left: 0,
right: 0,
height: scrollIndicatorHeight,
backgroundColor: "var(".concat(_constants.VAR_SCROLL_INDICATOR_COLOR, ", ", "var(--ds-surface, #FFFFFF)", ")"),
position: 'absolute',
display: 'block',
zIndex: scrollIndicatorMaskZIndex
}
}), {}, {
// This after pseudo element abuses being a flex child and pushes itself down to the
// very bottom of the container - doing so ends up "masking" the actual scroll indicator.
'&::after': {
borderRadius: "var(--ds-radius-xsmall, ".concat(scrollIndicatorBorderRadius, ")"),
content: "''",
display: 'block',
flexShrink: 0,
height: scrollIndicatorHeight,
// This is used to "push" the element to the bottom of the flex container.
marginTop: 'auto',
position: 'relative',
zIndex: scrollIndicatorMaskZIndex,
backgroundColor: "var(".concat(_constants.VAR_SCROLL_INDICATOR_COLOR, ", ", "var(--ds-surface, #FFFFFF)", ")")
}
});
};