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

Week03/chaeyeon #15

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Week03/chaeyeon #15

wants to merge 23 commits into from

Conversation

qkrcodus
Copy link
Contributor

@qkrcodus qkrcodus commented May 27, 2024

✨어떤 과제를 수행했나요?✨

스크린샷 2024-05-27 154330

✨어려웠던점, 트러블슈팅✨

  1. Sidebar 컴포넌트를 만들고 넣어주었는데 서버에서 인식이 안됐다. => 문법 점검
    프로그래밍 언어가 아닌 html과 달리 jsx의 문법 (모든 태그는 닫혀 있어야함, 부모 요소로 묶여야 함, class 대신 className,{} 사용)등을 지켜줘야 컴파일 에러가 나지 않아 성공적으로 컴포넌트를 렌더링 할 수 있다.

  2. Sidebar div 박스 hover시 스크롤이 생기고 그 div안에서만 움직이는 스크롤이 되게 하고 싶었다.=>Sidebar 컴포넌트는 fixed,botton:0으로 해주고 안의 요소들을 담은 div박스는 sticky로 해주었다.

  3. position fixed하면 다른 태그들이 fixed로 설정해둔 애들을 무시하고 겹쳐진다. 그리고 css가 깨진다.=> 다른 요소에 여백을 줘야한다.

정적으로 이미 저장해둔 데이터를 하드코딩해뒀는데 useState 와 useEffect를 이용해서 동적인 데이터를 관리하도록
코드를 바꾸어 보았다 <기능 : 비디오 데이터 관리 가능해지며, 업데이트 될 때마다 컴포넌트가 렌더링된다.>

🤔 아쉬운 점

시간이 부족하여 반응형으로 만들지 못했다. root 설정 못했다. styled-components 이용 못했다.

@SooY2 SooY2 assigned SooY2 and unassigned SooY2 May 27, 2024
Copy link
Member

@SooY2 SooY2 left a comment

Choose a reason for hiding this comment

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

너무너무 잘했습니당 !!! 과제를 넘어서 스스로 새로운 도전하는 모습이 넘 멋쪄..✨ 수고했서💖

추가로 react에서는 단순 css를 지양하는데요, 그 이유는 className이 파일에 관계없이 중복성을 띄기 때문입니다! (파일별로 나눠서 class관리를 해줄 필요가 없는거죠)
각 jsx파일을 위한 css를 주고싶을 땐 module.css를 사용합니다! 관련된 정리 글 남길테니 참고해보세요! module.css

[결론] react에서 스타일링을 주고싶을 땐 styled-components같은 스타일링 라이브러리를 사용하자 !

Comment on lines +98 to +110
<div className="video-item" key={video.id}>
<img src={thumbnail} alt="thumbnail" className="thumbnail" />
<div className="video-info">
<div className='video-title'>
<img src={profile} alt="profile" className="profile" />
<div>
<div>{video.title}</div>
<div>{video.channel}</div>
<div>{video.views} {video.uploaded}</div>
</div>
</div>
</div>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

map함수 사용 좋습니다 !! 요런 컴포넌트의 경우 다른 파일로 빼주는 것도 가독성이 좋을거같아요 !!

Comment on lines +23 to +27
<img src={upload_icon} alt="" />
<img src={more_icon} alt="" />
<img src={notification_icon} alt="" />
<img src={profile_icon} className='user-icon' alt="" />
</div>
Copy link
Member

Choose a reason for hiding this comment

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

alt는... 왜..... 안채워준거죠...ㅠ

Comment on lines +18 to +21
<div className="sidebar-item">
<img src={explore} alt="shorts icon" />
<span>Shorts</span>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

이 부분같은 경우엔 컴포넌트화해서 map돌리는 방법을 추천합니당

Comment on lines +6 to +28
const videoData=[
{
id:1,
title:"1아빠 기다리다 렉걸린 강아지",
channel:"속삭이는 몽자",
views:"조회수 3.8만",
uploaded:"1일전"
},
{
id:2,
title:"2아빠 기다리다 렉걸린 강아지",
channel:"속삭이는 몽자",
views:"조회수 3.8만",
uploaded:"2일전"
},
{
id:3,
title:"3아빠 기다리다 렉걸린 강아지",
channel:"속삭이는 몽자",
views:"조회수 3.8만",
uploaded:"3일전"
},
{
Copy link
Member

Choose a reason for hiding this comment

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

객체 배열같은 경우 constants라는 폴더를 만들어 그 안에 따로 관리해주면 파일관리를 더 잘 할 수 있답니당

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants