MCPcopy
hub / github.com/negomi/react-burger-menu / applyWrapperStyles

Function applyWrapperStyles

lib/menuFactory.js:287–317  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

285
286 // Applies component-specific styles to external wrapper elements
287 function applyWrapperStyles() {
288 var set = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
289
290 var applyClass = function applyClass(el, className) {
291 return el.classList[set ? 'add' : 'remove'](className);
292 };
293
294 if (props.htmlClassName) {
295 applyClass(document.querySelector('html'), props.htmlClassName);
296 }
297 if (props.bodyClassName) {
298 applyClass(document.querySelector('body'), props.bodyClassName);
299 }
300
301 if (styles.pageWrap && props.pageWrapId) {
302 handleExternalWrapper(props.pageWrapId, styles.pageWrap, set);
303 }
304
305 if (styles.outerContainer && props.outerContainerId) {
306 handleExternalWrapper(props.outerContainerId, styles.outerContainer, set);
307 }
308
309 var menuWrap = document.querySelector('.bm-menu-wrap');
310 if (menuWrap) {
311 if (set) {
312 menuWrap.removeAttribute('hidden');
313 } else {
314 menuWrap.setAttribute('hidden', true);
315 }
316 }
317 }
318
319 // Avoids potentially attempting to update an unmounted component
320 function clearCurrentTimeout() {

Callers 2

MenuFunction · 0.70
toggleMenuFunction · 0.70

Calls 2

applyClassFunction · 0.70
handleExternalWrapperFunction · 0.70

Tested by

no test coverage detected