feat: Implement a dark theme and modern UI components with improved layout and styling.

This commit is contained in:
code002lover 2025-12-03 19:48:23 +01:00
parent 0c3c9e61b6
commit deae3a106b
8 changed files with 317 additions and 194 deletions

View File

@ -2,41 +2,79 @@
max-width: 1280px; max-width: 1280px;
margin: 0 auto; margin: 0 auto;
padding: 2rem; padding: 2rem;
text-align: center; width: 100%;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
} }
.card { .card {
padding: 2em; background-color: var(--secondary-bg);
padding: 2rem;
border-radius: 16px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
border: 1px solid var(--border-color);
} }
.read-the-docs { .navbar {
color: #888; display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--border-color);
}
.nav-links {
display: flex;
gap: 1.5rem;
}
.nav-link {
font-size: 1.2rem;
font-weight: 600;
color: var(--text-muted);
transition: color 0.2s;
}
.nav-link:hover, .nav-link.active {
color: var(--accent-color);
}
.form-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin-bottom: 1rem;
}
.form-group label {
font-size: 0.9rem;
color: var(--text-muted);
}
.btn-secondary {
background-color: var(--secondary-alt-bg);
border: 1px solid var(--border-color);
}
.btn-secondary:hover {
background-color: var(--border-color);
}
.list-item {
background-color: var(--secondary-alt-bg);
padding: 1rem;
border-radius: 8px;
margin-bottom: 1rem;
border: 1px solid var(--border-color);
transition: transform 0.2s;
}
.list-item:hover {
transform: translateY(-2px);
border-color: var(--accent-color);
}
.grid-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 1.5rem;
} }

View File

@ -44,33 +44,18 @@ function App() {
return ( return (
<BrowserRouter> <BrowserRouter>
<div className="card"> <div className="card">
<div <div className="navbar">
style={{ <div className="nav-links">
display: "flex", <Link to="/" className="nav-link">
justifyContent: "space-between",
alignItems: "center",
marginBottom: "1rem",
}}
>
<h2>
<Link
to="/"
style={{
textDecoration: "none",
color: "inherit",
marginRight: "1rem",
}}
>
People List People List
</Link> </Link>
<Link <Link to="/games" className="nav-link">
to="/games"
style={{ textDecoration: "none", color: "inherit" }}
>
Games Games
</Link> </Link>
</h2> </div>
<button onClick={handleLogout}>Logout</button> <button onClick={handleLogout} className="btn-secondary">
Logout
</button>
</div> </div>
<Routes> <Routes>
<Route path="/" element={<PersonList people={people} />} /> <Route path="/" element={<PersonList people={people} />} />

View File

@ -70,27 +70,30 @@ export function GameList() {
return ( return (
<div> <div>
<h2>Add New Game</h2> <h2>Add New Game</h2>
{message && <p>{message}</p>} {message && (
<p
style={{ color: message.includes("success") ? "#4caf50" : "#f44336" }}
>
{message}
</p>
)}
<form <form
onSubmit={handleSubmit} onSubmit={handleSubmit}
style={{ className="form-group"
display: "flex", style={{ maxWidth: "500px" }}
flexDirection: "column",
gap: "1rem",
maxWidth: "400px",
}}
> >
<label> <div className="form-group">
Title: <label>Title</label>
<input <input
type="text" type="text"
value={title} value={title}
onChange={(e) => setTitle(e.target.value)} onChange={(e) => setTitle(e.target.value)}
required required
placeholder="Game Title"
/> />
</label> </div>
<label> <div className="form-group">
Source: <label>Source</label>
<select <select
value={source} value={source}
onChange={(e) => setSource(Number(e.target.value))} onChange={(e) => setSource(Number(e.target.value))}
@ -98,56 +101,92 @@ export function GameList() {
<option value={Source.STEAM}>Steam</option> <option value={Source.STEAM}>Steam</option>
<option value={Source.ROBLOX}>Roblox</option> <option value={Source.ROBLOX}>Roblox</option>
</select> </select>
</label> </div>
<label> <div
Multiplayer: className="form-group"
style={{ flexDirection: "row", alignItems: "center" }}
>
<input <input
type="checkbox" type="checkbox"
checked={multiplayer} checked={multiplayer}
onChange={(e) => setMultiplayer(e.target.checked)} onChange={(e) => setMultiplayer(e.target.checked)}
id="multiplayer"
/> />
<label
htmlFor="multiplayer"
style={{ marginBottom: 0, cursor: "pointer" }}
>
Multiplayer
</label> </label>
<label> </div>
Min Players: <div
style={{
display: "grid",
gridTemplateColumns: "1fr 1fr",
gap: "1rem",
}}
>
<div className="form-group">
<label>Min Players</label>
<input <input
type="number" type="number"
value={minPlayers} value={minPlayers}
onChange={(e) => setMinPlayers(Number(e.target.value))} onChange={(e) => setMinPlayers(Number(e.target.value))}
/> />
</label> </div>
<label> <div className="form-group">
Max Players: <label>Max Players</label>
<input <input
type="number" type="number"
value={maxPlayers} value={maxPlayers}
onChange={(e) => setMaxPlayers(Number(e.target.value))} onChange={(e) => setMaxPlayers(Number(e.target.value))}
/> />
</label> </div>
<label> </div>
Price: <div
style={{
display: "grid",
gridTemplateColumns: "1fr 1fr",
gap: "1rem",
}}
>
<div className="form-group">
<label>Price</label>
<input <input
type="number" type="number"
value={price} value={price}
onChange={(e) => setPrice(Number(e.target.value))} onChange={(e) => setPrice(Number(e.target.value))}
/> />
</label> </div>
<label> <div className="form-group">
Remote ID: <label>Remote ID</label>
<input <input
type="number" type="number"
value={remoteId} value={remoteId}
onChange={(e) => setRemoteId(Number(e.target.value))} onChange={(e) => setRemoteId(Number(e.target.value))}
/> />
</label> </div>
<button type="submit">Add Game</button> </div>
<button type="submit" style={{ marginTop: "1rem" }}>
Add Game
</button>
</form> </form>
<div style={{ marginTop: "2rem" }}> <div style={{ marginTop: "3rem" }}>
<h3>Existing Games</h3> <h3>Existing Games</h3>
<ul> <ul className="grid-container">
{games.map((game) => ( {games.map((game) => (
<li key={game.title}> <li key={game.title} className="list-item">
{game.title} ({game.source === Source.STEAM ? "Steam" : "Roblox"}) <strong>{game.title}</strong>
<div
style={{
fontSize: "0.9em",
color: "var(--text-muted)",
marginTop: "0.5rem",
}}
>
{game.source === Source.STEAM ? "Steam" : "Roblox"}
</div>
</li> </li>
))} ))}
</ul> </ul>

View File

@ -41,37 +41,36 @@ export function Login({ onLogin }: LoginProps) {
}; };
return ( return (
<div className="card"> <div className="card" style={{ maxWidth: "400px", margin: "4rem auto" }}>
<h2>Login</h2> <h2 style={{ textAlign: "center", marginBottom: "2rem" }}>Login</h2>
<form <form onSubmit={handleSubmit} className="form-group">
onSubmit={handleSubmit} <div className="form-group">
style={{ display: "flex", flexDirection: "column", gap: "1rem" }} <label>Username</label>
>
<div>
<label style={{ display: "block", marginBottom: "0.5rem" }}>
Username:{" "}
</label>
<input <input
type="text" type="text"
value={username} value={username}
onChange={(e) => setUsername(e.target.value)} onChange={(e) => setUsername(e.target.value)}
style={{ padding: "0.5rem" }} placeholder="Enter your username"
/> />
</div> </div>
<div> <div className="form-group">
<label style={{ display: "block", marginBottom: "0.5rem" }}> <label>Password</label>
Password:{" "}
</label>
<input <input
type="password" type="password"
value={password} value={password}
onChange={(e) => setPassword(e.target.value)} onChange={(e) => setPassword(e.target.value)}
style={{ padding: "0.5rem" }} placeholder="Enter your password"
/> />
</div> </div>
<button type="submit">Login</button> <button type="submit" style={{ marginTop: "1rem" }}>
Login
</button>
</form> </form>
{error && <p style={{ color: "red", marginTop: "1rem" }}>{error}</p>} {error && (
<p style={{ color: "#ff6b6b", marginTop: "1rem", textAlign: "center" }}>
{error}
</p>
)}
</div> </div>
); );
} }

View File

@ -75,28 +75,52 @@ export const PersonDetails = () => {
if (!person) return <div>Loading...</div>; if (!person) return <div>Loading...</div>;
return ( return (
<div className="card"> <div>
<div style={{ marginBottom: "2rem" }}>
<h2>{person.name}</h2> <h2>{person.name}</h2>
<ul> <ul className="grid-container">
{person.opinion.map((op, i) => ( {person.opinion.map((op, i) => (
<li key={i}> <li
{op.title} - {op.wouldPlay ? "Would Play" : "Would Not Play"} key={i}
className="list-item"
style={{ borderColor: op.wouldPlay ? "#4caf50" : "#f44336" }}
>
<strong>{op.title}</strong>
<div
style={{
color: op.wouldPlay ? "#4caf50" : "#f44336",
marginTop: "0.5rem",
}}
>
{op.wouldPlay ? "Would Play" : "Would Not Play"}
</div>
</li> </li>
))} ))}
</ul> </ul>
</div>
<div <div
style={{ style={{
marginTop: "2rem", marginTop: "2rem",
borderTop: "1px solid #ccc", borderTop: "1px solid var(--border-color)",
paddingTop: "1rem", paddingTop: "2rem",
}} }}
> >
<h3>Add Opinion</h3> <h3>Add Opinion</h3>
<div style={{ display: "flex", gap: "1rem", alignItems: "center" }}> <div
style={{
display: "flex",
gap: "1rem",
alignItems: "flex-end",
flexWrap: "wrap",
}}
>
<div className="form-group" style={{ marginBottom: 0, flex: 1 }}>
<label>Game</label>
<select <select
value={gameTitle} value={gameTitle}
onChange={(e) => setGameTitle(e.target.value)} onChange={(e) => setGameTitle(e.target.value)}
style={{ width: "100%" }}
> >
{games.map((g) => ( {games.map((g) => (
<option key={g.title} value={g.title}> <option key={g.title} value={g.title}>
@ -104,15 +128,32 @@ export const PersonDetails = () => {
</option> </option>
))} ))}
</select> </select>
<label> </div>
<div
className="form-group"
style={{
marginBottom: 0,
flexDirection: "row",
alignItems: "center",
paddingBottom: "0.5rem",
}}
>
<input <input
type="checkbox" type="checkbox"
checked={wouldPlay} checked={wouldPlay}
onChange={(e) => setWouldPlay(e.target.checked)} onChange={(e) => setWouldPlay(e.target.checked)}
id="wouldPlay"
/> />
<label
htmlFor="wouldPlay"
style={{ marginBottom: 0, cursor: "pointer" }}
>
Would Play Would Play
</label> </label>
<button onClick={handleAddOpinion}>Add</button> </div>
<button onClick={handleAddOpinion} style={{ marginBottom: "2px" }}>
Add
</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -7,23 +7,18 @@ interface Props {
export const PersonList = ({ people }: Props) => { export const PersonList = ({ people }: Props) => {
return ( return (
<div> <div className="grid-container">
{people.map((person, index) => ( {people.map((person, index) => (
<div <div key={index} className="list-item">
key={index}
style={{
marginBottom: "1rem",
padding: "1rem",
border: "1px solid #ccc",
borderRadius: "8px",
}}
>
<h3> <h3>
<Link to={`/person/${person.name}`}>{person.name}</Link> <Link to={`/person/${person.name}`}>{person.name}</Link>
</h3> </h3>
<ul> <ul>
{person.opinion.map((op, i) => ( {person.opinion.map((op, i) => (
<li key={i}> <li
key={i}
style={{ color: op.wouldPlay ? "#4caf50" : "#f44336" }}
>
{op.title} - {op.wouldPlay ? "Would Play" : "Would Not Play"} {op.title} - {op.wouldPlay ? "Would Play" : "Would Not Play"}
</li> </li>
))} ))}

View File

@ -1,11 +1,20 @@
:root { :root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif; --primary-bg: #23283d;
line-height: 1.5; --secondary-bg: #1e2233;
--secondary-alt-bg: #191f2e;
--tertiary-bg: #101320;
--accent-color: #096dc0;
--text-color: #ffffff;
--text-muted: #a0a0a0;
--border-color: #2a3045;
font-family: 'Inter', system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.6;
font-weight: 400; font-weight: 400;
color-scheme: light dark; color-scheme: dark;
color: rgba(255, 255, 255, 0.87); color: var(--text-color);
background-color: #242424; background-color: var(--primary-bg);
font-synthesis: none; font-synthesis: none;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
@ -13,26 +22,29 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body { body {
margin: 0; margin: 0;
display: flex; display: flex;
place-items: center; place-items: center;
min-width: 320px; min-width: 320px;
min-height: 100vh; min-height: 100vh;
background-color: var(--primary-bg);
} }
h1 { h1, h2, h3, h4, h5, h6 {
font-size: 3.2em; color: var(--text-color);
line-height: 1.1; margin-top: 0;
}
a {
font-weight: 500;
color: var(--accent-color);
text-decoration: inherit;
transition: color 0.2s;
}
a:hover {
color: #4da3ff;
} }
button { button {
@ -42,27 +54,41 @@ button {
font-size: 1em; font-size: 1em;
font-weight: 500; font-weight: 500;
font-family: inherit; font-family: inherit;
background-color: #1a1a1a; background-color: var(--accent-color);
color: white;
cursor: pointer; cursor: pointer;
transition: border-color 0.25s; transition: background-color 0.25s, transform 0.1s;
} }
button:hover { button:hover {
border-color: #646cff; background-color: #0b7dda;
} }
button:active {
transform: scale(0.98);
}
button:focus, button:focus,
button:focus-visible { button:focus-visible {
outline: 4px auto -webkit-focus-ring-color; outline: 4px auto -webkit-focus-ring-color;
} }
@media (prefers-color-scheme: light) { input, select {
:root { background-color: var(--secondary-alt-bg);
color: #213547; border: 1px solid var(--border-color);
background-color: #ffffff; color: var(--text-color);
padding: 0.6em;
border-radius: 6px;
font-size: 1em;
font-family: inherit;
} }
a:hover {
color: #747bff; input:focus, select:focus {
} outline: 2px solid var(--accent-color);
button { border-color: transparent;
background-color: #f9f9f9;
} }
ul {
list-style: none;
padding: 0;
} }

View File

@ -17,7 +17,7 @@
"opinion": [ "opinion": [
{ {
"title": "Naramo Nuclear Plant V2", "title": "Naramo Nuclear Plant V2",
"would_play": true "would_play": false
}, },
{ {
"title": "Test2", "title": "Test2",