summaryrefslogtreecommitdiff
path: root/packages/renderers/renderer-svelte/Wrapper.svelte
blob: 78d4a402b19c022f97a2fe364c656120fb424d0a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script>
/** 
  * Why do we need a wrapper component?
  * 
  * Astro passes `children` as a string of HTML, so we need
  * a way to render that content.
  * 
  * Rather than passing a magical prop which needs special 
  * handling, using this wrapper allows Svelte users to just
  * use `<slot />` like they would for any other component.
  */
const { __astro_component: Component, __astro_children, ...props } = $$props;
</script>

<svelte:component this={Component} {...props}>
  {#if __astro_children}
    <astro-fragment>
      {@html __astro_children}
    </astro-fragment>
  {/if}
</svelte:component>