diff --git a/src/screens/fillingStations/FilingStationSearch.tsx b/src/screens/fillingStations/FilingStationSearch.tsx new file mode 100644 index 0000000..346e657 --- /dev/null +++ b/src/screens/fillingStations/FilingStationSearch.tsx @@ -0,0 +1,118 @@ +import React, {useCallback, useState} from 'react'; +import {CompositeNavigationProp, useNavigation} from '@react-navigation/native'; +import {HomeStackParamList} from '../../navigators/Home'; +import {FlatList, ListRenderItem, StyleSheet, View} from 'react-native'; +import {Colors} from '../../Colors'; +import {Header} from '../../components/Header'; +import {ArrowLeft} from '../../icons/ArrowLeft'; +import {SearchInput} from '../../components/SearchInput'; +import {RootStackParamList} from '../../navigators/Root'; +import {StackNavigationProp} from '@react-navigation/stack'; +import {Pressable} from '../../components/Button/Pressable'; +import {StationRow} from './components/StationRow'; +import {FunnelIcons} from '../../icons/Funnel'; +import {SortModalModal} from './components/SortModal'; +import {useFillingStation} from '../../context/FilingStations'; + +type NavigationProps = CompositeNavigationProp< + StackNavigationProp, + StackNavigationProp +>; + +export const FilingStationSearch = () => { + const {goBack, navigate} = useNavigation(); + const [showSortModal, setShowSortModal] = useState(false); + const {filingStations} = useFillingStation(); + const itemSeparatorComponent = useCallback( + () => , + [], + ); + + const renderItem: ListRenderItem = ({item}) => ( + + navigate('FilingStation', { + id: item.id, + }) + } + /> + ); + + const keyExtractor = useCallback((item: FillingStation) => { + return `fs-Item-${item.id} `; + }, []); + + return ( + <> + +
} + onPressLeft={() => goBack()} + backgroundColor="white" + /> + + {}} + onClose={() => {}} + value={''} + /> + { + setShowSortModal(true); + }} + style={styles.filterButton}> + + + + + + { + setShowSortModal(false); + }} + /> + + ); +}; + +const styles = StyleSheet.create({ + root: { + flex: 1, + backgroundColor: Colors.Primary.White, + }, + searchContainer: { + flexDirection: 'row', + alignContent: 'center', + marginTop: 16, + marginHorizontal: 24, + }, + search: { + marginRight: 16, + }, + list: { + marginTop: 16, + }, + filterButton: { + width: 50, + height: 50, + borderRadius: 25, + backgroundColor: Colors.Label.OffRed, + alignContent: 'center', + alignItems: 'center', + justifyContent: 'center', + }, + + separator: { + height: 16, + }, +}); diff --git a/src/screens/fillingStations/components/SortModal.tsx b/src/screens/fillingStations/components/SortModal.tsx new file mode 100644 index 0000000..cee59d6 --- /dev/null +++ b/src/screens/fillingStations/components/SortModal.tsx @@ -0,0 +1,78 @@ +import React from 'react'; +import {View} from 'react-native'; +import {Colors} from '../../../Colors'; +import {BottomModal} from '../../../components/BottomModal'; +import {Pressable} from '../../../components/Button/Pressable'; +import {FontSize, Text} from '../../../components/Text'; +import {XIcon} from '../../../icons/XIcon'; + +interface SortModalProps { + show: boolean; + onClose: () => void; +} + +export const SortModalModal = ({show, onClose}: SortModalProps) => { + return ( + <> + { + onClose(); + }}> + + + Filter & Sorting + + + + + Distance + Availability + + {}} + style={{ + height: 50, + borderRadius: 25, + backgroundColor: Colors.Label.OffRed, + alignContent: 'center', + alignItems: 'center', + justifyContent: 'center', + }}> + {}} + style={{ + height: 50, + borderRadius: 25, + backgroundColor: Colors.Label.OffRed, + alignContent: 'center', + alignItems: 'center', + justifyContent: 'center', + }}> + + + + + ); +}; diff --git a/src/screens/fillingStations/components/StationRow.tsx b/src/screens/fillingStations/components/StationRow.tsx new file mode 100644 index 0000000..5fa103b --- /dev/null +++ b/src/screens/fillingStations/components/StationRow.tsx @@ -0,0 +1,75 @@ +import React from 'react'; +import {Colors} from '../../../Colors'; +import {StyleSheet, View} from 'react-native'; +import {FontSize, Text} from '../../../components/Text'; +import {StatusTag} from '../../../components/StatusTag'; +import {Pressable} from '../../../components/Button/Pressable'; + +interface StationRowProps { + onPress: () => void; + fs: FillingStation; +} + +export const StationRow = ({onPress, fs}: StationRowProps) => { + return ( + + + + + {fs.stationName} + {fs.address} + + {fs.scheduleDelivery?.scheduledDate && ( + + Estimate Fuel arrival: + + {fs.scheduleDelivery?.scheduledDate} + + + )} + + + + {fs.scheduleDelivery?.queueNumber && ( + + + {fs.scheduleDelivery?.queueNumber} + + on going + + )} + + + + ); +}; + +const styles = StyleSheet.create({ + root: { + backgroundColor: Colors.Secondary.GreyOff, + borderRadius: 16, + paddingVertical: 16, + marginHorizontal: 24, + paddingHorizontal: 8, + }, + subRowContainer: { + flexDirection: 'row', + justifyContent: 'space-between', + }, + leftColumnContainer: { + justifyContent: 'space-between', + flex: 1, + }, + dateContainer: { + flexDirection: 'row', + marginTop: 4, + alignContent: 'center', + alignItems: 'center', + }, + queueContainer: { + alignContent: 'center', + justifyContent: 'center', + alignItems: 'center', + marginTop: 8, + }, +});