convert Code component to new API

This commit is contained in:
Keviin Åberg Kultalahti 2021-04-30 13:39:34 +02:00
parent 71f20dd2ea
commit 856f808600
1 changed files with 6 additions and 16 deletions

View File

@ -1,20 +1,10 @@
<script> <script>
import "@spectrum-css/typography/dist/index-vars.css" import "@spectrum-css/typography/dist/index-vars.css"
// Sizes // Sizes
export let xl = false; export let size = "M"
export let l = false;
export let m = false;
export let s = false;
export let xs = false;
$: useDefault = ![xl, l, m, s, xs].includes(true)
</script> </script>
<code class="spectrum-Code" <code class="spectrum-Code spectrum-Code--size{size}">
class:spectrum-Code--sizeXL={xl} <slot />
class:spectrum-Code--sizeL={l} </code>
class:spectrum-Code--sizeM={m || useDefault}
class:spectrum-Code--sizeS={s}
class:spectrum-Code--sizeXS={xs}>
<slot />
</code>