Skip to content

Commit

Permalink
styling done
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos Hernandez committed Nov 21, 2023
1 parent 8edcaf4 commit 8f23328
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
13 changes: 6 additions & 7 deletions src/app/(tabs)/search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function SearchScreen() {
const searchFunction = (text: string) => {
if (text === '') {
setSearch(text);
setSearchResults(allStories);
setSearchResults([]);
return;
}
const updatedData = allStories.filter((item: StoryPreview) => {
Expand Down Expand Up @@ -124,21 +124,20 @@ function SearchScreen() {
onPress={() => setFilterVisible(true)}
/>
{search ? (
<Text>Showing Results {searchResults.length}</Text>
<Text style={styles.searchText}>
Showing Results {searchResults.length}
</Text>
) : (
<>
<View
style={{ justifyContent: 'space-between', flexDirection: 'row' }}
>
<Text>Recent Searches</Text>
<View style={styles.recentSpacing}>
<Text style={styles.searchText}>Recent Searches</Text>
<Button
onPress={clearRecentSearches}
title="Clear All"
color="#EB563B"
/>
</View>
<FlatList
style={{ paddingBottom: 200 }}
showsVerticalScrollIndicator={false}
data={recentSearches}
renderItem={({ item }) => (
Expand Down
10 changes: 10 additions & 0 deletions src/app/(tabs)/search/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ const styles = StyleSheet.create({
width,
height,
},
recentSpacing: {
justifyContent: 'space-between',
flexDirection: 'row',
alignContent: 'space-between',
},
searchText: {
fontWeight: '300',
fontSize: 20,
paddingTop: 5,
},
});

export default styles;
4 changes: 3 additions & 1 deletion src/components/RecentSearchCard/RecentSearchCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ function RecentSearchCard({
return (
<Pressable onPress={pressFunction}>
<View style={styles.card}>
<View style={styles.textContainer}>
<View style={styles.leftItems}>
<Icon name="search1" size={16} color="#A7A5A5" />
<Text style={styles.searchValueText}>{value}</Text>
</View>
<View style={styles.rightItems}>
<Text style={styles.numResultsText}>{numResults} Results</Text>
<Icon name="caretright" size={12} color="black" />
</View>
Expand Down
27 changes: 18 additions & 9 deletions src/components/RecentSearchCard/styles.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
import { StyleSheet } from 'react-native';

import colors from '../../styles/colors';

const styles = StyleSheet.create({
card: {
flexDirection: 'row',
justifyContent: 'flex-start',
justifyContent: 'space-between',
alignItems: 'center',
backgroundColor: colors.lightGrey,
backgroundColor: 'white',
borderRadius: 4,
marginBottom: 16,
marginTop: 8,
marginBottom: 8,
maxHeight: 100,
paddingLeft: 12,
paddingRight: 12,
paddingBottom: 4,
paddingTop: 4,
paddingBottom: 10,
paddingTop: 10,
shadowColor: 'black',
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.5,
elevation: 4,
},
textContainer: {
leftItems: {
gap: 8,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
rightItems: {
gap: 10,
flexDirection: 'row',
alignItems: 'center',
},
searchValueText: {
color: 'black',
Expand Down

0 comments on commit 8f23328

Please sign in to comment.