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

[김민찬] Sprint8 #247

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
07384bb
fix: 프로젝트 내 오타 수정
itscold96 Jul 30, 2024
98ae7fd
fix(Product): 상품 이미지가 공간을 다 채우지 않는 문제 해결
itscold96 Jul 30, 2024
aaa59e4
refactor(mentor): 미디어쿼리 사이즈 변화 문자열 상수화
itscold96 Jul 30, 2024
e0c9bac
fix: 오타 수정
itscold96 Aug 2, 2024
c559e68
refactor(useValidForm): 기존 useValidForm을 기능별로 분리
itscold96 Aug 2, 2024
9686e42
rename(formStyles): 유효성 검사를 위한 프로퍼티명을 직관적으로 수정
itscold96 Aug 2, 2024
ef21410
docs: validType 타입 관련 주석 추가
itscold96 Aug 2, 2024
ef38cec
rename: 핸들러 함수 이름 수정
itscold96 Aug 2, 2024
628a121
refactor(LoginForm): 기존 커스텀 훅을 모아 로그인 폼 용 커스텀 훅 제작
itscold96 Aug 2, 2024
2072eab
refactor(SignupForm): 기존 커스텀 훅을 모아 회원가입 폼 용 커스텀 훅 제작
itscold96 Aug 2, 2024
760dccc
remove(useValidForm): 리팩토링하여 더 이상 사용하지 않는 useValidForm 삭제
itscold96 Aug 2, 2024
354a4a1
rename(AddProduct): 변수 및 함수명을 좀더 직관적으로 수정
itscold96 Aug 2, 2024
71fb2e8
fix(Login): import 경로 수정
itscold96 Aug 2, 2024
0f4f4b7
move: form 관련 hook들을 hooks/form 폴더로 옮김
itscold96 Aug 2, 2024
26571c6
refactor: 불필요한 useNavigateTo 커스텀 훅 제거 및 Link로 교체
itscold96 Aug 2, 2024
64b3b3d
docs(useDidMountEffect): 주석 내용 수정
itscold96 Aug 2, 2024
27cd021
fix: 임포트 경로 수정
itscold96 Aug 2, 2024
ddcb0af
refactor(useLoginForm, useSignupForm): 불필요한 useEffect 제거
itscold96 Aug 5, 2024
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
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"cSpell.words": ["ADDITEM", "kakao", "Signup", "uuidv"]
}
2 changes: 0 additions & 2 deletions src/ constants/infomations/mediaQuerySize.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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',
Expand Down
11 changes: 11 additions & 0 deletions src/ constants/information/mediaQuerySize.ts
Original file line number Diff line number Diff line change
@@ -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)`,
};
6 changes: 3 additions & 3 deletions src/components/@shared/Footer.tsx
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down Expand Up @@ -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 {
Expand Down
22 changes: 11 additions & 11 deletions src/components/@shared/Header.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<StyledHeaderWrapper>
<StyledHeader>
<HeaderLinkSection />
<Button width={'12.8rem'} height={'4.8rem'} onClick={() => navigateTo(PATH_LOGIN)}>
로그인
</Button>
<Link to={PATH_LOGIN}>
<Button width={'12.8rem'} height={'4.8rem'}>
로그인
</Button>
</Link>
</StyledHeader>
</StyledHeaderWrapper>
);
Expand All @@ -24,7 +24,7 @@ export default Header;

const StyledHeaderWrapper = styled.header`
/* 매 페이지마다 fixed에 의해 숨겨진 영역 떄문에 패딩값을 주지 않도록 */
height: var(--header-heigt);
height: var(--header-height);
`;

const StyledHeader = styled.header`
Expand All @@ -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;
Expand Down
25 changes: 12 additions & 13 deletions src/components/@shared/HeaderLinkSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<StyledLinkSection>
<Image
src={innerWidth > 769 ? logoImg : typoImg}
alt={'로고 이미지'}
height={innerWidth > 769 ? '5.1rem' : '4rem'}
width={innerWidth > 769 ? '15.3rem' : '8.1rem'}
onClick={() => navigateTo(PATH_HOME)}
/>
<Link to={PATH_HOME}>
<Image
src={innerWidth > 769 ? logoImg : typoImg}
alt={'로고 이미지'}
height={innerWidth > 769 ? '5.1rem' : '4rem'}
width={innerWidth > 769 ? '15.3rem' : '8.1rem'}
/>
</Link>
{/* 링크가 필요한 페이지에서만 링크들이 나타나도록 */}
{needLinkHeaderPaths.includes(pathname) && (
<section>
Expand Down Expand Up @@ -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;
}
`;
Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/@shared/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function Pagination({ currentPage, totalCount, setSearchParams }: PaginationProp
};

return (
<StyledPagenationSection onClick={handlePageButtonClick}>
<StyledPaginationSection onClick={handlePageButtonClick}>
<StyledPageButton data-value={'prevPage'} disabled={currentPage === 1}>
{'<'}
</StyledPageButton>
Expand All @@ -60,13 +60,13 @@ function Pagination({ currentPage, totalCount, setSearchParams }: PaginationProp
<StyledPageButton data-value={'nextPage'} disabled={currentPage === lastPage}>
{'>'}
</StyledPageButton>
</StyledPagenationSection>
</StyledPaginationSection>
);
}

export default Pagination;

const StyledPagenationSection = styled.section`
const StyledPaginationSection = styled.section`
width: 100%;
display: flex;
justify-content: center;
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -7,24 +7,24 @@ 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<HTMLElement>) => void;
handleReturnKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
handleRemoveClick: (event: React.MouseEvent<HTMLElement>) => void;
}

function InputSection({
function AddProductInputSection({
formValue,
tagList,
handleInputChange,
handleReturnKeyDown,
handleRemoveClick,
}: InputSectionProps) {
}: AddProductInputSectionProps) {
return (
<StyledAddItemInputSection>
{ADDITEM_FEIELDSET_LIST.map(fieldset => (
<StyledAdProductInputSection>
{ADDITEM_FIELDSET_LIST.map(fieldset => (
<Fragment key={fieldset.name}>
<fieldset>
<StyledAddItemSubTitle htmlFor={fieldset.name}>{fieldset.subTitle}</StyledAddItemSubTitle>
Expand All @@ -50,12 +50,12 @@ function InputSection({
</fieldset>
</Fragment>
))}
</StyledAddItemInputSection>
</StyledAdProductInputSection>
);
}
export default InputSection;
export default AddProductInputSection;

const StyledAddItemInputSection = styled.section`
const StyledAdProductInputSection = styled.section`
& input,
& textarea {
${inputStyle};
Expand Down
20 changes: 10 additions & 10 deletions src/components/addItem/ImageRegistration.tsx
Original file line number Diff line number Diff line change
@@ -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<HTMLElement>) => void;
handleRemoveClick: (event: React.MouseEvent<HTMLElement>) => void;
}
Expand All @@ -19,7 +19,7 @@ function ImageRegistration({ previewList, handleInputChange, handleRemoveClick }
return (
<fieldset>
<StyledAddItemSubTitle>상품 이미지</StyledAddItemSubTitle>
<StyledItemRegistSection>
<StyledItemRegistrationSection>
<label htmlFor={'file-input-display-none'}>
<Image src={plusIcon} alt={'이미지 추가하기 아이콘'} height={'4.8rem'} width={'4.8rem'} />
<div>이미지 등록하기</div>
Expand All @@ -35,27 +35,27 @@ function ImageRegistration({ previewList, handleInputChange, handleRemoveClick }
onChange={handleInputChange}
/>
<PreviewList previewList={previewList} handleRemoveClick={handleRemoveClick} />
</StyledItemRegistSection>
</StyledItemRegistrationSection>
</fieldset>
);
}

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);
}

Expand All @@ -74,7 +74,7 @@ const StyledItemRegistSection = styled.section`

cursor: pointer;

@media (max-width: ${TABLET_MAX_WIDTH}px) {
@media ${MEDIA_QUERY_SIZE.underTablet} {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확실히 사용하는 것도 덜 귀찮아지고, 직관적이여서 좋네요 👍

width: 16.2rem;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/addItem/PreviewList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLElement>) => void;
}

Expand All @@ -16,7 +16,7 @@ function PreviewList({ previewList, handleRemoveClick }: PreviewListProps) {
{previewList.map(preview => (
<StyledPreviewItem key={preview.id}>
<Image
src={preview.url}
src={preview.imgUrl}
alt={'등록한 상품 이미지 미리보기'}
height={'100%'}
width={'auto'}
Expand All @@ -27,7 +27,7 @@ function PreviewList({ previewList, handleRemoveClick }: PreviewListProps) {
className={'preview-remove-btn'}
data-category={'preview'}
data-id={preview.id}
data-url={preview.url}
data-url={preview.imgUrl}
/>
</StyledPreviewItem>
))}
Expand Down
6 changes: 3 additions & 3 deletions src/components/addItem/RegistrationHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<StyledAddItemHeader>
<StyledAddItemTitle>상품 등록하기</StyledAddItemTitle>
Expand All @@ -17,7 +17,7 @@ function RegistraionHeader({ isSubmitActive }: RegistraionHeaderProps) {
);
}

export default RegistraionHeader;
export default RegistrationHeader;

const StyledAddItemHeader = styled.header`
display: flex;
Expand Down
8 changes: 4 additions & 4 deletions src/components/addItem/TagList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand All @@ -16,7 +16,7 @@ function TagList({ tagList, handleRemoveClick }: TagListProps) {
<StyledTagList onClick={handleRemoveClick}>
{tagList.map(tag => (
<StyledTagItem key={tag.id}>
{tag.content}
{tag.tagContent}
<StyledRemoveButton className={'tag-remove-btn'} data-category={'tag'} data-id={tag.id} />
</StyledTagItem>
))}
Expand All @@ -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);
}
`;
Expand Down
Loading
Loading