Search functionality

This commit is contained in:
Alicia Sykes committed 2025-09-02 05:59:01 +01:00
1 parent 6d779f5e2f
commit bf0ff73bf4
8 files changed
+631 -24

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@
</div>
<div>
<h1><a href="/">{site.title}</a></h1>
<p class="subtitle">Network Reference</p>
<p class="subtitle">The sysadmin's Swiss Army knife</p>
</div>
</div>
+2
View File
@@ -194,6 +194,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M64 320C64 337.7 78.3 352 96 352L466.7 352L498.7 320L466.7 288L96 288C78.3 288 64 302.3 64 320z"/><path d="M566.6 297.4C579.1 309.9 579.1 330.2 566.6 342.7L406.6 502.7C394.1 515.2 373.8 515.2 361.3 502.7C348.8 490.2 348.8 469.9 361.3 457.4L498.7 320L361.4 182.6C348.9 170.1 348.9 149.8 361.4 137.3C373.9 124.8 394.2 124.8 406.7 137.3L566.7 297.3z"/></svg>
{:else if name === 'previous'}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M141.3 320L173.3 352L544 352C561.7 352 576 337.7 576 320C576 302.3 561.7 288 544 288L173.3 288L141.3 320z"/><path d="M73.4 342.6C60.9 330.1 60.9 309.8 73.4 297.3L233.4 137.3C245.9 124.8 266.2 124.8 278.7 137.3C291.2 149.8 291.2 170.1 278.7 182.6L141.3 320L278.6 457.4C291.1 469.9 291.1 490.2 278.6 502.7C266.1 515.2 245.8 515.2 233.3 502.7L73.3 342.7z"/></svg>
{:else if name === 'search'}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M128 272C128 351.5 192.5 416 272 416C351.5 416 416 351.5 416 272C416 192.5 351.5 128 272 128C192.5 128 128 192.5 128 272z"/><path d="M480 272C480 317.9 465.1 360.3 440 394.7L566.6 521.4C579.1 533.9 579.1 554.2 566.6 566.7C554.1 579.2 533.8 579.2 521.3 566.7L394.7 440C360.3 465.1 317.9 480 272 480C157.1 480 64 386.9 64 272C64 157.1 157.1 64 272 64C386.9 64 480 157.1 480 272zM272 416C351.5 416 416 351.5 416 272C416 192.5 351.5 128 272 128C192.5 128 128 192.5 128 272C128 351.5 192.5 416 272 416z"/></svg>
{:else if name === 'draggable'}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path opacity=".4" d="M119.8 320L160 353.5L160 286.5L119.8 320zM286.5 160L353.5 160L320 119.8L286.5 160zM286.5 480L320 520.2L353.5 480L286.5 480zM480 286.5L480 353.5L520.2 320L480 286.5z"/><path d="M320 119.8L353.5 160L286.5 160L320 119.8zM293.8 76.3L232.2 150.2C226.9 156.5 224 164.5 224 172.8C224 192.3 239.8 208 259.2 208L296 208L296 296L208 296L208 259.2C208 239.7 192.2 224 172.8 224C164.6 224 156.6 226.9 150.2 232.2L76.3 293.8C68.5 300.2 64 309.9 64 320C64 330.1 68.5 339.8 76.3 346.2L150.2 407.8C156.5 413.1 164.5 416 172.8 416C192.3 416 208 400.2 208 380.8L208 344L296 344L296 432L259.2 432C239.7 432 224 447.8 224 467.2C224 475.4 226.9 483.4 232.2 489.8L293.8 563.7C300.3 571.5 309.9 576 320 576C330.1 576 339.8 571.5 346.2 563.7L407.8 489.8C413.1 483.5 416 475.5 416 467.2C416 447.7 400.2 432 380.8 432L344 432L344 344L432 344L432 380.8C432 400.3 447.8 416 467.2 416C475.4 416 483.4 413.1 489.8 407.8L563.7 346.2C571.5 339.7 576 330.1 576 320C576 309.9 571.5 300.2 563.7 293.8L489.8 232.2C483.5 226.9 475.5 224 467.2 224C447.7 224 432 239.8 432 259.2L432 296L344 296L344 208L380.8 208C400.3 208 416 192.2 416 172.8C416 164.6 413.1 156.6 407.8 150.2L346.2 76.3C339.8 68.5 330.1 64 320 64C309.9 64 300.2 68.5 293.8 76.3zM320 520.2L286.5 480L353.5 480L320 520.2zM520.2 320L480 353.5L480 286.5L520.2 320zM160 353.5L119.8 320L160 286.5L160 353.5z"/></svg>
{:else}
+143
View File
@@ -0,0 +1,143 @@
<script lang="ts">
import Icon from './Icon.svelte';
export let searchQuery: string = '';
</script>
<div class="no-results-card">
<div class="no-results-content">
<Icon name="search-x" size="xl" class="no-results-icon" />
<h3>No tools found</h3>
<p>
{#if searchQuery}
No results found for <strong>"{searchQuery}"</strong>
{:else}
Try a different search term
{/if}
</p>
<div class="suggestions">
<h4>Try searching for:</h4>
<div class="suggestion-tags">
<button class="suggestion-tag" onclick={() => window.dispatchEvent(new CustomEvent('search-suggestion', { detail: 'subnet' }))}>
subnet
</button>
<button class="suggestion-tag" onclick={() => window.dispatchEvent(new CustomEvent('search-suggestion', { detail: 'cidr' }))}>
cidr
</button>
<button class="suggestion-tag" onclick={() => window.dispatchEvent(new CustomEvent('search-suggestion', { detail: 'ipv6' }))}>
ipv6
</button>
<button class="suggestion-tag" onclick={() => window.dispatchEvent(new CustomEvent('search-suggestion', { detail: 'converter' }))}>
converter
</button>
<button class="suggestion-tag" onclick={() => window.dispatchEvent(new CustomEvent('search-suggestion', { detail: 'calculator' }))}>
calculator
</button>
</div>
</div>
</div>
</div>
<style lang="scss">
.no-results-card {
max-width: 600px;
margin: var(--spacing-xl) auto;
padding: var(--spacing-xl);
text-align: center;
background-color: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
}
.no-results-content {
display: flex;
flex-direction: column;
align-items: center;
gap: var(--spacing-md);
}
:global(.no-results-icon) {
color: var(--text-secondary);
opacity: 0.7;
}
h3 {
font-size: var(--font-size-xl);
font-weight: 600;
color: var(--text-primary);
margin: 0;
}
p {
color: var(--text-secondary);
font-size: var(--font-size-md);
line-height: 1.6;
margin: 0;
strong {
color: var(--color-primary);
font-weight: 600;
}
}
.suggestions {
margin-top: var(--spacing-lg);
width: 100%;
h4 {
font-size: var(--font-size-sm);
color: var(--text-secondary);
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.5px;
margin: 0 0 var(--spacing-md) 0;
}
}
.suggestion-tags {
display: flex;
flex-wrap: wrap;
gap: var(--spacing-sm);
justify-content: center;
}
.suggestion-tag {
padding: var(--spacing-xs) var(--spacing-md);
background-color: var(--bg-tertiary);
border: 1px solid var(--border-secondary);
border-radius: var(--radius-md);
color: var(--text-primary);
font-size: var(--font-size-sm);
font-family: var(--font-mono);
cursor: pointer;
transition: all var(--transition-fast);
&:hover {
background-color: var(--surface-hover);
border-color: var(--color-primary);
color: var(--color-primary);
transform: translateY(-1px);
}
&:focus-visible {
outline: 2px solid var(--color-primary);
outline-offset: 2px;
}
&:active {
transform: translateY(0);
}
}
@media (max-width: 768px) {
.no-results-card {
padding: var(--spacing-lg);
margin: var(--spacing-lg) auto;
}
.suggestion-tags {
justify-content: center;
}
}
</style>
+439
View File
@@ -0,0 +1,439 @@
<script lang="ts">
import { ALL_PAGES, type NavItem } from '$lib/constants/nav';
import Icon from './Icon.svelte';
let { filteredTools = $bindable(), searchQuery = $bindable() }: {
filteredTools: NavItem[];
searchQuery: string;
} = $props();
let searchInput: HTMLInputElement;
let isSearchOpen: boolean = $state(false);
// Weight different match types for relevance scoring
const MATCH_WEIGHTS = {
EXACT_TITLE: 100,
TITLE_START: 80,
TITLE_CONTAINS: 60,
KEYWORD_EXACT: 50,
KEYWORD_PARTIAL: 40,
DESC_CONTAINS: 20,
DESC_PARTIAL: 10
};
// Calculate relevance score for search matching
function calculateRelevance(item: NavItem, query: string): number {
const normalizedQuery = query.toLowerCase().trim();
if (!normalizedQuery) return 0;
const title = item.label.toLowerCase();
const description = item.description?.toLowerCase() || '';
const keywords = item.keywords?.map(k => k.toLowerCase()) || [];
let score = 0;
// Title matches (highest priority)
if (title === normalizedQuery) {
score += MATCH_WEIGHTS.EXACT_TITLE;
} else if (title.startsWith(normalizedQuery)) {
score += MATCH_WEIGHTS.TITLE_START;
} else if (title.includes(normalizedQuery)) {
score += MATCH_WEIGHTS.TITLE_CONTAINS;
}
// Keyword matches
for (const keyword of keywords) {
if (keyword === normalizedQuery) {
score += MATCH_WEIGHTS.KEYWORD_EXACT;
} else if (keyword.includes(normalizedQuery)) {
score += MATCH_WEIGHTS.KEYWORD_PARTIAL;
}
}
// Description matches (lower priority)
if (description.includes(normalizedQuery)) {
score += MATCH_WEIGHTS.DESC_CONTAINS;
// Bonus for partial word matches in description
const words = normalizedQuery.split(' ');
for (const word of words) {
if (word.length > 2 && description.includes(word)) {
score += MATCH_WEIGHTS.DESC_PARTIAL;
}
}
}
return score;
}
// Category priority for sorting (tools > reference)
function getCategoryPriority(item: NavItem): number {
if (item.href.startsWith('/reference/')) return 1; // Lower priority
return 2; // Higher priority for tools
}
// Perform search with fuzzy matching and relevance scoring
function performSearch(query: string): NavItem[] {
if (!query.trim()) {
return ALL_PAGES;
}
const results = ALL_PAGES
.map(item => ({
item,
relevance: calculateRelevance(item, query),
categoryPriority: getCategoryPriority(item)
}))
.filter(({ relevance }) => relevance > 0)
.sort((a, b) => {
// First sort by category (tools before reference)
if (a.categoryPriority !== b.categoryPriority) {
return b.categoryPriority - a.categoryPriority;
}
// Then by relevance score
return b.relevance - a.relevance;
})
.map(({ item }) => item);
return results;
}
// Handle search input changes
function handleSearch(event: Event) {
const target = event.target as HTMLInputElement;
searchQuery = target.value;
filteredTools = performSearch(searchQuery);
}
// Open search input
function openSearch() {
isSearchOpen = true;
// Focus input after it's rendered
setTimeout(() => {
if (searchInput) {
searchInput.focus();
}
}, 0);
}
// Clear search and close input
function clearSearch() {
searchQuery = '';
filteredTools = ALL_PAGES;
isSearchOpen = false;
if (searchInput) {
searchInput.value = '';
}
}
// Focus search input with keyboard shortcut
function handleKeydown(event: KeyboardEvent) {
if ((event.metaKey || event.ctrlKey) && event.key === 'k') {
event.preventDefault();
openSearch();
}
if (event.key === 'Escape' && isSearchOpen) {
clearSearch();
}
}
// Handle search suggestions from NoResults component
function handleSearchSuggestion(event: CustomEvent<string>) {
searchQuery = event.detail;
filteredTools = performSearch(searchQuery);
isSearchOpen = true;
setTimeout(() => {
if (searchInput) {
searchInput.value = searchQuery;
searchInput.focus();
}
}, 0);
}
</script>
<svelte:window onkeydown={handleKeydown} />
<div class="search-container">
<!-- Always reserve space for search input to prevent jumping -->
<div class="search-wrapper">
{#if !isSearchOpen}
<!-- Search Chip -->
<button
class="search-chip"
onclick={openSearch}
aria-label="Open search"
>
<span class="search-text">Search</span>
<span class="search-shortcut">⌘K</span>
</button>
{:else}
<!-- Expanded Search Input -->
<div class="search-input-wrapper" class:expanding={isSearchOpen}>
<Icon name="search" />
<input
bind:this={searchInput}
type="text"
placeholder="Search tools and reference..."
class="search-input"
value={searchQuery}
oninput={handleSearch}
/>
<button
class="close-search-button"
onclick={clearSearch}
aria-label="Close search"
>
<Icon name="x" size="sm" />
</button>
</div>
{/if}
</div>
<!-- Search results info with smooth height transition -->
<div class="search-results-container" class:visible={isSearchOpen}>
<div class="search-results-info">
{#if searchQuery.length === 0}
<span class="results-count">
Start typing to search {ALL_PAGES.length} tools
</span>
{:else if filteredTools.length === 0}
<span class="no-results">No results found</span>
{:else}
<span class="results-count">
Showing {filteredTools.length} of {ALL_PAGES.length} tools
</span>
{/if}
</div>
</div>
</div>
<style lang="scss">
.search-container {
margin-bottom: var(--spacing-lg);
text-align: center;
}
.search-wrapper {
// Reserve consistent height to prevent content jumping
min-height: 2.5rem; // Height of search chip
display: flex;
align-items: center;
justify-content: center;
transition: min-height var(--transition-normal) ease-out;
// When search is open, increase height smoothly
&:has(.search-input-wrapper) {
min-height: 3rem; // Height of search input
}
}
// Search Chip Styles
.search-chip {
display: inline-flex;
align-items: center;
gap: var(--spacing-sm);
padding: var(--spacing-xs) var(--spacing-sm);
background-color: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--radius-lg);
color: var(--text-primary);
font-size: var(--font-size-xs);
font-family: var(--font-mono);
cursor: pointer;
transition: all var(--transition-fast);
box-shadow: var(--shadow-sm);
opacity: 1;
transform: scale(1) translateY(0);
&:hover {
background-color: var(--surface-hover);
border-color: var(--color-primary);
transform: translateY(-1px) scale(1.02);
box-shadow: var(--shadow-md);
}
&:focus-visible {
outline: 2px solid var(--color-primary);
outline-offset: 2px;
}
&:active {
transform: scale(0.98) translateY(1px);
box-shadow: var(--shadow-sm);
}
// Subtle pulse animation on load
animation: chipAppear 0.4s ease-out;
.search-text {
color: var(--text-primary);
font-weight: 500;
}
.search-shortcut {
background-color: var(--bg-tertiary);
border: 1px solid var(--border-secondary);
border-radius: var(--radius-sm);
padding: 2px var(--spacing-xs);
font-size: var(--font-size-xs);
color: var(--text-secondary);
font-family: var(--font-mono);
}
}
// Expanded Search Input Styles
.search-input-wrapper {
position: relative;
display: flex;
align-items: center;
max-width: 600px;
margin: 0 auto;
width: 100%;
opacity: 0;
transform: scale(0.95) translateY(-4px);
transition: all var(--transition-normal) ease-out;
// Animation when expanding
&.expanding {
opacity: 1;
transform: scale(1) translateY(0);
}
:global(.icon) {
position: absolute;
left: var(--spacing-md);
color: var(--text-secondary);
pointer-events: none;
z-index: 1;
transition: color var(--transition-fast);
}
}
.search-input {
width: 100%;
padding: var(--spacing-md) var(--spacing-2xl);
font-size: var(--font-size-md);
border: 2px solid var(--border-primary);
border-radius: var(--radius-lg);
background-color: var(--bg-secondary);
color: var(--text-primary);
transition: all var(--transition-fast);
font-family: var(--font-mono);
&:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 3px rgba(227, 237, 112, 0.1);
}
&::placeholder {
color: var(--text-secondary);
}
}
.close-search-button {
position: absolute;
right: var(--spacing-md);
background: none;
border: none;
color: var(--text-secondary);
cursor: pointer;
border-radius: var(--radius-sm);
transition: all var(--transition-fast);
display: flex;
align-items: center;
justify-content: center;
padding: var(--spacing-md);
&:hover {
background-color: var(--surface-hover);
color: var(--text-primary);
}
&:focus-visible {
outline: 2px solid var(--color-primary);
outline-offset: 2px;
}
}
// Search results container with smooth height animation
.search-results-container {
overflow: hidden;
max-height: 0;
opacity: 0;
transition: all var(--transition-normal) ease-out;
&.visible {
max-height: 3rem; // Enough for results info
opacity: 1;
}
}
.search-results-info {
text-align: center;
padding: var(--spacing-sm) 0;
font-size: var(--font-size-sm);
color: var(--text-secondary);
transform: translateY(-8px);
transition: transform var(--transition-normal) ease-out;
.search-results-container.visible & {
transform: translateY(0);
}
}
.no-results {
color: var(--color-warning);
font-weight: 500;
}
.results-count {
color: var(--text-secondary);
}
// Keyframe animations
@keyframes chipAppear {
0% {
opacity: 0;
transform: scale(0.9) translateY(4px);
}
100% {
opacity: 1;
transform: scale(1) translateY(0);
}
}
@keyframes inputExpand {
0% {
opacity: 0;
transform: scale(0.95) translateY(-8px);
}
100% {
opacity: 1;
transform: scale(1) translateY(0);
}
}
@media (max-width: 768px) {
.search-input-wrapper {
max-width: none;
margin: 0 var(--spacing-md);
}
.search-input {
font-size: var(--font-size-sm);
}
.search-chip {
font-size: var(--font-size-xs);
padding: var(--spacing-xs) var(--spacing-sm);
}
.search-wrapper {
min-height: 2rem;
&:has(.search-input-wrapper) {
min-height: 2.5rem;
}
}
}
</style>
+11 -5
View File
@@ -1,16 +1,22 @@
<script lang="ts">
import { ALL_PAGES } from '$lib/constants/nav';
import ToolCard from './ToolCard.svelte';
import NoResults from './NoResults.svelte';
import type { NavItem } from '$lib/constants/nav';
export let tools: NavItem[] = ALL_PAGES;
export let searchQuery: string = '';
</script>
<section class="tools-grid">
{#each tools as tool}
<ToolCard {tool} />
{/each}
</section>
{#if tools.length === 0 && searchQuery}
<NoResults {searchQuery} />
{:else}
<section class="tools-grid">
{#each tools as tool}
<ToolCard {tool} />
{/each}
</section>
{/if}
<style lang="scss">
.tools-grid {
+25 -12
View File
@@ -5,6 +5,7 @@ export type NavItem = {
label: string;
description?: string;
icon?: string;
keywords?: string[];
};
export type NavGroup = {
@@ -29,31 +30,36 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
href: '/subnetting/ipv4-subnet-calculator',
label: 'IPv4 Subnet Calculator',
description: 'Calculate subnet information, network addresses, broadcast addresses, and host ranges with visual network analysis',
icon: 'subnet-calculator'
icon: 'subnet-calculator',
keywords: ['subnet', 'calculator', 'ipv4', 'network', 'broadcast', 'hosts', 'cidr', 'netmask']
},
{
href: '/subnetting/ipv6-subnet-calculator',
label: 'IPv6 Subnet Calculator',
description: 'Calculate IPv6 subnets with 128-bit addressing and modern network prefix planning',
icon: 'ipv6-subnet-calculator'
icon: 'ipv6-subnet-calculator',
keywords: ['subnet', 'calculator', 'ipv6', 'network', 'prefix', '128-bit', 'addressing']
},
{
href: '/subnetting/vlsm-calculator',
label: 'VLSM Calculator',
description: 'Variable Length Subnet Mask calculator to break networks into multiple smaller subnets with optimal allocation',
icon: 'vlsm-calculator'
icon: 'vlsm-calculator',
keywords: ['vlsm', 'variable', 'length', 'subnet', 'mask', 'calculator', 'subnets', 'allocation']
},
{
href: '/subnetting/supernet-calculator',
label: 'Supernet Calculator',
description: 'Aggregate multiple networks into supernets for route summarization and efficient routing table management',
icon: 'supernet-calculator'
icon: 'supernet-calculator',
keywords: ['supernet', 'calculator', 'aggregate', 'route', 'summarization', 'routing', 'table']
},
{
href: '/subnetting/planner',
label: 'Subnet Planner',
description: 'Design VLSM networks with drag-and-drop subnet planning and optimize address allocation strategies',
icon: 'subnet-planner'
icon: 'subnet-planner',
keywords: ['subnet', 'planner', 'design', 'vlsm', 'networks', 'planning', 'allocation']
}
],
'/cidr': [
@@ -64,13 +70,15 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
href: '/cidr/mask-converter/cidr-to-subnet-mask',
label: 'CIDR → Mask',
description: 'Convert CIDR notation (e.g. /24) to subnet mask format (255.255.255.0)',
icon: 'cidr-convertor'
icon: 'cidr-convertor',
keywords: ['cidr', 'convert', 'converter', 'mask', 'subnet', 'notation', '/24', '255.255.255.0']
},
{
href: '/cidr/mask-converter/subnet-mask-to-cidr',
label: 'Mask → CIDR',
description: 'Convert subnet mask format (255.255.255.0) to CIDR notation (/24)',
icon: 'cidr-convertor-mask'
icon: 'cidr-convertor-mask',
keywords: ['mask', 'convert', 'converter', 'cidr', 'subnet', 'notation', '/24', '255.255.255.0']
},
],
},
@@ -78,13 +86,15 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
href: '/cidr/summarize',
label: 'CIDR Summarizer',
description: 'Optimize mixed IP addresses, CIDR blocks, and ranges into minimal CIDR prefixes',
icon: 'cidr-summarize'
icon: 'cidr-summarize',
keywords: ['cidr', 'summarize', 'summarizer', 'optimize', 'ip', 'blocks', 'ranges', 'prefixes']
},
{
href: '/cidr/split',
label: 'CIDR Split',
description: 'Split a network into N equal child subnets or to a target prefix length',
icon: 'subnet-splitter'
icon: 'subnet-splitter',
keywords: ['cidr', 'split', 'splitter', 'network', 'subnets', 'child', 'prefix']
},
{
href: '/cidr/next-available',
@@ -136,7 +146,8 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
href: '/ip-address-convertor/representations',
label: 'Format Representations',
description: 'Convert IP addresses between decimal, binary, hexadecimal, and octal number systems',
icon: 'ip-convertor'
icon: 'ip-convertor',
keywords: ['ip', 'convert', 'converter', 'format', 'decimal', 'binary', 'hexadecimal', 'octal', 'representation']
}
]
},
@@ -147,7 +158,8 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
href: '/ip-address-convertor/distance',
label: 'IP Distance Calculator',
description: 'Calculate the number of addresses between two IPs with inclusive/exclusive counting',
icon: 'ip-distance'
icon: 'ip-distance',
keywords: ['ip', 'distance', 'calculator', 'addresses', 'between', 'counting', 'range']
},
{
href: '/ip-address-convertor/nth-ip',
@@ -159,7 +171,8 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
href: '/ip-address-convertor/random',
label: 'Random IP Generator',
description: 'Generate random IP addresses from networks with uniqueness control and seeded randomness',
icon: 'random-ip'
icon: 'random-ip',
keywords: ['random', 'ip', 'generator', 'generate', 'addresses', 'networks', 'seeded']
}
]
},
+9 -6
View File
@@ -1,7 +1,11 @@
<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 ToolsGrid from '$lib/components/ToolsGrid.svelte';
import SearchFilter from '$lib/components/SearchFilter.svelte';
let filteredTools: NavItem[] = $state(ALL_PAGES);
let searchQuery: string = $state('');
</script>
<svelte:head>
@@ -23,26 +27,26 @@
</div>
</section>
<!-- Search Filter -->
<SearchFilter bind:filteredTools bind:searchQuery />
<!-- Tools Grid -->
<ToolsGrid />
<ToolsGrid tools={filteredTools} {searchQuery} />
<style lang="scss">
/* Homepage specific styles */
.hero {
text-align: center;
padding: var(--spacing-xl) 0 var(--spacing-lg);
padding: var(--spacing-xl) 0 var(--spacing-sm);
.hero-content {
max-width: 900px;
margin: 0 auto;
h2 {
font-size: var(--font-size-3xl);
font-weight: 700;
color: var(--text-primary);
margin-bottom: var(--spacing-md);
line-height: 1.2;
@media (max-width: 768px) {
font-size: var(--font-size-xl);
}
@@ -53,7 +57,6 @@
color: var(--text-secondary);
line-height: 1.6;
margin: 0;
@media (max-width: 768px) {
font-size: var(--font-size-md);
}
+1
View File
@@ -53,6 +53,7 @@
--spacing-md: 1rem;
--spacing-lg: 1.5rem;
--spacing-xl: 2rem;
--spacing-2xl: 3rem;
/* Font */
--font-mono: 'Roboto Mono', 'Monaco', 'Menlo', 'Consolas', monospace;