1
0
resumarkdown/src/lib/components/preview.svelte

48 lines
818 B
Svelte
Raw Normal View History

2024-10-12 23:47:09 -05:00
<script lang="ts">
2024-10-16 12:36:50 -05:00
import { pane } from '$lib/stores/nav.js';
2024-10-12 23:47:09 -05:00
2024-10-16 12:36:50 -05:00
interface Props {
mobile?: boolean;
markdown: string;
stylesheet: string;
}
2024-10-12 23:47:09 -05:00
2024-10-16 12:36:50 -05:00
let { mobile = true, markdown, stylesheet }: Props = $props();
2024-10-12 23:47:09 -05:00
2024-10-16 12:36:50 -05:00
let hidden: boolean = $derived(mobile ? $pane !== 'preview' : true);
2024-10-12 23:47:09 -05:00
</script>
<main class:hidden class:mobile data-testid="preview-pane">
<h2>markdown:</h2>
<code>{markdown}</code>
<h2>stylesheet:</h2>
<code>{stylesheet}</code>
</main>
<style lang="less">
2024-10-12 23:55:40 -05:00
code {
display: block;
padding: @padding-md-x 0;
}
2024-10-12 23:47:09 -05:00
main {
grid-area: preview;
2024-10-12 23:55:40 -05:00
margin: 0;
padding: @padding-lg;
2024-10-12 23:47:09 -05:00
&.mobile {
grid-area: editor;
&.hidden {
display: none;
}
}
}
2024-10-12 23:55:40 -05:00
h2 {
font-weight: @font-w-semibold;
margin: 0;
padding: 0;
}
2024-10-12 23:47:09 -05:00
</style>