From d2aebf127b89fa6d68a35d756020fc69b6918e2b Mon Sep 17 00:00:00 2001 From: Florian Thoma Date: Thu, 8 Aug 2024 11:53:00 +1000 Subject: [PATCH 1/2] update styles and icon handling --- client/dist/css/GroupedCmsMenu.css | 97 ++++++++++++++++++++++++++++-- src/Admin/GroupedCmsMenu.php | 4 +- 2 files changed, 94 insertions(+), 7 deletions(-) diff --git a/client/dist/css/GroupedCmsMenu.css b/client/dist/css/GroupedCmsMenu.css index 4d471a7..418fdd4 100644 --- a/client/dist/css/GroupedCmsMenu.css +++ b/client/dist/css/GroupedCmsMenu.css @@ -16,8 +16,95 @@ padding-left: 8px; } -.cms-menu__list li a .toggle-children-icon, -.cms-menu__list li a .toggle-children .toggle-children-icon { - background-image: none !important; - top: 35% !important; -} \ No newline at end of file +.cms-menu__list .children > a > .text { + margin-right: 34px; +} + +.cms-menu__list li.children.current > a, +.cms-menu__list li.children.opened > a, +.cms-menu__list li.children.opened a:hover { + background-color: #d8e4eb; +} + +.cms-menu__list li ul.group { + margin-left: 0; + padding-left: 8px; +} + +.cms-menu__list li ul.group li a { + height: auto !important; +} + +.cms-menu__list .children a .toggle-children { + position: absolute; + border-radius: 2px; + margin-top: -1px; + padding-top: 0; + font-size: 17px; + text-align: center; + line-height: 26px; + top: 0; + left: 0; + transform: none; + width: 100%; + height: 100%; + right: 0; + bottom: 0; +} + +.cms-menu__list .children a .toggle-children:hover { + background: rgba(85, 137, 167, 0.15); +} + +.cms-menu__list .children a .toggle-children:before { + font-family: silverstripe!important; + font-style: normal!important; + font-weight: 400!important; + font-variant: normal!important; + text-transform: none!important; + speak: none; + line-height: 26px; + -webkit-font-smoothing: antialiased; + content: '('; + position: absolute; + right: 8px; + top: 50%; + transform: translateY(-50%); +} + +.cms-menu__list .children a .toggle-children.opened:before { + content: '*'; +} + +.cms-menu__list li.children ul.collapsed-flyout { + margin-top: -52px; +} + +.cms-menu__list.collapsed .opened .child-flyout-indicator { + display: none !important; +} + +.cms-menu__list.collapsed .opened ul.collapsed-flyout li.clone { + display: none !important; +} + +.cms-menu__list.collapsed .opened ul.collapsed-flyout li a { + padding-right: 8px; + padding-left: 8px; +} + +.cms-menu__list.collapsed .opened ul.collapsed-flyout li a .menu__icon { + left: 13px; +} + +.cms-menu__list.collapsed .opened ul.collapsed-flyout li a span.text { + margin-left: 23px; +} + +.cms-menu__list .child-flyout-indicator { + display: none !important; +} + +.cms-menu__list .toggle-children-icon { + display: none !important; +} diff --git a/src/Admin/GroupedCmsMenu.php b/src/Admin/GroupedCmsMenu.php index 7510b06..b459391 100644 --- a/src/Admin/GroupedCmsMenu.php +++ b/src/Admin/GroupedCmsMenu.php @@ -116,7 +116,7 @@ public function GroupedMainMenu() $result->push(ArrayData::create([ 'Title' => $this->getTitle($group, $code), 'IconClass' => $iconClass, - 'HasCSSIcon' => strtolower($code), + 'HasCSSIcon' => false, 'Code' => DBField::create_field(DBText::class, $code), 'Link' => $children->first()->Link, 'LinkingMode' => $active ? 'current' : 'link', @@ -171,7 +171,7 @@ public function getIcon($group, $code) return $class::create()->config()->get('menu_icon_class'); } - return 'font-icon-' . (!empty($groupSettings[$group]['icon']) ? $groupSettings[$group]['icon'] : ''); + return (!empty($groupSettings[$group]['icon']) ? 'font-icon-' . $groupSettings[$group]['icon'] : ''); } /** From 8135731dc98f5b07735d38a934949d1e011bb0d9 Mon Sep 17 00:00:00 2001 From: Florian Thoma Date: Thu, 22 Aug 2024 20:24:15 +1000 Subject: [PATCH 2/2] run phpcbf --- src/Admin/GroupedCmsMenu.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Admin/GroupedCmsMenu.php b/src/Admin/GroupedCmsMenu.php index b459391..a507ec8 100644 --- a/src/Admin/GroupedCmsMenu.php +++ b/src/Admin/GroupedCmsMenu.php @@ -221,5 +221,4 @@ public function filterChildren(SS_List $children) $filtered->sort('ChildTitle') : $filtered->sort('SortOrder'); } - }