hyprland-website/src/routes/CommunitySlice.svelte

242 lines
5.7 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'
import DiscordProfilePicture from './DiscordProfilePicture.svelte'
import { animateIn } from '$lib/Helper.mjs'
import { setContext } from 'svelte'
2023-08-07 19:59:22 +02:00
import Title from '$lib/components/Title.svelte'
2023-08-27 17:02:35 +02:00
import background from '$lib/images/community-bg.png'
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 = [
{
image: '/imgs/profile_pictures/vaxry.gif',
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'
},
{
image: '/imgs/profile_pictures/Mathisbuilder.png',
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-08-05 20:33:07 +02:00
image: '/imgs/profile_pictures/loseardes77.gif',
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'
},
{
image: 'imgs/chan/cool.webp',
coordinates: [284, 533],
size: 90,
class: 'outline-cyan-500',
onDragStart: ({ detail: { currentTarget } }) => {
isDraggingChan = true
currentTarget.src = 'imgs/chan/quirky.webp'
},
onDragEnd: ({ detail: { currentTarget } }) => {
isDraggingChan = false
currentTarget.src = 'imgs/chan/cool.webp'
},
onHover: ({ detail: { srcElement } }) =>
!isDraggingChan && (srcElement.src = 'imgs/chan/love.webp')
},
{
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'
},
{
image: '/imgs/profile_pictures/qwaranou.webp',
coordinates: [873, 224],
size: 79,
class: 'outline-slate-500'
},
{
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'
}
]
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-08-27 17:02:35 +02:00
class="relative flex flex-col items-center w-screen min-h-max h-[1100px] -mb-[200px]"
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
<div class="flex flex-col items-center gap-2 group mt-16">
<a
class="discord p-4"
href="https://discord.com/invite/hQ9XvMUjjr"
target="_blank"
rel="noopener"
>
<DiscordIcon class="w-full h-full " />
</a>
<a href="https://discord.com/invite/hQ9XvMUjjr">
<Button type="fancyOutline">Join us on Discord</Button>
</a>
</div>
<div class="absolute w-[1024px]">
<div class="flex flex-wrap gap-4 origin-bottom-right h-full">
{#each profiles as { onDragEnd, onDragStart, onHover, ...props }}
<DiscordProfilePicture
{...props}
on:dragStart={onDragStart}
on:dragEnd={onDragEnd}
on:hover={onHover}
/>
{/each}
</div>
</div>
2023-08-27 17:02:35 +02:00
<img src={background} class="absolute top-0 w-[1400px] -z-10" alt="" aria-hidden="true" />
2023-07-31 11:32:19 +02:00
</section>
<style lang="postcss">
.discord {
width: 9rem;
height: 9rem;
transition:
2023-08-17 16:45:47 +02:00
rotate 480ms cubic-bezier(0.5, 0, 0.5, 1.1),
scale 420ms cubic-bezier(1, 0.1, 0, 2),
filter 840ms;
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);
animation: bounce 1s infinite;
}
&:active {
scale: 1;
transition: scale 80ms;
}
}
</style>