428 lines
20 KiB
PHP
428 lines
20 KiB
PHP
@php
|
||
// Get menu items from Pages with nested children
|
||
$menuItems = \App\Models\Page::with(['children' => function ($query) {
|
||
$query->where('status', 'published')
|
||
->where('show_in_menu', true)
|
||
->orderBy('sort_order', 'asc')
|
||
->orderBy('title', 'asc');
|
||
}, 'children.children' => function ($query) {
|
||
$query->where('status', 'published')
|
||
->where('show_in_menu', true)
|
||
->orderBy('sort_order', 'asc')
|
||
->orderBy('title', 'asc');
|
||
}])
|
||
->whereNull('parent_id')
|
||
->where('status', 'published')
|
||
->where('show_in_menu', true)
|
||
->orderBy('sort_order', 'asc')
|
||
->orderBy('title', 'asc')
|
||
->get();
|
||
|
||
// Check if we're on homepage - multiple checks for reliability
|
||
$currentRoute = request()->route() ? request()->route()->getName() : null;
|
||
$currentPath = request()->path();
|
||
$isHomepage = $currentRoute === 'homepage' || $currentPath === '/' || request()->is('/');
|
||
@endphp
|
||
<header class="relative wrapper {{ $isHomepage ? '!bg-[#edf2fc]' : '!bg-white' }}">
|
||
<nav class="navbar navbar-expand-lg {{ $isHomepage ? 'center-logo transparent position-absolute navbar-dark' : 'navbar-light !bg-white !shadow-sm' }}">
|
||
<div class="container {{ $isHomepage ? 'justify-between' : 'flex justify-between' }} items-center">
|
||
<!-- Mobile Header -->
|
||
<div class="flex flex-row w-full justify-between items-center xl:!hidden lg:!hidden">
|
||
<div class="navbar-brand"><a href="/">
|
||
<img class="logo-dark" src="{{ asset('assets/img/truncgil-yatay.svg') }}" alt="Truncgil" fetchpriority="high" decoding="async">
|
||
<img class="logo-light" src="{{ asset('assets/img/truncgil-yatay-dark.svg') }}" alt="Truncgil" fetchpriority="high" decoding="async">
|
||
</a></div>
|
||
<div class="navbar-other !ml-auto">
|
||
<ul class="navbar-nav flex-row items-center">
|
||
<li class="nav-item">
|
||
<button class="hamburger offcanvas-nav-btn" data-bs-toggle="offcanvas" data-bs-target="#offcanvas-nav"><span></span></button>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Desktop Header -->
|
||
@if($isHomepage)
|
||
<!-- Homepage Layout (Center Logo) -->
|
||
<div class="navbar-collapse-wrapper flex flex-row items-center w-full">
|
||
<div id="offcanvas-nav" class="navbar-collapse offcanvas offcanvas-nav offcanvas-start">
|
||
<div class="offcanvas-header homepage-header-brand order-0 lg:!order-1 xl:!order-1 p-[1.5rem] !flex items-center justify-center flex-row gap-2">
|
||
<a class="transition-none hidden lg:!flex xl:!flex shrink-0" href="/" onclick="trackEvent('logo_click', {location: 'header_center'})">
|
||
<img class="logo-dark" src="{{ asset('assets/img/truncgil-yatay.svg') }}" alt="Truncgil" fetchpriority="high" decoding="async">
|
||
<img class="logo-light" src="{{ asset('assets/img/truncgil-yatay-dark.svg') }}" alt="Truncgil" fetchpriority="high" decoding="async">
|
||
</a>
|
||
<div class="hidden lg:!flex xl:!flex shrink-0 homepage-header-brand__language">
|
||
<x-custom.language-selector class="!ml-0" />
|
||
</div>
|
||
</div>
|
||
<div class="w-full order-1 lg:!order-none lg:!flex xl:!order-none xl:!flex offcanvas-body homepage-nav-panel homepage-nav-left">
|
||
<div class="xl:!hidden lg:!hidden w-full pb-4 mb-2 border-b border-white/10">
|
||
@include('components.custom.language-selector', ['variant' => 'offcanvas'])
|
||
</div>
|
||
<ul class="navbar-nav">
|
||
@foreach($menuItems->slice(0, ceil($menuItems->count() / 2)) as $item)
|
||
<x-front.menu-item :item="$item" />
|
||
@endforeach
|
||
</ul>
|
||
</div>
|
||
<div class="w-full order-3 lg:!order-2 lg:!flex xl:!order-2 xl:!flex offcanvas-body homepage-nav-panel homepage-nav-right">
|
||
<ul class="navbar-nav">
|
||
@foreach($menuItems->slice(ceil($menuItems->count() / 2)) as $item)
|
||
<x-front.menu-item :item="$item" />
|
||
@endforeach
|
||
</ul>
|
||
</div>
|
||
<div class="offcanvas-body xl:!hidden lg:!hidden order-4 !mt-auto">
|
||
<div class="offcanvas-footer">
|
||
<div>
|
||
<a href="mailto:{{setting('contact_email')}}" class="link-inverse">{{setting('contact_email')}}</a>
|
||
<br> <a href="tel:{{setting('contact_phone')}}">{{setting('contact_phone')}}</a> <br>
|
||
<nav class="nav social social-white !mt-4">
|
||
<?php $social_media = json_decode(setting('social_links'), true); ?>
|
||
<a class="!text-[#cacaca] text-[1rem] transition-all duration-[0.2s] ease-in-out translate-y-0 motion-reduce:transition-none hover:translate-y-[-0.15rem] m-[0_.7rem_0_0]" href="{{ !empty($social_media['Twitter']) ? $social_media['Twitter'] : '#' }}" target="_blank" rel="noopener"><i class="uil uil-twitter before:content-['\ed59'] !text-white text-[1rem]"></i></a>
|
||
<a class="!text-[#cacaca] text-[1rem] transition-all duration-[0.2s] ease-in-out translate-y-0 motion-reduce:transition-none hover:translate-y-[-0.15rem] m-[0_.7rem_0_0]" href="{{ !empty($social_media['Facebook']) ? $social_media['Facebook'] : '#' }}" target="_blank" rel="noopener"><i class="uil uil-facebook-f before:content-['\eae2'] !text-white text-[1rem]"></i></a>
|
||
<a class="!text-[#cacaca] text-[1rem] transition-all duration-[0.2s] ease-in-out translate-y-0 motion-reduce:transition-none hover:translate-y-[-0.15rem] m-[0_.7rem_0_0]" href="{{ !empty($social_media['Github']) ? $social_media['Github'] : '#' }}" target="_blank" rel="noopener"><i class="uil uil-github before:content-['\eb40'] !text-white text-[1rem]"></i></a>
|
||
<a class="!text-[#cacaca] text-[1rem] transition-all duration-[0.2s] ease-in-out translate-y-0 motion-reduce:transition-none hover:translate-y-[-0.15rem] m-[0_.7rem_0_0]" href="{{ !empty($social_media['Instagram']) ? $social_media['Instagram'] : '#' }}" target="_blank" rel="noopener"><i class="uil uil-instagram before:content-['\eb9c'] !text-white text-[1rem]"></i></a>
|
||
<a class="!text-[#cacaca] text-[1rem] transition-all duration-[0.2s] ease-in-out translate-y-0 motion-reduce:transition-none hover:translate-y-[-0.15rem] m-[0_.7rem_0_0]" href="{{ !empty($social_media['Youtube']) ? $social_media['Youtube'] : '#' }}" target="_blank" rel="noopener"><i class="uil uil-youtube before:content-['\edb5'] !text-white text-[1rem]"></i></a>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
@else
|
||
<!-- Other Pages Layout (Logo Left, Menu Center, Social Right) -->
|
||
<div class="navbar-collapse-wrapper flex flex-row items-center w-full justify-between hidden lg:!flex xl:!flex">
|
||
<!-- Logo on Left -->
|
||
<div class="navbar-brand">
|
||
<a href="/">
|
||
<img class="!h-[2.5rem]" src="{{ asset('assets/img/truncgil-yatay.svg') }}" alt="Truncgil Teknoloji" fetchpriority="high" decoding="async">
|
||
</a>
|
||
</div>
|
||
|
||
<!-- Menu in Center (Desktop) -->
|
||
<div class="navbar-collapse w-full flex justify-center">
|
||
<div class="flex justify-center w-full">
|
||
<ul class="navbar-nav flex-row items-center gap-1">
|
||
@foreach($menuItems as $item)
|
||
<x-front.menu-item :item="$item" />
|
||
@endforeach
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Social Media & Language on Right -->
|
||
<div class="flex items-center gap-4">
|
||
<nav class="nav social flex items-center gap-2">
|
||
<?php $social_media = json_decode(setting('social_links'), true); ?>
|
||
@if(!empty($social_media['Twitter']))
|
||
<a class="!text-[#5daed5] hover:!text-[#3b9ec9] text-[1.1rem] transition-colors" href="{{ $social_media['Twitter'] }}" target="_blank" rel="noopener" onclick="trackEvent('social_click', {platform: 'twitter'})">
|
||
<i class="uil uil-twitter"></i>
|
||
</a>
|
||
@endif
|
||
@if(!empty($social_media['Facebook']))
|
||
<a class="!text-[#4470cf] hover:!text-[#3259b8] text-[1.1rem] transition-colors" href="{{ $social_media['Facebook'] }}" target="_blank" rel="noopener" onclick="trackEvent('social_click', {platform: 'facebook'})">
|
||
<i class="uil uil-facebook-f"></i>
|
||
</a>
|
||
@endif
|
||
@if(!empty($social_media['Github']))
|
||
<a class="!text-[#343a40] hover:!text-[#23272b] text-[1.1rem] transition-colors" href="{{ $social_media['Github'] }}" target="_blank" rel="noopener" onclick="trackEvent('social_click', {platform: 'github'})">
|
||
<i class="uil uil-github"></i>
|
||
</a>
|
||
@endif
|
||
@if(!empty($social_media['Instagram']))
|
||
<a class="!text-[#d53581] hover:!text-[#c12570] text-[1.1rem] transition-colors" href="{{ $social_media['Instagram'] }}" target="_blank" rel="noopener" onclick="trackEvent('social_click', {platform: 'instagram'})">
|
||
<i class="uil uil-instagram"></i>
|
||
</a>
|
||
@endif
|
||
@if(!empty($social_media['Youtube']))
|
||
<a class="!text-[#c8312b] hover:!text-[#b02822] text-[1.1rem] transition-colors" href="{{ $social_media['Youtube'] }}" target="_blank" rel="noopener" onclick="trackEvent('social_click', {platform: 'youtube'})">
|
||
<i class="uil uil-youtube"></i>
|
||
</a>
|
||
@endif
|
||
</nav>
|
||
<div class="hidden lg:!block xl:!block shrink-0">
|
||
@include("components.custom.language-selector")
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Mobile Menu for Non-Homepage -->
|
||
<div id="offcanvas-nav" class="navbar-collapse offcanvas offcanvas-nav offcanvas-start lg:!hidden xl:!hidden">
|
||
<div class="offcanvas-header flex items-center justify-between flex-row p-6">
|
||
<a href="/">
|
||
{{-- Mobile menu is dark, so we only need the light (white) logo here --}}
|
||
<img class="!h-[2.2rem]" src="{{ asset('assets/img/truncgil-yatay-dark.svg') }}" alt="Truncgil" fetchpriority="high" decoding="async">
|
||
</a>
|
||
<button type="button" class="btn-close !text-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||
</div>
|
||
<div class="offcanvas-body !pt-0">
|
||
<div class="pb-4 mb-2 border-b border-white/10">
|
||
@include('components.custom.language-selector', ['variant' => 'offcanvas'])
|
||
</div>
|
||
<ul class="navbar-nav">
|
||
@foreach($menuItems as $item)
|
||
<x-front.menu-item :item="$item" />
|
||
@endforeach
|
||
</ul>
|
||
</div>
|
||
<div class="offcanvas-body !mt-auto">
|
||
<div class="offcanvas-footer">
|
||
<div>
|
||
<a href="mailto:{{setting('contact_email')}}" class="link-inverse">{{setting('contact_email')}}</a>
|
||
<br> <a href="tel:{{setting('contact_phone')}}">{{setting('contact_phone')}}</a> <br>
|
||
<nav class="nav social social-white !mt-4">
|
||
<?php $social_media = json_decode(setting('social_links'), true); ?>
|
||
<a class="!text-[#cacaca] text-[1rem] transition-all duration-[0.2s] ease-in-out translate-y-0 motion-reduce:transition-none hover:translate-y-[-0.15rem] m-[0_.7rem_0_0]" href="{{ !empty($social_media['Twitter']) ? $social_media['Twitter'] : '#' }}" target="_blank" rel="noopener"><i class="uil uil-twitter before:content-['\ed59'] !text-white text-[1rem]"></i></a>
|
||
<a class="!text-[#cacaca] text-[1rem] transition-all duration-[0.2s] ease-in-out translate-y-0 motion-reduce:transition-none hover:translate-y-[-0.15rem] m-[0_.7rem_0_0]" href="{{ !empty($social_media['Facebook']) ? $social_media['Facebook'] : '#' }}" target="_blank" rel="noopener"><i class="uil uil-facebook-f before:content-['\eae2'] !text-white text-[1rem]"></i></a>
|
||
<a class="!text-[#cacaca] text-[1rem] transition-all duration-[0.2s] ease-in-out translate-y-0 motion-reduce:transition-none hover:translate-y-[-0.15rem] m-[0_.7rem_0_0]" href="{{ !empty($social_media['Github']) ? $social_media['Github'] : '#' }}" target="_blank" rel="noopener"><i class="uil uil-github before:content-['\eb40'] !text-white text-[1rem]"></i></a>
|
||
<a class="!text-[#cacaca] text-[1rem] transition-all duration-[0.2s] ease-in-out translate-y-0 motion-reduce:transition-none hover:translate-y-[-0.15rem] m-[0_.7rem_0_0]" href="{{ !empty($social_media['Instagram']) ? $social_media['Instagram'] : '#' }}" target="_blank" rel="noopener"><i class="uil uil-instagram before:content-['\eb9c'] !text-white text-[1rem]"></i></a>
|
||
<a class="!text-[#cacaca] text-[1rem] transition-all duration-[0.2s] ease-in-out translate-y-0 motion-reduce:transition-none hover:translate-y-[-0.15rem] m-[0_.7rem_0_0]" href="{{ !empty($social_media['Youtube']) ? $social_media['Youtube'] : '#' }}" target="_blank" rel="noopener"><i class="uil uil-youtube before:content-['\edb5'] !text-white text-[1rem]"></i></a>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
</nav>
|
||
</header>
|
||
|
||
<style>
|
||
/* Logo Visibility Fix */
|
||
.logo-dark, .logo-light { display: none !important; }
|
||
.navbar-light .logo-dark, .navbar-dark .logo-light { display: block !important; }
|
||
|
||
/* Sticky scroll: açık arka planda koyu logo */
|
||
.navbar.fixed.navbar-light .logo-dark,
|
||
.navbar.transparent.fixed .logo-dark,
|
||
.navbar-clone.navbar-light .logo-dark {
|
||
display: block !important;
|
||
}
|
||
.navbar.fixed.navbar-light .logo-light,
|
||
.navbar.transparent.fixed .logo-light,
|
||
.navbar-clone.navbar-light .logo-light {
|
||
display: none !important;
|
||
}
|
||
|
||
/* Tema center-logo.fixed kurallarını geçersiz kıl (offcanvas-header hedefli) */
|
||
.navbar.center-logo.fixed .homepage-header-brand .logo-dark,
|
||
.navbar-clone.center-logo .homepage-header-brand .logo-dark {
|
||
display: block !important;
|
||
}
|
||
.navbar.center-logo.fixed .homepage-header-brand .logo-light,
|
||
.navbar-clone.center-logo .homepage-header-brand .logo-light {
|
||
display: none !important;
|
||
}
|
||
|
||
/* Mobil offcanvas menüde yalnızca light logo */
|
||
@media (max-width: 991.98px) {
|
||
.offcanvas .logo-dark { display: none !important; }
|
||
.offcanvas .logo-light { display: block !important; }
|
||
}
|
||
|
||
/* Anasayfa: sol/sağ nav eşit genişlik, logo tam ortada, uzun metinler ellipsis */
|
||
@media (min-width: 992px) {
|
||
.navbar.center-logo .offcanvas-nav {
|
||
display: grid !important;
|
||
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
||
align-items: center;
|
||
width: 100%;
|
||
flex-direction: row !important;
|
||
}
|
||
|
||
.navbar.center-logo .offcanvas-nav > .homepage-header-brand {
|
||
grid-column: 2;
|
||
grid-row: 1;
|
||
position: static;
|
||
z-index: 5;
|
||
width: auto !important;
|
||
max-width: none;
|
||
margin: 0 !important;
|
||
padding: 0 !important;
|
||
transform: none;
|
||
pointer-events: auto;
|
||
justify-content: center !important;
|
||
justify-self: center;
|
||
gap: 0.5rem;
|
||
}
|
||
|
||
.navbar.center-logo .homepage-header-brand__language .navbar-other {
|
||
margin-left: 0 !important;
|
||
}
|
||
|
||
.navbar.center-logo .offcanvas-nav > .homepage-nav-left {
|
||
grid-column: 1;
|
||
grid-row: 1;
|
||
width: 100% !important;
|
||
min-width: 0;
|
||
flex: none !important;
|
||
display: flex !important;
|
||
justify-content: flex-end;
|
||
align-items: center;
|
||
}
|
||
|
||
.navbar.center-logo .offcanvas-nav > .homepage-nav-right {
|
||
grid-column: 3;
|
||
grid-row: 1;
|
||
width: 100% !important;
|
||
min-width: 0;
|
||
flex: none !important;
|
||
display: flex !important;
|
||
justify-content: flex-start;
|
||
align-items: center;
|
||
}
|
||
|
||
.navbar.center-logo .homepage-nav-panel .navbar-nav {
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
width: 100%;
|
||
min-width: 0;
|
||
margin: 0;
|
||
}
|
||
|
||
.navbar.center-logo .homepage-nav-left .navbar-nav {
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.navbar.center-logo .homepage-nav-right .navbar-nav {
|
||
justify-content: flex-start;
|
||
}
|
||
|
||
.navbar.center-logo .homepage-nav-panel .nav-item {
|
||
min-width: 0;
|
||
flex: 0 1 auto;
|
||
}
|
||
|
||
.navbar.center-logo .homepage-nav-panel .nav-link {
|
||
display: block;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
max-width: 100%;
|
||
}
|
||
}
|
||
|
||
.tooltip.homepage-nav-tooltip .tooltip-inner {
|
||
max-width: none;
|
||
white-space: nowrap;
|
||
background-color: rgba(33, 38, 44, 0.95);
|
||
font-size: 0.8125rem;
|
||
font-weight: 600;
|
||
padding: 0.35rem 0.65rem;
|
||
}
|
||
|
||
.tooltip.homepage-nav-tooltip.bs-tooltip-bottom .tooltip-arrow::before {
|
||
border-bottom-color: rgba(33, 38, 44, 0.95);
|
||
}
|
||
|
||
.tooltip.homepage-nav-tooltip.bs-tooltip-top .tooltip-arrow::before {
|
||
border-top-color: rgba(33, 38, 44, 0.95);
|
||
}
|
||
|
||
/* Smoother Offcanvas Menu Transition */
|
||
.offcanvas {
|
||
transition: transform 0.4s cubic-bezier(0.77, 0.2, 0.05, 1.0) !important;
|
||
}
|
||
.offcanvas-backdrop {
|
||
transition: opacity 0.4s ease !important;
|
||
}
|
||
|
||
/* Fluid Hamburger Animation */
|
||
.hamburger {
|
||
transition: all 0.3s ease-in-out;
|
||
}
|
||
.hamburger span,
|
||
.hamburger::before,
|
||
.hamburger::after {
|
||
transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
|
||
}
|
||
.hamburger.is-active span {
|
||
background-color: transparent !important;
|
||
}
|
||
.hamburger.is-active::before {
|
||
transform: translateY(6px) rotate(45deg) !important;
|
||
}
|
||
.hamburger.is-active::after {
|
||
transform: translateY(-6px) rotate(-45deg) !important;
|
||
}
|
||
|
||
@media (max-width: 991.98px) {
|
||
header nav > .container > .flex.xl\:!hidden .language-select,
|
||
header .navbar-collapse-wrapper .language-select {
|
||
display: none !important;
|
||
}
|
||
|
||
.offcanvas .language-select-offcanvas__toggle[aria-expanded="true"] .language-select-offcanvas__icon {
|
||
transform: rotate(180deg);
|
||
}
|
||
}
|
||
</style>
|
||
|
||
<script>
|
||
function initHomepageNavEllipsisTooltips() {
|
||
if (window.matchMedia('(max-width: 991.98px)').matches) {
|
||
return;
|
||
}
|
||
|
||
document.querySelectorAll('.navbar.center-logo .homepage-nav-panel .nav-link').forEach(function(link) {
|
||
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip) {
|
||
var existingTooltip = bootstrap.Tooltip.getInstance(link);
|
||
if (existingTooltip) {
|
||
existingTooltip.dispose();
|
||
}
|
||
}
|
||
|
||
link.removeAttribute('title');
|
||
|
||
if (link.scrollWidth <= link.clientWidth) {
|
||
return;
|
||
}
|
||
|
||
var fullText = link.textContent.trim();
|
||
if (!fullText) {
|
||
return;
|
||
}
|
||
|
||
if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip) {
|
||
new bootstrap.Tooltip(link, {
|
||
title: fullText,
|
||
trigger: 'hover',
|
||
placement: 'bottom',
|
||
customClass: 'homepage-nav-tooltip',
|
||
container: 'body',
|
||
});
|
||
} else {
|
||
link.setAttribute('title', fullText);
|
||
}
|
||
});
|
||
}
|
||
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
var offcanvases = document.querySelectorAll('.offcanvas-nav');
|
||
var hamburgers = document.querySelectorAll('.hamburger.offcanvas-nav-btn');
|
||
|
||
if (offcanvases.length > 0 && hamburgers.length > 0) {
|
||
offcanvases.forEach(function(oc) {
|
||
oc.addEventListener('show.bs.offcanvas', function () {
|
||
hamburgers.forEach(function(h) { h.classList.add('is-active'); });
|
||
});
|
||
oc.addEventListener('hide.bs.offcanvas', function () {
|
||
hamburgers.forEach(function(h) { h.classList.remove('is-active'); });
|
||
});
|
||
});
|
||
}
|
||
|
||
initHomepageNavEllipsisTooltips();
|
||
|
||
if (document.fonts && document.fonts.ready) {
|
||
document.fonts.ready.then(initHomepageNavEllipsisTooltips);
|
||
}
|
||
|
||
var resizeTimer;
|
||
window.addEventListener('resize', function() {
|
||
clearTimeout(resizeTimer);
|
||
resizeTimer = setTimeout(initHomepageNavEllipsisTooltips, 150);
|
||
});
|
||
});
|
||
</script>
|