-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reordered checkout layout for store (#263)
* Added new component for pickup dropdown for desktop view * Conditionally adds visible overflow for desktop * Removed min height
- Loading branch information
Showing
7 changed files
with
143 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div className={styles.eventPicker}> | ||
{events.length > 0 ? ( | ||
<div className={styles.window}> | ||
<PickupEventDetail pickupEvent={events[eventIndex] as PublicOrderPickupEvent} /> | ||
<Dropdown | ||
className={styles.dropdown} | ||
name="schedulePickup" | ||
ariaLabel="Select a pickup event" | ||
options={events.map((e, index) => { | ||
return { | ||
value: index.toString(), | ||
label: `${e.title} (${formatEventDate(e.start, e.end)})`, | ||
}; | ||
})} | ||
value={eventIndex.toString()} | ||
onChange={v => setEventIndex(Number(v))} | ||
/> | ||
</div> | ||
) : ( | ||
<div className={styles.noEvents}> | ||
<Typography variant="h3/medium" component="span"> | ||
No upcoming pickup events. Check back later! | ||
</Typography> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default PickupEventDropdown; |
41 changes: 41 additions & 0 deletions
41
src/components/store/PickupEventDropdown/style.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/components/store/PickupEventDropdown/style.module.scss.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters