-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from TYPO3incubator/feature/logo-nav-header-pa…
…rtials Draft: [TASK] Create header with logo and navigation
- Loading branch information
Showing
11 changed files
with
217 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
function toggleMobileNavigation() { | ||
const hamburgerMenus = document.querySelectorAll(".hamburger-menu-button"); | ||
const navs = document.querySelectorAll(".navigation"); | ||
|
||
hamburgerMenus.forEach((menu) => { | ||
const open = menu.querySelector('.hamburger-menu-open'); | ||
const close = menu.querySelector('.hamburger-menu-close'); | ||
|
||
// Function to update icon visibility based on the 'active' state of navigation | ||
function updateIconVisibility() { | ||
navs.forEach((nav) => { | ||
const isActive = nav.classList.contains("active"); | ||
if (open && close) { | ||
open.classList.toggle('hidden', isActive); | ||
close.classList.toggle('hidden', !isActive); | ||
} | ||
}); | ||
} | ||
|
||
// Attach event listener if not already initialized | ||
if (!menu.dataset.initialized) { | ||
menu.addEventListener("click", function() { | ||
// Toggle 'active' class on all navigation elements | ||
navs.forEach((nav) => nav.classList.toggle("active")); | ||
updateIconVisibility(); | ||
}); | ||
|
||
// Mark this menu as initialized | ||
menu.dataset.initialized = "true"; | ||
} | ||
|
||
// Initial update of icon visibility based on the current 'active' state | ||
updateIconVisibility(); | ||
}); | ||
} | ||
|
||
toggleMobileNavigation(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletions
14
local_packages/success/Configuration/Sets/ProductLaunch/settings.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
ui: | ||
theme: "system" | ||
default: | ||
name: "Surfboard Company" | ||
layout: | ||
navigation: | ||
position: "below" | ||
isVisible: true | ||
radius: "5px" | ||
rotate: "3deg" | ||
font: | ||
text: "Roboto, sans-serif" | ||
heading: "Roboto, sans-serif" | ||
light: | ||
color: | ||
primary: "rgb(235, 183, 35)" | ||
secondary: "rgb(94, 13, 25)" | ||
light: "rgb(255, 249, 232)" | ||
primarytext: "black" | ||
secondarytext: "white" | ||
lighttext: "black" | ||
setting: | ||
radius: "5px" | ||
rotate: "3deg" | ||
name: 'Surfboard Company' | ||
dark: | ||
font: [] | ||
color: | ||
primary: "rgb(235, 183, 35)" | ||
secondary: "rgb(94, 13, 25)" | ||
light: "rgb(255, 249, 232)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...kages/success/Resources/Private/Templates/ProductLaunch/Partials/HamburgerMenuButton.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<button | ||
class="hamburger-menu-button lg:hidden ml-auto h-5" | ||
title="Menu" | ||
> | ||
<span aria-hidden="true" class="hamburger-menu-open w-5 flex flex-col justify-between gap-1"> | ||
<span class="block h-1 w-full bg-black"></span> | ||
<span class="block h-1 w-full bg-black"></span> | ||
<span class="block h-1 w-full bg-black"></span> | ||
</span> | ||
<span aria-hidden="true" class="hamburger-menu-close hidden">✖</span> | ||
</button> |
38 changes: 38 additions & 0 deletions
38
local_packages/success/Resources/Private/Templates/ProductLaunch/Partials/Header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<vac:asset.vite entry="assets/js/mobile-navigation.js"/> | ||
|
||
<header class="absolute top-0 left-0 z-50 w-full"> | ||
<f:if condition="{settings.ui.layout.navigation.position} == 'below'"> | ||
<f:then> | ||
<div class="w-full px-5 py-3 lg:block flex items-center justify-between gap-2"> | ||
<f:render partial="Logo" /> | ||
|
||
<f:if condition="{settings.ui.layout.navigation.isVisible}"> | ||
<f:then> | ||
<div class="mt-2 text-black"> | ||
<f:render partial="Navigation" /> | ||
</div> | ||
</f:then> | ||
</f:if> | ||
</div> | ||
</f:then> | ||
|
||
<f:else> | ||
<div class="relative"> | ||
<div class="w-full absolute top-0 left-0 z-10"> | ||
<div class="px-5 text-black py-3"> | ||
<div class="flex justify-between items-center gap-2"> | ||
<f:render partial="Logo" /> | ||
|
||
<f:if condition="{settings.ui.layout.navigation.isVisible}"> | ||
<f:then> | ||
<f:render partial="Navigation" /> | ||
</f:then> | ||
</f:if> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</f:else> | ||
</f:if> | ||
|
||
</header> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
local_packages/success/Resources/Private/Templates/ProductLaunch/Partials/Logo.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<a href="#" title="Home" class="inline-block min-w-24"> | ||
<img alt="ALT_TEXT" class="w-32 h-auto" src="https://picsum.photos/200/100" /> | ||
</a> |
7 changes: 7 additions & 0 deletions
7
local_packages/success/Resources/Private/Templates/ProductLaunch/Partials/Navigation.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
<nav class="navigation"> | ||
<!-- lg:bg-transparent lg:h-auto lg:static lg:w-auto --> | ||
<f:render partial="NavigationLinks" /> | ||
|
||
<f:render partial="HamburgerMenuButton" /> | ||
</nav> |
11 changes: 11 additions & 0 deletions
11
..._packages/success/Resources/Private/Templates/ProductLaunch/Partials/NavigationLinks.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<ul class="flex gap-4 items-center"> | ||
<li class="p-2 lg:pl-0 m-1 lg:ml-0"> | ||
<a href="#" class="font-bold text-lg uppercase transition-colors hover:text-primary-500 focus:text-primary-500">Menu 1</a> | ||
</li> | ||
<li class="p-2 m-1"> | ||
<a href="#" class="font-bold text-lg uppercase p-2 m-1 transition-colors hover:text-primary-500 focus:text-primary-500">Menu 2</a> | ||
</li> | ||
<li class="p-2 m-1"> | ||
<a href="#" class="font-bold text-lg uppercase p-2 m-1 transition-colors hover:text-primary-500 focus:text-primary-500">Menu 3</a> | ||
</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters