Hide sidebar on home and center category grid
This commit is contained in:
@@ -448,10 +448,30 @@ a:hover {
|
|||||||
|
|
||||||
/* ─── Category Grid ──────────────────────────────────────── */
|
/* ─── Category Grid ──────────────────────────────────────── */
|
||||||
|
|
||||||
|
.category-section {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding: clamp(1.5rem, 3vw, 3rem) clamp(1rem, 2vw, 2.5rem);
|
||||||
|
}
|
||||||
|
.category-section__inner {
|
||||||
|
width: min(1200px, 100%);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
.category-section .section-heading {
|
||||||
|
text-align: center;
|
||||||
|
margin: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
.category-grid {
|
.category-grid {
|
||||||
|
width: 100%;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||||||
gap: 1rem;
|
gap: clamp(0.75rem, 1.3vw, 1.25rem);
|
||||||
|
justify-items: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ─── Calculator List (category page) ────────────────────── */
|
/* ─── Calculator List (category page) ────────────────────── */
|
||||||
@@ -589,8 +609,14 @@ a:hover {
|
|||||||
.hero h1 {
|
.hero h1 {
|
||||||
font-size: 1.8rem;
|
font-size: 1.8rem;
|
||||||
}
|
}
|
||||||
|
.category-section {
|
||||||
|
padding: 1.25rem 1rem 2rem;
|
||||||
|
}
|
||||||
|
.category-section__inner {
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
.category-grid {
|
.category-grid {
|
||||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||||
}
|
}
|
||||||
.stats-row {
|
.stats-row {
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
import { page } from '$app/stores';
|
||||||
|
|
||||||
import '../app.css';
|
import '../app.css';
|
||||||
import Sidebar from '$lib/components/Sidebar.svelte';
|
import Sidebar from '$lib/components/Sidebar.svelte';
|
||||||
@@ -254,6 +255,10 @@
|
|||||||
let sidebarOpen = false;
|
let sidebarOpen = false;
|
||||||
let theme: ThemeMode = 'dark';
|
let theme: ThemeMode = 'dark';
|
||||||
let selectedPaletteIndex = 0;
|
let selectedPaletteIndex = 0;
|
||||||
|
$: isHomepage = $page.url.pathname === '/';
|
||||||
|
$: if (isHomepage && sidebarOpen) {
|
||||||
|
sidebarOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
const applyPalette = (index: number, persist = false) => {
|
const applyPalette = (index: number, persist = false) => {
|
||||||
const normalizedIndex = Math.max(0, Math.min(index, palettes.length - 1));
|
const normalizedIndex = Math.max(0, Math.min(index, palettes.length - 1));
|
||||||
@@ -337,9 +342,11 @@
|
|||||||
|
|
||||||
<header class="site-header">
|
<header class="site-header">
|
||||||
<div style="display:flex;align-items:center;gap:0.75rem;">
|
<div style="display:flex;align-items:center;gap:0.75rem;">
|
||||||
|
{#if !isHomepage}
|
||||||
<button class="hamburger" on:click={() => (sidebarOpen = !sidebarOpen)} aria-label="Toggle menu">
|
<button class="hamburger" on:click={() => (sidebarOpen = !sidebarOpen)} aria-label="Toggle menu">
|
||||||
☰
|
☰
|
||||||
</button>
|
</button>
|
||||||
|
{/if}
|
||||||
<a href="/" class="site-logo">
|
<a href="/" class="site-logo">
|
||||||
<span>How Do You</span><span class="logo-accent">Convert</span><span style="opacity:0.4;font-weight:400">.com</span>
|
<span>How Do You</span><span class="logo-accent">Convert</span><span style="opacity:0.4;font-weight:400">.com</span>
|
||||||
</a>
|
</a>
|
||||||
@@ -350,7 +357,9 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="site-body">
|
<div class="site-body">
|
||||||
|
{#if !isHomepage}
|
||||||
<Sidebar bind:open={sidebarOpen} />
|
<Sidebar bind:open={sidebarOpen} />
|
||||||
|
{/if}
|
||||||
<main class="main-content">
|
<main class="main-content">
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -32,9 +32,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class="section-heading">Browse by Category</h2>
|
<section class="category-section">
|
||||||
<div class="category-grid">
|
<div class="category-section__inner">
|
||||||
|
<h2 class="section-heading">Browse by Category</h2>
|
||||||
|
<div class="category-grid">
|
||||||
{#each cats as cat}
|
{#each cats as cat}
|
||||||
<CategoryCard icon={cat.icon} label={cat.label} href="/category/{cat.key}" />
|
<CategoryCard icon={cat.icon} label={cat.label} href="/category/{cat.key}" />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user