@php $settings = $section->settings ?? []; $title = $settings['title'] ?? 'Browse Categories'; $subtitle = $settings['subtitle'] ?? 'Explore our diverse ecosystem of digital assets.'; $limit = $settings['limit'] ?? 6; $columns = $settings['columns'] ?? 3; $layout = $settings['layout'] ?? 'grid'; $cardStyle = $settings['card_style'] ?? 'glass'; $cardSize = $settings['card_size'] ?? 'small'; $autoScroll = $settings['auto_scroll'] ?? false; $scrollSpeed = $settings['scroll_speed'] ?? '40s'; // Animation Settings $animType = $settings['anim_type'] ?? 'fade-in-up'; $animDuration = $settings['anim_duration'] ?? '0.6s'; $animDelay = $settings['anim_delay'] ?? '0s'; $stagger = $settings['anim_stagger'] ?? true; $hoverAnim = $settings['hover_anim'] ?? 'lift'; $paddingTop = $settings['padding_top'] ?? '0px'; $paddingBottom = $settings['padding_bottom'] ?? '0px'; $bgColor = $settings['bg_color'] ?? 'transparent'; $titleAlignment = $settings['title_alignment'] ?? 'center'; // Fetch categories $categories = \App\Modules\Product\Models\Category::withCount('products') ->when(($settings['source'] ?? 'popular') === 'popular', fn($q) => $q->orderBy('products_count', 'desc')) ->when(($settings['source'] ?? 'popular') === 'alphabetic', fn($q) => $q->orderBy('name', 'asc')) ->limit($limit) ->get(); // Grid Column Mapping $gridCols = [ '1' => 'grid-cols-1', '2' => 'grid-cols-2', '3' => 'grid-cols-2 md:grid-cols-3', '4' => 'grid-cols-2 lg:grid-cols-4', '6' => 'grid-cols-2 sm:grid-cols-3 lg:grid-cols-5', ][$columns] ?? 'grid-cols-2 md:grid-cols-3'; $isSlider = $layout === 'slider'; $isMoving = $autoScroll; // Size mapping - INCREASED for images $sizeClasses = match($cardSize) { 'small' => [ 'container' => 'min-h-[5rem] py-3 px-5', // Pill mode - Flexible height for long text 'icon_wrap' => 'w-12 h-12 rounded-xl', 'icon_text' => 'text-xl', 'name_text' => 'text-sm md:text-base font-800', 'count_text' => 'text-[9px]', 'is_pill' => true ], 'compact' => [ 'container' => 'h-36 p-5', 'icon_wrap' => 'w-11 h-11 rounded-2xl', 'icon_text' => 'text-2xl', 'name_text' => 'text-base font-900', 'count_text' => 'text-[10px]', 'is_pill' => false ], default => [ // standard 'container' => 'h-52 p-6', 'icon_wrap' => 'w-14 h-14 rounded-2xl', 'icon_text' => 'text-3xl', 'name_text' => 'text-xl font-900', 'count_text' => 'text-[11px]', 'is_pill' => false ] }; // Style mapping $cardClasses = match($cardStyle) { 'minimal' => 'bg-white border border-border-subtle shadow-sm hover:shadow-xl hover:border-brand-500/30 dark:bg-surface-primary', 'border' => 'bg-transparent border border-border-subtle hover:border-brand-500 shadow-none', default => 'bg-surface-secondary/25 backdrop-blur-xl border border-white/5 hover:border-brand-500/40 shadow-xl', // glass }; $textClasses = $cardStyle === 'minimal' ? 'text-text-base' : 'text-text-base dark:text-white'; $subTextClasses = $cardStyle === 'minimal' ? 'text-text-muted' : 'text-text-dim'; @endphp @if($isMoving) @endif @php $ptStyle = "padding-top: $paddingTop;"; $pbStyle = "padding-bottom: $paddingBottom;"; $bgStyle = $bgColor !== 'transparent' ? "background-color: $bgColor;" : ''; @endphp

{{ $title }}

{{ $subtitle }}

@php $items = $categories; if ($isMoving && $categories->count() > 0) { $repeats = $categories->count() < 12 ? 4 : 2; $items = collect(); for ($i = 0; $i < $repeats; $i++) { $items = $items->concat($categories); } } @endphp @foreach ($items as $category) @php $itemDelay = $stagger ? (float)$animDelay + ($loop->index * 0.04) : (float)$animDelay; $hoverClass = $hoverAnim !== 'none' ? 'hover-' . $hoverAnim : ''; $catColor = $category->color ?? '#6366f1'; @endphp {{-- Background / Image for Non-Pill card styles --}} @if($category->image && !$sizeClasses['is_pill']) {{ $category->name }}
@elseif(!$sizeClasses['is_pill'])
@endif
@if($sizeClasses['is_pill'])
@if($category->image) @php $catImg = $category->image; $catImgUrl = (Str::startsWith($catImg, ['http://', 'https://'])) ? $catImg : Storage::url($catImg); @endphp @else {{ $category->icon ?? '📦' }} @endif

{{ $category->name }}

{{ $category->products_count }} PRODUCTS
@else
@if($category->image) @else {{ $category->icon ?? '📦' }} @endif

{{ $category->name }}

{{ $category->products_count }} ITEMS
@endif
@endforeach