fluix 0.1.25

Rust UI components for GPUI
Documentation
<script lang="ts">
	import { ChevronDown, ExternalLink } from 'lucide-svelte';
	import { base } from '$app/paths';
	
	let resourcesOpen = $state(false);
	let dropdownTimeout: number | null = null;

	function handleMouseEnter() {
		if (dropdownTimeout) {
			clearTimeout(dropdownTimeout);
			dropdownTimeout = null;
		}
		resourcesOpen = true;
	}

	function handleMouseLeave() {
		dropdownTimeout = setTimeout(() => {
			resourcesOpen = false;
		}, 150); // 150ms delay to allow moving to dropdown menu
	}
</script>


<nav class="navbar">
	<div class="nav-container">
		<!-- Logo -->
		<a href="{base}/" class="logo-link">
			<div class="logo-icon-wrapper">
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
					<rect x="3" y="3" width="8" height="8" fill="currentColor" stroke="none"/>
					<rect x="13" y="3" width="8" height="8" stroke="currentColor" fill="none"/>
					<rect x="3" y="13" width="8" height="8" stroke="currentColor" fill="none"/>
					<rect x="13" y="13" width="8" height="8" fill="currentColor" stroke="none"/>
				</svg>
			</div>
			<span class="logo-text">Fluix Component</span>
		</a>

		<!-- Navigation Links -->
		<div class="nav-links">
			<a href="{base}/" class="nav-link">Home</a>
			<a href="{base}/docs/getting-started" class="nav-link">Getting Started</a>
			<a href="{base}/docs/components" class="nav-link">Components</a>
			<a href="{base}/docs/api-doc" class="nav-link">Documents</a>
			<div class="nav-link resources-dropdown" onmouseenter={handleMouseEnter} onmouseleave={handleMouseLeave}>
				<span>Resources</span>
				<ChevronDown class="chevron-icon" size={12} />
				{#if resourcesOpen}
					<div class="dropdown-menu" onmouseenter={handleMouseEnter} onmouseleave={handleMouseLeave}>
						<a href="{base}/docs/tutorials" class="dropdown-item">Tutorials</a>
						<a href="{base}/docs/faq" class="dropdown-item">FAQ</a>
						<a href="https://github.com/lipish/fluix/releases" target="_blank" rel="noopener noreferrer" class="dropdown-item">
							Releases
							<ExternalLink class="external-icon-small" />
						</a>
					</div>
				{/if}
			</div>
		</div>

		<!-- GitHub Link -->
		<a
			href="https://github.com/lipish/fluix"
			target="_blank"
			rel="noopener noreferrer"
			class="github-link"
		>
			<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" class="github-icon" />
		</a>
	</div>
</nav>

<style>
	.navbar {
		position: sticky;
		top: 0;
		z-index: 50;
		background: var(--background);
		border-bottom: 1px solid var(--border);
		padding: 0;
		backdrop-filter: blur(8px);
		background: oklch(from var(--background) l c h / 0.95);
	}

	.nav-container {
		max-width: 1280px;
		margin: 0 auto;
		padding: 0 1.5rem;
		display: flex;
		align-items: center;
		gap: 1.5rem;
		height: 4rem;
	}

	.logo-link {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		text-decoration: none;
		color: inherit;
		flex-shrink: 0;
	}

	.logo-icon-wrapper {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 2rem;
		height: 2rem;
		flex-shrink: 0;
		color: var(--foreground);
	}

	.logo-icon-wrapper :global(svg) {
		width: 100%;
		height: 100%;
	}

	.logo-icon {
		width: 2rem;
		height: 2rem;
		flex-shrink: 0;
	}

	.logo-text {
		font-size: 1rem;
		font-weight: 700;
		color: var(--foreground);
		white-space: nowrap;
	}

	.nav-links {
		display: flex;
		align-items: center;
		gap: 1.5rem;
		margin-left: auto;
		flex-shrink: 0;
	}

	.nav-link {
		display: flex;
		align-items: center;
		gap: 0.25rem;
		text-decoration: none;
		color: var(--foreground);
		font-size: 0.875rem;
		font-weight: 400;
		padding: 0.5rem 0.75rem;
		border-radius: 0.375rem;
		transition: background-color 0.2s;
		white-space: nowrap;
	}

	.nav-link:hover {
		background: var(--secondary);
	}

	.external-icon {
		width: 0.75rem;
		height: 0.75rem;
		color: var(--muted-foreground);
		opacity: 0.6;
		flex-shrink: 0;
	}

	.external-icon :global(svg) {
		width: 0.75rem;
		height: 0.75rem;
		color: var(--muted-foreground);
		opacity: 0.6;
	}

	.resources-dropdown {
		position: relative;
		cursor: pointer;
	}

	.chevron-icon {
		width: 0.75rem;
		height: 0.75rem;
		color: var(--muted-foreground);
		opacity: 0.6;
		transition: transform 0.2s;
		flex-shrink: 0;
	}

	.chevron-icon :global(svg) {
		width: 0.75rem;
		height: 0.75rem;
		color: var(--muted-foreground);
		opacity: 0.6;
	}

	.resources-dropdown:hover .chevron-icon {
		transform: rotate(180deg);
	}

	.dropdown-menu {
		position: absolute;
		top: 100%;
		right: 0;
		margin-top: 0.5rem;
		background: var(--popover);
		border: 1px solid var(--border);
		border-radius: 0.5rem;
		padding: 0.5rem;
		min-width: 12rem;
		box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
		z-index: 100;
	}

	.dropdown-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.5rem;
		padding: 0.5rem 0.75rem;
		border-radius: 0.375rem;
		text-decoration: none;
		color: var(--foreground);
		font-size: 0.875rem;
		transition: background-color 0.2s;
	}

	.dropdown-item:hover {
		background: var(--secondary);
	}

	.external-icon-small {
		width: 0.75rem;
		height: 0.75rem;
		color: var(--muted-foreground);
	}

	.github-link {
		display: flex;
		align-items: center;
		gap: 0.5rem;
		text-decoration: none;
		color: var(--foreground);
		padding: 0.5rem 0.75rem;
		border-radius: 0.375rem;
		transition: background-color 0.2s;
		flex-shrink: 0;
	}

	.github-link:hover {
		background: var(--secondary);
	}

	.github-icon {
		width: 1.25rem;
		height: 1.25rem;
		display: block;
		opacity: 0.8;
		transition: opacity 0.2s;
	}

	.github-link:hover .github-icon {
		opacity: 1;
	}

	/* Responsive */
	@media (max-width: 768px) {
		.logo-text {
			display: none;
		}

		.nav-links {
			gap: 0.75rem;
		}

		.nav-link {
			padding: 0.5rem;
			font-size: 0.8125rem;
		}
	}

	@media (max-width: 640px) {
		.nav-container {
			padding: 0 1rem;
			gap: 0.75rem;
		}

		.nav-links {
			gap: 0.5rem;
		}

		.nav-link {
			padding: 0.375rem 0.5rem;
			font-size: 0.75rem;
		}
	}
</style>