Skip to content

Commit

Permalink
Merge branch 'develop' into feature-community
Browse files Browse the repository at this point in the history
  • Loading branch information
aeuna committed Jul 21, 2022
2 parents 49849d5 + 62fe19e commit 182ca8e
Show file tree
Hide file tree
Showing 19 changed files with 220 additions and 141 deletions.
45 changes: 45 additions & 0 deletions community.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// ๋Œ“๊ธ€
export interface ReplyData {
author: boolean;
userNickname?: string;
content: string;
createdAt: string;
}
// ์ปค๋ฎค๋‹ˆํ‹ฐ ๋ฐ์ดํ„ฐ
export interface CommunityData {
id: string;
author: boolean;
category: string;
title: string;
content: string;
userNickname: string;
replyCount: number;
createdAt: string;
image?: string;
imageList: string[];
replyList: ReplyData[];
}
// ์ปค๋ฎค๋‹ˆํ‹ฐ ๊ฒŒ์‹œ๊ธ€ ์ž‘์„ฑ post body
export interface PostCommunityBody {
category: string;
title: string;
content: string;
imageList?: FormData;
}
// ์ปค๋ฎค๋‹ˆํ‹ฐ ๋Œ“๊ธ€
export interface PostCommentBody {
boardId?: string;
content: string;
}

export interface GetCommunityList {
communityList: CommunityData[];
isLoading: boolean;
isError: string;
}
// ์ปค๋ฎค๋‹ˆํ‹ฐ ๊ธ€ ์ž‘์„ฑ ์ด๋ฏธ์ง€ ๋ฐ์ดํ„ฐ
export interface ImgData {
id: number;
src: string;
file: File;
}
3 changes: 2 additions & 1 deletion components/main/ToyPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { MainToyData } from '../../types/toy';
export default function ToyPreview(props: MainToyData) {
const { image, month, price, siteName, siteUrl, title } = props;
const [isMark, setIsMark] = useState(false);
console.log(image);
const handleToySite = (e: React.MouseEvent<HTMLElement>) => {
if (!(e.target instanceof SVGElement)) window.open(siteUrl);
};
Expand Down Expand Up @@ -44,6 +43,8 @@ const StToyWrapper = styled.article`
width: 27.5rem;
height: 42.4rem;
margin: 0rem 1.25rem;
cursor: pointer;
`;
const StImgWrapper = styled.div`
position: relative;
Expand Down
50 changes: 29 additions & 21 deletions components/viewProduct/FilterDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@ export default function FilterDropdown(props: FilterDropdownProps) {
};

return (
<StDropdownWrapper isDrop={isDrop} isExcept={isExcept}>
{categoryKey === '์žฅ๋‚œ๊ฐ ์ข…๋ฅ˜' && toyKindList.length !== 0
<StDropdownWrapper
isDrop={isDrop}
isExcept={isExcept}
className={`${
isDrop ? 'slide-fade-in-dropdown' : 'slide-fade-out-dropdown'
}`}
>
{categoryKey === '์ข…๋ฅ˜' && toyKindList.length !== 0
? toyKindList.map((tagText: string, elementIdx: number) => {
return (
<StLabel
Expand Down Expand Up @@ -135,8 +141,6 @@ const StFilterElement = styled.p`
width: 15.2rem;
height: 2rem;
// color: {({ checked, theme: { colors } }) =>
// checked ? colors.black : colors.gray008};
${({ theme }) => theme.fonts.b5_14_medium_140};
`;
const StDropdownWrapper = styled.div<{ isExcept: boolean; isDrop: boolean }>`
Expand Down Expand Up @@ -172,36 +176,40 @@ const StDropdownWrapper = styled.div<{ isExcept: boolean; isDrop: boolean }>`
theme.colors.gray002}; /*์Šคํฌ๋กค๋ฐ” ๋’ท ๋ฐฐ๊ฒฝ ์ƒ‰์ƒ*/
}
// @keyframes slide-fade-in-dropdown-animation {
// 0% {
// transform: translateY(-1rem);
// }
@keyframes slide-fade-in-dropdown-animation {
0% {
max-height: 14.8rem;
overflow: hidden;
opacity: 1;
}
100% {
opacity: 0;
max-height: 0;
overflow: hidden;
}
}
// 100% {
// transform: translateY(0);
// }
// }
/* fade out */
@keyframes slide-fade-out-dropdown-animation {
0% {
transform: translateY(0);
opacity: 0;
max-height: 0;
overflow: hidden;
}
100% {
transform: translateY(-100%);
opacity: 1;
max-height: 14.8rem;
overflow: hidden;
}
}
animation: ${({ isDrop }) =>
isDrop
? 'slide-fade-in-dropdown-animation 0.4s ease'
: 'slide-fade-out-dropdown-animation 0.4s ease'};
// .slide-fade-out-dropdown {
// animation: slide-fade-out-dropdown-animation 0.4s ease;
// animation-fill-mode: forwards;
// }
? 'slide-fade-in-dropdown-animation 0.2s ease-out'
: 'slide-fade-out-dropdown-animation 0.2s ease-out'};
`;
// displayย `-๊ฐ์ฒด์˜ ๋…ธ์ถœ์—ฌ๋ถ€/ํ‘œํ˜„๋ฐฉ์‹--`
// ( justify-content / align-items)
Expand Down
59 changes: 31 additions & 28 deletions components/viewProduct/ProductFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { useRecoilState, useRecoilValue } from 'recoil';
import {
checkedItemsState,
Expand All @@ -19,59 +19,62 @@ export default function ProductFilter() {
false,
false,
]);

const [visibilityAnimation, setVisibilityAnimation] = useState<boolean[]>([
false,
false,
false,
false,
false,
]);
const filterListData = Object.values(filterlist.filterList);
const filterListKeys = Object.keys(filterlist.filterList);
const [checkedItems, setcheckedItems] =
useRecoilState<Set<number>[]>(checkedItemsState);
const toyKindList = useRecoilValue<string[]>(toyKindState);
const [repeat, setRepeat] = useState<any>(null);
const handleDropdown = (idx: number) => {
if (visibility[idx]) {
let timeoutId = repeat;
window.clearTimeout(timeoutId);
setRepeat(null);
setVisibilityAnimation({
...visibilityAnimation,
[idx]: true,
});
} else {
setRepeat(
setTimeout(() => {
setVisibilityAnimation({
...visibilityAnimation,
[idx]: false,
});
}, 190),
);
}
setVisibility({
...visibility,
[idx]: !visibility[idx],
});
};

//const [repeat, setRepeat] = useState<null | number | void | string>();
// const handleDrop = (idx: number) => {
// if (visibility[idx]) {
// clearTimeout(repeat);
// setRepeat(null);
// setVisibility({
// ...visibility,
// [idx]: !visibility[idx],
// });
// } else {
// setRepeat(
// setTimeout(() => {
// setVisibility({
// ...visibility,
// [0]: !visibility[0],
// });
// return 0;
// }, 400),
// );
// }
// };

return (
<StFilterWrapper>
{filterListKeys.map((title: string, idx: number) => (
<StFilterSection isDrop={visibility[idx]} key={title}>
<StFilterSection isDrop={visibilityAnimation[idx]} key={title}>
<StFilterTitle
onClick={() => {
handleDropdown(idx);
}}
>
<h2>{title}</h2>
{visibility[idx] ? <IcClose /> : <IcOpen />}
{visibilityAnimation[idx] ? <IcClose /> : <IcOpen />}
</StFilterTitle>
{visibility[idx] && (
{visibilityAnimation[idx] && (
<FilterDropdown
categoryInfo={filterListData[idx]}
categoryIdx={idx}
isExcept={
idx == 3 || (idx == 4 && toyKindList.length !== 0)
idx == 3 || (idx == 0 && toyKindList.length !== 0)
? true
: false
}
Expand Down
8 changes: 4 additions & 4 deletions components/viewProduct/ToyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export default function ToyList(props: ToyListProps) {

return (
<StToyListWrapper>
{toyList.map(({ image, title, price, month, siteUrl }, idx) => (
{toyList.map(({ image, title, price, month, link, toySite }, idx) => (
<ToyPreview
key={idx}
src={image}
store="๊ทธ๋ฆฐํ‚ค๋“œ๊ทธ๋ฆฐํ‚ค๋“œ๊ทธ๋ฆฐํ‚ค๋“œ๊ทธ๋ฆฐํ‚ค๋“œ๊ทธ๋ฆฐํ‚ค๋“œ๊ทธ๋ฆฐํ‚ค๋“œ๊ทธ๋ฆฐํ‚ค๋“œ๊ทธ๋ฆฐํ‚ค๋“œ๊ทธ๋ฆฐํ‚ค๋“œ๊ทธ๋ฆฐํ‚ค๋“œ"
store={toySite.toySite}
title={title}
price={price}
age="36๊ฐœ์›”์ด์ƒ"
siteUrl={siteUrl}
age={month}
siteUrl={link}
/>
))}
</StToyListWrapper>
Expand Down
4 changes: 3 additions & 1 deletion components/viewProduct/ToyPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export default function ToyPreview(props: ToyPreviewProps) {
return (
<StToyWrapper onClick={handleToySite}>
<StImgWrapper>
<StToyImg src="https://www.littlebaby.co.kr:14019/shop/data/goods/1632018070797m0.jpg" />
<StToyImg
src={`https://nori-image.s3.ap-northeast-2.amazonaws.com/${src}`}
/>
<StToyMarkWrapper onClick={handleToyMark}>
<StToyMark />
{isMark && <StFillToyMark />}
Expand Down
20 changes: 11 additions & 9 deletions core/api/user.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
import LocalStorage from '../localStorage';
import { baseInstance } from '../axios';
import {
PostLoginBody,
PostSignUpBody,
ResponseLoginDto,
} from '../../types/user';
import { PostLoginBody, SignUpBody, ResponseLoginDto } from '../../types/user';

export const loginUser = async (userLoginData: PostLoginBody) => {
const data = (await baseInstance.post(
'/auth/login',
userLoginData,
)) as ResponseLoginDto;

if (data) {
LocalStorage.setUserSession(data.data.accessToken, data.data.refreshToken);
if (data.status === 200) {
LocalStorage.setUserSession(
data.data.data.accessToken,
data.data.data.refreshToken,
);
return data.data.data.isSignup;
}
return data.data.isSignup;
};
export const getRefreshToken = () => {
return baseInstance.get('/auth/refresh');
};
export const putSignup = (signUpBody: PostSignUpBody) => {
export const postNickname = (nicknameBody: SignUpBody) => {
return baseInstance.post('/auth/nickname', nicknameBody);
};
export const putSignup = (signUpBody: SignUpBody) => {
return baseInstance.put('/auth/signup', signUpBody);
};
2 changes: 1 addition & 1 deletion core/api/viewProduct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export const useGetBannerViewProduct = (params: { category: number }) => {
};
};
export const getBannerViewProduct = () => {
return;
return baseInstance.get('/toy/list');
};
48 changes: 24 additions & 24 deletions core/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,7 @@ export const filterListState = atom({
key: 'filterListState',
default: {
filterList: {
์Šคํ† ์–ด: [
'๊ตญ๋ฏผ์žฅ๋‚œ๊ฐ',
'๊ทธ๋ฆฐํ‚ค๋“œ',
'๋Ÿฌ๋ธŒ๋กœ',
'๋ฆฌํ‹€๋ฒ ์ด๋น„',
'๋นŒ๋ฆฌ๋ฐ”๋ฐ”',
'์–ดํ…์…˜ํ™ˆ์ด๋ฒคํŠธ',
'์žฅ๋‚œ๊ฐ์ ๋นต',
'์ ค๋ฆฌ๋ฐ”์šด์Šค',
'ํ•ดํ”ผ์žฅ๋‚œ๊ฐ',
],
'์‚ฌ์šฉ ์—ฐ๋ น': [
'0~5๊ฐœ์›”',
'6~11๊ฐœ์›”',
'12~17๊ฐœ์›”',
'18~23๊ฐœ์›”',
'24~35๊ฐœ์›”',
'36~47๊ฐœ์›”',
'48~60๊ฐœ์›”',
'๊ธฐํƒ€',
],
๊ฐ€๊ฒฉ: ['1๋งŒ์› ๋ฏธ๋งŒ', '1-3๋งŒ์›', '3-5๋งŒ์›', '5-8๋งŒ์›', '8๋งŒ์›์ด์ƒ'],
ํŠน์„ฑ: ['ํƒ€๊ณ  ๋…ธ๋Š”', '๋งŒ์ง€๊ณ  ๋…ธ๋Š”', '๊ธฐํƒ€'],
'์žฅ๋‚œ๊ฐ ์ข…๋ฅ˜': [
์ข…๋ฅ˜: [
'์•„๊ธฐ์ฒด์œก๊ด€',
'๋ชจ๋นŒ',
'๋ฐ”์šด์„œ',
Expand All @@ -87,6 +64,29 @@ export const filterListState = atom({
'์—ญํ• ๋†€์ด',
'๊ธฐํƒ€',
],
'์‚ฌ์šฉ ์—ฐ๋ น': [
'0~5๊ฐœ์›”',
'6~11๊ฐœ์›”',
'12~17๊ฐœ์›”',
'18~23๊ฐœ์›”',
'24~35๊ฐœ์›”',
'36~47๊ฐœ์›”',
'48~60๊ฐœ์›”',
'๊ธฐํƒ€',
],
๊ฐ€๊ฒฉ: ['1๋งŒ์› ๋ฏธ๋งŒ', '1-3๋งŒ์›', '3-5๋งŒ์›', '5-8๋งŒ์›', '8๋งŒ์›์ด์ƒ'],
ํŠน์„ฑ: ['ํƒ€๊ณ  ๋…ธ๋Š”', '๋งŒ์ง€๊ณ  ๋…ธ๋Š”', '๊ธฐํƒ€'],
์Šคํ† ์–ด: [
'๊ตญ๋ฏผ์žฅ๋‚œ๊ฐ',
'๊ทธ๋ฆฐํ‚ค๋“œ',
'๋Ÿฌ๋ธŒ๋กœ',
'๋ฆฌํ‹€๋ฒ ์ด๋น„',
'๋นŒ๋ฆฌ๋ฐ”๋ฐ”',
'์–ดํ…์…˜ํ™ˆ์ด๋ฒคํŠธ',
'์žฅ๋‚œ๊ฐ์ ๋นต',
'์ ค๋ฆฌ๋ฐ”์šด์Šค',
'ํ•ดํ”ผ์žฅ๋‚œ๊ฐ',
],
},
},
});
Expand Down
Loading

0 comments on commit 182ca8e

Please sign in to comment.