Skip to content

Commit

Permalink
refactor(web): move banner to main app layout component
Browse files Browse the repository at this point in the history
  • Loading branch information
PJColombo committed Nov 1, 2024
1 parent 4b75e4a commit 4c609e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 4 additions & 0 deletions apps/web/src/components/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useState } from "react";
import cn from "classnames";

import { useIsHomepage } from "~/hooks/useIsHomePage";
import GitcoinBanner from "../GitcoinBanner";
import { BottomBarLayout } from "./BottomBarLayout";
import { TopBarLayout } from "./TopBarLayout";

Expand All @@ -11,9 +13,11 @@ interface LayoutProps {

const AppLayout = ({ children }: LayoutProps) => {
const isHomepage = useIsHomepage();
const [showBanner, setShowBanner] = useState(true);

return (
<div className="flex min-h-screen flex-col">
{showBanner && <GitcoinBanner onClose={() => setShowBanner(false)} />}
<TopBarLayout />
<main
className={cn("container mx-auto grow", {
Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/components/AppLayout/TopBarLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useState } from "react";
import React from "react";

import GitcoinBanner from "~/components/GitcoinBanner";
import { SidebarNavigationMenu } from "~/components/SidebarNavigationMenu";
import { ThemeModeButton } from "~/components/ThemeModeButton";
import { useIsHomepage } from "~/hooks/useIsHomePage";
Expand All @@ -11,12 +10,10 @@ import { TopBar } from "./TopBar";

export const TopBarLayout: React.FC = () => {
const isHomepage = useIsHomepage();
const [showBanner, setShowBanner] = useState(true);

if (isHomepage) {
return (
<>
{showBanner && <GitcoinBanner onClose={() => setShowBanner(false)} />}
<nav className="z-10 flex h-16 w-full items-center justify-end px-4 md:justify-between">
<div className="ml-5 w-full md:ml-0 md:flex">
<ExplorerDetails placement="top" />
Expand All @@ -42,7 +39,6 @@ export const TopBarLayout: React.FC = () => {
<div
className={`z-10 hidden h-16 w-full items-center justify-between sm:block`}
>
{showBanner && <GitcoinBanner onClose={() => setShowBanner(false)} />}
<TopBar />
</div>
<CompactTopBar />
Expand Down

0 comments on commit 4c609e8

Please sign in to comment.