hyprland-website/src/routes/CommunitySlice.svelte

258 lines
6.1 KiB
Svelte
Raw Normal View History

2023-07-31 11:32:19 +02:00
<script context="module">
export const contextId = Symbol('community context')
</script>
<script>
import Button from '$lib/components/Button.svelte'
import DiscordIcon from '~icons/prime/discord'
2023-11-02 15:20:05 +01:00
import DiscordProfilePicture from '$lib/components/DiscordProfilePicture.svelte'
2023-07-31 11:32:19 +02:00
import { setContext } from 'svelte'
2023-08-07 19:59:22 +02:00
import Title from '$lib/components/Title.svelte'
2023-09-13 14:27:13 +02:00
import background from '$lib/images/community-bg.webp'
2023-11-02 15:20:05 +01:00
import amongUsGreenImage from '$lib/images/amongus/green.webp'
2023-07-31 11:32:19 +02:00
let sectionElement
let isDraggingChan = false
/** @type {{image: string coordinates: [number, number] containerClass: string}[], size: number, quote?: string } */
const profiles = [
{
2023-09-10 08:09:06 +02:00
image: '/imgs/profile_pictures/vaxry.webp',
2023-07-31 11:32:19 +02:00
coordinates: [187, 296],
size: 172,
class: 'outline-red-500'
},
{
image: '/imgs/profile_pictures/fufexan.webp',
coordinates: [735, 441],
size: 164,
class: 'outline-yellow-500'
},
{
image: '/imgs/profile_pictures/raf-notashelf.webp',
coordinates: [391, 615],
size: 149,
class: 'outline-orange-500'
},
{
2023-09-10 08:09:06 +02:00
image: '/imgs/profile_pictures/Mathisbuilder.webp',
2023-07-31 11:32:19 +02:00
coordinates: [568, 568],
size: 120,
class: 'outline-amber-500'
},
{
image: '/imgs/profile_pictures/dani_666..webp',
coordinates: [525, 764],
size: 80,
class: 'outline-red-500'
},
{
image: '/imgs/profile_pictures/end_4.webp',
coordinates: [648, 709],
size: 128,
class: 'outline-cyan-400'
},
{
image: '/imgs/profile_pictures/ardishco.webp',
coordinates: [65, 208],
size: 100,
class: 'outline-slate-200'
},
{
2023-08-17 16:45:47 +02:00
image: '/imgs/profile_pictures/kcrmson.webp',
2023-07-31 11:32:19 +02:00
coordinates: [53, 399],
size: 75,
2023-08-17 16:45:47 +02:00
class: 'outline-sky-500'
2023-07-31 11:32:19 +02:00
},
{
2023-09-10 08:09:06 +02:00
image: '/imgs/profile_pictures/loseardes77.webp',
2023-07-31 11:32:19 +02:00
coordinates: [24, 341],
size: 49,
2023-08-05 20:33:07 +02:00
class: 'outline-green-500'
2023-07-31 11:32:19 +02:00
},
{
image: '/imgs/profile_pictures/captainiveau.webp',
coordinates: [47, 86],
size: 48,
class: 'outline-red-500'
},
{
image: '/imgs/profile_pictures/etrigan63.webp',
coordinates: [135, 538],
size: 93,
class: 'outline-amber-500'
},
{
image: '/imgs/profile_pictures/jsw.webp',
coordinates: [41, 566],
size: 49,
class: 'outline-sky-500'
},
{
2023-09-13 14:27:13 +02:00
image: 'imgs/chan/joy.svg',
2023-07-31 11:32:19 +02:00
coordinates: [284, 533],
size: 90,
2023-09-13 14:27:13 +02:00
class: 'outline-cyan-500 bg-blue-300',
2023-07-31 11:32:19 +02:00
onDragStart: ({ detail: { currentTarget } }) => {
isDraggingChan = true
2023-09-13 14:27:13 +02:00
currentTarget.src = 'imgs/chan/surprise.svg'
2023-07-31 11:32:19 +02:00
},
onDragEnd: ({ detail: { currentTarget } }) => {
isDraggingChan = false
2023-09-13 14:27:13 +02:00
currentTarget.src = 'imgs/chan/tongueout.svg'
2023-07-31 11:32:19 +02:00
},
onHover: ({ detail: { srcElement } }) =>
2023-09-13 14:27:13 +02:00
!isDraggingChan && (srcElement.src = 'imgs/chan/wink.svg')
2023-07-31 11:32:19 +02:00
},
{
image: '/imgs/profile_pictures/7.webp',
coordinates: [273, 687],
size: 52,
2023-08-17 16:45:47 +02:00
quote: '"meds"',
2023-07-31 11:32:19 +02:00
class: 'outline-cyan-500'
},
{
2023-08-17 16:45:47 +02:00
image: '/imgs/profile_pictures/outfoxxed.webp',
2023-07-31 11:32:19 +02:00
coordinates: [648, 364],
size: 80,
2023-08-17 16:45:47 +02:00
class: 'outline-orange-500'
2023-07-31 11:32:19 +02:00
},
{
image: '/imgs/profile_pictures/kirottum.webp',
coordinates: [772, 651],
size: 62,
class: 'outline-purple-500'
},
{
2023-08-05 20:33:07 +02:00
image: '/imgs/profile_pictures/beardwarrior.webp',
2023-07-31 11:32:19 +02:00
coordinates: [736, 277],
size: 87,
2023-08-05 20:33:07 +02:00
class: 'outline-amber-500'
2023-07-31 11:32:19 +02:00
},
{
image: '/imgs/profile_pictures/neoney.webp',
coordinates: [898, 364],
size: 68,
class: 'outline-green-500'
},
{
2023-11-02 15:20:05 +01:00
image: amongUsGreenImage,
2023-07-31 11:32:19 +02:00
coordinates: [873, 224],
size: 79,
2023-11-02 15:20:05 +01:00
class: 'outline-green-500'
2023-07-31 11:32:19 +02:00
},
{
image: '/imgs/profile_pictures/SimplyKyle!.webp',
coordinates: [859, 159],
size: 39,
class: 'outline-rose-500'
},
{
image: '/imgs/profile_pictures/sioodmy.webp',
coordinates: [974, 107],
size: 48,
class: 'outline-amber-500'
},
{
image: '/imgs/profile_pictures/flafy.webp',
coordinates: [340, 790],
size: 80,
class: 'outline-pink-500'
2023-09-13 14:27:13 +02:00
},
{
image: '/imgs/profile_pictures/jacekpoz.svg',
coordinates: [180, 730],
size: 80,
2023-09-15 18:46:48 +02:00
class: 'outline-yellow-500 bg-orange-700',
quote: '"Piss blob"'
2023-07-31 11:32:19 +02:00
}
]
setContext(contextId, {
biggestSize: profiles.reduce(
(previousSize, { size }) => (size > previousSize ? size : previousSize),
1
),
smallestSize: profiles.reduce(
(previousSize, { size }) => (size < previousSize ? size : previousSize),
Number.POSITIVE_INFINITY
),
getSectionElement: () => sectionElement
})
</script>
<section
2023-09-10 08:09:06 +02:00
class="relative -mb-[200px] flex h-[1100px] min-h-max w-screen flex-col items-center"
2023-07-31 11:32:19 +02:00
bind:this={sectionElement}
>
2023-08-07 19:59:22 +02:00
<Title>
<span slot="title">Join a great<br />community</span>
<span slot="subtitle">
2023-07-31 11:32:19 +02:00
Get help from Distro Hoppers, Haiku writers,<br />Hydrohomies and human_(probably)
2023-08-07 19:59:22 +02:00
</span>
</Title>
2023-07-31 11:32:19 +02:00
2023-09-13 14:27:13 +02:00
<div class="group mt-16 flex flex-col items-center">
2023-07-31 11:32:19 +02:00
<a
class="discord p-4"
href="https://discord.com/invite/hQ9XvMUjjr"
target="_blank"
rel="noopener"
2023-09-10 08:09:06 +02:00
aria-label="Join us on Discord"
2023-07-31 11:32:19 +02:00
>
2023-09-10 08:09:06 +02:00
<DiscordIcon class="h-full w-full " />
2023-07-31 11:32:19 +02:00
</a>
<a href="https://discord.com/invite/hQ9XvMUjjr">
<Button type="fancyOutline">Join us on Discord</Button>
</a>
</div>
2023-11-02 15:20:05 +01:00
<div class="absolute w-[1024px] select-none">
<div class="flex h-full origin-bottom-right select-none flex-wrap gap-4">
2023-07-31 11:32:19 +02:00
{#each profiles as { onDragEnd, onDragStart, onHover, ...props }}
<DiscordProfilePicture
{...props}
on:dragStart={onDragStart}
on:dragEnd={onDragEnd}
on:hover={onHover}
/>
{/each}
</div>
</div>
2023-09-13 14:27:13 +02:00
<img
src={background}
2023-11-02 15:20:05 +01:00
class="absolute top-0 -z-10 min-w-[1400px] select-none"
2023-09-13 14:27:13 +02:00
alt=""
aria-hidden="true"
loading="lazy"
/>
2023-07-31 11:32:19 +02:00
</section>
<style lang="postcss">
.discord {
width: 9rem;
height: 9rem;
transition:
2023-09-13 14:27:13 +02:00
rotate 500ms cubic-bezier(0.5, 0, 0.5, 1),
scale 420ms cubic-bezier(0.5, 0.1, 0, 1),
2023-08-17 16:45:47 +02:00
filter 840ms;
2023-09-13 14:27:13 +02:00
transition-delay: 240ms, 180ms, 20ms;
transform: translateY(-25%);
2023-07-31 11:32:19 +02:00
filter: drop-shadow(0px 0px 0px cyan) drop-shadow(0px 0px 0px blue);
&:hover,
.group:hover & {
scale: 1.2 1.2;
rotate: 360deg;
filter: drop-shadow(4px 4px 14px #0fffef7a) drop-shadow(-4px -4px 12px purple);
2023-09-13 14:27:13 +02:00
animation: bounce 0.7s infinite 180ms both;
2023-07-31 11:32:19 +02:00
}
&:active {
scale: 1;
transition: scale 80ms;
}
}
</style>