Skip to content

Commit be4cb24

Browse files
authored
Merge pull request #32 from hack4impact-calpoly/notifications-page
feat: add notifications page with back navigation
2 parents a60a22c + 060b9cc commit be4cb24

File tree

3 files changed

+107
-6
lines changed

3 files changed

+107
-6
lines changed

src/app/notifications/page.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { Box, HStack, Text, VStack } from "@chakra-ui/react";
2+
import { LuMailbox, LuChevronLeft, LuSettings } from "react-icons/lu";
3+
import Link from "next/link";
4+
import NotificationCard from "@/components/NotificationCard";
5+
6+
type Notification = {
7+
id: string;
8+
title: string;
9+
timeAgo: string;
10+
icon?: string;
11+
unread?: boolean;
12+
};
13+
14+
export default function Page() {
15+
const notifications: Notification[] = [
16+
{ id: "1", title: "You reached a personal best!", timeAgo: "23hr ago", icon: "🏆", unread: true },
17+
{ id: "2", title: "Spring Challenges are here!", timeAgo: "2 days ago", unread: false },
18+
{ id: "3", title: "Your weekly summary is ready", timeAgo: "4 days ago", unread: true },
19+
];
20+
21+
return (
22+
<Box display={"flex"} alignItems={"center"} justifyContent={"center"}>
23+
<VStack maxW={400} w={"full"} gap={0}>
24+
<HStack w="full" px="20px" py="20px" justify="space-between">
25+
<HStack gap={3} align="baseline">
26+
<Link href="/" style={{ display: "inline-flex" }}>
27+
<LuChevronLeft size={24} style={{ display: "block" }} />
28+
</Link>
29+
<Text fontSize="32px" fontWeight="semibold" lineHeight="1" display="inline">
30+
Notifications
31+
</Text>
32+
</HStack>
33+
<Link href="/settings" style={{ display: "inline-flex" }}>
34+
<LuSettings size={24} style={{ display: "block" }} />
35+
</Link>
36+
</HStack>
37+
38+
<VStack w={"full"} gap={0} mb={20}>
39+
{notifications.map((n) => (
40+
<NotificationCard key={n.id} title={n.title} timeAgo={n.timeAgo} icon={n.icon} unread={n.unread} />
41+
))}
42+
</VStack>
43+
<VStack flex={1} justifyContent={"center"} alignItems={"center"}>
44+
<LuMailbox size="130px" color="#16243F" />
45+
<VStack mt={-8} gap={1}>
46+
<Text fontSize={24}>No more notifications</Text>
47+
<Text w={"200px"} textAlign={"center"} fontSize={11} fontWeight="medium" lineHeight={1}>
48+
Missing notifications? Visit your <br />
49+
<Text as="span" color="#0084FF" textDecoration="underline">
50+
historical notifications
51+
</Text>
52+
</Text>
53+
</VStack>
54+
</VStack>
55+
</VStack>
56+
</Box>
57+
);
58+
}

src/app/page.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
import { Box, IconButton, Text, VStack, HStack } from "@chakra-ui/react";
22
import ProgressRing from "@/components/ProgressRing";
3-
import { FaChevronLeft, FaChevronRight } from "react-icons/fa";
3+
import { LuChevronLeft, LuChevronRight, LuBell } from "react-icons/lu";
4+
import Link from "next/link";
45

56
export default function Home() {
67
return (
78
<main>
8-
<Box display={"flex"} alignItems={"center"}>
9-
<VStack w={"full"}>
10-
<Text>Home</Text>
9+
<Box display={"flex"} alignItems={"center"} justifyContent={"center"}>
10+
<VStack maxW={400} w={"full"} gap={0}>
11+
<HStack w={"full"} justifyContent={"space-between"} padding={"20px"}>
12+
<Text fontWeight={"semibold"} fontSize={32}>
13+
Hi, Ethan!
14+
</Text>
15+
<Link href="/notifications" style={{ display: "flex", cursor: "pointer" }}>
16+
<LuBell size={24} />
17+
</Link>
18+
</HStack>
1119
{/* Progress Ring */}
1220
<VStack w={"full"} gap={5} padding={"20px"}>
1321
<HStack w={"full"} justifyContent={"space-between"}>
1422
<IconButton area-label="Previous Progress Ring" variant={"ghost"}>
15-
<FaChevronLeft />
23+
<LuChevronLeft />
1624
</IconButton>
1725
<Text fontSize={"x-large"} fontWeight={"semibold"}>
1826
Today
1927
</Text>
2028
<IconButton area-label="Next Progress Ring" variant={"ghost"}>
21-
<FaChevronRight />
29+
<LuChevronRight />
2230
</IconButton>
2331
</HStack>
2432
<ProgressRing percent={70} isClockwise={false} />
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Box, Grid, HStack, IconButton, Text, VStack } from "@chakra-ui/react";
2+
3+
type Props = {
4+
title: string;
5+
timeAgo: string;
6+
icon?: string;
7+
unread?: boolean;
8+
};
9+
10+
export default function NotificationCard({ title, timeAgo, icon, unread }: Props) {
11+
return (
12+
<HStack w="full" py={4} px={5} borderBottom=".5px solid" borderColor="#16243F" justify="space-between">
13+
<HStack align="center" gap={8}>
14+
<VStack align="flex-start" gap={0} flex={1}>
15+
<Text fontSize="16px" fontWeight="semibold">
16+
{title}
17+
</Text>
18+
19+
<Text fontSize="11px" color="#16243F" opacity="60%" lineHeight="1">
20+
{timeAgo}
21+
</Text>
22+
</VStack>
23+
{icon ? (
24+
<Box>
25+
<Text fontSize="24px" lineHeight="1">
26+
{icon}
27+
</Text>
28+
</Box>
29+
) : null}
30+
</HStack>
31+
32+
{unread ? <Box w="10px" h="10px" borderRadius="full" bg="#63ADF2" /> : null}
33+
</HStack>
34+
);
35+
}

0 commit comments

Comments
 (0)