recentlyBookedScrollView.tsx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import { View, Text, ScrollView } from 'react-native';
  2. import React from 'react';
  3. import NormalButton from './normal_button';
  4. import Svg, { Path } from 'react-native-svg';
  5. import { BookingIconSvg } from './SVG';
  6. const RecentBookedRowItemsData = [
  7. { chargingStationName: '充電站#1', chargingStationAddress: '充電站#1地址' },
  8. { chargingStationName: '充電站#2', chargingStationAddress: '充電站#2地址' },
  9. { chargingStationName: '充電站#3', chargingStationAddress: '充電站#3地址' },
  10. { chargingStationName: '充電站#4', chargingStationAddress: '充電站#4地址' },
  11. { chargingStationName: '充電站#5', chargingStationAddress: '充電站#5地址' },
  12. { chargingStationName: '充電站#6', chargingStationAddress: '充電站#6地址' },
  13. { chargingStationName: '充電站#7', chargingStationAddress: '充電站#7地址' },
  14. { chargingStationName: '充電站#8', chargingStationAddress: '充電站#8地址' }
  15. ];
  16. const RecentBookedRowItems = ({
  17. chargingStationName,
  18. chargingStationAddress
  19. }: {
  20. chargingStationName: string;
  21. chargingStationAddress: string;
  22. }) => (
  23. <View
  24. style={{
  25. flexDirection: 'row',
  26. alignItems: 'center'
  27. }}
  28. >
  29. <BookingIconSvg />
  30. <View
  31. style={{
  32. flexDirection: 'row',
  33. justifyContent: 'space-between',
  34. flex: 1,
  35. borderBottomWidth: 0.5,
  36. paddingVertical: 15,
  37. borderColor: '#ccc',
  38. borderRadius: 8
  39. }}
  40. >
  41. <View
  42. style={{
  43. marginLeft: 15,
  44. gap: 3
  45. }}
  46. >
  47. <Text
  48. style={{
  49. fontSize: 16,
  50. color: '#222222'
  51. }}
  52. >
  53. {chargingStationName}
  54. </Text>
  55. <Text
  56. style={{
  57. fontSize: 16,
  58. color: '#888888'
  59. }}
  60. >
  61. {chargingStationAddress}
  62. </Text>
  63. </View>
  64. <NormalButton
  65. title={<Text style={{ color: '#061E25' }}>重新預約</Text>}
  66. onPress={() => console.log('abc')}
  67. buttonPressedStyle={{
  68. backgroundColor: '#CFDEE4'
  69. }}
  70. extendedStyle={{
  71. backgroundColor: '#E3F2F8',
  72. paddingHorizontal: 25,
  73. paddingVertical: 1,
  74. borderRadius: 8
  75. }}
  76. />
  77. </View>
  78. </View>
  79. );
  80. const RecentlyBookedScrollView = () => {
  81. return (
  82. <View className="py-6 flex-column">
  83. <Text
  84. style={{
  85. fontWeight: 400,
  86. fontSize: 16,
  87. color: '#222222',
  88. marginBottom: '5%'
  89. }}
  90. >
  91. 近期預約過
  92. </Text>
  93. <View className="h-[25vh]">
  94. <ScrollView nestedScrollEnabled={true}>
  95. {RecentBookedRowItemsData.map((item) => (
  96. <RecentBookedRowItems
  97. key={`${item.chargingStationName}+${item.chargingStationAddress}`}
  98. chargingStationName={item.chargingStationName}
  99. chargingStationAddress={item.chargingStationAddress}
  100. />
  101. ))}
  102. </ScrollView>
  103. </View>
  104. </View>
  105. );
  106. };
  107. export default RecentlyBookedScrollView;