add current page highlight feature
This commit is contained in:
+61
-1
@@ -90,12 +90,26 @@ img {
|
|||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
transition: background-color 0.2s;
|
transition: background-color 0.2s;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-item:hover {
|
.nav-item:hover {
|
||||||
background-color: rgba(0, 0, 0, 0.05);
|
background-color: rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Styles pour la page active dans la sidebar */
|
||||||
|
.nav-item.active {
|
||||||
|
background-color: rgba(255, 0, 0, 0.08);
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--primary-red);
|
||||||
|
box-shadow: inset 3px 0 0 var(--primary-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item.active i {
|
||||||
|
color: var(--primary-red);
|
||||||
|
}
|
||||||
|
|
||||||
.nav-item i, .nav-item img {
|
.nav-item i, .nav-item img {
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
@@ -132,6 +146,14 @@ img {
|
|||||||
transform: translateX(5px);
|
transform: translateX(5px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Style pour un tag actif */
|
||||||
|
.tag-item.active {
|
||||||
|
background-color: rgba(255, 0, 0, 0.08);
|
||||||
|
color: var(--primary-red);
|
||||||
|
font-weight: 600;
|
||||||
|
box-shadow: inset 3px 0 0 var(--primary-red);
|
||||||
|
}
|
||||||
|
|
||||||
.tag-icon {
|
.tag-icon {
|
||||||
color: var(--primary-red);
|
color: var(--primary-red);
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
@@ -139,10 +161,48 @@ img {
|
|||||||
transition: transform 0.2s ease;
|
transition: transform 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-item:hover .tag-icon {
|
.tag-item:hover .tag-icon,
|
||||||
|
.tag-item.active .tag-icon {
|
||||||
transform: scale(1.5);
|
transform: scale(1.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Media queries pour le style actif sur les différentes tailles d'écran */
|
||||||
|
@media (max-width: 1200px) and (min-width: 1001px) {
|
||||||
|
.nav-item.active {
|
||||||
|
background-color: rgba(255, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item.active::after {
|
||||||
|
content: attr(data-title);
|
||||||
|
position: absolute;
|
||||||
|
left: 70px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background: var(--primary-red);
|
||||||
|
color: white;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
white-space: nowrap;
|
||||||
|
box-shadow: 0 1px 5px rgba(0,0,0,0.2);
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Style pour le menu mobile */
|
||||||
|
.mobile-menu .nav-item.active {
|
||||||
|
background-color: rgba(255, 0, 0, 0.08);
|
||||||
|
color: var(--primary-red);
|
||||||
|
font-weight: 600;
|
||||||
|
box-shadow: inset 3px 0 0 var(--primary-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-menu .tag-item.active {
|
||||||
|
background-color: rgba(255, 0, 0, 0.08);
|
||||||
|
color: var(--primary-red);
|
||||||
|
font-weight: 600;
|
||||||
|
box-shadow: inset 3px 0 0 var(--primary-red);
|
||||||
|
}
|
||||||
|
|
||||||
/* Header */
|
/* Header */
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -11,14 +11,15 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a href="index.php" class="nav-item">
|
<div>
|
||||||
|
<a href="index.php" class="nav-item <?php echo ($currentPage === 'index.php') ? 'active' : ''; ?>">
|
||||||
<i class="fas fa-home"></i> Accueil
|
<i class="fas fa-home"></i> Accueil
|
||||||
</a>
|
</a>
|
||||||
<a href="direct.php" class="nav-item">
|
<a href="direct.php" class="nav-item <?php echo ($currentPage === 'direct.php') ? 'active' : ''; ?>">
|
||||||
<i class="fas fa-broadcast-tower"></i> Direct
|
<i class="fas fa-broadcast-tower"></i> Direct
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="nav-divider"></div>
|
<hr class="nav-divider">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Afficher les catégories prioritaires
|
// Afficher les catégories prioritaires
|
||||||
@@ -46,32 +47,38 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach (PRIORITY_CATEGORIES as $id => $name) {
|
foreach (PRIORITY_CATEGORIES as $id => $name) {
|
||||||
|
$isActive = ($currentPage === 'categories.php' && $currentCategoryId === $id);
|
||||||
$icon = isset($categoryIcons[$id]) ? $categoryIcons[$id] : 'fas fa-folder';
|
$icon = isset($categoryIcons[$id]) ? $categoryIcons[$id] : 'fas fa-folder';
|
||||||
echo '<a href="categories.php?id=' . $id . '" class="nav-item">';
|
echo '<a href="categories.php?id=' . $id . '" class="nav-item ' . ($isActive ? 'active' : '') . '">';
|
||||||
echo '<i class="' . $icon . '"></i> ' . htmlspecialchars($name);
|
echo '<i class="' . $icon . '"></i> ' . htmlspecialchars($name);
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="nav-divider"></div>
|
<hr class="nav-divider">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
<h3 class="mobile-section-title">Hashtags populaires</h3>
|
<h3 class="mobile-section-title">Hashtags populaires</h3>
|
||||||
<?php
|
<?php
|
||||||
if (defined('IMPORTANT_TAGS') && !empty(IMPORTANT_TAGS)):
|
if (defined('IMPORTANT_TAGS') && !empty(IMPORTANT_TAGS)):
|
||||||
foreach (IMPORTANT_TAGS as $tag):
|
foreach (IMPORTANT_TAGS as $tag):
|
||||||
$encodedTag = urlencode('#' . $tag);
|
$encodedTag = urlencode('#' . $tag);
|
||||||
|
$isActive = ($isTagSearch && strtolower($currentTag) === strtolower($tag));
|
||||||
?>
|
?>
|
||||||
<a href="recherche.php?q=<?php echo $encodedTag; ?>" class="nav-item">
|
<a href="recherche.php?q=<?php echo $encodedTag; ?>" class="nav-item <?php echo $isActive ? 'active' : ''; ?>">
|
||||||
<i class="fas fa-hashtag"></i> <?php echo htmlspecialchars($tag); ?>
|
<i class="fas fa-hashtag"></i> <?php echo htmlspecialchars($tag); ?>
|
||||||
</a>
|
</a>
|
||||||
<?php
|
<?php
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="nav-divider"></div>
|
<hr class="nav-divider">
|
||||||
|
|
||||||
|
<div>
|
||||||
<h3 class="mobile-section-title">Suivez-nous</h3>
|
<h3 class="mobile-section-title">Suivez-nous</h3>
|
||||||
<div class="mobile-social-icons">
|
<div class="mobile-social-icons">
|
||||||
<a target="_blank" rel="noreferrer" href="<?php echo FACEBOOK_URL; ?>"><i class="fab fa-facebook icon-facebook"></i></a>
|
<a target="_blank" rel="noreferrer" href="<?php echo FACEBOOK_URL; ?>"><i class="fab fa-facebook icon-facebook"></i></a>
|
||||||
@@ -81,3 +88,4 @@
|
|||||||
<a target="_blank" rel="noreferrer" href="<?php echo X_URL; ?>"><i class="fab fa-x-twitter icon-x"></i></a>
|
<a target="_blank" rel="noreferrer" href="<?php echo X_URL; ?>"><i class="fab fa-x-twitter icon-x"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
+15
-4
@@ -4,11 +4,20 @@
|
|||||||
<img src="img/logo.png" alt="kaubuntu.re">
|
<img src="img/logo.png" alt="kaubuntu.re">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Détecter la page courante et ses paramètres
|
||||||
|
$currentPage = basename($_SERVER['PHP_SELF']);
|
||||||
|
$currentCategoryId = isset($_GET['id']) ? intval($_GET['id']) : null;
|
||||||
|
$currentQuery = isset($_GET['q']) ? trim($_GET['q']) : '';
|
||||||
|
$isTagSearch = !empty($currentQuery) && substr($currentQuery, 0, 1) === '#';
|
||||||
|
$currentTag = $isTagSearch ? substr($currentQuery, 1) : '';
|
||||||
|
?>
|
||||||
|
|
||||||
<nav class="sidebar-nav">
|
<nav class="sidebar-nav">
|
||||||
<a href="index.php" class="nav-item" data-title="Accueil">
|
<a href="index.php" class="nav-item <?php echo ($currentPage === 'index.php') ? 'active' : ''; ?>" data-title="Accueil">
|
||||||
<i class="fas fa-home"></i> <span>Accueil</span>
|
<i class="fas fa-home"></i> <span>Accueil</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="direct.php" class="nav-item" data-title="Direct">
|
<a href="direct.php" class="nav-item <?php echo ($currentPage === 'direct.php') ? 'active' : ''; ?>" data-title="Direct">
|
||||||
<i class="fas fa-broadcast-tower"></i> <span>Direct</span>
|
<i class="fas fa-broadcast-tower"></i> <span>Direct</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@@ -40,8 +49,9 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach (PRIORITY_CATEGORIES as $id => $name) {
|
foreach (PRIORITY_CATEGORIES as $id => $name) {
|
||||||
|
$isActive = ($currentPage === 'categories.php' && $currentCategoryId === $id);
|
||||||
$icon = isset($categoryIcons[$id]) ? $categoryIcons[$id] : 'fas fa-folder';
|
$icon = isset($categoryIcons[$id]) ? $categoryIcons[$id] : 'fas fa-folder';
|
||||||
echo '<a href="categories.php?id=' . $id . '" class="nav-item" data-title="' . htmlspecialchars($name) . '">';
|
echo '<a href="categories.php?id=' . $id . '" class="nav-item ' . ($isActive ? 'active' : '') . '" data-title="' . htmlspecialchars($name) . '">';
|
||||||
echo '<i class="' . $icon . '"></i> <span>' . htmlspecialchars($name) . '</span>';
|
echo '<i class="' . $icon . '"></i> <span>' . htmlspecialchars($name) . '</span>';
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
}
|
}
|
||||||
@@ -58,8 +68,9 @@
|
|||||||
if (defined('IMPORTANT_TAGS') && !empty(IMPORTANT_TAGS)):
|
if (defined('IMPORTANT_TAGS') && !empty(IMPORTANT_TAGS)):
|
||||||
foreach (IMPORTANT_TAGS as $tag):
|
foreach (IMPORTANT_TAGS as $tag):
|
||||||
$encodedTag = urlencode('#' . $tag);
|
$encodedTag = urlencode('#' . $tag);
|
||||||
|
$isActive = ($isTagSearch && strtolower($currentTag) === strtolower($tag));
|
||||||
?>
|
?>
|
||||||
<a href="recherche.php?q=<?php echo $encodedTag; ?>" class="tag-item" data-title="<?php echo htmlspecialchars($tag); ?>">
|
<a href="recherche.php?q=<?php echo $encodedTag; ?>" class="tag-item <?php echo $isActive ? 'active' : ''; ?>" data-title="<?php echo htmlspecialchars($tag); ?>">
|
||||||
<i class="fas fa-hashtag tag-icon"></i> <span><?php echo htmlspecialchars($tag); ?></span>
|
<i class="fas fa-hashtag tag-icon"></i> <span><?php echo htmlspecialchars($tag); ?></span>
|
||||||
</a>
|
</a>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
Reference in New Issue
Block a user