Skip to content

Commit

Permalink
Added isEditMode watcher for auto drawer closing.
Browse files Browse the repository at this point in the history
  • Loading branch information
net-runner committed Mar 17, 2021
1 parent fb819ca commit e0db285
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import React from "react";
import React, { useEffect } from "react";
import DrawerHeader from "./drawer-header.component";
import { Box } from "@material-ui/core";
import { makeStyles, Theme } from "@material-ui/core/styles";
Expand Down Expand Up @@ -33,6 +33,10 @@ export default function JiraLikeDrawer(width): JSX.Element {
const classes = useStyles(width);
const { title, open, setOpen, childrenComponent } = useJiraLikeDrawer();

useEffect(() => {
if (!isEditMode) setOpen(false);
}, [isEditMode, setOpen]);

return (
<Box>
{title && open && setOpen && childrenComponent && isEditMode && (
Expand Down

0 comments on commit e0db285

Please sign in to comment.