Skip to content

Commit

Permalink
Merge pull request #50 from dnd-side-project/feature/20
Browse files Browse the repository at this point in the history
[#20] 4장 미리보기 FeedCard 컴포넌트 추가 & 반응형 디자인 수정
  • Loading branch information
vgihan authored Jul 30, 2022
2 parents 4b39995 + f149605 commit 73c9d03
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/RecommendFeedCard/RecommendFeedCard.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import {StyleSheet} from 'react-native';
import {heightPercentage, widthPercentage} from 'src/styles/ScreenResponse';

export const FeedCardContainer = styled.View({
width: widthPercentage(164),
width: widthPercentage(166),
height: heightPercentage(220),
borderRadius: 12,
backgroundColor: '#F6F6F6',
marginHorizontal: widthPercentage(5.5),
marginVertical: heightPercentage(16),
});

export const IconContainer = styled.View({
Expand All @@ -23,6 +24,7 @@ export const IconContainer = styled.View({

export const styles = StyleSheet.create({
photoStyle: {
borderRadius: 12,
flex: 1,
zIndex: 2,
},
Expand Down
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),
});
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;
2 changes: 2 additions & 0 deletions src/components/RecommendPreviewFourCard/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import RecommendPreviewFourCard from './RecommendPreviewFourCard';
export default RecommendPreviewFourCard;

0 comments on commit 73c9d03

Please sign in to comment.