wix-style-react
Version:
17 lines (15 loc) • 489 B
JavaScript
/** Stylable formatter
* receives amount of control buttons
* and returns appropriate padding
*/
var BASE_PADDING = 12;
var BUTTON_WIDTH = 30;
var GAP_WIDTH = 6;
var MAX_BUTTON_AMOUNT = 2;
module.exports = function (amount) {
if (amount > MAX_BUTTON_AMOUNT) {
throw new Error("Modal accepts up to ".concat(MAX_BUTTON_AMOUNT, " control buttons"));
}
var gap = amount > 1 ? GAP_WIDTH * (amount - 1) : 0;
return "".concat(BASE_PADDING + BUTTON_WIDTH * amount + gap, "px");
};