elegantthemes / create-divi-extension

MIT License
185 stars 59 forks source link

VB::pass previewMode or responsiveWidth for access in JSX #87

Open BoDonkey opened 6 years ago

BoDonkey commented 6 years ago

Problem Description

Right now there is not an easy way to change CSS in response to a change to the preview mode in the visual builder. So for example, if there is an item that changes size depending on whether it is phone, tablet, or desktop, this can't be changed responsively in the visual builder. While the JSX file can access the DOM upon initial render to get the preview container width, it is cumbersome to set-up for a re-render upon the designer changing the preview device. Making either responsiveWidth or previewMode available would allow for this to be easily accomplished with conditional logic.

mrkenng commented 6 years ago

There's a work around. I use the CSS generated by Divi on responsive css. They output on the body classes. You can use that to target it.