scrolling

This commit is contained in:
Gerard Burns 2024-04-13 09:50:19 +01:00
parent 18581ba982
commit 2317003fbf
7 changed files with 65 additions and 31 deletions

View File

@ -18,7 +18,7 @@
> >
<div class="explanationModalContent"> <div class="explanationModalContent">
{#if subject === subjects.column} {#if subject === subjects.column}
<Column {schema} /> <Column {columnName} {schema} />
{:else if subject === subjects.support} {:else if subject === subjects.support}
<Support /> <Support />
{:else if subject === subjects.stringsAsNumbers} {:else if subject === subjects.stringsAsNumbers}

View File

@ -1,11 +1,15 @@
<script> <script>
import { Subject, Property, Section } from './components' import { Block, Subject, Property, Section } from './components'
export let schema export let schema
export let columnName
</script> </script>
<Subject heading="Column Overview"> <Subject>
<div class="heading" slot="heading">
Column Overview for <Block>{columnName}</Block>
</div>
<Section> <Section>
{#if schema.type === "string"} {#if schema.type === "string"}
<Property <Property
@ -51,3 +55,20 @@
/> />
</Section> </Section>
</Subject> </Subject>
<style>
.heading {
display: flex;
align-items: center;
}
.heading > :global(.block) {
margin-left: 4px;
flex-grow: 0;
flex-shrink: 1;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>

View File

@ -30,8 +30,6 @@
} }
$: scalarDescendants = getScalarDescendants(schema) $: scalarDescendants = getScalarDescendants(schema)
$: console.log(scalarDescendants);
$: console.log(schema);
</script> </script>
<Subject heading="Using Scalar JSON Values"> <Subject heading="Using Scalar JSON Values">

View File

@ -1,8 +1,4 @@
<script> <span class="block">
export let truncate = false
</script>
<span class:truncate class="block">
<slot /> <slot />
</span> </span>
@ -15,12 +11,4 @@
color: var(--ink); color: var(--ink);
word-break: break-all; word-break: break-all;
} }
.truncate {
display: inline-block;
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style> </style>

View File

@ -7,6 +7,10 @@
<div class="property"> <div class="property">
{#if pre} {#if pre}
<span class="propertyName">
{name}
</span>
<span class="propertyDivider">-</span>
<pre class="pre propertyValue"> <pre class="pre propertyValue">
{value} {value}
</pre> </pre>
@ -27,12 +31,15 @@
} }
.propertyName { .propertyName {
font-style: italic; font-style: italic;
} }
.pre {
padding: 4px; .pre {
border-radius: 3px; margin: 0;
width: 250px; margin-top: 3px;
background-color: black; padding: 4px;
} border-radius: 3px;
width: 250px;
box-sizing: border-box;
background-color: black;
}
</style> </style>

View File

@ -1,5 +1,23 @@
<script> <script>
import { onMount } from "svelte"
export let heading = "" export let heading = ""
let body;
const handleScroll = (e) => {
console.log("scroll");
if (!body) return;
body.scrollTo({ top: body.scrollTop + e.deltaY, behavior: "smooth" })
}
onMount(() => {
window.addEventListener("wheel", handleScroll)
return () => {
window.removeEventListener("wheel", handleScroll)
}
});
</script> </script>
<div class="heading"> <div class="heading">
@ -10,7 +28,9 @@
</span> </span>
</div> </div>
<div class="divider" /> <div class="divider" />
<slot /> <div bind:this={body} class="body">
<slot />
</div>
<style> <style>
.heading { .heading {
@ -24,4 +44,9 @@
border-bottom: 1px solid var(--grey-4); border-bottom: 1px solid var(--grey-4);
margin: 12px 0 12px; margin: 12px 0 12px;
} }
.body {
max-height: 300px;
overflow-y: auto;
}
</style> </style>

View File

@ -31,17 +31,12 @@
explanationModalSubject = option; explanationModalSubject = option;
root = root root = root
} }
$: {
console.log(messages);
}
</script> </script>
<div <div
bind:this={root} bind:this={root}
class="tooltipContents" class="tooltipContents"
> >
<Column <Column
{columnName} {columnName}
{columnIcon} {columnIcon}