diff --git a/assets/images/lienkien-ram.png b/assets/images/lienkien-ram.png new file mode 100644 index 0000000..30633f3 Binary files /dev/null and b/assets/images/lienkien-ram.png differ diff --git a/src/components/buildpc/CreateBuildpc.tsx b/src/components/buildpc/CreateBuildpc.tsx new file mode 100644 index 0000000..6f84e0a --- /dev/null +++ b/src/components/buildpc/CreateBuildpc.tsx @@ -0,0 +1,255 @@ +import React, { useState } from "react"; +import { + View, + Text, + ScrollView, + TouchableOpacity, + Image, + StyleSheet, + Dimensions, + TextInput, +} from "react-native"; +import PopupBuildpc from "@components/buildpc/PopupBuildpc"; // Bạn cần tự tạo modal này trong React Native +import Feather from "@expo/vector-icons/Feather"; +import AntDesign from "@expo/vector-icons/AntDesign"; +const { width } = Dimensions.get("window"); + +export function CreateBuildpc() { + const [showPopup, setShowPopup] = useState(false); + + return ( + + {/* Item CPU */} + + CPU + + + + + + AMD Ryzen 7 9800x3D 4.7 GHz 8-Core Processor + + + + Số lượng + + + + Giá bán: + 4.700.000 Vnđ + + + Khuyến mãi: + 20% + + + Thành tiền: + 4.000.000đ + + + + Nhà cung cấp + + + + + + + + + + + + + + + {/* Thêm lựa chọn CPU */} + setShowPopup(true)} + > + + Chọn thêm CPU + + {/* Tổng tiền */} + + Tổng tiền 2 sản phẩm: 8.000.000đ + + + 🖨️ In đơn hàng + + + Mua hàng tại Hacom + + + + {/* Popup */} + {showPopup && ( + setShowPopup(false)} /> + )} + + ); +} + +export default CreateBuildpc; + +const styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor: "#fff", + }, + componentTitle: { + fontWeight: "bold", + fontSize: 15, + marginBottom: 5, + }, + itemRow: { + paddingVertical: 12, + borderBottomWidth: 1, + borderColor: "#ccc", + }, + + productInfo: { + flexDirection: "row", + alignItems: "flex-start", + justifyContent: "space-between", + }, + productLeft: { + width: width - 100, + }, + infolinhkien: { + flexDirection: "row", + }, + productImage: { + width: 60, + height: 60, + marginRight: 10, + borderWidth: 1, + borderColor: "#ccc", + }, + productName: { + flexShrink: 1, + }, + inputQl: { + borderWidth: 1, + borderColor: "#e3e3e3", + fontSize: 13, + width: 64, + height: 30, + marginLeft: 10, + paddingVertical: 0, + paddingHorizontal: 6, + borderRadius: 4, + paddingLeft: 10, + paddingRight: 10, + lineHeight: 20, + includeFontPadding: false, + }, + boxQlt: { + marginBottom: 15, + marginTop: 10, + flexDirection: "row", + alignItems: "center", + height: 30, + flex: 1, + }, + oldPrice: {}, + discount: {}, + totalPrice: { + fontWeight: "bold", + color: "red", + }, + supplierSection: { + alignItems: "center", + flexDirection: "row", + }, + supplierLogo: { + width: 60, + height: 30, + marginBottom: 6, + }, + buttonGroup: { + flexDirection: "row", + alignItems: "center", + width: 60, + }, + buyButton: { + marginRight: 6, + }, + removeButton: { + paddingVertical: 2, + }, + addButton: { + marginTop: 12, + backgroundColor: "#d4d4d4", + borderRadius: 4, + paddingVertical: 6, + alignItems: "center", + }, + addButtonText: { + fontSize: 12, + fontWeight: "bold", + }, + totalSection: { + marginTop: 24, + }, + totalText: { + fontSize: 18, + fontWeight: "bold", + color: "#dc2626", + textAlign: "right", + }, + totalButtons: { + flexDirection: "row", + justifyContent: "flex-end", + marginTop: 12, + }, + printButton: { + borderWidth: 1, + borderColor: "#b3b3b3", + paddingHorizontal: 16, + paddingVertical: 8, + marginRight: 10, + borderRadius: 4, + }, + checkoutButton: { + backgroundColor: "#5b21b6", + paddingHorizontal: 16, + paddingVertical: 8, + borderRadius: 4, + }, + checkoutText: { + color: "#fff", + fontWeight: "bold", + }, +}); diff --git a/src/components/buildpc/PopupBuildpc.tsx b/src/components/buildpc/PopupBuildpc.tsx new file mode 100644 index 0000000..1e33547 --- /dev/null +++ b/src/components/buildpc/PopupBuildpc.tsx @@ -0,0 +1,98 @@ +import React from "react"; +import { + Modal, + View, + Text, + TouchableOpacity, + StyleSheet, + ScrollView, +} from "react-native"; +import { Ionicons } from "@expo/vector-icons"; // hoặc react-native-vector-icons + +interface PopupBuildpcProps { + visible: boolean; + onClose: () => void; +} + +export default function PopupBuildpc({ visible, onClose }: PopupBuildpcProps) { + return ( + + + + {/* Close button */} + + + + + Chọn linh kiện thay thế + + {/* List of products (giả lập) */} + + {[1, 2, 3].map((item) => ( + + Linh kiện {item} + + Chọn + + + ))} + + + + + ); +} + +const styles = StyleSheet.create({ + overlay: { + flex: 1, + backgroundColor: "rgba(0,0,0,0.4)", + justifyContent: "center", + alignItems: "center", + }, + modalContent: { + width: "90%", + maxHeight: "80%", + backgroundColor: "#fff", + borderRadius: 12, + padding: 20, + position: "relative", + }, + closeBtn: { + position: "absolute", + right: 16, + top: 16, + zIndex: 10, + }, + title: { + fontSize: 20, + fontWeight: "bold", + marginBottom: 16, + textAlign: "center", + }, + item: { + flexDirection: "row", + justifyContent: "space-between", + paddingVertical: 12, + borderBottomWidth: 1, + borderColor: "#e5e7eb", + }, + itemText: { + fontSize: 16, + }, + selectButton: { + backgroundColor: "#2563eb", + paddingHorizontal: 12, + paddingVertical: 6, + borderRadius: 4, + }, + selectButtonText: { + color: "#fff", + fontWeight: "bold", + }, +}); diff --git a/src/navigation/AppNavigator.tsx b/src/navigation/AppNavigator.tsx index 7c230ab..820cbab 100644 --- a/src/navigation/AppNavigator.tsx +++ b/src/navigation/AppNavigator.tsx @@ -6,6 +6,7 @@ import HomeScreen from "../screens/HomeScreen"; import ProductListBig from "../screens/product/ProductListBig"; import ProductList from "../screens/product/ProductList"; import ProductDetail from "../screens/product/ProductDetail"; +import Buildpc from "../screens/buildpc/Buildpc"; const Stack = createStackNavigator(); @@ -19,6 +20,7 @@ const AppNavigator: React.FC = () => { + ); }; diff --git a/src/screens/HomeScreen.tsx b/src/screens/HomeScreen.tsx index 9fb35b1..36b8f14 100644 --- a/src/screens/HomeScreen.tsx +++ b/src/screens/HomeScreen.tsx @@ -28,9 +28,9 @@ import Footer from "../components/footer/Footer"; var winWidth = Dimensions.get("window").width; //full width var winHeight = Dimensions.get("window").height; //full height const ratio = winWidth / 930; + const HomeScreen: React.FC = () => { const navigation = useNavigation>(); - return ( @@ -111,9 +111,13 @@ const SliderHome = () => { }; const BoxMenuHome = () => { + const navigation = useNavigation>(); return ( - + navigation.navigate("buildpc" as never)} + > + + {/* Breadcrumb */} + + + + + + + + + Tạo máy tính riêng của bạn + + + + {/* Buttons Bắt đầu/So sánh */} + + + Bắt đầu tạo + + + + So sánh giá tại các cửa hàng + + + + + {/* Action Bar */} + + {/* Share link */} + + + + + + {/* Đặt tên */} + + Đặt tên: + + + + {/* Buttons */} + + + + + + + + {/* Buildpc Content */} + + + + ); +} + +function ActionButton({ icon, label }: { icon: string; label: string }) { + return ( + + + {label} + + ); +} + +const styles = StyleSheet.create({ + container: { + paddingBottom: 100, + paddingHorizontal: 10, + }, + breadcrumb: { + flexDirection: "row", + alignItems: "center", + paddingVertical: 12, + flexWrap: "wrap", + }, + breadcrumbItem: { + flexDirection: "row", + alignItems: "center", + marginRight: 8, + }, + text: { + color: "#000", + }, + icon: { + marginRight: 5, + }, + angle: { + marginLeft: 12, + color: "#888", + }, + actionBar: { + marginTop: 12, + backgroundColor: "#fff", + borderRadius: 8, + }, + inputBox: { + flexDirection: "row", + alignItems: "center", + borderColor: "#ccc", + borderWidth: 1, + borderRadius: 8, + height: 48, + flex: 1, + paddingHorizontal: 10, + width: width - 20, + marginBottom: 10, + }, + input: { + flex: 1, + height: "100%", + paddingHorizontal: 10, + }, + iconAction: { + marginRight: 6, + color: "#888", + }, + buttonGroup: { + flexDirection: "row", + flex: 1, + justifyContent: "space-between", + }, + actionButton: { + flex: 1, + height: 35, + borderWidth: 1, + borderColor: "#ccc", + borderRadius: 8, + flexDirection: "row", + alignItems: "center", + justifyContent: "center", + marginHorizontal: 2, + backgroundColor: "#fff", + }, + buttonWrapper: { + backgroundColor: "#fff", + flexDirection: "row", + gap: 10, + alignItems: "center", + }, + primaryButton: { + backgroundColor: "#5B21B6", + padding: 10, + borderRadius: 4, + }, + primaryButtonText: { + color: "#fff", + fontWeight: "bold", + textAlign: "center", + }, + secondaryButton: { + backgroundColor: "#F5F5F5", + padding: 10, + borderRadius: 4, + }, + secondaryButtonText: { + color: "#666", + fontWeight: "bold", + }, +});