Skip to content

Commit

Permalink
Some css cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielBaulig committed Feb 16, 2024
1 parent 7f7c0d5 commit be29034
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 23 deletions.
4 changes: 3 additions & 1 deletion src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ h3 {

button {
background-color: var(--primary-color);
border-radius: 8px;
min-height: 3rem;
color: black;
font-family: inherit;
font-size: inherit;
color: black;
}

button:disabled {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/Spinner.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { spinner } from './Spinner.module.css';

export default function Spinner() {
return <div className={spinner}>
export default function Spinner({className}) {
return <div className={`${spinner} ${className}`}>
<div></div>
<div></div>
<div></div>
Expand Down
8 changes: 6 additions & 2 deletions src/ui/components/DrawerCard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
padding: 0 0 0 0.5rem;
}

.header button {
min-height: 0;
border: none;
background-color: transparent;
}

.title {
padding: 0 0 0 0.25rem;
flex-grow: 1;
text-align: left;
user-select: text;
border: none;
background-color: transparent;
}

.title h3 {
Expand Down
17 changes: 10 additions & 7 deletions src/ui/components/Improv.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import EntitySection from './EntitySection';
import WifiSelectionComponent from './WifiSelectionComponent';

import iif from '../../iif';
import css from '../css';

import { mdiWifiCheck, mdiWifiCog, mdiWifiCancel } from '@mdi/js';
import { useState } from 'react';

import { fill, flex } from './Improv.module.css';
import { flex, flexFill } from '../utility.module.css';
import { link } from './Improv.module.css';

export default function Improv({
initializing,
Expand All @@ -28,25 +30,26 @@ export default function Improv({
const [ isShowingWifiDialog, setShowWifiDialog] = useState(false);

if (notDetected && !initializing) {
return
return (
<EntitySection title="Wi-Fi" className={flex}>
<Icon className={`${flex} ${fill}`} path={mdiWifiCancel} size={4}/>
<Icon className={css(flex, flexFill)} path={mdiWifiCancel} size={4}/>
<h3 className={flex}>No Improv detected</h3>
</EntitySection>
);
}

if (!initialized) {
return <Spinner />;
return <Spinner className={css(flex, flexFill)} />;
}

let wifiSection = <>
<Icon
className={`${flex} ${fill}`}
className={css(flex, flexFill)}
size={4}
path={provisioned ? mdiWifiCheck : mdiWifiCog}
/>
{iif(error && !provisioned,
<h3 className={`${fill} ${flex}`}>Provisioning failed.</h3>
<h3 className={css(flex, flexFill)}>Provisioning failed.</h3>
)}
<button
onClick={() => {
Expand All @@ -58,7 +61,7 @@ export default function Improv({
</button>
{iif(nextUrl,
<a
className={flex}
className={css(link, flex)}
href={nextUrl}
target="_blank"
>
Expand Down
12 changes: 1 addition & 11 deletions src/ui/components/Improv.module.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
.fill {
flex-basis: 100%;
}

.flex {
display: flex;
flex-grow: 1;
justify-content: center;
}

a.flex {
.link {
text-decoration: inherit;
}

Expand Down
3 changes: 3 additions & 0 deletions src/ui/css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function css(...args) {
return args.join(' ');
}
10 changes: 10 additions & 0 deletions src/ui/utility.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.flex {
display: flex;
flex-grow: 1;
justify-content: center;
}

.flexFill {
flex-basis: 100%;
}

0 comments on commit be29034

Please sign in to comment.