-
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.
Merge pull request #31 from icssc/28-feat-date-range-filter-button
28 feat date range filter button
- Loading branch information
Showing
9 changed files
with
364 additions
and
141 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
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,74 @@ | ||
import { Button, Menu, MenuButton, MenuList, MenuItem } from "@chakra-ui/react"; | ||
import { useState, useContext } from "react"; | ||
import { ChevronDownIcon } from "@chakra-ui/icons"; | ||
import DataContext from "../../context/DataContext"; | ||
|
||
import { | ||
retrieveItemsAllTime, | ||
retrieveItemsWithinMonth, | ||
retrieveItemsWithinTwoWeeks, | ||
retrieveItemsWithinWeek, | ||
retrieveItemsWithinYear, | ||
} from "../../utils/HomeUtils"; | ||
|
||
export default function DateRangeFilter() { | ||
const [DateRangeFilter, setDateRangeFilter] = useState("Date Range Filter"); | ||
const { setLoading, setData } = useContext(DataContext); | ||
|
||
return ( | ||
<Menu> | ||
<MenuButton | ||
as={Button} | ||
rightIcon={<ChevronDownIcon />} | ||
backgroundColor="white" | ||
variant="outline" | ||
boxShadow="7px 7px 14px #666666, | ||
-7px -7px 14px #ffffff;" | ||
color="#74a2fa" | ||
fontSize={{ base: "xl", md: "2xl" }} | ||
size="lg" | ||
// gap={2} | ||
borderRadius={"lg"} | ||
> | ||
{DateRangeFilter} | ||
</MenuButton> | ||
<MenuList> | ||
<MenuItem | ||
onClick={() => | ||
retrieveItemsAllTime(setData, setDateRangeFilter, setLoading) | ||
} | ||
> | ||
All | ||
</MenuItem> | ||
<MenuItem | ||
onClick={() => | ||
retrieveItemsWithinWeek(setData, setDateRangeFilter, setLoading) | ||
} | ||
> | ||
Last 7 Days | ||
</MenuItem> | ||
<MenuItem | ||
onClick={() => | ||
retrieveItemsWithinTwoWeeks(setData, setDateRangeFilter, setLoading) | ||
} | ||
> | ||
Last 14 Days | ||
</MenuItem> | ||
<MenuItem | ||
onClick={() => | ||
retrieveItemsWithinMonth(setData, setDateRangeFilter, setLoading) | ||
} | ||
> | ||
Last 30 Days | ||
</MenuItem> | ||
<MenuItem | ||
onClick={() => | ||
retrieveItemsWithinYear(setData, setDateRangeFilter, setLoading) | ||
} | ||
> | ||
This Year | ||
</MenuItem> | ||
</MenuList> | ||
</Menu> | ||
); | ||
} |
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,88 @@ | ||
import { | ||
Button, | ||
Flex, | ||
Image, | ||
Menu, | ||
MenuButton, | ||
MenuList, | ||
MenuItem, | ||
} from "@chakra-ui/react"; | ||
|
||
import { useState } from "react"; | ||
import logo from "../../assets/images/small_logo.png"; | ||
import instagram from "../../assets/logos/instagram.svg"; | ||
import { ChevronDownIcon } from "@chakra-ui/icons"; | ||
|
||
export default function ZotNFoundLogoText() { | ||
const [screenWidth, setScreenWidth] = useState(window.screen.width); | ||
|
||
window.onresize = () => { | ||
setScreenWidth(window.screen.width); | ||
}; | ||
return ( | ||
<Flex | ||
alignItems="center" | ||
w={{ base: "20%", md: "20%" }} | ||
className="med" | ||
minWidth={{ base: "125px", md: "315px" }} | ||
> | ||
<Image | ||
width={{ base: "50px", md: "100px" }} | ||
src={logo} | ||
mb="5%" | ||
mt="3%" | ||
ml="10%" | ||
display={screenWidth < 350 ? "None" : "inline"} | ||
/> | ||
<Menu autoSelect={false}> | ||
<MenuButton | ||
as={Button} | ||
rightIcon={<ChevronDownIcon />} | ||
size={{ base: "4xl", md: "4xl" }} | ||
ml="3%" | ||
fontSize={{ base: "xl", md: "4xl" }} | ||
background="white" | ||
justifyContent="center" | ||
alignItems="center" | ||
padding={2} | ||
> | ||
ZotNFound | ||
</MenuButton> | ||
|
||
{/* ZotnFound Logo/Text Dropdown */} | ||
<MenuList zIndex={10000}> | ||
<MenuItem | ||
alignItems={"center"} | ||
justifyContent={"center"} | ||
as={"a"} | ||
href="https://www.instagram.com/zotnfound/" | ||
> | ||
@ZotNFound | ||
<Image | ||
src={instagram} | ||
maxWidth="10%" | ||
maxHeight="10%" | ||
ml="5%" | ||
></Image> | ||
</MenuItem> | ||
<MenuItem | ||
alignItems={"center"} | ||
justifyContent={"center"} | ||
as={"a"} | ||
href="/update" | ||
> | ||
News | ||
</MenuItem> | ||
<MenuItem | ||
alignItems={"center"} | ||
justifyContent={"center"} | ||
as={"a"} | ||
href="/about" | ||
> | ||
About | ||
</MenuItem> | ||
</MenuList> | ||
</Menu> | ||
</Flex> | ||
); | ||
} |
Oops, something went wrong.