Skip to content

Commit

Permalink
Merge pull request #81 from Vizzuality/SKY30-155-footer
Browse files Browse the repository at this point in the history
[SKY30-155] Add Header / Footer (+ design tweaks)
  • Loading branch information
SARodrigues authored Nov 26, 2023
2 parents 89d1acd + 518e3e2 commit 2f72002
Show file tree
Hide file tree
Showing 19 changed files with 230 additions and 109 deletions.
8 changes: 8 additions & 0 deletions frontend/public/images/static-pages/bg-images/footer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 39 additions & 18 deletions frontend/src/components/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,51 @@
import Link from 'next/link';

const navigation = [
{ name: 'About', href: '/about' },
{ name: 'Contact', href: '/contact' },
{ name: 'Privacy Policy', href: '/privacy-policy' },
];
import { Copyright } from 'lucide-react';

import { PAGES } from '@/constants/pages';

const Footer: React.FC = () => (
<footer className="bg-black text-white">
<div className="mx-auto max-w-7xl px-6 py-2 md:flex md:items-center md:justify-between lg:px-10">
<ul className="flex justify-center space-x-6">
{navigation.map(({ name, href }) => (
<li key={href}>
<div className="px-8 md:mx-auto md:max-w-7xl">
<div className="flex w-full flex-col">
<div className="my-6">
<div className="my-6">
<h2 className="text-4xl font-extrabold md:text-5xl">Would you like to know more?</h2>
<Link
href={href}
className="block ring-offset-black transition-colors hover:text-gray-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2"
href={PAGES.contact}
className="mt-8 inline-block bg-white px-4 py-2.5 font-mono text-xs uppercase text-black"
>
{name}
Get in touch
</Link>
</li>
))}
</ul>

<div className="mt-8 md:order-1 md:mt-0">
<p className="text-center">&copy; Skytruth 30x30 2023</p>
</div>
<address className="my-4 flex flex-col gap-0.5 pt-6 text-xs not-italic text-black-300 md:my-8">
<span>30x30 Skytruth</span>
<span>140–142 St No Street, New York, EC1V XXX, US</span>
<a href="tel:+1 (0)23 0000 0000">+1 (0)23 0000 0000</a>
<a href="mailto:[email protected]">info@example</a>
<span>Registered in United States of America as 30x30 Tool Limited. 7792366</span>
</address>
</div>
</div>
<div className="flex w-full justify-between gap-8 border-t border-black-400 py-6 text-xs font-extralight">
<div className="flex py-2">
<Copyright className="mr-2 h-3.5 w-3.5" aria-hidden="true" /> SkyTruth 2023
</div>
<nav className="flex gap-6">
<Link className="py-2" href={PAGES.privacyPolicy}>
Privacy policy
</Link>
<Link className="py-2" href={PAGES.termsOfUse}>
Terms of use
</Link>
</nav>
</div>
<span
className="block h-[12vw] w-full bg-contain bg-bottom bg-no-repeat opacity-10 sm:mt-2 md:mx-auto md:mt-4 md:max-w-7xl xl:-mt-8"
style={{
backgroundImage: `url(/images/static-pages/bg-images/footer.svg)`,
}}
/>
</div>
</footer>
);
Expand Down
76 changes: 58 additions & 18 deletions frontend/src/components/header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Image from 'next/image';
import Link from 'next/link';

import { VariantProps, cva } from 'class-variance-authority';
import { Menu } from 'lucide-react';

import ActiveLink from '@/components/active-link';
Expand All @@ -13,30 +14,66 @@ import {
SheetTitle,
SheetTrigger,
} from '@/components/ui/sheet';
import { PAGES } from '@/constants/pages';
import { cn } from '@/lib/classnames';
import ArrowRight from '@/styles/icons/arrow-right.svg?sprite';

const navigation = [
{ name: 'Data tool', href: '/data-tool', colorClassName: 'text-blue fill-blue' },
// { name: 'Map', href: '/map', colorClassName: 'text-blue fill-blue' },
// { name: 'Dashboard', href: '/dashboard', colorClassName: 'text-blue fill-blue' },
{ name: 'Knowledge Hub', href: '/knowledge-hub', colorClassName: 'text-green fill-green' },
{ name: 'About', href: '/about', colorClassName: 'text-black fill-black' },
{ name: 'Contact', href: '/contact', colorClassName: 'text-black fill-black' },
const NAVIGATION_ITEMS = [
{ name: 'Data tool', href: PAGES.dataTool, colorClassName: 'text-blue fill-blue' },
{ name: 'Knowledge Hub', href: PAGES.knowledgeHub, colorClassName: 'text-green fill-green' },
{ name: 'About', href: PAGES.about, colorClassName: 'text-black fill-black' },
{ name: 'Contact', href: PAGES.contact, colorClassName: 'text-black fill-black' },
];

const Header: React.FC = () => (
<header className="border-b border-black bg-white font-mono text-sm text-black">
const headerVariants = cva('', {
variants: {
theme: {
normal: 'border border-black bg-white text-black',
dark: 'border-white bg-black text-white',
},
},
defaultVariants: {
theme: 'normal',
},
});

const buttonVariants = cva('', {
variants: {
theme: {
normal: 'ring-offset-white hover:bg-gray-50 focus-visible:ring-black',
dark: 'ring-offset-black hover:bg-gray-50 focus-visible:ring-white',
},
},
defaultVariants: {
theme: 'normal',
},
});

export type HeaderProps = VariantProps<typeof headerVariants> & {
hideLogo?: boolean;
};

const Header: React.FC<HeaderProps> = ({ theme, hideLogo = false }) => (
<header className={cn('border-b font-mono text-sm', headerVariants({ theme }))}>
<nav
className="mx-auto flex items-center justify-between p-6 py-2.5 md:py-4 lg:px-10"
aria-label="Global"
>
<Link
href="/"
className="-m-1.5 p-1.5 ring-offset-black transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2"
>
<Image src="/images/skytruth-30-30-logo.svg" alt="SkyTruth 30x30" width={37} height={37} />
</Link>
<span className="flex">
{!hideLogo && (
<Link
href="/"
className="-my-1.5 inline-block ring-offset-black transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2"
>
<Image
src="/images/skytruth-30-30-logo.svg"
alt="SkyTruth 30x30"
width={37}
height={37}
/>
</Link>
)}
</span>

{/* Mobile hamburger menu */}
<div className="flex md:hidden">
Expand All @@ -52,11 +89,14 @@ const Header: React.FC = () => (
<div className="mt-6 flow-root">
<div className="-my-6 divide-y divide-gray-500/10">
<div className="space-y-2 py-6 font-mono text-sm">
{navigation.map(({ name, href, colorClassName }) => (
{NAVIGATION_ITEMS.map(({ name, href, colorClassName }) => (
<ActiveLink
key={href}
href={href}
className="group -mx-3 block px-3 py-2 ring-offset-white hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2"
className={cn(
'group -mx-3 block px-3 py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
buttonVariants({ theme })
)}
activeClassName="is-active"
>
<Icon
Expand All @@ -79,7 +119,7 @@ const Header: React.FC = () => (
</div>

<ul className="hidden md:flex md:gap-x-10">
{navigation.map(({ name, href, colorClassName }) => (
{NAVIGATION_ITEMS.map(({ name, href, colorClassName }) => (
<li key={href}>
<ActiveLink
href={href}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/static-pages/intro/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Intro: React.FC<IntroProps> = ({
image = 'computer',
onScrollClick,
}) => (
<div className={cn('border-b border-black bg-black', introVariants({ color }))}>
<div className={cn('bg-black', introVariants({ color }))}>
<div className="flex flex-col md:mx-auto md:max-w-7xl md:flex-row">
<div className="mt-6 mb-2 flex flex-1 flex-col px-8">
<div className="pr-10 text-5xl font-extrabold leading-tight md:text-6xl">{title}</div>
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/constants/pages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export const PAGES = {
homepage: '/',
dataTool: '/data-tool',
knowledgeHub: '/knowledge-hub',
contact: '/contact',
about: '/about',
privacyPolicy: '/privacy-policy',
termsOfUse: '/terms-of-use',
};
2 changes: 1 addition & 1 deletion frontend/src/containers/data-tool/content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const DataToolContent: React.FC = () => {
<>
<Map />
{showDetails && (
<div className="relative h-full w-full">
<div className="relative h-full w-full border-b border-r border-black">
<Details />
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/containers/data-tool/content/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const DataToolMap: React.FC = () => {
}, [locationBbox, isSidebarOpen]);

return (
<div className="absolute left-0 h-full w-full">
<div className="absolute left-0 h-full w-full border-r border-b border-black">
<Map
initialViewState={initialViewState}
bounds={bounds}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/containers/data-tool/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const DataToolSidebar: React.FC = () => {
</Button>
</CollapsibleTrigger>
<CollapsibleContent className="relative top-0 left-0 z-20 h-full flex-shrink-0 bg-white fill-mode-none data-[state=closed]:animate-out-absolute data-[state=open]:animate-in-absolute data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left md:w-[430px]">
<div className="h-full w-full overflow-y-scroll border-r border-black pb-12">
<div className="h-full w-full overflow-y-scroll border-x border-black pb-12">
<div className="border-b border-black px-4 pt-4 pb-2 md:px-8">
<h1 className="text-5xl font-black">{location?.name}</h1>
<LocationSelector className="my-2" />
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/containers/homepage/intro/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const Intro: React.FC<IntroProps> = ({ onScrollClick }) => {
}, [protectionStatsData]);

return (
<div className="border-t border-white bg-black">
<div className="bg-black">
<div className="flex flex-col text-white md:mx-auto md:max-w-7xl md:flex-row">
<div className="mt-6 mb-2 flex flex-1 flex-col gap-10 px-8 pt-10">
<div className="relative">
Expand Down
48 changes: 48 additions & 0 deletions frontend/src/layouts/error-page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import Head from 'next/head';
import Link from 'next/link';

import Header from '@/components/header';
import { PAGES } from '@/constants/pages';

export interface ErrorPageLayoutProps {
pageTitle?: string;
error: 404 | 500;
title?: string;
description?: string;
}

const ErrorPageLayout: React.FC<ErrorPageLayoutProps> = ({
pageTitle,
error,
title,
description,
}) => (
<>
<Head>
<title>{`${pageTitle ? `${pageTitle} | ` : ''}Skytruth 30x30`}</title>
{description && <meta name="description" content={description} />}
</Head>
<div className="flex h-screen w-full flex-col">
<div className="flex-shrink-0">
<Header />
</div>
<div className="flex h-full w-full items-center justify-center border-x border-b border-black">
<div className="mb-8 inline-block max-w-2xl p-8 text-center">
<h1 className="text-9xl font-extrabold leading-none text-orange md:text-[200px]">
{error}
</h1>
<h2 className="my-4 mt-4 text-4xl md:mb-8 md:text-5xl">{title}</h2>
<p>{description}</p>
<Link
href={PAGES.homepage}
className="mt-6 inline-block bg-black px-8 py-3 font-mono text-xs uppercase text-white md:mt-4"
>
Go to homepage
</Link>
</div>
</div>
</div>
</>
);

export default ErrorPageLayout;
2 changes: 1 addition & 1 deletion frontend/src/layouts/fullscreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const FullscreenLayout: React.FC<PropsWithChildren<FullscreenLayoutProps>> = ({
<div className="flex-shrink-0">
<Header />
</div>
{children}
<div className="h-full border-x border-b border-black">{children}</div>
</div>
</>
);
Expand Down
Loading

0 comments on commit 2f72002

Please sign in to comment.