الگو:صفحه اصلی مغازه شما/دسته بندی موضوعی: تفاوت میان نسخهها
Esfandiari (بحث | مشارکتها) بدون خلاصۀ ویرایش |
Esfandiari (بحث | مشارکتها) بدون خلاصۀ ویرایش |
||
| خط ۱: | خط ۱: | ||
<html> | <html> | ||
<div class="mediawiki-category-container" style="direction: rtl; font-family: tahoma, arial; max-width: 1000px; margin: 20px auto; padding: | |||
<div class="mediawiki-category-container" style="direction: rtl; font-family: tahoma, arial; max-width: 1000px; margin: 20px auto; padding: 10px; background: #f9f9f9; border-radius: 15px; border: 1px solid #c9e4d5;"> | |||
<!-- بخش جستجو --> | <!-- بخش جستجو --> | ||
<div class="search-box" style="margin-bottom: | <div class="search-box" style="margin-bottom: 10px; text-align: center;"> | ||
<input type="text" id="categorySearch" placeholder="جستجو | <input type="text" id="categorySearch" placeholder="جستجو..." | ||
style="width: | style="width: 95%; padding: 6px 15px; border: 1px solid #c9e4d5; border-radius: 20px; outline: none; font-size: 14px;"> | ||
</div> | </div> | ||
<!-- بخش فیلترها --> | <!-- بخش فیلترها --> | ||
<div class="filter-bar" style="display: flex; flex-wrap: wrap; gap: | <div class="filter-bar" style="display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-bottom: 15px;"> | ||
<button class="filter-btn active" onclick="filterSelection(event, 'all')" style="padding: | <button class="filter-btn active" onclick="filterSelection(event, 'all')" style="padding: 3px 10px; border-radius: 10px; border: none; background: #16bd78; color: white; cursor: pointer; font-size: 12px;">همه</button> | ||
<button class="filter-btn" onclick="filterSelection(event, 'tech')" style="padding: | <button class="filter-btn" onclick="filterSelection(event, 'tech')" style="padding: 3px 10px; border-radius: 10px; border: none; background: #eee; cursor: pointer; font-size: 12px;">تکنولوژی</button> | ||
<button class="filter-btn" onclick="filterSelection(event, 'art')" style="padding: | <button class="filter-btn" onclick="filterSelection(event, 'art')" style="padding: 3px 10px; border-radius: 10px; border: none; background: #eee; cursor: pointer; font-size: 12px;">هنر</button> | ||
</div> | </div> | ||
<!-- شبکه کارتها --> | <!-- شبکه کارتها - تمرکز روی حداقل ارتفاع --> | ||
<div id="categoryGrid" class="category-grid"> | <div id="categoryGrid" class="category-grid"> | ||
<!-- کارت | <!-- کارت با ارتفاع بسیار کم --> | ||
<div class="category-card tech" style="background: white; padding: | <div class="category-card tech" style="background: white; height: 35px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-right: 4px solid #16bd78; overflow: hidden;"> | ||
<span class="card-title" style="font-weight: bold; color: #333; font-size: | <span class="card-title" style="font-weight: bold; color: #333; font-size: 15px; flex-grow: 1;">هوش مصنوعی</span> | ||
<span style="font-size: | <span style="font-size: 12px; color: #777; margin-right: 5px;">۱۲</span> | ||
</div> | </div> | ||
<div class="category-card art" style="background: white; height: 35px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-right: 4px solid #ff9f43; overflow: hidden;"> | |||
<div class="category-card art" style="background: white; padding: | <span class="card-title" style="font-weight: bold; color: #333; font-size: 15px; flex-grow: 1;">نقاشی</span> | ||
<span class="card-title" style="font-weight: bold; color: #333; font-size: | <span style="font-size: 12px; color: #777; margin-right: 5px;">۸</span> | ||
<span style="font-size: | |||
</div> | </div> | ||
<div class="category-card tech" style="background: white; height: 35px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-right: 4px solid #16bd78; overflow: hidden;"> | |||
<div class="category-card | <span class="card-title" style="font-weight: bold; color: #333; font-size: 15px; flex-grow: 1;">برنامهنویسی</span> | ||
<span class="card-title" style="font-weight: bold; color: #333; font-size: | <span style="font-size: 12px; color: #777; margin-right: 5px;">۲۵</span> | ||
<span style="font-size: | |||
</div> | </div> | ||
<div class="category-card science" style="background: white; height: 35px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-right: 4px solid #54a0ff; overflow: hidden;"> | |||
<div class="category-card | <span class="card-title" style="font-weight: bold; color: #333; font-size: 15px; flex-grow: 1;">فیزیک</span> | ||
<span class="card-title" style="font-weight: bold; color: #333; font-size: | <span style="font-size: 12px; color: #777; margin-right: 5px;">۵</span> | ||
<span style="font-size: | |||
</div> | </div> | ||
</div> | </div> | ||
</div> | </div> | ||
<style> | <style> | ||
.category-grid { | .category-grid { | ||
display: grid; | display: grid; | ||
grid-template-columns: repeat(4, 1fr); | grid-template-columns: repeat(4, 1fr); | ||
gap: | gap: 8px; | ||
} | } | ||
@media (max-width: 768px) { | @media (max-width: 768px) { | ||
.category-grid { | .category-grid { grid-template-columns: repeat(2, 1fr); } | ||
} | |||
.category-card { | |||
transition: all 0.2s ease; | |||
cursor: pointer; | |||
box-sizing: border-box; /* برای اینکه پدینگ ارتفاع را زیاد نکند */ | |||
} | } | ||
.category-card:hover { transform: scale(1.02); } | |||
.category-card:hover { transform: | .is-hidden { display: none !important; } | ||
. | |||
/* | /* استایل دکمهها */ | ||
. | .filter-btn.active { background: #16bd78 !important; color: white !important; } | ||
} | |||
</style> | </style> | ||
<script> | <script> | ||
function filterSelection(event, category) { | function filterSelection(event, category) { | ||
const cards = document.getElementsByClassName("category-card"); | const cards = document.getElementsByClassName("category-card"); | ||
const buttons = document.getElementsByClassName("filter-btn"); | const buttons = document.getElementsByClassName("filter-btn"); | ||
for (let btn of buttons) { btn.classList.remove("active"); btn.style.background = "#eee"; btn.style.color = "black"; } | |||
if(event) { event.currentTarget.classList.add("active"); event.currentTarget.style.background = "#16bd78"; event.currentTarget.style.color = "white"; } | |||
for (let card of cards) { | for (let card of cards) { | ||
if (category === 'all') { | if (category === 'all' || card.classList.contains(category)) { | ||
card.classList.remove("is-hidden"); | card.classList.remove("is-hidden"); | ||
} else { | } else { | ||
card.classList.add("is-hidden"); | |||
} | } | ||
} | } | ||
} | } | ||
document.getElementById('categorySearch').addEventListener('keyup', function() { | document.getElementById('categorySearch').addEventListener('keyup', function() { | ||
const | const val = this.value.toLowerCase().trim(); | ||
const cards = document.getElementsByClassName("category-card"); | const cards = document.getElementsByClassName("category-card"); | ||
for (let card of cards) { | for (let card of cards) { | ||
const | const txt = card.querySelector('.card-title').innerText.toLowerCase(); | ||
card.classList.toggle("is-hidden", !txt.includes(val)); | |||
} | } | ||
}); | }); | ||
</script> | </script> | ||
</html> | </html> | ||