Skip to content

Commit

Permalink
Update packages/edit-post/src/components/sidebar/settings-sidebar/ind…
Browse files Browse the repository at this point in the history
…ex.js

Co-Authored-By: Enrique Piqueras <[email protected]>
  • Loading branch information
jorgefilipecosta and epiqueras committed Nov 26, 2019
1 parent 8cda377 commit 3e588f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ function replaceMediaQueryWithWidthEvaluation( ruleText, widthValue ) {
} );
}

export default function SimulateMediaQuery( { partialPaths, value } ) {
export default function SimulateMediaQuery( { partialPaths, width } ) {
useEffect(
() => {
const styleSheets = getStyleSheetsThatMatchPaths( partialPaths );
const originalStyles = [];
styleSheets.forEach( ( styleSheet, styleSheetIndex ) => {
for ( let ruleIndex = 0; ruleIndex < styleSheet.rules.length; ++ruleIndex ) {
const rule = styleSheet.rules[ ruleIndex ];
for ( let ruleIndex = 0; ruleIndex < styleSheet.cssRules.length; ++ruleIndex ) {
const rule = styleSheet.cssRules[ ruleIndex ];
if ( ! isReplaceableMediaRule( rule ) ) {
continue;
}
Expand All @@ -77,7 +77,7 @@ export default function SimulateMediaQuery( { partialPaths, value } ) {
originalStyles[ styleSheetIndex ][ ruleIndex ] = ruleText;
replaceRule(
styleSheet,
replaceMediaQueryWithWidthEvaluation( ruleText, value ),
replaceMediaQueryWithWidthEvaluation( ruleText, width ),
ruleIndex
);
}
Expand All @@ -96,7 +96,7 @@ export default function SimulateMediaQuery( { partialPaths, value } ) {
} );
};
},
[ partialPaths, value ]
[ partialPaths, width ]
);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function TestSimulateMediaQuery() {
onChange={ ( newValue ) => setIsSimulationEnabled( newValue ) }
/>
);
if ( ! isSimulationEnable ) {
if ( ! isSimulationEnabled ) {
return toggleUI;
}
return (
Expand All @@ -56,7 +56,7 @@ function TestSimulateMediaQuery() {
onChange={ ( newValue ) => ( setSimulationWidth( newValue ) ) }
/>
<__experimentalSimulateMediaQuery
value={ simulationWidth }
width={ simulationWidth }
partialPaths={ PARTIAL_PATHS }
/>
</>
Expand Down

0 comments on commit 3e588f6

Please sign in to comment.