Skip to content

Commit 5dbb0df

Browse files
authored
feat(fe): include question content in reply modal (#228)
* feat: include question content in reply modal * fix: restrict dropdown visibility to host users only
1 parent 8eaa924 commit 5dbb0df

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

apps/client/src/components/modal/CreateQuestionModal.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
import { useToastStore } from '@/features/toast';
1313

1414
import { Button } from '@/components';
15-
import Modal from '@/components/modal/Modal';
1615

1716
interface CreateQuestionModalProps {
1817
question?: Question;
@@ -100,12 +99,12 @@ function CreateQuestionModal({ question }: CreateQuestionModalProps) {
10099
}, [question]);
101100

102101
return (
103-
<Modal>
104-
<div className='inline-flex h-[40dvh] w-[600px] flex-col items-center justify-center gap-2.5'>
102+
<div className='inline-flex min-h-[45dvh] min-w-[45dvw] flex-col items-center justify-center gap-2.5 rounded-lg bg-gray-50 p-8 shadow'>
103+
<div className='inline-flex h-full w-full flex-grow flex-col items-center justify-center gap-2.5'>
105104
<div className='inline-flex items-center justify-start gap-2.5 self-stretch border-b border-gray-200 pb-1'>
106105
<div className='text-lg font-semibold text-black'>질문하기</div>
107106
</div>
108-
<div className='inline-flex h-[30dvh] shrink grow basis-0 items-center justify-center gap-2.5 self-stretch'>
107+
<div className='inline-flex h-full shrink grow basis-0 items-center justify-center gap-2.5 self-stretch'>
109108
<textarea
110109
className='shrink grow basis-0 resize-none flex-col items-start justify-start gap-2 self-stretch whitespace-pre-wrap rounded border border-gray-200 bg-white p-4 focus:outline-none'
111110
value={body}
@@ -136,7 +135,7 @@ function CreateQuestionModal({ question }: CreateQuestionModalProps) {
136135
</div>
137136
</div>
138137
</div>
139-
</Modal>
138+
</div>
140139
);
141140
}
142141

apps/client/src/components/modal/CreateReplyModal.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
import { useToastStore } from '@/features/toast';
1414

1515
import Button from '@/components/Button';
16-
import Modal from '@/components/modal/Modal';
1716

1817
interface CreateReplyModalProps {
1918
question?: Question;
@@ -110,19 +109,26 @@ function CreateReplyModal({ question, reply }: CreateReplyModalProps) {
110109
}, [reply]);
111110

112111
return (
113-
<Modal>
114-
<div className='inline-flex h-[40dvh] w-[600px] flex-col items-center justify-center gap-2.5'>
112+
<div className='inline-flex min-h-[45dvh] min-w-[45dvw] flex-col items-center justify-center gap-2.5 rounded-lg bg-gray-50 p-8 shadow'>
113+
<div className='inline-flex h-full w-full flex-grow flex-col items-center justify-center gap-4'>
115114
<div className='inline-flex items-center justify-start gap-2.5 self-stretch border-b border-gray-200 pb-1'>
116115
<div className='text-lg font-semibold text-black'>답변하기</div>
117116
</div>
118-
<div className='inline-flex h-[30dvh] shrink grow basis-0 items-center justify-center gap-2.5 self-stretch'>
117+
<div className='max-h-[20dvh] self-stretch overflow-y-auto border-b border-gray-200 py-4 text-left font-medium text-gray-700'>
118+
{question && (
119+
<Markdown className='prose prose-stone flex w-full flex-col gap-3 prose-img:rounded-md'>
120+
{question.body}
121+
</Markdown>
122+
)}
123+
</div>
124+
<div className='inline-flex h-full shrink grow basis-0 items-center justify-center gap-2.5 self-stretch'>
119125
<textarea
120-
className='shrink grow basis-0 resize-none flex-col items-start justify-start gap-2 self-stretch whitespace-pre-wrap rounded border border-gray-200 bg-white p-4 focus:outline-none'
126+
className='h-full shrink grow basis-0 resize-none flex-col items-start justify-start gap-2 self-stretch whitespace-pre-wrap rounded border border-gray-200 bg-white p-4 focus:outline-none'
121127
value={body}
122128
onChange={(e) => setBody(e.target.value)}
123129
placeholder={`**답변을 남겨주세요**\n**(마크다운 지원)**`}
124130
/>
125-
<div className='inline-flex shrink grow basis-0 flex-col items-start justify-start gap-2 self-stretch overflow-y-auto rounded border border-gray-200 bg-white p-4'>
131+
<div className='inline-flex h-full shrink grow basis-0 flex-col items-start justify-start gap-2 self-stretch overflow-y-auto rounded border border-gray-200 bg-white p-4'>
126132
<Markdown className='prose prose-stone flex w-full flex-col gap-3 prose-img:rounded-md'>
127133
{body.length === 0
128134
? `**답변을 남겨주세요**\n\n**(마크다운 지원)**`
@@ -146,7 +152,7 @@ function CreateReplyModal({ question, reply }: CreateReplyModalProps) {
146152
</div>
147153
</div>
148154
</div>
149-
</Modal>
155+
</div>
150156
);
151157
}
152158

apps/client/src/components/qna/QuestionList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function QuestionList() {
172172
<p className='text-sm font-bold text-black'>설정</p>
173173
</Button>
174174
)}
175-
{isDropdownOpen && (
175+
{isHost && isDropdownOpen && (
176176
<SessionSettingsDropdown
177177
buttons={sessionButtons}
178178
onClose={() => setIsDropdownOpen(false)}

0 commit comments

Comments
 (0)