style cleanup

This commit is contained in:
2025-08-12 19:40:54 -04:00
parent 01d1571b0e
commit 4419dd7acc
8 changed files with 50 additions and 105 deletions

View File

@@ -6,19 +6,15 @@ import { render } from "solid-js/web";
import Root from "./routes/index"; import Root from "./routes/index";
import "virtual:uno.css"; import "virtual:uno.css";
const Version = () => (
<>
<span class="fixed br m-2 font-mono text-xs">v{pkg.version}</span>
<div class="i-solar-user-circle-bold fixed s-10 top-0 right-0 m-2 cursor-pointer" />
</>
);
const App = () => ( const App = () => (
<Router <Router
root={(props) => ( root={(props) => (
<> <>
<Suspense>{props.children}</Suspense> <Suspense>{props.children}</Suspense>
<Version /> <span class="fixed br m-2 font-mono text-xs">
{"v" + pkg.version}
</span>
<div class="i-solar-user-circle-bold fixed s-10 top-0 right-0 m-2 cursor-pointer" />
</> </>
)} )}
> >

View File

@@ -24,10 +24,7 @@ export default ((props) => {
onClick={props.onClick} onClick={props.onClick}
draggable={false} draggable={false}
class={props.class} class={props.class}
style={{ style={props.style}
"border-radius": "5px",
...props.style,
}}
width="100px" width="100px"
src={ src={
props.face == "down" props.face == "down"

View File

@@ -30,19 +30,13 @@ export default (props: { instanceId: string }) => {
return ( return (
<GameContext.Provider value={{ view, submitAction }}> <GameContext.Provider value={{ view, submitAction }}>
<Show when={view.latest != undefined}> <Show when={view.latest != undefined}>
<div <Pile
class="full column center" count={view.latest!.deckCount}
style={{ "row-gap": "20px", "font-size": "32px" }} class="cursor-pointer fixed center"
> onClick={() => submitAction({ type: "draw" })}
<div class="full center"> />
<Pile
count={view.latest!.deckCount} <Hand class="fixed bc" hand={view.latest!.myHand} />
style={{ cursor: "pointer" }}
onClick={() => submitAction({ type: "draw" })}
/>
</div>
<Hand hand={view.latest!.myHand} />
</div>
</Show> </Show>
</GameContext.Provider> </GameContext.Provider>
); );

View File

@@ -3,29 +3,13 @@ import Card from "./Card";
import { Hand } from "../../../shared/cards"; import { Hand } from "../../../shared/cards";
import { GameContext } from "./Game"; import { GameContext } from "./Game";
import { produce } from "solid-js/store"; import { produce } from "solid-js/store";
import { Stylable } from "./toolbox";
export default ((props) => { export default ((props) => {
const { submitAction, view } = useContext(GameContext)!; const { submitAction, view } = useContext(GameContext)!;
return ( return (
<div <div class={"hand " + props.class} style={props.style}>
class="hand"
style={{
"min-width": "100px",
width: "fit-content",
"max-width": "80%",
border: "2px dashed white",
"border-radius": "12px",
margin: "10px",
"margin-bottom": "25px",
padding: "10px",
height: "180px",
overflow: "scroll",
"scrollbar-width": "none",
display: "flex",
gap: "5px",
}}
>
<For each={props.hand}> <For each={props.hand}>
{(card) => ( {(card) => (
<Card <Card
@@ -39,4 +23,4 @@ export default ((props) => {
</For> </For>
</div> </div>
); );
}) satisfies Component<{ hand: Hand }>; }) satisfies Component<{ hand: Hand } & Stylable>;

View File

@@ -5,20 +5,14 @@ import { Clickable, Stylable } from "./toolbox";
export default ((props) => { export default ((props) => {
return ( return (
<div <Show when={props.count > 0}>
{...props} <Card
class={`center ${props.class ?? ""}}`.trim()} onClick={props.onClick}
style={{ style={props.style}
width: "200px", class={props.class + " shadow-lg shadow-black"}
height: "400px", face="down"
...(props.style as JSX.CSSProperties), />
}} </Show>
onClick={props.onClick}
>
<Show when={props.count > 0}>
<Card face="down" />
</Show>
</div>
); );
}) satisfies Component< }) satisfies Component<
{ {

View File

@@ -8,20 +8,7 @@ export default () => {
return ( return (
<> <>
<Game instanceId={params.instance} /> <Game instanceId={params.instance} />
<A <A href={`/${params.game}`} class="fixed tl m-4 px-2 py-1.5 button">
href={`/${params.game}`}
// style={{
// position: "absolute",
// padding: "10px",
// top: "0",
// left: "0",
// margin: "20px",
// "background-color": "white",
// "border-radius": "8px",
// border: "2px solid black",
// }}
class="fixed tl m-4 px-2 py-1.5 button"
>
Back Back
</A> </A>
</> </>

View File

@@ -44,41 +44,19 @@ a:visited {
} }
.hand { .hand {
height: 160px;
background: radial-gradient(rgb(24, 70, 82), rgb(1, 42, 41)); background: radial-gradient(rgb(24, 70, 82), rgb(1, 42, 41));
} min-width: 100px;
width: fit-content;
max-width: 90%;
border: 2px dashed white;
border-radius: 12px;
.full { margin-bottom: 50px;
height: 100%; padding: 10px;
width: 100%;
}
.w-full { overflow: scroll;
width: 100%; scrollbar-width: none;
}
.center {
display: flex; display: flex;
justify-content: center; gap: 5px;
align-items: center;
}
.column {
display: flex;
flex-direction: column;
}
.free {
position: absolute;
top: 0;
left: 0;
}
.fixed-br {
position: fixed;
bottom: 0;
right: 0;
}
.clear {
pointer-events: none;
} }

View File

@@ -21,5 +21,20 @@ export default defineConfig({
["tr", { top: 0, right: 0 }], ["tr", { top: 0, right: 0 }],
["bl", { bottom: 0, left: 0 }], ["bl", { bottom: 0, left: 0 }],
["br", { bottom: 0, right: 0 }], ["br", { bottom: 0, right: 0 }],
[
"bc",
{
bottom: 0,
left: 0,
right: 0,
"margin-left": "auto",
"margin-right": "auto",
},
],
[
"center",
{ top: "50%", left: "50%", transform: "translate(-50%, -50%)" },
],
], ],
}); });