Skip to content

Commit e0023c8

Browse files
committed
styles(website): add smooth animation
1 parent fde620f commit e0023c8

9 files changed

Lines changed: 45 additions & 27 deletions

File tree

app/src/app/layout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ export const metadata: Metadata = {
4040
}
4141

4242
export default function RootLayout({ children }: LayoutProps) {
43-
console.log("Rendering RootLayout")
4443
return (
45-
<html lang="en">
44+
<html className="scroll-smooth" lang="en">
4645
<body
47-
className={`${inter.className} min-h-screen grid grid-rows-[auto,1fr_auto] antialiased relative overflow-x-hidden bg-black scroll-smooth scroll:w-2 track:my-2 thumb:rounded thumb:bg-gray-100 has-[header.open]:scroll:bg-gray-300`}
46+
className={`${inter.className} min-h-screen grid grid-rows-[auto,1fr_auto] antialiased relative overflow-x-hidden bg-black scroll:w-2 track:my-2 thumb:rounded thumb:bg-gray-100 has-[header.open]:scroll:bg-gray-300`}
4847
>
4948
<Header />
5049
{children}

app/src/lib/@types/props.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ export interface TitleProps extends ImageSetProps {
2323
title: string
2424
}
2525

26-
export interface SeparatorProps extends PropsWithChildren {
27-
index?: number
26+
export interface SeparatorProps {
27+
className?: string
28+
redirectTo?: string
29+
children: string
2830
rotate?: boolean
2931
}
3032

app/src/ui/community/community-cards.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Link from "next/link"
33
import { useState } from "react"
44
import { motion } from "motion/react"
55
import { Separator } from "@/ui/separator"
6-
import { cardVariants } from "@/ui/motion-config/card.motion"
6+
import { cardVariants } from "@/ui/motion-config/benefit.motion"
77
import { SegmentAnimation } from "@/ui/motion/segment"
88
import { communityCards } from "@/lib/content"
99

app/src/ui/footer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export const Footer = () => {
5959
</figure>
6060
</div>
6161
</section>
62-
<Separator rotate>
63-
<span className="mx-auto">&#169; 2025 halvaradop.</span>
62+
<Separator className="justify-center" redirectTo="@halvaradop/tailwindcss-utilities" rotate>
63+
&#169; 2025 halvaradop.
6464
</Separator>
6565
</footer>
6666
)

app/src/ui/header/header.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export const Header = () => {
2929
}, [])
3030

3131
return (
32-
<header className={merge("flex items-center border-b border-solid border-border", isOpen ? "open" : "")}>
32+
<header
33+
className={merge("flex items-center border-b border-solid border-border", isOpen ? "open" : "")}
34+
id="halvaradop-tailwindcss-utilities"
35+
>
3336
<nav className="flex-100 h-16 ml-10 px-4 border-x border-solid border-border sm:px-6 md:px-8 base:ml-16 base:px-10 base:flex base:items-center base:justify-between base:relative">
3437
<div className="w-full h-full flex items-center justify-between relative z-20 base:w-fit">
3538
<h2 className="text-primary base:text-lg">

app/src/ui/home/benefits.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useState } from "react"
33
import { motion } from "motion/react"
44
import { Separator } from "@/ui/separator"
55
import { SegmentAnimation } from "@/ui/motion/segment"
6-
import { cardVariants } from "@/ui/motion-config/card.motion"
6+
import { cardVariants } from "@/ui/motion-config/benefit.motion"
77
import { benefitsContent } from "@/lib/content"
88

99
export const BenefitsSection = () => {

app/src/ui/home/community-cards.tsx

Whitespace-only changes.
File renamed without changes.

app/src/ui/separator.tsx

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,40 @@
11
"use client"
2+
import Link from "next/link"
23
import Image from "next/image"
34
import arrow from "@/assets/arrow.svg"
45
import type { SeparatorProps } from "@/lib/@types/props"
56

6-
export const Separator = ({ rotate = false, children }: SeparatorProps) => {
7+
export const Separator = ({ rotate = false, className, children, redirectTo }: SeparatorProps) => {
8+
const name = encodeURIComponent(
9+
String(redirectTo ?? children)
10+
.toLowerCase()
11+
.replace(/[^a-z0-9]+/g, "-")
12+
.replace(/^-+|-+$/g, "")
13+
)
14+
715
return (
8-
<div className="h-16 flex items-center text-primary border-y border-solid border-border separator">
9-
<figure className="group w-10 h-full flex items-center justify-center relative overflow-hidden img:transition-transform img:ease-linear img:duration-300 hover:cursor-pointer base:w-16">
10-
<Image
11-
className={`${rotate ? "-rotate-127 group-hover:-translate-y-14 group-hover:translate-x-14" : "group-hover:translate-y-18"}`}
12-
src={arrow}
13-
alt="Arrow Icon"
14-
priority
15-
/>
16-
<Image
17-
className={`absolute ${rotate ? "-rotate-127 translate-y-14 -translate-x-14 group-hover:translate-0" : "-translate-y-14 group-hover:translate-0"}`}
18-
src={arrow}
19-
alt="Arrow Icon"
20-
priority
21-
/>
22-
</figure>
23-
<p className="flex-100 h-full px-4 flex items-center border-x border-border sm:px-6 md:px-8 base:px-10">{children}</p>
16+
<div className="h-16 flex items-center text-primary border-y border-solid border-border separator" id={name}>
17+
<Link className="h-full" href={`#${name}`}>
18+
<figure className="group w-10 h-full flex items-center justify-center relative overflow-hidden img:transition-transform img:ease-linear img:duration-300 hover:cursor-pointer base:w-16">
19+
<Image
20+
className={`${rotate ? "-rotate-127 group-hover:-translate-y-14 group-hover:translate-x-14" : "group-hover:translate-y-18"}`}
21+
src={arrow}
22+
alt="Arrow Icon"
23+
priority
24+
/>
25+
<Image
26+
className={`absolute ${rotate ? "-rotate-127 translate-y-14 -translate-x-14 group-hover:translate-0" : "-translate-y-14 group-hover:translate-0"}`}
27+
src={arrow}
28+
alt="Arrow Icon"
29+
priority
30+
/>
31+
</figure>
32+
</Link>
33+
<p
34+
className={`flex-100 h-full px-4 flex items-center border-x border-border sm:px-6 md:px-8 base:px-10 ${className}`}
35+
>
36+
{children}
37+
</p>
2438
<span className="w-10 grid place-content-center base:w-16 index" />
2539
</div>
2640
)

0 commit comments

Comments
 (0)