-
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.
* Updated Directory, Tree Search & Filter * Styled Filter component. * Added functional checkboxes and filtering. * Fixed SVG typing. --------- Co-authored-by: Chris Torres <[email protected]> Co-authored-by: Chris Torres <[email protected]>
- Loading branch information
1 parent
f461657
commit aa3fa6d
Showing
48 changed files
with
4,973 additions
and
622 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
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,21 @@ | ||
import React from 'react'; | ||
import { TouchableOpacity, View } from 'react-native'; | ||
import { styles } from './styles'; | ||
|
||
type CheckboxProps = { | ||
value: boolean; | ||
onValueChange: () => void; | ||
}; | ||
|
||
const Checkbox: React.FC<CheckboxProps> = ({ value, onValueChange }) => { | ||
return ( | ||
<TouchableOpacity | ||
onPress={onValueChange} | ||
style={[styles.checkbox, value && styles.checkboxChecked]} | ||
> | ||
{value && <View style={styles.checkmark} />} | ||
</TouchableOpacity> | ||
); | ||
}; | ||
|
||
export default Checkbox; |
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,29 @@ | ||
import { StyleSheet } from 'react-native'; | ||
import colors from '@/styles/colors'; | ||
|
||
export const styles = StyleSheet.create({ | ||
checkbox: { | ||
width: 20, | ||
height: 20, | ||
backgroundColor: colors.gray5, | ||
borderRadius: 5, | ||
borderWidth: 0, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
|
||
checkboxChecked: { | ||
backgroundColor: colors.secondary, | ||
borderColor: colors.primary, | ||
borderWidth: 1, | ||
}, | ||
|
||
checkmark: { | ||
width: 12, | ||
height: 6, | ||
borderLeftWidth: 2, | ||
borderBottomWidth: 2, | ||
borderColor: colors.primary, | ||
transform: [{ rotate: '315deg' }], | ||
}, | ||
}); |
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
This file was deleted.
Oops, something went wrong.
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,66 @@ | ||
import React, { useState } from 'react'; | ||
import { TextInput, TouchableOpacity, View } from 'react-native'; | ||
import TreeFilterModal from '@/components/TreeFilter/TreeFilter'; | ||
import Search from '@/icons/Search'; | ||
import Filter from '@/icons/Sort'; | ||
import { styles } from './styles'; | ||
|
||
type SearchBarProps = { | ||
value: string; | ||
onChange: (text: string) => void; | ||
filters: { | ||
height: string[]; | ||
shape: string; | ||
fruit: string[]; | ||
water: string[]; | ||
other: string[]; | ||
}; | ||
setFilters: React.Dispatch< | ||
React.SetStateAction<{ | ||
height: string[]; | ||
shape: string; | ||
fruit: string[]; | ||
water: string[]; | ||
other: string[]; | ||
}> | ||
>; | ||
}; | ||
|
||
const SearchBar: React.FC<SearchBarProps> = ({ | ||
value, | ||
onChange, | ||
filters, | ||
setFilters, | ||
}) => { | ||
const [modalVisible, setModalVisible] = useState(false); | ||
|
||
const openModal = () => setModalVisible(true); | ||
const closeModal = () => setModalVisible(false); | ||
|
||
return ( | ||
<View style={styles.searchContainer}> | ||
<View style={styles.inputContainer}> | ||
<Search /> | ||
<TextInput | ||
style={styles.searchBarInput} | ||
placeholder="Find a species..." | ||
value={value} | ||
onChangeText={onChange} | ||
/> | ||
<TouchableOpacity onPress={openModal}> | ||
<View style={styles.filterIconContainer}> | ||
<Filter /> | ||
</View> | ||
</TouchableOpacity> | ||
<TreeFilterModal | ||
visible={modalVisible} | ||
onClose={closeModal} | ||
filters={filters} | ||
setFilters={setFilters} | ||
/> | ||
</View> | ||
</View> | ||
); | ||
}; | ||
|
||
export default SearchBar; |
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,53 @@ | ||
import { StyleSheet } from 'react-native'; | ||
import colors from '@/styles/colors'; | ||
import typography from '@/styles/typography'; | ||
|
||
export const styles = StyleSheet.create({ | ||
searchContainer: { | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
borderBottomWidth: 1, | ||
borderBottomColor: colors.gray5, | ||
paddingTop: 5, | ||
paddingBottom: 20, | ||
paddingHorizontal: 24, | ||
}, | ||
|
||
searchBarInput: { | ||
...typography.normalRegular, | ||
color: colors.gray3, | ||
flex: 1, | ||
height: 42, | ||
borderWidth: 1, | ||
borderRadius: 30, | ||
paddingHorizontal: 10, | ||
borderColor: colors.gray6, | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
backgroundColor: 'transparent', | ||
}, | ||
|
||
inputContainer: { | ||
flex: 1, | ||
height: 42, | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
width: '100%', | ||
position: 'relative', | ||
borderColor: colors.gray6, | ||
backgroundColor: colors.gray6, | ||
borderRadius: 30, | ||
paddingHorizontal: 10, | ||
}, | ||
|
||
filterIconContainer: { | ||
width: 32, | ||
height: 32, | ||
borderRadius: 16, | ||
backgroundColor: colors.white, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
}); | ||
|
||
export default styles; |
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
Oops, something went wrong.