From da303fc6a0f47a565723f216d403d40c608a3677 Mon Sep 17 00:00:00 2001
From: Angela Hu <51968178+angela139@users.noreply.github.com>
Date: Mon, 19 Aug 2024 14:32:55 -0400
Subject: [PATCH] Reordered checkout layout for store (#263)
* Added new component for pickup dropdown for desktop view
* Conditionally adds visible overflow for desktop
* Removed min height
---
.../store/PickupEventDropdown/index.tsx | 44 +++++++++++++++++++
.../PickupEventDropdown/style.module.scss | 41 +++++++++++++++++
.../style.module.scss.d.ts | 12 +++++
src/components/store/index.ts | 1 +
src/pages/store/cart.tsx | 22 +++++++---
src/styles/pages/store/cart/index.module.scss | 34 +++++++++++---
.../pages/store/cart/index.module.scss.d.ts | 2 +
7 files changed, 143 insertions(+), 13 deletions(-)
create mode 100644 src/components/store/PickupEventDropdown/index.tsx
create mode 100644 src/components/store/PickupEventDropdown/style.module.scss
create mode 100644 src/components/store/PickupEventDropdown/style.module.scss.d.ts
diff --git a/src/components/store/PickupEventDropdown/index.tsx b/src/components/store/PickupEventDropdown/index.tsx
new file mode 100644
index 00000000..fa608881
--- /dev/null
+++ b/src/components/store/PickupEventDropdown/index.tsx
@@ -0,0 +1,44 @@
+import PickupEventDetail from '@/components/store/PickupEventDetail';
+import { Dropdown, Typography } from '@/components/common';
+import { PublicOrderPickupEvent } from '@/lib/types/apiResponses';
+import { formatEventDate } from '@/lib/utils';
+import styles from './style.module.scss';
+
+interface EventPickerProps {
+ events: PublicOrderPickupEvent[];
+ eventIndex: number;
+ setEventIndex: (...args: any[]) => any;
+}
+
+const PickupEventDropdown = ({ events, eventIndex, setEventIndex }: EventPickerProps) => {
+ return (
+
+ {events.length > 0 ? (
+
+
+
{
+ return {
+ value: index.toString(),
+ label: `${e.title} (${formatEventDate(e.start, e.end)})`,
+ };
+ })}
+ value={eventIndex.toString()}
+ onChange={v => setEventIndex(Number(v))}
+ />
+
+ ) : (
+
+
+ No upcoming pickup events. Check back later!
+
+
+ )}
+
+ );
+};
+
+export default PickupEventDropdown;
diff --git a/src/components/store/PickupEventDropdown/style.module.scss b/src/components/store/PickupEventDropdown/style.module.scss
new file mode 100644
index 00000000..d7476674
--- /dev/null
+++ b/src/components/store/PickupEventDropdown/style.module.scss
@@ -0,0 +1,41 @@
+@use 'src/styles/vars.scss' as vars;
+
+.eventPicker {
+ display: flex;
+ flex-direction: column;
+
+ .window {
+ display: flex;
+ flex-direction: column;
+ gap: 2rem;
+ height: 100%;
+ padding: 2rem;
+
+ .dropdown {
+ background-color: var(--theme-surface-1);
+ border-radius: 1rem;
+ line-height: 2rem;
+ padding: 1rem;
+
+ select {
+ font-weight: normal;
+ }
+
+ option,
+ button,
+ div {
+ background-color: var(--theme-surface-1);
+
+ :hover {
+ background-color: var(--theme-surface-2);
+ }
+ }
+ }
+ }
+
+ .noEvents {
+ color: var(--theme-text-on-background-3);
+ margin: auto;
+ text-align: center;
+ }
+}
diff --git a/src/components/store/PickupEventDropdown/style.module.scss.d.ts b/src/components/store/PickupEventDropdown/style.module.scss.d.ts
new file mode 100644
index 00000000..996064e6
--- /dev/null
+++ b/src/components/store/PickupEventDropdown/style.module.scss.d.ts
@@ -0,0 +1,12 @@
+export type Styles = {
+ dropdown: string;
+ eventPicker: string;
+ noEvents: string;
+ window: string;
+};
+
+export type ClassNames = keyof Styles;
+
+declare const styles: Styles;
+
+export default styles;
diff --git a/src/components/store/index.ts b/src/components/store/index.ts
index fb49674c..3ce2d86e 100644
--- a/src/components/store/index.ts
+++ b/src/components/store/index.ts
@@ -13,6 +13,7 @@ export { default as OrderCard } from './OrderCard';
export { default as OrdersDisplay } from './OrdersDisplay';
export { default as PickupEventDetail } from './PickupEventDetail';
export { default as PickupEventPicker } from './PickupEventPicker';
+export { default as PickupEventDropdown } from './PickupEventDropdown';
export { default as StoreConfirmModal } from './StoreConfirmModal';
export { default as StoreEditButton } from './StoreEditButton';
export { default as Navbar } from './StoreNavbar';
diff --git a/src/pages/store/cart.tsx b/src/pages/store/cart.tsx
index 765ab9af..3b00ffa5 100644
--- a/src/pages/store/cart.tsx
+++ b/src/pages/store/cart.tsx
@@ -4,6 +4,7 @@ import {
Diamonds,
Navbar,
PickupEventDetail,
+ PickupEventDropdown,
PickupEventPicker,
StoreConfirmModal,
} from '@/components/store';
@@ -186,12 +187,21 @@ const StoreCartPage = ({ user: { credits }, savedCart, pickupEvents }: CartPageP
{cartState !== CartState.CONFIRMED ? 'Choose Pickup Event' : 'Pickup Event Details'}
-
+
+
)}
diff --git a/src/styles/pages/store/cart/index.module.scss b/src/styles/pages/store/cart/index.module.scss
index b9bd0a06..42553409 100644
--- a/src/styles/pages/store/cart/index.module.scss
+++ b/src/styles/pages/store/cart/index.module.scss
@@ -8,27 +8,26 @@
max-width: 81rem;
.content {
- align-items: start;
display: grid;
grid-column-gap: 2rem;
grid-template-areas:
- 'title placeOrder'
- 'confirmation event'
- 'items event'
+ 'title title'
+ 'confirmation confirmation'
'items summary'
- 'items warning';
+ 'event placeOrder'
+ 'warning placeOrder';
grid-template-columns: 1fr 20rem;
grid-template-rows: auto auto auto auto 1fr;
@media screen and (max-width: vars.$breakpoint-md) {
grid-template-areas:
'title'
- 'placeOrder'
'warning'
'confirmation'
'event'
'items'
- 'summary';
+ 'summary'
+ 'placeOrder';
grid-template-columns: 1fr;
}
@@ -165,8 +164,29 @@
}
.eventPicker {
+ background-color: var(--theme-elevated-background);
grid-area: event;
margin-bottom: 2rem;
+
+ @media screen and (min-width: vars.$breakpoint-md) {
+ overflow: visible;
+ }
+
+ .mobile {
+ display: none;
+
+ @media screen and (max-width: vars.$breakpoint-md) {
+ display: block;
+ }
+ }
+
+ .desktop {
+ display: block;
+
+ @media screen and (max-width: vars.$breakpoint-md) {
+ display: none;
+ }
+ }
}
.warning {
diff --git a/src/styles/pages/store/cart/index.module.scss.d.ts b/src/styles/pages/store/cart/index.module.scss.d.ts
index 0bcde840..f4e56de2 100644
--- a/src/styles/pages/store/cart/index.module.scss.d.ts
+++ b/src/styles/pages/store/cart/index.module.scss.d.ts
@@ -4,10 +4,12 @@ export type Styles = {
confirming: string;
container: string;
content: string;
+ desktop: string;
emptyCart: string;
eventPicker: string;
header: string;
items: string;
+ mobile: string;
pickupEventDetail: string;
placeOrder: string;
points: string;