-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(community): Community 페이지에서 Refactoring 진행
개요 - fetchPosts를 해서 가져올 때 Promise All 해서 함께 보여줄 수 있도록 변경 - ternary에서 if문으로 바꾸어서 가독성 높임 - 일부 컴포넌트 외부 컴포넌트로 추출: CommunitySection
- Loading branch information
1 parent
e4b794e
commit bc4d9fa
Showing
2 changed files
with
69 additions
and
65 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
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,37 @@ | ||
import React from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import CommunityStyles from "@pages/community/CommunityStyles"; | ||
import IconCommunityTitle from "@components/community/IconCommunityTitle"; | ||
import ItemCommunityPreview from "@components/community/ItemCommunityPreview"; | ||
import { View, Text, TouchableOpacity } from "react-native"; | ||
import ArrowRight from "@components/common/ArrowRight"; | ||
|
||
const CommunitySection = ({ title, postList, onMorePress }) => { | ||
const { t } = useTranslation(); | ||
return ( | ||
<View> | ||
<View style={CommunityStyles.containerCommunityTop}> | ||
<View style={CommunityStyles.containerTitle}> | ||
<IconCommunityTitle style={CommunityStyles.iconCommunity} /> | ||
<Text style={CommunityStyles.textCommunityTitle}> | ||
{t(title)} | ||
</Text> | ||
</View> | ||
<TouchableOpacity | ||
style={CommunityStyles.containerMore} | ||
onPress={onMorePress} | ||
> | ||
<Text style={CommunityStyles.textCommunityMore}> | ||
{t("moreButton")} | ||
</Text> | ||
<ArrowRight style={CommunityStyles.iconArrow} /> | ||
</TouchableOpacity> | ||
</View> | ||
<View style={CommunityStyles.itemCommunityPreview}> | ||
<ItemCommunityPreview postList={postList} /> | ||
</View> | ||
</View> | ||
); | ||
}; | ||
|
||
export default CommunitySection; |