Browse Source

Fix sidebar

pull/110/head
Malte Grimm 3 years ago
parent
commit
aeba42bb2c
  1. 2
      src/App.tsx
  2. 6
      src/components/DeviceSelector.tsx
  3. 6
      src/components/DeviceSetup.tsx
  4. 48
      src/components/SidebarSetup.tsx
  5. 2
      src/components/form/Button.tsx

2
src/App.tsx

@ -39,7 +39,7 @@ export const App = (): JSX.Element => {
) : (
<NewDevice />
)}
<BottomNav>{device && <Drawer />}</BottomNav>
{<BottomNav>{device && <Drawer />}</BottomNav>}
</div>
</div>
</DeviceWrapper>

6
src/components/DeviceSelector.tsx

@ -12,6 +12,8 @@ export const DeviceSelector = (): JSX.Element => {
const { selectedDevice, setSelectedDevice, darkMode, setDarkMode } =
useAppStore();
console.log(`Current device: ${selectedDevice}`);
return (
<div className="flex h-full w-14 items-center gap-3 bg-backgroundPrimary pt-3 [writing-mode:vertical-rl]">
<div className="flex items-center gap-3">
@ -44,8 +46,8 @@ export const DeviceSelector = (): JSX.Element => {
</div>
</span>
</div>
{selectedDevice !== 0 && (
{selectedDevice > 0 && ( // TODO_MG: Handle selectedDevice == -1
<>
<NavSpacer />
<PageNav />

6
src/components/DeviceSetup.tsx

@ -17,9 +17,9 @@ export const DeviceSetup = (): JSX.Element => {
return (
<DeviceWrapper device={testDevice}>
<SidebarSetup/>
{/* <PageNav pages={pagesSetup}/> */}
<PageRouter/>
{ <SidebarSetup/> }
{/* <PageNav pages={pagesSetup}/> TODO_MG: Fix these */}
{/* <PageRouter/> */}
</DeviceWrapper>
);
}

48
src/components/SidebarSetup.tsx

@ -28,29 +28,31 @@ export const SidebarSetup = (): JSX.Element => {
const devicesToFlash = devices.map(d => d.selectedToFlash);
return (
<div className="bg-slate-50 relative flex flex-col w-72 flex-shrink-0 flex-col gap-2 p-2">
<div className="h-1/2">
<div className="flex h-16 flex-col gap-2 overflow-y-auto">
{devices.map((device, index) => (
<Button
key={index}
color={devicesToFlash[index] ? "bg-accentMuted" : "bg-backgroundPrimary"}
onClick={() => {
devicesToFlash[index] = !devicesToFlash[index];
console.log(`Set device ${index}: ${devicesToFlash[index]}`);
device.setSelectedToFlash(devicesToFlash[index]);
}}
size="sm"
>
{`${getButtonText(device)}`}
</Button>
))}
</div>
</div>
<div className="w-1/1 h-0.5 bg-accent"></div>
<div className="h-1/2">{<Mono>(Configurations go here)</Mono>}</div>
<div className="flex flex-grow">
<div className="bg-slate-50 relative flex w-72 flex-shrink-0 flex-col gap-2 p-2">
<div className="h-1/2">
<div className="flex h-16 flex-col gap-2 overflow-y-auto">
{devices.map((device, index) => (
<Button
key={index}
color={devicesToFlash[index] ? "bg-accentMuted" : "bg-backgroundPrimary"}
onClick={() => {
devicesToFlash[index] = !devicesToFlash[index];
console.log(`Set device ${index}: ${devicesToFlash[index]}`);
device.setSelectedToFlash(devicesToFlash[index]);
}}
size="sm"
>
{`${getButtonText(device)}`}
</Button>
))}
</div>
</div>
<div className="w-1/1 h-0.5 bg-accent"></div>
<div className="h-1/2">{<Mono>(Configurations go here)</Mono>}</div>
</div>
</div>
);
};

2
src/components/form/Button.tsx

@ -14,7 +14,7 @@ export const Button = ({
}: ButtonProps): JSX.Element => {
return (
<button
className={`flex w-full select-none rounded-md ${color} bg-accentMuted px-3 text-textPrimary hover:brightness-hover focus:outline-none active:brightness-press ${
className={`flex w-full select-none rounded-md ${color} px-3 text-textPrimary hover:brightness-hover focus:outline-none active:brightness-press ${
size === "sm"
? "h-8 text-sm"
: size === "md"

Loading…
Cancel
Save