mirror of
https://github.com/twinpath/app.git
synced 2026-01-27 05:42:04 +07:00
Initial commit
This commit is contained in:
29
resources/views/components/ui/youtube-embed.blade.php
Normal file
29
resources/views/components/ui/youtube-embed.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
@props([
|
||||
'videoId' => '',
|
||||
'aspectRatio' => '16:9',
|
||||
'title' => 'YouTube video',
|
||||
'className' => ''
|
||||
])
|
||||
|
||||
@php
|
||||
$aspectRatioClasses = [
|
||||
'16:9' => 'aspect-video',
|
||||
'4:3' => 'aspect-4/3',
|
||||
'21:9' => 'aspect-21/9',
|
||||
'1:1' => 'aspect-square',
|
||||
];
|
||||
|
||||
$aspectRatioClass = $aspectRatioClasses[$aspectRatio] ?? $aspectRatioClasses['16:9'];
|
||||
@endphp
|
||||
|
||||
<div class="overflow-hidden rounded-lg {{ $aspectRatioClass }} {{ $className }}">
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/{{ $videoId }}"
|
||||
title="{{ $title }}"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
class="w-full h-full"
|
||||
></iframe>
|
||||
</div>
|
||||
Reference in New Issue
Block a user