oliverdavies.uk/src/components/talk/Events.astro

48 lines
908 B
Plaintext
Raw Normal View History

---
interface Event {
2023-01-08 19:25:23 +00:00
date: string;
location: string;
name: string;
online?: boolean;
time: string;
url?: string;
}
interface Props {
2023-01-08 19:25:23 +00:00
events: Event[];
}
2023-01-08 19:25:23 +00:00
const { events } = Astro.props;
---
2023-01-08 19:25:23 +00:00
{
events && (
<div>
2023-01-08 19:25:23 +00:00
<h2>Events</h2>
2023-01-08 19:25:23 +00:00
<div>
<ul class="ml-4 list-disc">
{events.map((event) => (
<li>
{event.url ? (
<a class="link" href={event.url}>
{event.name}
</a>
) : (
event.name
)}
{event.location && `in ${event.location} -`}
2023-01-08 19:25:23 +00:00
{new Date(event.date).toLocaleDateString("en-GB", {
day: "numeric",
month: "long",
year: "numeric",
})}
{event.online && "(online)"}
</li>
))}
</ul>
</div>
</div>
2023-01-08 19:25:23 +00:00
)
}