wip
This commit is contained in:
23
apps/website/lib/leagueCovers.ts
Normal file
23
apps/website/lib/leagueCovers.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
function hashString(input: string): number {
|
||||
let hash = 0;
|
||||
for (let i = 0; i < input.length; i += 1) {
|
||||
hash = (hash * 31 + input.charCodeAt(i)) | 0;
|
||||
}
|
||||
return Math.abs(hash);
|
||||
}
|
||||
|
||||
const GRADIENTS: string[] = [
|
||||
'bg-gradient-to-r from-blue-500/80 via-indigo-500/80 to-purple-500/80',
|
||||
'bg-gradient-to-r from-emerald-500/80 via-teal-500/80 to-cyan-500/80',
|
||||
'bg-gradient-to-r from-amber-500/80 via-orange-500/80 to-rose-500/80',
|
||||
'bg-gradient-to-r from-fuchsia-500/80 via-purple-500/80 to-sky-500/80',
|
||||
'bg-gradient-to-r from-lime-500/80 via-emerald-500/80 to-green-500/80',
|
||||
'bg-gradient-to-r from-slate-500/80 via-slate-600/80 to-slate-700/80',
|
||||
];
|
||||
|
||||
export function getLeagueCoverClasses(leagueId: string): string {
|
||||
const index = hashString(leagueId) % GRADIENTS.length;
|
||||
const baseLayout =
|
||||
'w-full h-32 rounded-lg overflow-hidden border border-charcoal-outline/60';
|
||||
return baseLayout + ' ' + GRADIENTS[index];
|
||||
}
|
||||
Reference in New Issue
Block a user