@@ -34,13 +34,11 @@ public function getCloseTagWrapper()
34
34
*/
35
35
public function getMenuWithoutDropdownWrapper ($ item )
36
36
{
37
- return '<li class="group relative mb-2.5">
38
- <a class="flex items-center text-secondary" href=" ' . $ item ->getUrl () . '" ' . $ item ->getAttributes () . '>
39
- <div class="w-8 h-8 flex items-center justify-center">
37
+ return '<li class="group relative pb-2.5">
38
+ <a class="flex items-center text-secondary ' . $ this ->getActiveState ($ item ) . '" href=" ' . $ item ->getUrl () . '" ' . $ item ->getAttributes () . '>
40
39
' . $ this ->getIcon ($ item ) . '
41
- </div>
42
40
<span class="text-sm ml-2 hover:font-bold"> ' . $ item ->title . '</span>
43
- <span class="bg-secondary absolute h-5 -right-5 rounded-tl-lg rounded-bl-lg opacity-0 group-hover:opacity-100 transition-all" style="width: 5px;" ></span>
41
+ <span class="bg-secondary absolute h-5 -right-5 rounded-tl-lg rounded-bl-lg opacity-0 group-hover:opacity-100 transition-all" style="width: 5px;"></span>
44
42
</a>
45
43
</li> '
46
44
. PHP_EOL ;
@@ -49,9 +47,9 @@ public function getMenuWithoutDropdownWrapper($item)
49
47
/**
50
48
* {@inheritdoc }.
51
49
*/
52
- public function getActiveState ($ item , $ state = '' )
50
+ public function getActiveState ($ item , $ state = 'active-menu ' )
53
51
{
54
- return $ item ->isActive () ? $ state : '-outline ' ;
52
+ return $ item ->isActive () ? $ state : '' ;
55
53
}
56
54
57
55
/**
@@ -105,12 +103,12 @@ public function getMenuWithDropDownWrapper($item)
105
103
106
104
return '
107
105
<details ' . $ this ->getActiveStateOnChild ($ item ) .'>
108
- <summary class="relative mb -2.5 flex mt-2 items-center cursor-pointer text-secondary" href="#navbar- ' . $ id . '">
106
+ <summary class="relative pb -2.5 flex items-center cursor-pointer text-secondary" href="#navbar- ' . $ id . '">
109
107
' . $ this ->getIcon ($ item ) . '
110
108
<span class="text-sm font-normal ml-2"> ' . $ item ->title . '</span>
111
109
' . $ this ->getChevron ($ item ) . '
112
110
</summary>
113
- <div class="mt-2 ml-8 " id="navbar- ' . $ id . '">
111
+ <div class="mt-2 ml-8 menu__submenu " id="navbar- ' . $ id . '">
114
112
<ul class="relative pb-2.5">
115
113
' . $ this ->getChildMenuItems ($ item ) . '
116
114
</ul>
@@ -130,27 +128,40 @@ public function getMultiLevelDropdownWrapper($item)
130
128
{
131
129
$ id = Str::slug ($ item ->title );
132
130
133
- return '<li class="nav-item">
134
- <a class="nav-link ' . $ this ->getActiveState ($ item ) . '" href="#navbar- ' . $ id . '" data-toggle="collapse" role="button" aria-expanded="false" aria-controls="navbar- ' . $ id . '">
135
- ' . $ item ->getIcon () . '
136
- <span class="nav-link-text"> ' . $ item ->title . '</span>
137
- </a>
138
- <div class="collapse ' . $ this ->getShowStateOnChild ($ item ) . '" id="navbar- ' . $ id . '">
139
- <ul class="nav nav-sm flex-column">
140
- ' . $ this ->getChildMenuItems ($ item ) . '
141
- </ul>
142
- </div>
143
- </li> '
131
+ return '<li class="group relative pb-2.5">
132
+ <a class="flex items-center text-secondary ' . $ this ->getActiveState ($ item ) . '" href="#navbar- ' . $ id . '" aria-controls="navbar- ' . $ id . '">
133
+ ' . $ this ->getIcon ($ item ) . '
134
+ <span class="text-sm ml-2 hover:font-bold"> ' . $ item ->title . '</span>
135
+ <span class="bg-secondary absolute h-5 -right-5 rounded-tl-lg rounded-bl-lg opacity-0 group-hover:opacity-100 transition-all" style="width: 5px;"></span>
136
+ </a>
137
+ <div class="mt-2 ml-8 menu__submenu ' . $ this ->getShowStateOnChild ($ item ) . '" id="navbar- ' . $ id . '">
138
+ <ul class="relative pb-2.5">
139
+ ' . $ this ->getChildMenuItems ($ item ) . '
140
+ </ul>
141
+ </div>
142
+ </li> '
144
143
. PHP_EOL ;
145
144
}
146
145
146
+ public function iconState ($ item , $ state = '' )
147
+ {
148
+ return $ item ->isActive () ? $ state : '-outline ' ;
149
+ }
150
+
151
+ public function iconChildState ($ item , $ state = '' )
152
+ {
153
+ return $ item ->hasActiveOnChild () ? $ state : '-outline ' ;
154
+ }
155
+
147
156
public function getIcon ($ item )
148
157
{
149
- $ state = $ this ->iconState ($ item );
158
+ $ state = empty ( $ item -> getChilds ()) ? $ this ->iconState ( $ item ) : $ this -> iconChildState ($ item );
150
159
151
- return '<div class="w-8 h-8 flex colour-secondary items-center justify-center">
152
- <ion-icon class="w-5 h-5 text-secondary colour-secondary ' . $ item ->icon . '" name=" ' . $ item ->icon . $ state .'"></ion-icon>
153
- </div> ' . PHP_EOL ;
160
+ if ($ item ->icon !== null && $ item ->icon !== '' ) {
161
+ return '<div class="w-8 h-8 flex colour-secondary items-center justify-center">
162
+ <ion-icon class="w-5 h-5 text-secondary colour-secondary ' . $ item ->icon . '" name=" ' . $ item ->icon . $ state .'"></ion-icon>
163
+ </div> ' . PHP_EOL ;
164
+ }
154
165
}
155
166
156
167
public function getChevron ($ item )
@@ -160,11 +171,6 @@ public function getChevron($item)
160
171
return '<ion-icon data-id="cash" name="chevron ' . $ state . '" class="absolute right-0"></ion-icon> ' . PHP_EOL ;
161
172
}
162
173
163
- public function iconState ($ item , $ state = '' )
164
- {
165
- return $ item ->hasActiveOnChild () ? $ state : '-outline ' ;
166
- }
167
-
168
174
public function chevronState ($ item , $ state = '-up ' )
169
175
{
170
176
return $ item ->hasActiveOnChild () ? $ state : '-down ' ;
0 commit comments