Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat/#26 ] 댓글 컴포넌트 구현 #32

Merged
merged 17 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/feature-issue.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: "✨ Feat"
description: "새로운 기능 추가"
title: "[ Feat ] "
labels: ["feature"]
body:
- type: textarea
Expand All @@ -19,4 +20,4 @@ body:
- type: textarea
attributes:
label: 🙋🏻 참고 자료
description: 참고 자료가 있다면 작성해 주세요.
description: 참고 자료가 있다면 작성해 주세요.
7 changes: 6 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"lineWidth": 120,
"attributePosition": "auto"
},
"organizeImports": { "enabled": true },
"organizeImports": { "enabled": false },
"linter": {
"enabled": true,
"rules": {
Expand All @@ -35,6 +35,11 @@
"level": "warn",
"fix": "safe"
}
},
"style": {
"useImportType": {
"level": "off"
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"dependencies": {
"@tanstack/react-query": "^5.62.11",
"@vanilla-extract/css": "^1.17.0",
"@vanilla-extract/dynamic": "^2.1.2",
"@vanilla-extract/recipes": "^0.5.5",
"axios": "^1.7.9",
"openapi-typescript": "^7.5.2",
"react": "^18.3.1",
Expand Down
31 changes: 31 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/svgs/Ellipse 57.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/svgs/ellipses.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/svgs/message.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/asset/svg/Ellipse57.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { SVGProps } from "react";
const SvgEllipse57 = (props: SVGProps<SVGSVGElement>) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width={32}
height={32}
fill="none"
{...props}
>
<circle cx={16} cy={16} r={16} fill="#E4E4E4" />
</svg>
);
export default SvgEllipse57;
20 changes: 20 additions & 0 deletions src/asset/svg/Ellipses.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { SVGProps } from "react";
const SvgEllipses = (props: SVGProps<SVGSVGElement>) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width={22}
height={22}
fill="none"
{...props}
>
<g
stroke="#222"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={1.5}
>
<path d="M11 11.875a.875.875 0 1 0 0-1.75.875.875 0 0 0 0 1.75M11 5.75A.875.875 0 1 0 11 4a.875.875 0 0 0 0 1.75M11 18a.875.875 0 1 0 0-1.75.875.875 0 0 0 0 1.75" />
</g>
</svg>
);
export default SvgEllipses;
19 changes: 19 additions & 0 deletions src/asset/svg/Message.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { SVGProps } from "react";
const SvgMessage = (props: SVGProps<SVGSVGElement>) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width={18}
height={18}
fill="none"
{...props}
>
<path
stroke="#BEBEBE"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={1.5}
d="M5.625 9h.008M9 9h.008m3.367 0h.008M9 15.75a6.75 6.75 0 1 0-6.256-4.212c.06.15.09.225.104.286a.7.7 0 0 1 .019.164c0 .062-.012.13-.034.265l-.445 2.668c-.046.28-.07.42-.026.52a.38.38 0 0 0 .196.197c.101.044.241.02.52-.026l2.669-.445c.135-.022.203-.034.265-.034.06 0 .105.005.164.019s.136.043.286.105c.783.318 1.64.493 2.538.493M6 9a.375.375 0 1 1-.75 0A.375.375 0 0 1 6 9m3.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0m3.375 0A.375.375 0 1 1 12 9a.375.375 0 0 1 .75 0"
/>
</svg>
);
export default SvgMessage;
3 changes: 3 additions & 0 deletions src/asset/svg/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export { default as Ellipse57 } from "./Ellipse57";
export { default as Ellipses } from "./Ellipses";
export { default as Message } from "./Message";
export { default as Plus } from "./Plus";
export { default as React } from "./React";
export { default as Vite } from "./Vite";
103 changes: 103 additions & 0 deletions src/common/component/Comment/Comment.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { style } from "@vanilla-extract/css";
import { font, semanticColor } from "@style/styles.css";

export const commentContainer = style([
{
position: "relative",
display: "flex",
flexDirection: "column",
width: "33.5rem",
padding: "8px 0px",
gap: "0.4rem",
},
]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3) 혹시 padding : 8px, 0px 은 어디에 있던 값이었나요?
image
피그마상에서는, padding-top : 16px 로 되어 있던데 확실히 디자인이 달라보이더라구요. 다시 한번 확인 부탁드립니다 !

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어엇 Comment layout에 해당 padding 값이 있어서 적용했습니다..!

image


export const containerOptionsIcon = style([
{
position: "absolute",
right: "0.8rem",
top: "0.8rem",
},
]);

export const commentItem = style([
{
display: "flex",
alignItems: "flex-start",
gap: "0.4rem",
},
]);

export const contentContainer = style([
{
flex: 1,
display: "flex",
flexDirection: "column",
gap: "0.4rem",
},
]);

export const header = style([
{
display: "flex",
alignItems: "center",
gap: "0.8rem",
},
]);

export const headerInfo = style([
{
display: "flex",
flexDirection: "column",
},
]);

export const nickname = style([
font.label01,
{
fontWeight: 600,
color: semanticColor.text.assistive,
letterSpacing: "-0.024rem",
},
]);

export const meta = style([
font.label01,
{
color: semanticColor.text.assistive,
fontWeight: 500,
letterSpacing: "-0.024rem",
},
]);

export const text = style([
font.heading03,
{
color: semanticColor.text.normal,
fontWeight: "500",
lineHeight: "2.24rem",
letterSpacing: "-0.16rem",
padding: "0px 11px 0px 40px",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3) 패딩은 rem 아닌 px 로 한 이유가 있을까요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엇 그것은 그냥 저의 무지... padding 값과 borderRadius 값이랑 헷갈렸나봐요 ㅠㅠ 수정했습니다!

},
]);

export const replyContainer = style([
{
display: "flex",
alignItems: "center",
padding: "0px 11px 0px 40px",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3) 여기도 px 확인 해주세용

},
]);

export const replyText = style([
font.label01,
{
color: semanticColor.text.assistiveLight,
},
]);

export const icon = style([
{
gap: "0.4rem",
},
]);
36 changes: 36 additions & 0 deletions src/common/component/Comment/Comment.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as styles from "./Comment.css";
import { Ellipse57, Message, Ellipses } from "@asset/svg";
import mockComments from "@common/component/Comment/mock/mockComments";

const Comment = () => {
const { comments } = mockComments;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p1) mock data를 사용해서 코멘트의 예시 모습을 렌더링하는거 너무 좋은데,
나중에는 Comment 컴포넌트에 prop으로 직접 넘겨줘야하니까 prop들, interface를 전부 구성해둡시다!
(지금 형태는 단순하게 퍼블리싱 된 형태입니다!)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정했습니다 -!


return (
<div className={styles.commentContainer}>
{comments.map((comment) => (
<div key={comment.id} className={styles.commentItem}>
<div className={styles.contentContainer}>
<div className={styles.header}>
<Ellipse57 />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3) 이거 버튼에도 함수를 연결할 수 있도록 만들어야 할 것 같아요!

<div className={styles.headerInfo}>
<Ellipses className={styles.containerOptionsIcon} />
<span className={styles.nickname}>{comment.nickname}</span>
<span className={styles.meta}>
{comment.breed}·{comment.petAge}살 · {comment.createdAt}
</span>
</div>
</div>
<p className={styles.text}>{comment.content}</p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3)
image
이거 보면 content 내용이 길어질경우 피그마와는 다르게 오른쪽으로 조금 삐져나오는데, 이거 조정이 필요할 것 같아요!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저 content를 감싸는 p 태그의 width(혹은 max-width)값을 정해져서 모양이 일관되면 좋을 것 같아요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정했습니다~!


<div className={styles.replyContainer}>
<Message className={styles.icon} />
<p className={styles.replyText}>답글쓰기</p>
</div>
</div>
</div>
))}
</div>
);
};

export default Comment;
14 changes: 14 additions & 0 deletions src/common/component/Comment/mock/mockComments.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2) 이거 mock comment 목 데이터 임시로 만드신 거 같은데, 파일 위치 여기 위치하는 게 맞을지 얘기해보면 좋을 것 같아요

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const mockComments = {
comments: [
{
id: 1,
nickname: "리트리버사랑해",
breed: "골든리트리버",
petAge: 12,
content: "호흡기 문제일 수 있는데 다른 증상은 없나요?",
createdAt: "1시간전",
},
],
};

export default mockComments;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p1) 그리고 mockData 위에는 반드시 주석 남겨줍시다 "api 연결 후 삭제할 예정입니다"
그리고 common/component 에 파일 만들어서 저장해두는 건 폴더 구조를 위반하는거니까 꼭 수정합시다!
(그냥 해당 예시 데이터를 사용하는 곳에서 직접 정의해두거나, constant 폴더에서 파일 만들고 export 하거나)

24 changes: 24 additions & 0 deletions src/common/component/Divider/Divider.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { semanticColor } from "@style/styles.css";
import { recipe, RecipeVariants } from "@vanilla-extract/recipes";

export const divider = recipe({
base: {
width: "100%",
backgroundColor: semanticColor.line.normal,
},

variants: {
size: {
large: { height: "1.6rem" },
small: { height: "0.1rem" },
},
},
});

export type DividerVariants = RecipeVariants<typeof divider>;
//위는 아래와 동일한 타입 생성
/*
export type DividerVariants = {
size?: 'large' | 'small'
}
*/
9 changes: 9 additions & 0 deletions src/common/component/Divider/Divider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { divider, DividerVariants } from "./Divider.css";

type DividerPropTypes = Exclude<DividerVariants, undefined>;

const Divider = ({ size = "large" }: DividerPropTypes) => {
return <div className={divider({ size: size })} />;
};

export default Divider;
8 changes: 8 additions & 0 deletions src/common/component/Spacing/Spacing.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createVar, style } from "@vanilla-extract/css";

//동적 스타일링 (style 관련된 코드는 반드시 .css.ts에 작성하는게 rule
export const marginBottomVar = createVar();
export const container = style({
marginBottom: marginBottomVar,
backgroundColor: "black",
});
Loading