UNPKG

@atlaskit/page-layout

Version:

A collection of components which let you compose an application's page layout.

17 lines (16 loc) 525 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLeftSidebarPercentage = void 0; var _constants = require("./constants"); var getLeftSidebarPercentage = exports.getLeftSidebarPercentage = function getLeftSidebarPercentage(currentWidth, maxWidth) { var total = (currentWidth - _constants.DEFAULT_LEFT_SIDEBAR_WIDTH) / (maxWidth - _constants.DEFAULT_LEFT_SIDEBAR_WIDTH); if (total < 0) { return 0; } if (total > 1) { return 100; } return Math.floor(total * 100); };