UNPKG

pouncejs

Version:

A collection of UI components from Panther labs

28 lines (23 loc) 691 B
// These helper fns are modified versions of the amazing rebass library // https://github.com/rebassjs/rebass/blob/master/packages/layout/src/index.js var px = function px(n) { return typeof n === 'number' ? n + 'px' : n; }; export var widthToColumns = function widthToColumns(width) { if (Array.isArray(width)) { return width.map(widthToColumns); } if (width != null) { return "repeat(auto-fit, minmax(" + px(width) + ", 1fr))"; } return null; }; export var countToColumns = function countToColumns(count) { if (Array.isArray(count)) { return count.map(countToColumns); } if (count != null) { return "repeat(" + count + ", 1fr)"; } return null; };