Update Settings Page

This commit is contained in:
Bastian Meissner 2021-11-23 17:50:30 +01:00
parent e2ebb55768
commit eb5cb2dee6
3 changed files with 31 additions and 20 deletions

View file

@ -6,11 +6,11 @@ import { IconButton } from "./icon";
const ModalContainer = styled.div` const ModalContainer = styled.div`
position: absolute; position: absolute;
top: 50%;
left: 50%; left: 50%;
top: 1rem; transform: translate(-50%, -50%);
padding: 1rem;
transform: translate(-50%, 0%);
z-index: 10; z-index: 10;
padding: 1rem;
border: 1px solid ${(props) => props.theme.mainColor}; border: 1px solid ${(props) => props.theme.mainColor};
background-color: ${(props) => props.theme.backgroundColor}; background-color: ${(props) => props.theme.backgroundColor};
`; `;

View file

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import styled from "styled-components";
export interface IItemProps { export interface IItemProps {
label: string; label: string;
@ -13,6 +14,11 @@ export interface ISelectProps {
testId?: string; testId?: string;
} }
const List = styled.select`
border-radius: 0;
padding: 0.5rem;
`;
const update = ( const update = (
items: Array<IItemProps>, items: Array<IItemProps>,
onChange: (item: any) => void, onChange: (item: any) => void,
@ -28,7 +34,7 @@ const Select = ({
className, className,
testId, testId,
}: ISelectProps) => ( }: ISelectProps) => (
<select <List
data-testid={"select" + (testId ? "-" + testId : "")} data-testid={"select" + (testId ? "-" + testId : "")}
onChange={(e) => update(items, onChange, e)} onChange={(e) => update(items, onChange, e)}
className={className} className={className}
@ -57,7 +63,7 @@ const Select = ({
); );
} }
})} })}
</select> </List>
); );
export default Select; export default Select;

View file

@ -10,6 +10,7 @@ import { Button, SubHeadline } from "./elements";
import Modal from "./modal"; import Modal from "./modal";
export const FormContainer = styled.div` export const FormContainer = styled.div`
display: flex;
margin-bottom: 1em; margin-bottom: 1em;
`; `;
@ -97,8 +98,9 @@ const Settings = ({ themes, search }: ISettingsProps) => {
<Modal element="icon" icon="settings" title="Settings"> <Modal element="icon" icon="settings" title="Settings">
{themes && ( {themes && (
<Section> <Section>
<SectionHeadline>Theme:</SectionHeadline> <SectionHeadline>Theme</SectionHeadline>
<FormContainer> <FormContainer>
<div>
<ThemeHeader>Light</ThemeHeader> <ThemeHeader>Light</ThemeHeader>
<ThemeSelect <ThemeSelect
items={themes} items={themes}
@ -106,6 +108,8 @@ const Settings = ({ themes, search }: ISettingsProps) => {
current={currentLightTheme} current={currentLightTheme}
testId="light" testId="light"
></ThemeSelect> ></ThemeSelect>
</div>
<div>
<ThemeHeader>Dark</ThemeHeader> <ThemeHeader>Dark</ThemeHeader>
<ThemeSelect <ThemeSelect
items={themes} items={themes}
@ -113,6 +117,7 @@ const Settings = ({ themes, search }: ISettingsProps) => {
current={currentDarkTheme} current={currentDarkTheme}
testId="dark" testId="dark"
></ThemeSelect> ></ThemeSelect>
</div>
</FormContainer> </FormContainer>
<Button <Button
data-testid="button-submit" data-testid="button-submit"