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`
position: absolute;
top: 50%;
left: 50%;
top: 1rem;
padding: 1rem;
transform: translate(-50%, 0%);
transform: translate(-50%, -50%);
z-index: 10;
padding: 1rem;
border: 1px solid ${(props) => props.theme.mainColor};
background-color: ${(props) => props.theme.backgroundColor};
`;

View file

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

View file

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