Skip to content

Commit

Permalink
marketing page layout and component abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
benorloff committed Apr 1, 2024
1 parent 52e79d6 commit 0fc3dd8
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 109 deletions.
2 changes: 1 addition & 1 deletion app/(marketing)/_components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const Footer = () => {
<div className="w-full p-4 border-t bg-background px-8">
<div className="max-w-screen-2xl mx-auto flex items-center w-full justify-between">
<Logo />
<div className="space-x-4 md:block md:w-auto flex items-center justify-between w-full">
<div className="space-x-4 md:block md:w-auto flex items-center justify-between">
<Button size="sm" variant="ghost">
Privacy Policy
</Button>
Expand Down
8 changes: 4 additions & 4 deletions app/(marketing)/_components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export const Navbar = () => {
const { isSignedIn } = useUser();
const { theme } = useTheme();
return (
<div id="header-wrapper" className="sticky z-100 top-4 mx-auto bg-neutral-100/75 dark:bg-neutral-100/5 backdrop-blur-lg dark:backdrop-brightness-50 flex items-center rounded-full max-w-screen-2xl">
<div className="md:max-w-screen-2xl w-full flex-1 relative">
<div id="header-wrapper" className="fixed w-full z-10 top-4 ">
<div className="max-w-screen-xl mx-auto bg-neutral-100/75 dark:bg-neutral-100/5 backdrop-blur-lg dark:backdrop-brightness-50 rounded-full">
<div id="header-container" className="w-full flex-col pl-7 pr-5 flex mx-auto rounded-full">
<div id="header-content-wrapper" className="flex flex-1 relative justify-between items-center py-4">
<div id="header-content-wrapper" className="flex flex-1 justify-between items-center py-4">
<Logo />
<div className="space-x-4 md:block md:w-auto flex items-center justify-between w-full">
<div className="space-x-4 md:block md:w-auto flex items-center justify-end w-full">
{ isSignedIn ? (
<Button size="sm" variant="outline" asChild>
<Link href="/dashboard">
Expand Down
6 changes: 3 additions & 3 deletions app/(marketing)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const MarketingLayout = ({
children: React.ReactNode
}) => {
return (
<div className="w-full bg-background">
<>
<Navbar />
<main className="max-w-screen-2xl mx-auto p-8 overflow-auto">
<main className="max-w-screen-xl mx-auto overflow-auto px-8">
{children}
</main>
<Footer />
</div>
</>
);
};

Expand Down
137 changes: 47 additions & 90 deletions app/(marketing)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import { TestimonialCarousel } from "@/components/marketing/testimonial-carousel
import { FeatureCarousel } from "@/components/marketing/feature-carousel";
import { Section } from "@/components/marketing/section";
import { Overline } from "@/components/marketing/overline";
import { FeatureCard } from "@/components/marketing/feature-card";
import { SectionHeading } from "@/components/marketing/section-heading";

const MarketingPage = () => {
return (
<>
<Section>
<div className="w-full space-y-6 max-w-3xl text-center">
<Section fullHeight={true}>
<div className="flex flex-col max-w-3xl h-full m-auto gap-8 justify-center items-center text-center">
<div className="flex flex-row w-fit border rounded-full justify-center items-center pl-2 pr-4 py-2 mx-auto space-x-2">
<Badge variant="secondary">Coming Soon</Badge>
<span className="text-sm">Lorem ipsum dolor sit amet.</span>
Expand All @@ -26,7 +28,7 @@ const MarketingPage = () => {
<div className="text-muted-foreground">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl purus in mollis nunc.
</div>
<div className="flex flex-row justify-center items-center gap-4">
<div className="flex w-full flex-row justify-center items-center gap-4">
<Input
className="max-w-xs"
placeholder="Enter your email"
Expand All @@ -37,100 +39,55 @@ const MarketingPage = () => {
</div>
</Section>
<Section>
<div className="max-w-3xl space-y-4">
<Overline title="Pre-heading" />
<div className="text-6xl">
Lorem ipsum dolor sit amet.
</div>
<div className="text-muted-foreground">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl purus in mollis nunc.
</div>
</div>
<SectionHeading
overline="Overline"
headline="Lorem ipsum dolor sit amet."
subheading="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
/>
<div className="grid lg:grid-cols-3 md:grid-cols-2 grid-cols-1 gap-8 w-full text-left">
<div className="flex flex-col gap-4 border rounded-lg p-8">
<Database size={48} />
<div className="text-3xl">
Lorem ipsum.
</div>
<div className="text-muted-foreground">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl purus in mollis nunc.
</div>
</div>
<div className="flex flex-col gap-4 border rounded-lg p-8">
<Database size={48} />
<div className="text-3xl">
Lorem ipsum.
</div>
<div className="text-muted-foreground">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl purus in mollis nunc.
</div>
</div>
<div className="flex flex-col gap-4 border rounded-lg p-8">
<Database size={48} />
<div className="text-3xl">
Lorem ipsum.
</div>
<div className="text-muted-foreground">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl purus in mollis nunc.
</div>
</div>
<div className="flex flex-col gap-4 border rounded-lg p-8">
<Database size={48} />
<div className="text-3xl">
Lorem ipsum.
</div>
<div className="text-muted-foreground">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl purus in mollis nunc.
</div>
</div>
<div className="flex flex-col gap-4 border rounded-lg p-8">
<Database size={48} />
<div className="text-3xl">
Lorem ipsum.
</div>
<div className="text-muted-foreground">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl purus in mollis nunc.
</div>
</div>
<div className="flex flex-col gap-4 border rounded-lg p-8">
<Database size={48} />
<div className="text-3xl">
Lorem ipsum.
</div>
<div className="text-muted-foreground">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl purus in mollis nunc.
</div>
</div>
{Array.from({ length: 6 }).map((_, i) => (
<FeatureCard
key={i}
title="Lorem ipsum."
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
icon={
<Database
size={48}
className="group-hover:text-orange-500 transition-colors ease-in-out"
/>
}
/>
))}
</div>
</Section>
<div className="flex flex-row flex-wrap py-32 justify-center items-center text-center space-y-8">
<div className="flex flex-col gap-4 w-full lg:w-1/2 text-left pr-6">
<Overline title="Pre-heading" />
<div className="text-6xl">
Lorem ipsum dolor sit amet.
<Section>
<div className="flex flex-row flex-wrap justify-center items-center text-center space-y-8">
<div className="flex flex-col gap-4 w-full lg:w-1/2 pr-6">
<SectionHeading
overline="Overline"
headline="Lorem ipsum dolor sit amet."
subheading="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
align="left"
/>
</div>
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pharetra et ultrices neque ornare aenean. Donec ac odio tempor orci dapibus ultrices in iaculis nunc.
<div className="w-full min-h-max lg:w-1/2 pl-6">
<Image
src="/placeholder-browser.svg"
width={800}
height={600}
alt="Placeholder"
/>
</div>
</div>
<div className="w-full min-h-max lg:w-1/2 pl-6">
<Image
src="/placeholder-browser.svg"
width={800}
height={600}
alt="Placeholder"
/>
</div>
</div>
<div className="flex flex-col gap-8 py-32 justify-center items-center">
Lorem ipsum.
</div>
<div className="w-full py-32">
</Section>
<Section>
<FeatureCarousel />
</div>
<div className="w-full bg-secondary p-20 rounded-lg">
<TestimonialCarousel />
</div>
</Section>
<Section>
<div className="w-full bg-secondary p-20 rounded-lg">
<TestimonialCarousel />
</div>
</Section>
</>
)
};
Expand Down
2 changes: 1 addition & 1 deletion components/logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const headingFont = localFont({
export const Logo = () => {
return (
<Link href="/">
<div className="hover:opacity-75 transition items-center gap-x-2 hidden md:flex">
<div className="hover:opacity-75 transition items-center gap-x-2 flex">
<Image src="/logo.svg" alt="Logo" width={35} height={35} />
<p className={cn("text-lg pb-1", headingFont.className)}>Bellhop</p>
</div>
Expand Down
25 changes: 25 additions & 0 deletions components/marketing/feature-card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
interface FeatureCardProps {
title: string;
description: string;
icon: React.ReactElement;
className?: string;
}

export const FeatureCard = ({
title,
description,
icon,
className
}: FeatureCardProps) => {
return (
<div className="flex flex-col gap-4 bg-background border rounded-lg p-8 group">
{icon}
<div className="text-3xl">
{title}
</div>
<div className="text-muted-foreground group-hover:text-primary transition-colors ease-in-out">
{description}
</div>
</div>
)
}
25 changes: 24 additions & 1 deletion components/marketing/feature-carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import { cn } from "@/lib/utils"
import React, { useEffect, useState } from "react"
import { Feature } from "./feature"
import { useDebounceValue } from "usehooks-ts"

export const FeatureCarousel = () => {

const [activeFeature, setActiveFeature] = useDebounceValue(1, 100)
const [scrollProgress, setScrollProgress] = useState(0)

let featureTrack: HTMLElement | null = null;
Expand All @@ -25,10 +27,27 @@ export const FeatureCarousel = () => {
setScrollProgress(progress);
}

useEffect(() => {
switch (true) {
case scrollProgress < 25:
setActiveFeature(1);
break;
case scrollProgress >= 25 && scrollProgress < 50:
setActiveFeature(2);
break;
case scrollProgress >= 50 && scrollProgress < 75:
setActiveFeature(3);
break;
case scrollProgress >= 75:
setActiveFeature(4);
break;
}
}, [scrollProgress])

const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
let id = parseInt(e.currentTarget.id);
let n: number = 0;
n = ( ( id - 1 ) ) * featureElClientWidth;
n = ( id - 1 ) * featureElClientWidth;

featureTrack?.scrollTo( { left: n , top: 0, behavior: 'smooth' } )
}
Expand Down Expand Up @@ -67,6 +86,7 @@ export const FeatureCarousel = () => {
role="button"
className={cn(
"border-t border-dashed border-muted py-8 px-2 text-muted-foreground",
activeFeature === 1 && "text-primary"
)}
onClick={(e) => handleClick(e)}
>
Expand All @@ -77,6 +97,7 @@ export const FeatureCarousel = () => {
role="button"
className={cn(
"border-t border-dashed border-muted py-8 px-2 text-muted-foreground",
activeFeature === 2 && "text-primary"
)}
onClick={(e) => handleClick(e)}
>
Expand All @@ -87,6 +108,7 @@ export const FeatureCarousel = () => {
role="button"
className={cn(
"border-t border-dashed border-muted py-8 px-2 text-muted-foreground",
activeFeature === 3 && "text-primary"
)}
onClick={(e) => handleClick(e)}
>
Expand All @@ -97,6 +119,7 @@ export const FeatureCarousel = () => {
role="button"
className={cn(
"border-t border-dashed border-muted py-8 px-2 text-muted-foreground",
activeFeature === 4 && "text-primary"
)}
onClick={(e) => handleClick(e)}
>
Expand Down
12 changes: 6 additions & 6 deletions components/marketing/feature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const Feature = ({
}) => {

return (
<div id="Feature" data-key={number} className="min-w-full h-fit snap-start grid grid-cols-1 items-center gap-16 px-16">
<div id="Feature" data-key={number} className="min-w-full h-fit snap-start grid grid-cols-1 items-center gap-16 px-4 lg:px-16">
<div className="grid lg:grid-cols-2 grid-cols-1 items-center gap-8">
<div className="">
<div className="text-6xl">{title}</div>
Expand All @@ -20,18 +20,18 @@ export const Feature = ({
{description}
</div>
</div>
<div className="grid md:grid-cols-2 grid-cols-1 items-start gap-8">
<div className="grid lg:grid-cols-2 grid-cols-1 items-center gap-8">
<div className="grid grid-cols-1 items-start gap-8">
<div className="space-y-4">
<div className="font-semibold pl-4 pr-32">Lorem ipsum.</div>
<div className="text-muted-foreground pl-4 pr-32 ">
<div className="font-semibold lg:pr-32">Lorem ipsum.</div>
<div className="text-muted-foreground lg:pr-32 ">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>
</div>
<div className="space-y-4">
<div className="font-semibold pl-4 pr-32">Lorem ipsum.</div>
<div className="text-muted-foreground pl-4 pr-32">
<div className="font-semibold lg:pr-32">Lorem ipsum.</div>
<div className="text-muted-foreground lg:pr-32">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>
Expand Down
32 changes: 32 additions & 0 deletions components/marketing/section-heading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { cn } from "@/lib/utils";
import { Overline } from "./overline";

interface SectionHeadingProps {
overline: string;
headline: string;
subheading: string;
align?: "left" | "center" | "right";
}

export const SectionHeading = ({
overline,
headline,
subheading,
align,
}: SectionHeadingProps) => {
return (
<div className={cn(
"max-w-3xl space-y-4 text-center m-auto mb-16",
align ? `text-${align}` : "text-center"
)}
>
<Overline title={overline} />
<div className="text-6xl">
{headline}
</div>
<div className="text-muted-foreground">
{subheading}
</div>
</div>
)
}
Loading

0 comments on commit 0fc3dd8

Please sign in to comment.