Footer 2
Footer5+ ColumnsText Align LeftNewsletter Sign UpFooter

Code
relume-footer2.tsx
"use client";
import { useState } from "react";
import { Button, type ButtonProps } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { FacebookLogo, InstagramLogo, LinkedinLogo, XLogo, YoutubeLogo } from "relume-icons";
type ImageProps = {
url?: string;
src: string;
alt?: string;
};
type Links = {
title: string;
url: string;
};
type ColumnLinks = {
title: string;
links: Links[];
};
type SocialMediaLinks = {
url: string;
icon: React.ReactNode;
};
type FooterLink = {
title: string;
url: string;
};
type Props = {
logo: ImageProps;
newsletterHeading: string;
newsletterDescription: string;
inputPlaceholder?: string;
button: ButtonProps;
termsAndConditions: string;
columnLinks: ColumnLinks[];
socialMediaLinks: SocialMediaLinks[];
footerText?: string;
footerLinks: FooterLink[];
};
export type Footer2Props = React.ComponentPropsWithoutRef<"section"> & Partial<Props>;
export const Footer2 = (props: Footer2Props) => {
const {
logo,
newsletterHeading,
newsletterDescription,
inputPlaceholder,
button,
termsAndConditions,
columnLinks,
socialMediaLinks,
footerText,
footerLinks,
} = {
...Footer2Defaults,
...props,
};
const [emailInput, setEmailInput] = useState<string>("");
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
console.log({
emailInput,
});
};
return (
<footer className="px-[5%] py-12 md:py-18 lg:py-20">
<div className="container">
<div className="grid grid-cols-1 items-start gap-x-[8vw] gap-y-12 pb-12 md:gap-y-16 md:pb-18 lg:grid-cols-[1fr_0.5fr] lg:gap-y-4 lg:pb-20">
<div className="grid grid-cols-1 items-start gap-x-8 gap-y-10 sm:grid-cols-3 sm:gap-x-6 sm:gap-y-12 md:gap-x-8 lg:grid-cols-4">
<a
href={logo.url}
className="sm:col-start-1 sm:col-end-4 sm:row-start-1 sm:row-end-2 lg:col-start-auto lg:col-end-auto lg:row-start-auto lg:row-end-auto"
>
<img src={logo.src} alt={logo.alt} />
</a>
{columnLinks.map((column, index) => (
<div key={index} className="flex flex-col items-start justify-start">
<h2 className="mb-3 font-semibold md:mb-4">{column.title}</h2>
<ul>
{column.links.map((link, linkIndex) => (
<li key={linkIndex} className="py-2 text-small">
<a href={link.url} className="flex items-center gap-3">
{link.title}
</a>
</li>
))}
</ul>
</div>
))}
</div>
<div className="flex flex-col">
<h1 className="mb-3 font-semibold md:mb-4">{newsletterHeading}</h1>
<p className="mb-3 text-small md:mb-4">{newsletterDescription}</p>
<div className="w-full max-w-md">
<form
className="mb-3 grid grid-cols-1 gap-x-4 gap-y-3 sm:grid-cols-[1fr_max-content] md:gap-y-4"
onSubmit={handleSubmit}
>
<Input
id="email"
type="email"
placeholder={inputPlaceholder}
value={emailInput}
onChange={(e) => setEmailInput(e.target.value)}
/>
<Button {...button}>{button.title}</Button>
</form>
<div dangerouslySetInnerHTML={{ __html: termsAndConditions }} />
</div>
</div>
</div>
<div className="h-px w-full bg-scheme-border" />
<div className="flex flex-col-reverse items-start pt-6 pb-4 text-small md:justify-start md:pt-8 md:pb-0 lg:flex-row lg:items-center lg:justify-between">
<div className="flex flex-col items-start gap-4 md:flex-row md:gap-6 lg:items-center">
<p className="mt-4 md:mt-0">{footerText}</p>
<div className="grid grid-flow-row grid-cols-[max-content] justify-center gap-y-4 md:grid-flow-col md:justify-center md:gap-x-6 md:gap-y-0 lg:text-left">
{footerLinks.map((link, index) => (
<p key={index} className="underline">
<a href={link.url}>{link.title}</a>
</p>
))}
</div>
</div>
<div className="mb-8 flex items-center justify-center gap-3 lg:mb-0">
{socialMediaLinks.map((link, index) => (
<a key={index} href={link.url}>
{link.icon}
</a>
))}
</div>
</div>
</div>
</footer>
);
};
export const Footer2Defaults: Props = {
logo: {
url: "#",
src: "https://d22po4pjz3o32e.cloudfront.net/logo-image.svg",
alt: "Logo image",
},
newsletterHeading: "Subscribe",
newsletterDescription: "Join our newsletter to stay up to date on features and releases.",
inputPlaceholder: "Enter your email",
button: {
title: "Subscribe",
variant: "secondary",
size: "sm",
},
termsAndConditions: `
<p class='text-tiny'>
By subscribing you agree to with our
<a href='#' class='underline'>Privacy Policy</a>
and provide consent to receive updates from our company.
</p>
`,
columnLinks: [
{
title: "Column One",
links: [
{ title: "Link One", url: "#" },
{ title: "Link Two", url: "#" },
{ title: "Link Three", url: "#" },
{ title: "Link Four", url: "#" },
{ title: "Link Five", url: "#" },
],
},
{
title: "Column Two",
links: [
{ title: "Link Six", url: "#" },
{ title: "Link Seven", url: "#" },
{ title: "Link Eight", url: "#" },
{ title: "Link Nine", url: "#" },
{ title: "Link Ten", url: "#" },
],
},
{
title: "Column Three",
links: [
{ title: "Link Eleven", url: "#" },
{ title: "Link Twelve", url: "#" },
{ title: "Link Thirteen", url: "#" },
{ title: "Link Fourteen", url: "#" },
{ title: "Link Fifteen", url: "#" },
],
},
],
socialMediaLinks: [
{ url: "#", icon: <FacebookLogo className="size-6 text-scheme-text" /> },
{ url: "#", icon: <InstagramLogo className="size-6 text-scheme-text" /> },
{ url: "#", icon: <XLogo className="size-6 p-0.5 text-scheme-text" /> },
{ url: "#", icon: <LinkedinLogo className="size-6 text-scheme-text" /> },
{ url: "#", icon: <YoutubeLogo className="size-6 text-scheme-text" /> },
],
footerText: "© 2024 Relume. All rights reserved.",
footerLinks: [
{ title: "Privacy Policy", url: "#" },
{ title: "Terms of Service", url: "#" },
{ title: "Cookies Settings", url: "#" },
],
};npm i @radix-ui/react-checkbox @radix-ui/react-label @radix-ui/react-radio-group @radix-ui/react-select @radix-ui/react-slot class-variance-authority@0.7.1 clsx@^2.1.1 embla-carousel-react@^8.5.2 motion@^12.15.0 relume-icons@1.3.0 tailwind-merge@^2.2.2


