| 1 | --- |
| 2 | import { avatar, type Post } from "../../data/sentiment"; |
| 3 | import { icons } from "@iconify-json/simple-icons"; |
| 4 | |
| 5 | interface Props { |
| 6 | post: Post; |
| 7 | /** Decorative duplicate (marquee loop): not focusable. */ |
| 8 | hidden?: boolean; |
| 9 | } |
| 10 | const { post, hidden } = Astro.props; |
| 11 | const discord = post.source === "discord"; |
| 12 | const where = discord ? "the Alchemy Discord" : "X"; |
| 13 | --- |
| 14 | |
| 15 | <a |
| 16 | class="snt-card" |
| 17 | href={post.url} |
| 18 | target="_blank" |
| 19 | rel="noopener" |
| 20 | tabindex={hidden ? -1 : undefined} |
| 21 | aria-label={hidden ? undefined : `${post.name} on ${where}: ${post.text}`} |
| 22 | > |
| 23 | <span class="snt-card__head"> |
| 24 | <img |
| 25 | class="snt-avatar" |
| 26 | src={avatar(post)} |
| 27 | alt="" |
| 28 | width="32" |
| 29 | height="32" |
| 30 | loading="lazy" |
| 31 | decoding="async" |
| 32 | /> |
| 33 | <span class="snt-card__who"> |
| 34 | <span class="snt-card__name">{post.name}</span> |
| 35 | <span class="snt-handle">@{post.handle}</span> |
| 36 | </span> |
| 37 | { |
| 38 | discord ? ( |
| 39 | <svg |
| 40 | class="snt-card__x" |
| 41 | viewBox="0 0 24 24" |
| 42 | width="15" |
| 43 | height="15" |
| 44 | aria-hidden="true" |
| 45 | set:html={icons.icons.discord!.body} |
| 46 | /> |
| 47 | ) : ( |
| 48 | <svg |
| 49 | class="snt-card__x" |
| 50 | viewBox="0 0 24 24" |
| 51 | width="14" |
| 52 | height="14" |
| 53 | aria-hidden="true" |
| 54 | fill="currentColor" |
| 55 | > |
| 56 | <path |
| 57 | d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" |
| 58 | ></path> |
| 59 | </svg> |
| 60 | ) |
| 61 | } |
| 62 | </span> |
| 63 | <p class="snt-card__text">{post.text}</p> |
| 64 | </a> |