public-web/layouts/partials/ticker.html
2022-11-02 20:21:54 +01:00

25 lines
891 B
HTML

<div class="lg:col-span-5 bg-gray-100 dark:bg-gray-800 rounded-xl px-6 pt-6 pb-24 lg:pb-6 -mx-6 lg:mx-0 -mb-24">
<h2 class="mb-4 font-bold">Novinky</h2>
<ol
x-data="{ posts: [] }"
x-init="posts = await fetch('https://ticker.nolog.cz/v1/timeline?origin=demo.ticker.nolog.cz&limit=3')
.then(res => res.json())
.then(json => json.data.messages)"
>
<template x-for="post in posts">
<li class="mb-4">
<article class="md:text-sm">
<p x-text="post.text"></p>
<time
class="text-gray-500 text-xs"
x-bind:datetime="post.creation_date"
x-text="new Date(post.creation_date).toLocaleString()"
></time>
</article>
</li>
</template>
</ol>
<a class="link md:text-sm font-bold" href="https://demo.ticker.nolog.cz/" target="_blank">Přečíst starší zprávy →</a>
</div>