Skip to content

Commit

Permalink
fix: change to common form elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelmala committed Nov 19, 2024
1 parent 3735dc1 commit 9e35890
Showing 1 changed file with 23 additions and 42 deletions.
65 changes: 23 additions & 42 deletions src/components/production-line/settings-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import styled from "@emotion/styled";
import React, { useRef } from "react";
import { PrimaryButton, SecondaryButton } from "../landing-page/form-elements";
import {
PrimaryButton,
SecondaryButton,
FormLabel,
FormInput,
FormContainer,
DecorativeLabel,
} from "../landing-page/form-elements";

const ModalOverlay = styled.div`
position: fixed;
Expand All @@ -22,7 +29,7 @@ const ModalContent = styled.div`
width: 80%;
max-width: 40rem;
box-shadow: 0 0.4rem 0.8rem rgba(0, 0, 0, 0.2);
text-color: white;
color: white;
`;

const ModalHeader = styled.h2`
Expand All @@ -41,32 +48,6 @@ const ModalCloseButton = styled.button`
font-size: 1.6rem;
`;

const Form = styled.form`
display: flex;
flex-direction: column;
gap: 1rem;
`;

const FormField = styled.div`
display: flex;
align-items: center;
gap: 1rem;
`;

const Label = styled.label`
font-size: 1.4rem;
width: 30%;
color: white;
`;

const Input = styled.input`
flex: 1;
padding: 0.5rem;
border: 0.1rem solid #ccc;
border-radius: 0.25rem;
font-size: 1.2rem;
`;

const CancelButton = styled(SecondaryButton)`
background-color: #000000;
`;
Expand Down Expand Up @@ -132,10 +113,10 @@ export const SettingsModal = ({
<ModalContent onClick={stopPropagation}>
<ModalCloseButton onClick={onClose}>X</ModalCloseButton>
<ModalHeader>Hotkey settings for line: {lineName}</ModalHeader>
<Form>
<FormField>
<Label>Toggle mute: </Label>
<Input
<FormContainer>
<FormLabel>
<DecorativeLabel>Toggle mute: </DecorativeLabel>
<FormInput
id="hotkeyMute"
ref={(el) => setInputRef(0, el)}
type="text"
Expand All @@ -145,10 +126,10 @@ export const SettingsModal = ({
maxLength={1}
onKeyDown={(e) => handleKeyDown(e, 0)}
/>
</FormField>
<FormField>
<Label>Toggle speaker: </Label>
<Input
</FormLabel>
<FormLabel>
<DecorativeLabel>Toggle speaker: </DecorativeLabel>
<FormInput
id="hotkeySpeaker"
ref={(el) => setInputRef(1, el)}
type="text"
Expand All @@ -160,10 +141,10 @@ export const SettingsModal = ({
maxLength={1}
onKeyDown={(e) => handleKeyDown(e, 1)}
/>
</FormField>
<FormField>
<Label>Toggle press to speak: </Label>
<Input
</FormLabel>
<FormLabel>
<DecorativeLabel>Toggle press to speak: </DecorativeLabel>
<FormInput
id="hotkeyPress"
ref={(el) => setInputRef(2, el)}
type="text"
Expand All @@ -175,7 +156,7 @@ export const SettingsModal = ({
maxLength={1}
onKeyDown={(e) => handleKeyDown(e, 2)}
/>
</FormField>
</FormLabel>
<ButtonDiv>
<CancelButton type="button" onClick={onClose}>
Cancel
Expand All @@ -184,7 +165,7 @@ export const SettingsModal = ({
Save settings
</PrimaryButton>
</ButtonDiv>
</Form>
</FormContainer>
</ModalContent>
</ModalOverlay>
);
Expand Down

0 comments on commit 9e35890

Please sign in to comment.