İçeriğe geç
Tüm kodlar

ER3NSHOP

Kurulum sihirbazlı online mağaza sistemi

114 satır · 6,8 KBHamİndir
<?php
$layout = theme('header_layout');
$menu = header_menu();
?>
<!doctype html>
<html lang="tr">
<head>
    <?php tailwind_head() ?>
    <title><?= e(page_title($title)) ?></title>
    <?= seo_head($title, $meta) ?>
</head>
<body class="flex min-h-screen flex-col bg-page font-sans text-body antialiased">
<?= setting('body_code', '') ?>

<?php if (theme_draft() !== null): ?>
    <div class="relative z-50 flex flex-wrap items-center justify-center gap-3 bg-amber-400 px-4 py-2 text-center text-[13px] font-medium text-amber-950">
        Kaydedilmemiş tema önizlemesini görüyorsunuz.
        <a href="<?= admin_url('tema') ?>" class="underline underline-offset-4">Temaya dön</a>
    </div>
<?php endif ?>

<div data-announcement-bar data-customize="header" data-customize-label="Duyuru bandı" style="background-color: <?= e(hex_color(theme('announce_bg'), '#0a0a0a')) ?>; color: <?= e(hex_color(theme('announce_text'), '#ffffff')) ?>">
    <div data-announcement class="container-x flex h-9 items-center justify-center text-center text-[12px] font-medium tracking-wide">
        <?php if (site_setting('announcement')): ?>
            <?= e(site_setting('announcement')) ?>
        <?php elseif (setting('free_shipping_limit') > 0): ?>
            <?= money(setting('free_shipping_limit')) ?> ve üzeri siparişlerde ücretsiz kargo
        <?php else: ?>
            Güvenli alışveriş, hızlı teslimat
        <?php endif ?>
    </div>
</div>

<header data-customize="header" data-customize-label="Üst bölüm" class="<?= theme_on('header_sticky') ? 'sticky top-0' : 'relative' ?> z-30 border-b border-zinc-200/70 bg-page/90 backdrop-blur-xl backdrop-saturate-150">
    <?php ob_start() ?>
        <nav class="hidden items-center gap-1 lg:flex">
            <?php foreach ($menu as $item): ?>
                <div class="group relative">
                    <a href="<?= e($item['href']) ?>" class="inline-flex items-center gap-1 rounded-lg px-3 py-2 text-[13px] font-medium transition hover:text-ink <?= menu_is_active($item['href']) ? 'text-ink' : 'text-zinc-700' ?>">
                        <?= e($item['label']) ?>
                        <?php if ($item['children']): ?><?= icon('down', 'size-3.5 text-zinc-400 transition group-hover:rotate-180', '2') ?><?php endif ?>
                    </a>
                    <?php if ($item['children']): ?>
                        <div class="invisible absolute top-full left-0 z-40 pt-2 opacity-0 transition duration-200 group-hover:visible group-hover:opacity-100">
                            <div class="w-60 rounded-2xl border border-zinc-200/80 bg-white p-2 shadow-xl shadow-zinc-900/5">
                                <?php foreach ($item['children'] as $child): ?>
                                    <a href="<?= e($child['href']) ?>" class="block rounded-lg px-3 py-2 text-sm text-zinc-600 hover:bg-zinc-50 hover:text-ink"><?= e($child['label']) ?></a>
                                <?php endforeach ?>
                                <a href="<?= e($item['href']) ?>" class="mt-1 block rounded-lg border-t border-zinc-100 px-3 py-2 text-sm font-medium text-ink hover:bg-zinc-50">Tümünü gör</a>
                            </div>
                        </div>
                    <?php endif ?>
                </div>
            <?php endforeach ?>
        </nav>
    <?php $nav = ob_get_clean() ?>

    <?php ob_start() ?>
        <div class="flex items-center justify-end gap-0.5 sm:gap-1">
            <button type="button" data-search-toggle class="btn-ghost p-2.5" aria-label="Ara"><?= icon('search', 'size-[22px]') ?></button>
            <a href="<?= url(is_customer() ? 'hesabim' : 'giris') ?>" class="btn-ghost hidden p-2.5 sm:inline-flex" aria-label="Hesabım"><?= icon('user', 'size-[22px]') ?></a>
            <button type="button" data-open-drawer="favorites" class="btn-ghost relative p-2.5" aria-label="Favorilerim">
                <?= icon('heart', 'size-[22px]') ?>
                <span data-favorite-count class="<?= favorite_count() ? '' : 'hidden' ?> absolute top-1 right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-ink px-1 text-[10px] font-bold text-white"><?= favorite_count() ?></span>
            </button>
            <button type="button" data-open-drawer="cart" class="btn-ghost relative p-2.5" aria-label="Sepetim">
                <?= icon('bag', 'size-[22px]') ?>
                <span data-cart-count class="<?= cart_count() ? '' : 'hidden' ?> absolute top-1 right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-accent-600 px-1 text-[10px] font-bold text-white"><?= cart_count() ?></span>
            </button>
        </div>
    <?php $actions = ob_get_clean() ?>

    <?php $logo = '<a href="' . url() . '" data-customize="kimlik" data-customize-label="Logo" class="flex shrink-0 items-center text-ink">' . logo_html() . '</a>' ?>
    <?php $burger = '<button type="button" data-open-drawer="menu" class="btn-ghost -ml-3 p-2.5 lg:hidden" aria-label="Menü">' . icon('menu', 'size-6') . '</button>' ?>

    <?php if ($layout === 'left'): ?>
        <div class="container-x flex h-[72px] items-center gap-6">
            <?= $burger ?><?= $logo ?>
            <div class="flex-1"><?= $nav ?></div>
            <?= $actions ?>
        </div>
    <?php elseif ($layout === 'stacked'): ?>
        <div class="container-x grid h-[72px] grid-cols-[1fr_auto_1fr] items-center gap-4">
            <div><?= $burger ?></div>
            <?= $logo ?>
            <?= $actions ?>
        </div>
        <div class="hidden border-t border-zinc-100 lg:block">
            <div class="container-x flex justify-center py-1.5"><?= $nav ?></div>
        </div>
    <?php else: ?>
        <div class="container-x grid h-[72px] grid-cols-[1fr_auto_1fr] items-center gap-4">
            <div class="flex items-center gap-1"><?= $burger ?><?= $nav ?></div>
            <?= $logo ?>
            <?= $actions ?>
        </div>
    <?php endif ?>

    <div id="search-panel" class="absolute inset-x-0 top-full hidden border-b border-zinc-200 bg-white shadow-xl shadow-zinc-900/5 data-open:block">
        <form action="<?= url('arama') ?>" class="container-x flex items-center gap-4 py-6">
            <?= icon('search', 'size-6 text-zinc-400') ?>
            <input name="q" value="<?= e(get('q')) ?>" placeholder="Ne aramıştınız?" autocomplete="off" data-live-search class="font-display w-full bg-transparent text-2xl font-medium tracking-tight placeholder:text-zinc-300 focus:outline-none sm:text-3xl">
            <button type="button" data-search-toggle class="btn-ghost p-2.5"><?= icon('x', 'size-6') ?></button>
        </form>
        <div id="search-results" class="container-x empty:hidden"></div>
    </div>
</header>

<main class="flex-1">
    <?php if ($flashes = flashes()): ?>
        <div class="container-x pt-6">
            <?php include PARTS . '/flash.php' ?>
        </div>
    <?php endif ?>

Lisans bilgisi projenin LICENSE dosyasında.