Skip to content

Commit

Permalink
Add module block style.
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Feb 12, 2025
1 parent 65c7f02 commit 2cb0d46
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 32 deletions.
6 changes: 4 additions & 2 deletions framework/frontend/header/horizontal.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
$mode = $params->get('header_horizontal_menu_mode', 'left');
$block_1_type = $params->get('header_block_1_type', 'blank');
$block_1_position = $params->get('header_block_1_position', '');
$block_1_style = $params->get('header_block_1_style', 'none');
$block_1_custom = $params->get('header_block_1_custom', '');
$block_2_type = $params->get('header_block_2_type', 'blank');
$block_2_position = $params->get('header_block_2_position', '');
$block_2_style = $params->get('header_block_2_style', 'none');
$block_2_custom = $params->get('header_block_2_custom', '');
$header_menu_method = $params->get('header_menu_method', 'default');
$header_menu = $params->get('header_menu', 'mainmenu');
Expand Down Expand Up @@ -63,7 +65,7 @@
<?php
if ($block_2_type == 'position') {
echo '<div class="header-block-item d-flex justify-content-start align-items-center">';
echo $document->position($block_2_position, 'astroidxhtml');
echo $document->position($block_2_position, $block_2_style);
echo '</div>';
}
if ($block_2_type == 'custom') {
Expand Down Expand Up @@ -120,7 +122,7 @@
<?php
if ($block_1_type == 'position') {
echo '<div class="header-block-item d-flex justify-content-end align-items-center">';
echo $document->position($block_1_position, 'astroidxhtml');
echo $document->position($block_1_position, $block_1_style);
echo '</div>';
}
if ($block_1_type == 'custom') {
Expand Down
9 changes: 6 additions & 3 deletions framework/frontend/header/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@

$block_2_type = $params->get('header_block_2_type', 'blank');
$block_2_position = $params->get('header_block_2_position', '');
$block_2_style = $params->get('header_block_2_style', 'none');
$block_2_custom = $params->get('header_block_2_custom', '');

$block_1_type = $params->get('header_block_1_type', 'blank');
$block_1_position = $params->get('header_block_1_position', '');
$block_1_style = $params->get('header_block_1_style', 'none');
$block_1_custom = $params->get('header_block_1_custom', '');

$block_3_type = $params->get('header_block_3_type', 'blank');
$block_3_position = $params->get('header_block_3_position', '');
$block_3_style = $params->get('header_block_3_style', 'none');
$block_3_custom = $params->get('header_block_3_custom', '');

$header_menu = $params->get('header_menu', 'mainmenu');
Expand Down Expand Up @@ -83,7 +86,7 @@
<?php
if (${'block_'.$position_count.'_type'} == 'position') {
echo '<div class="header-block-item d-flex align-item-center as-gutter-lg">';
echo $document->position(${'block_'.$position_count.'_position'}, 'astroidxhtml');
echo $document->position(${'block_'.$position_count.'_position'}, ${'block_'.$position_count.'_style'});
echo '</div>';
}
if (${'block_'.$position_count.'_type'} == 'custom') {
Expand Down Expand Up @@ -123,7 +126,7 @@
<?php
if (${'block_'.$position_count.'_type'} == 'position') {
echo '<div class="header-block-item">';
echo $document->position(${'block_'.$position_count.'_position'}, 'astroidxhtml');
echo $document->position(${'block_'.$position_count.'_position'}, ${'block_'.$position_count.'_style'});
echo '</div>';
}
if (${'block_'.$position_count.'_type'} == 'custom') {
Expand All @@ -150,7 +153,7 @@
<?php
if (${'block_'.$position_count.'_type'} == 'position') {
echo '<div class="header-block-item">';
echo $document->position(${'block_'.$position_count.'_position'}, 'astroidxhtml');
echo $document->position(${'block_'.$position_count.'_position'}, ${'block_'.$position_count.'_style'});
echo '</div>';
}
if (${'block_'.$position_count.'_type'} == 'custom') {
Expand Down
23 changes: 13 additions & 10 deletions framework/frontend/header/stacked.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@
$mode = $params->get('header_stacked_menu_mode', 'center');
$block_1_type = $params->get('header_block_1_type', 'blank');
$block_1_position = $params->get('header_block_1_position', '');
$block_1_style = $params->get('header_block_1_style', 'none');
$block_1_custom = $params->get('header_block_1_custom', '');
$block_2_type = $params->get('header_block_2_type', 'blank');
$block_2_position = $params->get('header_block_2_position', '');
$block_2_style = $params->get('header_block_2_style', 'none');
$block_2_custom = $params->get('header_block_2_custom', '');
$block_3_type = $params->get('header_block_3_type', 'blank');
$block_3_position = $params->get('header_block_3_position', '');
$block_3_style = $params->get('header_block_3_style', 'none');
$block_3_custom = $params->get('header_block_3_custom', '');
$header_mobile_menu = $params->get('header_mobile_menu', '');
$header_menu = $params->get('header_menu', '');
Expand Down Expand Up @@ -101,7 +104,7 @@
if ($block_1_type == 'position') {
echo '<div class="w-100 d-none d-'.$header_breakpoint.'-flex justify-content-start align-items-center">';
echo '<div class="w-100 header-block-item d-flex justify-content-start align-items-center">';
echo $document->position($block_1_position, 'astroidxhtml');
echo $document->position($block_1_position, $block_1_style);
echo '</div>';
echo '</div>';
}
Expand All @@ -127,7 +130,7 @@
// header block 2 starts
if ($block_2_type == 'position') {
echo '<div class="header-block-item d-none d-'.$header_breakpoint.'-flex justify-content-end align-items-center">';
echo $document->position($block_2_position, 'astroidxhtml');
echo $document->position($block_2_position, $block_2_style);
echo '</div>';
}
if ($block_2_type == 'custom') {
Expand Down Expand Up @@ -210,7 +213,7 @@
// header block starts
if ($block_1_type == 'position') {
echo '<div class="w-100 header-block-item d-none d-'.$header_breakpoint.'-flex justify-content-center py-3">';
echo $document->position($block_1_position, 'astroidxhtml');
echo $document->position($block_1_position, $block_1_style);
echo '</div>';
}
if ($block_1_type == 'custom') {
Expand Down Expand Up @@ -242,7 +245,7 @@
// header block starts
if ($block_1_type == 'position') {
echo '<div class="header-block-item header-block-1 d-none d-'.$header_breakpoint.'-flex justify-content-start">';
echo $document->position($block_1_position, 'astroidxhtml');
echo $document->position($block_1_position, $block_1_style);
echo '</div>';
}
if ($block_1_type == 'custom') {
Expand All @@ -266,7 +269,7 @@
// header block starts
if ($block_2_type == 'position') {
echo '<div class="header-block-item header-block-2 d-none d-'.$header_breakpoint.'-flex justify-content-end">';
echo $document->position($block_2_position, 'astroidxhtml');
echo $document->position($block_2_position, $block_2_style);
echo '</div>';
}
if ($block_2_type == 'custom') {
Expand Down Expand Up @@ -312,7 +315,7 @@
if ($block_1_type == 'position') {
echo '<div class="d-none d-'.$header_breakpoint.'-flex w-100 flex-grow-1 justify-content-end py-2 align-items-center">';
echo '<div class="d-flex w-100 justify-content-end header-block-item align-items-center">';
echo $document->position($block_1_position, 'astroidxhtml');
echo $document->position($block_1_position, $block_1_style);
echo '</div>';
echo '</div>';
}
Expand Down Expand Up @@ -347,7 +350,7 @@
if ($block_2_type == 'position') {
echo '<div class="d-flex col-auto">';
echo '<div class="d-flex align-items-center header-block-item">';
echo $document->position($block_2_position, 'astroidxhtml');
echo $document->position($block_2_position, $block_2_style);
echo '</div>';
echo '</div>';
}
Expand Down Expand Up @@ -399,7 +402,7 @@
// header block starts
if ($block_1_type == 'position') {
echo '<div class="d-flex header-block-item justify-content-start align-items-center">';
echo $document->position($block_1_position, 'astroidxhtml');
echo $document->position($block_1_position, $block_1_style);
echo '</div>';
}
if ($block_1_type == 'custom') {
Expand All @@ -409,7 +412,7 @@
}
if ($block_2_type == 'position') {
echo '<div class="d-flex header-block-item justify-content-end align-items-center">';
echo $document->position($block_2_position, 'astroidxhtml');
echo $document->position($block_2_position, $block_2_style);
echo '</div>';
}
if ($block_2_type == 'custom') {
Expand Down Expand Up @@ -442,7 +445,7 @@
if ($block_3_type != '') {
if ($block_3_type == 'position') {
echo '<div class="d-flex header-block-item justify-content-end align-items-center">';
echo $document->position($block_3_position, 'astroidxhtml');
echo $document->position($block_3_position, $block_3_style);
echo '</div>';
}
if ($block_3_type == 'custom') {
Expand Down
3 changes: 2 additions & 1 deletion framework/frontend/header/sticky.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
$stickey_mode = $params->get('stickey_horizontal_menu_mode', 'left');
$block_1_type = $params->get('stickey_block_1_type', 'left');
$block_1_position = $params->get('stickey_block_1_position', '');
$block_1_style = $params->get('header_block_1_style', 'none');
$block_1_custom = $params->get('stickey_block_1_custom', '');
switch ($stickey_mode) {
case 'left':
Expand Down Expand Up @@ -118,7 +119,7 @@
<?php
if ($block_1_type == 'position') {
echo '<div class="header-block-item d-flex">';
echo $document->position($block_1_position, 'astroidxhtml');
echo $document->position($block_1_position, $block_1_style);
echo '</div>';
}
if ($block_1_type == 'custom') {
Expand Down
5 changes: 5 additions & 0 deletions framework/library/astroid/Component/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,14 @@ public static function colors(): void

// Menu
$main_menu_link_color = Style::getColor($params->get('main_menu_link_color', ''));
$main_menu_link_background = Style::getColor($params->get('main_menu_link_background', ''));
$main_menu_link_hover_color = Style::getColor($params->get('main_menu_link_hover_color', ''));
$main_menu_link_active_color = Style::getColor($params->get('main_menu_link_active_color', ''));
$main_menu_active_background = Style::getColor($params->get('main_menu_active_background', ''));
$main_menu_hover_background = Style::getColor($params->get('main_menu_hover_background', ''));
$navLink = new Style(['.astroid-nav .nav-link']);
$navLink->addCss('color', $main_menu_link_color['light']);
$navLink->addCss('background-color', $main_menu_link_background['light']);
$navLink->hover()->addCss('color', $main_menu_link_hover_color['light']);
$navLink->hover()->addCss('background-color', $main_menu_hover_background['light']);
$navLink->focus()->addCss('color', $main_menu_link_hover_color['light']);
Expand All @@ -481,6 +483,7 @@ public static function colors(): void

$navLink = new Style(['.astroid-nav .nav-link'], 'dark');
$navLink->addCss('color', $main_menu_link_color['dark']);
$navLink->addCss('background-color', $main_menu_link_background['dark']);
$navLink->hover()->addCss('color', $main_menu_link_hover_color['dark']);
$navLink->hover()->addCss('background-color', $main_menu_hover_background['dark']);
$navLink->focus()->addCss('color', $main_menu_link_hover_color['dark']);
Expand Down Expand Up @@ -521,6 +524,7 @@ public static function colors(): void
// Sidebar Submenu
$sidebar_menu_style = new Style('.astroid-sidebar-menu');
$sidebar_menu_style->child('.nav-item-inner > .as-menu-item')->addCss('color', $main_menu_link_color['light']);
$sidebar_menu_style->child('.nav-item-inner')->addCss('background-color', $main_menu_link_background['light']);
$sidebar_menu_style->child('.nav-item-inner > .as-menu-item')->hover()->addCss('color', $main_menu_link_hover_color['light']);
$sidebar_menu_style->child('.nav-item-inner')->hover()->child('> i')->addCss('color', $main_menu_link_hover_color['light']);
$sidebar_menu_style->child('.nav-item-inner')->hover()->addCss('background-color', $main_menu_hover_background['light']);
Expand All @@ -538,6 +542,7 @@ public static function colors(): void

$sidebar_menu_style = new Style('.astroid-sidebar-menu', 'dark');
$sidebar_menu_style->child('.nav-item-inner > .as-menu-item')->addCss('color', $main_menu_link_color['dark']);
$sidebar_menu_style->child('.nav-item-inner')->addCss('background-color', $main_menu_link_background['dark']);
$sidebar_menu_style->child('.nav-item-inner > .as-menu-item')->hover()->addCss('color', $main_menu_link_hover_color['dark']);
$sidebar_menu_style->child('.nav-item-inner')->hover()->addCss('background-color', $main_menu_hover_background['dark']);
$sidebar_menu_style->child('.nav-item-inner > .as-menu-item')->active('.active')->addCss('color', $main_menu_link_active_color['dark']);
Expand Down
16 changes: 6 additions & 10 deletions framework/options/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,12 @@
<field astroidgroup="sticky_header" name="stick_header_mobile_menu_active_icon_color" type="astroidcolor" large="true" label="TPL_ASTROID_ACTIVE_HAMBURGER_ICON_COLOR">
</field>

<field astroidgroup="main_menu" name="main_menu_link_color" type="astroidcolor" large="true" label="TPL_ASTROID_LINK_COLOR_LABEL" description="TPL_ASTROID_M_MENU_LINK_COLOR_DESC">
</field>
<field astroidgroup="main_menu" name="main_menu_link_active_color" type="astroidcolor" large="true" label="TPL_ASTROID_LINK_ACTIVE_COLOR_LABEL" description="TPL_ASTROID_M_MENU_LINK_ACTIVE_COLOR_DESC">
</field>
<field astroidgroup="main_menu" name="main_menu_link_hover_color" type="astroidcolor" large="true" label="TPL_ASTROID_LINK_HOVER_COLOR_LABEL" description="TPL_ASTROID_M_MENU_LINK_HOVER_COLOR_DESC">
</field>
<field astroidgroup="main_menu" name="main_menu_active_background" type="astroidcolor" large="true" label="TPL_ASTROID_BG_ACTIVE_COLOR_LABEL" description="TPL_ASTROID_BG_ACTIVE_COLOR_DESC">
</field>
<field astroidgroup="main_menu" name="main_menu_hover_background" type="astroidcolor" large="true" label="TPL_ASTROID_BG_COLOR_HOVER_LABEL" description="TPL_ASTROID_BG_COLOR_HOVER_DESC">
</field>
<field astroidgroup="main_menu" name="main_menu_link_color" type="astroidcolor" large="true" label="TPL_ASTROID_LINK_COLOR_LABEL" description="TPL_ASTROID_M_MENU_LINK_COLOR_DESC"/>
<field astroidgroup="main_menu" name="main_menu_link_background" type="astroidcolor" large="true" label="TPL_ASTROID_LINK_BG_COLOR_LABEL" description="TPL_ASTROID_LINK_BG_COLOR_DESC"/>
<field astroidgroup="main_menu" name="main_menu_link_hover_color" type="astroidcolor" large="true" label="TPL_ASTROID_LINK_HOVER_COLOR_LABEL" description="TPL_ASTROID_M_MENU_LINK_HOVER_COLOR_DESC"/>
<field astroidgroup="main_menu" name="main_menu_hover_background" type="astroidcolor" large="true" label="TPL_ASTROID_BG_COLOR_HOVER_LABEL" description="TPL_ASTROID_BG_COLOR_HOVER_DESC"/>
<field astroidgroup="main_menu" name="main_menu_link_active_color" type="astroidcolor" large="true" label="TPL_ASTROID_LINK_ACTIVE_COLOR_LABEL" description="TPL_ASTROID_M_MENU_LINK_ACTIVE_COLOR_DESC"/>
<field astroidgroup="main_menu" name="main_menu_active_background" type="astroidcolor" large="true" label="TPL_ASTROID_BG_ACTIVE_COLOR_LABEL" description="TPL_ASTROID_BG_ACTIVE_COLOR_DESC"/>
<field astroidgroup="dropdown_menu" name="dropdown_bg_color" type="astroidcolor" large="true" label="TPL_ASTROID_BACKGROUND_COLOR_LABEL" description="TPL_ASTROID_DROPDOWN_BACKGROUND_COLOR_DESC">
</field>
<field astroidgroup="dropdown_menu" name="dropdown_link_color" type="astroidcolor" large="true" label="TPL_ASTROID_LINK_COLOR_LABEL" description="TPL_ASTROID_DROPDOWN_LINK_COLOR_DESC">
Expand Down
Loading

0 comments on commit 2cb0d46

Please sign in to comment.