You've already forked AstralRinth
forked from didirus/AstralRinth
Update docs examples + Add Select component + Add Card, Base, Title classes
This commit is contained in:
@@ -1,18 +1,26 @@
|
||||
<script lang="ts">
|
||||
import Prism from 'prismjs';
|
||||
import 'prism-svelte';
|
||||
import Button from '$lib/components/Button.svelte'
|
||||
import IconMoon from 'virtual:icons/heroicons-outline/moon'
|
||||
import IconSun from 'virtual:icons/heroicons-outline/sun'
|
||||
|
||||
export let background: 'var(--color-raised-bg)' | 'transparent' = 'var(--color-raised-bg)'
|
||||
|
||||
export let code = ''
|
||||
const highlighted = Prism.highlight(code.trim(), Prism.languages.svelte, 'svelte');
|
||||
let theme = 'light'
|
||||
let background: 'var(--color-raised-bg)' | 'var(--color-bg)' = 'var(--color-bg)'
|
||||
</script>
|
||||
|
||||
<div class="example theme-light">
|
||||
<div class="example__preview" style:background={background}>
|
||||
<slot />
|
||||
<div class="example">
|
||||
<div class="example__preview theme-{theme} base" style:background={background}>
|
||||
<div class="example__preview__options">
|
||||
<Button color="primary-light" on:click={() => theme === 'light' ? theme = 'dark' : theme = 'light'}>
|
||||
{#if theme === 'light'}
|
||||
<IconMoon/>
|
||||
{:else}
|
||||
<IconSun/>
|
||||
{/if}
|
||||
</Button>
|
||||
</div>
|
||||
<slot name="example"/>
|
||||
</div>
|
||||
<pre class="example__code language-">{@html highlighted}</pre>
|
||||
<pre class="example__code language-svelte"><slot name="code"/></pre>
|
||||
</div>
|
||||
|
||||
<style lang="postcss">
|
||||
@@ -20,13 +28,24 @@
|
||||
margin-bottom: 32px;
|
||||
|
||||
&__preview {
|
||||
padding: 16px;
|
||||
border-radius: var(--rounded-sm-top);
|
||||
border: solid 2px hsl(0, 0%, 20%);
|
||||
border-bottom: none;
|
||||
display: flex;
|
||||
grid-gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
position: relative;
|
||||
justify-content: flex-start;
|
||||
|
||||
&__options {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 8px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
z-index: 100;
|
||||
}
|
||||
}
|
||||
|
||||
&__code {
|
||||
|
||||
Reference in New Issue
Block a user