Skip to content

Commit 5e0e0df

Browse files
authored
feat: update landing page (#174)
Closes #175
1 parent 0948bc4 commit 5e0e0df

35 files changed

+1020
-947
lines changed

animata/background/grid.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ interface GridProps {
1515
children?: React.ReactNode;
1616

1717
className?: string;
18+
19+
style?: React.CSSProperties;
1820
}
1921

2022
function Placeholder({ size = 20 }: Pick<GridProps, "size">) {
@@ -34,11 +36,19 @@ function Placeholder({ size = 20 }: Pick<GridProps, "size">) {
3436
);
3537
}
3638

37-
export default function Grid({ color = "#cacaca", size = 20, children, className }: GridProps) {
39+
export default function Grid({
40+
color = "#cacaca",
41+
size = 20,
42+
children,
43+
className,
44+
style = {
45+
backgroundColor: "white",
46+
},
47+
}: GridProps) {
3848
return (
3949
<div
4050
style={{
41-
backgroundColor: "white",
51+
...style,
4252
backgroundImage: `linear-gradient(${color} 1px, transparent 1px), linear-gradient(to right, ${color} 1px, transparent 1px)`,
4353
backgroundSize: `${size}px ${size}px`,
4454
}}

animata/card/github-card-shiny.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function GithubCardShiny({ className }: { className?: string }) {
2727
<div
2828
ref={containerRef}
2929
className={cn(
30-
"group relative min-w-96 overflow-hidden rounded-md border border-zinc-500 bg-zinc-700 p-10 text-zinc-200 shadow-lg",
30+
"group relative w-96 min-w-fit max-w-full overflow-hidden rounded-md border border-border bg-zinc-700 p-6 text-zinc-200 shadow-lg",
3131
className,
3232
)}
3333
>
@@ -45,7 +45,7 @@ export default function GithubCardShiny({ className }: { className?: string }) {
4545
<div className="text-xs text-zinc-400">on: push</div>
4646
</div>
4747

48-
<div className="z-10 mt-10 flex min-w-fit flex-col gap-2 rounded-md bg-zinc-600 p-4 shadow-2xl">
48+
<div className="z-10 mt-10 flex w-full min-w-fit flex-col gap-2 rounded-md bg-zinc-600 p-4 shadow-2xl">
4949
{[
5050
{
5151
title: "Install dependencies",
@@ -61,11 +61,13 @@ export default function GithubCardShiny({ className }: { className?: string }) {
6161
},
6262
].map((step) => {
6363
return (
64-
<div className="flex items-center gap-2" key={step.title}>
65-
<CheckCircle2 className="fill-green-400 text-zinc-600" />
66-
<strong>{step.title}</strong>
64+
<div className="flex w-full items-center gap-2" key={step.title}>
65+
<CheckCircle2 className="flex-shrink-0 fill-green-400 text-zinc-600" />
66+
<strong className="text-xs md:flex-shrink-0 md:text-base">{step.title}</strong>
6767

68-
<span className="ml-auto inline-block text-sm opacity-75">{step.time}</span>
68+
<span className="ml-auto inline-block flex-shrink-0 text-xs opacity-75">
69+
{step.time}
70+
</span>
6971
</div>
7072
);
7173
})}

animata/card/github-card-skew.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default function GithubCardSkew({ className }: { className?: string }) {
6363
<div
6464
ref={containerRef}
6565
className={cn(
66-
"flex max-w-80 transform-gpu flex-col gap-4 rounded-3xl border border-zinc-500 bg-zinc-900 p-10 text-zinc-200 shadow-lg transition-transform ease-linear will-change-transform",
66+
"flex max-w-80 transform-gpu flex-col gap-4 rounded-3xl border border-border bg-zinc-700 p-10 text-zinc-200 shadow-lg transition-transform ease-linear will-change-transform",
6767
className,
6868
)}
6969
style={{
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import FibonacciLines from "@/animata/container/fibonacci-lines";
2+
import { Meta, StoryObj } from "@storybook/react";
3+
4+
const meta = {
5+
title: "Container/Fibonacci Lines",
6+
component: FibonacciLines,
7+
parameters: {
8+
layout: "centered",
9+
},
10+
tags: ["autodocs"],
11+
argTypes: {},
12+
} satisfies Meta<typeof FibonacciLines>;
13+
14+
export default meta;
15+
type Story = StoryObj<typeof meta>;
16+
17+
export const Primary: Story = {
18+
args: {
19+
className: "storybook-fix w-full",
20+
},
21+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { cn } from "@/lib/utils";
2+
3+
function fibonacci(n: number): number {
4+
if (n <= 1) return n;
5+
return fibonacci(n - 1) + fibonacci(n - 2);
6+
}
7+
8+
export default function FibonacciLines({
9+
reverse,
10+
className,
11+
children,
12+
...props
13+
}: { reverse?: boolean } & React.HTMLAttributes<HTMLDivElement>) {
14+
return (
15+
<div
16+
className={cn("flex w-full", className, {
17+
"flex-col-reverse": reverse,
18+
"flex-col": !reverse,
19+
})}
20+
{...props}
21+
>
22+
{Array.from({ length: 10 }).map((_, i) => (
23+
<div
24+
key={i}
25+
style={{
26+
opacity: (i + 1) * 0.1,
27+
marginTop: fibonacci(i) + 2,
28+
}}
29+
className="w-full"
30+
>
31+
<div className="h-px w-full bg-foreground/10" />
32+
</div>
33+
))}
34+
{children}
35+
</div>
36+
);
37+
}

animata/text/wave-reveal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ const createAnimatedNodes = (args: ReducedValue, word: string, index: number): R
132132
const node = (
133133
<span
134134
key={`word_${index}`}
135-
className={cn({
135+
className={cn("contents", {
136136
[className]: isWordMode,
137137
})}
138138
style={

app/_landing/call-to-action.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { useEffect, useRef, useState } from "react";
2+
import Link from "next/link";
3+
import { useInView } from "framer-motion";
4+
import { Navigation } from "lucide-react";
5+
6+
import AnimatedGradientText from "@/animata/text/animated-gradient-text";
7+
import GibberishText from "@/animata/text/gibberish-text";
8+
import ComponentLinkWrapper from "@/components/component-link-wrapper";
9+
import RemountOnMouseIn from "@/components/remount-on-mouse-in";
10+
import { GitHubLogoIcon } from "@radix-ui/react-icons";
11+
12+
export default function CallToActionSection() {
13+
const headerRef = useRef<HTMLHeadingElement>(null);
14+
const isInView = useInView(headerRef);
15+
const [key, setKey] = useState(0);
16+
17+
useEffect(() => {
18+
if (isInView) {
19+
setKey((prev) => prev + 1);
20+
}
21+
}, [isInView]);
22+
23+
return (
24+
<section className="flex w-full flex-col gap-4 px-4 py-16 md:py-20">
25+
<ComponentLinkWrapper link="/docs/text/gibberish-text" className="mx-auto">
26+
<h1
27+
ref={headerRef}
28+
className="mx-auto w-fit px-0 py-4 text-center font-mono text-xl font-bold sm:text-3xl md:text-5xl"
29+
>
30+
<RemountOnMouseIn>
31+
<GibberishText key={`in_${key}`} text="Start building today" />
32+
</RemountOnMouseIn>
33+
</h1>
34+
</ComponentLinkWrapper>
35+
36+
<div className="mx-auto flex w-full max-w-2xl flex-row items-center justify-center gap-4">
37+
<Link
38+
href="/docs"
39+
className="relative flex aspect-square min-h-52 w-full flex-col items-center justify-center gap-4 overflow-hidden rounded-xl border border-border bg-gray-100/50 bg-opacity-100 py-12 transition-all duration-100 hover:scale-105 hover:bg-opacity-50 dark:border-zinc-600 dark:bg-zinc-800"
40+
>
41+
<Navigation className="size-10 md:size-14" />
42+
<div className="text-balance px-4 text-center text-sm font-bold sm:text-base md:text-lg">
43+
<AnimatedGradientText>Explore Components</AnimatedGradientText>
44+
</div>
45+
</Link>
46+
<Link
47+
href="https://github.com/codse/animata"
48+
className="relative flex aspect-square min-h-52 w-full flex-col items-center justify-center gap-4 overflow-hidden rounded-xl border border-border bg-gray-100/50 bg-opacity-100 py-12 transition-all duration-100 hover:scale-105 hover:bg-opacity-50 dark:border-zinc-600 dark:bg-zinc-800"
49+
>
50+
<GitHubLogoIcon className="size-10 md:size-14" />
51+
<div className="text-balance px-4 text-center text-sm font-bold sm:text-base md:text-lg">
52+
<AnimatedGradientText>View code on GitHub</AnimatedGradientText>
53+
</div>
54+
</Link>
55+
</div>
56+
</section>
57+
);
58+
}

app/_landing/curtain.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

app/_landing/faq-section.tsx

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import Link from "next/link";
2+
import { useTheme } from "next-themes";
23

34
import BoldCopy from "@/animata/text/bold-copy";
45
import ComponentLinkWrapper from "@/components/component-link-wrapper";
5-
import { cn } from "@/lib/utils";
6+
import {
7+
Accordion,
8+
AccordionContent,
9+
AccordionItem,
10+
AccordionTrigger,
11+
} from "@/components/ui/accordion";
612

713
import Highlight from "./highlight";
814

@@ -55,43 +61,48 @@ const faq = [
5561

5662
function FaqItem({ index }: { index: number }) {
5763
const item = faq[index];
58-
const count = (
59-
<BoldCopy
60-
text={String(index + 1)}
61-
className="w-fit bg-transparent px-0 md:px-0"
62-
textClassName="text-md md:text-xl group-hover:text-2xl group-hover:md:text-5xl transition-all"
63-
backgroundTextClassName="text-2xl md:text-5xl"
64-
/>
65-
);
66-
6764
return (
68-
<div
69-
key={`question-${index}`}
70-
className={cn({
71-
"mb-4": index !== faq.length - 1,
72-
})}
73-
>
74-
<h3 className="relative flex flex-shrink-0 flex-wrap items-center gap-4">
75-
{count}
76-
<span className="inline-block w-3/4 text-lg font-medium md:text-xl">{item.question}</span>
77-
</h3>
78-
<div className="flex gap-4">
79-
<div className="invisible h-0">{count}</div>
80-
<div className="text-muted-foreground">{item.answer}</div>
81-
</div>
82-
</div>
65+
<AccordionItem value={`question-${index}`} className="w-full px-4 md:px-0">
66+
<AccordionTrigger className="w-full">
67+
<span className="inline-block text-sm font-medium md:text-base">{item.question}</span>
68+
</AccordionTrigger>
69+
<AccordionContent>
70+
<div className="text-gray-900 dark:text-slate-50">{item.answer}</div>
71+
</AccordionContent>
72+
</AccordionItem>
8373
);
8474
}
8575

8676
export default function FAQSection() {
77+
const { resolvedTheme } = useTheme();
78+
const color = resolvedTheme === "dark" ? "#ffffff12" : "#444cf710";
8779
return (
88-
<section id="faq" className="relative mx-auto max-w-5xl">
89-
<ComponentLinkWrapper link="/docs/text/bold-copy" className="w-full">
90-
<BoldCopy text="FAQ" className="mb-4 border border-gray-200 dark:border-zinc-800" />
91-
</ComponentLinkWrapper>
92-
{faq.map((_, index) => {
93-
return <FaqItem key={`item-${index}`} index={index} />;
94-
})}
95-
</section>
80+
<div
81+
className="relative border-b border-t border-border pb-4"
82+
style={{
83+
backgroundImage: `radial-gradient(${color} 1px, transparent 1px)`,
84+
backgroundSize: "calc(10px) calc(10px)",
85+
}}
86+
>
87+
<div className="absolute inset-0 left-1/2 z-0 aspect-square h-[120%] -translate-x-1/2 rounded-full bg-gradient-to-br from-gray-100 to-gray-50 blur-3xl dark:from-zinc-900 dark:to-zinc-800" />
88+
<section id="faq" className="mx-auto flex max-w-xl flex-col gap-4 py-16">
89+
<ComponentLinkWrapper className="mx-auto px-4" link="/docs/text/bold-copy">
90+
<BoldCopy
91+
text="FAQ"
92+
textClassName="leading-none"
93+
backgroundTextClassName="leading-none"
94+
className="bg-transparent"
95+
/>
96+
<div className="relative z-10 -mt-2 block text-center text-xs leading-none text-muted-foreground md:-mt-4 md:text-base">
97+
You ask. We answer.
98+
</div>
99+
</ComponentLinkWrapper>
100+
<Accordion collapsible type="single" className="relative">
101+
{faq.map((_, index) => {
102+
return <FaqItem key={`item-${index}`} index={index} />;
103+
})}
104+
</Accordion>
105+
</section>
106+
</div>
96107
);
97108
}

0 commit comments

Comments
 (0)