From 4358e648fdea78d3891dd3bf585ca4a190032bba Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Mon, 10 Jun 2024 11:52:31 +0700 Subject: [PATCH] Improve Navigation Widget --- framework/elements/navigation/navigation.php | 11 ++++++++++- framework/elements/navigation/navigation.xml | 16 ++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/framework/elements/navigation/navigation.php b/framework/elements/navigation/navigation.php index c395874b..dbf36b3f 100644 --- a/framework/elements/navigation/navigation.php +++ b/framework/elements/navigation/navigation.php @@ -34,16 +34,19 @@ $alignment = $alignment !== '' ? ' '. $alignment : ''; $color = Style::getColor($params->get('color', '')); $color_hover = Style::getColor($params->get('color_hover', '')); +$color_active = Style::getColor($params->get('color_active', '')); $bgcolor = Style::getColor($params->get('bgcolor', '')); $bgcolor_hover = Style::getColor($params->get('bgcolor_hover', '')); +$bgcolor_active = Style::getColor($params->get('bgcolor_active', '')); echo ''; @@ -60,11 +63,17 @@ $style_dark->child('.nav-link')->addCss('color', $color['dark']); $style->child('.nav-link')->hover()->addCss('color', $color_hover['light']); $style_dark->child('.nav-link')->hover()->addCss('color', $color_hover['dark']); +$style->child('.nav-link')->active('.active')->addCss('color', $color_active['light']); +$style_dark->child('.nav-link')->active('.active')->addCss('color', $color_active['dark']); + // Background color style $style->child('.nav-link')->addCss('background-color', $bgcolor['light']); $style_dark->child('.nav-link')->addCss('background-color', $bgcolor['dark']); $style->child('.nav-link')->hover()->addCss('background-color', $bgcolor_hover['light']); $style_dark->child('.nav-link')->hover()->addCss('background-color', $bgcolor_hover['dark']); +$style->child('.nav-link')->active('.active')->addCss('background-color', $bgcolor_active['light']); +$style_dark->child('.nav-link')->active('.active')->addCss('background-color', $bgcolor_active['dark']); + // Item Margin if (!empty($item_margin)) { $margin = \json_decode($item_margin, false); diff --git a/framework/elements/navigation/navigation.xml b/framework/elements/navigation/navigation.xml index 0e4fa47a..601730f8 100644 --- a/framework/elements/navigation/navigation.xml +++ b/framework/elements/navigation/navigation.xml @@ -19,6 +19,7 @@ + @@ -42,11 +43,18 @@ - - + + + + + + + + - - + + +