Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #384 Added Close Icon on Add Restaurant Overlay #385

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
Select,
OutlinedInput,
MenuItem,
ListItemText
ListItemText,
IconButton
} from '@mui/material'

import ConfigurableValues from '../../config/constants'
Expand All @@ -27,6 +28,7 @@ import useGlobalStyles from '../../utils/globalStyles'
import InputAdornment from '@mui/material/InputAdornment'
import VisibilityIcon from '@mui/icons-material/Visibility'
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff'
import CloseIcon from '@mui/icons-material/Close';
import { SHOP_TYPE } from '../../utils/enums'
import Dropdown from '../Dropdown'

Expand Down Expand Up @@ -66,7 +68,7 @@ const CreateRestaurant = props => {
const [minimumOrderError, setMinimumOrderError] = useState(null)
const [salesTaxError, setSalesTaxError] = useState(null)
const [restaurantCuisines, setRestaurantCuisines] = React.useState([])

const [isOpen, setIsOpen] = useState(true); // State to control visibility
rahil1202 marked this conversation as resolved.
Show resolved Hide resolved
// const [shopType, setShopType] = useState(SHOP_TYPE.RESTAURANT)
const [errors, setErrors] = useState('')
const [success, setSuccess] = useState('')
Expand Down Expand Up @@ -248,6 +250,17 @@ const CreateRestaurant = props => {
setImgUrl('')
}

const handleClose = () => {
setIsOpen(false); // Set isOpen to false to close the component
};
const handleContainerClick = (e) => {
// Prevent closing if the click event occurs within the container
e.stopPropagation();
};
if (!isOpen) {
return null; // Render nothing if isOpen is false
}

const handleCuisineChange = event => {
const {
target: { value }
Expand All @@ -262,7 +275,7 @@ const CreateRestaurant = props => {


return (
<Box container className={classes.container}>
<Box container className={classes.container} onClick={handleContainerClick}>
rahil1202 marked this conversation as resolved.
Show resolved Hide resolved
<Box style={{ alignItems: 'start' }} className={classes.flexRow}>
<Box item className={classes.heading}>
<Typography variant="h6" className={classes.text}>
Expand All @@ -273,8 +286,10 @@ const CreateRestaurant = props => {
<label>{t('Available')}</label>
<Switch defaultChecked style={{ color: 'black' }} />
</Box>
<IconButton onClick={handleClose}>
rahil1202 marked this conversation as resolved.
Show resolved Hide resolved
<CloseIcon /> {/* Close icon */}
</IconButton>
</Box>

<Box className={classes.form}>
<form ref={formRef}>
<Grid container spacing={2}>
Expand Down