Skip to content

Commit b4d6327

Browse files
simonhampclaude
andcommitted
Animate feedback cards by row and add promoted factory state
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c3456a7 commit b4d6327

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

database/factories/WallOfLoveSubmissionFactory.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,14 @@ public function pending(): static
4949
'approved_by' => null,
5050
]);
5151
}
52+
53+
/**
54+
* Indicate that the submission is promoted to the homepage.
55+
*/
56+
public function promoted(): static
57+
{
58+
return $this->state(fn (array $attributes) => [
59+
'promoted' => true,
60+
]);
61+
}
5262
}

resources/views/components/home/feedback.blade.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,23 @@ class="mt-1 text-sm text-gray-500 dark:text-gray-400"
4444
</p>
4545
</div>
4646

47+
@php
48+
$columns = 4;
49+
$itemsPerColumn = (int) ceil($submissions->count() / $columns);
50+
@endphp
4751
<div class="mt-6 columns-1 gap-4 sm:columns-2 lg:columns-4">
4852
@foreach ($submissions as $submission)
53+
@php
54+
$row = $loop->index % $itemsPerColumn;
55+
@endphp
4956
<div
5057
x-init="
5158
() => {
5259
motion.inView($el, () => {
5360
gsap.fromTo(
5461
$el,
5562
{ autoAlpha: 0, y: 15 },
56-
{ autoAlpha: 1, y: 0, duration: 0.4, delay: {{ $loop->index * 0.08 }}, ease: 'power2.out' },
63+
{ autoAlpha: 1, y: 0, duration: 0.4, delay: {{ $row * 0.1 }}, ease: 'power2.out' },
5764
)
5865
})
5966
}

0 commit comments

Comments
 (0)