mirror of
https://github.com/twinpath/app-beta.git
synced 2026-01-26 22:01:53 +07:00
first commit
This commit is contained in:
82
resources/views/components/ui/alert.blade.php
Normal file
82
resources/views/components/ui/alert.blade.php
Normal file
@@ -0,0 +1,82 @@
|
||||
{{-- resources/views/components/alert.blade.php --}}
|
||||
|
||||
@props([
|
||||
'variant' => 'info',
|
||||
'title' => '',
|
||||
'message' => '',
|
||||
'showLink' => false,
|
||||
'linkHref' => '#',
|
||||
'linkText' => 'Learn more'
|
||||
])
|
||||
|
||||
@php
|
||||
$variantClasses = [
|
||||
'success' => [
|
||||
'container' => 'border-green-500 bg-green-50 dark:border-green-500/30 dark:bg-green-500/15',
|
||||
'icon' => 'text-green-500',
|
||||
],
|
||||
'error' => [
|
||||
'container' => 'border-red-500 bg-red-50 dark:border-red-500/30 dark:bg-red-500/15',
|
||||
'icon' => 'text-red-500',
|
||||
],
|
||||
'warning' => [
|
||||
'container' => 'border-yellow-500 bg-yellow-50 dark:border-yellow-500/30 dark:bg-yellow-500/15',
|
||||
'icon' => 'text-yellow-500',
|
||||
],
|
||||
'info' => [
|
||||
'container' => 'border-blue-500 bg-blue-50 dark:border-blue-500/30 dark:bg-blue-500/15',
|
||||
'icon' => 'text-blue-500',
|
||||
],
|
||||
];
|
||||
|
||||
$icons = [
|
||||
'success' => '<svg class="fill-current" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.70186 12.0001C3.70186 7.41711 7.41711 3.70186 12.0001 3.70186C16.5831 3.70186 20.2984 7.41711 20.2984 12.0001C20.2984 16.5831 16.5831 20.2984 12.0001 20.2984C7.41711 20.2984 3.70186 16.5831 3.70186 12.0001ZM12.0001 1.90186C6.423 1.90186 1.90186 6.423 1.90186 12.0001C1.90186 17.5772 6.423 22.0984 12.0001 22.0984C17.5772 22.0984 22.0984 17.5772 22.0984 12.0001C22.0984 6.423 17.5772 1.90186 12.0001 1.90186ZM15.6197 10.7395C15.9712 10.388 15.9712 9.81819 15.6197 9.46672C15.2683 9.11525 14.6984 9.11525 14.347 9.46672L11.1894 12.6243L9.6533 11.0883C9.30183 10.7368 8.73198 10.7368 8.38051 11.0883C8.02904 11.4397 8.02904 12.0096 8.38051 12.3611L10.553 14.5335C10.7217 14.7023 10.9507 14.7971 11.1894 14.7971C11.428 14.7971 11.657 14.7023 11.8257 14.5335L15.6197 10.7395Z" fill=""></path>
|
||||
</svg>',
|
||||
'error' => '<svg class="fill-current" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.6501 12.0001C3.6501 7.38852 7.38852 3.6501 12.0001 3.6501C16.6117 3.6501 20.3501 7.38852 20.3501 12.0001C20.3501 16.6117 16.6117 20.3501 12.0001 20.3501C7.38852 20.3501 3.6501 16.6117 3.6501 12.0001ZM12.0001 1.8501C6.39441 1.8501 1.8501 6.39441 1.8501 12.0001C1.8501 17.6058 6.39441 22.1501 12.0001 22.1501C17.6058 22.1501 22.1501 17.6058 22.1501 12.0001C22.1501 6.39441 17.6058 1.8501 12.0001 1.8501ZM10.9992 7.52517C10.9992 8.07746 11.4469 8.52517 11.9992 8.52517H12.0002C12.5525 8.52517 13.0002 8.07746 13.0002 7.52517C13.0002 6.97289 12.5525 6.52517 12.0002 6.52517H11.9992C11.4469 6.52517 10.9992 6.97289 10.9992 7.52517ZM12.0002 17.3715C11.586 17.3715 11.2502 17.0357 11.2502 16.6215V10.945C11.2502 10.5308 11.586 10.195 12.0002 10.195C12.4144 10.195 12.7502 10.5308 12.7502 10.945V16.6215C12.7502 17.0357 12.4144 17.3715 12.0002 17.3715Z" fill=""></path>
|
||||
</svg>',
|
||||
'warning' => '<svg class="fill-current" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.3499 12.0004C20.3499 16.612 16.6115 20.3504 11.9999 20.3504C7.38832 20.3504 3.6499 16.612 3.6499 12.0004C3.6499 7.38881 7.38833 3.65039 11.9999 3.65039C16.6115 3.65039 20.3499 7.38881 20.3499 12.0004ZM11.9999 22.1504C17.6056 22.1504 22.1499 17.6061 22.1499 12.0004C22.1499 6.3947 17.6056 1.85039 11.9999 1.85039C6.39421 1.85039 1.8499 6.3947 1.8499 12.0004C1.8499 17.6061 6.39421 22.1504 11.9999 22.1504ZM13.0008 16.4753C13.0008 15.923 12.5531 15.4753 12.0008 15.4753L11.9998 15.4753C11.4475 15.4753 10.9998 15.923 10.9998 16.4753C10.9998 17.0276 11.4475 17.4753 11.9998 17.4753L12.0008 17.4753C12.5531 17.4753 13.0008 17.0276 13.0008 16.4753ZM11.9998 6.62898C12.414 6.62898 12.7498 6.96476 12.7498 7.37898L12.7498 13.0555C12.7498 13.4697 12.414 13.8055 11.9998 13.8055C11.5856 13.8055 11.2498 13.4697 11.2498 13.0555L11.2498 7.37898C11.2498 6.96476 11.5856 6.62898 11.9998 6.62898Z" fill="#F04438"></path>
|
||||
</svg>',
|
||||
'info' => '<svg class="fill-current" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.6501 11.9996C3.6501 7.38803 7.38852 3.64961 12.0001 3.64961C16.6117 3.64961 20.3501 7.38803 20.3501 11.9996C20.3501 16.6112 16.6117 20.3496 12.0001 20.3496C7.38852 20.3496 3.6501 16.6112 3.6501 11.9996ZM12.0001 1.84961C6.39441 1.84961 1.8501 6.39392 1.8501 11.9996C1.8501 17.6053 6.39441 22.1496 12.0001 22.1496C17.6058 22.1496 22.1501 17.6053 22.1501 11.9996C22.1501 6.39392 17.6058 1.84961 12.0001 1.84961ZM10.9992 7.52468C10.9992 8.07697 11.4469 8.52468 11.9992 8.52468H12.0002C12.5525 8.52468 13.0002 8.07697 13.0002 7.52468C13.0002 6.9724 12.5525 6.52468 12.0002 6.52468H11.9992C11.4469 6.52468 10.9992 6.9724 10.9992 7.52468ZM12.0002 17.371C11.586 17.371 11.2502 17.0352 11.2502 16.621V10.9445C11.2502 10.5303 11.586 10.1945 12.0002 10.1945C12.4144 10.1945 12.7502 10.5303 12.7502 10.9445V16.621C12.7502 17.0352 12.4144 17.371 12.0002 17.371Z" fill=""></path>
|
||||
</svg>',
|
||||
];
|
||||
|
||||
$containerClass = $variantClasses[$variant]['container'] ?? $variantClasses['info']['container'];
|
||||
$iconClass = $variantClasses[$variant]['icon'] ?? $variantClasses['info']['icon'];
|
||||
$icon = $icons[$variant] ?? $icons['info'];
|
||||
@endphp
|
||||
|
||||
<div class="rounded-xl border p-4 {{ $containerClass }}">
|
||||
<div class="flex items-start gap-3">
|
||||
<div class="-mt-0.5 {{ $iconClass }}">
|
||||
{!! $icon !!}
|
||||
</div>
|
||||
|
||||
<div class="flex-1">
|
||||
@if($title)
|
||||
<h4 class="mb-1 text-sm font-semibold text-gray-800 dark:text-white/90">
|
||||
{{ $title }}
|
||||
</h4>
|
||||
@endif
|
||||
|
||||
@if($message)
|
||||
<p class="text-sm text-gray-500 dark:text-gray-400">{{ $message }}</p>
|
||||
@endif
|
||||
|
||||
@if($showLink)
|
||||
<a
|
||||
href="{{ $linkHref }}"
|
||||
class="inline-block mt-3 text-sm font-medium text-gray-500 underline dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"
|
||||
>
|
||||
{{ $linkText }}
|
||||
</a>
|
||||
@endif
|
||||
|
||||
{{-- Slot for custom content --}}
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
49
resources/views/components/ui/avatar.blade.php
Normal file
49
resources/views/components/ui/avatar.blade.php
Normal file
@@ -0,0 +1,49 @@
|
||||
|
||||
@props([
|
||||
'src' => '',
|
||||
'alt' => 'User Avatar',
|
||||
'size' => 'medium',
|
||||
'status' => 'none',
|
||||
])
|
||||
|
||||
@php
|
||||
$sizeClasses = [
|
||||
'xsmall' => 'h-6 w-6 max-w-6',
|
||||
'small' => 'h-8 w-8 max-w-8',
|
||||
'medium' => 'h-10 w-10 max-w-10',
|
||||
'large' => 'h-12 w-12 max-w-12',
|
||||
'xlarge' => 'h-14 w-14 max-w-14',
|
||||
'xxlarge' => 'h-16 w-16 max-w-16',
|
||||
];
|
||||
|
||||
$statusSizeClasses = [
|
||||
'xsmall' => 'h-1.5 w-1.5 max-w-1.5',
|
||||
'small' => 'h-2 w-2 max-w-2',
|
||||
'medium' => 'h-2.5 w-2.5 max-w-2.5',
|
||||
'large' => 'h-3 w-3 max-w-3',
|
||||
'xlarge' => 'h-3.5 w-3.5 max-w-3.5',
|
||||
'xxlarge' => 'h-4 w-4 max-w-4',
|
||||
];
|
||||
|
||||
$statusColorClasses = [
|
||||
'online' => 'bg-green-500',
|
||||
'offline' => 'bg-red-400',
|
||||
'busy' => 'bg-yellow-500',
|
||||
];
|
||||
|
||||
$sizeClass = $sizeClasses[$size] ?? $sizeClasses['medium'];
|
||||
$statusSizeClass = $statusSizeClasses[$size] ?? $statusSizeClasses['medium'];
|
||||
$statusColorClass = $statusColorClasses[$status] ?? '';
|
||||
@endphp
|
||||
|
||||
<div class="relative rounded-full {{ $sizeClass }}">
|
||||
<img
|
||||
src="{{ $src }}"
|
||||
alt="{{ $alt }}"
|
||||
class="h-full w-full object-cover rounded-full"
|
||||
/>
|
||||
|
||||
@if($status !== 'none')
|
||||
<span class="absolute bottom-0 right-0 rounded-full border-[1.5px] border-white dark:border-gray-900 {{ $statusSizeClass }} {{ $statusColorClass }}"></span>
|
||||
@endif
|
||||
</div>
|
||||
53
resources/views/components/ui/badge.blade.php
Normal file
53
resources/views/components/ui/badge.blade.php
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
@props([
|
||||
'variant' => 'light',
|
||||
'size' => 'md',
|
||||
'color' => 'primary',
|
||||
'startIcon' => null,
|
||||
'endIcon' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
$baseStyles = 'inline-flex items-center px-2.5 py-0.5 justify-center gap-1 rounded-full font-medium capitalize';
|
||||
|
||||
$sizeStyles = [
|
||||
'sm' => 'text-xs',
|
||||
'md' => 'text-sm',
|
||||
];
|
||||
|
||||
$variants = [
|
||||
'light' => [
|
||||
'primary' => 'bg-blue-50 text-blue-500 dark:bg-blue-500/15 dark:text-blue-400',
|
||||
'success' => 'bg-green-50 text-green-600 dark:bg-green-500/15 dark:text-green-500',
|
||||
'error' => 'bg-red-50 text-red-600 dark:bg-red-500/15 dark:text-red-500',
|
||||
'warning' => 'bg-yellow-50 text-yellow-600 dark:bg-yellow-500/15 dark:text-orange-400',
|
||||
'info' => 'bg-sky-50 text-sky-500 dark:bg-sky-500/15 dark:text-sky-500',
|
||||
'light' => 'bg-gray-100 text-gray-700 dark:bg-white/5 dark:text-white/80',
|
||||
'dark' => 'bg-gray-500 text-white dark:bg-white/5 dark:text-white',
|
||||
],
|
||||
'solid' => [
|
||||
'primary' => 'bg-blue-500 text-white dark:text-white',
|
||||
'success' => 'bg-green-500 text-white dark:text-white',
|
||||
'error' => 'bg-red-500 text-white dark:text-white',
|
||||
'warning' => 'bg-yellow-500 text-white dark:text-white',
|
||||
'info' => 'bg-sky-500 text-white dark:text-white',
|
||||
'light' => 'bg-gray-400 dark:bg-white/5 text-white dark:text-white/80',
|
||||
'dark' => 'bg-gray-700 text-white dark:text-white',
|
||||
],
|
||||
];
|
||||
|
||||
$sizeClass = $sizeStyles[$size] ?? $sizeStyles['md'];
|
||||
$colorStyles = $variants[$variant][$color] ?? $variants['light']['primary'];
|
||||
@endphp
|
||||
|
||||
<span class="{{ $baseStyles }} {{ $sizeClass }} {{ $colorStyles }}" {{ $attributes }}>
|
||||
@if($startIcon)
|
||||
{!! $startIcon !!}
|
||||
@endif
|
||||
|
||||
{{ $slot }}
|
||||
|
||||
@if($endIcon)
|
||||
{!! $endIcon !!}
|
||||
@endif
|
||||
</span>
|
||||
61
resources/views/components/ui/button.blade.php
Normal file
61
resources/views/components/ui/button.blade.php
Normal file
@@ -0,0 +1,61 @@
|
||||
@props([
|
||||
'size' => 'md',
|
||||
'variant' => 'primary',
|
||||
'startIcon' => null,
|
||||
'endIcon' => null,
|
||||
'className' => '',
|
||||
'disabled' => false,
|
||||
])
|
||||
|
||||
@php
|
||||
// Base classes
|
||||
$base = 'inline-flex items-center justify-center font-medium gap-2 rounded-lg transition';
|
||||
|
||||
// Size map
|
||||
$sizeMap = [
|
||||
'sm' => 'px-4 py-3 text-sm',
|
||||
'md' => 'px-5 py-3.5 text-sm',
|
||||
];
|
||||
$sizeClass = $sizeMap[$size] ?? $sizeMap['md'];
|
||||
|
||||
// Variant map
|
||||
$variantMap = [
|
||||
'primary' => 'bg-brand-500 text-white shadow-theme-xs hover:bg-brand-600 disabled:bg-brand-300',
|
||||
'outline' => 'bg-white text-gray-700 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-400 dark:ring-gray-700 dark:hover:bg-white/[0.03] dark:hover:text-gray-300',
|
||||
];
|
||||
$variantClass = $variantMap[$variant] ?? $variantMap['primary'];
|
||||
|
||||
// disabled classes
|
||||
$disabledClass = $disabled ? 'cursor-not-allowed opacity-50' : '';
|
||||
|
||||
// final classes (merge user className too)
|
||||
$classes = trim("{$base} {$sizeClass} {$variantClass} {$className} {$disabledClass}");
|
||||
@endphp
|
||||
|
||||
<button
|
||||
{{ $attributes->merge(['class' => $classes, 'type' => $attributes->get('type', 'button')]) }}
|
||||
@if($disabled) disabled @endif
|
||||
>
|
||||
{{-- start icon: priority — named slot 'startIcon' first, then startIcon prop if it's a HtmlString --}}
|
||||
@if (isset($__env) && $slot->isEmpty() === false) @endif
|
||||
|
||||
@hasSection('startIcon')
|
||||
<span class="flex items-center">
|
||||
@yield('startIcon')
|
||||
</span>
|
||||
@elseif($startIcon)
|
||||
<span class="flex items-center">{!! $startIcon !!}</span>
|
||||
@endif
|
||||
|
||||
{{-- main slot --}}
|
||||
{{ $slot }}
|
||||
|
||||
{{-- end icon: named slot 'endIcon' first, then endIcon prop --}}
|
||||
@hasSection('endIcon')
|
||||
<span class="flex items-center">
|
||||
@yield('endIcon')
|
||||
</span>
|
||||
@elseif($endIcon)
|
||||
<span class="flex items-center">{!! $endIcon !!}</span>
|
||||
@endif
|
||||
</button>
|
||||
59
resources/views/components/ui/modal.blade.php
Normal file
59
resources/views/components/ui/modal.blade.php
Normal file
@@ -0,0 +1,59 @@
|
||||
@props([
|
||||
'isOpen' => false,
|
||||
'showCloseButton' => true,
|
||||
])
|
||||
|
||||
<div x-data="{
|
||||
open: @js($isOpen),
|
||||
init() {
|
||||
this.$watch('open', value => {
|
||||
if (value) {
|
||||
document.body.style.overflow = 'hidden';
|
||||
} else {
|
||||
document.body.style.overflow = 'unset';
|
||||
}
|
||||
});
|
||||
}
|
||||
}" x-show="open" x-cloak @keydown.escape.window="open = false"
|
||||
class="modal fixed inset-0 z-99999 flex items-center justify-center overflow-y-auto p-5"
|
||||
{{ $attributes->except('class') }}>
|
||||
|
||||
<!-- Backdrop -->
|
||||
<div @click="open = false" class="fixed inset-0 h-full w-full bg-gray-400/50 backdrop-blur-[32px]"
|
||||
x-transition:enter="transition ease-out duration-300" x-transition:enter-start="opacity-0"
|
||||
x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0">
|
||||
</div>
|
||||
|
||||
<!-- Modal Content -->
|
||||
<div @click.stop class="relative w-full rounded-3xl bg-white dark:bg-gray-900 {{ $attributes->get('class') }}"
|
||||
x-transition:enter="transition ease-out duration-300" x-transition:enter-start="opacity-0 transform scale-95"
|
||||
x-transition:enter-end="opacity-100 transform scale-100" x-transition:leave="transition ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100 transform scale-100"
|
||||
x-transition:leave-end="opacity-0 transform scale-95">
|
||||
|
||||
<!-- Close Button -->
|
||||
@if ($showCloseButton)
|
||||
<button @click="open = false"
|
||||
class="absolute right-3 top-3 z-999 flex h-9.5 w-9.5 items-center justify-center rounded-full bg-gray-100 text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white sm:right-6 sm:top-6 sm:h-11 sm:w-11">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path fillRule="evenodd" clipRule="evenodd"
|
||||
d="M6.04289 16.5413C5.65237 16.9318 5.65237 17.565 6.04289 17.9555C6.43342 18.346 7.06658 18.346 7.45711 17.9555L11.9987 13.4139L16.5408 17.956C16.9313 18.3466 17.5645 18.3466 17.955 17.956C18.3455 17.5655 18.3455 16.9323 17.955 16.5418L13.4129 11.9997L17.955 7.4576C18.3455 7.06707 18.3455 6.43391 17.955 6.04338C17.5645 5.65286 16.9313 5.65286 16.5408 6.04338L11.9987 10.5855L7.45711 6.0439C7.06658 5.65338 6.43342 5.65338 6.04289 6.0439C5.65237 6.43442 5.65237 7.06759 6.04289 7.45811L10.5845 11.9997L6.04289 16.5413Z"
|
||||
fill="currentColor" />
|
||||
</svg>
|
||||
</button>
|
||||
@endif
|
||||
|
||||
<!-- Modal Body -->
|
||||
<div>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
[x-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
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