mirror of
https://github.com/lissy93/networking-toolbox.git
synced 2026-12-01 09:22:25 +03:00
Close burger on click, add dns landing page, split homepage
This commit is contained in:
1 parent
ce789cc8bf
commit
d64545657b
4 files changed
+169
-6
No files matched your search
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { SUB_NAV } from '$lib/constants/nav';
|
||||
import Icon from './Icon.svelte';
|
||||
import { type NavItem, type NavGroup, footerLinks } from '$lib/constants/nav';
|
||||
@@ -33,6 +34,11 @@
|
||||
isOpen = false;
|
||||
}
|
||||
|
||||
// Check if a link is currently active
|
||||
function isActiveLink(href: string): boolean {
|
||||
return $page.url.pathname === href || $page.url.pathname.startsWith(href + '/');
|
||||
}
|
||||
|
||||
|
||||
// Get nav groups for organized display
|
||||
function getNavGroups(items: (NavItem | NavGroup)[]): { title: string; items: NavItem[] }[] {
|
||||
@@ -91,7 +97,7 @@
|
||||
|
||||
<!-- Menu Overlay -->
|
||||
{#if isOpen}
|
||||
<div class="menu-overlay" aria-hidden="true"></div>
|
||||
<div class="menu-overlay" aria-hidden="true" on:click={() => isOpen = false}></div>
|
||||
{/if}
|
||||
|
||||
<!-- Menu Content -->
|
||||
@@ -136,6 +142,7 @@
|
||||
<a
|
||||
href={item.href}
|
||||
class="menu-item"
|
||||
class:active={isActiveLink(item.href)}
|
||||
on:click={handleLinkClick}
|
||||
title={item.description}
|
||||
aria-label={`${item.label}: ${item.description}`}
|
||||
@@ -154,6 +161,7 @@
|
||||
<a
|
||||
href={item.href}
|
||||
class="menu-item"
|
||||
class:active={isActiveLink(item.href)}
|
||||
on:click={handleLinkClick}
|
||||
title={item.description}
|
||||
aria-label={`${item.label}: ${item.description}`}
|
||||
@@ -361,6 +369,14 @@
|
||||
padding-bottom: var(--spacing-xs);
|
||||
border-bottom: 1px solid var(--border-secondary);
|
||||
}
|
||||
|
||||
&.active h3 {
|
||||
color: var(--color-primary);
|
||||
background-color: rgba(var(--color-primary-rgb), 0.1);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-md);
|
||||
border-bottom-color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.menu-group {
|
||||
@@ -408,6 +424,23 @@
|
||||
outline: 2px solid var(--color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: var(--color-primary);
|
||||
color: var(--bg-primary);
|
||||
font-weight: 600;
|
||||
transform: translateX(4px);
|
||||
|
||||
:global(.icon) {
|
||||
color: var(--bg-primary);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: var(--color-primary);
|
||||
color: var(--bg-primary);
|
||||
transform: translateX(6px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-label {
|
||||
|
||||
+85
-4
@@ -1,11 +1,50 @@
|
||||
<script lang="ts">
|
||||
import '../styles/pages.scss';
|
||||
import { site, pages, about } from '$lib/constants/site';
|
||||
import { ALL_PAGES, type NavItem } from '$lib/constants/nav';
|
||||
import { ALL_PAGES, SUB_NAV, type NavItem, type NavGroup } from '$lib/constants/nav';
|
||||
import ToolsGrid from '$lib/components/ToolsGrid.svelte';
|
||||
import SearchFilter from '$lib/components/SearchFilter.svelte';
|
||||
let filteredTools: NavItem[] = $state(ALL_PAGES);
|
||||
|
||||
// Helper function to extract nav items from mixed structure
|
||||
function extractNavItems(items: (NavItem | NavGroup)[]): NavItem[] {
|
||||
const navItems: NavItem[] = [];
|
||||
for (const item of items) {
|
||||
if ('href' in item) {
|
||||
navItems.push(item);
|
||||
} else if ('title' in item && 'items' in item) {
|
||||
navItems.push(...item.items);
|
||||
}
|
||||
}
|
||||
return navItems;
|
||||
}
|
||||
|
||||
// Separate tools from reference pages
|
||||
const referencePages = extractNavItems(SUB_NAV['/reference'] || []);
|
||||
const toolPages = ALL_PAGES.filter(page => !page.href.startsWith('/reference'));
|
||||
|
||||
let filteredTools: NavItem[] = $state(toolPages);
|
||||
let filteredReference: NavItem[] = $state(referencePages);
|
||||
let searchQuery: string = $state('');
|
||||
|
||||
// Update filtered items when search changes
|
||||
$effect(() => {
|
||||
if (searchQuery.trim() === '') {
|
||||
filteredTools = toolPages;
|
||||
filteredReference = referencePages;
|
||||
} else {
|
||||
const query = searchQuery.toLowerCase().trim();
|
||||
filteredTools = toolPages.filter(tool =>
|
||||
tool.label.toLowerCase().includes(query) ||
|
||||
tool.description.toLowerCase().includes(query) ||
|
||||
tool.keywords?.some(keyword => keyword.toLowerCase().includes(query))
|
||||
);
|
||||
filteredReference = referencePages.filter(page =>
|
||||
page.label.toLowerCase().includes(query) ||
|
||||
page.description.toLowerCase().includes(query) ||
|
||||
page.keywords?.some(keyword => keyword.toLowerCase().includes(query))
|
||||
);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -30,8 +69,26 @@
|
||||
<!-- Search Filter -->
|
||||
<SearchFilter bind:filteredTools bind:searchQuery />
|
||||
|
||||
<!-- Tools Grid -->
|
||||
<ToolsGrid tools={filteredTools} {searchQuery} />
|
||||
{#if searchQuery.trim() === ''}
|
||||
<!-- Tools Grid -->
|
||||
<ToolsGrid tools={filteredTools} {searchQuery} />
|
||||
|
||||
<!-- Reference Pages Section -->
|
||||
{#if filteredReference.length > 0}
|
||||
<section class="reference-section">
|
||||
<div class="section-header">
|
||||
<h2>Reference & Documentation</h2>
|
||||
<p class="section-description">
|
||||
Comprehensive reference materials and documentation for network professionals.
|
||||
</p>
|
||||
</div>
|
||||
<ToolsGrid tools={filteredReference} {searchQuery} />
|
||||
</section>
|
||||
{/if}
|
||||
{:else}
|
||||
<!-- Combined Search Results -->
|
||||
<ToolsGrid tools={[...filteredTools, ...filteredReference]} {searchQuery} />
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
/* Homepage specific styles */
|
||||
@@ -63,5 +120,29 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.reference-section {
|
||||
margin-top: var(--spacing-xl);
|
||||
|
||||
.section-header {
|
||||
text-align: center;
|
||||
margin-bottom: var(--spacing-lg);
|
||||
|
||||
h2 {
|
||||
font-size: var(--font-size-xl);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.section-description {
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--text-secondary);
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<script lang="ts">
|
||||
import { site } from '$lib/constants/site';
|
||||
import { SUB_NAV } from '$lib/constants/nav';
|
||||
import ToolsGrid from '$lib/components/ToolsGrid.svelte';
|
||||
import type { NavItem, NavGroup } from '$lib/constants/nav';
|
||||
import '../../styles/pages.scss';
|
||||
|
||||
// Extract tools for DNS section
|
||||
function extractNavItems(items: (NavItem | NavGroup)[]): NavItem[] {
|
||||
const navItems: NavItem[] = [];
|
||||
for (const item of items) {
|
||||
if ('href' in item) {
|
||||
navItems.push(item);
|
||||
} else if ('title' in item && 'items' in item) {
|
||||
navItems.push(...item.items);
|
||||
}
|
||||
}
|
||||
return navItems;
|
||||
}
|
||||
|
||||
const dnsTools = extractNavItems(SUB_NAV['/dns'] || []);
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>DNS Tools & Record Generators | {site.title}</title>
|
||||
<meta name="description" content="Professional DNS tools for generating PTR records, reverse DNS lookups, and zone file management for IPv4 and IPv6 networks." />
|
||||
<meta name="keywords" content="{site.keywords}, DNS tools, PTR records, reverse DNS, in-addr.arpa, ip6.arpa, zone files, DNS generators" />
|
||||
<meta property="og:title" content="DNS Tools & Record Generators" />
|
||||
<meta property="og:description" content="Professional DNS tools for network engineers including PTR record generation and reverse DNS management." />
|
||||
<meta property="og:url" content="{site.url}/dns" />
|
||||
</svelte:head>
|
||||
|
||||
<div class="page-container">
|
||||
<header class="page-header">
|
||||
<h1>DNS Tools & Record Generators</h1>
|
||||
<p class="page-description">
|
||||
Professional DNS management tools for network administrators.
|
||||
Generate PTR records, create zone files, and manage reverse DNS lookups for both IPv4 and IPv6 networks.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<ToolsGrid tools={dnsTools} />
|
||||
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
|
||||
<ToolsGrid tools={ipTools} />
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in new issue
Block a user