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

feature: Card 컴포넌트 구현 #15

Closed
wants to merge 13 commits into from
Closed

feature: Card 컴포넌트 구현 #15

wants to merge 13 commits into from

Conversation

asdf99245
Copy link
Collaborator

👀 What is this PR?

Card 컴포넌트 구현 완-료

📝 Changes

  • next/image를 wrapping한 ImageFrame 컴포넌트 구현 -> 기존에 h-auto w-full object-cover object-center 이거 추가하니깐 중간에 딱 맞게 잘림 👍
  • ImageFrame을 이용해서 Card 컴포넌트 구현
  • next.config.js 에 imageSize, deviceSize 설정을 했는데, 우리는 일단 모바일 크기의 뷰만 고려하기 때문에 큰 디바이스 크기에서의 이미지 srcset size를 next/image가 생성하지 않게 했음

📌 Related issue(s)

📷 Attachment(optional)

image

@github-actions
Copy link

Thanks for the contribution!
I have applied any labels matching special text in your title and description.

Please review the labels and make any necessary changes.

@github-actions github-actions bot added the 🌟 feature new feature label Jul 23, 2023
@github-actions github-actions bot requested a review from bsy1141 July 23, 2023 06:20
export function Card({ thumbnail, title, description, ...restProps }: Props) {
return (
<div className='flex w-full flex-col' {...restProps}>
<ImageFrame src={thumbnail} alt={title} sizes='200px' priority />
Copy link
Collaborator

Choose a reason for hiding this comment

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

우리 근데 사이즈는 200px 고정값인가요?? 그리고 내가 nextjs Image 컴포넌트를 잘 몰라서 그런데 200px이 아니라 187.5px로 설정되네

Copy link
Collaborator Author

@asdf99245 asdf99245 Jul 23, 2023

Choose a reason for hiding this comment

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

아하 고것은 그 width 길이가 아니라 next/image에서 image를 다운로드할 때 현재 viewport에 따라 크기를 정해서 다운받는데 저거 명시안해주면 default 100vw로 다운로드 한다(예를들어 1920이 vw면 너비가 1920인 사진을 다운받음)해서 200px로 일단 고정했쓰 -> 187.5로 지정해도 되긴한데 뭔가 딱 맞아떨어졌으면 좋겠어서 일단 200px로 해뒀어

https://nextjs.org/docs/pages/api-reference/components/image#sizes 요 속성임 !

근데 저거 ImageFrame내에서 default 200으로 해놔서 명시안해줘도 되는데 해놓았네 빼야겠다

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

일단 우리 가로 고정 길이 475px인거 같아서 sizes 475px로 고정했어 -> 많이 찾아보긴했는데 이렇게 쓰는게 맞는지 모르겠다.. 나중에 문제 생기면 다시 수정해봐야겠어

@bsy1141
Copy link
Collaborator

bsy1141 commented Jul 28, 2023

ㅠㅠㅠ 이거 이제 안쓰니까 합칠 필요가 없겠지..?? 고생했는데 윤규

@asdf99245
Copy link
Collaborator Author

안돼~ 눈물 😢

@asdf99245 asdf99245 closed this Jul 30, 2023
@asdf99245 asdf99245 deleted the feature/card branch July 30, 2023 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌟 feature new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: 카드 컴포넌트 구현
2 participants