Files
formularios_front/src/components/carousel.tsx
T
miguel e092eeec4d feat: add markdown editor for event description and update event forms
- Added @uiw/react-md-editor dependency for rich text editing.
- Implemented dynamic loading of the markdown editor in create and edit event forms.
- Updated event forms to include new fields for 'apellidos', 'genero', and 'rfc'.
- Refactored event and questionnaire pages to improve data fetching and rendering.
- Removed unnecessary Excel files from the public directory.
- Enhanced error handling and logging in event creation and form submission processes.
- Updated carousel component to handle empty image arrays gracefully.
- Created a new FormularioPage component to streamline questionnaire rendering.
2025-06-18 15:51:17 -06:00

73 lines
1.9 KiB
TypeScript

import Image from 'next/image';
import React from 'react';
export interface CarouselProps {
id?: string;
images?: {
src: string;
alt?: string;
}[];
}
export default function Carousel({ id="carousel-banners-eventos", images }: CarouselProps) {
if (!images || images.length === 0) {
return <div></div>;
}
return (
<div id={id} className="carousel slide" data-bs-ride="carousel">
<div className="carousel-inner">
{images.map((img, index) => (
<div
key={index}
className={`carousel-item ${index === 0 ? 'active' : ''}`}
>
<Image
src={img.src ? img.src : '/default-banner.png'}
width={1200}
height={400}
alt="Ejemplo de banner"
className="d-block w-100 rounded-3 img-fluid"
style={{
height: '400px',
objectFit: 'cover',
objectPosition: 'center',
maxHeight: '400px',
}}
/>
</div>
))}
</div>
{images.length > 1 && (
<>
<button
className="carousel-control-prev"
type="button"
data-bs-target={`#${id}`}
data-bs-slide="prev"
>
<span
className="carousel-control-prev-icon"
aria-hidden="true"
></span>
<span className="visually-hidden">Anterior</span>
</button>
<button
className="carousel-control-next"
type="button"
data-bs-target={`#${id}`}
data-bs-slide="next"
>
<span
className="carousel-control-next-icon"
aria-hidden="true"
></span>
<span className="visually-hidden">Siguiente</span>
</button>
</>
)}
</div>
);
}