linter issues
All checks were successful
Lint / Lint and Typecheck (push) Successful in 41s

This commit is contained in:
2025-11-15 18:18:15 +01:00
parent 6b7e254014
commit 431e654154
4 changed files with 50 additions and 32 deletions

View File

@@ -1,5 +1,6 @@
"use client";
import { useState, useEffect } from "react";
import type React from "react";
import {
type LucideIcon,
HandCoins,
@@ -112,14 +113,15 @@ export default function MultiIconPattern({ opacity = 0.2, spacing = 160 }) {
Target,
];
const renderIcons = ({
rows,
columns,
}: {
rows: number;
columns: number;
}) => {
const icons = [];
const [icons, setIcons] = useState<React.ReactElement[]>([]);
useEffect(() => {
if (rows === 0 || columns === 0) {
setIcons([]);
return;
}
const iconElements: React.ReactElement[] = [];
for (let y = 0; y < rows; y++) {
for (let x = 0; x < columns; x++) {
// Pick a random icon component from the array
@@ -130,28 +132,30 @@ export default function MultiIconPattern({ opacity = 0.2, spacing = 160 }) {
const size = 28 + Math.floor(Math.random() * 8);
const xOffset = Math.floor(Math.random() * (spacing / 1.618));
const yOffset = Math.floor(Math.random() * (spacing / 1.618));
const rotation = Math.round((Math.random() - 0.5) * 30);
icons.push(
iconElements.push(
<IconComponent
key={`icon-${x}-${y}`}
key={`icon-${String(x)}-${String(y)}`}
size={size}
className="text-primary fixed"
style={{
left: `${x * spacing + xOffset}px`,
top: `${y * spacing + yOffset}px`,
left: `${String(x * spacing + xOffset)}px`,
top: `${String(y * spacing + yOffset)}px`,
opacity: opacity,
transform: `rotate(${Math.round((Math.random() - 0.5) * 30)}deg)`,
transform: `rotate(${String(rotation)}deg)`,
}}
/>,
);
}
}
return icons;
};
setIcons(iconElements);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [rows, columns, spacing, opacity]);
return (
<div className="absolute h-full w-full">
{width > 0 && renderIcons({ rows, columns })}
{width > 0 && icons}
</div>
);
}