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

feat(frontend): update campaigns page ui to the new standards #432

Merged
merged 3 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 9 additions & 2 deletions packages/frontend/src/components/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,31 @@ import {
} from "../../constants";
import { CarrotMarquee } from "../ui/carrot-marquee";
import { Footer } from "../ui/footer";
import { Navbar } from "../ui/navbar";
import { Navbar, type NavbarProps } from "../ui/navbar";

interface LayoutProps {
navbarLinks?: NavbarLink[];
navbarBgColor?: NavbarProps["bgColor"];
noNavbar?: boolean;
footerLinks?: FooterLink[];
children?: ReactNode;
}

export const Layout = ({
navbarLinks,
navbarBgColor,
noNavbar,
footerLinks,
children,
}: LayoutProps) => {
return (
<div className="w-full flex flex-col bg-grid-light dark:bg-grid-dark bg-left-top">
{!noNavbar && <Navbar links={navbarLinks || NAVBAR_LINKS} />}
{!noNavbar && (
<Navbar
links={navbarLinks || NAVBAR_LINKS}
bgColor={navbarBgColor}
/>
)}
{children}
<CarrotMarquee />
<Footer footerLinks={footerLinks || FOOTER_LINKS} />
Expand Down
17 changes: 16 additions & 1 deletion packages/frontend/src/components/ui/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,30 @@ import { PreferencesPopover } from "./popovers/preferences";
import { useClickAway } from "react-use";
import { NavbarVerticalLayout } from "./vertical-layout";
import type { NavbarLink } from "../../../constants";
import { cva } from "class-variance-authority";

const rootStyles = cva(
["flex", "justify-center", "px-4", "xl:px-32", "bg-grid-light"],
{
variants: {
bgColor: {
orange: ["bg-orange"],
transparent: ["bg-transparent"],
},
},
},
);

export interface NavbarProps {
mode?: "standard" | "modal";
bgColor?: "transparent" | "orange";
onDismiss?: () => void;
links?: NavbarLink[];
}

export const Navbar = ({
mode = "standard",
bgColor = "transparent",
onDismiss,
links = [],
}: NavbarProps) => {
Expand Down Expand Up @@ -58,7 +73,7 @@ export const Navbar = ({
links={links}
onNavbarClose={() => setOpen(false)}
/>
<div className="flex justify-center px-4 xl:px-32 bg-transparent">
<div className={rootStyles({ bgColor })}>
<div className="w-full max-w-screen-2xl relative flex items-center justify-between py-5 md:py-8 xl:py-11">
<div className="flex gap-4 items-center">
<div className="flex items-center">
Expand Down
72 changes: 34 additions & 38 deletions packages/frontend/src/pages/campaigns/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,45 +115,41 @@ export const Campaigns = () => {
);

return (
<Layout>
<div className="relative">
<div className="relative">
<div className="px-6 py-16 md:px-10">
<Typography variant="h1">
{t("campaign.all")}
</Typography>
</div>
<div id="__campaigns_page">
<CampaignsTopNav
sortOptions={SORT_OPTIONS}
stateOptions={STATE_OPTIONS}
state={state}
sort={sort}
filtersOpen={filtersOpen}
setSearchQuery={setSearchQuery}
onOrderingChange={handleSortChange}
onStateChange={handleStateChange}
onToggleFilters={toggleFilters}
/>
</div>
<div className="flex">
<SideFilters
open={filtersOpen}
selectedTemplates={templates}
setSelectedTemplates={handleTemplatesUpdate}
selectedOracles={oracles}
setSelectedOracles={handleOraclesTemplatesUpdate}
toggleFilters={toggleFilters}
<Layout navbarBgColor="orange">
<div className="w-full relative flex flex-col items-center px-4 md:px-10 lg:px-14 xl:px-40">
<div className="py-16 w-full max-w-screen-2xl">
<Typography variant="h1">{t("campaign.all")}</Typography>
</div>
</div>
<div className="w-full" id="__campaigns_page">
<CampaignsTopNav
sortOptions={SORT_OPTIONS}
stateOptions={STATE_OPTIONS}
state={state}
sort={sort}
filtersOpen={filtersOpen}
setSearchQuery={setSearchQuery}
onOrderingChange={handleSortChange}
onStateChange={handleStateChange}
onToggleFilters={toggleFilters}
/>
</div>
<div className="w-full flex flex-col items-center px-4 md:px-10 lg:px-14 xl:px-40">
<SideFilters
open={filtersOpen}
selectedTemplates={templates}
setSelectedTemplates={handleTemplatesUpdate}
selectedOracles={oracles}
setSelectedOracles={handleOraclesTemplatesUpdate}
toggleFilters={toggleFilters}
/>
<div className="flex flex-col items-center w-full py-12 md:py-16">
<div className="flex flex-wrap justify-center gap-5 lg:justify-start">
<Grid
loading={loading}
kpiTokensReady={kpiTokensReady}
items={sortedAndfilteredKPITokens}
/>
<div className="flex flex-col items-center w-full my-16 sm:mx-3 md:mx-4 lg:mx-5 space-y-12 md:space-y-16">
<div className="flex flex-wrap justify-center gap-5 lg:justify-start">
<Grid
loading={loading}
kpiTokensReady={kpiTokensReady}
items={sortedAndfilteredKPITokens}
/>
</div>
</div>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/pages/campaigns/top-nav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export const CampaignsTopNav = ({
);

return (
<div className="flex px-6 py-6 bg-white border-t border-b border-black md:px-12 dark:bg-black">
<div className="flex flex-col items-center justify-between w-full md:flex-row">
<div className="flex justify-center px-6 py-6 bg-white border-t border-b border-black md:px-12 dark:bg-black">
<div className="w-full max-w-screen-2xl flex flex-col items-center justify-between md:flex-row">
<div className="flex flex-col w-full gap-5 md:flex-row">
<div className="flex gap-5">
{/* <ToggleFiltersButton
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/home/hero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const Hero = ({ featuredKPITokens }: HeroProps) => {
return (
<div className="flex flex-col items-center bg-orange bg-grid-light dark:bg-grid-dark bg-left-top">
<div className="w-full">
<Navbar links={NAVBAR_LINKS} />
<Navbar bgColor="orange" links={NAVBAR_LINKS} />
</div>
<div className="w-full relative">
{featuredKPITokens.length === 0 ? (
Expand Down