MCPcopy
hub / github.com/proksh/atomize / makeResponsive

Function makeResponsive

src/style-functions/makeResponsive.js:3–32  ·  view source on GitHub ↗
(value, property, themeValues = {})

Source from the content-addressed store, hash-verified

1import DEVICEQUERRY from "./deviceQuerry";
2
3const makeResponsive = (value, property, themeValues = {}) => {
4 let style = {};
5 if (!value) {
6 return;
7 }
8
9 // Give style directly if not an object
10 if (
11 typeof value === "string" ||
12 typeof value === "number" ||
13 typeof value === "boolean"
14 ) {
15 style[`${property}`] = themeValues[`${value}`] || `${value}`;
16 }
17
18 // Create an array for responsive value
19 else if (typeof value === "object") {
20 Object.keys(value).map(key => {
21 if (key === "xs") {
22 style[property] = themeValues[`${value[key]}`] || `${value[key]}`;
23 } else {
24 style[DEVICEQUERRY[key]] = {
25 [property]: themeValues[`${value[key]}`] || `${value[key]}`
26 };
27 }
28 });
29 }
30
31 return style;
32};
33
34export default makeResponsive;

Callers 8

computeImageStyleFunction · 0.85
computeDivStyleFunction · 0.85
computeButtonStyleFunction · 0.85
computeIconStyleFunction · 0.85
computeDivStyleFunction · 0.85
computeTextStyleFunction · 0.85
findRoundedDirectionFunction · 0.85
findDirectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected