Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions public/card/paragraph/searchInfoPopupApple.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions src/components/atoms/SearchInfoPopup/SearchInfoPopup.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { useEffect, useState } from 'react';
import { Card, CardContent, IconButton, Typography } from '@mui/material';
import Zoom from '@mui/material/Zoom';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';

export default function SearchInfoPopup() {
const cookieName = 'com.fridgefinder.searchInfoPopup';
const [popupOpen, setPopupOpen] = useState();

const handleClick = () => {
setPopupOpen(false);
localStorage.setItem(cookieName, 'false');
};

useEffect(() => {
const cookie = localStorage.getItem(cookieName);
if (!cookie) {
localStorage.setItem(cookieName, 'true');
setPopupOpen(true);
}
if (cookie === 'false') {
setPopupOpen(false);
}
if (cookie === 'true') {
setPopupOpen(true);
}
}, [cookieName, setPopupOpen]);

return (
<Zoom in={popupOpen}>
<Card
variant="outlined"
sx={{
position: 'fixed',
top: 157,
right: 16,
zIndex: 410,
width: 200,
padding: '15px',
backgroundColor: '#fff',
border: 'none ',
}}
>
<IconButton
onClick={handleClick}
sx={{
position: 'absolute',
top: 15,
right: 15,
width: 0,
height: 0,
p: 0,
}}
>
<CloseRoundedIcon fontSize="small" />
</IconButton>
<div
style={{ display: 'grid', gridTemplateColumns: '1fr auto', p: '0' }}
>
<CardContent sx={{ p: 0 }}>
<Typography
variant="h4"
sx={{
marginBottom: '4px',
fontSize: '12px',
lineHeight: '15px',
}}
>
Find Your Fridge
</Typography>
<Typography
variant="body2"
sx={{
fontSize: '11px',
lineHeight: '15px',
}}
>
Use the filters at the top of the map to find a fridge near you!
</Typography>
</CardContent>
<img height="84px" src="/card/paragraph/searchInfoPopupApple.svg" />
</div>
</Card>
</Zoom>
);
}
1 change: 1 addition & 0 deletions src/components/atoms/SearchInfoPopup/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './SearchInfoPopup';
1 change: 1 addition & 0 deletions src/components/atoms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export { default as PageHero } from './PageHero';
export { default as PamphletParagraph } from './PamphletParagraph';
export { default as ParagraphCard } from './ParagraphCard';
export { default as TitleCard } from './TitleCard';
export { default as SearchInfoPopup } from './SearchInfoPopup';
10 changes: 8 additions & 2 deletions src/pages/browse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import {
Divider,
useMediaQuery,
} from '@mui/material';

import BrowseList from 'components/organisms/browse/List';
import { MapToggle } from 'components/atoms/';
import { MapToggle, SearchInfoPopup } from 'components/atoms/';

import { getFridgeList } from 'model/view';
import { useWindowHeight } from 'lib/browser';
Expand Down Expand Up @@ -85,7 +86,12 @@ export default function BrowsePage() {
{currentView === MapToggle.view.list ? (
<Box sx={{ flex: 1, px: 4 }}>{List}</Box>
) : (
<Box sx={{ flex: 1 }}>{Map}</Box>
<Box sx={{ flex: 1 }}>
<>
{Map}
<SearchInfoPopup />
</>
</Box>
)}

<MapToggle currentView={currentView} setView={setCurrentView} />
Expand Down