-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from dnd-side-project/feature/20
[#20] 4장 미리보기 FeedCard 컴포넌트 추가 & 반응형 디자인 수정
- Loading branch information
Showing
4 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
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
8 changes: 8 additions & 0 deletions
8
src/components/RecommendPreviewFourCard/RecommendPreviewFourCard.styles.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import styled from '@emotion/native'; | ||
|
||
import {heightPercentage} from 'src/styles/ScreenResponse'; | ||
|
||
export const PreviewFourCardView = styled.View({ | ||
alignSelf: 'center', | ||
height: heightPercentage(472), | ||
}); |
36 changes: 36 additions & 0 deletions
36
src/components/RecommendPreviewFourCard/RecommendPreviewFourCard.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, {useCallback} from 'react'; | ||
import {FlatList} from 'react-native'; | ||
|
||
import RecommendFeedCard from '../RecommendFeedCard'; | ||
import {PreviewFourCardView} from './RecommendPreviewFourCard.styles'; | ||
|
||
interface Props { | ||
data: ReadonlyArray<renderItemList['item']>; | ||
} | ||
|
||
type renderItemList = { | ||
item: { | ||
url: string; | ||
id: string; | ||
title: string; | ||
}; | ||
}; | ||
|
||
const RecommendPreviewFourCard = ({data}: Props) => { | ||
const renderItem = useCallback(({item}: renderItemList) => { | ||
return <RecommendFeedCard imgUrl={item.url} />; | ||
}, []); | ||
return ( | ||
<PreviewFourCardView> | ||
<FlatList | ||
data={data} | ||
numColumns={2} | ||
keyExtractor={o => o.url} | ||
renderItem={renderItem} | ||
scrollEnabled={false} | ||
/> | ||
</PreviewFourCardView> | ||
); | ||
}; | ||
|
||
export default RecommendPreviewFourCard; |
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,2 @@ | ||
import RecommendPreviewFourCard from './RecommendPreviewFourCard'; | ||
export default RecommendPreviewFourCard; |