Files
gridfinity-calc/index.html

115 lines
6.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Gridfinity Calculator</title>
</head>
<body class="bg-slate-50 text-slate-900 min-h-screen">
<div id="app" class="max-w-2xl mx-auto p-4 md:p-8">
<header class="mb-8 text-center">
<h1 class="text-3xl font-bold text-slate-800">Gridfinity Calculator</h1>
<p class="text-slate-600">Plan your modular storage layout</p>
</header>
<main class="grid gap-8">
<!-- Inputs Section -->
<section class="bg-white p-6 rounded-xl shadow-sm border border-slate-200">
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4 mb-6 pb-6 border-b border-slate-100">
<h2 class="text-xl font-semibold flex items-center gap-2">
Drawer Dimensions
</h2>
<div class="flex items-center gap-3">
<label class="text-sm font-medium text-slate-700">Units:</label>
<div class="flex bg-slate-100 p-1 rounded-lg">
<button id="unit-mm" class="px-4 py-1 rounded-md text-sm font-medium text-slate-600 hover:text-slate-900 transition-colors">mm</button>
<button id="unit-in" class="px-4 py-1 rounded-md text-sm font-medium bg-blue-600 text-white shadow-sm transition-colors">inches</button>
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Width</label>
<input type="number" id="input-width" class="w-full px-3 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="0" step="any" />
</div>
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Length / Depth</label>
<input type="number" id="input-length" class="w-full px-3 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="0" step="any" />
</div>
<div>
<label class="block text-sm font-medium text-slate-700 mb-1">Height</label>
<input type="number" id="input-height" class="w-full px-3 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="0" step="any" />
</div>
</div>
</section>
<!-- Results Section -->
<section id="results" class="bg-blue-600 text-white p-6 rounded-xl shadow-md hidden">
<h2 class="text-xl font-semibold mb-6">Calculation Results</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<div class="space-y-4">
<div>
<p class="text-blue-100 text-sm uppercase tracking-wider font-semibold">Grid Count</p>
<p class="text-4xl font-bold" id="result-grid-count">0 x 0</p>
<p class="text-blue-100 text-sm mt-1" id="result-grid-fractional">0.00 x 0.00 grids</p>
</div>
<div>
<p class="text-blue-100 text-sm uppercase tracking-wider font-semibold">Max Bin Height</p>
<p class="text-4xl font-bold" id="result-bin-height">0U</p>
<p class="text-blue-100 text-sm mt-1">Vertical Units (7mm each)</p>
</div>
</div>
<div class="bg-blue-700/50 p-4 rounded-lg space-y-3">
<h3 class="font-semibold border-b border-blue-500/50 pb-2">Remaining Space</h3>
<div class="grid grid-cols-2 gap-2 text-sm">
<span>Width Gap:</span>
<span id="gap-width" class="font-mono text-right">0.0 mm</span>
<span>Length Gap:</span>
<span id="gap-length" class="font-mono text-right">0.0 mm</span>
<span>Height Gap:</span>
<span id="gap-height" class="font-mono text-right">0.0 mm</span>
</div>
</div>
</div>
</section>
<!-- Spec Overrides -->
<details class="bg-white border border-slate-200 rounded-xl overflow-hidden shadow-sm">
<summary class="px-6 py-4 font-medium cursor-pointer hover:bg-slate-50 flex items-center justify-between">
<span>Gridfinity Spec Overrides</span>
<span class="text-slate-400 text-sm font-normal">Standard: 42x42x7mm</span>
</summary>
<div class="p-6 border-t border-slate-100 space-y-4 bg-slate-50/50">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label class="block text-xs font-semibold text-slate-500 uppercase mb-1">Grid Size (mm)</label>
<input type="number" id="spec-grid-size" value="42" class="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm" />
</div>
<div>
<label class="block text-xs font-semibold text-slate-500 uppercase mb-1">Unit Height (mm)</label>
<input type="number" id="spec-height-unit" value="7" class="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm" />
</div>
<div>
<label class="block text-xs font-semibold text-slate-500 uppercase mb-1">Base Thickness (mm)</label>
<input type="number" id="spec-base-thickness" value="4.8" class="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm" />
</div>
</div>
<p class="text-xs text-slate-400 italic">Adjust these to scale the system for an exact fit in your drawer.</p>
</div>
</details>
</main>
<footer class="mt-12 text-center text-slate-400 text-sm">
<p>Follows the Gridfinity spec by Zach Freedman</p>
</footer>
</div>
<script type="module" src="/src/main.ts"></script>
<link rel="stylesheet" href="/src/style.css">
</body>
</html>