mirror of
https://github.com/mudabbir-ahmad/Portfolio_V1.git
synced 2026-12-06 19:53:09 +00:00
Fix skills carousel: seamless right-edge coverage
This commit is contained in:
1 parent
7da63e0741
commit
cb15333409
1 file changed
+8
-5
@@ -1,15 +1,18 @@
|
|||||||
import { skills } from "../content.js";
|
import { skills } from "../content.js";
|
||||||
|
|
||||||
|
// Even copy count so the -50% translate lands on a copy boundary
|
||||||
|
// (seamless loop); 12 copies keep half the track (~5000px) far wider
|
||||||
|
// than any real viewport, so the right edge never gaps.
|
||||||
|
const COPIES = 12;
|
||||||
|
|
||||||
function Marquee({ label, items }) {
|
function Marquee({ label, items }) {
|
||||||
// Four copies so the track always covers the viewport on wide screens;
|
const row = Array.from({ length: COPIES }, () => items).flat();
|
||||||
// the -50% translate lands on a copy boundary, keeping the loop seamless.
|
|
||||||
const row = [...items, ...items, ...items, ...items];
|
|
||||||
return (
|
return (
|
||||||
<div className="marquee-block">
|
<div className="marquee-block">
|
||||||
<h3 className="marquee-label">{label}</h3>
|
<h3 className="marquee-label">{label}</h3>
|
||||||
<div
|
<div
|
||||||
className="marquee"
|
className="marquee"
|
||||||
style={{ "--marquee-duration": `${items.length * 3.4}s` }}
|
style={{ "--marquee-duration": `${items.length * 3.4 * (COPIES / 4)}s` }}
|
||||||
aria-label={`${label}: ${items.join(", ")}`}
|
aria-label={`${label}: ${items.join(", ")}`}
|
||||||
>
|
>
|
||||||
<div className="marquee-track">
|
<div className="marquee-track">
|
||||||
@@ -17,7 +20,7 @@ function Marquee({ label, items }) {
|
|||||||
<span
|
<span
|
||||||
key={`${item}-${i}`}
|
key={`${item}-${i}`}
|
||||||
className="marquee-item"
|
className="marquee-item"
|
||||||
aria-hidden={i >= items.length * 2}
|
aria-hidden={i >= items.length * (COPIES / 2)}
|
||||||
>
|
>
|
||||||
{item}
|
{item}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in new issue
Block a user