Skip to content

Commit

Permalink
feat(nav): ✨ alarm indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
gracefullight committed Oct 28, 2023
1 parent 05ce9aa commit 41acc49
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/web/public/sw.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 19 additions & 6 deletions apps/web/src/components/main/MainNavbar.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { BellIcon, MapPinIcon } from "@heroicons/react/24/solid";
import { useRouter } from "next/router";
import { useState } from "react";

export default function MainNavbar() {
// TODO: count unread alarms
const [hasUnreadAlarms] = useState(true);
const router = useRouter();
const handleNearby = async () => {
await router.push("/benefit/nearby");
};

const handleNotification = async () => {
await router.push("/notification");
};

return (
<div className="navbar bg-base-100 sticky top-0 z-50">
<div className="flex-1">
Expand All @@ -23,11 +26,21 @@ export default function MainNavbar() {
title="함께 도스켜고 포인트"
type="button"
>
<MapPinIcon className="h-6 w-6" />
</button>
<button className="btn btn-square btn-ghost" title="알림" type="button" onClick={() => void handleNotification()}>
<BellIcon className="h-6 w-6" />
<MapPinIcon className="h-6 w-6 fill-yellow-500" />
</button>
<div className="indicator">
{hasUnreadAlarms && (
<span className="indicator-item badge badge-error right-1 top-1 h-2 p-1"></span>
)}
<button
className="btn btn-square btn-ghost"
title="알림"
type="button"
onClick={() => void handleNotification()}
>
<BellIcon className="h-6 w-6" />
</button>
</div>
</div>
</div>
);
Expand Down

0 comments on commit 41acc49

Please sign in to comment.