searchPage.tsx 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. import { ScrollView, Text, View, StyleSheet, Pressable } from 'react-native';
  2. import NormalInput from '../global/normal_input';
  3. import Svg, { Path } from 'react-native-svg';
  4. import NormalButton from '../global/normal_button';
  5. import { FlashList } from '@shopify/flash-list';
  6. interface BookingHistory {
  7. charingStationName: string;
  8. chargingStationAddress: string;
  9. }
  10. interface SearchPageProps {}
  11. const ArrowIconSvg = () => (
  12. <Svg width="8" height="12" viewBox="0 0 8 12" fill="none">
  13. <Path
  14. d="M0.6 6L6.6 -6.11959e-08L8 1.4L3.4 6L8 10.6L6.6 12L0.6 6Z"
  15. fill="#888888"
  16. />
  17. </Svg>
  18. );
  19. const bookingHistoryData: BookingHistory[] = [
  20. {
  21. charingStationName: '充電站#1',
  22. chargingStationAddress: '充電站地址#1'
  23. },
  24. {
  25. charingStationName: '充電站#2',
  26. chargingStationAddress: '充電站地址#2'
  27. },
  28. {
  29. charingStationName: '充電站#3',
  30. chargingStationAddress: '充電站地址#3'
  31. },
  32. {
  33. charingStationName: '充電站#4',
  34. chargingStationAddress: '充電站地址#4'
  35. }
  36. ];
  37. const SearchPage: React.FC<SearchPageProps> = () => {
  38. return (
  39. <ScrollView className="bg-[#ffffff] flex-1 h-[100vh] px-[5%] pt-[5%] ">
  40. <View className="flex-column gap-4 ">
  41. <View className=" flex-1 flex-row ">
  42. <Pressable
  43. style={styles.leftArrowBackButton}
  44. onPress={() => console.log('Back Button')}
  45. >
  46. <ArrowIconSvg />
  47. </Pressable>
  48. <NormalInput
  49. placeholder="搜尋這裡"
  50. onChangeText={(abc) => console.log(abc)}
  51. extendedStyle={styles.textInput}
  52. />
  53. </View>
  54. <ScrollView
  55. horizontal={true}
  56. className="space-x-4"
  57. showsHorizontalScrollIndicator={false}
  58. >
  59. <View>
  60. <NormalButton
  61. title={
  62. <Text style={{ color: '#061E25' }}>
  63. 附近的充電站
  64. </Text>
  65. }
  66. onPress={() => console.log('附近的充電站')}
  67. buttonPressedStyle={{
  68. backgroundColor: '#CFDEE4'
  69. }}
  70. extendedStyle={{
  71. backgroundColor: '#E3F2F8',
  72. borderRadius: 8,
  73. paddingVertical: 12
  74. }}
  75. />
  76. </View>
  77. <View>
  78. <NormalButton
  79. title={
  80. <Text style={{ color: '#061E25' }}>
  81. 可Walk-in的充電站
  82. </Text>
  83. }
  84. onPress={() => console.log('可Walk-in的充電站')}
  85. buttonPressedStyle={{
  86. backgroundColor: '#CFDEE4'
  87. }}
  88. extendedStyle={{
  89. backgroundColor: '#E3F2F8',
  90. borderRadius: 8,
  91. paddingVertical: 12
  92. }}
  93. />
  94. </View>
  95. <View>
  96. <NormalButton
  97. title={
  98. <Text style={{ color: '#061E25' }}>
  99. Test Tab #1
  100. </Text>
  101. }
  102. onPress={() => console.log('Test Tab #1')}
  103. buttonPressedStyle={{
  104. backgroundColor: '#CFDEE4'
  105. }}
  106. extendedStyle={{
  107. backgroundColor: '#E3F2F8',
  108. borderRadius: 8,
  109. paddingVertical: 12
  110. }}
  111. />
  112. </View>
  113. <View>
  114. <NormalButton
  115. title={
  116. <Text style={{ color: '#061E25' }}>
  117. Test Tab #2
  118. </Text>
  119. }
  120. onPress={() => console.log('Test Tab #2')}
  121. buttonPressedStyle={{
  122. backgroundColor: '#CFDEE4'
  123. }}
  124. extendedStyle={{
  125. backgroundColor: '#E3F2F8',
  126. borderRadius: 8,
  127. paddingVertical: 12
  128. }}
  129. />
  130. </View>
  131. </ScrollView>
  132. <View>
  133. <Text
  134. style={{
  135. fontWeight: 400,
  136. fontSize: 16,
  137. color: '#222222',
  138. paddingTop: 6
  139. }}
  140. >
  141. 預約記錄
  142. </Text>
  143. <FlashList
  144. estimatedItemSize={10}
  145. data={bookingHistoryData}
  146. renderItem={({ item }) => (
  147. <View className="flex-column space-y-1 py-4 border-b border-gray-300">
  148. <Text className="text-base text-[#222222]">
  149. {item.charingStationName}
  150. </Text>
  151. <Text className="text-base text-[#888888]">
  152. {item.chargingStationAddress}
  153. </Text>
  154. </View>
  155. )}
  156. />
  157. </View>
  158. </View>
  159. </ScrollView>
  160. );
  161. };
  162. export default SearchPage;
  163. const styles = StyleSheet.create({
  164. leftArrowBackButton: {
  165. width: '15%',
  166. maxWidth: '100%',
  167. fontSize: 16,
  168. padding: 20,
  169. paddingLeft: 30,
  170. borderBottomLeftRadius: 12,
  171. borderTopLeftRadius: 12,
  172. borderColor: '#bbbbbb',
  173. borderTopWidth: 1,
  174. borderBottomWidth: 1,
  175. borderLeftWidth: 1,
  176. alignItems: 'center',
  177. justifyContent: 'center'
  178. },
  179. textInput: {
  180. width: '85%',
  181. maxWidth: '100%',
  182. fontSize: 16,
  183. padding: 20,
  184. paddingLeft: 0,
  185. borderLeftWidth: 0,
  186. borderTopWidth: 1,
  187. borderBottomWidth: 1,
  188. borderRightWidth: 1,
  189. borderBottomRightRadius: 12,
  190. borderTopRightRadius: 12,
  191. borderRadius: 0,
  192. borderColor: '#bbbbbb'
  193. }
  194. });