Kód snippet

Névtelen

Nincs leírás

centered-header
<header-context (loaded)="hdr = $event"/>

    <style>
        /* --- CSAK A HEADER STÍLUSAI --- */
        .header-container {
            display: flex;
            align-items: center;
            padding: 0 5%;
            height: 100px;
            /* Megemelt magasság a nagyobb logónak */
            background: #ffffff;
            border-bottom: 1px solid #eaeaea;
            position: sticky;

        }

        /* Logó méretezése */
        .header-logo-img {
            height: 100px;
            /* Nagyobb logó */
            width: auto;
            transition: height 0.3s ease;
        }

        /* Menü középre igazítása */
        .desktop-nav-center {
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 30px;
        }

        .nav-item-link {
            text-decoration: none;
            color: #666;
            font-size: 14px;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        /* Hover animáció a menüpontokhoz */
        .nav-item-link {
            position: relative;
            transition: color 0.3s ease;
        }

        .nav-item-link:hover {
            color: #1a1a1a;
            /* Sötétebb szín hoverre */
        }

        .nav-item-link::after {
            content: '';
            position: absolute;
            width: 0;
            height: 1.5px;
            bottom: -5px;
            left: 50%;
            background-color: #4a5d4e;
            /* A márka zöldes színe */
            transition: all 0.3s ease;
            transform: translateX(-50%);
        }

        .nav-item-link:hover::after {
            width: 100%;
            /* Szépen kihúzódik a vonal */
        }

        /* Mobil hamburger */
        .burger-btn {
            display: none;
            flex-direction: column;
            justify-content: space-around;
            width: 24px;
            height: 18px;
            background: transparent;
            border: none;
            cursor: pointer;
            padding: 0;
            z-index: 10;
        }

        .burger-line {
            width: 24px;
            height: 2px;
            background-color: #333;
            border-radius: 10px;
        }

        /* Mobil Drawer */
        .drawer-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.4);
            backdrop-filter: blur(2px);
            z-index: 10001;
        }

        .drawer-content {
            position: fixed;
            top: 0;
            left: 0;
            width: 300px;
            height: 100%;
            background: white;
            z-index: 10002;
            display: flex;
            flex-direction: column;
            box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
            animation: slideIn 0.25s ease-out;
        }

        @keyframes slideIn {
            from {
                transform: translateX(-100%);
            }

            to {
                transform: translateX(0);
            }
        }

        /* --- RESPONSIVE --- */
        @media (max-width: 850px) {
            .desktop-only {
                display: none !important;
            }

            .desktop-nav-center {
                display: none !important;
            }

            .burger-btn {
                display: flex !important;
            }

            .header-container {
                height: 70px;
                justify-content: space-between;
            }

            .header-logo-img {
                height: 35px;
            }
        }
    </style>

    <if [condition]="hdr">
        <div class="header-container">
            <div class="burger-btn" (click)="hdr.menuOpen = true">
                <div class="burger-line"/>
                <div class="burger-line"/>
                <div class="burger-line"/>
            </div>

            <a [href]="hdr.navigation.homeUrl" style="display: flex; align-items: center; z-index: 11;">
                <img [src]="hdr.branding.logoUrl" class="header-logo-img"/>
            </a>

            <div class="desktop-nav-center">
                <loop [data]="hdr.navigation.entries" let="navItem">
                    <a [href]="navItem.url" class="nav-item-link">
                        {{ navItem.title }}
                    </a>
                </loop>
            </div>

            <div style="flex: 1;"/>

            <div style="display: flex; align-items: center; gap: 16px; z-index: 11;">
                <div class="desktop-only" style="font-size: 14px;">
                    <if [condition]="hdr.user.isLoggedIn">
                        <span style="color: #444;">{{ hdr.user.name }}</span>
                    </if>
                </div>
                <cart-button-1/>
            </div>

            <if [condition]="hdr.menuOpen">
                <div class="drawer-overlay" (click)="hdr.menuOpen = false"/>
                <div class="drawer-content">
                    <div style="padding: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee;">
                        <img [src]="hdr.branding.logoUrl" style="height: 24px;"/>
                        <div (click)="hdr.menuOpen = false" style="font-size: 28px; cursor: pointer;"/>
                    </div>
                    <div style="display: flex; flex-direction: column; overflow-y: auto;">
                        <loop [data]="hdr.navigation.entries" let="mItem">
                            <a [href]="mItem.url" style="padding: 16px 20px; text-decoration: none; color: #333; border-bottom: 1px solid #f9f9f9;" (click)="hdr.menuOpen = false">
                                {{ mItem.title }}
                            </a>
                        </loop>
                    </div>
                </div>
            </if>
        </div>
    </if>