Skip to content

Commit

Permalink
Merge pull request #474 from hydephp/breaking-namespace-changes
Browse files Browse the repository at this point in the history
Breaking move of navigation related namespaces hydephp/develop@f2f8c0d
  • Loading branch information
github-actions committed Sep 8, 2022
1 parent ebea713 commit 616dc6d
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 52 deletions.
1 change: 0 additions & 1 deletion config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Hyde\Framework\Helpers\Features;
use Hyde\Framework\Helpers\Meta;
use Hyde\Framework\Models\Author;
use Hyde\Framework\Models\NavItem;

return [
/*
Expand Down
5 changes: 3 additions & 2 deletions resources/views/components/docs/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ class="bg-gray-100 dark:bg-gray-800 dark:text-gray-200 h-screen w-64 fixed z-30
<header id="sidebar-header" class="h-16">
@include('hyde::components.docs.sidebar-brand')
</header>
<nav id="sidebar-navigation" class="p-4 overflow-y-auto border-y border-gray-300 dark:border-[#1b2533] h-[calc(100vh_-_8rem)]">
<nav id="sidebar-navigation"
class="p-4 overflow-y-auto border-y border-gray-300 dark:border-[#1b2533] h-[calc(100vh_-_8rem)]">
@php
$sidebar = \Hyde\Framework\Models\DocumentationSidebar::create();
$sidebar = \Hyde\Framework\Models\Navigation\DocumentationSidebar::create();
@endphp

@if($sidebar->hasGroups())
Expand Down
74 changes: 38 additions & 36 deletions resources/views/layouts/navigation.blade.php
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
@php
$navigation = \Hyde\Framework\Models\NavigationMenu::create();
$navigation = \Hyde\Framework\Models\Navigation\NavigationMenu::create();
@endphp

<nav aria-label="Main navigation" id="main-navigation"
class="flex flex-wrap items-center justify-between p-4 shadow-lg sm:shadow-xl md:shadow-none dark:bg-gray-800">
<div class="flex flex-grow items-center flex-shrink-0 text-gray-700 dark:text-gray-200">
@include('hyde::components.navigation.navigation-brand')
class="flex flex-wrap items-center justify-between p-4 shadow-lg sm:shadow-xl md:shadow-none dark:bg-gray-800">
<div class="flex flex-grow items-center flex-shrink-0 text-gray-700 dark:text-gray-200">
@include('hyde::components.navigation.navigation-brand')

<div class="ml-auto">
<x-hyde::navigation.theme-toggle-button />
</div>
</div>
<div class="ml-auto">
<x-hyde::navigation.theme-toggle-button/>
</div>
</div>

<div class="block md:hidden">
<button id="navigation-toggle-button" @click="navigationOpen = ! navigationOpen" class="flex items-center px-3 py-1 hover:text-gray-700 dark:text-gray-200"
aria-label="Toggle navigation menu">
<svg x-show="! navigationOpen" title="Open Navigation Menu" class="dark:fill-gray-200" style="display: block;"
id="open-main-navigation-menu-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24"
width="24"><title>Open Menu</title>
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/>
</svg>
<svg x-show="navigationOpen" title="Close Navigation Menu" class="dark:fill-gray-200" style="display: none;"
id="close-main-navigation-menu-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24"
width="24"><title>Close Menu</title>
<path d="M0 0h24v24H0z" fill="none"></path>
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path>
</svg>
</button>
</div>
<div class="block md:hidden">
<button id="navigation-toggle-button" @click="navigationOpen = ! navigationOpen"
class="flex items-center px-3 py-1 hover:text-gray-700 dark:text-gray-200"
aria-label="Toggle navigation menu">
<svg x-show="! navigationOpen" title="Open Navigation Menu" class="dark:fill-gray-200"
style="display: block;"
id="open-main-navigation-menu-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24"
width="24"><title>Open Menu</title>
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/>
</svg>
<svg x-show="navigationOpen" title="Close Navigation Menu" class="dark:fill-gray-200" style="display: none;"
id="close-main-navigation-menu-icon" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24"
width="24"><title>Close Menu</title>
<path d="M0 0h24v24H0z" fill="none"></path>
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path>
</svg>
</button>
</div>

<div id="main-navigation-links"
class="w-full x-uncloak-md md:flex flex-grow md:flex-grow-0 md:items-center md:w-auto px-6 -mx-4 border-t mt-3 pt-3 md:border-none md:mt-0 md:py-0 border-gray-200 dark:border-gray-700"
:class="navigationOpen ? '' : 'hidden'" x-cloak>
<ul aria-label="Navigation links" class="md:flex-grow md:flex justify-end">
@foreach ($navigation->items as $item)
<li class="md:mx-2">
@include('hyde::components.navigation.navigation-link')
</li>
@endforeach
</ul>
</div>
<div id="main-navigation-links"
class="w-full x-uncloak-md md:flex flex-grow md:flex-grow-0 md:items-center md:w-auto px-6 -mx-4 border-t mt-3 pt-3 md:border-none md:mt-0 md:py-0 border-gray-200 dark:border-gray-700"
:class="navigationOpen ? '' : 'hidden'" x-cloak>
<ul aria-label="Navigation links" class="md:flex-grow md:flex justify-end">
@foreach ($navigation->items as $item)
<li class="md:mx-2">
@include('hyde::components.navigation.navigation-link')
</li>
@endforeach
</ul>
</div>
</nav>
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

namespace Hyde\Framework\Models;
namespace Hyde\Framework\Models\Navigation;

use Hyde\Framework\Hyde;
use Hyde\Framework\Models\Pages\DocumentationPage;
use Hyde\Framework\Models\Route;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Hyde\Framework\Models;
namespace Hyde\Framework\Models\Navigation;

use Hyde\Framework\Contracts\PageContract;
use Hyde\Framework\Contracts\RouteContract;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

namespace Hyde\Framework\Models;
namespace Hyde\Framework\Models\Navigation;

use Hyde\Framework\Contracts\RouteContract;
use Hyde\Framework\Hyde;
use Hyde\Framework\Models\Route;
use Illuminate\Support\Collection;

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/NavigationMenuTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace Hyde\Framework\Testing\Feature;

use Hyde\Framework\Hyde;
use Hyde\Framework\Models\NavigationMenu;
use Hyde\Framework\Models\NavItem;
use Hyde\Framework\Models\Navigation\NavigationMenu;
use Hyde\Framework\Models\Navigation\NavItem;
use Hyde\Framework\Models\Route;
use Hyde\Testing\TestCase;
use Illuminate\Support\Collection;

/**
* @covers \Hyde\Framework\Models\NavigationMenu
* @covers \Hyde\Framework\Models\Navigation\NavigationMenu
*/
class NavigationMenuTest extends TestCase
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Services/DocumentationSidebarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

use Hyde\Framework\Actions\ConvertsArrayToFrontMatter;
use Hyde\Framework\Hyde;
use Hyde\Framework\Models\DocumentationSidebar;
use Hyde\Framework\Models\NavItem;
use Hyde\Framework\Models\Navigation\DocumentationSidebar;
use Hyde\Framework\Models\Navigation\NavItem;
use Hyde\Framework\Models\Route;
use Hyde\Testing\TestCase;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\File;

/**
* @covers \Hyde\Framework\Models\DocumentationSidebar
* @covers \Hyde\Framework\Models\Navigation\DocumentationSidebar
* @covers Hyde\Framework\Concerns\FrontMatter\Schemas\DocumentationPageSchema
*/
class DocumentationSidebarTest extends TestCase
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/NavItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

use Hyde\Framework\Contracts\PageContract;
use Hyde\Framework\Contracts\RouteContract;
use Hyde\Framework\Models\NavItem;
use Hyde\Framework\Models\Navigation\NavItem;
use Hyde\Framework\Models\Route;
use Hyde\Testing\TestCase;

/**
* This unit test covers the basics of the NavItem class.
* For the full feature test, see the NavigationMenuTest class.
*
* @covers \Hyde\Framework\Models\NavItem
* @covers \Hyde\Framework\Models\Navigation\NavItem
*/
class NavItemTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Views/NavigationBrandViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function setUp(): void
protected function render(): string
{
return view('hyde::components.navigation.navigation-brand', [
'navigation' => \Hyde\Framework\Models\NavigationMenu::create(),
'navigation' => \Hyde\Framework\Models\Navigation\NavigationMenu::create(),
])->render();
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Views/NavigationLinkViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Hyde\Framework\Testing\Unit\Views;

use Hyde\Framework\Models\NavItem;
use Hyde\Framework\Models\Navigation\NavItem;
use Hyde\Framework\Models\Route;
use Hyde\Testing\TestCase;

Expand Down

0 comments on commit 616dc6d

Please sign in to comment.