Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
up
  • Loading branch information
Elpiu committed Apr 23, 2024
1 parent ec18174 commit 19d5689
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ DONE to install
- [ ] fare pagina 404 e far scomparire header
- [ ] nuovo contact me con capcha per nascondere il numero
- [ ] avviene il re rendering ogni volta che si sposta l'header di sezione
- [ ] img vetrina progetto

- [ ] img vetrina progetto (trovare una strategia es: folder speciale)
- [ ] refactor contact me section
---
- [ ] rendere SPA tutto il sito per hostarlo su GitHubPages [Tutorial](https://www.youtube.com/watch?v=mJuz45RXeXY)
- [ ] disabilitare tutti i componenti server-side
Expand Down
20 changes: 19 additions & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import React from "react";
import {CgWorkAlt} from "react-icons/cg";
import {LuGraduationCap} from "react-icons/lu";

import placeholder_1 from '../../public/repo-placeholder/placeholder-1.webp'
import placeholder_2 from '../../public/repo-placeholder/placeholder-2.webp'
import placeholder_3 from '../../public/repo-placeholder/placeholder-3.webp'
import placeholder_4 from '../../public/repo-placeholder/placeholder-4.webp'
import placeholder_5 from '../../public/repo-placeholder/placeholder-5.webp'
import placeholder_6 from '../../public/repo-placeholder/placeholder-6.webp'
import placeholder_7 from '../../public/repo-placeholder/placeholder-7.webp'
import placeholder_8 from '../../public/repo-placeholder/placeholder-8.webp'

const supportedIconMapFromString = new Map()
.set("work", CgWorkAlt)
Expand Down Expand Up @@ -32,7 +40,17 @@ export const createIconFromText = (iconName: string) => {
return React.createElement(supportedIconMapFromString.get(iconName))
}


export function repositoryRandomImagePlaceholder() {
const randomIndex = Math.floor(Math.random() * 7) + 1;
return `/repo-placeholder/placeholder-${randomIndex}.webp`
switch (randomIndex) {
case 1: return placeholder_1;
case 2: return placeholder_2;
case 3: return placeholder_3;
case 4: return placeholder_4;
case 5: return placeholder_5;
case 6: return placeholder_6;
case 7: return placeholder_7;
default: return placeholder_8;
}
}

0 comments on commit 19d5689

Please sign in to comment.