<script>
    import SvelteMarkdown from 'svelte-markdown';

    export let at;
    export let body;

    let scroll = (message) => {
        message.scrollIntoView();
    }
</script>

<div class="message relative">
    <span class="timestamp chip variant-soft absolute top-0 right-0">{at}</span>
    <section use:scroll class="py-1 message-body">
        <SvelteMarkdown source={body} />
    </section>
</div>

<style>
    .message .timestamp {
        display: none;
    }
    .message:hover .timestamp {
        display: flex;
    }
    .message-body:empty:after {
        content: ".";
        visibility: hidden;
    }
</style>
