all repos — websitemeow @ 0a0bdf06936d21b38c83ffce1aaff761ebea9b59

src/components/DiscordMessages.astro (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
---
import type { DiscordMessage } from "@/types";

interface Props {
	message: DiscordMessage;
}

const { message } = Astro.props;
---

<div class="message-group">
	<div class="gutter">
		<img src={message.avatarUrl} alt="" aria-hidden="true" />
	</div>
	<div class="message-content">
		<div class="message-author">
			<span class="author-name">{message.author}</span>
			<span class="timestamp">{message.timestamp}</span>
		</div>
		<div class="message-text">
			{message.content.map((content) => <p>{content}</p>)}
		</div>
	</div>
</div>

<style>
	.message-group {
		display: flex;
		flex-direction: row;
		gap: 0.5rem;

		padding: 0.5rem;
		background-color: hsl(var(--crust));
		border-radius: 1.5rem;

		.gutter {
			width: 2rem;
			img {
				width: 100%;
				height: auto;
				border-radius: 50%;
			}
		}

		.message-content {
			flex: 1;

			.message-author {
				display: flex;
				align-items: center;
				gap: 0.5rem;
				.author-name {
					font-weight: bold;
				}
				.timestamp {
					font-size: 0.75rem;
					color: hsl(var(--subtext0));
				}
			}

			.message-text {
				font-size: 0.875rem;
				line-height: 1.5;
				color: hsl(var(--text));
			}
		}
	}
</style>