File tree Expand file tree Collapse file tree
src/components/InputField Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import React , { ChangeEvent } from "react" ;
2- import "./InputField.scss" ;
2+
3+ import { StyledContainer , StyledInput } from "./styles" ;
34
45interface InputFieldProps < T > {
56 name : string ;
@@ -30,28 +31,16 @@ function InputField<T>({
3031 }
3132
3233 return (
33- < div
34- className = "input-field__container"
35- style = { {
36- display : "flex" ,
37- flexDirection : "column" ,
38- justifyContent : "center" ,
39- alignItems : "flex-start" ,
40- width : "100%" ,
41- gap : 10 ,
42- } }
43- >
44- < span className = "input-field__name" > { name } </ span >
45- < input
46- className = "input-field__value"
34+ < StyledContainer >
35+ < span > { name } </ span >
36+ < StyledInput
4737 type = { getInputType ( ) }
4838 defaultValue = { defaultValue }
4939 onChange = { handleChange }
50- style = { { width : "100%" , boxSizing : "border-box" } }
5140 autoFocus
52- > </ input >
41+ / >
5342 { error && < span className = "input-field__error" > { error } </ span > }
54- </ div >
43+ </ StyledContainer >
5544 ) ;
5645}
5746
Original file line number Diff line number Diff line change 1+ import styled from "@emotion/styled" ;
2+
3+ export const StyledContainer = styled . div `
4+ display: flex;
5+ flex-direction: column;
6+ justify-content: center;
7+ align-items: flex-start;
8+ width: 100%;
9+ gap: 10;
10+ ` ;
11+
12+ export const StyledInput = styled . input `
13+ width: 100%;
14+ box-sizing: border-box;
15+ ` ;
You can’t perform that action at this time.
0 commit comments