Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #108 from helsingborg-stad/feature/dynamic-top-nav
Browse files Browse the repository at this point in the history
Dynamic navbar
  • Loading branch information
silvergrund authored Apr 23, 2020
2 parents fa45267 + f7fa8d4 commit ab5b37c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 12 deletions.
27 changes: 27 additions & 0 deletions src/Component/Navbar/Navbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,32 @@ public function init() {

// Extract array for eazy access (fetch only)
extract($this->data);

if($this->data['isDynamic']) {


$this->data['attributeList']['js-is-dynamic'] = '';

if(isset($childItemsUrl)) {


$this->data['attributeList']['js-child-items-url'] = $childItemsUrl;
}
}

if(isset($this->data['multiDimenexpanded_menusional'])) {
foreach($this->data['expanded_menu'] as $key => $value){
$this->data['expanded_menu'][$key]['id'] = isset($this->data['expanded_menu'][$key]['id']) ? $this->data['expanded_menu'][$key]['id'] : null;
}
}

if(isset($this->data['pageID'])) {
$this->data['attributeList']['data-page-id'] = $this->data['pageID'];
}

if(isset($this->data['pageParentID'])) {
$this->data['attributeList']['data-page-parent-id'] = $this->data['pageParentID'];
}

}
}
3 changes: 2 additions & 1 deletion src/Component/Navbar/navbar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"logo": "",
"items": [],
"sidebar": false,
"expanded_menu": false
"expanded_menu": false,
"isDynamic": false
},

"description":{
Expand Down
6 changes: 5 additions & 1 deletion src/Component/Navbar/sub/expanded_grid.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


@grid([
"classList" => [
$baseClass.'__expanded_grid'
Expand All @@ -8,8 +10,9 @@
"col_gap" => "5",
"row_gap" => "9"
])

@foreach ($expanded_menu as $key => $item)

@grid([
'element' => 'a',
'classList' => [
Expand Down Expand Up @@ -38,4 +41,5 @@
@endgrid
@endforeach


@endgrid
3 changes: 2 additions & 1 deletion src/Component/Navbar/sub/expanded_main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
'color' => 'default',
'size' => 'lg',
'style' => 'basic',
'href' => '#',
'classList' => [
$baseClass.'__prev'
]
])
@endbutton
@endif

@typography([
"element" => "h2",
"variant" => "marketing",
Expand Down
20 changes: 11 additions & 9 deletions src/Component/Navbar/sub/expanded_menu.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
"col_gap" => "4"
])

@foreach ($expanded_menu as $key => $item)
@grid([])
@link([
'href' => $item['href']
])
{{$key}}
@endbutton
@endgrid
@endforeach
@if(!$isDynamic)
@foreach ($expanded_menu as $key => $item)
@grid([])
@link([
'href' => $item['href']
])
{{$key}}
@endbutton
@endgrid
@endforeach
@endif
@endgrid

0 comments on commit ab5b37c

Please sign in to comment.