feat: Initialize SvelteKit project, add tsconfig.json, and introduce a new Calculator.svelte component.
This commit is contained in:
73
hdyc-svelte/src/routes/[slug]/+page.svelte
Normal file
73
hdyc-svelte/src/routes/[slug]/+page.svelte
Normal file
@@ -0,0 +1,73 @@
|
||||
<script lang="ts">
|
||||
import Calculator from '$lib/components/Calculator.svelte';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
$: calc = data.calculator;
|
||||
$: related = data.related;
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{calc.name} — HowDoYouConvert.com</title>
|
||||
<meta name="description" content="Convert {calc.labels.in1} to {calc.labels.in2} instantly with our free online calculator. Accurate bidirectional conversion with the exact formula shown." />
|
||||
</svelte:head>
|
||||
|
||||
<nav class="breadcrumbs">
|
||||
<a href="/">Home</a>
|
||||
<span class="sep">›</span>
|
||||
<a href="/category/{calc.category}">{data.categoryIcon} {data.categoryLabel}</a>
|
||||
<span class="sep">›</span>
|
||||
<span>{calc.name}</span>
|
||||
</nav>
|
||||
|
||||
<Calculator config={calc} />
|
||||
|
||||
<div class="seo-content">
|
||||
{#if calc.descriptionHTML}
|
||||
{@html calc.descriptionHTML}
|
||||
{:else}
|
||||
<h3>How to convert {calc.labels.in1} to {calc.labels.in2}</h3>
|
||||
{#if calc.type === 'standard' && calc.factor}
|
||||
<p>
|
||||
The conversion between {calc.labels.in1.toLowerCase()} and {calc.labels.in2.toLowerCase()}
|
||||
uses a fixed multiplication factor. One {calc.labels.in1.toLowerCase().replace(/s$/, '')} equals
|
||||
{calc.factor}{calc.offset ? ` plus an offset of ${calc.offset}` : ''} {calc.labels.in2.toLowerCase()}.
|
||||
{#if calc.offset}
|
||||
This offset is common in temperature conversions, where scales differ not just in magnitude but also in their zero point.
|
||||
{/if}
|
||||
</p>
|
||||
<p>
|
||||
To convert, multiply the value in {calc.labels.in1.toLowerCase()} by {calc.factor}{calc.offset ? `, then add ${calc.offset}` : ''}.
|
||||
To convert in the opposite direction, {calc.offset ? `subtract ${calc.offset}, then ` : ''}divide by {calc.factor}.
|
||||
</p>
|
||||
{:else if calc.type === '3col' || calc.type === '3col-mul'}
|
||||
<p>
|
||||
This is a three-variable conversion. Enter any two of the three values
|
||||
— {calc.labels.in1}, {calc.labels.in2}, and {calc.labels.in3} — and the third
|
||||
will be calculated automatically.
|
||||
</p>
|
||||
{:else if calc.type === 'base'}
|
||||
<p>
|
||||
Number system conversion between base-{calc.fromBase} ({calc.labels.in1.toLowerCase()}) and
|
||||
base-{calc.toBase} ({calc.labels.in2.toLowerCase()}). Enter a value in either field and the
|
||||
equivalent representation will appear in the other.
|
||||
</p>
|
||||
{:else}
|
||||
<p>
|
||||
Enter a value in the field for {calc.labels.in1.toLowerCase()} and the equivalent
|
||||
in {calc.labels.in2.toLowerCase()} will be calculated instantly. The conversion
|
||||
works bidirectionally — modify either field and the other updates in real time.
|
||||
</p>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if related.length > 0}
|
||||
<h3 class="section-heading">Related Converters</h3>
|
||||
<div class="related-grid">
|
||||
{#each related as rel}
|
||||
<a href="/{rel.slug}" class="related-chip">{rel.name}</a>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user