From 7a38eef00de0bb35565dda3ddb1efa748c22ea47 Mon Sep 17 00:00:00 2001 From: realtradam Date: Thu, 23 May 2024 16:55:59 -0400 Subject: improve games --- src/components/Game.jsx | 13 +++++-------- src/components/GameCard.jsx | 6 +++--- src/components/Games.jsx | 20 +++++++++++--------- 3 files changed, 19 insertions(+), 20 deletions(-) (limited to 'src/components') diff --git a/src/components/Game.jsx b/src/components/Game.jsx index 7746767..a7bd007 100644 --- a/src/components/Game.jsx +++ b/src/components/Game.jsx @@ -1,10 +1,7 @@ import React, { useState, useEffect } from "react"; import { useParams } from "react-router-dom"; -//import { Link } from "react-router-dom"; -import GameCard from "./GameCard"; -import Button from "./Button"; -//} /> +//} /> //export default () => ( export default function Games () { @@ -12,10 +9,10 @@ export default function Games () { //http://%{VITE_API_TITLE}/api/v1/game/realtradam/orc-arena-of-time/index.html return( <> -
-
-
Orc: Arena of Time
- +
+
+
{game}
+
diff --git a/src/components/GameCard.jsx b/src/components/GameCard.jsx index 82ad423..ac63160 100644 --- a/src/components/GameCard.jsx +++ b/src/components/GameCard.jsx @@ -15,10 +15,10 @@ export default function GameCard ({ link = "./", width = "72", game = { card_img
- +
- - + +
diff --git a/src/components/Games.jsx b/src/components/Games.jsx index a0646be..173b3b7 100644 --- a/src/components/Games.jsx +++ b/src/components/Games.jsx @@ -16,13 +16,14 @@ export default function Games () { }).then((response) => setGames(response))//.catch(() => navigate("/")); }, []); const allGames = games.map((game) => ( - + )); var handleSubmit = (e) => { e.preventDefault() //stops submit from happening const form = e.target; const formData = new FormData() formData.append('game[title]', form.title.value) + formData.append('game[img_rendering]', form.img_rendering.value) for(let i =0; i < form.game_files.files.length; i++) { formData.append('game[game_files][]', form.game_files.files[i], form.game_files.files[i].value); @@ -35,7 +36,7 @@ export default function Games () { console.log(pair[0] + ', ' + pair[1]) }; - fetch('${import.meta.env.VITE_API_TITLE}/api/v1/games', { + fetch(`${import.meta.env.VITE_API_TITLE}/api/v1/games`, { method: 'post', body: formData, }); @@ -54,6 +55,13 @@ export default function Games () {
+ + +
+
@@ -77,14 +85,8 @@ export default function Games () {
- { allGames }
- - - - - - + { allGames }
-- cgit v1.2.3