-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from cksrlcks/React-김찬기-sprint6
[김찬기] Sprint6
- Loading branch information
Showing
148 changed files
with
2,240 additions
and
979 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import { Outlet } from "react-router-dom"; | ||
import { AuthProvider } from "./context/AuthContext"; | ||
import { RouterProvider } from "react-router-dom"; | ||
import { router } from "./router"; | ||
|
||
export default function App() { | ||
return ( | ||
<> | ||
<Outlet /> | ||
<AuthProvider> | ||
<RouterProvider router={router} /> | ||
</AuthProvider> | ||
</> | ||
); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@forward "input"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.field { | ||
position: relative; | ||
|
||
.field-box { | ||
display: block; | ||
width: 100%; | ||
height: 5.6rem; | ||
padding: 0 2.4rem; | ||
border: 1px solid transparent; | ||
border-radius: 12px; | ||
background: var(--color-secondary-100); | ||
|
||
&:focus, | ||
&.valid { | ||
border: 1px solid var(--color-primary-100); | ||
outline: none; | ||
} | ||
|
||
&.error { | ||
border: 1px solid var(--color-error); | ||
outline: none; | ||
} | ||
|
||
&::placeholder { | ||
color: var(--color-secondary-400); | ||
} | ||
|
||
&:has(~ button) { | ||
padding-right: 5rem; | ||
} | ||
} | ||
|
||
textarea.field-box { | ||
height: 28.2rem; | ||
padding: 2.4rem; | ||
resize: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
@use "base"; | ||
@use "common"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import styles from "./Error.module.scss"; | ||
|
||
export function Error({ error }) { | ||
if (!error) { | ||
return null; | ||
} | ||
return ( | ||
<div className={styles["item-error"]}> | ||
{error || "오류가 발생했습니다."} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.item-error { | ||
margin-top: 0.8rem; | ||
padding-left: 1.6rem; | ||
font-size: 1.4rem; | ||
font-weight: 600; | ||
color: var(--color-error); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import styles from "./FieldItem.module.scss"; | ||
|
||
export function FieldItem({ children }) { | ||
return <div className={styles["form-item"]}>{children}</div>; | ||
} | ||
|
||
function Label({ htmlFor, children }) { | ||
return ( | ||
<label className={styles["item-label"]} htmlFor={htmlFor}> | ||
{children} | ||
</label> | ||
); | ||
} | ||
|
||
FieldItem.Label = Label; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@use "@assets/scss/base/mixins"; | ||
|
||
.form-item { | ||
margin-bottom: 2.4rem; | ||
position: relative; | ||
|
||
@include mixins.mobile { | ||
margin-bottom: 1.6rem; | ||
} | ||
|
||
.item-label { | ||
display: inline-block; | ||
margin-bottom: 1.6rem; | ||
font-size: 1.8rem; | ||
font-weight: 700; | ||
|
||
@include mixins.mobile { | ||
margin-bottom: 0.8rem; | ||
font-size: 1.4rem; | ||
} | ||
} | ||
|
||
.item-field { | ||
position: relative; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Alert, LoadingSpinner } from "@components/ui"; | ||
|
||
export function Form({ isLoading, error, onSubmit, children }) { | ||
return ( | ||
<> | ||
{isLoading && <LoadingSpinner />} | ||
{error && ( | ||
<Alert mode="error">{error.message || "오류가 발생했습니다."}</Alert> | ||
)} | ||
<form onSubmit={onSubmit}>{children}</form> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import useSingleFile from "@hooks/useSingleFile"; | ||
import { Thumbnail } from "@components/ui"; | ||
import { Error } from "@components/Field"; | ||
import iconPlus from "@assets/img/icon/icon_plus.svg"; | ||
import styles from "./ImageUpload.module.scss"; | ||
|
||
const LIMIT_SIZE_MB = 2; | ||
|
||
export function ImageUpload({ | ||
error, | ||
value, | ||
id, | ||
name, | ||
onChange, | ||
placeholder = "이미지 등록", | ||
}) { | ||
const { fileProps, fileError, handleRemove, preview } = useSingleFile({ | ||
name, | ||
value, | ||
accept: "image/*", | ||
limiSize: LIMIT_SIZE_MB, | ||
onChange: (file) => onChange(name, file), | ||
errorMessage: { | ||
max: "이미지 등록은 최대 1개까지 가능합니다.", | ||
accept: "이미지 파일만 업로드 가능합니다.", | ||
}, | ||
}); | ||
|
||
// 두가지 에러 동시에 보내려고 문자열로 합침 | ||
const fileInputError = [fileError, error].filter((err) => err).join(" / "); | ||
|
||
return ( | ||
<> | ||
<div className={styles["thumbnail-list"]}> | ||
<label className={styles["upload-button"]}> | ||
<span className={styles["upload-label"]}> | ||
<img src={iconPlus} alt="이미지 업로드" /> | ||
{placeholder} | ||
</span> | ||
<input id={id} name={name} className="a11y" {...fileProps} /> | ||
</label> | ||
<div className={styles.preview}> | ||
{preview && ( | ||
<Thumbnail | ||
src={preview} | ||
alt="상품 이미지 등록" | ||
onRemove={handleRemove} | ||
/> | ||
)} | ||
</div> | ||
</div> | ||
<Error error={fileInputError} /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
.thumbnail-list { | ||
display: flex; | ||
gap: 2.4rem; | ||
} | ||
|
||
.upload-button { | ||
overflow: hidden; | ||
position: relative; | ||
display: block; | ||
width: 100%; | ||
max-width: 28.2rem; | ||
border-radius: 1.6rem; | ||
background: var(--color-secondary-100); | ||
cursor: pointer; | ||
|
||
&:before { | ||
content: ""; | ||
display: block; | ||
width: 100%; | ||
height: 0; | ||
padding-bottom: 100%; | ||
} | ||
|
||
.upload-label { | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
gap: 1.3rem; | ||
width: 100%; | ||
height: 100%; | ||
color: var(--color-secondary-400); | ||
} | ||
} | ||
|
||
.preview { | ||
max-width: 28.2rem; | ||
} |
Oops, something went wrong.