Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: InputForm 컴포넌트 구현 #15

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/componenets/common/InputForm/InputForm.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Theme from '@/styles/Theme';
import styled from '@emotion/styled';

export const InputWrapper = styled.div`
width: 100%;
`;
SongInjae marked this conversation as resolved.
Show resolved Hide resolved
export const LabelStyled = styled.label`
display: block;
`;
export const InputStyled = styled.input`
width: 100%;
height: 3rem;
border: none;
outline: none;
background-color: ${Theme.color.gray};
padding-left: 1rem;
box-sizing: border-box;
`;
18 changes: 18 additions & 0 deletions src/componenets/common/InputForm/InputForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { InputStyled, InputWrapper, LabelStyled } from './InputForm.style';

interface InputForm {
labelText: string;
labelId: string;
inputType: 'date' | 'file' | 'number' | 'search' | 'tel' | 'text' | 'time';
}

const InputForm = ({ labelText, labelId, inputType, ...props }: InputForm) => {
return (
<InputWrapper>
<LabelStyled htmlFor={labelId}>{labelText}</LabelStyled>
<InputStyled id={labelId} type={inputType} {...props} />
</InputWrapper>
);
};

export default InputForm;
15 changes: 0 additions & 15 deletions src/pages/RegisterPage/RegisterPage.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ export const Title = styled.div`
font-family: 'MainBold';
font-size: 2rem;
`;
export const InputWrapper = styled.div`
width: 100%;
`;
export const LabelStyled = styled.label`
display: block;
`;
export const InputStyled = styled.input`
width: 100%;
height: 3rem;
border: none;
outline: none;
background-color: ${Theme.color.gray};
padding-left: 1rem;
box-sizing: border-box;
`;
export const SubmitBtn = styled.button`
width: 100%;
padding: 0.5rem 0;
Expand Down
21 changes: 4 additions & 17 deletions src/pages/RegisterPage/RegisterPage.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
import React from 'react';
import InputForm from '@/componenets/common/InputForm/InputForm';

import {
Container,
InputStyled,
InputWrapper,
LabelStyled,
SubmitBtn,
Title,
} from './RegisterPage.style';
import { Container, SubmitBtn, Title } from './RegisterPage.style';

const RegisterPage = () => {
return (
<Container>
<Title>추가 정보를 입력해주세요</Title>
<InputWrapper>
<LabelStyled htmlFor="id">이름</LabelStyled>
<InputStyled id="id" type="text" />
</InputWrapper>
<InputWrapper>
<LabelStyled htmlFor="number">연락처</LabelStyled>
<InputStyled id="number" type="tel" />
</InputWrapper>
<InputForm labelText="이름" labelId="id" inputType="text" />
<InputForm labelText="연락처" labelId="number" inputType="tel" />
<SubmitBtn>가입 완료</SubmitBtn>
</Container>
);
Expand Down
Loading