Skip to content

Commit

Permalink
Merge branch 'fix/feature'
Browse files Browse the repository at this point in the history
  • Loading branch information
asaei623 committed Sep 26, 2023
2 parents 176c3b3 + 77bc689 commit d054238
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
13 changes: 2 additions & 11 deletions src/components/common/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ShortBtn } from './Button';
import { CategoryLabel } from 'components/Category/CategoryLabel';
import { questionType } from 'types';
import { Ref, forwardRef } from 'react';
import { useRecoilValue, useSetRecoilState } from 'recoil';
import { useSetRecoilState } from 'recoil';
import { questionState } from 'store/recoil/atom';

interface cardProps {
Expand Down Expand Up @@ -67,13 +67,6 @@ export const AnsButtonCard = forwardRef(
height={270}
ref={ref}
justifyContent="space-between"
onClick={() => {
//์งˆ๋ฌธ ๋‚ด์šฉ์„ ์ €์žฅ ํ›„ ํด๋ฆญ์‹œ ์ด์–ด์ง€๋Š” ์ƒ์„ธ ํŽ˜์ด์ง€์—์„œ ์‚ฌ์šฉ
setWriteState({
title: question.title,
content: question.content,
});
}}
>
<InnerBox gap={10}>
<Tag tagType={'question'}>
Expand All @@ -88,9 +81,7 @@ export const AnsButtonCard = forwardRef(
},
);

export const QDetailCard = () => {
const question = useRecoilValue(questionState);

export const QDetailCard = ({ question }: { question: questionType }) => {
return (
<QDContainer color={Palette.Sub.blue} gap={20}>
<Row gap={10}>
Expand Down
2 changes: 1 addition & 1 deletion src/network/apis/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const getQuestionApi = async ({
page,
}: {
category: string;
page: number;
page: number | null;
}) => {
try {
let res = await publicInstance.get('/questions', {
Expand Down
27 changes: 26 additions & 1 deletion src/pages/Answer/WriteAnswer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,35 @@ import { Header } from 'components/common/Header';
import WriteConfirmBar from 'components/common/WriteConfirmBar';
import { Palette } from 'styles/Palette';
import { useParams } from 'react-router-dom';
import { useEffect, useState } from 'react';
import { getQuestionApi } from 'network/apis/question';
import { questionType } from 'types';

const WriteAnswer = () => {
const { idx } = useParams();
const idxNum = idx ? parseInt(idx) : null;
const [question, setQuestion] = useState<questionType>();

useEffect(() => {
const fetchQuestion = async () => {
try {
let res = await getQuestionApi({
category: '',
page: null,
});
const question: questionType = res.result.content.find(
(item: questionType) => item.postIdx === idxNum,
);
if (question !== undefined) {
setQuestion(question);
}
} catch (err) {
console.log(err);
}
};

fetchQuestion();
}, []);

return (
<Column>
Expand All @@ -20,7 +45,7 @@ const WriteAnswer = () => {
style={{ height: 'calc(100dvh - 119px)' }}
>
<Column gap={22} alignItems="center">
<QDetailCard />
{question !== undefined && <QDetailCard question={question} />}
<WriteInputBox
minHeight={203}
placeholder="์‹œ๋‹ˆ์–ด๋‹˜์˜ ๊ฒฝํ—˜์„ ๋ฐ”ํƒ•์œผ๋กœ ๋‹ต๋ณ€์„ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”."
Expand Down
2 changes: 0 additions & 2 deletions src/pages/Mypage/MyQna/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export const MyQna = () => {
const [myQnaCount, setMyQnaCount] = useState<number>();
const [page, setPage] = useState<number>(2);

console.log(myQnaData);

const { ref, inView } = useInView();

if (userType === 'Juni') {
Expand Down
2 changes: 1 addition & 1 deletion src/styles/Palette.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { rgba } from 'polished';

const userType = window.localStorage.getItem('userType');
console.log(userType);

const orange = '#FF8267';
const blue = '#3F6EFF';
const main: string = userType === 'Juni' ? orange : blue;
Expand Down

0 comments on commit d054238

Please sign in to comment.