Skip to content

Commit 2d3b70c

Browse files
committed
Header / Footer tweaks on mobile
1 parent ce2ce16 commit 2d3b70c

File tree

5 files changed

+31
-67
lines changed

5 files changed

+31
-67
lines changed

packages/nextjs/components/Footer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export const Footer = () => {
1212
useInitializeNativeCurrencyPrice();
1313

1414
return (
15-
<div className="min-h-0 py-5 px-1 mb-11 lg:mb-0">
15+
<div className="min-h-0 py-5 px-1 sm:mb-11 lg:mb-0">
1616
<div className="w-full">
1717
<ul className="menu menu-horizontal w-full">
18-
<div className="flex justify-center items-center gap-2 text-sm w-full">
18+
<div className="flex flex-col sm:flex-row justify-center items-center gap-3 sm:gap-2 text-sm w-full">
1919
<div className="text-center">
2020
<a
2121
href="https://github.com/buidlguidl/ctf.buidlguidl.com"
@@ -26,7 +26,7 @@ export const Footer = () => {
2626
Fork me
2727
</a>
2828
</div>
29-
<span>·</span>
29+
<span className="hidden sm:inline">·</span>
3030
<div className="flex justify-center items-center gap-2">
3131
<p className="m-0 text-center">
3232
Built with <HeartIcon className="inline-block h-4 w-4" /> at
@@ -41,7 +41,7 @@ export const Footer = () => {
4141
<span className="link">BuidlGuidl</span>
4242
</a>
4343
</div>
44-
<span>·</span>
44+
<span className="hidden sm:inline">·</span>
4545
<div className="text-center">
4646
<Link href="/faqs" className="link">
4747
FAQs
Lines changed: 25 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,54 @@
11
"use client";
22

3-
import { ReactNode, useCallback, useRef, useState } from "react";
43
import Image from "next/image";
54
import Link from "next/link";
65
import { hardhat } from "viem/chains";
76
import { useAccount } from "wagmi";
8-
import { Bars3Icon } from "@heroicons/react/24/outline";
97
import { FaucetButton, RainbowKitCustomConnectButton } from "~~/components/scaffold-eth";
10-
import { useOutsideClick } from "~~/hooks/scaffold-eth";
118
import { useFetchUserData } from "~~/hooks/useFetchUserData";
129
import scaffoldConfig from "~~/scaffold.config";
1310

1411
/**
1512
* Site header
1613
*/
17-
export const HeaderClient = ({ menuLinks }: { menuLinks: ReactNode }) => {
14+
export const HeaderClient = () => {
1815
const currentChain = scaffoldConfig.targetNetworks[0];
1916

20-
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
21-
const burgerMenuRef = useRef<HTMLDivElement>(null);
22-
useOutsideClick(
23-
burgerMenuRef,
24-
useCallback(() => setIsDrawerOpen(false), []),
25-
);
26-
2717
const { address: connectedAddress } = useAccount();
2818

2919
const { userData } = useFetchUserData({ address: connectedAddress });
3020

3121
const flagsCaptured = userData?.challenges?.items.length || 0;
3222

3323
return (
34-
<div className="py-4 px-4 flex justify-between lg:grid lg:grid-cols-3 items-center z-20 relative">
35-
<div className="">
36-
<div className="lg:hidden dropdown" ref={burgerMenuRef}>
37-
<label
38-
tabIndex={0}
39-
className="btn btn-ghost px-3"
40-
onClick={() => {
41-
setIsDrawerOpen(prevIsOpenState => !prevIsOpenState);
42-
}}
43-
>
44-
<Bars3Icon className="w-6 h-6" />
45-
</label>
46-
{isDrawerOpen && (
47-
<ul
48-
tabIndex={0}
49-
className="menu menu-compact gap-1 dropdown-content mt-3 p-2 bg-base-100 rounded-md w-52 border border-secondary"
50-
onClick={() => {
51-
setIsDrawerOpen(false);
52-
}}
24+
<>
25+
<div className="py-4 px-4 flex justify-between lg:grid lg:grid-cols-3 items-center z-20 relative">
26+
<div>
27+
<div className="text-white text-sm font-pressStart">
28+
<Link className="flex items-center gap-4" href="/">
29+
<Image alt="BuidlGuidl" className="w-8" src="/fortress-flag.svg" width={112} height={128} />
30+
<span className="mt-2 hidden lg:inline">BuidlGuidl CTF</span>
31+
</Link>
32+
</div>
33+
</div>
34+
<div className="hidden lg:block text-center">
35+
{connectedAddress && (
36+
<Link
37+
href={`/profile/${connectedAddress}`}
38+
className="text-white text-sm font-pressStart link-hover hover:text-primary"
5339
>
54-
{menuLinks}
55-
</ul>
40+
My Flags: {flagsCaptured}/12
41+
</Link>
5642
)}
5743
</div>
58-
<div className="hidden lg:block text-white text-sm font-pressStart">
59-
<Link className="flex items-center gap-4" href="/">
60-
<Image alt="BuidlGuidl" className="w-8" src="/fortress-flag.svg" width={112} height={128} />
61-
<span className="mt-2">BuidlGuidl CTF</span>
62-
</Link>
44+
<div className="flex">
45+
<div className="ml-auto flex">
46+
<RainbowKitCustomConnectButton />
47+
{(currentChain?.id as number) === hardhat.id && <FaucetButton />}
48+
</div>
6349
</div>
6450
</div>
65-
<div className="hidden lg:block text-center">
51+
<div className="text-center lg:hidden">
6652
{connectedAddress && (
6753
<Link
6854
href={`/profile/${connectedAddress}`}
@@ -72,12 +58,6 @@ export const HeaderClient = ({ menuLinks }: { menuLinks: ReactNode }) => {
7258
</Link>
7359
)}
7460
</div>
75-
<div className="flex">
76-
<div className="ml-auto flex">
77-
<RainbowKitCustomConnectButton />
78-
{(currentChain?.id as number) === hardhat.id && <FaucetButton />}
79-
</div>
80-
</div>
81-
</div>
61+
</>
8262
);
8363
};

packages/nextjs/components/Header/HeaderMenuLinks.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { HeaderClient } from "./HeaderClient";
2-
import { HeaderMenuLinks } from "./HeaderMenuLinks";
32

43
export const Header = () => {
5-
return <HeaderClient menuLinks={<HeaderMenuLinks />} />;
4+
return <HeaderClient />;
65
};

packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const AddressInfoDropdown = ({
5151
<details ref={dropdownRef} className="dropdown dropdown-end leading-3">
5252
<summary tabIndex={0} className="btn btn-secondary btn-sm pl-0 pr-2 shadow-md dropdown-toggle gap-0 !h-auto">
5353
<BlockieAvatar address={checkSumAddress} size={30} ensImage={ensAvatar} />
54-
<span className="ml-2 mr-1">
54+
<span className="hidden md:inline-block ml-2 mr-1">
5555
{isENS(displayName) ? displayName : checkSumAddress?.slice(0, 6) + "..." + checkSumAddress?.slice(-4)}
5656
</span>
5757
<ChevronDownIcon className="h-6 w-4 ml-2 sm:ml-0" />

0 commit comments

Comments
 (0)