Copy desktop width with threshold when enabling mobile layout

This commit is contained in:
navaneeth 2021-06-03 22:06:11 +05:30
parent 5664f2ef95
commit bd2aa59f2a

View file

@ -76,9 +76,17 @@ export const Inspector = ({
let newComponent = {
...component
};
const { width, height } = newComponent.layouts['desktop'];
newComponent['layouts'] = {
...newComponent.layouts,
mobile: { top: 100, left: 0, width: 445, height: 500 }
mobile: {
top: 100,
left: 0,
width: Math.min(width, 445),
height: height
}
}
setComponent(newComponent);