diff --git a/hdyc-svelte/src/lib/components/Calculator.svelte b/hdyc-svelte/src/lib/components/Calculator.svelte index 8aff362..5e8ee77 100644 --- a/hdyc-svelte/src/lib/components/Calculator.svelte +++ b/hdyc-svelte/src/lib/components/Calculator.svelte @@ -6,6 +6,7 @@ import QuickDefinitionCard from '$lib/components/QuickDefinitionCard.svelte'; import QuickConversionExample from '$lib/components/QuickConversionExample.svelte'; import QuickConversionTable from '$lib/components/QuickConversionTable.svelte'; + import ScientificNotationValue from '$lib/components/ScientificNotationValue.svelte'; export let config: CalculatorDef; export let showTitle = true; @@ -147,7 +148,9 @@ {#if config.factor && config.type === 'standard'} - 1 {config.labels.in1} = {config.factor}{config.offset ? ` + ${config.offset}` : ''} {config.labels.in2} + 1 {config.labels.in1} = + + {config.offset ? ` + ${config.offset}` : ''} {config.labels.in2} {/if} diff --git a/hdyc-svelte/src/lib/components/QuickConversionExample.svelte b/hdyc-svelte/src/lib/components/QuickConversionExample.svelte index e75ef49..c4de07e 100644 --- a/hdyc-svelte/src/lib/components/QuickConversionExample.svelte +++ b/hdyc-svelte/src/lib/components/QuickConversionExample.svelte @@ -1,6 +1,7 @@ + +{#if scientific} + + {scientific.base} + + ×10{scientific.exponent} + + +{:else} + + {formattedValue || fallback} + +{/if} + + diff --git a/hdyc-svelte/src/routes/[slug]/+page.svelte b/hdyc-svelte/src/routes/[slug]/+page.svelte index 1a83dd3..46b42f1 100644 --- a/hdyc-svelte/src/routes/[slug]/+page.svelte +++ b/hdyc-svelte/src/routes/[slug]/+page.svelte @@ -5,6 +5,7 @@ import { onMount } from 'svelte'; import type { PageData } from './$types'; import { buildSeoMeta, canonicalUrl, SITE_NAME, SITE_URL, toJsonLd } from '$lib/seo'; + import ScientificNotationValue from '$lib/components/ScientificNotationValue.svelte'; export let data: PageData; @@ -105,14 +106,18 @@

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()}. + + {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}

- 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}. + To convert, multiply the value in {calc.labels.in1.toLowerCase()} by + + {calc.offset ? `, then add ${calc.offset}` : ''}. + To convert in the opposite direction, {calc.offset ? `subtract ${calc.offset}, then ` : ''}divide by + .

{:else if calc.type === '3col' || calc.type === '3col-mul'}