From add184d580bdb01f7460a4afcf5a82a7e95b64e8 Mon Sep 17 00:00:00 2001 From: Bastian Meissner Date: Wed, 24 Nov 2021 21:30:44 +0100 Subject: [PATCH] Update Settings Modal --- src/components/elements.tsx | 2 +- src/components/modal.tsx | 45 +++++++---- src/components/settings.tsx | 153 ++++++++++++++++++++---------------- 3 files changed, 116 insertions(+), 84 deletions(-) diff --git a/src/components/elements.tsx b/src/components/elements.tsx index 3051995..da21b83 100644 --- a/src/components/elements.tsx +++ b/src/components/elements.tsx @@ -28,7 +28,7 @@ export const ItemList = styled.ul` padding: 0; list-style: none; - @media (max-width: 750px) { + @media (max-width: 766px) { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } `; diff --git a/src/components/modal.tsx b/src/components/modal.tsx index 416e5bb..ae42f1e 100644 --- a/src/components/modal.tsx +++ b/src/components/modal.tsx @@ -5,14 +5,28 @@ import { Headline } from "./elements"; import { IconButton } from "./icon"; const ModalContainer = styled.div` - position: absolute; + position: fixed; + top: 50%; left: 50%; transform: translate(-50%, -50%); - z-index: 10; - padding: 1rem; + + z-index: 1; + + max-height: 100%; + + overflow-y: auto; + + box-sizing: border-box; border: 1px solid ${(props) => props.theme.mainColor}; background-color: ${(props) => props.theme.backgroundColor}; + + padding: 1rem; + + @media (max-width: 766px) { + width: 100%; + height: 100%; + } `; const Text = styled.p` @@ -32,6 +46,7 @@ const Text = styled.p` const TitleContainer = styled.div` display: flex; + flex-direction: row; flex-wrap: nowrap; justify-content: space-between; @@ -70,6 +85,18 @@ const Modal = ({ return ( <> + + {element === "icon" && ( )} - - ); }; diff --git a/src/components/settings.tsx b/src/components/settings.tsx index a95a74b..72faa12 100644 --- a/src/components/settings.tsx +++ b/src/components/settings.tsx @@ -10,7 +10,9 @@ import { Button, SubHeadline } from "./elements"; import Modal from "./modal"; export const FormContainer = styled.div` - display: flex; + display: inline-grid; + grid-template-columns: auto auto; + grid-gap: 0.5rem 1rem; margin-bottom: 1em; `; @@ -56,7 +58,6 @@ const Code = styled.p` `; const ThemeHeader = styled.p` - grid-column: 1 / 4; color: ${(props) => props.theme.accentColor}; `; @@ -76,6 +77,16 @@ const ThemeSelect = styled(Select)` } `; +const ContentContainer = styled.div` + display: flex; + justify-content: space-between; + flex-direction: row; + + @media (max-width: 766px) { + flex-direction: column; + } +`; + interface ISettingsProps { themes: Array | undefined; search: ISearchProps | undefined; @@ -96,73 +107,79 @@ const Settings = ({ themes, search }: ISettingsProps) => { if (themes || search) { return ( - {themes && ( -
- Theme - -
- Light - setNewLightTheme(theme)} - current={currentLightTheme} - testId="light" - > -
-
- Dark - setNewDarkTheme(theme)} - current={currentDarkTheme} - testId="dark" - > -
-
- - -
- )} - {search && ( -
- Search Providers - <> - Default Search Provider - {search.defaultProvider} - - <> - {search.providers && ( - - - - Search Provider - Prefix - - {search.providers.map(({ name, prefix }, index) => ( - - {name} - {prefix} + + {themes && ( +
+ Theme + +
+ Light + setNewLightTheme(theme)} + current={currentLightTheme} + testId="light" + > +
+
+ Dark + setNewDarkTheme(theme)} + current={currentDarkTheme} + testId="dark" + > +
+
+ +
+
+ +
+
+
+ )} + {search && ( +
+ Search Providers + <> + Default Search Provider + {search.defaultProvider} + + <> + {search.providers && ( +
+ + + Search Provider + Prefix - ))} - -
- )} - -
- )} + {search.providers.map(({ name, prefix }, index) => ( + + {name} + {prefix} + + ))} + + + )} + + + )} +
); } else {