Skip to content

Commit f2aedea

Browse files
committed
Merge remote-tracking branch 'origin/dev' into feat/mypage#106
2 parents 7b2d9bc + 7ccdd93 commit f2aedea

File tree

27 files changed

+515
-179
lines changed

27 files changed

+515
-179
lines changed

next.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import type { NextConfig } from 'next';
22

33
const nextConfig: NextConfig = {
44
images: {
5-
domains: ['www.thecocktaildb.com'],
5+
remotePatterns: [
6+
{
7+
protocol: 'https',
8+
hostname:'www.thecocktaildb.com'
9+
}
10+
]
611
},
712
env: {
813
NPUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,

src/app/community/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PageHeader from '@/domains/shared/components/page-header/PageHeader';
33
import { Metadata } from 'next';
44

55
export const metadata: Metadata = {
6-
title: 'SSOUL | 커뮤니티',
6+
title: '커뮤니티',
77
description: '칵테일에 관한 모든 이야기',
88
};
99

src/app/login/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import loginBg from '@/shared/assets/images/login_bg.webp';
44
import SocialLogin from '@/domains/login/main/SocialLogin';
55

66
export const metadata: Metadata = {
7-
title: 'SSOUL | 로그인',
7+
title: '로그인',
88
description: '칵테일을 좋아하는 사람들을 위한 서비스 로그인 페이지',
99
};
1010

src/app/mypage/my-active/my-comment/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import MyComment from '@/domains/mypage/components/pages/my-active/MyComment';
22
import { Metadata } from 'next';
33

44
export const metadata: Metadata = {
5-
title: 'SSOUL | 마이페이지',
5+
title: '마이페이지',
66
description: 'SSOUL 서비스에서 나의 활동을 관리할 수 있는 페이지입니다',
77
};
88

src/app/mypage/my-active/my-like/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import MyLike from '@/domains/mypage/components/pages/my-active/MyLike';
33
import { Metadata } from 'next';
44

55
export const metadata: Metadata = {
6-
title: 'SSOUL | 마이페이지',
6+
title: '마이페이지',
77
description: 'SSOUL 서비스에서 나의 활동을 관리할 수 있는 페이지입니다',
88
};
99

src/app/mypage/my-active/my-post/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import MyPost from '@/domains/mypage/components/pages/my-active/MyPost';
22
import { Metadata } from 'next';
33

44
export const metadata: Metadata = {
5-
title: 'SSOUL | 마이페이지',
5+
title: '마이페이지',
66
description: 'SSOUL 서비스에서 나의 활동을 관리할 수 있는 페이지입니다',
77
};
88

src/app/mypage/my-alarm/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import MyAlarm from '@/domains/mypage/components/pages/my-alarm/MyAlarm';
33
import { Metadata } from 'next';
44

55
export const metadata: Metadata = {
6-
title: 'SSOUL | 마이페이지',
6+
title: '마이페이지',
77
description: 'SSOUL 서비스에서 나의 활동을 관리할 수 있는 페이지입니다',
88
};
99

src/app/mypage/my-bar/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import MyBar from '@/domains/mypage/components/pages/my-bar/MyBar';
22
import { Metadata } from 'next';
33

44
export const metadata: Metadata = {
5-
title: 'SSOUL | 마이페이지',
5+
title: '마이페이지',
66
description: 'SSOUL 서비스에서 나의 활동을 관리할 수 있는 페이지입니다',
77
};
88

src/app/recipe/page.tsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { Metadata } from 'next';
2-
import Input from '@/shared/components/Input-box/Input';
32

4-
import Accordion from '../../domains/recipe/components/main/Accordion';
53
import PageHeader from '@/domains/shared/components/page-header/PageHeader';
64
import { Suspense } from 'react';
75
import SkeletonRecipe from '@/domains/recipe/skeleton/SkeletonRecipe';
8-
import Cocktails from '@/domains/recipe/main/Cocktails';
6+
import Cocktails from '@/domains/recipe/components/main/Cocktails';
97

108
export const metadata: Metadata = {
11-
title: 'SSOUL | 칵테일레시피',
9+
title: '칵테일레시피',
1210
description: '칵테일 레시피가 궁금하신 분들을 위한 레시피 페이지',
1311
};
1412

@@ -20,15 +18,6 @@ function Page() {
2018
</section>
2119
<div className="page-layout max-w-1224 mt-6">
2220
<Suspense fallback={<SkeletonRecipe />}>
23-
<section className="flex flex-col-reverse items-start gap-6 md:flex-row md:justify-between md:items-center ">
24-
<Accordion />
25-
<Input
26-
placeholder="내용을 입력해 주세요."
27-
id="search"
28-
variant="search"
29-
className="w-full md:max-w-80"
30-
/>
31-
</section>
3221
<Cocktails />
3322
</Suspense>
3423
</div>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
'use client';
2+
import { getApi } from '@/app/api/config/appConfig';
3+
import { Cocktail } from '../types/types';
4+
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
5+
6+
interface Props {
7+
setData: Dispatch<SetStateAction<Cocktail[]>>;
8+
setNoResults: Dispatch<React.SetStateAction<boolean>>;
9+
}
10+
11+
function CocktailSearch({ setData, setNoResults }: Props) {
12+
const [alcoholStrengths, setAlcoholStrengths] = useState<string[]>([]);
13+
const [cocktailTypes, setCocktailTypes] = useState<string[]>([]);
14+
const [alcoholBaseTypes, setAlcoholBaseTypes] = useState<string[]>([]);
15+
16+
const searchApi = async (v?: string) => {
17+
const keyword = v?.trim() ?? '';
18+
const body = {
19+
keyword,
20+
alcoholStrengths,
21+
cocktailTypes,
22+
alcoholBaseTypes,
23+
page: 0,
24+
size: 100,
25+
};
26+
27+
if (!keyword && !alcoholStrengths.length && !cocktailTypes.length && !alcoholBaseTypes.length) {
28+
setData([]);
29+
setNoResults(false);
30+
return null;
31+
}
32+
33+
const res = await fetch(`${getApi}/cocktails/search`, {
34+
method: 'POST',
35+
headers: { 'Content-Type': 'application/json' },
36+
body: JSON.stringify(body),
37+
});
38+
const json = await res.json();
39+
40+
setData(json.data);
41+
setNoResults(json.data.length === 0);
42+
};
43+
44+
useEffect(() => {
45+
searchApi();
46+
}, [alcoholStrengths, cocktailTypes, alcoholBaseTypes]);
47+
48+
return {
49+
searchApi,
50+
setAlcoholBaseTypes,
51+
setAlcoholStrengths,
52+
setCocktailTypes,
53+
alcoholBaseTypes,
54+
alcoholStrengths,
55+
cocktailTypes,
56+
};
57+
}
58+
export default CocktailSearch;

0 commit comments

Comments
 (0)