your personal website on atproto - mirror
blento.app
1<script lang="ts">
2 import { marked } from 'marked';
3 import { sanitize } from '$lib/sanitize';
4 import type { WebsiteData } from '$lib/types';
5 import { getDescription, getImage, getName, getProfilePosition } from '$lib/helper';
6 import { page } from '$app/state';
7 import { qrOverlay } from '$lib/components/qr/qrOverlay.svelte';
8 import MadeWithBlento from './MadeWithBlento.svelte';
9 import { Avatar } from '@foxui/core';
10
11 let {
12 data,
13 hideBlento = false
14 }: {
15 data: WebsiteData;
16 hideBlento?: boolean;
17 } = $props();
18
19 const renderer = new marked.Renderer();
20 renderer.link = ({ href, title, text }) =>
21 `<a target="_blank" href="${href}" title="${title ?? ''}">${text}</a>`;
22
23 const profileUrl = $derived(`${page.url.origin}/${data.handle}`);
24 const profilePosition = $derived(getProfilePosition(data));
25</script>
26
27<!-- lg:fixed lg:h-screen lg:w-1/4 lg:max-w-none lg:px-12 lg:pt-24 xl:w-1/3 -->
28<div
29 class={[
30 'mx-auto flex max-w-lg flex-col justify-between px-8',
31 profilePosition === 'side'
32 ? '@5xl/wrapper:fixed @5xl/wrapper:h-screen @5xl/wrapper:w-1/4 @5xl/wrapper:max-w-none @5xl/wrapper:px-12'
33 : '@5xl/wrapper:max-w-4xl @5xl/wrapper:px-12'
34 ]}
35>
36 <div
37 class={[
38 'flex flex-col gap-4 pt-16 pb-4',
39 profilePosition === 'side' && '@5xl/wrapper:h-screen @5xl/wrapper:pt-24'
40 ]}
41 >
42 <a
43 href={profileUrl}
44 class="w-fit"
45 use:qrOverlay={{
46 context: {
47 title: getName(data) + "'s blento"
48 }
49 }}
50 >
51 <Avatar
52 src={getImage(data.publication, data.did, 'icon') || data.profile.avatar}
53 class={[
54 'border-base-400 dark:border-base-800 size-32 shrink-0 rounded-full border object-cover',
55 profilePosition === 'side' && '@5xl/wrapper:size-44'
56 ]}
57 />
58 </a>
59
60 <div class="text-4xl font-bold wrap-anywhere">
61 {getName(data)}
62 </div>
63
64 <div class="scrollbar -mx-4 grow overflow-x-hidden overflow-y-scroll px-4">
65 <div
66 class="text-base-600 dark:text-base-400 prose dark:prose-invert prose-a:text-accent-500 prose-a:no-underline"
67 >
68 {@html sanitize(
69 marked.parse(getDescription(data), {
70 renderer
71 }) as string,
72 { ADD_ATTR: ['target'] }
73 )}
74 </div>
75 </div>
76
77 {#if !hideBlento}
78 <MadeWithBlento class="hidden {profilePosition === 'side' && '@5xl/wrapper:block'}" />
79 {/if}
80 </div>
81</div>