Skip to content

Commit

Permalink
Fix key error for skills with less than 3 projects
Browse files Browse the repository at this point in the history
  • Loading branch information
rbourdon committed Aug 3, 2023
1 parent 5ecfb81 commit cbb31ee
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions components/Projects/ProjectsScroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,26 @@ export default function ProjectScroller({ projects, bgColor, primaryColor }) {
onPanStart={handlePanStart}
onPan={handlePan}
onPanEnd={handlePanEnd}
style={{ cursor: panning ? "grabbing" : "grab" }}
style={{
cursor: panning ? "grabbing" : "grab",
gridTemplateColumns: `repeat(${Math.min(
3,
projects.length
)}, 340px)`,
}}
>
{[
...projects.slice(rollerPos, rollerPos + 3),
...projects.slice(
rollerPos,
rollerPos + Math.min(3, projects.length)
),
...projects.slice(
0,
3 - projects.slice(rollerPos, rollerPos + 3).length
Math.min(3, projects.length) -
projects.slice(
rollerPos,
rollerPos + Math.min(3, projects.length)
).length
),
].map((project, index) => {
return (
Expand Down

0 comments on commit cbb31ee

Please sign in to comment.