Skip to content

Commit

Permalink
Merge pull request #11 from chingu-x/CGD-33-Navbar
Browse files Browse the repository at this point in the history
Cgd 33 navbar
  • Loading branch information
Dan-Y-Ko authored Sep 8, 2023
2 parents 20b8481 + 5bc761e commit bf37d55
Show file tree
Hide file tree
Showing 16 changed files with 121 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"object-curly-newline": [2, { "minProperties": 4, "consistent": true }],
"brace-style": 2,
"no-multiple-empty-lines": 2,
"eol-last": [2, "always"]
"eol-last": [2, "always"],
"no-nested-ternary": 2
}
}
Binary file added public/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/chingu_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/grey_ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion public/next.svg

This file was deleted.

1 change: 0 additions & 1 deletion public/vercel.svg

This file was deleted.

7 changes: 2 additions & 5 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import "./globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { BellIcon } from "@heroicons/react/24/solid";
import { StoreProvider } from "@/components";
import { StoreProvider, Navbar } from "@/components";

export const metadata: Metadata = {
title: "Create Next App",
Expand All @@ -24,9 +23,7 @@ export default function RootLayout({
return (
<html lang="en" className={`${inter.className} bg-base-content`}>
<body>
<nav>
<BellIcon className="h-12 w-12 text-primary" />
</nav>
<Navbar />
<StoreProvider>{children}</StoreProvider>
</body>
</html>
Expand Down
17 changes: 10 additions & 7 deletions src/app/tech-stack/components/TechStackContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ import styles from "./TechStackContainer.module.css";
import { TechStackCard } from ".";

export default function TechStackContainer() {
function getJustifyClass(index: number) {
if (index % 3 === 0) {
return "justify-self-start";
} else if (index % 3 === 1) {
return "justify-self-center";
} else {
return "justify-self-end";
}
}
return (
<div
className={`card bg-primary-content p-10 ${styles["tech-container-width"]}`}
Expand All @@ -11,13 +20,7 @@ export default function TechStackContainer() {
{Object.keys(techStack).map((cardType, index) => (
<li
key={cardType}
className={`mx-auto xl:mx-0 ${
index % 3 === 0
? "justify-self-start"
: index % 3 === 1
? "justify-self-center" // eslint-disable-line
: "justify-self-end" // eslint-disable-line
}`}
className={`mx-auto xl:mx-0 ${getJustifyClass(index)}`}
>
<TechStackCard
title={cardType}
Expand Down
10 changes: 7 additions & 3 deletions src/components/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ interface AvatarProps {
height: number;
}

export default function Avatar({ image, width, height }: AvatarProps) {
export default function Avatar({
image,
width = 24,
height = 24,
}: AvatarProps) {
return (
<div className="avatar rounded-full border border-base-content">
<div className="px-0 pointer-events-none rounded-full">
<Image
alt="avatar"
src={
image ||
image ??
"https://png.pngtree.com/png-vector/20210604/ourmid/pngtree-gray-avatar-placeholder-png-image_3416697.jpg"
}
width={width}
Expand Down
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as StoreProvider } from "./StoreProvider";
export { default as Avatar } from "./Avatar";
export { default as Navbar } from "./navbar/Navbar";
export { default as Button } from "./Button";
16 changes: 16 additions & 0 deletions src/components/navbar/Bell.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { BellIcon } from "@heroicons/react/20/solid";

export default function Bell({
notificationCount,
}: {
notificationCount: number;
}) {
return (
<div className="indicator">
<span className="indicator-item badge badge-error px-1 rounded-full text-white">
{notificationCount}
</span>
<BellIcon className="h-6 w-6 hover:text-base-100 duration-200 self-center cursor-pointer" />
</div>
);
}
16 changes: 16 additions & 0 deletions src/components/navbar/ChinguMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Image from "next/image";

export default function ChinguMenu() {
return (
<div className="flex items-center gap-2 cursor-pointer">
<Image
src="/chingu_logo.png"
width={50}
height={50}
alt="Chingu Logo"
priority={false}
/>
<h2 className=" font-semibold text-lg">Chingu</h2>
</div>
);
}
22 changes: 22 additions & 0 deletions src/components/navbar/DropDown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ChevronDownIcon } from "@heroicons/react/24/outline";
import DropDownLink from "./DropDownLink";

export default function DropDown({ name }: { name: string }) {
return (
<div className="dropdown py-0 mx-2 dropdown-bottom">
<label
tabIndex={0}
className="btn m-0 p-0 bg-transparent border-none hover:border-none hover:bg-transparent"
>
{name} <ChevronDownIcon className="w-4" />
</label>
<ul
tabIndex={0}
className="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box right-0"
>
<DropDownLink title="Link 1" />
<DropDownLink title="404???" href="/hello404" />
</ul>
</div>
);
}
19 changes: 19 additions & 0 deletions src/components/navbar/DropDownLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Link from "next/link";

interface DropDownLinkProps {
title: string;
href?: string;
}

export default function DropDownLink({ title, href = "#" }: DropDownLinkProps) {
return (
<li>
<Link
href={href}
className="text-neutral hover:text-neutral-focus font-semibold duration-200"
>
{title}
</Link>
</li>
);
}
22 changes: 22 additions & 0 deletions src/components/navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Avatar } from "@/components";
import { Bell, ChinguMenu, DropDown } from "@/components/navbar";

const name = "Yorick";
const notificationCount = 4;

export default function Navbar() {
return (
<nav className="navbar bg-primary h-8">
<div className="flex-1 pl-2">
<ChinguMenu />
</div>
<div>
<Bell notificationCount={notificationCount} />
<div className="px-2 ml-6 flex flex-row items-center">
<Avatar image="/avatar.png" height={34} width={34} />
<DropDown name={name} />
</div>
</div>
</nav>
);
}
4 changes: 4 additions & 0 deletions src/components/navbar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as Bell } from "./Bell";
export { default as ChinguMenu } from "./ChinguMenu";
export { default as DropDown } from "./DropDown";
export { default as DropDownLink } from "./DropDownLink";

0 comments on commit bf37d55

Please sign in to comment.