import React, { useState, useRef, useLayoutEffect, useMemo } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import gsap from 'gsap'; import { ScrollTrigger } from 'gsap/ScrollTrigger'; import { Link } from 'react-router-dom'; gsap.registerPlugin(ScrollTrigger); const servicesData = [ { id: 1, category: 'Web Services', title: 'Web Design', description: 'Professional websites with domain registration and DNS support to give your business a clean, reliable online presence.', icon: 'language', image: '/assets/services/business-it.webp', href: '/services/web-design-corpus-christi' }, { id: 2, category: 'Web Services', title: 'Bay Area Email Services', description: 'Enterprise cloud email with 99.99% uptime, local Texas support, 25 GB mailboxes, and business-grade delivery for $5 per inbox.', icon: 'mail', image: '/assets/services/business-it.webp', href: '/services/business-email-services' }, { id: 3, category: 'IT Infrastructure', title: 'Printer & Scanner Installation', description: 'Professional installation and configuration of printers and scanners to ensure seamless integration into your workflow.', icon: 'print', image: '/assets/services/printer-scanner.webp', href: '/services' }, { id: 4, category: 'IT Infrastructure', title: 'New/Refurbished Desktop Hardware', description: 'Supply and installation of new or refurbished desktop hardware, tailored to meet your business requirements.', icon: 'computer', image: '/assets/services/desktop-hardware.webp', href: '/services/computer-support' }, { id: 5, category: 'Networking', title: 'Network Infrastructure Support', description: 'Robust network solutions to ensure connectivity, security, and efficiency, including routers, access points, and switches.', icon: 'lan', image: '/assets/services/network-infrastructure.webp', href: '/services' }, { id: 6, category: 'Networking', title: 'Shared Drive', description: 'Setup and management of shared drive solutions so your team can store, access, and organize files reliably.', icon: 'storage', image: '/assets/services/nas-storage.webp', href: '/services' }, { id: 7, category: 'IT Infrastructure', title: 'IT Help Desk', description: 'Fast and reliable help desk support for employees, resolving technical issues remotely or on-site.', icon: 'support_agent', image: '/assets/services/help-desk.webp', href: '/services/it-help-desk' } ]; const categories = ['All', 'IT Infrastructure', 'Web Services', 'Networking']; interface ServicesProps { preview?: boolean; featuredIds?: number[]; } const Services: React.FC = ({ preview = false, featuredIds }) => { const [activeCategory, setActiveCategory] = useState('All'); const [showAll, setShowAll] = useState(false); const containerRef = useRef(null); // Determine if we should be in "preview mode" (showing only a subset) // This applies if preview is true OR if featuredIds are provided and we haven't clicked "Show More" const isRestrictedView = (preview || featuredIds) && !showAll; // Filter services based on category first (unless in restricted view with specific IDs, where we might want to ignore category or just show the specific ones) const filteredByCategory = activeCategory === 'All' ? servicesData : servicesData.filter(s => s.category === activeCategory); const displayedServices = useMemo(() => { if (isRestrictedView) { if (featuredIds && featuredIds.length > 0) { // Sort the services to match the order of featuredIds return featuredIds .map(id => servicesData.find(s => s.id === id)) .filter((s): s is typeof servicesData[0] => s !== undefined); } // Fallback to first 3 if no IDs but preview is true return servicesData.slice(0, 3); } // Show all (filtered by category) return filteredByCategory; }, [isRestrictedView, featuredIds, filteredByCategory]); return (
Our Services

Comprehensive IT solutions tailored to your business needs.

{/* Categories - Hide in restricted view to keep it clean, or keep it? User said "mach nur das 3 services angezeigt werden". usually categories are for the full list. */} {!isRestrictedView && (
{categories.map((cat) => ( ))}
)}
{displayedServices.map((service, index) => ( {/* Image Container */}
{service.title}
{service.icon}

{service.title}

{service.description}

Learn More arrow_forward
))}
{isRestrictedView && (
)} {/* If we are showing all and originally had a restricted view, maybe show a "Show Less" but user didn't ask for it. The user said "then all are shown". */}
); }; export default Services;