From aa6b503cca26e22d1aa5cb5305866f3add2ecff7 Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Wed, 4 Jan 2023 14:01:45 -0800 Subject: [PATCH] add prop gap = `0.3cqw` between element tiles, default is 0.3% of container width requires extra wrapper div around div.periodic-table but solves layout issues from global CSS making parent element of div.periodic-table container-type: inline-size add slot bottom-left-inset which defaults to ElementPhoto --- src/lib/PeriodicTable.svelte | 75 +++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/src/lib/PeriodicTable.svelte b/src/lib/PeriodicTable.svelte index e3b52f4..ba877bc 100644 --- a/src/lib/PeriodicTable.svelte +++ b/src/lib/PeriodicTable.svelte @@ -24,6 +24,7 @@ export let color_scale: ScaleLinear | null = null export let active_element: ChemicalElement | null = null export let active_category: Category | null = null + export let gap = `0.3cqw` // gap between element tiles, default is 0.3% of container width $: if (![0, 118].includes(heatmap_values.length)) { console.error( @@ -46,52 +47,56 @@ -
- +
+
+ - {#each element_data as element, idx} - {@const { column, row, category, name, symbol } = element} - {@const value = heatmap_values?.length > 0 && heatmap_values[idx]} - {@const active = - active_category === category.replaceAll(` `, `-`) || active_element?.name === name} - - {/each} - -
+ {#each element_data as element, idx} + {@const { column, row, category, name, symbol } = element} + {@const value = heatmap_values?.length > 0 && heatmap_values[idx]} + {@const active = + active_category === category.replaceAll(` `, `-`) || + active_element?.name === name} + + {/each} + +
- {#if show_photo} - - {/if} + + {#if show_photo} + + {/if} + +