@props([ 'folder', 'cards' => null, // 可選:使用者自訂資料夾顏色 map(controller 帶:pluck('color','folder_id')) 'userColors' => [], ]) @php $all = collect($cards ?? [])->values(); $total = $all->count(); $items = $all->take(9); // 只顯示前 9 個 $count = $items->count(); $pages = (int) ceil(max(1, $total) / 9); $showDots = $total > 9; // 顏色:個人偏好 > 資料夾預設 > 柔和藍 $base = $userColors[$folder->id] ?? ($folder->color ?? '#cfe4ff'); $hex = ltrim($base, '#'); if (strlen($hex) !== 6) { $hex = 'cfe4ff'; } [$r, $g, $b] = [hexdec(substr($hex, 0, 2)), hexdec(substr($hex, 2, 2)), hexdec(substr($hex, 4, 2))]; $light = sprintf('#%02x%02x%02x', min(255, $r + 28), min(255, $g + 28), min(255, $b + 28)); $deep = sprintf('#%02x%02x%02x', max(0, $r - 40), max(0, $g - 40), max(0, $b - 40)); @endphp