-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathExample.svelte
64 lines (56 loc) · 1.27 KB
/
Example.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<script>
import { run } from 'svelte/legacy';
let {
src = undefined,
meta = undefined,
example,
code
} = $props();
// suppress vite-plugin-svelte warning about unused props
run(() => {
src, meta
});
</script>
<div class="root">
<div class="container">
<div class="example-wrapper">
<div class="example">
{@render example?.()}
</div>
</div>
<pre class="language-svelte">{@render code?.()}</pre>
</div>
</div>
<style>
.root {
margin: 0.5rem 0;
}
.container {
display: flex;
flex-direction: column;
width: 100%;
overflow: hidden;
border-bottom-left-radius: var(--example-border-radius, 0.25rem);
border-bottom-right-radius: var(--example-border-radius, 0.25rem);
}
.example-wrapper {
display: flex;
justify-content: center;
background: var(--example-background, #fafafa);
border: var(--example-border, 1px solid #ddd);
overflow: hidden;
border-bottom: none;
border-top-left-radius: var(--example-border-radius, 0.25rem);
border-top-right-radius: var(--example-border-radius, 0.25rem);
}
.example {
display: flex;
justify-content: center;
align-items: center;
padding: 0.75rem 0;
min-height: 3rem;
}
pre {
margin: 0;
}
</style>