@props([
'video',
'tag' => 'button', // 'button' or 'a'
])
{{-- Canonical share trigger. Opens the single with the full
argument set (link, title, tracked-share, email, members) so every share
entry point offers the same options. Pass a slot for custom inner content;
otherwise it renders a default "Share" label. Extra attributes (class,
style, …) are forwarded to the element. --}}
@php
$auth = auth()->check();
$emailUrl = $auth ? route('videos.shareEmail', $video) : '';
$membersUrl = $auth ? route('videos.shareMembers', $video) : '';
$onclick = sprintf(
"openShareModal('%s','%s','%s','%s','%s')",
e($video->share_url),
addslashes($video->title),
route('videos.recordShare', $video),
$emailUrl,
$membersUrl
);
@endphp
@if($tag === 'a')
@if($slot->isEmpty())
Share
@else
{{ $slot }}
@endif
@else
@endif