Skip to content

Commit

Permalink
add dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Afonso-santos committed Oct 14, 2023
1 parent bd08d0f commit 27a71d4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
47 changes: 35 additions & 12 deletions packages/ui/components/landing/Header/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState } from "react";
import Link from "next/link";
import { Grid } from "antd";
import { Grid, Dropdown, Menu, Space } from "antd";

import { DashboardOutlined, LogoutOutlined } from "@ant-design/icons";
import { DownOutlined, DashboardOutlined, LogoutOutlined } from "@ant-design/icons";

import { ThemeToggle, useAuth } from "@coderdojobraga/ui";
import MobileNavBar from "../MobileNavBar/MobileNavBar";
Expand All @@ -12,6 +12,7 @@ import { getUserInitials } from "../utils";

import styles from "./style.module.css";


const { useBreakpoint } = Grid;

interface EntryProps {
Expand All @@ -28,10 +29,28 @@ const Entry = ({ href, text }: EntryProps) => (
interface UserDropDownProps {
logout: () => void;
}
const EventosDropDown = () => (
<ul>
<li className="flex items-center text-base justify-start gap-x-2">
<Menu>
<Menu.Item>
<a href="/web/dojocon">Dojo Con</a>
</Menu.Item>
<Menu.Item>
<a href="/web/codercamp">Coder Camp</a>
</Menu.Item>
{/* <Menu.Item>
<a href="/web/dojocare">Dojo Care</a>
</Menu.Item> */}
</Menu>
</li>
</ul>
);


const UserDropDown = ({ logout }: UserDropDownProps) => (
<ul>
<li className="flex items-center justify-start gap-x-2">
<li className="flex items-center text-base justify-start gap-x-2">
<DashboardOutlined />
<Link href="/dashboard">Dashboard</Link>
</li>
Expand Down Expand Up @@ -69,11 +88,17 @@ function NavBar({ landing = true }: any) {

if (screens.md) {
return (
<ul className="flex items-center gap-8 text-sm uppercase text-black md:flex">
<ul className="flex items-center gap-5 text-base uppercase text-black md:flex">
{MENU_ENTRIES.map(({ key, text }) => (
<Entry href={key} text={text} />
))}

<Dropdown arrow={false} overlay={EventosDropDown} placement="bottomRight">
<Space>
Eventos <DownOutlined />
</Space>
</Dropdown>

{user ? (
<li
className="text-bold cursor-pointer"
Expand All @@ -93,11 +118,10 @@ function NavBar({ landing = true }: any) {
</div>
)}
<div
className={`absolute z-10 mt-2 ${
userDropdownVisible
? "opacity-100"
: "invisible -translate-y-full opacity-0"
} -translate-x-1/4 transform px-4 py-2 transition-all duration-300`}
className={`absolute z-10 mt-2 ${userDropdownVisible
? "opacity-100"
: "invisible -translate-y-full opacity-0"
} -translate-x-1/4 transform px-4 py-2 transition-all duration-300`}
>
<UserDropDown logout={logout} />
</div>
Expand All @@ -106,14 +130,13 @@ function NavBar({ landing = true }: any) {
<LoginButton isLoading={isLoading} />
)}

<li>
<ThemeToggle visible={!landing} />
</li>

</ul>
);
}

return <MobileNavBar landing={landing} />;
}


export default NavBar;
2 changes: 1 addition & 1 deletion packages/ui/components/landing/Header/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const MENU_ENTRIES = [
{ key: "/web/team", text: "Equipa" },
// { key: "/web/hall-of-fame", text: "Hall of Fame" },
{ key: "/web/faqs", text: "Faqs" },
//{ key: "/web/dojocon", text: "DojoCon" },
// { key: "/web/dojocon", text: "DojoCon" },
{ key: "/web/codercamp", text: "Coder Camp" },
{ key: "/blog", text: "Blog" },
];

0 comments on commit 27a71d4

Please sign in to comment.