-
Notifications
You must be signed in to change notification settings - Fork 39
[조인성] sprint6 #215
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
The head ref may contain hidden characters: "React-\uC870\uC778\uC131-sprint6"
[조인성] sprint6 #215
Changes from all commits
3d109db
68f4142
a20357f
d8ef390
f6927c4
a9c6c97
6076352
c333b27
2d1d970
5e208c6
302982f
b9ae3dd
9e2ae06
d60ff33
cd9edbc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import * as S from './formHeader.styles'; | ||
| import { titleStyle } from '../../styles/common'; | ||
|
|
||
| const FormHeader = ({ isFormValid }) => { | ||
| return ( | ||
| <div css={S.formHeaderStyle}> | ||
| <h1 css={titleStyle}>상품 등록하기</h1> | ||
| <button | ||
| css={S.submitButtonStyle} | ||
| type="submit" | ||
| disabled={!isFormValid} | ||
| > | ||
| 등록 | ||
| </button> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default FormHeader; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { css } from "@emotion/react"; | ||
|
|
||
| export const formHeaderStyle = css` | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| margin-top: 2.4rem; | ||
| `; | ||
|
|
||
| export const submitButtonStyle = css` | ||
| width: 7.4rem; | ||
| height: 4.2rem; | ||
| border-radius: 0.8rem; | ||
| background: #3692ff; | ||
| font-size: 1.6rem; | ||
| font-weight: 600; | ||
| color: #F3F4F6; | ||
|
|
||
| &:disabled { | ||
| background: #9CA3AF; | ||
| } | ||
| `; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import * as S from './formImageUpload.styles'; | ||
| import plusImg from '../../assets/icons/ic_plus.png'; | ||
|
|
||
| const FormImageUpload = ({ | ||
| imagePreview, | ||
| onClick, | ||
| onChange, | ||
| onRemove, | ||
| errorMessage, | ||
| fileInputRef | ||
| }) => { | ||
| return ( | ||
| <> | ||
| <label>상품 이미지</label> | ||
| <div css={S.imageContainerStyle}> | ||
| <div css={S.formImageBoxStyle} onClick={onClick}> | ||
| <img src={plusImg} alt="plus" /> | ||
| <p>이미지 등록</p> | ||
| <input | ||
| type="file" | ||
| accept="image/*" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💊 제안 (사용자가 업로드창에서 옵션을 열어 확장자를 바꾸면 아래처럼 보입니다) https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/accept |
||
| ref={fileInputRef} | ||
| onChange={onChange} | ||
| style={{ display: 'none' }} | ||
| /> | ||
| </div> | ||
|
|
||
| {imagePreview && ( | ||
| <div css={S.itemPreviewContainerStyle}> | ||
| <img src={imagePreview} alt="preview" css={S.previewImageStyle} /> | ||
| <button | ||
| onClick={onRemove} | ||
| type="button" | ||
| css={S.imageCloseButtonStyle} | ||
| /> | ||
| </div> | ||
| )} | ||
| </div> | ||
|
|
||
| {errorMessage && <p css={S.errorMessageStyle}>{errorMessage}</p>} | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default FormImageUpload; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import { css } from "@emotion/react"; | ||
| import mq from "../../styles/media"; | ||
| import { closeButtonStyle } from '../../styles/common'; | ||
|
|
||
| export const imageContainerStyle = css` | ||
| display: flex; | ||
| gap: 2.4rem; | ||
| `; | ||
|
|
||
| export const formImageBoxStyle = css` | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| gap: 12px; | ||
| width: 16.8rem; | ||
| height: 16.8rem; | ||
| background-color: #F3F4F6; | ||
|
|
||
| p { | ||
| font-size: 1.6rem; | ||
| font-weight: 400; | ||
| color: #9CA3AF; | ||
| } | ||
|
|
||
| img { | ||
| width: 4.8rem; | ||
| height: 4.8rem; | ||
| } | ||
|
|
||
| ${mq({ | ||
| width: ['16.8rem', '16.8rem', '28.2rem', '28.2rem'], | ||
| height: ['16.8rem', '16.8rem', '28.2rem', '28.2rem'], | ||
| })} | ||
| `; | ||
|
|
||
| export const itemPreviewContainerStyle = css` | ||
| position: relative; | ||
| `; | ||
|
|
||
| export const previewImageStyle = css` | ||
| width: 16.8rem; | ||
| height: 16.8rem; | ||
| object-fit: cover; | ||
| object-position: center; | ||
|
|
||
| ${mq({ | ||
| width: ['16.8rem', '16.8rem', '28.2rem', '28.2rem'], | ||
| height: ['16.8rem', '16.8rem', '28.2rem', '28.2rem'], | ||
| })} | ||
| `; | ||
|
|
||
| export const imageCloseButtonStyle = css` | ||
| ${closeButtonStyle}; | ||
| position: absolute; | ||
| top: 3%; | ||
| right: 3%; | ||
| width: 2.4rem; | ||
| height: 2.4rem; | ||
| `; | ||
|
|
||
| export const errorMessageStyle = css` | ||
| color: red; | ||
| font-size: 1.6rem; | ||
| margin-top: 1.6rem; | ||
| `; |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||||||||
| import * as S from './formInputs.styles'; | ||||||||||||
|
|
||||||||||||
| const FormInputs = ({ name, onNameChange, description, onDescriptionChange, price, onPriceChange }) => { | ||||||||||||
| return ( | ||||||||||||
| <> | ||||||||||||
| <label>상품명</label> | ||||||||||||
| <input | ||||||||||||
| css={S.inputStyle} | ||||||||||||
| placeholder="상품명을 입력해주세요" | ||||||||||||
| value={name} | ||||||||||||
| onChange={(e) => onNameChange(e.target.value)} | ||||||||||||
| /> | ||||||||||||
|
|
||||||||||||
| <label>상품 소개</label> | ||||||||||||
| <textarea | ||||||||||||
|
Comment on lines
+14
to
+15
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💊 제안
Suggested change
|
||||||||||||
| css={S.areaStyle} | ||||||||||||
| placeholder="상품 소개를 입력해주세요" | ||||||||||||
| value={description} | ||||||||||||
| onChange={(e) => onDescriptionChange(e.target.value)} | ||||||||||||
| /> | ||||||||||||
|
|
||||||||||||
| <label>판매 가격</label> | ||||||||||||
| <input | ||||||||||||
| type="number" | ||||||||||||
| css={S.inputStyle} | ||||||||||||
| placeholder="판매 가격을 입력해주세요" | ||||||||||||
| value={price} | ||||||||||||
| onChange={(e) => onPriceChange(e.target.value)} | ||||||||||||
| /> | ||||||||||||
| </> | ||||||||||||
| ); | ||||||||||||
| }; | ||||||||||||
|
|
||||||||||||
| export default FormInputs; | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { css } from "@emotion/react"; | ||
|
|
||
| export const inputStyle = css` | ||
| height: 5.6rem; | ||
| `; | ||
|
|
||
| export const areaStyle = css` | ||
| height: 28.2rem; | ||
| `; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import * as S from './formTags.styles'; | ||
|
|
||
| const FormTags = ({ tagInput, tags, onTagInputChange, onTagKeyDown, onTagRemove }) => { | ||
| return ( | ||
| <> | ||
| <label>태그</label> | ||
| <input | ||
| css={S.inputStyle} | ||
| placeholder="태그를 입력해주세요" | ||
| value={tagInput} | ||
| onChange={onTagInputChange} | ||
| onKeyDown={onTagKeyDown} | ||
| /> | ||
|
|
||
| <div css={S.tagListContainerStyle}> | ||
| {tags.map((tag, index) => ( | ||
| <div key={index} css={S.tagItemStyle}> | ||
| {`#${tag}`} | ||
| <button | ||
| type="button" | ||
| onClick={() => onTagRemove(index)} | ||
| css={S.tagButtonStyle} | ||
| /> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default FormTags; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { css } from "@emotion/react"; | ||
| import { closeButtonStyle } from '../../styles/common'; | ||
|
|
||
| export const tagListContainerStyle = css` | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| gap: 8px; | ||
| margin-top: 8px; | ||
| `; | ||
|
|
||
| export const tagItemStyle = css` | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| gap: 4px; | ||
| background-color: #f2f2f2; | ||
| padding: 0.6rem 1.2rem; | ||
| border-radius: 26px; | ||
| font-size: 1.6rem; | ||
| font-weight: 400; | ||
| `; | ||
|
|
||
| export const tagButtonStyle = css` | ||
| ${closeButtonStyle}; | ||
| width: 2rem; | ||
| height: 2rem; | ||
| `; |

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💊 제안
label 태그가 더 적절합니다~