From 88cc6c3d1282ced6e754a8427189c48c4ea526ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Pyntt=C3=A4ri?= Date: Thu, 12 Sep 2024 14:19:54 +0300 Subject: [PATCH] Fixing start time picker padding and margin --- .../components/AvailableRoomList/AvailableRoomList.test.tsx | 1 + .../src/components/AvailableRoomList/AvailableRoomList.tsx | 6 +++--- frontend/src/components/BookingView/StartingTimePicker.tsx | 6 ++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/AvailableRoomList/AvailableRoomList.test.tsx b/frontend/src/components/AvailableRoomList/AvailableRoomList.test.tsx index ca5c460..67d0dff 100644 --- a/frontend/src/components/AvailableRoomList/AvailableRoomList.test.tsx +++ b/frontend/src/components/AvailableRoomList/AvailableRoomList.test.tsx @@ -119,6 +119,7 @@ describe('AvailableRoomList', () => { }, selectedRoom: fakeRooms[0] }; + it('renders room data', async () => { render( ({ } })); -async function checkIfFavorited(room: Room, pref?: Preferences) { +function checkIfFavorited(room: Room, pref?: Preferences) { if (pref && pref.fav_rooms) { room.favorited = pref.fav_rooms.includes(room.id); } else { @@ -59,10 +59,10 @@ const AvailableRoomList = (props: BookingListProps) => { // Effect to update room favorited status useEffect(() => { - const updateFavoritedRooms = async () => { + const updateFavoritedRooms = () => { const roomsCopy = [...rooms]; // Make a shallow copy of rooms for (const room of roomsCopy) { - await checkIfFavorited(room, preferences); + checkIfFavorited(room, preferences); } setUpdatedRooms(roomsCopy); // Update state after processing all rooms }; diff --git a/frontend/src/components/BookingView/StartingTimePicker.tsx b/frontend/src/components/BookingView/StartingTimePicker.tsx index a1b1448..04553ba 100644 --- a/frontend/src/components/BookingView/StartingTimePicker.tsx +++ b/frontend/src/components/BookingView/StartingTimePicker.tsx @@ -7,9 +7,7 @@ import { formatTimeToHalfAndFullHours } from '../util/Time'; import AlertBox from '../util/alertBox'; const StartingTimeButton = styled(ToggleButton)(() => ({})); -const StartingTimePickerContent = styled(Box)(({ theme }) => ({ - margin: '8px 0px' -})); +const StartingTimePickerContent = styled(Box)(({ theme }) => ({})); type StartingTimePickerProps = { startingTime: string; @@ -81,7 +79,7 @@ const StartingTimePicker = (props: StartingTimePickerProps) => { exclusive onChange={handleChange} aria-label="duration picker" - sx={{ margin: '8px 0' }} + sx={{ marginTop: '8px', paddingBottom: '8px' }} fullWidth >