From fd5bfd161d2cd0138458d837783ee6cd0f522dc9 Mon Sep 17 00:00:00 2001
From: nimbleghost <132819643+nimbleghost@users.noreply.github.com>
Date: Mon, 26 Jun 2023 23:19:58 +0200
Subject: [PATCH] Web app UI: make preferences responsive
---
web/src/components/Account.jsx | 2 +-
web/src/components/Pref.jsx | 100 ++++++++++++++++++---------------
2 files changed, 55 insertions(+), 47 deletions(-)
diff --git a/web/src/components/Account.jsx b/web/src/components/Account.jsx
index a6a624b8..977bf161 100644
--- a/web/src/components/Account.jsx
+++ b/web/src/components/Account.jsx
@@ -785,7 +785,7 @@ const Tokens = () => {
}}
/>
- {tokens?.length > 0 && }
+
{tokens?.length > 0 && }
diff --git a/web/src/components/Pref.jsx b/web/src/components/Pref.jsx
index a725d115..5e64c41f 100644
--- a/web/src/components/Pref.jsx
+++ b/web/src/components/Pref.jsx
@@ -1,52 +1,60 @@
+import { styled } from "@mui/material";
import * as React from "react";
-export const PrefGroup = (props) => {props.children}
;
+export const PrefGroup = styled("div", { attrs: { role: "table" } })`
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+`;
-export const Pref = (props) => {
- const justifyContent = props.alignTop ? "normal" : "center";
- return (
-
-
+const PrefRow = styled("div")`
+ display: flex;
+ flex-direction: row;
+
+ > :first-child {
+ flex: 1 0 40%;
+ display: flex;
+ flex-direction: column;
+ justify-content: ${(props) => (props.alignTop ? "normal" : "center")};
+ }
+
+ > :last-child {
+ flex: 1 0 calc(60% - 50px);
+ display: flex;
+ flex-direction: column;
+ justify-content: ${(props) => (props.alignTop ? "normal" : "center")};
+ }
+
+ @media (max-width: 1000px) {
+ flex-direction: column;
+ gap: 10px;
+
+ > :first-child,
+ > :last-child {
+ flex: unset;
+ }
+
+ > :last-child {
+ .MuiFormControl-root {
+ margin: 0;
+ }
+ }
+ }
+`;
+
+export const Pref = (props) => (
+
+
+
+ {props.title}
+ {props.subtitle && ({props.subtitle})}
+
+ {props.description && (
- {props.title}
- {props.subtitle && ({props.subtitle})}
+ {props.description}
- {props.description && (
-
- {props.description}
-
- )}
-
-
- {props.children}
-
+ )}
- );
-};
+
{props.children}
+
+);