Retro_Vintage_Earth_Tones_Filters_Component
中等复杂度的过滤器组件,具有复古/复古美感和大地色调,适用于仪表板。具有响应式设计和深色模式支持。
HTML 代码
<div class="flex flex-col p-4 sm:p-6 lg:p-8 bg-amber-50 dark:bg-stone-900 rounded-xl shadow-lg font-mono text-gray-800 dark:text-gray-200 border-2 border-stone-300 dark:border-stone-700">
<div class="flex flex-col sm:flex-row sm:items-center justify-between mb-6 border-b-2 border-dashed border-stone-400 dark:border-stone-600 pb-4">
<h2 class="text-2xl sm:text-3xl font-bold text-stone-800 dark:text-stone-200 mb-4 sm:mb-0">Dashboard Filters</h2>
<div class="flex items-center space-x-2">
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" value="" class="sr-only peer">
<div class="w-11 h-6 bg-stone-300 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-amber-500 rounded-full peer dark:bg-stone-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-amber-600"></div>
<span class="ml-3 text-sm font-medium text-stone-700 dark:text-stone-300">Dark Mode</span>
</label>
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-8">
<!-- Date Range Filter -->
<div class="flex flex-col">
<label for="date-range" class="block text-sm font-medium text-stone-700 dark:text-stone-300 mb-2">Date Range</label>
<div class="relative">
<input id="date-range" type="text" placeholder="Select Date Range" class="block w-full py-2 px-3 pl-10 text-stone-800 dark:text-stone-200 bg-white dark:bg-stone-800 border border-stone-400 dark:border-stone-600 rounded-md focus:ring-amber-500 focus:border-amber-500 shadow-sm transition-all duration-200 ease-in-out placeholder-stone-500 dark:placeholder-stone-400"
onfocus="this.type='date'" onblur="this.type='text'" >
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg class="h-5 w-5 text-stone-500 dark:text-stone-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
</svg>
</div>
</div>
</div>
<!-- Category Filter -->
<div class="flex flex-col">
<label for="category" class="block text-sm font-medium text-stone-700 dark:text-stone-300 mb-2">Category</label>
<div class="relative">
<select id="category" class="block w-full py-2 px-3 pl-10 text-stone-800 dark:text-stone-200 bg-white dark:bg-stone-800 border border-stone-400 dark:border-stone-600 rounded-md focus:ring-amber-500 focus:border-amber-500 shadow-sm transition-all duration-200 ease-in-out appearance-none">
<option value="">All Categories</option>
<option value="revenue">Revenue</option>
<option value="users">Users</option>
<option value="products">Products</option>
<option value="marketing">Marketing</option>
</select>
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg class="h-5 w-5 text-stone-500 dark:text-stone-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 8h10M7 12h10M7 16h10"></path>
</svg>
</div>
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-stone-500 dark:text-stone-400">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path d="M9.293 12.95l-.707.707L4.586 9.5l4-.707zM10 12.95l4-4-.707-.707L10 11.586l-2.293-2.293-.707.707L10 12.95z"/>
</svg>
</div>
</div>
</div>
<!-- Status Filter -->
<div class="flex flex-col">
<label for="status" class="block text-sm font-medium text-stone-700 dark:text-stone-300 mb-2">Status</label>
<div class="relative">
<select id="status" class="block w-full py-2 px-3 pl-10 text-stone-800 dark:text-stone-200 bg-white dark:bg-stone-800 border border-stone-400 dark:border-stone-600 rounded-md focus:ring-amber-500 focus:border-amber-500 shadow-sm transition-all duration-200 ease-in-out appearance-none">
<option value="">All Statuses</option>
<option value="active">Active</option>
<option value="pending">Pending</option>
<option value="completed">Completed</option>
<option value="archived">Archived</option>
</select>
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg class="h-5 w-5 text-stone-500 dark:text-stone-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</div>
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-stone-500 dark:text-stone-400">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path d="M9.293 12.95l-.707.707L4.586 9.5l4-.707zM10 12.95l4-4-.707-.707L10 11.586l-2.293-2.293-.707.707L10 12.95z"/>
</svg>
</div>
</div>
</div>
<!-- Search Input -->
<div class="flex flex-col sm:col-span-2 lg:col-span-1">
<label for="search" class="block text-sm font-medium text-stone-700 dark:text-stone-300 mb-2">Search</label>
<div class="relative">
<input id="search" type="text" placeholder="Search anything..." class="block w-full py-2 px-3 pl-10 text-stone-800 dark:text-stone-200 bg-white dark:bg-stone-800 border border-stone-400 dark:border-stone-600 rounded-md focus:ring-amber-500 focus:border-amber-500 shadow-sm transition-all duration-200 ease-in-out placeholder-stone-500 dark:placeholder-stone-400">
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg class="h-5 w-5 text-stone-500 dark:text-stone-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 11-14 0 7 7 0 0114 0z"></path>
</svg>
</div>
</div>
</div>
<!-- Slider Filter -->
<div class="flex flex-col sm:col-span-2 lg:col-span-1">
<label for="value-range" class="block text-sm font-medium text-stone-700 dark:text-stone-300 mb-2">Value Range: <span id="value-display" class="font-bold text-amber-700 dark:text-amber-400">$50 - $200</span></label>
<input id="value-range" type="range" min="0" max="500" value="150" class="w-full h-2 bg-stone-300 rounded-lg appearance-none cursor-pointer range-amber-500 dark:bg-stone-700"
oninput="document.getElementById('value-display').innerText = '$' + (this.value - 100 < 0 ? 0 : this.value - 100) + ' - $' + this.value">
</div>
<!-- User Avatar Filter -->
<div class="flex flex-col">
<label for="user-filter" class="block text-sm font-medium text-stone-700 dark:text-stone-300 mb-2">Assigned To</label>
<div class="flex items-center space-x-2">
<img class="w-9 h-9 rounded-full border-2 border-stone-400 dark:border-stone-600 object-cover" src="https://randomuser.me/api/portraits/men/45.jpg" alt="User Avatar">
<img class="w-9 h-9 rounded-full border-2 border-stone-400 dark:border-stone-600 object-cover" src="https://randomuser.me/api/portraits/women/67.jpg" alt="User Avatar">
<img class="w-9 h-9 rounded-full border-2 border-stone-400 dark:border-stone-600 object-cover" src="https://randomuser.me/api/portraits/men/22.jpg" alt="User Avatar">
<button class="w-9 h-9 rounded-full bg-stone-200 dark:bg-stone-700 text-stone-600 dark:text-stone-300 flex items-center justify-center border-2 border-stone-400 dark:border-stone-600 hover:bg-stone-300 dark:hover:bg-stone-600 transition-colors duration-200 ease-in-out">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path></svg>
</button>
</div>
</div>
</div>
<div class="flex flex-col sm:flex-row justify-end space-y-4 sm:space-y-0 sm:space-x-4 pt-6 border-t-2 border-dashed border-stone-400 dark:border-stone-600">
<button class="px-6 py-2 bg-stone-300 dark:bg-stone-700 text-stone-800 dark:text-stone-200 rounded-md shadow-md hover:bg-stone-400 dark:hover:bg-stone-600 transition-colors duration-200 ease-in-out border border-stone-400 dark:border-stone-600 font-bold uppercase text-sm tracking-wider">
Reset Filters
</button>
<button class="px-6 py-2 bg-amber-600 text-white rounded-md shadow-lg hover:bg-amber-700 transition-colors duration-200 ease-in-out border-2 border-amber-700 font-bold uppercase text-sm tracking-wider">
Apply Filters
</button>
</div>
</div>