diff --git a/.gitignore b/.gitignore index ccbe641..93acad9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ node_modules /functions/\[\[path\]\].js /functions/\[\[path\]\].js.map /public/build -.env +.env \ No newline at end of file diff --git a/app/components/Card.tsx b/app/components/Card.tsx index df7b631..255ae7c 100644 --- a/app/components/Card.tsx +++ b/app/components/Card.tsx @@ -8,6 +8,7 @@ export const CardBase = styled("div", { backgroundColor: "#000", border: "2px solid #fff", borderRadius: "0.5rem", + margin: "1rem", }); export const CardHeader = styled(Link, { @@ -17,4 +18,12 @@ export const CardHeader = styled(Link, { justifyContent: "space-between", backgroundColor: "#ccc", borderRadius: "0.5rem", + fontSize: "1.25rem", + color: "#000", + textDecoration: "none", + padding: "0.5rem", + cursor: "pointer", + ":hover": { + backgroundColor: "#fff", + }, }); diff --git a/app/components/FactionBar.tsx b/app/components/FactionBar.tsx index e69de29..68cea5f 100644 --- a/app/components/FactionBar.tsx +++ b/app/components/FactionBar.tsx @@ -0,0 +1,55 @@ +import { styled } from "styletron-react"; + +const BarRoot = styled("div", { + display: "flex", + flexDirection: "row", + alignItems: "center", + overflow: "hidden", + borderRadius: "0.5rem", + border: "1px solid #888", +}); + +const Bar = styled( + "div", + ({ + color, + size, + borders = false, + }: { + color: string; + size: number; + borders?: boolean; + }) => ({ + backgroundColor: color, + flex: size, + padding: "0 0.35rem", + textAlign: "center", + textShadow: "0 0 0.25rem #000", + }) +); + +export const FactionBar = ({ + nc, + tr, + vs, + showNumbers = true, +}: { + showNumbers?: boolean; + nc: number; + tr: number; + vs: number; +}) => { + return ( + + + {nc.toLocaleString()} + + + {tr.toLocaleString()} + + + {vs.toLocaleString()} + + + ); +}; diff --git a/app/globalStyles.ts b/app/globalStyles.ts index ee98f42..f2c8a08 100644 --- a/app/globalStyles.ts +++ b/app/globalStyles.ts @@ -8,4 +8,5 @@ export const Body = styled("body", { color: "#fff", lineHeight: 1.6, fontFamily: "Inter, system-ui, sans-serif", + margin: 0, }); diff --git a/app/routes/index.tsx b/app/routes/index.tsx index 92003b7..f391b99 100644 --- a/app/routes/index.tsx +++ b/app/routes/index.tsx @@ -4,6 +4,7 @@ import type { IndexResponse, World } from "~/utils/saerro"; import { indexQuery } from "~/utils/saerro"; import { useLoaderData } from "@remix-run/react"; import { json } from "@remix-run/cloudflare"; +import { FactionBar } from "~/components/FactionBar"; export const loader = async () => { return json(await indexQuery()); @@ -26,10 +27,15 @@ const WorldCard = ({ world }: { world: World }) => { {world.name} - - - + + + + Population: {world.population.total.toLocaleString()} + + + + ); };