UNPKG

@zohodesk/components

Version:

In this Package, we Provide Some Basic Components to Build Web App

52 lines (46 loc) 994 B
import { getHTMLFontSize } from "../../utils/getHTMLFontSize"; export const breakPoints = { // common break points MOBILE: 30, //480 TABLET_S: 40, //640 TABLET: 48, //768 LAPTOP_S: 64, //1024 LAPTOP: 90, //1440 // other break points MOBILE_XS: 20, //320 MOBILE_S: 22.5, //360 MOBILE_M: 23.44, //375 TABLET_M: 45, //720 LAPTOP_M: 80, //1280 MONITOR_M: 100, //1600 MONITOR: 120 //1920 }; export function getBreakPointValue(breakPoint) { return breakPoints[breakPoint] * getHTMLFontSize(); // return breakPoints[breakPoint] * 16; } export const sortedBreackPointKey = Object.keys(breakPoints).sort((a, b) => breakPoints[a] - breakPoints[b]); export function defaultMatcher(size) { let currentSize = ''; if (!size) { return currentSize; } let key; for (let i = 0; i < sortedBreackPointKey.length; i++) { key = sortedBreackPointKey[i]; if (getBreakPointValue(key) >= size.width) { break; } } return key; }