Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: Navbar Dock added on Landing Page #127

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 68 additions & 67 deletions components/nav/navItemWithSmallDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,79 +1,80 @@
import React, {useState} from "react";
import React, { useState } from "react";
import Link from "next/link";
import {UpIcon} from "./UpIcon"
import { UpIcon } from "./UpIcon"
import DownIcon from "./DownIcon"
import Image from "next/image";

export interface NavItemWithSmallDropdownProps {
heading: string;
dropdownData: DropdowndataInterface[];
}
heading: string;
dropdownData: DropdowndataInterface[];
}

export interface DropdowndataInterface{
heading:string;
links:LinkDatainterface[]
export interface DropdowndataInterface {
heading: string;
links: LinkDatainterface[]
}
export interface LinkDatainterface {
pagelink: string;
pageName: string;
}
export default function NavItemWithSmallDropdown({ heading, dropdownData }: NavItemWithSmallDropdownProps) {
const [openDropdown, setShowDropdown] = useState(false)
const showDropdown = () => {
setShowDropdown(true)
}
const hideDropdown = () => {
setShowDropdown(false)
}
export interface LinkDatainterface{
pagelink:string;
pageName:string;
const toggleDropdown = () => {
setShowDropdown(!openDropdown)
}
export default function NavItemWithSmallDropdown({heading,dropdownData}:NavItemWithSmallDropdownProps){
const [openDropdown,setShowDropdown] = useState(false)
const showDropdown = ()=>{
setShowDropdown(true)
}
const hideDropdown = ()=>{
setShowDropdown(false)
}
const toggleDropdown =()=>{
setShowDropdown(!openDropdown)
}

return(
return (
<div
onMouseEnter={showDropdown}
onMouseLeave={hideDropdown}
className="relative flex items-center py-3 transition duration-150 ease-in-out cursor-pointer"
>
<div className="flex align-center text-gray-600 hover:text-primary-300">
<div className="font-medium mr-2">
Resources
</div>
<div onClick={toggleDropdown} className="pt-1.5">
{openDropdown ? <UpIcon className="text-current" /> : <DownIcon className="text-current" />}
</div>
</div>
{openDropdown && (
<div
onMouseEnter={showDropdown}
onMouseLeave={hideDropdown}
className="relative flex items-center py-3 transition duration-150 ease-in-out cursor-pointer"
>
<div className="flex align-center text-gray-600 hover:text-primary-300">
<div className="font-medium mr-2">
Resources
className="absolute top-full pb-0 bg-[#F5F5F5] pb-8 z-10 border border-gray-300 rounded-lg"
> <div>
<div className="flex items-center justify-between">
{dropdownData.map((lists) => (
<div key={lists.heading}>
{" "}
<span className="font-bold text-secondary-300 uppercase px-3 py-3 flex items-center transition duration-150 ease-in-out">
{lists.heading}
</span>
<ul>
{lists.links.map((link) => (
<li key={link.pageName}>
{" "}
{/* Ensure to add a key for list items when mapping */}
<Link
target="_blank"
href={link.pagelink}
className="font-medium text-gray-600 hover:text-primary-300 px-3 py-3 flex items-center transition duration-150 ease-in-out whitespace-nowrap "
>
{link.pageName}
</Link>
</li>
))}
</ul>
</div>
<div onClick={toggleDropdown} className="pt-1.5">
{openDropdown ? <UpIcon className="text-current" /> : <DownIcon className="text-current" />}
</div></div>
{openDropdown && (
<div
className="absolute top-full bg-[#eeeded] pb-8 z-10" >
<div>
<div className="flex items-center justify-between">
{dropdownData.map((lists) => (
<div key={lists.heading}>
{" "}
<span className="font-bold text-secondary-300 uppercase px-3 py-3 flex items-center transition duration-150 ease-in-out">
{lists.heading}
</span>
<ul>
{lists.links.map((link) => (
<li key={link.pageName}>
{" "}
{/* Ensure to add a key for list items when mapping */}
<Link
target="_blank"
href={link.pagelink}
className="font-medium text-gray-600 hover:text-primary-300 px-3 py-3 flex items-center transition duration-150 ease-in-out whitespace-nowrap "
>
{link.pageName}
</Link>
</li>
))}
</ul>
</div>
))}
</div>
</div>
</div>
)}
</div>
)
))}
</div>
</div>
</div>
)}
</div>
)
}
40 changes: 22 additions & 18 deletions components/ui/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Logo from "./logo";
import MobileMenu from "./mobile-menu";
import CountingNumbers from "../utils/countingNumbers";
import { isTypeOfExpression } from "typescript";
import NavItemWithSmallDropdown, {DropdowndataInterface,LinkDatainterface} from "@/components/nav/navItemWithSmallDropdown";
import NavItemWithSmallDropdown, { DropdowndataInterface, LinkDatainterface } from "@/components/nav/navItemWithSmallDropdown";
import { PillarPages } from "../utils/resources";
import { StarIcon } from "@heroicons/react/24/solid";
import Product from "../nav/productSection";
Expand Down Expand Up @@ -62,10 +62,15 @@ export default function Header() {

return (
<header
className={`fixed w-full z-30 bg-neutral-100 transition duration-300 ease-in-out ${
className={`fixed place-self-center z-30 bg-neutral-100 transition duration-300 ease-in-out ${!top ? "bg-neutral-100 place-self-center backdrop-blur-sm my-5 shadow-lg rounded-full w-fit ease-in-out" : "w-full"
}`}
>
{/*
<header
className={`fixed w-fit place-self-center shadow-lg my-5 z-30 bg-neutral-100 rounded-full transition duration-300 ease-in-out ${
!top ? "bg-neutral-100 backdrop-blur-sm shadow-lg" : ""
}`}
>
> */}
<div className="max-w-6xl mx-auto px-5 sm:px-6">
<div className="flex items-center justify-between h-16 md:h-20">
{/* Site branding */}
Expand All @@ -76,7 +81,7 @@ export default function Header() {
<nav className="hidden lg:flex flex-grow-0 w-6/12">
{/* Desktop privacy-policy in links */}
<ul className="flex grow justify-end flex items-center">
<li>
<li>
<Link
target="_blank"
href="https://keploy.io/devscribe"
Expand All @@ -102,10 +107,9 @@ export default function Header() {
</ul>
</nav>
<div className="header-btn-container flex-grow-0 w-4/12 justify-end hidden lg:flex">
<div className="border border-primary-400 rounded-md overflow-hidden p-2.5 border-opacity-40 relative transition-all group">
<div className="border border-primary-400 rounded-full overflow-hidden p-2.5 border-opacity-40 relative transition-all group">
{/* Sliding effect span */}
<span className="absolute right-0 -mt-12 h-32 w-8 translate-x-12 rotate-12 bg-orange-500 opacity-10 transition-transform duration-1000 ease-out group-hover:translate-x-[-400%]" />

<Link
className="flex items-center gap-2 text-sm text-primary-400 font-extrabold transition-colors hover:text-primary-500"
target="_blank"
Expand Down Expand Up @@ -133,18 +137,18 @@ export default function Header() {
<span className="text-base flex gap-1"> <CountingNumbers className="" /></span>
</Link>
</div>
<div className="ml-3">
<Link
href="https://app.keploy.io/signin"
target="_blank"
className="btn-sm text-gray-200 bg-secondary-300 hover:text-primary-300 "
>
<span>Sign In</span>
{/*<svg className="w-3 h-3 fill-current hover:text-primary-300 shrink-0 ml-2 -mr-1" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">*/}
{/* <path d="M11.707 5.293L7 .586 5.586 2l3 3H0v2h8.586l-3 3L7 11.414l4.707-4.707a1 1 0 000-1.414z" fillRule="nonzero" />*/}
{/*</svg>*/}
</Link>
</div>
<div className="rounded-full ml-3">
<Link
href="https://app.keploy.io/signin"
target="_blank"
className="btn-sm rounded-full text-gray-200 bg-secondary-300 h-12 hover:text-primary-300 "
>
<span>Sign In</span>
{/*<svg className="w-3 h-3 fill-current hover:text-primary-300 shrink-0 ml-2 -mr-1" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">*/}
{/* <path d="M11.707 5.293L7 .586 5.586 2l3 3H0v2h8.586l-3 3L7 11.414l4.707-4.707a1 1 0 000-1.414z" fillRule="nonzero" />*/}
{/*</svg>*/}
</Link>
</div>
</div>

<MobileMenu starsCount={starsCount} />
Expand Down