init
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<fieldset name="esun_megamenu_display" sortOrder="94">
|
||||
<settings>
|
||||
<collapsible>true</collapsible>
|
||||
<label translate="true">Mega Menu Display</label>
|
||||
</settings>
|
||||
<field name="esun_megamenu_type" sortOrder="10" formElement="select">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">category</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Mega Menu Type</label>
|
||||
<notice translate="true">Used when this category ID is configured as a Mega Menu root. Existing menus default to Product Mega Menu.</notice>
|
||||
<required>false</required>
|
||||
</settings>
|
||||
<formElements>
|
||||
<select>
|
||||
<settings>
|
||||
<options class="Esun\MegaMenu\Model\Config\Source\MegaMenuType"/>
|
||||
</settings>
|
||||
</select>
|
||||
</formElements>
|
||||
</field>
|
||||
<field name="esun_megamenu_icon" sortOrder="20" formElement="imageUploader">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">category</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<elementTmpl>ui/form/element/uploader/image</elementTmpl>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Mega Menu Icon</label>
|
||||
<notice translate="true">Used on direct child categories in the Icon Category Mega Menu.</notice>
|
||||
<required>false</required>
|
||||
</settings>
|
||||
<formElements>
|
||||
<imageUploader>
|
||||
<settings>
|
||||
<required>false</required>
|
||||
<uploaderConfig>
|
||||
<param xsi:type="url" name="url" path="catalog/category_image/upload"/>
|
||||
</uploaderConfig>
|
||||
<previewTmpl>Magento_Catalog/image-preview</previewTmpl>
|
||||
<openDialogTitle>Media Gallery</openDialogTitle>
|
||||
<initialMediaGalleryOpenSubpath>catalog/category</initialMediaGalleryOpenSubpath>
|
||||
<allowedExtensions>jpg jpeg gif png webp</allowedExtensions>
|
||||
<maxFileSize>4194304</maxFileSize>
|
||||
</settings>
|
||||
</imageUploader>
|
||||
</formElements>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="esun_megamenu_featured_product" sortOrder="95">
|
||||
<settings>
|
||||
<collapsible>true</collapsible>
|
||||
<label translate="true">Mega Menu Featured Product</label>
|
||||
</settings>
|
||||
<field name="esun_megamenu_featured_background" sortOrder="10" formElement="imageUploader">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">category</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<elementTmpl>ui/form/element/uploader/image</elementTmpl>
|
||||
<dataType>string</dataType>
|
||||
<label translate="true">Featured Background Image</label>
|
||||
<visible>true</visible>
|
||||
<required>false</required>
|
||||
</settings>
|
||||
<formElements>
|
||||
<imageUploader>
|
||||
<settings>
|
||||
<required>false</required>
|
||||
<uploaderConfig>
|
||||
<param xsi:type="url" name="url" path="catalog/category_image/upload"/>
|
||||
</uploaderConfig>
|
||||
<previewTmpl>Magento_Catalog/image-preview</previewTmpl>
|
||||
<openDialogTitle>Media Gallery</openDialogTitle>
|
||||
<initialMediaGalleryOpenSubpath>catalog/category</initialMediaGalleryOpenSubpath>
|
||||
<allowedExtensions>jpg jpeg gif png</allowedExtensions>
|
||||
<maxFileSize>4194304</maxFileSize>
|
||||
</settings>
|
||||
</imageUploader>
|
||||
</formElements>
|
||||
</field>
|
||||
<field name="esun_megamenu_featured_label" sortOrder="20" formElement="input">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">category</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Featured Label</label>
|
||||
<notice translate="true">Example: New Arrival</notice>
|
||||
<visible>true</visible>
|
||||
<required>false</required>
|
||||
</settings>
|
||||
</field>
|
||||
<field name="esun_megamenu_featured_sku" sortOrder="30" formElement="input">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">category</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Featured Product SKU</label>
|
||||
<notice translate="true">If empty or invalid, the FEATURED PRODUCT card is hidden.</notice>
|
||||
<visible>true</visible>
|
||||
<required>false</required>
|
||||
</settings>
|
||||
</field>
|
||||
<field name="esun_megamenu_redirect_url" sortOrder="40" formElement="input">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="source" xsi:type="string">category</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>text</dataType>
|
||||
<label translate="true">Redirect URL</label>
|
||||
<notice translate="true">Used by normal top-level menu categories and Icon Category Mega Menu items. Enter a CMS page URL key/store path or a complete http/https URL. Mega Menu Root categories ignore this value.</notice>
|
||||
<visible>true</visible>
|
||||
<required>false</required>
|
||||
<validation>
|
||||
<rule name="validate-no-html-tags" xsi:type="boolean">true</rule>
|
||||
</validation>
|
||||
</settings>
|
||||
</field>
|
||||
</fieldset>
|
||||
</form>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<move element="logo"
|
||||
destination="header-wrapper"
|
||||
before="-"/>
|
||||
<move element="navigation.sections"
|
||||
destination="header-wrapper"
|
||||
after="logo"/>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceBlock name="navigation.sections">
|
||||
<block class="Magento\Framework\View\Element\Template"
|
||||
name="store.menu"
|
||||
group="navigation-sections"
|
||||
template="Magento_Theme::html/container.phtml">
|
||||
<arguments>
|
||||
<argument name="title" translate="true" xsi:type="string">Menu</argument>
|
||||
</arguments>
|
||||
<block class="Magento\Theme\Block\Html\Topmenu"
|
||||
name="catalog.topnav"
|
||||
template="Esun_MegaMenu::html/topmenu.phtml"
|
||||
ttl="3600"
|
||||
before="-">
|
||||
<arguments>
|
||||
<argument name="view_model" xsi:type="object">Esun\MegaMenu\ViewModel\MegaMenuData</argument>
|
||||
</arguments>
|
||||
</block>
|
||||
</block>
|
||||
</referenceBlock>
|
||||
<move element="logo"
|
||||
destination="header-wrapper"
|
||||
before="-"/>
|
||||
<move element="navigation.sections"
|
||||
destination="header-wrapper"
|
||||
after="logo"/>
|
||||
</body>
|
||||
</page>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceBlock name="catalog.topnav">
|
||||
<arguments>
|
||||
<argument name="view_model" xsi:type="object">Esun\MegaMenu\ViewModel\MegaMenuData</argument>
|
||||
</arguments>
|
||||
<action method="setTemplate">
|
||||
<argument name="template" xsi:type="string">Esun_MegaMenu::html/topmenu.phtml</argument>
|
||||
</action>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* Icon category mega menu. Kept separate from the existing product mega menu.
|
||||
*
|
||||
* @var \Magento\Framework\View\Element\Template $block
|
||||
* @var \Magento\Framework\Escaper $escaper
|
||||
*/
|
||||
$rootCategoryId = (int)$block->getData('root_category_id');
|
||||
$label = (string)$block->getData('menu_label');
|
||||
$class = (string)$block->getData('menu_class');
|
||||
$menuUrl = (string)$block->getData('menu_url');
|
||||
$description = trim((string)$block->getData('menu_description'));
|
||||
$menuItems = (array)$block->getData('menu_items');
|
||||
$hasImages = false;
|
||||
$hasDescription = $description !== '';
|
||||
|
||||
foreach ($menuItems as $menuItem) {
|
||||
if (!empty($menuItem['icon_url'])) {
|
||||
$hasImages = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$layoutClass = $hasImages
|
||||
? 'esun-icon-megamenu--visual'
|
||||
: 'esun-icon-megamenu--text-only';
|
||||
$parentClass = $hasImages ? 'parent ' : '';
|
||||
$linkedMenuClass = !$hasImages ? 'esun-linked-megamenu-trigger' : '';
|
||||
$descriptionClass = $hasDescription ? 'has-description' : 'no-description';
|
||||
$textDividerIndex = !$hasImages && count($menuItems) > 1
|
||||
? (int)ceil(count($menuItems) / 2)
|
||||
: -1;
|
||||
?>
|
||||
<li class="<?= $escaper->escapeHtmlAttr(trim('level0 level-top ' . $parentClass . 'category-item esun-megamenu-trigger esun-icon-megamenu-trigger ' . $linkedMenuClass . ' ' . $class)) ?>"
|
||||
data-category="<?= $rootCategoryId ?>">
|
||||
<a href="<?= !$hasImages ? $escaper->escapeUrl($menuUrl) : 'javascript:void(0)' ?>"
|
||||
class="level-top"
|
||||
aria-haspopup="true">
|
||||
<span><?= $escaper->escapeHtml($label) ?></span>
|
||||
</a>
|
||||
<?php if (!$hasImages): ?>
|
||||
<button class="esun-megamenu-toggle"
|
||||
type="button"
|
||||
aria-label="<?= $escaper->escapeHtmlAttr(__('Toggle %1 submenu', $label)) ?>"
|
||||
aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="esun-megamenu-wrapper esun-icon-megamenu-wrapper <?= $escaper->escapeHtmlAttr($layoutClass . ' ' . $descriptionClass) ?>">
|
||||
<div class="esun-icon-megamenu-inner">
|
||||
<?php if ($hasImages && $hasDescription): ?>
|
||||
<aside class="esun-icon-megamenu-intro">
|
||||
<div class="esun-icon-megamenu-intro-content">
|
||||
<?= /* @noEscape */ $description ?>
|
||||
</div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="esun-icon-megamenu-items">
|
||||
<?php foreach ($menuItems as $itemIndex => $item): ?>
|
||||
<?php $hasItemImage = !empty($item['icon_url']); ?>
|
||||
<?php $hasChildren = !empty($item['children']); ?>
|
||||
<?php $dividerClass = (int)$itemIndex === $textDividerIndex ? 'is-second-half-start' : ''; ?>
|
||||
<section class="esun-icon-megamenu-column <?= $hasItemImage ? 'has-image' : 'no-image' ?> <?= $dividerClass ?>">
|
||||
<?php if ($hasItemImage): ?>
|
||||
<?php if (!$hasChildren): ?>
|
||||
<a class="esun-icon-megamenu-image-wrap"
|
||||
href="<?= $escaper->escapeUrl((string)$item['url']) ?>">
|
||||
<?php else: ?>
|
||||
<div class="esun-icon-megamenu-image-wrap">
|
||||
<?php endif; ?>
|
||||
<img class="esun-icon-megamenu-image"
|
||||
src="<?= $escaper->escapeUrl((string)$item['icon_url']) ?>"
|
||||
alt="<?= $escaper->escapeHtmlAttr((string)$item['name']) ?>"
|
||||
loading="lazy"/>
|
||||
<span class="esun-icon-megamenu-image-title">
|
||||
<?= $escaper->escapeHtml((string)$item['name']) ?>
|
||||
</span>
|
||||
<?php if (!$hasChildren): ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<div class="esun-icon-megamenu-content">
|
||||
<?php if (!$hasItemImage): ?>
|
||||
<?php if (!$hasChildren): ?>
|
||||
<a class="esun-icon-megamenu-title"
|
||||
href="<?= $escaper->escapeUrl((string)$item['url']) ?>">
|
||||
<?= $escaper->escapeHtml((string)$item['name']) ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<span class="esun-icon-megamenu-title">
|
||||
<?= $escaper->escapeHtml((string)$item['name']) ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($hasChildren): ?>
|
||||
<ul class="esun-icon-megamenu-links">
|
||||
<?php foreach ((array)$item['children'] as $child): ?>
|
||||
<li>
|
||||
<a href="<?= $escaper->escapeUrl((string)$child['url']) ?>">
|
||||
<?= $escaper->escapeHtml((string)$child['name']) ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/**
|
||||
* Magento top menu with an Esun classification mega menu attached to one level-0 node.
|
||||
*
|
||||
* @var \Magento\Theme\Block\Html\Topmenu $block
|
||||
* @var \Magento\Framework\Escaper $escaper
|
||||
* @var \Esun\MegaMenu\ViewModel\MegaMenuData|null $viewModel
|
||||
*/
|
||||
$viewModel = $block->getData('view_model');
|
||||
|
||||
if (!$viewModel || !$viewModel->isEnabled()) {
|
||||
$columnsLimit = $block->getColumnsLimit() ?: 0;
|
||||
$_menuHtml = $block->getHtml('level-top', 'submenu', $columnsLimit);
|
||||
?>
|
||||
<nav class="navigation" data-action="navigation">
|
||||
<ul data-mage-init='{"menu":{"responsive":true, "expanded":true, "position":{"my":"left top","at":"left bottom"}}}'>
|
||||
<?= /* @noEscape */ $_menuHtml ?>
|
||||
<?= $block->getChildHtml() ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
|
||||
$columnsLimit = $block->getColumnsLimit() ?: 0;
|
||||
$block->getHtml('level-top', 'submenu', $columnsLimit);
|
||||
$rootCategoryIds = $viewModel->getRootCategoryIds();
|
||||
$legacyRootCategoryId = $viewModel->getRootCategoryId();
|
||||
$targetTitle = strtoupper(trim($viewModel->getTitle()));
|
||||
$baseScopeName = 'esunMegaMenu_' . preg_replace('/[^A-Za-z0-9_]/', '_', (string)$block->getNameInLayout());
|
||||
$renderedRootCategoryIds = [];
|
||||
$componentConfigs = [];
|
||||
|
||||
$getNodeCategoryId = function ($node): int {
|
||||
if (preg_match('/^category-node-(\d+)$/', (string)$node->getId(), $matches)) {
|
||||
return (int)$matches[1];
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
$renderDefaultNode = function ($node) use (
|
||||
$escaper,
|
||||
$getNodeCategoryId,
|
||||
$viewModel
|
||||
): string {
|
||||
$categoryId = $getNodeCategoryId($node);
|
||||
$nodeUrl = $categoryId
|
||||
? $viewModel->getTopLevelCategoryUrl($categoryId, (string)$node->getUrl())
|
||||
: (string)$node->getUrl();
|
||||
$classes = array_filter([
|
||||
'level0',
|
||||
(string)$node->getPositionClass(),
|
||||
(string)$node->getClass(),
|
||||
'level-top',
|
||||
$node->getIsActive() ? 'active' : ''
|
||||
]);
|
||||
|
||||
$html = '<li class="' . $escaper->escapeHtmlAttr(implode(' ', $classes)) . '">';
|
||||
$html .= '<a href="' . $escaper->escapeUrl($nodeUrl) . '" class="level-top">';
|
||||
$html .= '<span>' . $escaper->escapeHtml($node->getName()) . '</span></a>';
|
||||
$html .= '</li>';
|
||||
|
||||
return $html;
|
||||
};
|
||||
|
||||
$getMegaNodeRootCategoryId = function ($node) use (
|
||||
$viewModel,
|
||||
$getNodeCategoryId,
|
||||
$legacyRootCategoryId,
|
||||
$targetTitle
|
||||
): int {
|
||||
$categoryId = $getNodeCategoryId($node);
|
||||
|
||||
if ($categoryId && $viewModel->isMegaMenuRootCategory($categoryId)) {
|
||||
return $categoryId;
|
||||
}
|
||||
|
||||
if ($legacyRootCategoryId && strtoupper(trim((string)$node->getName())) === $targetTitle) {
|
||||
return $legacyRootCategoryId;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
$renderMegaNode = function (int $rootCategoryId, string $label, string $class = '') use (
|
||||
$block,
|
||||
$escaper,
|
||||
$viewModel,
|
||||
$baseScopeName,
|
||||
&$componentConfigs
|
||||
): string {
|
||||
if ($viewModel->isIconCategoryMenu($rootCategoryId)) {
|
||||
return $block->getLayout()
|
||||
->createBlock(\Magento\Framework\View\Element\Template::class)
|
||||
->setTemplate('Esun_MegaMenu::html/icon-category-menu.phtml')
|
||||
->setData('root_category_id', $rootCategoryId)
|
||||
->setData('menu_label', $label)
|
||||
->setData('menu_class', $class)
|
||||
->setData('menu_url', $viewModel->getRootCategoryUrl($rootCategoryId))
|
||||
->setData('menu_description', $viewModel->getRootCategoryDescription($rootCategoryId))
|
||||
->setData('menu_items', $viewModel->getIconCategoryMenuData($rootCategoryId))
|
||||
->toHtml();
|
||||
}
|
||||
|
||||
$scopeName = $baseScopeName . '_' . $rootCategoryId;
|
||||
$featuredProduct = $viewModel->getFeaturedProductData($rootCategoryId);
|
||||
$componentConfigs[$scopeName] = [
|
||||
'component' => 'Esun_MegaMenu/js/mega-menu',
|
||||
'config' => [
|
||||
'rawMenuData' => $viewModel->getMegaMenuData($rootCategoryId)
|
||||
]
|
||||
];
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<li class="<?= $escaper->escapeHtmlAttr(trim('level0 level-top parent category-item esun-megamenu-trigger ' . $class)) ?>" data-category="<?= $rootCategoryId ?>"
|
||||
data-bind="scope: '<?= $escaper->escapeHtmlAttr($scopeName) ?>'">
|
||||
<a href="javascript:void(0)" class="level-top" aria-haspopup="true">
|
||||
<span><?= $escaper->escapeHtml($label) ?></span>
|
||||
</a>
|
||||
|
||||
<div class="esun-megamenu-wrapper">
|
||||
<div class="esun-megamenu-inner">
|
||||
<div class="esun-megamenu-sidebar">
|
||||
<div class="esun-filament-categories" data-bind="foreach: menuData">
|
||||
<div class="esun-filament-category" data-bind="
|
||||
css: { active: $parent.currentSecondaryId() === id },
|
||||
event: { click: $parent.switchSecondaryCategory.bind($parent), mouseenter: $parent.switchSecondaryCategory.bind($parent), focusin: $parent.switchSecondaryCategory.bind($parent) }
|
||||
">
|
||||
<span class="esun-filament-category-label">
|
||||
<span data-bind="text: name"></span>
|
||||
<span class="esun-megamenu-arrow" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($featuredProduct): ?>
|
||||
<div class="esun-featured-product-block">
|
||||
<div class="esun-featured-title"><?= $escaper->escapeHtml(__('FEATURED PRODUCT')) ?></div>
|
||||
<?php $backgroundUrl = (string)$featuredProduct['category_background_url']; ?>
|
||||
<div class="esun-megamenu-featured-card"
|
||||
<?php if ($backgroundUrl): ?>
|
||||
style="background-image: linear-gradient(90deg, rgba(20, 33, 44, 0.48), rgba(20, 33, 44, 0.06)), url('<?= $escaper->escapeUrl($backgroundUrl) ?>');"
|
||||
<?php endif; ?>>
|
||||
<span class="esun-megamenu-featured-kicker">
|
||||
<?= $escaper->escapeHtml($featuredProduct['label']) ?>
|
||||
</span>
|
||||
<span class="esun-megamenu-featured-name">
|
||||
<?= $escaper->escapeHtml($featuredProduct['name']) ?>
|
||||
</span>
|
||||
<a class="esun-megamenu-featured-link"
|
||||
href="<?= $escaper->escapeUrl($featuredProduct['url']) ?>">
|
||||
<?= $escaper->escapeHtml(__('Explore Product')) ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="esun-megamenu-content" data-bind="with: activeSecondaryCategory">
|
||||
<!-- ko if: seriesCategories && seriesCategories.length -->
|
||||
<div class="esun-series-container" data-bind="foreach: seriesCategories">
|
||||
<section class="esun-series-group">
|
||||
<header class="esun-series-header">
|
||||
<h4 data-bind="text: name"></h4>
|
||||
<a data-bind="attr: { href: url }" class="esun-view-all">
|
||||
<?= $escaper->escapeHtml(__('View All')) ?> >
|
||||
</a>
|
||||
</header>
|
||||
|
||||
<!-- ko if: products && products.length -->
|
||||
<div class="esun-products-grid" data-bind="foreach: products">
|
||||
<article class="esun-product-card">
|
||||
<a data-bind="attr: { href: url, title: name }" class="esun-product-link">
|
||||
<span class="esun-product-image-frame">
|
||||
<img data-bind="attr: { src: image_url, alt: name }" class="esun-product-image" loading="lazy"/>
|
||||
</span>
|
||||
<span class="esun-product-name" data-bind="text: name"></span>
|
||||
<span class="esun-product-price" data-bind="text: price"></span>
|
||||
</a>
|
||||
</article>
|
||||
</div>
|
||||
<!-- /ko -->
|
||||
</section>
|
||||
</div>
|
||||
<!-- /ko -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
|
||||
return ob_get_clean();
|
||||
};
|
||||
|
||||
?>
|
||||
|
||||
<nav class="navigation esun-main-navigation"
|
||||
data-action="navigation"
|
||||
data-mage-init='{"Esun_MegaMenu/js/mobile-menu":{}}'>
|
||||
<ul data-mage-init='{"menu":{"responsive":true, "expanded":true, "position":{"my":"left top","at":"left bottom"}}}'>
|
||||
<?php foreach ($block->getMenu()->getChildren() as $node): ?>
|
||||
<?php $megaRootCategoryId = $getMegaNodeRootCategoryId($node); ?>
|
||||
<?php if ($megaRootCategoryId): ?>
|
||||
<?php $renderedRootCategoryIds[$megaRootCategoryId] = $megaRootCategoryId; ?>
|
||||
<?= /* @noEscape */ $renderMegaNode(
|
||||
$megaRootCategoryId,
|
||||
(string)$node->getName(),
|
||||
trim((string)$node->getPositionClass() . ' ' . (string)$node->getClass())
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= /* @noEscape */ $renderDefaultNode($node) ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($rootCategoryIds as $rootCategoryId): ?>
|
||||
<?php if (isset($renderedRootCategoryIds[$rootCategoryId])): ?>
|
||||
<?php continue; ?>
|
||||
<?php endif; ?>
|
||||
<?= /* @noEscape */ $renderMegaNode(
|
||||
(int)$rootCategoryId,
|
||||
$rootCategoryId === $legacyRootCategoryId ? $viewModel->getTitle() : $viewModel->getRootCategoryName((int)$rootCategoryId)
|
||||
) ?>
|
||||
<?php endforeach; ?>
|
||||
<?= $block->getChildHtml() ?>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<?php if ($componentConfigs): ?>
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
"*": {
|
||||
"Magento_Ui/js/core/app": {
|
||||
"components": <?= /* @noEscape */ json_encode($componentConfigs, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP) ?>
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,288 @@
|
||||
.esun-icon-megamenu-wrapper {
|
||||
border-radius: 0 0 36px 36px;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-inner {
|
||||
box-sizing: border-box;
|
||||
margin: 0 auto;
|
||||
padding: 20px 7.5% 30px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-items {
|
||||
display: grid;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-column {
|
||||
box-sizing: border-box;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-content {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-title {
|
||||
color: #111111;
|
||||
display: block;
|
||||
font-size: 24px;
|
||||
font-weight: 500;
|
||||
line-height: 1.25;
|
||||
margin: 0 0 18px;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
color: @esun-megamenu-green;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-links {
|
||||
background: transparent !important;
|
||||
border: 0 !important;
|
||||
box-shadow: none !important;
|
||||
display: block !important;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
min-width: 0 !important;
|
||||
opacity: 1 !important;
|
||||
padding: 0;
|
||||
position: static !important;
|
||||
transform: none !important;
|
||||
visibility: visible !important;
|
||||
width: auto !important;
|
||||
|
||||
li {
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #171717;
|
||||
display: inline-block;
|
||||
font-size: 19px;
|
||||
font-weight: 400;
|
||||
line-height: 1.35;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
color: @esun-megamenu-green;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Image mode: four equal cards by default; Description reserves the first quarter.
|
||||
.esun-icon-megamenu-wrapper.esun-icon-megamenu--visual {
|
||||
.esun-icon-megamenu-inner {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-intro-content {
|
||||
color: #171717;
|
||||
font-size: 19px;
|
||||
line-height: 1.5;
|
||||
max-width: 410px;
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
[data-content-type] {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-items {
|
||||
display: grid !important;
|
||||
gap: 42px 30px !important;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
|
||||
min-width: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-column {
|
||||
display: block !important;
|
||||
float: none !important;
|
||||
margin: 0 !important;
|
||||
max-width: none !important;
|
||||
min-width: 0 !important;
|
||||
padding: 0 !important;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-image-wrap {
|
||||
aspect-ratio: 2.35 / 1 !important;
|
||||
border-radius: 20px !important;
|
||||
display: block !important;
|
||||
flex: none !important;
|
||||
height: auto !important;
|
||||
overflow: hidden !important;
|
||||
position: relative !important;
|
||||
width: 100% !important;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-image {
|
||||
display: block !important;
|
||||
height: 100% !important;
|
||||
max-width: none !important;
|
||||
object-fit: cover !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-image-wrap::after {
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
rgba(0, 0, 0, 0.42),
|
||||
rgba(0, 0, 0, 0.03) 72%
|
||||
);
|
||||
content: "";
|
||||
inset: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-image-title {
|
||||
color: #ffffff;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
left: 24px;
|
||||
line-height: 1.25;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-content {
|
||||
display: block !important;
|
||||
padding: 24px 24px 0 !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-column.no-image {
|
||||
padding-top: 16px !important;
|
||||
}
|
||||
|
||||
&.has-description {
|
||||
.esun-icon-megamenu-inner {
|
||||
display: grid !important;
|
||||
gap: 64px !important;
|
||||
grid-template-columns: minmax(260px, 1fr) minmax(0, 3fr) !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-items {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No-image mode: every second-level category receives an equal share.
|
||||
.esun-icon-megamenu--text-only {
|
||||
.esun-icon-megamenu-inner {
|
||||
padding-bottom: 82px;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-items {
|
||||
display: flex;
|
||||
gap: 40px 0;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-column {
|
||||
flex: 1 1 0;
|
||||
padding: 0 38px;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-column:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1399px) {
|
||||
.esun-icon-megamenu-inner {
|
||||
padding-left: 48px;
|
||||
padding-right: 48px;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-wrapper.esun-icon-megamenu--visual.has-description
|
||||
.esun-icon-megamenu-inner {
|
||||
gap: 40px !important;
|
||||
grid-template-columns: minmax(220px, 1fr) minmax(0, 3fr) !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.esun-icon-megamenu-wrapper.esun-icon-megamenu--visual {
|
||||
.esun-icon-megamenu-inner {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-intro {
|
||||
margin-bottom: 34px;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-items {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.esun-icon-megamenu-wrapper.esun-icon-megamenu--visual.has-description
|
||||
.esun-icon-megamenu-inner {
|
||||
display: block !important;
|
||||
}
|
||||
.esun-icon-megamenu-wrapper {
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-inner {
|
||||
display: block !important;
|
||||
padding: 18px 20px !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-intro {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-items {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-column,
|
||||
.esun-icon-megamenu--text-only .esun-icon-megamenu-column {
|
||||
border: 0 !important;
|
||||
margin: 0 0 22px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-wrapper.esun-icon-megamenu--visual {
|
||||
.esun-icon-megamenu-image-wrap {
|
||||
border-radius: 12px !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-content {
|
||||
padding: 14px 8px 0 !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-column {
|
||||
margin-bottom: 22px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-title {
|
||||
font-size: 18px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-links a {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,637 @@
|
||||
@esun-megamenu-green: #30a957;
|
||||
@esun-megamenu-text: #333333;
|
||||
@esun-megamenu-muted: #999;
|
||||
@esun-megamenu-border: #edf0f2;
|
||||
|
||||
@import "_icon-category-menu.less";
|
||||
|
||||
.page-header {
|
||||
position: relative;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.esun-main-navigation {
|
||||
position: static;
|
||||
|
||||
> ul {
|
||||
position: static;
|
||||
}
|
||||
|
||||
.level0.esun-megamenu-trigger {
|
||||
cursor: pointer;
|
||||
position: static !important;
|
||||
|
||||
> .level-top {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus-within {
|
||||
> .esun-megamenu-wrapper {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.esun-megamenu-wrapper {
|
||||
background: #ffffff;
|
||||
box-sizing: border-box;
|
||||
display: none;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
top: 99%;
|
||||
width: 100%;
|
||||
z-index: 999;
|
||||
box-shadow: 0 0 36px rgba(26, 137, 82, 0.38);
|
||||
}
|
||||
|
||||
.esun-main-navigation .esun-megamenu-toggle,
|
||||
.esun-main-navigation .esun-megamenu-toggle:hover,
|
||||
.esun-main-navigation .esun-megamenu-toggle:focus,
|
||||
.esun-main-navigation .esun-megamenu-toggle:active {
|
||||
appearance: none;
|
||||
background: transparent !important;
|
||||
background-image: none !important;
|
||||
border: 0 !important;
|
||||
border-radius: 0;
|
||||
box-shadow: none !important;
|
||||
display: none;
|
||||
min-width: 0;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.esun-megamenu-inner {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
margin: 0 auto;
|
||||
max-width: 1360px;
|
||||
min-height: 520px;
|
||||
overflow-y: auto;
|
||||
padding: 20px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.esun-megamenu-sidebar {
|
||||
width: 26%;
|
||||
}
|
||||
|
||||
.esun-filament-categories {
|
||||
display: block;
|
||||
margin: 0 0 34px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.esun-filament-category {
|
||||
background: #f3f3f3;
|
||||
border-radius: 12px;
|
||||
box-sizing: border-box;
|
||||
color: @esun-megamenu-text;
|
||||
cursor: pointer;
|
||||
margin: 0 0 10px;
|
||||
min-height: 50px;
|
||||
transition:
|
||||
background-color 160ms ease,
|
||||
color 160ms ease;
|
||||
width: 100%;
|
||||
|
||||
> .esun-filament-category-label {
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
color: inherit;
|
||||
display: flex;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
justify-content: space-between;
|
||||
line-height: 1.25;
|
||||
min-height: 50px;
|
||||
padding: 10px 20px;
|
||||
text-decoration: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.active,
|
||||
&:hover {
|
||||
background: @esun-megamenu-green;
|
||||
color: #ffffff;
|
||||
.esun-megamenu-arrow {
|
||||
border-bottom: 2px solid #fff;
|
||||
border-right: 2px solid #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.esun-megamenu-arrow {
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
border-bottom: 2px solid #939393;
|
||||
border-right: 2px solid #939393;
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
|
||||
.esun-featured-product-block {
|
||||
.esun-featured-title {
|
||||
color: @esun-megamenu-green;
|
||||
font-size: 14px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 1px;
|
||||
line-height: 1.2;
|
||||
margin: 0 0 18px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-megamenu-featured-card {
|
||||
background: linear-gradient(135deg, #dfeee8 0%, #f4f4f4 52%, #d6d7ff 100%);
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
border-radius: 8px;
|
||||
box-sizing: border-box;
|
||||
color: #ffffff;
|
||||
display: block;
|
||||
min-height: 174px;
|
||||
overflow: hidden;
|
||||
padding: 42px 30px 26px;
|
||||
text-decoration: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.esun-megamenu-featured-kicker {
|
||||
color: #ffffff;
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 4px;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 10px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.esun-megamenu-featured-name {
|
||||
color: #ffffff;
|
||||
display: block;
|
||||
font-size: 23px;
|
||||
font-weight: 800;
|
||||
line-height: 1.1;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.esun-megamenu-featured-link {
|
||||
background: @esun-megamenu-green;
|
||||
border-radius: 18px;
|
||||
color: #ffffff;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
line-height: 1;
|
||||
padding: 11px 16px;
|
||||
text-decoration: none;
|
||||
width: fit-content;
|
||||
|
||||
&:hover {
|
||||
background: #258e49;
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-megamenu-content {
|
||||
width: 70%;
|
||||
}
|
||||
.ui-state-active .esun-megamenu-content {
|
||||
overflow-y: scroll;
|
||||
max-height: calc(100dvh - 104px);
|
||||
}
|
||||
.esun-series-group {
|
||||
margin: 0 0 42px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-series-header {
|
||||
align-items: baseline;
|
||||
border-bottom: 1px solid @esun-megamenu-border;
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
justify-content: space-between;
|
||||
margin: 0 0 22px;
|
||||
padding: 0 0 18px;
|
||||
|
||||
h4 {
|
||||
color: @esun-megamenu-green;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-view-all {
|
||||
color: @esun-megamenu-text;
|
||||
flex: 0 0 auto;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
color: @esun-megamenu-green;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-products-grid {
|
||||
display: grid;
|
||||
gap: 26px 24px;
|
||||
grid-template-columns: repeat(6, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.esun-product-card {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.esun-product-link {
|
||||
color: @esun-megamenu-text;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
color: @esun-megamenu-green;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-product-image-frame {
|
||||
align-items: center;
|
||||
aspect-ratio: 1 / 1;
|
||||
background: #fbfbfb;
|
||||
border: 1px solid @esun-megamenu-border;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 0 0 10px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.esun-product-image {
|
||||
display: block;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
max-width: 100%;
|
||||
object-fit: cover;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.esun-product-name,
|
||||
.esun-product-price {
|
||||
display: block;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.esun-product-name {
|
||||
color: @esun-megamenu-text;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.esun-product-price {
|
||||
color: @esun-megamenu-muted;
|
||||
font-size: 15px;
|
||||
margin-top: 2px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@media (max-width: 1199px) {
|
||||
.esun-megamenu-inner {
|
||||
gap: 30px;
|
||||
grid-template-columns: 280px minmax(0, 1fr);
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
}
|
||||
|
||||
.esun-products-grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.esun-main-navigation .level0.esun-megamenu-trigger {
|
||||
> .level-top:after,
|
||||
> .level-top.ui-state-active:after {
|
||||
content: "\e622";
|
||||
}
|
||||
}
|
||||
|
||||
.esun-main-navigation .level0.esun-linked-megamenu-trigger {
|
||||
position: relative !important;
|
||||
|
||||
> .level-top {
|
||||
padding-right: 64px;
|
||||
}
|
||||
|
||||
> .level-top:after,
|
||||
> .level-top.ui-state-active:after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
> .esun-megamenu-toggle {
|
||||
align-items: center;
|
||||
color: #ffffff !important;
|
||||
display: flex;
|
||||
font-size: 0;
|
||||
height: 64px;
|
||||
justify-content: center;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 64px;
|
||||
z-index: 2;
|
||||
|
||||
> span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .esun-megamenu-toggle:after {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
color: inherit;
|
||||
content: "\e622";
|
||||
display: inline-block;
|
||||
font-family: "icons-blank-theme";
|
||||
font-size: 42px;
|
||||
font-weight: normal;
|
||||
line-height: inherit;
|
||||
overflow: hidden;
|
||||
speak: none;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
&.is-open > .esun-megamenu-toggle:after {
|
||||
content: "\e621";
|
||||
}
|
||||
}
|
||||
.page-header .navigation li.level0:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
.esun-megamenu-wrapper {
|
||||
box-shadow: none;
|
||||
left: auto;
|
||||
position: static;
|
||||
transform: none;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.esun-main-navigation
|
||||
.level0.esun-megamenu-trigger:hover
|
||||
> .esun-megamenu-wrapper,
|
||||
.esun-main-navigation
|
||||
.level0.esun-megamenu-trigger:focus-within
|
||||
> .esun-megamenu-wrapper {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.esun-main-navigation .level0.esun-megamenu-trigger.is-open {
|
||||
> .level-top:after,
|
||||
> .level-top.ui-state-active:after {
|
||||
content: "\e621";
|
||||
}
|
||||
|
||||
> .esun-megamenu-wrapper {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-main-navigation {
|
||||
.esun-megamenu-wrapper {
|
||||
background: #f7f8f7;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.35);
|
||||
}
|
||||
|
||||
.esun-megamenu-inner,
|
||||
.esun-icon-megamenu-inner {
|
||||
display: block !important;
|
||||
max-height: calc(100vh - 170px);
|
||||
max-height: calc(100dvh - 170px);
|
||||
min-height: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
padding: 16px !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.esun-megamenu-sidebar,
|
||||
.esun-megamenu-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.esun-filament-categories {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin: 0 -16px 4px;
|
||||
overflow-x: auto;
|
||||
padding: 0 16px 4px;
|
||||
scrollbar-width: none;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-filament-category {
|
||||
border: 1px solid #e2e7e3;
|
||||
border-radius: 999px;
|
||||
flex: 0 0 auto;
|
||||
margin: 0;
|
||||
min-height: 40px;
|
||||
width: auto;
|
||||
|
||||
> .esun-filament-category-label {
|
||||
font-size: 14px;
|
||||
min-height: 38px;
|
||||
padding: 8px 15px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.esun-megamenu-arrow {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-featured-product-block {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.esun-megamenu-content,
|
||||
.ui-state-active .esun-megamenu-content {
|
||||
max-height: none;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.esun-series-group {
|
||||
margin-bottom: 26px;
|
||||
}
|
||||
|
||||
.esun-series-header {
|
||||
gap: 12px;
|
||||
margin-bottom: 0px;
|
||||
padding-bottom: 10px;
|
||||
|
||||
h4 {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-view-all {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.esun-products-grid {
|
||||
gap: 12px;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.esun-product-image-frame {
|
||||
border-radius: 7px;
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
.esun-product-name {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.esun-product-price {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-wrapper {
|
||||
border-radius: 0;
|
||||
|
||||
.esun-icon-megamenu-intro {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.esun-icon-megamenu--visual .esun-icon-megamenu-inner {
|
||||
display: block !important;
|
||||
gap: 0 !important;
|
||||
grid-template-columns: none !important;
|
||||
}
|
||||
|
||||
&.esun-icon-megamenu--visual .esun-icon-megamenu-items {
|
||||
align-items: start;
|
||||
display: grid !important;
|
||||
gap: 18px 12px !important;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
|
||||
}
|
||||
|
||||
&.esun-icon-megamenu--visual .esun-icon-megamenu-column {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-column,
|
||||
.esun-icon-megamenu--text-only .esun-icon-megamenu-column {
|
||||
border: 0 !important;
|
||||
margin: 0 !important;
|
||||
min-width: 0;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-image-wrap {
|
||||
aspect-ratio: 1.65 / 1 !important;
|
||||
border-radius: 10px !important;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-image-title {
|
||||
font-size: 15px;
|
||||
left: 12px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-content {
|
||||
padding: 10px 4px 0 !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-title {
|
||||
font-size: 16px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-links li {
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-links a {
|
||||
font-size: 14px;
|
||||
line-height: 1.3;
|
||||
padding: 5px 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-trigger[data-category="7"]
|
||||
.esun-icon-megamenu-image-wrap::after {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-trigger[data-category="7"]
|
||||
.esun-icon-megamenu-column,
|
||||
.esun-icon-megamenu-trigger[data-category="7"]
|
||||
.esun-icon-megamenu-image-wrap {
|
||||
border-radius: 14px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-trigger[data-category="7"]
|
||||
.esun-icon-megamenu-image-title {
|
||||
left: 16px;
|
||||
line-height: 1.25;
|
||||
right: 16px;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-wrapper.esun-icon-megamenu--text-only {
|
||||
.esun-icon-megamenu-items {
|
||||
display: grid !important;
|
||||
gap: 0 !important;
|
||||
grid-template-columns: 1fr !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-column {
|
||||
border-bottom: 1px solid #e2e7e3 !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-column:last-child {
|
||||
border-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-content {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.esun-icon-megamenu-title {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 14px 4px;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 420px) {
|
||||
.esun-main-navigation
|
||||
.esun-icon-megamenu-wrapper.esun-icon-megamenu--text-only {
|
||||
.esun-icon-megamenu-items {
|
||||
grid-template-columns: 1fr !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
define([
|
||||
'uiComponent',
|
||||
'ko'
|
||||
], function (Component, ko) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
defaults: {
|
||||
rawMenuData: []
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this._super();
|
||||
|
||||
this.rawMenuData = this.rawMenuData || [];
|
||||
this.menuData = ko.observableArray(this.rawMenuData);
|
||||
|
||||
var firstId = this.rawMenuData.length ? this.rawMenuData[0].id : null;
|
||||
this.currentSecondaryId = ko.observable(firstId);
|
||||
|
||||
this.activeSecondaryCategory = ko.computed(function () {
|
||||
var currentId = this.currentSecondaryId(),
|
||||
items = this.menuData(),
|
||||
index;
|
||||
|
||||
for (index = 0; index < items.length; index++) {
|
||||
if (items[index].id === currentId) {
|
||||
return items[index];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}, this);
|
||||
},
|
||||
|
||||
switchSecondaryCategory: function (category, event) {
|
||||
var menuContainer,
|
||||
menuScrollTop,
|
||||
navigationContainer,
|
||||
navigationScrollTop,
|
||||
pageScrollTop,
|
||||
shouldRestoreScroll = event && event.type === 'click' &&
|
||||
window.matchMedia('(max-width: 992px)').matches;
|
||||
|
||||
if (shouldRestoreScroll) {
|
||||
menuContainer = event.currentTarget.closest('.esun-megamenu-inner');
|
||||
menuScrollTop = menuContainer ? menuContainer.scrollTop : 0;
|
||||
navigationContainer = event.currentTarget.closest('.nav-sections');
|
||||
navigationScrollTop = navigationContainer ? navigationContainer.scrollTop : 0;
|
||||
pageScrollTop = window.pageYOffset;
|
||||
}
|
||||
|
||||
if (category && typeof category.id !== 'undefined') {
|
||||
this.currentSecondaryId(category.id);
|
||||
}
|
||||
|
||||
if (shouldRestoreScroll) {
|
||||
window.requestAnimationFrame(function restoreScroll() {
|
||||
if (menuContainer) {
|
||||
menuContainer.scrollTop = menuScrollTop;
|
||||
}
|
||||
|
||||
if (navigationContainer) {
|
||||
navigationContainer.scrollTop = navigationScrollTop;
|
||||
}
|
||||
|
||||
window.scrollTo(0, pageScrollTop);
|
||||
|
||||
window.requestAnimationFrame(function () {
|
||||
if (menuContainer) {
|
||||
menuContainer.scrollTop = menuScrollTop;
|
||||
}
|
||||
|
||||
if (navigationContainer) {
|
||||
navigationContainer.scrollTop = navigationScrollTop;
|
||||
}
|
||||
|
||||
window.scrollTo(0, pageScrollTop);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,113 @@
|
||||
define([
|
||||
'jquery'
|
||||
], function ($) {
|
||||
'use strict';
|
||||
|
||||
return function (config, element) {
|
||||
var $navigation = $(element),
|
||||
mobileQuery = window.matchMedia(config.mediaBreakpoint || '(max-width: 992px)'),
|
||||
triggerSelector = '.esun-megamenu-trigger > .level-top';
|
||||
|
||||
function resetMenus() {
|
||||
$navigation
|
||||
.find('.esun-megamenu-trigger')
|
||||
.removeClass('is-open')
|
||||
.find('> .esun-megamenu-wrapper')
|
||||
.css('display', '')
|
||||
.end()
|
||||
.find('> .level-top')
|
||||
.removeClass('ui-state-active')
|
||||
.attr('aria-expanded', 'false')
|
||||
.end()
|
||||
.find('> .esun-megamenu-toggle')
|
||||
.attr('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
function handleNavigationClick(event) {
|
||||
var $target = $(event.target),
|
||||
$item = $target.closest('.esun-megamenu-trigger'),
|
||||
$contentLink = $target.closest('a.esun-product-link, a.esun-view-all'),
|
||||
$trigger,
|
||||
$linkedToggle,
|
||||
willOpen;
|
||||
|
||||
if (mobileQuery.matches && $contentLink.length) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
window.location.assign($contentLink.get(0).href);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mobileQuery.matches || !$item.length ||
|
||||
$target.closest('.esun-megamenu-wrapper').length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$linkedToggle = $target.closest('.esun-megamenu-toggle');
|
||||
|
||||
if ($item.hasClass('esun-linked-megamenu-trigger') && !$linkedToggle.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$trigger = $linkedToggle.length
|
||||
? $linkedToggle
|
||||
: $item.find('> .level-top');
|
||||
|
||||
if (!$trigger.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
|
||||
willOpen = !$item.hasClass('is-open');
|
||||
resetMenus();
|
||||
|
||||
if (willOpen) {
|
||||
$item.addClass('is-open');
|
||||
$trigger.attr('aria-expanded', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
$navigation
|
||||
.find(triggerSelector)
|
||||
.attr({
|
||||
'aria-expanded': 'false'
|
||||
});
|
||||
|
||||
$navigation
|
||||
.find('.esun-megamenu-toggle')
|
||||
.attr({
|
||||
'aria-expanded': 'false'
|
||||
});
|
||||
|
||||
$navigation
|
||||
.find('.esun-megamenu-wrapper')
|
||||
.on('click.esunMobileMegaMenu', function (event) {
|
||||
if (mobileQuery.matches) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
$(document)
|
||||
.off('click.esunMobileMegaMenuReset', '[data-action="toggle-nav"]')
|
||||
.on('click.esunMobileMegaMenuReset', '[data-action="toggle-nav"]', resetMenus);
|
||||
|
||||
if (typeof mobileQuery.addEventListener === 'function') {
|
||||
mobileQuery.addEventListener('change', function (event) {
|
||||
if (!event.matches) {
|
||||
resetMenus();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mobileQuery.addListener(function (event) {
|
||||
if (!event.matches) {
|
||||
resetMenus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
element.addEventListener('click', handleNavigationClick, true);
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user