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

header | matched design #36

Open
wants to merge 1 commit 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
3 changes: 2 additions & 1 deletion ecommerce/components/Layout/CartSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client"
import { IoCartOutline } from 'react-icons/io5'
import Image from 'next/image';
import { Button } from "../ui/button"
import { Input } from "../ui/input"
import { Label } from "../ui/label"
Expand All @@ -23,7 +24,7 @@ type CartSliderProps = {
<Sheet key="side">
<SheetTrigger asChild>
<Button variant="link" >
<IoCartOutline className={`h-6 w-6 text-${variant}`}/>
<Image src={'/cart.svg'} width='17' height='20' alt="Cart" className='min-w-15 max-w-15'/>
</Button>
</SheetTrigger>
<SheetContent side="right">
Expand Down
30 changes: 14 additions & 16 deletions ecommerce/components/Layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,44 @@ import { AuthSlider } from "./AuthSlider"
import { CartSlider } from "./CartSlider"
import { SideNav } from "./SideNav"
import { BuilderContent } from '@builder.io/react';
import styles from './header.module.css'
import Image from 'next/image';


export function Header({ headerContent }: any) {
return (
<BuilderContent model="header-links" content={headerContent}>
{(data) => (
<header className="w-full flex flex-1 border-y mb-4">
<div className="px-4 p-3 flex justify-between container">
<header className={styles.header}>
<div className={styles.container}>

<NavigationMenuItem className="flex md:hidden">
<SideNav />
</NavigationMenuItem>
<Button variant="link" asChild>
<Button variant="link" asChild className={styles.mainLink}>
<Link href="/" passHref>
<img
className="h-6"
src="https://cdn.builder.io/api/v1/image/assets%2Ff5348105e75441b59830f1e489577801%2F6ad04e7727854622abc5cb8b6e539000"
alt="Builder.io Logo"
loading="lazy"
/>
<Image src={'/shopaholic.svg'} alt='Shopaholic' width="160" height="30" className={styles.logo}/>
</Link>
</Button>
<NavigationMenu className="hidden md:flex space-x-5">
<NavigationMenuList className="justify-around w-full">
<NavigationMenuList className={styles.nav}>
{data?.headerLinks.map((item:any, index:number) => {
return(
<Button key={index} variant="link" className="text-md">
<Link href={item.path || '/'} legacyBehavior passHref >
<Link href={item.path || '/'} legacyBehavior passHref key={index}>
{/* <NavigationMenuLink className={navigationMenuTriggerStyle()}> */}
<span className={`uppercase font-normal ${item.highlight ? "text-rose-500" : ""}`}>{item.label}</span>
<span className={styles.navLink + " " + (item.highlight ? styles.highlight : "")}>{item.label}</span>
{/* </NavigationMenuLink> */}
</Link>
</Button>
)
})}
</NavigationMenuList>
</NavigationMenu>
<div className="flex items-center">
<div className={styles.actions}>
<CartSlider variant="black"/>
<AuthSlider variant="black"/>
<div className="hidden md:flex">
<AuthSlider variant="black"/>
</div>

</div>
</div>
</header>
Expand Down
100 changes: 100 additions & 0 deletions ecommerce/components/Layout/header.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
.header{
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding-left: 2rem;
padding-right: 2rem;
padding-top: 1rem;
padding-bottom: 1rem;
background-color: white;
position: relative;
}

.container{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
width: 100%;
max-width: 1200px;
}

.logo{
width: 100%;
max-width: 160px;
min-width: 160px;
}

.nav{
display: flex;
gap: 25px
}

.navLink{
font-size: 15px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 3.15px;
cursor: pointer;
border-bottom: 2.5px solid transparent;
margin-top: 3px;
padding: 5px;
transition: .3s ease-out;
}

.navLink:hover{
border-bottom: 2.5px solid black;
}

.highlight{
color: #B63333;
}

.highlight:hover{
border-color: #B63333;
}

.actions{
display: flex;
gap: 15px;
align-items: center;
}

@media screen and (max-width: 950px){
.logo{
width: 100%;
max-width: 140px;
min-width: 140px;
}
.nav{
gap: 0px;
}
.navLink{
font-size: 13px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 3px;
cursor: pointer;
border-bottom: 2.5px solid transparent;
margin-top: 7px;
padding: 0px;
padding-bottom: 3px;
}
.actions{
display: flex;
gap: 5px;
align-items: center;
}
}

@media screen and (max-width: 767px){
.header{
padding-top: .5rem;
padding-bottom: .5rem;
}
.mainLink{
position: absolute;
left: 65px;
}
}
Loading