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 multiple visible drawer edges #169

Merged
merged 2 commits into from
Jun 28, 2024
Merged
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
13 changes: 0 additions & 13 deletions frontend/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,11 @@ import { SnackbarProvider } from 'notistack';
import MainView from './MainView/MainView';
import LoginView from './login/LoginView';
import { CssBaseline, Divider, styled, ThemeProvider } from '@mui/material';
import { renderToStaticMarkup } from 'react-dom/server';
import { DesktopBackground, MobileBackground } from './images/svgImages';
import { theme_2024 } from '../theme_2024';

export const GarApp = styled(Divider)(() => ({}));

const App = () => {
// Basic solution for differentiating between desktop and mobile. Switch from desktop to mobile resolution requires a page refresh
// to show background correctly.
let svgString = encodeURIComponent(
renderToStaticMarkup(<MobileBackground />)
);
if (window.innerWidth > 600) {
svgString = encodeURIComponent(
renderToStaticMarkup(<DesktopBackground />)
);
}

return (
<ThemeProvider theme={theme_2024}>
<CssBaseline />
Expand Down
25 changes: 14 additions & 11 deletions frontend/src/components/AvailableRoomList/AvailableRoomList.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { useState } from 'react';
import { List, Typography, Box, ToggleButton } from '@mui/material';
import { Box, List, ToggleButton, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
import { makeBooking } from '../../services/bookingService';
import { Booking, BookingDetails, Room, Preferences } from '../../types';
import { Booking, BookingDetails, Preferences, Room } from '../../types';
import { DateTime, Duration } from 'luxon';
import useCreateNotification from '../../hooks/useCreateNotification';
import RoomCard from '../RoomCard/RoomCard';
import NoRoomsCard from '../RoomCard/NoRoomsCard';
import BookingDrawer from '../BookingDrawer/BookingDrawer';
import TimePickerDrawer from '../TimePickerDrawer/TimePickerDrawer';

const SKIP_CONFIRMATION = true;

const TimePickerButton = styled(ToggleButton)(() => ({
Expand Down Expand Up @@ -277,15 +278,17 @@ const AvailableRoomList = (props: BookingListProps) => {
onAddTimeUntilNext={handleUntilNextDurationChange}
startingTime={startingTime}
/>
<TimePickerDrawer
open={expandTimePickerDrawer}
toggle={(newOpen: any) =>
setExpandTimePickerDrawer(newOpen)
}
startingTime={startingTime}
setStartingTime={setStartingTime}
setExpandTimePickerDrawer={setExpandTimePickerDrawer}
/>
{
<TimePickerDrawer
open={expandTimePickerDrawer}
toggle={(newOpen: any) =>
setExpandTimePickerDrawer(newOpen)
}
startingTime={startingTime}
setStartingTime={setStartingTime}
setExpandTimePickerDrawer={setExpandTimePickerDrawer}
/>
}
</div>
<div
id="available-booking-typography"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/BookingDrawer/BookingDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import { Box, Button, Typography } from '@mui/material';
import AddIcon from '@mui/icons-material/Add';
import RemoveIcon from '@mui/icons-material/Remove';
Expand Down
58 changes: 27 additions & 31 deletions frontend/src/components/SwipeableEdgeDrawer/SwipeableEdgeDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Person from '@mui/icons-material/Person';
import FilterListIcon from '@mui/icons-material/FilterList';
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { COLORS } from '../../theme_2024';

export const drawerBleeding = 88;

Expand All @@ -25,13 +26,6 @@ const Root = styled('div')(({ theme }) => ({
: theme.palette.background.default
}));

const Puller = styled(Box)(({ theme }) => ({
width: '30%',
height: 4,
backgroundColor: theme.palette.mode === 'light' ? '#F6F5F5' : grey[900],
borderRadius: 3
}));

const DrawerHeader = styled(Box)(({ theme }) => ({
padding: '24px',
display: 'flex',
Expand Down Expand Up @@ -59,8 +53,8 @@ const FilterCounter = styled(Box)(({ theme }) => ({
alignItems: 'center',
justifyContent: 'center',
margin: '0 4px',
color: '#F6F5F5',
backgroundColor: '#CE3B20'
color: COLORS.TEXT_PRIMARY,
backgroundColor: COLORS.ACCENT_BLUE
}));

const DrawerTitle = styled(Typography)(({ theme }) => ({
Expand Down Expand Up @@ -183,29 +177,31 @@ const SwipeableEdgeDrawer = (props: Props) => {
maxWidth: '1000px'
}}
>
<DrawerHeader onClick={handleHeaderClick}>
<Box
style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
width: '100%',
maxWidth: '1000px'
}}
>
{left}
<Puller />
{title}
{filters}
<Puller />
<IconButton
onClick={toggleDrawer(false)}
aria-label={label}
{!disableSwipeToOpen ? (
<DrawerHeader onClick={handleHeaderClick}>
<Box
style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
width: '100%',
maxWidth: '1000px'
}}
>
{right}
</IconButton>
</Box>
</DrawerHeader>
{left}
{title}
{filters}
<IconButton
onClick={toggleDrawer(false)}
aria-label={label}
>
{right}
</IconButton>
</Box>
</DrawerHeader>
) : (
''
)}
{children}
</SwipeableDrawer>
</Root>
Expand Down