<script lang="ts">
  import GenericSite from './types/GenericSite.svelte';
  import InteractivePanel from '../elements/InteractivePanel.svelte';
  import WidgetRenderContainer from '../elements/WidgetRenderContainer.svelte';

  export let data: WidgetTwitterPost;
  export let preview: WidgetPreviewTwitterPost | undefined = undefined;
  export let nonInteractive: boolean = false;
  export let handle: boolean = false;
  export let isPreview: boolean = false;
</script>

<InteractivePanel preview={isPreview} title="Twitter Post" url={!nonInteractive ? data.url : undefined} {handle}>
  <WidgetRenderContainer hasPreview={preview != null}>
    <GenericSite thumbnail={preview?.thumbnail} title={preview?.description} description={preview?.tag} />
  </WidgetRenderContainer>
</InteractivePanel>
