-
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
✨ #85 홈피드 구현 및 플레이리스트 타입 정리 #122
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1658c97
✨ 썸네일, 유저정보 컴포넌트 추가
seoyoonyi 6c3ac1e
✨ 파일 이동
seoyoonyi ec47d49
📝 #85 스타일 수정
seoyoonyi 9fc37fe
🔨 #85 플레이리스트 관련 api 및 타입정의 수정
seoyoonyi d8928e0
✨ #85 홈피드 구현 및 플레이리스트 타입 정리
seoyoonyi a3b6939
☠️ nav컴포넌트 클릭하는 영역 확장
seoyoonyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/components/LikeButton.tsx → src/components/common/Button/LikeButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react' | ||
import styled from '@emotion/styled' | ||
import defaultThumbnail from '@/assets/default-thumbnail.png' | ||
|
||
type ImageGridSize = 'small' | 'large' | ||
|
||
interface ImageGridProps { | ||
thumbnails: string[] | ||
size?: ImageGridSize | ||
} | ||
|
||
const ImageGrid: React.FC<ImageGridProps> = ({ thumbnails, size = 'small' }) => { | ||
const displayThumbnails = [...thumbnails] | ||
if (thumbnails.length === 3) { | ||
displayThumbnails.push(defaultThumbnail) | ||
} | ||
|
||
return ( | ||
<Container count={displayThumbnails.length} size={size}> | ||
{displayThumbnails.map((thumbnail, index) => ( | ||
<div className="image-container" key={index}> | ||
<img src={thumbnail} alt={`Thumbnail ${index + 1}`} /> | ||
</div> | ||
))} | ||
</Container> | ||
) | ||
} | ||
|
||
export default ImageGrid | ||
|
||
const sizeStyles = { | ||
small: '70px', | ||
large: '52px', | ||
} | ||
|
||
const Container = styled.div<{ count: number; size: ImageGridSize }>` | ||
position: relative; | ||
width: ${({ size }) => sizeStyles[size]}; | ||
height: ${({ size }) => sizeStyles[size]}; | ||
aspect-ratio: 1 / 1; | ||
display: grid; | ||
grid-template-columns: repeat(${(props) => Math.min(props.count, 2)}, 1fr); | ||
border-radius: 10px; | ||
overflow: hidden; | ||
|
||
.play-button { | ||
z-index: 2; | ||
position: absolute; | ||
bottom: 15px; | ||
left: 10px; | ||
width: 45px; | ||
height: 45px; | ||
background-color: rgba(128, 128, 128, 0.5); | ||
border-radius: 50%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
.triangle { | ||
width: 0; | ||
height: 0; | ||
border-left: 10px solid white; | ||
border-top: 6px solid transparent; | ||
border-bottom: 6px solid transparent; | ||
} | ||
} | ||
|
||
.image-container { | ||
position: relative; | ||
width: 100%; | ||
padding-top: 100%; | ||
|
||
img { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from 'react' | ||
import styled from '@emotion/styled' | ||
import defaultThumbnail from '@/assets/default-thumbnail.png' | ||
|
||
interface PlaylistThumbnailFeedProps { | ||
thumbnails: string[] | ||
} | ||
|
||
const PlaylistThumbnailFeed: React.FC<PlaylistThumbnailFeedProps> = ({ thumbnails = [] }) => { | ||
const displayThumbnails = [...thumbnails] | ||
if (thumbnails.length === 3) { | ||
displayThumbnails.push(defaultThumbnail) | ||
} | ||
|
||
return ( | ||
<Container count={displayThumbnails.length}> | ||
<div className="play-button"> | ||
<div className="triangle"></div> | ||
</div> | ||
{displayThumbnails.map((thumbnail, index) => ( | ||
<div className="image-container" key={index}> | ||
<img src={thumbnail} alt={`Thumbnail ${index + 1}`} /> | ||
</div> | ||
))} | ||
</Container> | ||
) | ||
} | ||
|
||
export default PlaylistThumbnailFeed | ||
|
||
const Container = styled.div<{ count: number }>` | ||
position: relative; | ||
width: 100%; | ||
aspect-ratio: 1 / 1; | ||
display: grid; | ||
grid-template-columns: repeat(${(props) => Math.min(props.count, 2)}, 1fr); | ||
border-radius: 10px; | ||
overflow: hidden; | ||
|
||
.play-button { | ||
z-index: 2; | ||
position: absolute; | ||
bottom: 15px; | ||
left: 10px; | ||
width: 45px; | ||
height: 45px; | ||
background-color: rgba(128, 128, 128, 0.5); | ||
border-radius: 50%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
.triangle { | ||
width: 0; | ||
height: 0; | ||
border-left: 10px solid white; | ||
border-top: 6px solid transparent; | ||
border-bottom: 6px solid transparent; | ||
} | ||
} | ||
|
||
.image-container { | ||
position: relative; | ||
width: 100%; | ||
padding-top: 100%; | ||
|
||
img { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
} | ||
} | ||
` |
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
suggestion: 세 개의 썸네일을 처리하는 접근 방식을 재고하세요
정확히 세 개의 썸네일이 있을 때 기본 썸네일을 추가하는 것은 임의로 보입니다. 썸네일 수에 따라 그리드 레이아웃을 조정하거나 이 경우 사용자 정의 동작을 위한 prop을 허용하는 등 더 유연한 접근 방식을 고려하세요.
Original comment in English
suggestion: Reconsider the approach for handling three thumbnails
Adding a default thumbnail when there are exactly three thumbnails seems arbitrary. Consider a more flexible approach, such as adjusting the grid layout based on the number of thumbnails, or allowing the component to accept a prop for custom behavior in this case.