Overview
TheContenidoVideo component provides a styled wrapper for embedding YouTube videos in project detail pages. It features:
- Lightweight YouTube embed using
react-lite-youtube-embed - Material-UI Card styling matching the app theme
- High-quality video poster (maxresdefault)
- WebP image format support for better performance
- Rounded border with custom styling
- Emoji-decorated section title
Props
The video title, used for accessibility and SEO (passed to the YouTube embed as the title attribute)
The YouTube video ID (not the full URL). For example, if the video URL is
https://youtube.com/watch?v=dQw4w9WgXcQ, you would pass "dQw4w9WgXcQ"Usage Example
FromProyectoDetalle.jsx, showing how the video component is displayed in project details:
The component checks if
proyectoData.videoUrl exists before rendering, making it safe to use even when some projects don’t have videos.Component Structure
Card Container
The component uses Material-UI’sCard and CardContent for structure:
Section Title
The title includes a film emoji and uses the brand cyan color:Video Embed Container
The video is wrapped in a styled div with rounded corners and a border:Lite YouTube Embed
This component usesreact-lite-youtube-embed for performance benefits:
Installation
Import Required
Benefits
Configuration
| Parameter | Value | Purpose |
|---|---|---|
id | {videoUrl} | YouTube video ID |
title | {titulo} | Accessibility title |
poster | "maxresdefault" | Highest quality thumbnail (1280×720) |
webp | true | Use WebP format for thumbnail (better compression) |
Styling Details
Color Scheme
| Element | Color | Hex Code |
|---|---|---|
| Card Background | Purple | #2d1f6e |
| Title Text | Cyan | #15F5BA |
| Border | Gray | #525554 |
Layout Properties
- Card height:
100%(fills parent container) - Border radius:
12px - Border width:
3px - Title margin:
15pxbottom spacing - Flex layout: Centers content vertically
Video ID Extraction
If you need to extract the video ID from a full YouTube URL:Layout Integration
InProyectoDetalle.jsx, the video component is placed in a two-column layout:
ColumnaGrande component gives the video 66% of the width on desktop, creating a balanced layout.
Responsive Behavior
The
Agrupar styled component changes to a column layout on screens smaller than 1100px, making the video full-width on mobile devices.Alternative: Standard YouTube Embed
If you prefer the standard YouTube iframe embed:Material-UI Components Used
Card- Main containerCardContent- Content wrapper with flex layout
Related Components
- ImageCarousel - Image slideshow component
- TarjetasContenido - Content card wrapper
- BotonDescarga - PDF download buttons