index.tsx 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. import React from 'react';
  2. import {
  3. View,
  4. Text,
  5. TouchableOpacity,
  6. ScrollView,
  7. StyleSheet,
  8. Alert,
  9. Dimensions,
  10. } from 'react-native';
  11. import Svg, { Path } from 'react-native-svg';
  12. import { useTheme } from '@/theme';
  13. import { SafeScreen } from '@/components/templates';
  14. import { RootScreenProps } from '@/navigation/types';
  15. import { Paths } from '@/navigation/paths';
  16. const { width } = Dimensions.get('window');
  17. // CheckIcon Component
  18. const CheckIcon = () => (
  19. <Svg width={24} height={24} viewBox="0 0 24 24" fill="none" stroke="#10B981">
  20. <Path
  21. strokeLinecap="round"
  22. strokeLinejoin="round"
  23. strokeWidth={2}
  24. d="M5 13l4 4L19 7"
  25. />
  26. </Svg>
  27. );
  28. const SubList = ({ navigation }: RootScreenProps<Paths.SubList>) => {
  29. const { colors, layout, gutters, fonts } = useTheme();
  30. // 处理免费试用按钮点击
  31. const handleFreeTrial = () => {
  32. Alert.alert('成功', '开始7天免费试用');
  33. };
  34. // 处理高级套餐按钮点击
  35. const handlePremium = () => {
  36. Alert.alert('提示', '正在跳转到支付页面...');
  37. };
  38. return (
  39. <SafeScreen style={styles.pageBgColor} navigation={navigation}>
  40. <ScrollView style={styles.container}>
  41. <View style={styles.content}>
  42. {/* 页面标题区域 */}
  43. <View style={styles.headerSection}>
  44. <Text style={[styles.mainTitle, fonts.bold]}>Choose Your Plan</Text>
  45. <Text style={styles.subtitle}>
  46. Unlock premium features with our flexible{'\n'}subscription
  47. options
  48. </Text>
  49. </View>
  50. {/* 7天免费试用卡片 */}
  51. <View style={[styles.card, gutters.marginBottom_24]}>
  52. {/* 卡片头部 */}
  53. <View style={styles.cardHeaderLight}>
  54. <Text style={[styles.cardHeaderTitle, fonts.bold]}>
  55. 7-Day Free Trial
  56. </Text>
  57. </View>
  58. {/* 卡片内容 */}
  59. <View style={styles.cardBody}>
  60. {/* 价格 */}
  61. <View style={styles.priceSection}>
  62. <Text style={[styles.priceAmount, fonts.bold]}>$0</Text>
  63. <Text style={styles.pricePeriod}> for 7 days</Text>
  64. </View>
  65. {/* 特性列表 */}
  66. <View style={styles.featureList}>
  67. <View style={styles.featureItem}>
  68. <CheckIcon />
  69. <Text style={styles.featureText}>
  70. Full access to all features
  71. </Text>
  72. </View>
  73. <View style={styles.featureItem}>
  74. <CheckIcon />
  75. <Text style={styles.featureText}>
  76. No credit card required
  77. </Text>
  78. </View>
  79. <View style={styles.featureItem}>
  80. <CheckIcon />
  81. <Text style={styles.featureText}>Cancel anytime</Text>
  82. </View>
  83. </View>
  84. {/* 按钮 */}
  85. <TouchableOpacity
  86. onPress={handleFreeTrial}
  87. style={styles.buttonLight}
  88. >
  89. <Text style={[styles.buttonLightText, fonts.bold]}>
  90. Start Free Trial
  91. </Text>
  92. </TouchableOpacity>
  93. </View>
  94. </View>
  95. {/* Premium 高级套餐卡片 */}
  96. <View
  97. style={[styles.card, styles.cardPremium, gutters.marginBottom_24]}
  98. >
  99. {/* 卡片头部 */}
  100. <View style={styles.cardHeaderDark}>
  101. <Text style={[styles.cardHeaderTitleWhite, fonts.bold]}>
  102. Premium Plan
  103. </Text>
  104. </View>
  105. {/* 卡片内容 */}
  106. <View style={styles.cardBody}>
  107. {/* 价格 */}
  108. <View style={styles.priceSection}>
  109. <Text style={[styles.priceAmount, fonts.bold]}>$9.99</Text>
  110. <Text style={styles.pricePeriod}> per month</Text>
  111. </View>
  112. {/* 特性列表 */}
  113. <View style={styles.featureList}>
  114. <View style={styles.featureItem}>
  115. <CheckIcon />
  116. <Text style={styles.featureText}>All features included</Text>
  117. </View>
  118. <View style={styles.featureItem}>
  119. <CheckIcon />
  120. <Text style={styles.featureText}>Priority support</Text>
  121. </View>
  122. <View style={styles.featureItem}>
  123. <CheckIcon />
  124. <Text style={styles.featureText}>Cancel anytime</Text>
  125. </View>
  126. </View>
  127. {/* 按钮 */}
  128. <TouchableOpacity
  129. onPress={handlePremium}
  130. style={styles.buttonDark}
  131. >
  132. <Text style={[styles.buttonDarkText, fonts.bold]}>
  133. Get Premium
  134. </Text>
  135. </TouchableOpacity>
  136. </View>
  137. </View>
  138. </View>
  139. </ScrollView>
  140. </SafeScreen>
  141. );
  142. };
  143. const styles = StyleSheet.create({
  144. pageBgColor: {
  145. backgroundColor: '#FBBF24', // yellow-400
  146. },
  147. container: {
  148. flex: 1,
  149. },
  150. content: {
  151. maxWidth: 672, // 2xl
  152. width: width > 672 ? 672 : '100%',
  153. alignSelf: 'center',
  154. paddingHorizontal: 16,
  155. paddingVertical: 24,
  156. },
  157. headerSection: {
  158. alignItems: 'center',
  159. marginBottom: 32,
  160. },
  161. mainTitle: {
  162. fontSize: 30,
  163. color: '#1F2937', // gray-800
  164. marginBottom: 8,
  165. textAlign: 'center',
  166. },
  167. subtitle: {
  168. fontSize: 16,
  169. color: '#6B7280', // gray-600
  170. textAlign: 'center',
  171. lineHeight: 24,
  172. },
  173. card: {
  174. backgroundColor: '#FFFFFF',
  175. borderRadius: 24,
  176. overflow: 'hidden',
  177. shadowColor: '#000',
  178. shadowOffset: { width: 0, height: 4 },
  179. shadowOpacity: 0.15,
  180. shadowRadius: 12,
  181. elevation: 8,
  182. },
  183. cardPremium: {
  184. borderWidth: 2,
  185. borderColor: '#4F46E5', // indigo-600
  186. },
  187. cardHeaderLight: {
  188. backgroundColor: '#E0E7FF', // indigo-100
  189. paddingHorizontal: 24,
  190. paddingVertical: 16,
  191. },
  192. cardHeaderDark: {
  193. backgroundColor: '#4F46E5', // indigo-600
  194. paddingHorizontal: 24,
  195. paddingVertical: 16,
  196. },
  197. cardHeaderTitle: {
  198. fontSize: 24,
  199. color: '#4338CA', // indigo-700
  200. },
  201. cardHeaderTitleWhite: {
  202. fontSize: 24,
  203. color: '#FFFFFF',
  204. },
  205. cardBody: {
  206. paddingHorizontal: 24,
  207. paddingVertical: 32,
  208. },
  209. priceSection: {
  210. flexDirection: 'row',
  211. alignItems: 'baseline',
  212. marginBottom: 24,
  213. },
  214. priceAmount: {
  215. fontSize: 48,
  216. color: '#1F2937', // gray-800
  217. },
  218. pricePeriod: {
  219. fontSize: 20,
  220. color: '#6B7280', // gray-500
  221. marginLeft: 8,
  222. },
  223. featureList: {
  224. marginBottom: 32,
  225. gap: 16,
  226. },
  227. featureItem: {
  228. flexDirection: 'row',
  229. alignItems: 'center',
  230. marginBottom: 16,
  231. },
  232. featureText: {
  233. fontSize: 18,
  234. color: '#374151', // gray-700
  235. marginLeft: 12,
  236. flex: 1,
  237. },
  238. buttonLight: {
  239. width: '100%',
  240. backgroundColor: '#E0E7FF', // indigo-100
  241. paddingVertical: 16,
  242. paddingHorizontal: 24,
  243. borderRadius: 16,
  244. },
  245. buttonLightText: {
  246. color: '#4338CA', // indigo-700
  247. fontSize: 16,
  248. textAlign: 'center',
  249. },
  250. buttonDark: {
  251. width: '100%',
  252. backgroundColor: '#4F46E5', // indigo-600
  253. paddingVertical: 16,
  254. paddingHorizontal: 24,
  255. borderRadius: 16,
  256. },
  257. buttonDarkText: {
  258. color: '#FFFFFF',
  259. fontSize: 16,
  260. textAlign: 'center',
  261. },
  262. });
  263. export default SubList;