Skip to content

Commit 523a5ee

Browse files
url implementation trying to resolve path
1 parent 40f45cf commit 523a5ee

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
"react": "^17.0.2",
1515
"react-dom": "^17.0.2",
1616
"react-router-dom": "^6.27.0",
17-
"shadertoy-react": "^1.1.2",
18-
"url": "^0.11.4"
17+
"shadertoy-react": "^1.1.2"
1918
},
2019
"devDependencies": {
2120
"@monaco-editor/react": "^4.3.1",

src/Pages/ProjectsPage/PGASGame.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import PowerupSS from "@assets/PGAS24_PowerupSS.png";
66
import WarningSS from "@assets/PGAS24_WarningSS.png";
77

88
export default function PGASGame(){
9+
function getImageUrl(file: string) {
10+
return new URL(`${file}`, import.meta.url).href
11+
}
12+
913
return <div className="relative grid place-items-center">
1014
<article className="my-4 p-2 w-full max-w-sm md:max-w-2xl">
1115
<h1 className="text-4xl">PGAS-Game</h1>
@@ -35,10 +39,10 @@ export default function PGASGame(){
3539

3640
<h2 className="text-xl">Images</h2>
3741
<div className="grid gap-1 grid-cols-1 md:grid-cols-2">
38-
<img src={LevelsSS} alt="LevelSS.png"/>
39-
<img src={MainMenuSS} alt="MainMenuSS.png"/>
40-
<img src={PowerupSS} alt="PowerupSS.png"/>
41-
<img src={WarningSS} alt="WarningSS.png"/>
42+
<img src={getImageUrl(LevelsSS)} alt="LevelSS.png"/>
43+
<img src={getImageUrl(MainMenuSS)} alt="MainMenuSS.png"/>
44+
<img src={getImageUrl(PowerupSS)} alt="PowerupSS.png"/>
45+
<img src={getImageUrl(WarningSS)} alt="WarningSS.png"/>
4246
</div>
4347
</article>
4448
</div>

0 commit comments

Comments
 (0)