"use client"; import Autoplay from "embla-carousel-autoplay"; import { useEffect, useRef, useState } from "react"; import type { CarouselApi } from "@/components/ui/carousel"; import { Carousel, CarouselContent, CarouselItem, } from "@/components/ui/carousel"; import { cn } from "@/lib/utils"; const technologies = [ { name: "Next", command: "npx create-next-app my-app", image: "/block-media/shadcnblocks/block/logos/nextjs-icon.svg", }, { name: "Vite", command: "npm create vite@latest", image: "/block-media/shadcnblocks/block/logos/vite-icon.svg", }, { name: "Remix", command: "npx create-remix@latest my-app", image: "/block-media/shadcnblocks/block/logos/remix-icon.svg", }, { name: "Gatsby", command: "npm init gatsby", image: "/block-media/shadcnblocks/block/logos/gatsby-icon.svg", }, { name: "Astro", command: "npm create astro@latest", image: "/block-media/shadcnblocks/block/logos/astro-icon.svg", }, { name: "Laravel", command: "laravel new my-app ", image: "/block-media/shadcnblocks/block/logos/laravel-icon.svg", }, { name: "React", command: "npx create-react-app my-app", image: "/block-media/shadcnblocks/block/logos/react-icon.svg", }, ]; interface Hero14Props { className?: string; } const Hero14 = ({ className }: Hero14Props) => { const plugin = useRef(Autoplay({ delay: 4000, stopOnInteraction: false })); const [api, setApi] = useState(); const [current, setCurrent] = useState(0); const [fadeIn, setFadeIn] = useState(true); useEffect(() => { if (!api) return; // Set initial selection setCurrent(api.selectedScrollSnap()); // Create a reusable update function const updateCurrent = () => { // Trigger fade out and then update with fade in setFadeIn(false); setTimeout(() => { setCurrent(api.selectedScrollSnap()); setFadeIn(true); }, 200); // Short delay for the fade effect }; // Add event listeners for both 'select' and 'settle' api.on("select", updateCurrent); api.on("settle", updateCurrent); // Clean up event listeners when component unmounts return () => { api.off("select", updateCurrent); api.off("settle", updateCurrent); }; }, [api]); // Function to manually select a technology const selectTechnology = (index: number) => { if (api) { api.scrollTo(index); } }; return (

راه‌اندازی در چند دقیقه

بدون پیچیدگی و تنها با چند مرحله ساده، پروژه خود را راه‌اندازی کرده و توسعه را آغاز کنید.

{technologies[current]?.name}

{technologies[current]?.command}

{technologies.map((technology, idx) => (
selectTechnology(idx)} > {technology.name}

{technology.name}

))}
); }; export { Hero14 };