From 3aeb8189f058f5e6f959572faae792dac078502f Mon Sep 17 00:00:00 2001 From: 0hee0 Date: Wed, 1 Jun 2022 20:56:41 +0900 Subject: [PATCH] [#48] feat: change data structure & update style --- react-native/components/SearchedNotice.tsx | 43 +++++++------ react-native/screens/SearchResultScreen.tsx | 4 +- react-native/screens/SearchScreen.tsx | 67 ++++++++------------- react-native/types.ts | 2 +- 4 files changed, 48 insertions(+), 68 deletions(-) diff --git a/react-native/components/SearchedNotice.tsx b/react-native/components/SearchedNotice.tsx index e06b031..88902e8 100644 --- a/react-native/components/SearchedNotice.tsx +++ b/react-native/components/SearchedNotice.tsx @@ -48,9 +48,9 @@ export default function SearchedNotice(props: Notices) { return ( - Saved on {props?.date.replaceAll("-", ". ")} + Saved on {props?.date.replaceAll("-", ". ")} - + {props?.saved?.map((child, index) => - {i18n.t('title')} {user.uchildren && - {user.uchildren.filter(uchild => uchild.cid === child.cid)[0]?.cname} - uchild.cid === child.cid)[0]?.cprofileImg-1]} /> + uchild.cid === child.cid)[0]?.cprofileImg-1]} /> + + {user.uchildren.filter(uchild => uchild.cid === child.cid)[0]?.cname} + {child?.title} + } - - {child?.titles?.map((title, tIndex) => - {(tIndex + 1) + ". " + title} - )} + )} @@ -83,8 +82,7 @@ const styles = StyleSheet.create({ backgroundColor: theme.colors.primary, width: '100%', marginVertical: 8, - paddingVertical: 20, - paddingHorizontal: 28, + padding: 20, borderRadius: 16, shadowColor: "#acacac", shadowOpacity: 0.2, @@ -96,7 +94,9 @@ const styles = StyleSheet.create({ }, headerContainer: { flexDirection: "row", - paddingBottom: 20, + paddingBottom: 12, + justifyContent: "flex-end", + width: "100%" }, date: { fontFamily: 'Lora_700Bold', @@ -109,26 +109,25 @@ const styles = StyleSheet.create({ childNotice: { backgroundColor: "#fff", borderRadius: 16, - padding: 16, + padding: 12, shadowColor: "#acacac", shadowOpacity: 0.4, shadowRadius: 8, shadowOffset: { - height: 0, - width: 0, + height: 2, + width: 2, } }, cprofile: { - alignItems: "center", + alignItems: "flex-start", + width: "90%" }, - cprofileImageLg: { - width: 32, - height: 32, - marginLeft: 8 + cprofileImage: { + width: 28, + height: 28, + marginRight: 10 }, noticeHeader: { - alignItems: "center", - justifyContent: "space-between", paddingBottom: 6 } }) diff --git a/react-native/screens/SearchResultScreen.tsx b/react-native/screens/SearchResultScreen.tsx index 801a9c8..cfd169d 100644 --- a/react-native/screens/SearchResultScreen.tsx +++ b/react-native/screens/SearchResultScreen.tsx @@ -14,7 +14,7 @@ interface SearchResultScreenProps { name: string, params: { date: string, - cid: number + nid: number }, path: string | undefined, } @@ -55,7 +55,7 @@ export default function SearchResultScreen(props: SearchResultScreenProps) { }) if (auth?.authData?.access_token) { - fetch(`http://localhost:8080/search/detail?date=${props.route.params.date}&cid=${props.route.params.cid}`, { + fetch(`http://localhost:8080/search/detail?nid=${props.route.params.nid}`, { method: 'GET', headers: { 'ACCESS-TOKEN': auth.authData.access_token diff --git a/react-native/screens/SearchScreen.tsx b/react-native/screens/SearchScreen.tsx index 1b6eda7..17cd122 100644 --- a/react-native/screens/SearchScreen.tsx +++ b/react-native/screens/SearchScreen.tsx @@ -31,31 +31,15 @@ export default function SearchScreen({ navigation }: Navigation) { { date: "2022-02-19", saved: [ - { - cid: 1, - titles: [ - "17th Graduation Ceremony", - "School Day", - ] - }, - { - cid: 2, - titles: [ - "Opening Ceremony", - ] - } + { nid: 1, cid: 1, title: "17th Graduation Ceremony" }, + { nid: 3, cid: 2, title: "School Day and school day and school day" }, ] }, { date: "2022-02-15", saved: [ - { - cid: 1, - titles: [ - "17th Graduation Ceremony", - "School Day", - ] - } + { nid: 4, cid: 1, title: "17th Graduation Ceremony" }, + { nid: 2, cid: 1, title: "Opening Ceremony" }, ] }, ] @@ -65,31 +49,15 @@ export default function SearchScreen({ navigation }: Navigation) { { date: "2022-02-19", saved: [ - { - cid: 1, - titles: [ - "17th Graduation Ceremony", - "School Day", - ] - }, - { - cid: 2, - titles: [ - "Opening Ceremony", - ] - } + { nid: 1, cid: 1, title: "17th Graduation Ceremony" }, + { nid: 2, cid: 1, title: "School Day" }, + { nid: 3, cid: 2, title: "Opening Ceremony" }, ] }, { date: "2022-02-15", saved: [ - { - cid: 1, - titles: [ - "17th Graduation Ceremony", - "School Day", - ] - } + { nid: 1, cid: 1, title: "17th Graduation Ceremony" } ] }, ]) @@ -158,7 +126,7 @@ export default function SearchScreen({ navigation }: Navigation) { const newData = notices?.filter((notice) => { let flag = false; notice?.saved?.filter((item) => { - const noticeData = item.titles?.join().toUpperCase(); + const noticeData = item.title?.toUpperCase(); const textData = text.toUpperCase(); if (noticeData.indexOf(textData) > -1) { flag = true; @@ -211,7 +179,6 @@ export default function SearchScreen({ navigation }: Navigation) { onClear={() => searchFilter('')} placeholder="Search" value={search} - inputStyle={{ borderBottomColor: "#dddddd", borderBottomWidth: 1 }} /> @@ -282,7 +249,21 @@ const styles = StyleSheet.create({ }, searchWrapper: { alignItems: 'center', - paddingRight: 12 + height: 40, + paddingRight: 12, + marginHorizontal: 12, + marginBottom: 16, + backgroundColor: "#fff", + borderRadius: 16, + borderColor: theme.colors.gray, + borderWidth: 1, + shadowColor: "#acacac", + shadowOpacity: 0.2, + shadowRadius: 8, + shadowOffset: { + height: 0, + width: 0, + } }, searchResults: { width: '100%', diff --git a/react-native/types.ts b/react-native/types.ts index 19d2fc3..d1b9957 100644 --- a/react-native/types.ts +++ b/react-native/types.ts @@ -93,7 +93,7 @@ interface Notice { interface Notices { date: string, - saved: { cid: number, titles: string[] }[] + saved: { nid: number, cid: number, title: string }[] } interface BottomDrawerProps {