1
0

add some reactivity

This commit is contained in:
Nicola Clark 2024-10-11 22:45:07 -05:00
parent fe46c54496
commit 4d6cdf8f78
Signed by: nicola
GPG Key ID: 3E1710E7FF08956C
2 changed files with 32 additions and 9 deletions

View File

@ -1,4 +1,8 @@
<textarea></textarea> <script lang="ts">
export let code: string;
</script>
<textarea bind:value={code}></textarea>
<style lang="less"> <style lang="less">
textarea { textarea {

View File

@ -4,6 +4,9 @@
import Headline from '$lib/components/headline.svelte'; import Headline from '$lib/components/headline.svelte';
import NavItem from '$lib/components/nav-item.svelte'; import NavItem from '$lib/components/nav-item.svelte';
import NavTree from '$lib/components/nav-tree.svelte'; import NavTree from '$lib/components/nav-tree.svelte';
let markdown: string = '';
let stylesheet: string = '';
</script> </script>
<svelte:head> <svelte:head>
@ -20,18 +23,30 @@
</header> </header>
<main> <main>
<Content pane="content"> <Content pane="content">
<CodeInput /> <CodeInput bind:code={markdown} />
</Content> </Content>
<Content pane="style"> <Content pane="style">
<CodeInput /> <CodeInput bind:code={stylesheet} />
</Content> </Content>
<Content pane="preview"> <Content pane="preview">
<p>preview</p> <dl>
<dt>markdown:</dt>
<dd>{markdown !== '' ? markdown : '???'}</dd>
<dt>stylesheet:</dt>
<dd>{stylesheet !== '' ? stylesheet : '???'}</dd>
</dl>
</Content> </Content>
</main> </main>
</div> </div>
<style lang="less"> <style lang="less">
// util
.margin-v(@v) {
margin-bottom: @v;
margin-top: @v;
}
// styles
div { div {
align-items: stretch; align-items: stretch;
display: flex; display: flex;
@ -40,12 +55,16 @@
justify-content: start; justify-content: start;
} }
dd {
.margin-v(@padding-lg-y);
}
dl {
margin: 0;
padding: @padding-xl;
}
main { main {
flex-grow: 1; flex-grow: 1;
} }
p {
margin: 0;
padding: @padding-md;
}
</style> </style>