feat(ui): childhood-friendly how section, squarical android quick-settings tiles with resizing, pure 3D art hero without tool names
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import Link from 'next/link';
|
||||
import {
|
||||
Sparkles,
|
||||
Scissors,
|
||||
@@ -9,119 +10,165 @@ import {
|
||||
Video,
|
||||
SunMedium,
|
||||
Layers,
|
||||
ArrowRight,
|
||||
Maximize2,
|
||||
Minimize2,
|
||||
GripHorizontal,
|
||||
LayoutGrid,
|
||||
Square,
|
||||
RectangleHorizontal,
|
||||
} from 'lucide-react';
|
||||
import { BentoGrid, BentoCard } from '@/components/magicui/bento-grid';
|
||||
import { TextAnimate } from '@/components/magicui/text-animate';
|
||||
|
||||
export type TileTemplate = 'squarical' | 'squared' | 'rectangular';
|
||||
|
||||
interface TrendyBentoSectionProps {
|
||||
title?: string;
|
||||
badge?: string;
|
||||
subtitle?: string;
|
||||
template?: TileTemplate;
|
||||
}
|
||||
|
||||
interface TileItem {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
href: string;
|
||||
cta: string;
|
||||
badge: string;
|
||||
icon: React.ElementType;
|
||||
imageUrl: string;
|
||||
isWide?: boolean;
|
||||
}
|
||||
|
||||
const INITIAL_TILES: TileItem[] = [
|
||||
{
|
||||
id: 'tile-matting',
|
||||
name: 'Hair-Strand Matting',
|
||||
description: 'Flyaway hair boundary separation with sub-pixel alpha matting.',
|
||||
href: '/tools/background-remover',
|
||||
cta: 'Try Matting',
|
||||
badge: 'TRENDING CUTOUT',
|
||||
icon: Scissors,
|
||||
imageUrl: '/management/pages/home/media/landscape_bg_matting.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-restore',
|
||||
name: '4K Face Restore',
|
||||
description: 'Generative restoration preserving real skin pores and eyelashes.',
|
||||
href: '/tools/old-photo-restorer',
|
||||
cta: 'Restore Photo',
|
||||
badge: '4K RESTORE',
|
||||
icon: Wand2,
|
||||
imageUrl: '/management/pages/home/media/landscape_restore_after.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-anime',
|
||||
name: 'AnimeGAN Synthesis',
|
||||
description: 'Transform portraits into high-definition anime illustrations.',
|
||||
href: '/tools/cartoon-avatar',
|
||||
cta: 'Create Avatar',
|
||||
badge: 'VIRAL ANIME',
|
||||
icon: Sparkles,
|
||||
imageUrl: '/management/pages/home/media/landscape_cartoon_after.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-video',
|
||||
name: 'Video Retouching',
|
||||
description: 'Temporal epidermal smoothing across 4K dynamic video clips.',
|
||||
href: '/tools/blemish-remover',
|
||||
cta: 'Watch Reel',
|
||||
badge: '4K 60FPS',
|
||||
icon: Video,
|
||||
imageUrl: '/management/pages/home/media/landscape_blemish_after.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-color',
|
||||
name: 'Deep Colorizer',
|
||||
description: 'Reconstruct vintage monochrome family archives with rich pigments.',
|
||||
href: '/tools/colorization',
|
||||
cta: 'Colorize Archive',
|
||||
badge: 'ARCHIVAL AI',
|
||||
icon: Palette,
|
||||
imageUrl: '/management/pages/home/media/landscape_color_after.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
{
|
||||
id: 'tile-relight',
|
||||
name: 'Studio Relight',
|
||||
description: 'Virtual three-point studio softbox illumination and retouch.',
|
||||
href: '/tools/blemish-remover',
|
||||
cta: 'Relight Portrait',
|
||||
badge: 'STUDIO GRADE',
|
||||
icon: SunMedium,
|
||||
imageUrl: '/management/pages/home/media/landscape_portrait_studio.jpg',
|
||||
isWide: false,
|
||||
},
|
||||
];
|
||||
|
||||
export function TrendyBentoSection({
|
||||
title = 'Trendy Neural Effects',
|
||||
badge = 'FEATURED CAPABILITIES',
|
||||
subtitle = 'Cutting-edge AI transformations engineered for creators, ecommerce, and studio professionals.',
|
||||
badge = 'CUSTOM SQUARICAL TILES',
|
||||
subtitle = 'Explore modular AI effects. Resize, customize, and rearrange tiles just like an Android Quick Settings panel.',
|
||||
template: defaultTemplate = 'squarical',
|
||||
}: TrendyBentoSectionProps) {
|
||||
const bentoCards = [
|
||||
{
|
||||
Icon: Scissors,
|
||||
name: 'Hair-Strand P3M Matting',
|
||||
description: 'Microscopic flyaway hair boundary separation with sub-pixel alpha matting.',
|
||||
href: '/tools/background-remover',
|
||||
cta: 'Try Alpha Matting',
|
||||
badge: 'TRENDING CUTOUT',
|
||||
className: 'md:col-span-2',
|
||||
background: (
|
||||
<img
|
||||
src="/management/pages/home/media/reel_hair_alpha.jpg"
|
||||
alt="Hair Cutout"
|
||||
className="absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
Icon: Wand2,
|
||||
name: '4K Generative Face Restoration',
|
||||
description: 'Neural restoration that preserves real skin pores, eyelashes, and authentic iris glints.',
|
||||
href: '/tools/old-photo-restorer',
|
||||
cta: 'Restore Photos',
|
||||
badge: '4K RESTORATION',
|
||||
className: 'md:col-span-1',
|
||||
background: (
|
||||
<img
|
||||
src="/management/pages/home/media/reel_restore_after.jpg"
|
||||
alt="Restoration"
|
||||
className="absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
Icon: Sparkles,
|
||||
name: 'Cartoon & AnimeGAN Synthesis',
|
||||
description: 'Transform portraits into high-definition anime illustrations and stylized manga art.',
|
||||
href: '/tools/cartoon-avatar',
|
||||
cta: 'Create Avatar',
|
||||
badge: 'VIRAL ANIME',
|
||||
className: 'md:col-span-1',
|
||||
background: (
|
||||
<img
|
||||
src="/management/pages/home/media/showcase_05_cartoon_after.jpg"
|
||||
alt="Cartoon Avatar"
|
||||
className="absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
Icon: Video,
|
||||
name: 'Temporal Video Retouching',
|
||||
description: 'Continuous temporal epidermal smoothing across 4K dynamic video clips with zero flicker.',
|
||||
href: '/tools/blemish-remover',
|
||||
cta: 'Watch Reel',
|
||||
badge: '4K 60FPS REEL',
|
||||
className: 'md:col-span-2',
|
||||
background: (
|
||||
<img
|
||||
src="/management/pages/home/media/reel_video_poster.jpg"
|
||||
alt="Video Retouch"
|
||||
className="absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
Icon: Palette,
|
||||
name: 'Historical Deep Colorizer',
|
||||
description: 'Reconstruct vintage monochrome family archives with historically grounded pigment priors.',
|
||||
href: '/tools/colorization',
|
||||
cta: 'Colorize Archive',
|
||||
badge: 'ARCHIVAL AI',
|
||||
className: 'md:col-span-1',
|
||||
background: (
|
||||
<img
|
||||
src="/management/pages/home/media/showcase_04_restore_after.jpg"
|
||||
alt="Colorizer"
|
||||
className="absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
Icon: SunMedium,
|
||||
name: 'Studio Relight & Sub-Pore Retouch',
|
||||
description: 'Virtual three-point studio softbox illumination and non-destructive blemish removal.',
|
||||
href: '/tools/blemish-remover',
|
||||
cta: 'Relight Portrait',
|
||||
badge: 'STUDIO GRADE',
|
||||
className: 'md:col-span-2',
|
||||
background: (
|
||||
<img
|
||||
src="/management/pages/home/media/sample_portrait_1.jpg"
|
||||
alt="Studio Relight"
|
||||
className="absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
),
|
||||
},
|
||||
];
|
||||
const [template, setTemplate] = useState<TileTemplate>(defaultTemplate);
|
||||
const [tiles, setTiles] = useState<TileItem[]>(INITIAL_TILES);
|
||||
const [draggedIdx, setDraggedIdx] = useState<number | null>(null);
|
||||
|
||||
// Toggle individual tile width (1x1 to 2x1 just like Android Quick Settings)
|
||||
const toggleTileSize = (id: string, e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setTiles((prev) =>
|
||||
prev.map((tile) =>
|
||||
tile.id === id ? { ...tile, isWide: !tile.isWide } : tile
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
// Drag-and-drop tile reordering
|
||||
const handleDragStart = (idx: number) => {
|
||||
setDraggedIdx(idx);
|
||||
};
|
||||
|
||||
const handleDragOver = (e: React.DragEvent, targetIdx: number) => {
|
||||
e.preventDefault();
|
||||
if (draggedIdx === null || draggedIdx === targetIdx) return;
|
||||
setTiles((prev) => {
|
||||
const updated = [...prev];
|
||||
const [draggedItem] = updated.splice(draggedIdx, 1);
|
||||
updated.splice(targetIdx, 0, draggedItem);
|
||||
return updated;
|
||||
});
|
||||
setDraggedIdx(targetIdx);
|
||||
};
|
||||
|
||||
const handleDragEnd = () => {
|
||||
setDraggedIdx(null);
|
||||
};
|
||||
|
||||
// Determine styling based on selected template
|
||||
const getTemplateClasses = (isWide?: boolean) => {
|
||||
if (template === 'squarical') {
|
||||
// Default Squarical / Squircle geometry
|
||||
return isWide
|
||||
? 'col-span-1 md:col-span-2 aspect-[16/9] sm:aspect-[2/1] rounded-[36px] sm:rounded-[42px]'
|
||||
: 'col-span-1 aspect-square rounded-[36px] sm:rounded-[42px]';
|
||||
}
|
||||
if (template === 'squared') {
|
||||
// Classic square
|
||||
return isWide
|
||||
? 'col-span-1 md:col-span-2 aspect-[2/1] rounded-2xl'
|
||||
: 'col-span-1 aspect-square rounded-2xl';
|
||||
}
|
||||
// Rectangular template
|
||||
return 'col-span-1 md:col-span-2 aspect-[16/8] rounded-3xl';
|
||||
};
|
||||
|
||||
return (
|
||||
<section id="trendy-effects" className="py-20 sm:py-28 px-4 sm:px-6 md:px-8 lg:px-10 bg-[#FAF8F5] relative overflow-hidden border-t border-slate-900/[0.06]">
|
||||
@@ -133,7 +180,7 @@ export function TrendyBentoSection({
|
||||
<span>{badge}</span>
|
||||
</div>
|
||||
|
||||
<h2 className="text-3xl sm:text-5xl font-display font-extrabold text-slate-900 tracking-tight">
|
||||
<h2 className="text-3xl sm:text-5xl font-display font-extrabold text-slate-900 tracking-tight text-balance">
|
||||
<TextAnimate animation="slideLeft" by="character">
|
||||
{title}
|
||||
</TextAnimate>
|
||||
@@ -144,14 +191,126 @@ export function TrendyBentoSection({
|
||||
{subtitle}
|
||||
</TextAnimate>
|
||||
</p>
|
||||
|
||||
{/* Android Quick Settings Template Switcher Pills */}
|
||||
<div className="pt-2 flex items-center justify-center flex-wrap gap-2 text-xs font-display font-bold">
|
||||
<button
|
||||
onClick={() => setTemplate('squarical')}
|
||||
className={`flex items-center gap-1.5 px-4 py-2 rounded-full transition-all duration-200 ${
|
||||
template === 'squarical'
|
||||
? 'bg-slate-900 text-white shadow-md shadow-slate-900/15 scale-105'
|
||||
: 'bg-white text-slate-700 hover:bg-slate-100 border border-slate-200'
|
||||
}`}
|
||||
>
|
||||
<LayoutGrid className="w-3.5 h-3.5 text-blue-500" />
|
||||
<span>Squarical (Default)</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setTemplate('squared')}
|
||||
className={`flex items-center gap-1.5 px-4 py-2 rounded-full transition-all duration-200 ${
|
||||
template === 'squared'
|
||||
? 'bg-slate-900 text-white shadow-md shadow-slate-900/15 scale-105'
|
||||
: 'bg-white text-slate-700 hover:bg-slate-100 border border-slate-200'
|
||||
}`}
|
||||
>
|
||||
<Square className="w-3.5 h-3.5 text-indigo-500" />
|
||||
<span>Squared</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setTemplate('rectangular')}
|
||||
className={`flex items-center gap-1.5 px-4 py-2 rounded-full transition-all duration-200 ${
|
||||
template === 'rectangular'
|
||||
? 'bg-slate-900 text-white shadow-md shadow-slate-900/15 scale-105'
|
||||
: 'bg-white text-slate-700 hover:bg-slate-100 border border-slate-200'
|
||||
}`}
|
||||
>
|
||||
<RectangleHorizontal className="w-3.5 h-3.5 text-cyan-500" />
|
||||
<span>Rectangular</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Bento Grid Layout */}
|
||||
<BentoGrid className="lg:grid-rows-2">
|
||||
{bentoCards.map((card, idx) => (
|
||||
<BentoCard key={idx} {...card} />
|
||||
))}
|
||||
</BentoGrid>
|
||||
{/* Squarical Tile Grid (Android Quick Settings Style) */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||
{tiles.map((tile, idx) => {
|
||||
const Icon = tile.icon;
|
||||
const templateClass = getTemplateClasses(tile.isWide);
|
||||
|
||||
return (
|
||||
<div
|
||||
key={tile.id}
|
||||
draggable
|
||||
onDragStart={() => handleDragStart(idx)}
|
||||
onDragOver={(e) => handleDragOver(e, idx)}
|
||||
onDragEnd={handleDragEnd}
|
||||
className={`group relative flex flex-col justify-between overflow-hidden bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm hover:shadow-cream-lg transition-all duration-500 hover:-translate-y-1.5 cursor-grab active:cursor-grabbing select-none ${templateClass}`}
|
||||
>
|
||||
{/* Background Image (Covering the squarical tile) */}
|
||||
<img
|
||||
src={tile.imageUrl}
|
||||
alt={tile.name}
|
||||
className="absolute inset-0 w-full h-full object-cover transition-transform duration-700 group-hover:scale-105"
|
||||
loading="lazy"
|
||||
/>
|
||||
|
||||
{/* Dark Vignette Overlay for Readability */}
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-slate-950/90 via-slate-950/30 to-slate-950/20 group-hover:via-slate-950/15 transition-all duration-300 pointer-events-none" />
|
||||
|
||||
{/* Top Tile Bar: Drag Handle, Badge, and Resize Button */}
|
||||
<div className="relative z-20 flex items-center justify-between p-5">
|
||||
<div className="flex items-center gap-2">
|
||||
{/* Drag Handle Indicator */}
|
||||
<div className="w-8 h-8 rounded-full bg-black/50 backdrop-blur-md text-white/70 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<GripHorizontal className="w-4 h-4" />
|
||||
</div>
|
||||
|
||||
<span className="px-3 py-1 rounded-full text-[10px] font-mono font-bold tracking-wider uppercase bg-black/60 backdrop-blur-md text-cyan-400 border border-cyan-500/30 shadow-sm">
|
||||
{tile.badge}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Android Quick Settings Size Toggle Button (1x1 to 2x1) */}
|
||||
<button
|
||||
onClick={(e) => toggleTileSize(tile.id, e)}
|
||||
title={tile.isWide ? 'Shrink to 1x1' : 'Expand to 2x1'}
|
||||
className="w-9 h-9 rounded-2xl bg-white/90 hover:bg-white text-slate-800 shadow-md flex items-center justify-center transition-all duration-200 hover:scale-110 active:scale-95"
|
||||
>
|
||||
{tile.isWide ? (
|
||||
<Minimize2 className="w-4 h-4 text-blue-600" />
|
||||
) : (
|
||||
<Maximize2 className="w-4 h-4 text-blue-600" />
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Bottom Tile Info & Link */}
|
||||
<div className="relative z-20 p-6 flex flex-col gap-2">
|
||||
<div className="w-10 h-10 rounded-2xl bg-white/90 backdrop-blur-md text-blue-600 flex items-center justify-center shadow-md mb-1">
|
||||
<Icon className="w-5 h-5" />
|
||||
</div>
|
||||
|
||||
<h3 className="text-xl font-display font-bold text-white tracking-tight group-hover:text-cyan-300 transition-colors">
|
||||
{tile.name}
|
||||
</h3>
|
||||
|
||||
<p className="text-xs text-slate-200 line-clamp-2 leading-relaxed font-sans">
|
||||
{tile.description}
|
||||
</p>
|
||||
|
||||
<Link
|
||||
href={tile.href}
|
||||
className="mt-2 inline-flex items-center gap-1.5 text-xs font-display font-bold text-cyan-300 group-hover:text-white transition-colors"
|
||||
>
|
||||
<span>{tile.cta}</span>
|
||||
<ArrowRight className="w-3.5 h-3.5 transition-transform group-hover:translate-x-1" />
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user