Skip to content

Commit eede185

Browse files
author
Jesse Winton
committed
updates
1 parent ebf4fd8 commit eede185

File tree

2 files changed

+74
-26
lines changed

2 files changed

+74
-26
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<script lang="ts">
2+
import { classNames } from '$lib/utils/classnames';
3+
import { animate } from 'motion';
4+
import { type Snippet } from 'svelte';
5+
6+
interface AnimatedLogoProps {
7+
children: Snippet;
8+
delay: number;
9+
repeatDelay: number;
10+
class?: string;
11+
}
12+
13+
let element: HTMLElement;
14+
15+
const { children, delay, repeatDelay, class: className }: AnimatedLogoProps = $props();
16+
17+
$effect(() => {
18+
animate(
19+
element,
20+
{
21+
filter: ['blur(5px)', 'blur(0px)', 'blur(0px)', 'blur(5px)'],
22+
23+
y: [10, 0, 0, -10],
24+
opacity: [0, 1, 1, 0]
25+
},
26+
{
27+
delay,
28+
duration: 3,
29+
ease: 'easeInOut',
30+
repeat: Infinity,
31+
repeatDelay,
32+
repeatType: 'loop',
33+
times: [0, 0.1, 0.9, 1]
34+
}
35+
);
36+
});
37+
</script>
38+
39+
<div bind:this={element} class={classNames('will-change-transform', className)}>
40+
{@render children()}
41+
</div>

src/routes/(marketing)/(components)/logo-list.svelte

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import { classNames } from '$lib/utils/classnames';
3+
import AnimatedLogo from './animated-logo.svelte';
34
45
type Props = {
56
title?: string;
@@ -69,7 +70,7 @@
6970
{
7071
src: '/images/logos/trusted-by/nestle.svg',
7172
alt: 'Nestle',
72-
width: 119,
73+
width: 150,
7374
height: 34
7475
},
7576
{
@@ -86,36 +87,42 @@
8687
}
8788
];
8889
89-
let currentIndex = $state<number>(0);
90-
let itemCount = 4;
90+
let baseDelay = 2.9;
9191
92-
const currentLogos = $derived(logos.slice(currentIndex, currentIndex + itemCount));
93-
94-
$effect(() => {
95-
const interval = setInterval(() => {
96-
currentIndex = currentIndex + itemCount >= logos.length ? 0 : currentIndex + itemCount;
97-
}, 5000);
98-
99-
return () => {
100-
clearInterval(interval);
101-
};
102-
});
92+
const logoGroups = logos.reduce(
93+
(groups, logo, index) => {
94+
const groupIndex = Math.floor(index / 3);
95+
if (!groups[groupIndex]) {
96+
groups[groupIndex] = [];
97+
}
98+
groups[groupIndex].push(logo);
99+
return groups;
100+
},
101+
[] as Array<typeof logos>
102+
);
103103
</script>
104104

105-
<div class={classNames('py-32', className)}>
106-
<div class="container">
107-
<h2 class="font-aeonik-pro text-greyscale-100 text-label mx-auto max-w-md text-center">
105+
<div class={classNames('py-12', className)}>
106+
<div class="mx-auto max-w-4xl">
107+
<h2
108+
class="font-aeonik-pro text-greyscale-100 text-description mx-auto max-w-[312px] text-center text-pretty"
109+
>
108110
{title}
109111
</h2>
110-
<ul
111-
class="grid gap-10 pt-10 text-center"
112-
style:grid-template-columns={`repeat(${itemCount}, minmax(150px, 1fr))`}
113-
>
114-
{#each currentLogos as { src, alt, width, height }}
115-
<li class="grid place-content-center">
116-
<img {src} {alt} {width} {height} />
117-
</li>
112+
<div class="relative grid grid-cols-2 gap-4 py-10 md:grid-cols-4">
113+
{#each logoGroups as group, i}
114+
<div class="relative flex aspect-[8/2] flex-col items-center justify-center">
115+
{#each group as { src, alt, width, height }, index}
116+
<AnimatedLogo
117+
repeatDelay={baseDelay * 2}
118+
delay={index * baseDelay + i * 0.1}
119+
class="absolute"
120+
>
121+
<img {src} {alt} {width} {height} />
122+
</AnimatedLogo>
123+
{/each}
124+
</div>
118125
{/each}
119-
</ul>
126+
</div>
120127
</div>
121128
</div>

0 commit comments

Comments
 (0)