@@ -34,19 +34,16 @@ public function getCloseTagWrapper()
3434 */
3535 public function getMenuWithoutDropdownWrapper ($ item )
3636 {
37- $ iconState = $ this ->iconState ($ item );
38-
39- $ html = '<li class="group relative mb-2.5"> ' ;
40- $ html .= ' <a class="flex items-center text-secondary" href=" ' . $ item ->getUrl () . '" ' . $ item ->getAttributes () . '> ' ;
41- $ html .= ' <div class="w-8 h-8 flex items-center justify-center"> ' ;
42- $ html .= $ item ->getIcon ($ iconState );
43- $ html .= ' </div> ' ;
44- $ html .= ' <span class="text-sm ml-2 hover:font-bold"> ' . $ item ->title . '</span> ' ;
45- $ html .= ' <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> ' ;
46- $ html .= ' </a> ' ;
47- $ html .= '</li> ' . PHP_EOL ;
48-
49- return $ html ;
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">
40+ ' . $ this ->getIcon ($ item ) . '
41+ </div>
42+ <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>
44+ </a>
45+ </li> '
46+ . PHP_EOL ;
5047 }
5148
5249 /**
@@ -70,16 +67,6 @@ public function getActiveStateOnChild($item, $state = 'open')
7067 return $ item ->hasActiveOnChild () ? $ state : '' ;
7168 }
7269
73- public function chevronState ($ item , $ state = '-up ' )
74- {
75- return $ item ->hasActiveOnChild () ? $ state : '-down ' ;
76- }
77-
78- public function iconState ($ item , $ state = '' )
79- {
80- return $ item ->hasActiveOnChild () ? $ state : '-outline ' ;
81- }
82-
8370 /**
8471 * Get active state on child items.
8572 *
@@ -116,20 +103,17 @@ public function getMenuWithDropDownWrapper($item)
116103 {
117104 $ id = Str::slug ($ item ->title );
118105
119- $ iconState = $ this ->iconState ($ item );
120-
121106 return '
122107 <details ' . $ this ->getActiveStateOnChild ($ item ) .'>
123108 <summary class="relative mb-2.5 flex mt-2 items-center cursor-pointer text-secondary" href="#navbar- ' . $ id . '">
124- ' . $ item ->getIcon ($ iconState ) . '
109+ ' . $ this ->getIcon ($ item ) . '
125110 <span class="text-sm font-normal ml-2"> ' . $ item ->title . '</span>
126- <ion-icon data-id="cash" name="chevron ' . $ this ->chevronState ($ item ) .' " class="absolute right-0"></ion-icon>
111+ ' . $ this ->getChevron ($ item ) . '
127112 </summary>
128113 <div class="mt-2 ml-8 " id="navbar- ' . $ id . '">
129114 <ul class="relative pb-2.5">
130115 ' . $ this ->getChildMenuItems ($ item ) . '
131116 </ul>
132-
133117 </div>
134118 </details> '
135119 . PHP_EOL ;
@@ -159,4 +143,30 @@ public function getMultiLevelDropdownWrapper($item)
159143</li> '
160144 . PHP_EOL ;
161145 }
146+
147+ public function getIcon ($ item )
148+ {
149+ $ state = $ this ->iconState ($ item );
150+
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 ;
154+ }
155+
156+ public function getChevron ($ item )
157+ {
158+ $ state = $ this ->chevronState ($ item );
159+
160+ return '<ion-icon data-id="cash" name="chevron ' . $ state . '" class="absolute right-0"></ion-icon> ' . PHP_EOL ;
161+ }
162+
163+ public function iconState ($ item , $ state = '' )
164+ {
165+ return $ item ->hasActiveOnChild () ? $ state : '-outline ' ;
166+ }
167+
168+ public function chevronState ($ item , $ state = '-up ' )
169+ {
170+ return $ item ->hasActiveOnChild () ? $ state : '-down ' ;
171+ }
162172}
0 commit comments