your personal website on atproto - mirror blento.app
at main 74 lines 2.2 kB view raw
1<script lang="ts"> 2 import Card from '../cards/Card/Card.svelte'; 3 import Profile from './Profile.svelte'; 4 import { getDescription, getHideProfileSection, getName, sortItems } from '../helper'; 5 import { innerWidth } from 'svelte/reactivity/window'; 6 import { setDidContext, setHandleContext, setIsMobile } from './context'; 7 import BaseCard from '../cards/BaseCard/BaseCard.svelte'; 8 import type { WebsiteData } from '$lib/types'; 9 import Context from './Context.svelte'; 10 import Head from './Head.svelte'; 11 import type { Did, Handle } from '@atcute/lexicons'; 12 13 let { data }: { data: WebsiteData } = $props(); 14 15 let isMobile = $derived((innerWidth.current ?? 1000) < 1024); 16 setIsMobile(() => isMobile); 17 18 // svelte-ignore state_referenced_locally 19 setDidContext(data.did as Did); 20 // svelte-ignore state_referenced_locally 21 setHandleContext(data.handle as Handle); 22 23 let maxHeight = $derived( 24 data.cards.reduce( 25 (max, item) => Math.max(max, isMobile ? item.mobileY + item.mobileH : item.y + item.h), 26 0 27 ) 28 ); 29 30 let container: HTMLDivElement | undefined = $state(); 31</script> 32 33<Head 34 favicon={data.profile.avatar ?? null} 35 title={getName(data)} 36 image={'/' + data.handle + '/og.png'} 37 description={getDescription(data)} 38/> 39 40<Context {data}> 41 <div class="@container/wrapper relative w-full"> 42 {#if !getHideProfileSection(data)} 43 <Profile {data} showEditButton={true} /> 44 {/if} 45 46 <div 47 class={[ 48 'mx-auto max-w-lg', 49 !getHideProfileSection(data) 50 ? '@5xl/wrapper:grid @5xl/wrapper:max-w-7xl @5xl/wrapper:grid-cols-4' 51 : '@5xl/wrapper:max-w-4xl' 52 ]} 53 > 54 <div></div> 55 <div bind:this={container} class="@container/grid relative col-span-3 px-2 py-8 lg:px-8"> 56 {#each data.cards.toSorted(sortItems) as item (item.id)} 57 <BaseCard {item}> 58 <Card {item} /> 59 </BaseCard> 60 {/each} 61 <div style="height: {(maxHeight / 8) * 100}cqw;"></div> 62 </div> 63 </div> 64 65 <div class="mx-auto block pb-8 text-center text-xs font-light @5xl/wrapper:hidden"> 66 made with <a 67 href="https://blento.app" 68 target="_blank" 69 class="hover:text-accent-600 dark:hover:text-accent-400 font-medium transition-colors duration-200" 70 >blento</a 71 > 72 </div> 73 </div> 74</Context>