import React, { useState } from "react"; import { useThemeHooks } from '@redocly/theme/core/hooks'; interface Project { id: string; label: string; url: string; description?: string; // New optional field for payments page buttonText?: string; // Optional button text for battle-tested cards } interface ProjectCardsProps { title: string; projects: Project[]; showCarousel?: boolean; // true for tokenization (carousel), false for payments (grid) className?: string; } const ProjectCard = ({ project, index, showCarousel = true }: { project: Project; index: number; showCarousel?: boolean; }) => { const { useTranslate } = useThemeHooks(); const { translate } = useTranslate(); return (
{project.label}
{!showCarousel && project.description && (
{(() => { const words = project.description.split(' '); const firstWord = words[0]; const restOfText = words.slice(1).join(' '); return ( <> {firstWord} {restOfText && {restOfText}} ); })()}
)} {!showCarousel && project.buttonText && (
{translate(project.buttonText)}
)} ); }; const FeaturedProjectsCarousel = ({ projects }: { projects: Project[] }) => { const [currentIndex, setCurrentIndex] = useState(0); const handlePrev = () => { if (currentIndex > 0) { setCurrentIndex(currentIndex - 1); } }; const handleNext = () => { if (currentIndex < projects.length - 3) { setCurrentIndex(currentIndex + 1); } }; return (
); }; const ProjectsGrid = ({ projects }: { projects: Project[] }) => { return (
{projects.map((project, index) => ( ))}
); }; export const ProjectCards: React.FC = ({ title, projects, showCarousel = true, className = "" }) => { const { useTranslate } = useThemeHooks(); const { translate } = useTranslate(); return (

{translate(title)}

{showCarousel ? ( ) : ( )}
); };