threads/templates/threads.html

160 lines
4.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ayo's Threads</title>
<link rel="stylesheet" href="https://webcomponent.io/reset.css" />
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
max-width: 570px;
margin: 0 auto;
}
header, footer {
background: linear-gradient(45deg, #3054bf, #416fff);
color: white;
padding: 1em;
border-radius: 5px;
margin: 1em 0;
& a {
color: white;
}
}
summary:hover {
text-decoration: underline;
}
summary {
color: blue;
cursor: pointer;
margin-top: 1em;
}
ul {
list-style: none;
}
.card {
margin-left: -40px;
margin-top: 1em;
border: 1px solid rgba(34, 34, 34, 0.35);
border-radius: 5px;
padding:1em;
background-color: #fff;
box-shadow: 5px 25px 10px -25px rgba(34, 34, 34, 0.15);
display: grid;
grid-template-columns: 55px auto;
gap: 5px;
}
.card_content {
& *:not(.meta, .descendant *) {
margin-bottom: 1em;
}
& img, & video {
border-radius: 5px;
max-width: 100%;
object-fit: cover;
border: 1px solid rgba(34, 34, 34, 0.15);
}
& .meta {
margin-bottom: 5px;
& a {
font-size: small;
color: #888;
}
& a:hover {
color: blue;
}
}
}
.card_avatar img {
border: 1px solid rgba(34, 34, 34, 0.35);
border-radius: 5px;
display: inline;
width: 50px;
}
</style>
</head>
<body>
<header>
<h1>Ayo's Threads</h1>
<p>Some of my favorie threads. See the <a href="https://ayco.io/sh/threads">source code</a>.</p>
</header>
<main>
<ul>
{% for thread in threads %}
<li class="card">
<div class="card_avatar">
{% if thread.account.avatar is defined %}
<img class="avatar" src="{{thread.account.avatar}}" />
{% endif %}
</div>
<div class="card_content">
<div class="meta">
<a href="{{thread.url}}" target="_blank">{{ thread.created_at }}</a>
</div>
{{thread.content | safe}}
{% for media in thread.media_attachments %}
{% if media.type == 'image'%}
<img src="{{media.url}}" />
{% elif media.type == 'gifv' %}
<video autoplay loop>
<source src="{{media.url}}" type="video/mp4">
Your browser does not support the video tag.
</video>
{% endif %}
{% endfor %}
<details>
<summary>See more ({{ thread.descendants | length }})</summary>
<ul>
{% for descendant in thread.descendants %}
<li class="card descendant">
<div class="card_avatar">
{% if descendant.account.avatar is defined %}
<img class="avatar" src="{{thread.account.avatar}}" />
{% endif %}
</div>
<div class="card_content">
<div class="meta">
<a href="{{descendant.url}}" target="_blank">{{ descendant.created_at }}</a>
</div>
{{ descendant.content | safe }}
{% for media in descendant.media_attachments%}
{% if media.type == 'image'%}
<img src="{{media.url}}" />
{% elif media.type == 'gifv' %}
<video autoplay loop>
<source src="{{media.url}}" type="video/mp4">
Your browser does not support the video tag.
</video>
{% endif %}
{% endfor %}
</div>
<li>
{% endfor %}
</ul>
</details>
</div>
</li>
{% endfor %}
</ul>
</main>
<footer>
&copy; 2024 Ayo Ayco
</footer>
</body>
</html>