From 686a1f16a7dca7927983048ea6848462c3eb0bed Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Thu, 1 Feb 2024 15:43:09 +0700 Subject: [PATCH] Re-style Divided Header, Add Image Group widget --- assets/vendor/astroid/scss/_header.scss | 7 +- framework/elements/articles/articles.php | 2 +- framework/elements/image/image.php | 1 - framework/elements/imagegroup/imagegroup.php | 147 +++++++++++++++++ framework/elements/imagegroup/imagegroup.xml | 162 +++++++++++++++++++ framework/elements/slideshow/slideshow.php | 16 +- framework/frontend/header/stacked.php | 12 +- language/en-GB/en-GB.astroid.ini | 12 +- 8 files changed, 347 insertions(+), 12 deletions(-) create mode 100644 framework/elements/imagegroup/imagegroup.php create mode 100644 framework/elements/imagegroup/imagegroup.xml diff --git a/assets/vendor/astroid/scss/_header.scss b/assets/vendor/astroid/scss/_header.scss index 39f899ea..27b065cd 100644 --- a/assets/vendor/astroid/scss/_header.scss +++ b/assets/vendor/astroid/scss/_header.scss @@ -15,7 +15,12 @@ padding: $header-padding-y $header-padding-x; z-index: 1; } - + &.astroid-stacked-divided-header:not(.astroid-header-sticky) { + padding: 0; + .as-megamenu-section { + border-top: 1px solid var(--bs-border-color); + } + } /* Stacked Header */ &.header-stacked { position: fixed; diff --git a/framework/elements/articles/articles.php b/framework/elements/articles/articles.php index 6ce81c58..9ee1e2fc 100644 --- a/framework/elements/articles/articles.php +++ b/framework/elements/articles/articles.php @@ -314,7 +314,7 @@ $wa->useScript('bootstrap.carousel'); } if ($enable_slider) { - $wa->registerAndUseStyle('astroid.slick', 'astroid/slick.css'); + $wa->registerAndUseStyle('astroid.slick', 'astroid/slick.min.css'); $wa->registerAndUseScript('astroid.slick', 'astroid/slick.min.js', ['relative' => true, 'version' => 'auto'], [], ['jquery']); echo ''; } diff --git a/framework/elements/image/image.php b/framework/elements/image/image.php index 74c0743d..5b65d70d 100644 --- a/framework/elements/image/image.php +++ b/framework/elements/image/image.php @@ -13,7 +13,6 @@ // No direct access. defined('_JEXEC') or die; extract($displayData); -use Joomla\CMS\Uri\Uri; $title = $params->get('title', ''); $image = $params->get('image', ''); $use_link = $params->get('use_link', 0); diff --git a/framework/elements/imagegroup/imagegroup.php b/framework/elements/imagegroup/imagegroup.php new file mode 100644 index 00000000..405139cc --- /dev/null +++ b/framework/elements/imagegroup/imagegroup.php @@ -0,0 +1,147 @@ +get('images', ''); +if (empty($images)) { + return false; +} +$images = json_decode($images); +if (!count($images)) { + return false; +} + +$enable_slider = $params->get('enable_slider', 0); +$slider_autoplay = $params->get('slider_autoplay', 0); +$slider_nav = $params->get('slider_nav', 1); +$slider_dotnav = $params->get('slider_dotnav', 0); +$interval = $params->get('interval', 3); +$slide_settings = array(); +$slide_responsive = array(); + +$row_column_cls = 'row'; + +$xxl_column = $params->get('xxl_column', ''); +if ($xxl_column) { + $slide_settings[]= 'slidesToShow: ' . $xxl_column; + $row_column_cls .= ' row-cols-xxl-' . $xxl_column; +} + +$xl_column = $params->get('xl_column', ''); +if ($xl_column) { + $row_column_cls .= ' row-cols-xl-' . $xl_column; + if (!count($slide_settings)) { + $slide_settings[] = 'slidesToShow: ' . $xl_column; + } else { + $slide_responsive[] = '{breakpoint: 1400,settings: {slidesToShow: ' . $xl_column.'}}'; + } +} + +$lg_column = $params->get('lg_column', 3); +if ($lg_column) { + $row_column_cls .= ' row-cols-lg-' . $lg_column; + if (!count($slide_settings)) { + $slide_settings[] = 'slidesToShow: ' . $lg_column; + } else { + $slide_responsive[] = '{breakpoint: 1200,settings: {slidesToShow: ' . $lg_column.'}}'; + } +} + +$md_column = $params->get('md_column', 1); +if ($md_column) { + $row_column_cls .= ' row-cols-md-' . $md_column; + if (!count($slide_settings)) { + $slide_settings[] = 'slidesToShow: ' . $md_column; + } else { + $slide_responsive[] = '{breakpoint: 992,settings: {slidesToShow: ' . $md_column.'}}'; + } +} + +$sm_column = $params->get('sm_column', 1); +if ($sm_column) { + $row_column_cls .= ' row-cols-sm-' . $sm_column; + if (!count($slide_settings)) { + $slide_settings[] = 'slidesToShow: ' . $sm_column; + } else { + $slide_responsive[] = '{breakpoint: 768,settings: {slidesToShow: ' . $sm_column.'}}'; + } +} + +$xs_column = $params->get('xs_column', 1); +if ($xs_column) { + $row_column_cls .= ' row-cols-' . $xs_column; + if (!count($slide_settings)) { + $slide_settings[] = 'slidesToShow: ' . $xs_column; + } else { + $slide_responsive[] = '{breakpoint: 576,settings: {slidesToShow: ' . $xs_column.'}}'; + } +} + +if ($slider_autoplay) { + $slide_settings[] = 'autoplay: true'; + $slide_settings[] = 'autoplaySpeed: '. ($interval * 1000); +} + +if ($slider_dotnav) { + $slide_settings[] = 'dots: true'; +} + +if (!$slider_nav) { + $slide_settings[] = 'arrows: false'; +} + +if (count($slide_responsive)) { + $slide_settings[] = 'responsive: ['.implode(',', $slide_responsive).']'; +} + +$row_gutter = $params->get('row_gutter', 4); +$gutter_cls = ' gx-' . $row_gutter; +$column_gutter = $params->get('column_gutter', 4); +$gutter_cls .= ' gy-' . $column_gutter; + +$border_radius = $params->get('border_radius', ''); +$border_radius = $border_radius !== '' ? ' ' . $border_radius : ''; +$box_shadow = $params->get('box_shadow', ''); +$box_shadow = $box_shadow !== '' ? ' ' . $box_shadow : ''; +$hover_effect = $params->get('hover_effect', ''); +$hover_effect = $hover_effect !== '' ? ' as-effect-' . $hover_effect : ''; +$transition = $params->get('hover_transition', ''); +$transition = $transition !== '' ? ' as-transition-' . $transition : ''; +echo '
'; +foreach ($images as $image) { + $image_params = Style::getSubFormParams($image->params); + if (!empty($image_params['image'])) { + if ($image_params['use_link']) { + echo ''; + } + echo '
'; + echo ''.$image_params['title'].''; + echo '
'; + if ($image_params['use_link']) { + echo '
'; + } + } +} +echo '
'; +if ($enable_slider) { + $mainframe = Factory::getApplication(); + $wa = $mainframe->getDocument()->getWebAssetManager(); + $wa->registerAndUseStyle('astroid.slick', 'astroid/slick.min.css'); + $wa->registerAndUseScript('astroid.slick', 'astroid/slick.min.js', ['relative' => true, 'version' => 'auto'], [], ['jquery']); + echo ''; +} \ No newline at end of file diff --git a/framework/elements/imagegroup/imagegroup.xml b/framework/elements/imagegroup/imagegroup.xml new file mode 100644 index 00000000..a270a223 --- /dev/null +++ b/framework/elements/imagegroup/imagegroup.xml @@ -0,0 +1,162 @@ + + + ASTROID_WIDGET_IMAGE_GROUP_LABEL + ASTROID_WIDGET_IMAGE_GROUP_DESC + fa-regular fa-images + Widgets +
+ +
+ + + + + + +
+ + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
diff --git a/framework/elements/slideshow/slideshow.php b/framework/elements/slideshow/slideshow.php index fabe14eb..c958596e 100644 --- a/framework/elements/slideshow/slideshow.php +++ b/framework/elements/slideshow/slideshow.php @@ -93,9 +93,8 @@ echo ''; echo '