diff --git a/.vscode/settings.json b/.vscode/settings.json
index 0967ef424..a90e172e6 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1 +1,3 @@
-{}
+{
+ "cSpell.words": ["ADDITEM", "kakao", "Signup", "uuidv"]
+}
diff --git a/src/ constants/infomations/mediaQuerySize.ts b/src/ constants/infomations/mediaQuerySize.ts
deleted file mode 100644
index a504e1bd0..000000000
--- a/src/ constants/infomations/mediaQuerySize.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export const TABLET_MAX_WIDTH = 1280;
-export const MOBILE_MAX_WIDTH = 768;
diff --git a/src/ constants/infomations/addItemList.ts b/src/ constants/information/addItemList.ts
similarity index 78%
rename from src/ constants/infomations/addItemList.ts
rename to src/ constants/information/addItemList.ts
index c7e7b28d2..45575893b 100644
--- a/src/ constants/infomations/addItemList.ts
+++ b/src/ constants/information/addItemList.ts
@@ -1,6 +1,6 @@
-import { IAddItemFeildset } from 'types/@shared/addProductTypes';
+import { IAddItemFieldset } from 'types/@shared/addProductTypes';
-export const ADDITEM_FEIELDSET_LIST: IAddItemFeildset[] = [
+export const ADDITEM_FIELDSET_LIST: IAddItemFieldset[] = [
{
subTitle: '상품명',
name: 'title',
diff --git a/src/ constants/infomations/brandFeatureList.ts b/src/ constants/information/brandFeatureList.ts
similarity index 100%
rename from src/ constants/infomations/brandFeatureList.ts
rename to src/ constants/information/brandFeatureList.ts
diff --git a/src/ constants/infomations/fileExtension.ts b/src/ constants/information/fileExtension.ts
similarity index 100%
rename from src/ constants/infomations/fileExtension.ts
rename to src/ constants/information/fileExtension.ts
diff --git a/src/ constants/information/mediaQuerySize.ts b/src/ constants/information/mediaQuerySize.ts
new file mode 100644
index 000000000..1d07461b1
--- /dev/null
+++ b/src/ constants/information/mediaQuerySize.ts
@@ -0,0 +1,11 @@
+export const DEVICE_MAX_WIDTH = {
+ tablet: 1280,
+ mobile: 768,
+};
+
+export const MEDIA_QUERY_SIZE = {
+ desktop: `(min-width: ${DEVICE_MAX_WIDTH.tablet}px)`,
+ tablet: `(min-width: ${DEVICE_MAX_WIDTH.mobile}px) and (max-width: ${DEVICE_MAX_WIDTH.tablet}px)`,
+ underTablet: `(max-width: ${DEVICE_MAX_WIDTH.tablet}px)`,
+ mobile: `(max-width: ${DEVICE_MAX_WIDTH.mobile}px)`,
+};
diff --git a/src/ constants/infomations/snsLinks.ts b/src/ constants/information/snsLinks.ts
similarity index 100%
rename from src/ constants/infomations/snsLinks.ts
rename to src/ constants/information/snsLinks.ts
diff --git a/src/components/@shared/Footer.tsx b/src/components/@shared/Footer.tsx
index d4fef40f2..906cf1110 100644
--- a/src/components/@shared/Footer.tsx
+++ b/src/components/@shared/Footer.tsx
@@ -1,7 +1,7 @@
-import { SNS_LINKS } from ' constants/infomations/snsLinks';
+import { SNS_LINKS } from ' constants/information/snsLinks';
import styled from 'styled-components';
import Image from './Image';
-import { MOBILE_MAX_WIDTH } from ' constants/infomations/mediaQuerySize';
+import { MEDIA_QUERY_SIZE } from ' constants/information/mediaQuerySize';
function Footer() {
return (
@@ -55,7 +55,7 @@ const StyledFooter = styled.footer`
gap: 1.2rem;
}
- @media all and (max-width: ${MOBILE_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.mobile} {
position: relative;
padding: 3.2rem;
& .footer-company {
diff --git a/src/components/@shared/Header.tsx b/src/components/@shared/Header.tsx
index 755f9223e..a3e36cff0 100644
--- a/src/components/@shared/Header.tsx
+++ b/src/components/@shared/Header.tsx
@@ -1,20 +1,20 @@
-import useNavigateTo from 'hooks/useNavigateTo';
import styled from 'styled-components';
import Button from './Button';
import { PATH_LOGIN } from ' constants/paths/paths';
import HeaderLinkSection from './HeaderLinkSection';
-import { MOBILE_MAX_WIDTH, TABLET_MAX_WIDTH } from ' constants/infomations/mediaQuerySize';
+import { MEDIA_QUERY_SIZE } from ' constants/information/mediaQuerySize';
+import { Link } from 'react-router-dom';
function Header() {
- const { navigateTo } = useNavigateTo();
-
return (
-
+
+
+
);
@@ -24,7 +24,7 @@ export default Header;
const StyledHeaderWrapper = styled.header`
/* 매 페이지마다 fixed에 의해 숨겨진 영역 떄문에 패딩값을 주지 않도록 */
- height: var(--header-heigt);
+ height: var(--header-height);
`;
const StyledHeader = styled.header`
@@ -38,16 +38,16 @@ const StyledHeader = styled.header`
align-items: center;
width: 100%;
- height: var(--header-heigt);
+ height: var(--header-height);
padding: var(--padding-001);
background-color: var(--white);
border-bottom: 1px solid var(--border-gray);
- @media all and (min-width: ${MOBILE_MAX_WIDTH}px) and (max-width: ${TABLET_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.tablet} {
padding: 0 2.4rem;
}
- @media all and (max-width: ${MOBILE_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.mobile} {
padding: 0 1.6rem;
& button {
width: 6rem;
diff --git a/src/components/@shared/HeaderLinkSection.tsx b/src/components/@shared/HeaderLinkSection.tsx
index 22ec6b203..6f3db542f 100644
--- a/src/components/@shared/HeaderLinkSection.tsx
+++ b/src/components/@shared/HeaderLinkSection.tsx
@@ -4,25 +4,24 @@ import typoImg from 'assets/images/home/typo.png';
import Image from './Image';
import { PATH_HOME, PATH_BOARDS, PATH_ITEMS, PATH_ADD_ITEM } from ' constants/paths/paths';
import styled from 'styled-components';
-import useNavigateTo from 'hooks/useNavigateTo';
import useWindowSize from 'hooks/useWindowSize';
-import { MOBILE_MAX_WIDTH } from ' constants/infomations/mediaQuerySize';
+import { MEDIA_QUERY_SIZE } from ' constants/information/mediaQuerySize';
function HeaderLinkSection() {
const { innerWidth } = useWindowSize();
- const { navigateTo } = useNavigateTo();
const { pathname } = useLocation();
const needLinkHeaderPaths = [PATH_BOARDS, PATH_ITEMS, PATH_ADD_ITEM];
return (
- 769 ? logoImg : typoImg}
- alt={'로고 이미지'}
- height={innerWidth > 769 ? '5.1rem' : '4rem'}
- width={innerWidth > 769 ? '15.3rem' : '8.1rem'}
- onClick={() => navigateTo(PATH_HOME)}
- />
+
+ 769 ? logoImg : typoImg}
+ alt={'로고 이미지'}
+ height={innerWidth > 769 ? '5.1rem' : '4rem'}
+ width={innerWidth > 769 ? '15.3rem' : '8.1rem'}
+ />
+
{/* 링크가 필요한 페이지에서만 링크들이 나타나도록 */}
{needLinkHeaderPaths.includes(pathname) && (
@@ -50,7 +49,7 @@ const StyledLinkSection = styled.section`
cursor: pointer;
}
- @media (max-width: ${MOBILE_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.mobile} {
gap: 1.5rem;
}
`;
@@ -63,12 +62,12 @@ const StyledLink = styled(Link)<{ $isPageMatch: boolean }>`
&:not(:last-child) {
margin-right: 3.2rem;
- @media (max-width: ${MOBILE_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.mobile} {
margin-right: 0.8rem;
}
}
- @media (max-width: ${MOBILE_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.mobile} {
font-size: 1.6rem;
line-height: 1.909rem;
}
diff --git a/src/components/@shared/Pagination.tsx b/src/components/@shared/Pagination.tsx
index f7e31c5d1..7c3c17bd8 100644
--- a/src/components/@shared/Pagination.tsx
+++ b/src/components/@shared/Pagination.tsx
@@ -48,7 +48,7 @@ function Pagination({ currentPage, totalCount, setSearchParams }: PaginationProp
};
return (
-
+
{'<'}
@@ -60,13 +60,13 @@ function Pagination({ currentPage, totalCount, setSearchParams }: PaginationProp
{'>'}
-
+
);
}
export default Pagination;
-const StyledPagenationSection = styled.section`
+const StyledPaginationSection = styled.section`
width: 100%;
display: flex;
justify-content: center;
diff --git a/src/components/addItem/InputSection.tsx b/src/components/addItem/AddProductInputSection.tsx
similarity index 83%
rename from src/components/addItem/InputSection.tsx
rename to src/components/addItem/AddProductInputSection.tsx
index cdf593e83..029adf81d 100644
--- a/src/components/addItem/InputSection.tsx
+++ b/src/components/addItem/AddProductInputSection.tsx
@@ -1,4 +1,4 @@
-import { ADDITEM_FEIELDSET_LIST } from ' constants/infomations/addItemList';
+import { ADDITEM_FIELDSET_LIST } from ' constants/information/addItemList';
import React from 'react';
import { Fragment } from 'react/jsx-runtime';
import styled from 'styled-components';
@@ -7,7 +7,7 @@ import { inputStyle, placeholderStyle } from 'styles/auth/formStyles';
import TagList from './TagList';
import { IFormValue, ITag } from 'types/@shared/addProductTypes';
-interface InputSectionProps {
+interface AddProductInputSectionProps {
formValue: IFormValue;
tagList: ITag[];
handleInputChange: (event: React.ChangeEvent) => void;
@@ -15,16 +15,16 @@ interface InputSectionProps {
handleRemoveClick: (event: React.MouseEvent) => void;
}
-function InputSection({
+function AddProductInputSection({
formValue,
tagList,
handleInputChange,
handleReturnKeyDown,
handleRemoveClick,
-}: InputSectionProps) {
+}: AddProductInputSectionProps) {
return (
-
- {ADDITEM_FEIELDSET_LIST.map(fieldset => (
+
+ {ADDITEM_FIELDSET_LIST.map(fieldset => (
))}
-
+
);
}
-export default InputSection;
+export default AddProductInputSection;
-const StyledAddItemInputSection = styled.section`
+const StyledAdProductInputSection = styled.section`
& input,
& textarea {
${inputStyle};
diff --git a/src/components/addItem/ImageRegistration.tsx b/src/components/addItem/ImageRegistration.tsx
index 5c00f88bd..bdcec94b5 100644
--- a/src/components/addItem/ImageRegistration.tsx
+++ b/src/components/addItem/ImageRegistration.tsx
@@ -1,16 +1,16 @@
import styled from 'styled-components';
import { inputStyle, placeholderStyle } from 'styles/auth/formStyles';
import plusIcon from 'assets/images/addProduct/plus-icon.png';
-import { ALLOW_FILE_EXTENSION } from ' constants/infomations/fileExtension';
+import { ALLOW_FILE_EXTENSION } from ' constants/information/fileExtension';
import { StyledAddItemSubTitle } from 'styles/addProduct/textStyles';
import React from 'react';
import Image from 'components/@shared/Image';
import PreviewList from './PreviewList';
-import { IPreview } from 'types/@shared/addProductTypes';
-import { MOBILE_MAX_WIDTH, TABLET_MAX_WIDTH } from ' constants/infomations/mediaQuerySize';
+import { IImagePreview } from 'types/@shared/addProductTypes';
+import { MEDIA_QUERY_SIZE } from ' constants/information/mediaQuerySize';
interface ImageRegistrationProps {
- previewList: IPreview[];
+ previewList: IImagePreview[];
handleInputChange: (event: React.ChangeEvent) => void;
handleRemoveClick: (event: React.MouseEvent) => void;
}
@@ -19,7 +19,7 @@ function ImageRegistration({ previewList, handleInputChange, handleRemoveClick }
return (
);
}
export default ImageRegistration;
-const StyledItemRegistSection = styled.section`
+const StyledItemRegistrationSection = styled.section`
display: flex;
gap: 2.4rem;
overflow-x: auto; // 사진이 많아지면 좌우 스크롤이 되도록 지정
width: var(--container-width);
height: 28.2rem;
- @media (max-width: ${TABLET_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.underTablet} {
height: 16.2rem;
max-width: calc(100vw - 5.2rem);
overflow-y: hidden;
overflow-x: auto;
}
- @media (max-width: ${MOBILE_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.mobile} {
max-width: calc(100vw - 3.2rem);
}
@@ -74,7 +74,7 @@ const StyledItemRegistSection = styled.section`
cursor: pointer;
- @media (max-width: ${TABLET_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.underTablet} {
width: 16.2rem;
}
}
diff --git a/src/components/addItem/PreviewList.tsx b/src/components/addItem/PreviewList.tsx
index 51f35fbbd..d76da199b 100644
--- a/src/components/addItem/PreviewList.tsx
+++ b/src/components/addItem/PreviewList.tsx
@@ -3,10 +3,10 @@ import styled from 'styled-components';
import React from 'react';
import { StyledRemoveButton } from 'styles/addProduct/buttonStyles';
import Image from 'components/@shared/Image';
-import { IPreview } from 'types/@shared/addProductTypes';
+import { IImagePreview } from 'types/@shared/addProductTypes';
interface PreviewListProps {
- previewList: IPreview[];
+ previewList: IImagePreview[];
handleRemoveClick: (event: React.MouseEvent) => void;
}
@@ -16,7 +16,7 @@ function PreviewList({ previewList, handleRemoveClick }: PreviewListProps) {
{previewList.map(preview => (
))}
diff --git a/src/components/addItem/RegistrationHeader.tsx b/src/components/addItem/RegistrationHeader.tsx
index c339f5293..0e58b179d 100644
--- a/src/components/addItem/RegistrationHeader.tsx
+++ b/src/components/addItem/RegistrationHeader.tsx
@@ -2,11 +2,11 @@ import Button from 'components/@shared/Button';
import styled from 'styled-components';
import { StyledTitleText } from 'styles/market/textStyles';
-interface RegistraionHeaderProps {
+interface RegistrationHeaderProps {
isSubmitActive: boolean;
}
-function RegistraionHeader({ isSubmitActive }: RegistraionHeaderProps) {
+function RegistrationHeader({ isSubmitActive }: RegistrationHeaderProps) {
return (
상품 등록하기
@@ -17,7 +17,7 @@ function RegistraionHeader({ isSubmitActive }: RegistraionHeaderProps) {
);
}
-export default RegistraionHeader;
+export default RegistrationHeader;
const StyledAddItemHeader = styled.header`
display: flex;
diff --git a/src/components/addItem/TagList.tsx b/src/components/addItem/TagList.tsx
index 3be725ad4..e50a6e58f 100644
--- a/src/components/addItem/TagList.tsx
+++ b/src/components/addItem/TagList.tsx
@@ -4,7 +4,7 @@ import { smallTextStyle } from 'styles/addProduct/textStyles';
import { StyledRemoveButton } from 'styles/addProduct/buttonStyles';
import { ITag } from 'types/@shared/addProductTypes';
-import { MOBILE_MAX_WIDTH, TABLET_MAX_WIDTH } from ' constants/infomations/mediaQuerySize';
+import { MEDIA_QUERY_SIZE } from ' constants/information/mediaQuerySize';
interface TagListProps {
tagList: ITag[];
@@ -16,7 +16,7 @@ function TagList({ tagList, handleRemoveClick }: TagListProps) {
{tagList.map(tag => (
- {tag.content}
+ {tag.tagContent}
))}
@@ -37,10 +37,10 @@ const StyledTagList = styled.ul`
${smallTextStyle};
- @media (max-width: ${TABLET_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.underTablet} {
max-width: calc(100vw - 5.2rem);
}
- @media (max-width: ${MOBILE_MAX_WIDTH}px) {
+ @media ${MEDIA_QUERY_SIZE.mobile} {
max-width: calc(100vw - 3.2rem);
}
`;
diff --git a/src/components/auth/AuthLogo.tsx b/src/components/auth/AuthLogo.tsx
index 17011b7a8..7a427f5ff 100644
--- a/src/components/auth/AuthLogo.tsx
+++ b/src/components/auth/AuthLogo.tsx
@@ -2,26 +2,19 @@ import Image from 'components/@shared/Image';
import styled from 'styled-components';
import authLogoImg from 'assets/images/auth/auth-logo.png';
import { PATH_HOME } from ' constants/paths/paths';
-import useNavigateTo from 'hooks/useNavigateTo';
+import { Link } from 'react-router-dom';
function AuthLogo() {
- const { navigateTo } = useNavigateTo();
return (
-
- navigateTo(PATH_HOME)}
- />
+
+
);
}
export default AuthLogo;
-const StyledAuthLogo = styled.div`
+const StyledAuthLogo = styled(Link)`
height: 13.2rem;
width: 39.6rem;
margin: 6rem auto 4rem;
diff --git a/src/components/auth/login/LoginForm.tsx b/src/components/auth/login/LoginForm.tsx
index 5985dee2c..5456600c3 100644
--- a/src/components/auth/login/LoginForm.tsx
+++ b/src/components/auth/login/LoginForm.tsx
@@ -1,60 +1,48 @@
import PasswordInput from '../PasswordInput';
-import React, { useEffect, useState } from 'react';
import Button from 'components/@shared/Button';
-import useNavigateTo from 'hooks/useNavigateTo';
import { PATH_ITEMS } from ' constants/paths/paths';
-import useValidForm from 'hooks/useValidForm';
import { StyledAuthForm, StyledAuthLabel, StyledInputSection } from 'styles/auth/formStyles';
+import React from 'react';
+import useLoginForm from 'hooks/form/useLoginForm';
+import { useNavigate } from 'react-router-dom';
function LoginForm() {
- const { navigateTo } = useNavigateTo();
- const [form, setForm] = useState({
- email: '',
- password: '',
- });
- const { validMessages, validationResult, isFormValid, validateForm } = useValidForm(form);
-
- const handleInputChange = (event: React.ChangeEvent) => {
- const { value, name } = event.target;
- setForm({ ...form, [name]: value });
- };
+ const navigator = useNavigate();
+ const { form, handler, result, message, isFormValid } = useLoginForm();
const handleSubmitClick = (event: React.FormEvent) => {
+ // 입력 양식을 통과하지 못하면 button이 disabled 상태라 누를 수 없음
event.preventDefault();
- navigateTo(PATH_ITEMS);
+ navigator(PATH_ITEMS);
};
- useEffect(() => {
- validateForm();
- }, [validationResult.email, validationResult.password]);
-
return (
// 로그인 정보를 서버로 보낼 form, 비밀번호가 url에 표시되지 않도록 하기위해 method post로 전송
-
+
이메일
- {validMessages.email}
+ {message.emailValidMessage}
-
+
비밀번호
- {validMessages.password}
+ {message.passwordValidMessage}