From 315c58cc8d845c08409737e0e060856dcddaccf0 Mon Sep 17 00:00:00 2001 From: Jonasz Bigda Date: Wed, 23 Sep 2020 19:53:30 +0200 Subject: [PATCH] little added to EditRestaurant --- src/components/Dialogs/EditRestaurant.js | 127 +++++++++++++++++++++-- src/styles/EditRestaurant.scss | 12 +++ 2 files changed, 128 insertions(+), 11 deletions(-) diff --git a/src/components/Dialogs/EditRestaurant.js b/src/components/Dialogs/EditRestaurant.js index 15bc317..ce388e8 100644 --- a/src/components/Dialogs/EditRestaurant.js +++ b/src/components/Dialogs/EditRestaurant.js @@ -1,18 +1,64 @@ import React, { useState } from "react"; import { useSelector } from "react-redux"; import { useParams, useHistory } from "react-router-dom"; +import { makeStyles } from "@material-ui/core/styles"; import List from "@material-ui/core/List"; import ListItem from "@material-ui/core/ListItem"; import ListItemIcon from "@material-ui/core/ListItemIcon"; import ListItemText from "@material-ui/core/ListItemText"; import Divider from "@material-ui/core/Divider"; -import InboxIcon from "@material-ui/icons/Inbox"; +import DescriptionIcon from "@material-ui/icons/Description"; +import PhotoIcon from "@material-ui/icons/Photo"; +import RoomIcon from "@material-ui/icons/Room"; +import RestaurantMenuIcon from "@material-ui/icons/RestaurantMenu"; +import FastfoodIcon from "@material-ui/icons/Fastfood"; +import AddIcon from "@material-ui/icons/Add"; +import Badge from "@material-ui/core/Badge"; + +const useStyles = makeStyles((theme) => ({ + main: { + "& .MuiListItemIcon-root": { + color: "#d68000", + }, + }, + root: { + "& .MuiBadge-colorPrimary": { + backgroundColor: "#13ff00", + }, + "& .MuiBadge-colorError": { + backgroundColor: "#ff0000", + }, + }, + secondary: { + "& .MuiListItemText-secondary": { + color: "#7b7b7b", + fontSize: "13px", + }, + }, +})); export default function EditRestaurant(props) { + const classes = useStyles(); const [tab, setTab] = useState(0); const history = useHistory(); let { id } = useParams(); const restaurants = useSelector((state) => state.data.userData.restaurants); + const badgeData = { + color: "", + secondaryText: "", + }; + const badgeInit = () => { + if ( + !restaurant.subscriptionActive || + restaurant.subscriptionActive === false + ) { + badgeData.color = "error"; + badgeData.secondaryText = "Nieaktywna"; + } else { + badgeData.color = "primary"; + badgeData.secondaryText = `Aktywna do: ${restaurant.subscriptionDue}`; + } + }; const handleListItemClick = (event, index) => { setTab(index); @@ -23,18 +69,21 @@ export default function EditRestaurant(props) { } const restaurant = restaurants.find(matchId); if (restaurant === undefined) history.push("/"); + badgeInit(); return (
- +

{restaurant.name}

+ + handleListItemClick(event, 0)} > - + @@ -44,9 +93,19 @@ export default function EditRestaurant(props) { onClick={(event) => handleListItemClick(event, 1)} > - + + + - + handleListItemClick(event, 2)} > - + - + handleListItemClick(event, 3)} > - + - + handleListItemClick(event, 4)} > - + - + + + handleListItemClick(event, 5)} + > + + + + + + + + + +
+ {tab === 0 && ( +
+

Informacje

+
+ )} + {tab === 1 && ( +
+

Subskrypcja

+
+ )} + {tab === 2 && ( +
+

Zdjęcie

+
+ )} + {tab === 3 && ( +
+

Lokalizacja

+
+ )} + {tab === 4 && ( +
+

Menu

+
+ )} + {tab === 5 && ( +
+

Lunch menu

+
+ )}
); } diff --git a/src/styles/EditRestaurant.scss b/src/styles/EditRestaurant.scss index 4169f0e..d656f00 100644 --- a/src/styles/EditRestaurant.scss +++ b/src/styles/EditRestaurant.scss @@ -10,6 +10,18 @@ .editRestaurant-menu { width: 100%; + border-radius: 15px 0px 0px 15px; + background-color: #323232; max-width: 280px; color: #c0c0c0; } + +.editRestaurant-title { + font-weight: 300; +} + +.editRestaurant-tab { + display: flex; + flex-flow: column; + width: 100%; +}