From 08739a2e3dfda1901ade4c9c1828d6a1e143365e Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 15 Apr 2024 09:09:45 +0100 Subject: [PATCH] cleanup --- src/components/player-search.tsx | 10 +++++++--- src/components/server-search.tsx | 10 +++++++--- src/components/ui/card.tsx | 7 +++++++ 3 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 src/components/ui/card.tsx diff --git a/src/components/player-search.tsx b/src/components/player-search.tsx index 6c2687f..db660a2 100644 --- a/src/components/player-search.tsx +++ b/src/components/player-search.tsx @@ -6,10 +6,13 @@ import Link from "next/link"; import { useState } from "react"; import { toast } from "react-toastify"; import { Button } from "./ui/button"; +import { Card } from "./ui/card"; import { Input } from "./ui/input"; +const defaultPlayerId = "Notch"; + export default function PlayerSearch() { - const [playerId, setPlayerId] = useState(null); + const [playerId, setPlayerId] = useState(defaultPlayerId); const [player, setPlayer] = useState(null); const handleLookup = async () => { @@ -40,6 +43,7 @@ export default function PlayerSearch() { setPlayerId(e.target.value)} onKeyDown={handleKeyDown} /> @@ -47,7 +51,7 @@ export default function PlayerSearch() { {player && ( -
+ The player's Head

@@ -71,7 +75,7 @@ export default function PlayerSearch() {

- + )} ); diff --git a/src/components/server-search.tsx b/src/components/server-search.tsx index 3f61168..0ba8733 100644 --- a/src/components/server-search.tsx +++ b/src/components/server-search.tsx @@ -8,10 +8,13 @@ import Image from "next/image"; import { useState } from "react"; import { toast } from "react-toastify"; import { Button } from "./ui/button"; +import { Card } from "./ui/card"; import { Input } from "./ui/input"; +const defaultServerHostname = "play.hypixel.net"; + export default function ServerSearch() { - const [serverHostname, setServerHostname] = useState(null); + const [serverHostname, setServerHostname] = useState(defaultServerHostname); const [server, setServer] = useState(null); const handleLookup = async () => { @@ -41,6 +44,7 @@ export default function ServerSearch() { setServerHostname(e.target.value)} onKeyDown={handleKeyDown} /> @@ -48,7 +52,7 @@ export default function ServerSearch() { {server && ( -
+
The server's Icon @@ -67,7 +71,7 @@ export default function ServerSearch() { Players: {server.players.online}/{server.players.max}
- + )} ); diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx new file mode 100644 index 0000000..120fd1c --- /dev/null +++ b/src/components/ui/card.tsx @@ -0,0 +1,7 @@ +export function Card({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + return
{children}
; +}