Add a Svelte Html component

This commit is contained in:
Norbert de Langen 2022-09-08 11:53:46 +02:00
parent 1ea262fe54
commit 385f610f23
No known key found for this signature in database
GPG Key ID: FD0E78AF9A837762
3 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
// eslint-disable-next-line react/no-danger
export const Html = ({ contents }) => <div dangerouslySetInnerHTML={{ __html: contents }} />;
Html.propTypes = {

View File

@ -0,0 +1,8 @@
<script>
/**
* contents
*/
export let contents = '';
</script>
<div>{@html contents}></div>

View File

@ -1,5 +1,6 @@
import globalThis from 'global';
import Button from './Button.svelte';
import Html from './Html.svelte';
globalThis.Components = { Button };
globalThis.Components = { Button, Html };