-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from UTDNebula/JUP-47-improve-events-page
JUP-47: improve events page
- Loading branch information
Showing
15 changed files
with
522 additions
and
582 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,69 @@ | ||
'use client'; | ||
|
||
import 'react-day-picker/dist/style.css'; | ||
import { LeftArrowIcon, RightArrowIcon } from '@src/icons/Icons'; | ||
import { DayPicker, useInput } from 'react-day-picker'; | ||
import { | ||
Popover, | ||
PopoverClose, | ||
PopoverContent, | ||
PopoverPortal, | ||
PopoverTrigger, | ||
} from '@radix-ui/react-popover'; | ||
import { addDays, subDays } from 'date-fns'; | ||
import { useEffect } from 'react'; | ||
import { type eventParamsSchema } from '@src/utils/eventFilter'; | ||
import { type useSyncedSearchParamsDispatch } from '@src/utils/useSyncedSearchParams'; | ||
type DateBrowserProps = { | ||
filterState: eventParamsSchema; | ||
setParams: useSyncedSearchParamsDispatch<eventParamsSchema>; | ||
}; | ||
const DateBrowser = ({ filterState, setParams }: DateBrowserProps) => { | ||
const { inputProps, dayPickerProps, setSelected } = useInput({ | ||
defaultSelected: filterState.date, | ||
}); | ||
useEffect(() => { | ||
if (dayPickerProps.selected != undefined) { | ||
setParams({ date: dayPickerProps.selected }); | ||
} | ||
}, [dayPickerProps.selected]); | ||
return ( | ||
<div className="flex w-full flex-row justify-between rounded-3xl bg-white px-5 py-2.5 align-middle shadow-md md:w-fit"> | ||
{/* eslint-disable-next-line @typescript-eslint/no-misused-promises */} | ||
<button | ||
onClick={() => { | ||
setSelected(subDays(dayPickerProps.selected!, 1)); | ||
}} | ||
aria-label="back one day" | ||
type="submit" | ||
> | ||
<div> | ||
<LeftArrowIcon fill="fill-black" /> | ||
</div> | ||
</button> | ||
<Popover defaultOpen={false}> | ||
<PopoverTrigger> | ||
<input name="date" {...inputProps} /> | ||
</PopoverTrigger> | ||
<PopoverPortal> | ||
<PopoverContent className="flex items-center rounded-lg bg-white p-2 shadow-md"> | ||
<DayPicker mode="default" {...dayPickerProps} /> | ||
<PopoverClose className="h-5 w-5 text-blue-primary" /> | ||
</PopoverContent> | ||
</PopoverPortal> | ||
</Popover> | ||
<button | ||
onClick={() => { | ||
setSelected(addDays(dayPickerProps.selected!, 1)); | ||
}} | ||
aria-label="forward one day" | ||
type="submit" | ||
> | ||
<div> | ||
<RightArrowIcon fill="fill-black" /> | ||
</div> | ||
</button> | ||
</div> | ||
); | ||
}; | ||
export default DateBrowser; |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.