Skip to content

Commit b84f79b

Browse files
authored
Docs: update carousel and footer on landing (#995)
* Docs: update footer copyright year to current year * Docs: enhancet carousel for video scrolling in GuideSection * Docs: add embla-carousel dependency to pnpm lockfile
1 parent 9e1d6d2 commit b84f79b

4 files changed

Lines changed: 38 additions & 33 deletions

File tree

landing/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"astro": "^5.18.0",
2020
"class-variance-authority": "^0.7.1",
2121
"clsx": "^2.1.1",
22+
"embla-carousel": "^8.6.0",
2223
"lucide-react": "^0.546.0",
2324
"react": "^19.2.0",
2425
"react-dom": "^19.2.0",

landing/pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

landing/src/components/GuideSection.astro

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -127,28 +127,28 @@ const videos = await getPlaylistVideos();
127127
<div class="relative w-full">
128128
<button
129129
type="button"
130-
class="bg-bg-primary text-white border-white/10 hover:bg-bg-primary/80 absolute top-1/2 left-0 z-10 inline-flex h-10 w-10 -translate-y-1/2 items-center justify-center border transition"
130+
class="bg-bg-primary text-white border-white/10 hover:bg-bg-primary/80 absolute top-1/2 left-0 z-10 inline-flex h-10 w-10 -translate-y-1/2 items-center justify-center border transition disabled:pointer-events-none disabled:opacity-40"
131131
aria-label="Scroll videos left"
132-
data-guide-scroll-left
132+
data-guide-prev
133133
>
134134
<ChevronLeft className="h-5 w-5" />
135135
</button>
136136
<button
137137
type="button"
138-
class="bg-bg-primary text-white border-white/10 hover:bg-bg-primary/80 absolute top-1/2 right-0 z-10 inline-flex h-10 w-10 -translate-y-1/2 items-center justify-center border transition"
138+
class="bg-bg-primary text-white border-white/10 hover:bg-bg-primary/80 absolute top-1/2 right-0 z-10 inline-flex h-10 w-10 -translate-y-1/2 items-center justify-center border transition disabled:pointer-events-none disabled:opacity-40"
139139
aria-label="Scroll videos right"
140-
data-guide-scroll-right
140+
data-guide-next
141141
>
142142
<ChevronRight className="h-5 w-5" />
143143
</button>
144144
<div
145-
class="guide-scrollbar-hidden mx-auto w-[calc(100%-104px)] overflow-x-auto"
146-
data-guide-scroll
145+
class="mx-auto w-[calc(100%-104px)] overflow-hidden"
146+
data-guide-embla
147147
>
148-
<div class="flex min-w-max gap-4">
148+
<div class="flex gap-4">
149149
{
150150
videos.map((video) => (
151-
<div class="bg-bg-primary w-[220px] shrink-0 overflow-hidden sm:w-[250px] md:w-[280px]">
151+
<div class="bg-bg-primary w-[220px] shrink-0 grow-0 basis-auto overflow-hidden sm:w-[250px] md:w-[280px]">
152152
<a
153153
href={`https://www.youtube.com/watch?v=${video.id}`}
154154
target="_blank"
@@ -176,32 +176,28 @@ const videos = await getPlaylistVideos();
176176
</ContentWrapper>
177177
</section>
178178

179-
<style>
180-
.guide-scrollbar-hidden {
181-
scrollbar-width: none;
182-
-ms-overflow-style: none;
183-
}
184-
185-
.guide-scrollbar-hidden::-webkit-scrollbar {
186-
display: none;
187-
}
188-
</style>
179+
<script>
180+
import EmblaCarousel from "embla-carousel";
189181

190-
<script is:inline>
191-
const scrollContainer = document.querySelector("[data-guide-scroll]");
192-
const leftButton = document.querySelector("[data-guide-scroll-left]");
193-
const rightButton = document.querySelector("[data-guide-scroll-right]");
182+
const node = document.querySelector<HTMLElement>("[data-guide-embla]");
183+
const prevBtn = document.querySelector<HTMLButtonElement>("[data-guide-prev]");
184+
const nextBtn = document.querySelector<HTMLButtonElement>("[data-guide-next]");
194185

195-
const scrollByAmount = () => {
196-
if (!scrollContainer) return 280;
197-
return Math.max(220, Math.floor(scrollContainer.clientWidth * 0.7));
198-
};
186+
if (node) {
187+
const embla = EmblaCarousel(node, {
188+
align: "start",
189+
dragFree: true,
190+
containScroll: "trimSnaps",
191+
});
199192

200-
leftButton?.addEventListener("click", () => {
201-
scrollContainer?.scrollBy({ left: -scrollByAmount(), behavior: "smooth" });
202-
});
193+
const update = () => {
194+
if (prevBtn) prevBtn.disabled = !embla.canScrollPrev();
195+
if (nextBtn) nextBtn.disabled = !embla.canScrollNext();
196+
};
203197

204-
rightButton?.addEventListener("click", () => {
205-
scrollContainer?.scrollBy({ left: scrollByAmount(), behavior: "smooth" });
206-
});
198+
prevBtn?.addEventListener("click", () => embla.scrollPrev());
199+
nextBtn?.addEventListener("click", () => embla.scrollNext());
200+
embla.on("select", update).on("init", update).on("reInit", update);
201+
update();
202+
}
207203
</script>

landing/src/components/ui/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const Footer = React.forwardRef<HTMLElement, FooterProps>(
151151
))}
152152
</div>
153153
<p className="text-md mt-3 font-normal">
154-
&copy; Software Mansion 2025.
154+
&copy; Software Mansion {new Date().getFullYear()}.
155155
</p>
156156
</div>
157157
</div>

0 commit comments

Comments
 (0)