Skip to content

Commit

Permalink
Merge pull request #3244 from bettyblocks/fix/initial-responsive-stat…
Browse files Browse the repository at this point in the history
…e-mobile-hidden-PRDGM-191

fix: initial responsive state mobile hidden
  • Loading branch information
JorisPannekeet authored Nov 16, 2023
2 parents 47ac8c6 + 4dbd44f commit 0f2ca78
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
orientation: 'HORIZONTAL',
jsx: (() => {
const { Children, env, useText } = B;
const { useMediaQuery, useTheme } = window.MaterialUI.Core;
const isEmpty = children.length === 0;
const isPristine = isEmpty && env === 'dev';
const {
Expand All @@ -20,11 +21,11 @@

const isTemporary = drawerType === 'temporary';
const anchor = isTemporary ? temporaryAnchor : persistentAnchor;

// Because custom boolean option returns false as a string, do an additonal check
const componentVisibility =
env === 'dev' ? visibility : runTimeVisibility !== 'false';

const aboveBreakpoint = useMediaQuery(
useTheme().breakpoints.up(breakpoint),
);
const showInRunTime = aboveBreakpoint && runTimeVisibility;
const componentVisibility = env === 'dev' ? visibility : showInRunTime;
const [isOpen, setIsOpen] = useState(componentVisibility);

const closeDrawer = () => setIsOpen(false);
Expand Down

0 comments on commit 0f2ca78

Please sign in to comment.