website/src/routes/+page.svelte

74 lines
1.9 KiB
Svelte
Raw Normal View History

2022-08-04 12:24:22 +03:00
<script lang="ts">
2022-08-05 17:01:15 +03:00
import Hero from "$lib/Hero.svelte";
2023-01-25 19:11:11 +02:00
import sanitizeHtml from "sanitize-html";
2022-11-09 20:42:34 +02:00
import type { PageData } from "./$types";
2023-08-18 16:19:20 -05:00
import snarkdown from "snarkdown";
2022-11-09 20:42:34 +02:00
2022-12-27 17:28:47 +02:00
export let data: PageData;
2022-08-05 15:46:54 +03:00
2023-01-25 19:11:11 +02:00
$: backgroundColor = "#5cdd8b";
2023-02-18 18:21:41 +02:00
$: if (!data.announcements.error) {
2023-01-25 19:11:11 +02:00
if (data.announcements.incident) {
if (data.announcements.incident.style === "info") {
backgroundColor = "#0dcaf0";
} else if (data.announcements.incident.style === "warning") {
backgroundColor = "#f8a306";
} else if (data.announcements.incident.style === "danger") {
backgroundColor = "#dc3545";
} else if (data.announcements.incident.style === "primary") {
backgroundColor = "#5cdd8b";
} else if (data.announcements.incident.style === "light") {
backgroundColor = "#f8f9fa";
} else if (data.announcements.incident.style === "dark") {
backgroundColor = "#212529";
}
}
}
2022-08-04 12:24:22 +03:00
</script>
2023-01-25 19:11:11 +02:00
<Hero />
2023-02-18 18:21:41 +02:00
{#if !data.announcements.error}
2023-01-25 19:11:11 +02:00
{#if data.announcements.incident}
<div class="flex flex-col items-center mt-16">
2023-02-03 19:55:33 +02:00
<div
class="flex flex-col prose break-words rounded p-4 lt-sm:max-w-74 sm:(p-8) {backgroundColor ===
'#212529'
? 'text-text'
: 'text-black'}"
style="background-color: {backgroundColor};"
>
2023-01-25 19:11:11 +02:00
{#if data.announcements.incident.title}
2023-02-03 19:55:33 +02:00
<span class="text-xl font-semibold"
>{data.announcements.incident.title}</span
>
2023-01-25 19:11:11 +02:00
{/if}
2022-08-05 17:01:15 +03:00
2023-01-25 19:11:11 +02:00
{#if data.announcements.incident.content}
2023-08-18 16:19:20 -05:00
<p class="text-black">
{@html snarkdown(
sanitizeHtml(
data.announcements.incident.content.replace(
/\n/g,
"<br />"
)
2023-02-03 19:55:33 +02:00
)
2023-08-18 16:19:20 -05:00
)}
2023-02-03 19:55:33 +02:00
</p>
2023-01-25 19:11:11 +02:00
{/if}
2022-08-04 12:24:22 +03:00
2023-01-25 19:11:11 +02:00
<span>Created - {data.announcements.incident.createdDate}</span>
{#if data.announcements.incident.lastUpdatedDate}
2023-02-03 19:55:33 +02:00
<span
>Updated - {data.announcements.incident
.lastUpdatedDate}</span
>
2023-01-25 19:11:11 +02:00
{/if}
</div>
2023-02-03 19:55:33 +02:00
</div>
2023-01-25 19:11:11 +02:00
{/if}
{:else}
2023-02-18 18:21:41 +02:00
<p>{data.announcements.message}</p>
2023-02-03 19:55:33 +02:00
{/if}