Skip to content

Commit

Permalink
Merge pull request #35 from hydephp/34-move-app-scripts-into-appjsdoc…
Browse files Browse the repository at this point in the history
…umentationjs-hydehyde

Move scripts into app.js
  • Loading branch information
caendesilva authored Mar 28, 2022
2 parents 9c2ea99 + 6bdaff0 commit bf55f3b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 78 deletions.
3 changes: 3 additions & 0 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
</section>

@includeUnless(config('hyde.footer.enabled', true) && ($withoutNavigation ?? false), 'hyde::layouts.footer')

<!-- The main app script -->
<script defer src="{{ Hyde::relativePath('media/app.js', $currentPage) }}"></script>
</body>
</html>
46 changes: 0 additions & 46 deletions resources/views/layouts/docs.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,5 @@
@include('hyde::components.docs.content')
</main>

<script>
var sidebarOpen = screen.width >= 768;
const sidebar = document.getElementById("documentation-sidebar");
const main = document.getElementById("documentation-content");
const backdrop = document.getElementById("sidebar-backdrop");
const toggleButtons = document.querySelectorAll(".sidebar-button-wrapper");
function toggleSidebar() {
if (sidebarOpen) {
hideSidebar();
} else {
showSidebar();
}
}
function showSidebar() {
sidebar.classList.remove("hidden");
sidebar.classList.add("flex");
backdrop.classList.remove("hidden");
document.getElementById("app").style.overflow = "hidden";
toggleButtons.forEach((button) => {
button.classList.remove("open");
button.classList.add("closed");
});
sidebarOpen = true;
}
function hideSidebar() {
sidebar.classList.add("hidden");
sidebar.classList.remove("flex");
backdrop.classList.add("hidden");
document.getElementById("app").style.overflow = null;
toggleButtons.forEach((button) => {
button.classList.add("open");
button.classList.remove("closed");
});
sidebarOpen = false;
}
</script>
<div id="sidebar-backdrop" class="hidden" title="Click to close sidebar" onClick="hideSidebar()"></div>
@endsection
34 changes: 2 additions & 32 deletions resources/views/layouts/navigation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</a>
</header>

<button class="navigation-toggle-button md:hidden" title="Open navigation menu" onClick="showNavigation()">
<button class="navigation-toggle-button md:hidden px-4" title="Open navigation menu" onClick="showNavigation()">
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>
</button>

Expand All @@ -35,7 +35,7 @@
</a>
</header>

<button class="navigation-toggle-button" title="Close navigation menu" onClick="hideNavigation()">
<button class="navigation-toggle-button px-4" title="Close navigation menu" onClick="hideNavigation()">
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><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"/></svg>
</button>
</div>
Expand All @@ -56,33 +56,3 @@
@endforeach
</ul>
</nav>


<script>
const mainNavigation = document.getElementById("main-navigation");
const mobileNavigation = document.getElementById("mobile-navigation");
var navigationOpen = false;
function toggleNavigation() {
if (navigationOpen) {
hideNavigation();
} else {
showNavigation();
}
}
function showNavigation() {
mobileNavigation.classList.add("flex");
mobileNavigation.classList.remove("hidden");
navigationOpen = true;
}
function hideNavigation() {
mobileNavigation.classList.remove("flex");
mobileNavigation.classList.add("hidden");
navigationOpen = false;
}
</script>

0 comments on commit bf55f3b

Please sign in to comment.