Skip to content

Commit d4defbf

Browse files
committed
[style] 카드 컴포넌트 구현 완료
1 parent a0d9f89 commit d4defbf

File tree

5 files changed

+71
-78
lines changed

5 files changed

+71
-78
lines changed

src/app/recommend/ChatForm.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Image from 'next/image';
2+
import Dummy from '@/shared/assets/images/dummy/exampleCocktail.png';
3+
import Link from 'next/link';
4+
import Keep from '@/shared/components/keep/Keep';
5+
6+
function ChatCocktailCard() {
7+
return (
8+
<div className="relative flex flex-col w-full min-w-[200px] rounded-2xl overflow-hidden bg-white shadow-[0_0_12px_rgba(255,255,255,0.4)]">
9+
<Link href="/" className="block relative">
10+
<div className="relative w-full h-[200px]">
11+
<Image src={Dummy} fill className="object-cover" alt="칵테일 이름" />
12+
</div>
13+
14+
<div className="p-3 flex flex-col gap-1 text-center">
15+
<strong className="text-black text-lg">{'진피즈'}</strong>
16+
<span className="text-gray-500 text-sm">+ 상세보기</span>
17+
</div>
18+
</Link>
19+
<Keep className="absolute top-2 right-2 z-50" />
20+
</div>
21+
);
22+
}
23+
export default ChatCocktailCard;

src/app/recommend/components/ChatForm.tsx

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,30 @@ function ChatForm() {
1515
};
1616

1717
return (
18-
<form
19-
onSubmit={(e) => e.preventDefault()}
20-
className="absolute w-[calc(100%-24px)] bottom-12 left-3"
21-
>
22-
<div className="flex items-end w-full gap-2">
23-
<label htmlFor="chatInput" className="sr-only">
24-
질문 입력창
25-
</label>
26-
<textarea
27-
id="chatInput"
28-
name="chatInput"
29-
onKeyDown={(e) => keyDown(e)}
30-
onInput={(e) => handleInput(e)}
31-
placeholder="칵테일 추천 질문을 입력해주세요."
32-
className="w-[calc(100%-3.75rem)] px-4 py-3.5 rounded-lg h-[52px] max-h-[280px] bg-white text-primary placeholder:text-gray-dark resize-none outline-none"
33-
/>
34-
<button
35-
type="button"
36-
aria-label="보내기"
37-
className="flex-center w-13 h-13 rounded-xl border-1 border-white bg-secondary/20"
38-
>
39-
<Send className="text-secondary" />
40-
</button>
41-
</div>
42-
</form>
18+
<div className="fixed left-0 bottom-0 w-full px-3 py-4 bg-primary">
19+
<form onSubmit={(e) => e.preventDefault()}>
20+
<div className="flex items-end w-full gap-2">
21+
<label htmlFor="chatInput" className="sr-only">
22+
질문 입력창
23+
</label>
24+
<textarea
25+
id="chatInput"
26+
name="chatInput"
27+
onKeyDown={(e) => keyDown(e)}
28+
onInput={(e) => handleInput(e)}
29+
placeholder="칵테일 추천 질문을 입력해주세요."
30+
className="w-[calc(100%-3rem)] md:w-[calc(100%-3.75rem)] px-4 py-2 md:py-3.5 rounded-lg h-[40px] md:h-[52px] max-h-[160px] md:max-h-[280px] bg-white text-primary placeholder:text-gray-dark resize-none outline-none"
31+
/>
32+
<button
33+
type="button"
34+
aria-label="보내기"
35+
className="flex-center w-10 md:w-13 h-10 md:h-13 rounded-xl border-1 border-white bg-secondary/20"
36+
>
37+
<Send className="text-secondary" />
38+
</button>
39+
</div>
40+
</form>
41+
</div>
4342
);
4443
}
4544
export default ChatForm;

src/app/recommend/components/SsuryChat.tsx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ function SsuryChat() {
4040
];
4141

4242
return (
43-
<article aria-label="취향추천 챗봇 메시지" className="max-w-[80%]">
43+
<article aria-label="취향추천 챗봇 메시지" className="">
4444
<header className="flex items-end">
45-
<div className="relative w-20 h-20">
46-
<Image src={Ssury} alt="쑤리아바타" width={80} height={80} className="object-cover" />
45+
<div className="relative w-15 md:w-20 h-15 md:h-20">
46+
<Image
47+
src={Ssury}
48+
alt="쑤리아바타"
49+
width={80}
50+
height={80}
51+
className="object-cover w-15 h-15"
52+
/>
4753
</div>
4854
<strong>쑤리</strong>
4955
</header>
@@ -53,9 +59,19 @@ function SsuryChat() {
5359
{messages.map((msg) => (
5460
<div key={msg.id}>
5561
{msg.type === 'recommend' ? (
56-
<ChatCocktailCard />
62+
<ul className="inline-grid grid-cols-1 sm:grid-cols-3 gap-2 justify-start">
63+
<li>
64+
<ChatCocktailCard />
65+
</li>
66+
<li>
67+
<ChatCocktailCard />
68+
</li>
69+
<li>
70+
<ChatCocktailCard />
71+
</li>
72+
</ul>
5773
) : (
58-
<div className="flex flex-col w-fit min-w-[120px] p-3 rounded-2xl rounded-tl-none bg-white text-black">
74+
<div className="flex flex-col w-fit max-w-[80%] min-w-[120px] p-3 rounded-2xl rounded-tl-none bg-white text-black">
5975
{msg.text && <p className="whitespace-pre-line">{msg.text}</p>}
6076

6177
{/* radio */}

src/app/recommend/page.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,17 @@ import MyChat from './components/MyChat';
66
function Page() {
77
return (
88
<div
9-
className="bg-repeat-y bg-top bg-auto w-full flex"
9+
className="relative bg-repeat-y bg-top bg-auto w-full flex"
1010
style={{ backgroundImage: `url(${Bg.src})` }}
1111
>
1212
<h1 className="sr-only">취향추천하기</h1>
13-
<div className="relative page-layout max-w-1024 py-12 ">
13+
<div className="page-layout max-w-1024 py-12 ">
1414
<div className="flex flex-col gap-10 pb-20">
1515
<SsuryChat />
1616
<MyChat></MyChat>
1717
</div>
18-
19-
<ChatForm />
2018
</div>
19+
<ChatForm />
2120
</div>
2221
);
2322
}

0 commit comments

Comments
 (0)