A less terrible UI

This commit is contained in:
2022-04-19 16:44:04 +02:00
parent 751f16fbab
commit 657d583b28
2 changed files with 42 additions and 18 deletions

View File

@@ -120,23 +120,30 @@ export function App() {
}; };
return ( return (
<div> <div class="connectionBar">
<div class="autoconnectSwitch">
Autoconnect:
<input <input
onChange={onAutoConnectChange} onChange={onAutoConnectChange}
checked={autoConnect} checked={autoConnect}
type="checkbox" type="checkbox"
/> />
</div>
<div class="connectionStatus">
{connecting && !device && <span>Trying to connect</span>} {connecting && !device && <span>Trying to connect</span>}
{device == null && !connecting && ( {device == null && !connecting && (
<button onClick={tryConnect}>Connect</button> <button onClick={tryConnect}>Connect</button>
)} )}
{device && ( {device && (
<> <>
<span>connected</span> <span>Connected </span>
<button onClick={onDisconnectClick}>Disconnect</button> <button onClick={onDisconnectClick}>Disconnect</button>
{doorOpen != null && <span>{doorOpen ? "open" : "closed"}</span>}
</> </>
)} )}
</div> </div>
<div>
{doorOpen != null && <span>Door: {doorOpen ? "open" : "closed"}</span>}
</div>
</div>
); );
} }

View File

@@ -1,7 +1,24 @@
body { body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
Arial, sans-serif; Arial, sans-serif;
margin: auto; margin: auto;
max-width: 38rem; max-width: 38rem;
padding: 2rem; padding: 2rem;
} }
.connectionBar {
display: flex;
flex-wrap: wrap;
}
.autoconnectSwitch {
width: 100%;
}
.connectionStatus {
width: 100%;
}
.connectionBar >* {
height: 2rem;
}