-
Notifications
You must be signed in to change notification settings - Fork 3
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
Changes from 11 commits
7fab75c
2199e41
6762b2a
f0851af
cb5b42e
d05b6df
d98f5b7
0fbd12d
939c726
6c73a94
6e78357
555cd9d
1784d8d
d42aa85
08adcce
b7d954e
a31aa11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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; |
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; |
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; |
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"; |
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", | ||
}, | ||
]); | ||
|
||
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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. p3) 패딩은 rem 아닌 px 로 한 이유가 있을까요?? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", | ||
}, | ||
]); |
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. p1) mock data를 사용해서 코멘트의 예시 모습을 렌더링하는거 너무 좋은데, There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저 content를 감싸는 p 태그의 width(혹은 max-width)값을 정해져서 모양이 일관되면 좋을 것 같아요! There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. p1) 그리고 mockData 위에는 반드시 주석 남겨줍시다 "api 연결 후 삭제할 예정입니다" |
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' | ||
} | ||
*/ |
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; |
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", | ||
}); |
There was a problem hiding this comment.
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](https://private-user-images.githubusercontent.com/155794105/402651361-ef68753b-07a8-4ad2-b15d-f8ef63b20862.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMDMxODQsIm5iZiI6MTczOTIwMjg4NCwicGF0aCI6Ii8xNTU3OTQxMDUvNDAyNjUxMzYxLWVmNjg3NTNiLTA3YTgtNGFkMi1iMTVkLWY4ZWY2M2IyMDg2Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxNTU0NDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wMDhkYTYzOTY0YTVjODI5M2QwMGY1NzhmNTRmMGQ0YTcwZDcyNDBiOGU3M2YzZmNhMmNhNjZiZWZkNTQ0NWY0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.8QqiSbOqvABRd7Y5Mn8hFuxPI2mii-o_3Wcj77dk2u4)
피그마상에서는, padding-top : 16px 로 되어 있던데 확실히 디자인이 달라보이더라구요. 다시 한번 확인 부탁드립니다 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어엇 Comment layout에 해당 padding 값이 있어서 적용했습니다..!