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

기사의 제목(헤드라인)을 표시하는 부분 생성 #10

Merged
merged 19 commits into from
Jul 15, 2024

Conversation

stopmin
Copy link
Contributor

@stopmin stopmin commented Jul 1, 2024

관련 이슈

작업 요약

스크린샷 2024-07-16 오전 12 34 24

  • 기사 보기에 헤드라인 부분을 생성하였습니다!

작업 상세 설명

리뷰 요구 사항

  • chip은 피그마에 없어서 일단 생략했습니다! 만들어두기만 하고 붙이지 않았습니다.
  • 그리고 색상 두가지 그라데이션에 활용하는 색 추가해뒀습니다!

미리 보기

스크린샷 2024-07-16 오전 12 33 27

@stopmin stopmin added the Feature label Jul 1, 2024
@stopmin stopmin requested a review from yeonddori July 1, 2024 18:29
@stopmin stopmin self-assigned this Jul 1, 2024
@stopmin
Copy link
Contributor Author

stopmin commented Jul 3, 2024

@yeonddori

import Chip from '@mui/material/Chip';
import { useTheme } from '@mui/material/styles';

const TagChip = ({ label }: { label: string }) => {
  const theme = useTheme();

  return (
    <Chip
      label={label}
      sx={{
        color: '#000000',
        display: 'flex',
        alignItems: 'center',
        backgroundColor: theme.palette.primary.main,
      }}
    />
  );
};

export default TagChip;

여기 background Color도 테마로 지정한 색을 사용해도 되나요? 여기서 "primary"로 하면 안될 것 같은데 어떻게 하면 좋을지 궁금합니다!

@stopmin
Copy link
Contributor Author

stopmin commented Jul 3, 2024

일단 아래와 같이 수정했습니다!!

    <Chip
      label={label}
      color="primary"
      sx={{
        color: '#000000',
        display: 'flex',
        alignItems: 'center',
      }}
    />

Copy link
Contributor

@yeonddori yeonddori left a comment

Choose a reason for hiding this comment

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

제목은 h1로 하는게 맞나욤?

맞습니다~! SEO 및 접근성 측면에서 h1 태그가 매우 중요한 역할을 하기 때문에, 제목은 h1로 명시해주는 것이 좋습니다! 나중에 오버라이드를 통해 h1의 사이즈를 사용자 지정으로 해놓으면, 따로 fontSize 없이 h1만 써도 됩니다! 이 부분은 같이 논의해서 사이즈를 정해봐요~!

네이밍이나 전체적인 구조에 대해서 리뷰 부탁드립니당!!!

모두 완벽한 것 같습니다!! 마음에 들어요😊

Chip은 따로 빼놨는데 괜찮을까욤?

너무 잘하셨습니다!! Chip도 하나의 컴포넌트이기에, 별도의 파일로 지정해두는 것이 맞습니다!

지금 Chip 안에도 목 데이터를 두고 있는데 이전 PR에서 카테고리 5개를 정의한 것으로 아는데 그 PR이 머지되면 그곳에서 가져와서 쓰도록 수정해야할까요?

Chip 컴포넌트가 쓰일 때는 해당 기사가 어떤 카테고리인지 구분하는 용도로 쓰이게 될 텐데, 그렇게 되면 API로 기사에 대한 정보가 넘어올 때 카테고리도 무엇인지 같이 넘어오겠죠? 그렇기에 Tab 부분의 카테고리 mock 데이터와는 조금 다르게 될 것 같습니다!

그리고 mock 데이터는 컴포넌트를 활용하는 페이지단에서 적용이 되기 때문에, 현재 PR 코드에서는 수정할 부분이 없습니다 ㅎㅎ 페이지단에서 데이터 적용을 하게 된다면 이런 형식으로 하게 되겠네요~!

categories={articleInfo.map((item) => item.category)}

리뷰 뭐든 다 조씁니다!! 부탁드립니다!!!

너무 잘 구현하셔서 깜짝 놀랐습니다😯
함수 정의와 코드 지워달라는 부분만 해주시면 완벽한 것 같습니다~!

Comment on lines 8 to 16
<Chip
label={label}
color="primary"
sx={{
color: '#000000',
display: 'flex',
alignItems: 'center',
}}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

이렇게 두신 거 좋습니다~~
잘 수정하셨는데요!👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

헤헤

categories: string[];
}

const Headline: React.FC<HeadlineProps> = ({ title, uploadDate, viewCount, source, categories }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

React.FC는 children을 암시적으로 가지고 있으며 타입스크립트의 제네릭 문법을 지원하지 않는 등의 단점으로 인해 사용을 지양하고 있습니다!
따라서 저희가 쓰기로 한 함수 정의 방법 그대로 써주시면 좋을 것 같습니다~!

const Headline = ({ title, uploadDate, viewCount, source, categories }: HeadlineProps) => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

헛 넵넵~!! 수정하고 알려드리겠심다!

const Headline: React.FC<HeadlineProps> = ({ title, uploadDate, viewCount, source, categories }) => {
return (
<Box>
<Typography variant="h1" sx={{ fontSize: '2rem', fontWeight: 'bold', marginBottom: '1rem' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

나중에 폰트 사이즈도 따로 지정해야겠네요~
일단은 이렇게 둡시다! 굿이에용!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

조씁니다!

import Chip from '@mui/material/Chip';
import { useTheme } from '@mui/material/styles';

const TagChip = ({ label }: { label: string }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Prop이 하나일 때는 따로 interface를 정의하지 말고 지금 작성하신 코드처럼 이렇게 쓰는 걸로 하죠!
interface를 쓰면 괜히 코드만 더 길어지는 기분..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오케이이이

@@ -0,0 +1,20 @@
import Chip from '@mui/material/Chip';
import { useTheme } from '@mui/material/styles';
Copy link
Contributor

Choose a reason for hiding this comment

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

이 코드는 질문해주신 부분을 올바르게 수정하시면서 실질적 쓰임이 없어졌기에 지워주시면 될 것 같아요~!

import { useTheme } from '@mui/material/styles';

const TagChip = ({ label }: { label: string }) => {
const theme = useTheme();
Copy link
Contributor

Choose a reason for hiding this comment

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

마찬가지로 이 코드도 지워주시면 됩니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵!!

Copy link

vercel bot commented Jul 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gyeongdan-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2024 6:13pm

const Headline = ({ title, uploadDate, viewCount, source }: HeadlineProps) => {
return (
<Box>
<Typography sx={{ fontSize: '2rem', fontWeight: 'bold', marginBottom: '1rem' }} variant="h1">
Copy link
Contributor

Choose a reason for hiding this comment

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

저희 일단은 반응형 없이 고정된 값으로 구현하고 있어서 rem으로 안 쓰셔도 될 것 같습니다!! 그리고 variant="h1"을 하면 이미 fontSize와 fontWeight가 피그마값대로 고정되어 있으니 아래와 같이 모두 없애도 될 것 같습니다!

<Typography mb={1} variant="h1">

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네넹!!

Comment on lines 16 to 20
<Box sx={{ display: 'flex', alignItems: 'center', marginBottom: '1rem' }}>
<Typography sx={{ marginRight: '0.5rem' }} variant="body1">
{uploadDate} | 조회 {viewCount}회 | {source}
</Typography>
</Box>
Copy link
Contributor

Choose a reason for hiding this comment

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

사실 Box로 flex를 써도 무방하지만, MUI에 FlexBox인 Stack이란 컴포넌트가 있더라구요! 그래서 flex를 사용하실 땐 Stack으로 사용하면 더 편하게 구현하실 수 있을 것 같아요!!
또한 Typography에서 marginRight를 주어서 뒤에 쓰이는 게 없기 때문에 빼주셔도 될 것 같습니다! 나중에 TagChip을 연결할 때 고려하는 게 좋을 것 같아요!
피그마에서 폰트 사이즈를 볼 때 variant도 h4를 써주시면 좋을 것 같아요!

      <Stack alignItems="center" direction="row">
        <Typography variant="h4">
          {uploadDate} | 조회 {viewCount}회 | {source}
        </Typography>
      </Stack>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

와우... 대박!!! 거의 뜯어고쳐주셨네요 ㄷㄷ... 앞으로는 Flex 쓸 때는 Stack!!

Comment on lines 12 to 13
display: 'flex',
alignItems: 'center',
Copy link
Contributor

Choose a reason for hiding this comment

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

이미 Chip 컴포넌트 자체적으로 구현이 다 되어있기에 display와 alignItems 속성은 없애주셔도 될 것 같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아!! 맞네 오키욐!!

Copy link
Contributor

Choose a reason for hiding this comment

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

저도 색상 하나를 추가했어서 아마 이 파일에서 충돌이 일어날텐데, 풀 받아서 잘 해결해주세용!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오키오키!!

Copy link
Contributor

@yeonddori yeonddori left a comment

Choose a reason for hiding this comment

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

giphy
굿이에용

@stopmin stopmin merged commit f19a259 into main Jul 15, 2024
3 checks passed
@stopmin stopmin deleted the feature/ISSUE-9 branch July 15, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

기사의 제목(헤드라인)을 표시하는 부분 생성
2 participants