cccb font, layout adjustments
This commit is contained in:
parent
b604c01e22
commit
6c0f2aa198
BIN
tank-frontend/public/CCCBFont.woff
Normal file
BIN
tank-frontend/public/CCCBFont.woff
Normal file
Binary file not shown.
|
@ -1,8 +1,3 @@
|
||||||
.PlayerInfo {
|
|
||||||
border: 2px solid rgb(76, 76, 76);
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.Elems {
|
.Elems {
|
||||||
padding: 8px 8px;
|
padding: 8px 8px;
|
||||||
margin: 8px 8px;
|
margin: 8px 8px;
|
||||||
|
|
|
@ -4,12 +4,10 @@ import {PlayerResponse, getPlayer} from './serverCalls';
|
||||||
import {Guid} from "./Guid.ts";
|
import {Guid} from "./Guid.ts";
|
||||||
import Column from "./components/Column.tsx";
|
import Column from "./components/Column.tsx";
|
||||||
import Row from "./components/Row.tsx";
|
import Row from "./components/Row.tsx";
|
||||||
import Button from "./components/Button.tsx";
|
|
||||||
|
|
||||||
export default function PlayerInfo({playerId, logout, reset}: {
|
export default function PlayerInfo({playerId, logout}: {
|
||||||
playerId: Guid,
|
playerId: Guid,
|
||||||
logout: () => void,
|
logout: () => void
|
||||||
reset: () => void
|
|
||||||
}) {
|
}) {
|
||||||
const [player, setPlayer] = useState<PlayerResponse | null>();
|
const [player, setPlayer] = useState<PlayerResponse | null>();
|
||||||
|
|
||||||
|
@ -28,12 +26,9 @@ export default function PlayerInfo({playerId, logout, reset}: {
|
||||||
}, [playerId]);
|
}, [playerId]);
|
||||||
|
|
||||||
return <Column className='PlayerInfo'>
|
return <Column className='PlayerInfo'>
|
||||||
<Row>
|
<h3>
|
||||||
<h3 className='grow'>
|
|
||||||
{player ? `Playing as "${player?.name}"` : 'loading...'}
|
{player ? `Playing as "${player?.name}"` : 'loading...'}
|
||||||
</h3>
|
</h3>
|
||||||
<Button className='PlayerInfo-Reset' onClick={() => reset()} text='x'/>
|
|
||||||
</Row>
|
|
||||||
<Row>
|
<Row>
|
||||||
<p className='Elems'> kills: </p>
|
<p className='Elems'> kills: </p>
|
||||||
<p className='Elems'>{player?.scores.kills}</p>
|
<p className='Elems'>{player?.scores.kills}</p>
|
||||||
|
|
|
@ -4,4 +4,5 @@
|
||||||
flex: auto;
|
flex: auto;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,4 +4,5 @@
|
||||||
flex: auto;
|
flex: auto;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,22 @@ body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100vw;
|
width: 95vw;
|
||||||
height: 100vh;
|
height: 95vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grow {
|
.grow {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'CCCBFont';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
font-display: swap;
|
||||||
|
src: url('/public/CCCBFont.woff') format('woff');
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
font-family: CCCBFont, monospace;
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {NameId, postPlayer} from './serverCalls.tsx';
|
||||||
import Column from "./components/Column.tsx";
|
import Column from "./components/Column.tsx";
|
||||||
import Row from "./components/Row.tsx";
|
import Row from "./components/Row.tsx";
|
||||||
import Scoreboard from "./Scoreboard.tsx";
|
import Scoreboard from "./Scoreboard.tsx";
|
||||||
|
import Button from "./components/Button.tsx";
|
||||||
|
|
||||||
const getNewNameId = () => ({
|
const getNewNameId = () => ({
|
||||||
id: crypto.randomUUID(),
|
id: crypto.randomUUID(),
|
||||||
|
@ -30,12 +31,16 @@ function App() {
|
||||||
}, [nameId, isLoggedIn])();
|
}, [nameId, isLoggedIn])();
|
||||||
|
|
||||||
return <Column className='grow'>
|
return <Column className='grow'>
|
||||||
<h1>Tanks!</h1>
|
<Row>
|
||||||
{nameId.name === '' && <JoinForm setNameId={setNameId} clientId={nameId.id}/>}
|
<h1 className='grow'>Tanks!</h1>
|
||||||
|
{nameId.name !== '' &&
|
||||||
|
<Button className='PlayerInfo-Reset' onClick={() => setNameId(getNewNameId)} text='x'/>}
|
||||||
|
</Row>
|
||||||
<ClientScreen logout={logout}/>
|
<ClientScreen logout={logout}/>
|
||||||
|
{nameId.name === '' && <JoinForm setNameId={setNameId} clientId={nameId.id}/>}
|
||||||
{isLoggedIn && <Row>
|
{isLoggedIn && <Row>
|
||||||
<Controls playerId={nameId.id} logout={logout}/>
|
<Controls playerId={nameId.id} logout={logout}/>
|
||||||
<PlayerInfo playerId={nameId.id} logout={logout} reset={() => setNameId(getNewNameId)}/>
|
<PlayerInfo playerId={nameId.id} logout={logout}/>
|
||||||
<Scoreboard/>
|
<Scoreboard/>
|
||||||
</Row>
|
</Row>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue