import 'react-native-gesture-handler'; import * as React from 'react'; import { useState } from 'react'; import { Alert, Button, Image, StyleSheet, Dimensions, SafeAreaView, ScrollView, TouchableOpacity, Modal, Pressable, Share } from 'react-native'; import Constants from 'expo-constants'; import { Ionicons, FontAwesome } from '@expo/vector-icons'; import { LinearGradient } from 'expo-linear-gradient'; import { PolicyFooter, Social, ShowroomList, FooterInfo } from '../components/footer/footerMain'; import EditScreenInfo from '../components/EditScreenInfo'; import { Text, View, } from '../components/Themed'; import useColorScheme from '../hooks/useColorScheme'; import { TextInput } from 'react-native-gesture-handler'; import { RadioButton, Checkbox } from 'react-native-paper'; import { Picker } from '@react-native-picker/picker'; import { ArticleItem } from '../components/article/ArticleItem'; export default function ArticleHome() { return ( Trang chủ Tin tức ) } const dataArticle = [ { id: 1, title: 'Chương trình Khuyến mãi “Play-with Power by MSI”', image: 'https://hanoicomputercdn.com/media/news/454_cpu_ch__i_game.jpg', category: 'Review sản phẩm', visit: 10, comment: 40, createDate: '12-03-2021, 5:30 pm', summary: 'Khi chọn mua cho mình một chiếc laptop để đồng hành mình trong công việc, học lập và giải trí phải chăng chúng ta chỉ quan tâm đến cầu hình', }, { id: 2, title: 'Tự bẻ khóa tính năng hạn chế khai thác tiền ảo của RTX 3060, Nvidia đang \'tiếp tay\' cho dân đào coin?', image: 'https://hanoicomputercdn.com/media/news/454_cpu_ch__i_game.jpg', category: 'Review sản phẩm', visit: 10, comment: 40, createDate: '13-03-2021, 8:30 pm', summary: 'Khi chọn mua cho mình một chiếc laptop để đồng hành mình trong công việc, học lập và giải trí phải chăng chúng ta chỉ quan tâm đến cầu hình', }, { id: 3, title: '3 CPU “thần thánh” sẽ cứu rỗi game thủ', image: 'https://hanoicomputercdn.com/media/news/454_cpu_ch__i_game.jpg', category: 'Review sản phẩm', visit: 10, comment: 40, createDate: '13-03-2021, 5:30 am', summary: 'Khi chọn mua cho mình một chiếc laptop để đồng hành mình trong công việc, học lập và giải trí phải chăng chúng ta chỉ quan tâm đến cầu hình', }, { id: 4, title: 'Chương trình Khuyến mãi “Quà Cực Sốc Khi Dựng Cấu Hình PC Lắp Ráp”', image: 'https://hanoicomputercdn.com/media/news/454_cpu_ch__i_game.jpg', category: 'Review sản phẩm', visit: 10, comment: 40, createDate: '22-03-2021, 5:30 pm', summary: 'Khi chọn mua cho mình một chiếc laptop để đồng hành mình trong công việc, học lập và giải trí phải chăng chúng ta chỉ quan tâm đến cầu hình', }, ] const ArticleHomeNewFirstBlock = () => { const dataArticleHome = dataArticle; return ( { dataArticleHome.map((item, index) => { if (index == 0) { return ( {item.category} {item.title} ) } else if (index > 0 && index < 5) { return ( {item.title} {item.createDate} ) } }) } ) } const ArticleNewHome = () => { const dataArticleNew = dataArticle; return ( Bài viết mới nhất { dataArticleNew.map(item => {item.title} {item.createDate} {item.comment} {item.visit} {item.summary} ) } ) } const ArticleHot = () => { const dataArticleNew = dataArticle; let counter = 1; return ( Bài viết nổi bật { dataArticleNew.map((item, index) => { if (index == 0) { return ( 01 {item.title} Chia sẻ ) } else if (index > 0 && index < 4) { { counter++ } return ( 0{counter} {item.title} Chia sẻ ) } } ) } ) } const ArticleListHome = () => { const listArticleCat = [ 'Review sản phẩm', 'Tin game', 'Tin khuyến mãi', 'Sự kiện' ]; const dataArtileList = dataArticle; const styleTitle = { fontSize: 14, } return ( { listArticleCat.map((item, index) => {item} { dataArtileList.map(item => ) } Xem thêm ) } ) } const winWidth = Dimensions.get('window').width; //full width const winHeight = Dimensions.get('window').height; //full height const winWidthP10 = winWidth - 20; const halfWinWidth = winWidth / 2; const ratio = winWidthP10 / 850; //541 is actual image width const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: '#fff', }, brecrumb: { display: 'flex', width: winWidth, paddingLeft: 10, paddingRight: 10, flexDirection: 'row', height: 18, alignItems: 'center', marginTop: 10, marginBottom: 10, }, brecrumbText: { fontSize: 13, color: '#222', }, brecrumbTextLast: { fontSize: 13, color: '#b7b7b7', }, brecrumbIcon: { fontSize: 13, color: '#222', marginLeft: 6, marginRight: 6 }, boxArticleHomeNew: { paddingHorizontal: 10, width: winWidth, marginBottom: 10, }, boxArticleHomeNewFirst: { marginBottom: 20, position: 'relative', }, boxArticleHomeNewFirstImg: { width: '100%', height: 450 * ratio, }, boxArticleHomeNewFirstInfo: { padding: 10, position: 'absolute', left: 0, bottom: 0, backgroundColor: 'rgba(0,0,0,0.3)', width: '100%', }, boxArticleHomeNewFirstInfoCat: { backgroundColor: '#ce0707', width: 150, maxWidth: '100%', textAlign: 'center', color: '#fff', textTransform: 'uppercase', paddingVertical: 5, overflow: 'hidden', marginBottom: 8, }, boxArticleHomeNewFirstInfoName: { width: '100%', fontSize: 30, fontWeight: 'bold', color: '#fff', }, boxArticleHomeNewList: { flexDirection: 'column', }, boxArticleHomeNewListItem: { width: '100%', marginBottom: 10, }, boxArticleHomeNewListImg: { width: '100%', height: 450 * ratio, }, boxArticleHomeNewListItemInfo: {}, boxArticleHomeNewListItemInfoName: { marginVertical: 7, width: '100%', fontSize: 14, fontWeight: 'bold', color: '#222222' }, boxArticleHomeNewListItemInfoTime: { fontSize: 13, color: '#888888' }, boxArticleNewHome: { width: winWidth, paddingHorizontal: 10, }, boxArticleNewHomeTitle: { paddingVertical: 10, marginBottom: 10, borderBottomWidth: 1, borderBottomColor: '#e1e1e1', }, boxArticleNewHomeTitleText: { fontSize: 16, fontWeight: 'bold', color: '#ce0707', textTransform: 'uppercase', }, boxArticleNewHomeTitleLine: { width: 100, height: 1, backgroundColor: '#ce0707', position: 'absolute', bottom: -1, left: 0, }, boxArticleNewHomeList: { flexDirection: 'column', width: '100%' }, boxArticleNewHomeItem: { marginBottom: 20, width: '100%', flexDirection: 'column', }, boxArticleNewHomeItemcontent: { width: '100%', marginBottom: 10, flexDirection: 'row' }, boxArticleNewHomeItemInfo: { width: '65%', paddingRight: 10, }, boxArticleNewHomeItemName: { width: '100%', fontSize: 14, fontWeight: 'bold', color: '#222222', marginBottom: 8, }, boxArticleNewHomeItemTimeView: { flexDirection: 'row', }, boxArticleNewHomeItemTime: { fontSize: 13, color: '#888', alignItems: 'center' }, boxArticleNewHomeItemView: { flexDirection: 'row', marginLeft: 10, alignItems: 'center' }, boxArticleNewHomeItemIcon: { fontSize: 11, color: '#2e9fff', marginRight: 2, }, boxArticleNewHomeItemViewText: { fontSize: 13, color: '#888' }, boxArticleNewHomeItemImageCt: { width: '35%', paddingTop: '35%', position: 'relative', overflow: 'hidden', }, boxArticleNewHomeItemImage: { width: '100%', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, }, boxArticleNewHomeItemSummary: {}, boxArticleHomeHot: { width: winWidth, paddingHorizontal: 10, }, articleHotFirst: { marginBottom: 20, paddingBottom: 10, borderBottomColor: '#e1e1e1', borderBottomWidth: 1, }, articleHotFirstImg: { width: '100%', height: ratio * 450, marginBottom: 10, }, articleHotFirstInfo: { flexDirection: 'row', alignItems: 'center' }, articleHotFirstInfoNum: { width: 75, paddingRight: 10, fontSize: 50, fontWeight: 'bold', color: '#cacaca', fontStyle: 'italic', }, articleHotFirstInfoContent: { width: winWidth - 95, paddingLeft: 10, borderLeftWidth: 1, borderLeftColor: '#e1e1e1' }, articleHotName: { fontSize: 14, fontWeight: 'bold', color: '#222', marginBottom: 10, }, articleHotSahre: { flexDirection: 'row', alignItems: 'center' }, articleHotSahreIcon: { color: '#45629f', marginRight: 3, }, articleHotSahreText: { color: '#999' }, articleHotItem: { marginBottom: 20, }, articleHotInfo: { flexDirection: 'row', alignItems: 'center' }, articleHotNum: { width: 40, height: 40, marginRight: 10, fontSize: 16, fontWeight: 'bold', color: '#222', fontStyle: 'italic', backgroundColor: '#f0eded', textAlign: 'center', lineHeight: 40, borderRadius: 20, overflow: 'hidden', }, articleHotInfoContent: { width: winWidth - 70, paddingLeft: 10, }, boxArticleHomeList: { width: winWidth, paddingHorizontal: 10, marginBottom: 20, }, boxArticleHomeListVm: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20, }, boxArticleHomeListVmLineL: { width: halfWinWidth - 85, height: 1, backgroundColor: '#e1e1e1' }, boxArticleHomeListVmLineR: { width: halfWinWidth - 85, height: 1, backgroundColor: '#e1e1e1' }, boxArticleHomeListVmBt: { width: 115, height: 34, borderRadius: 3, borderWidth: 1, borderColor: '#e1e1e1', flexDirection: 'row', justifyContent: 'center', alignItems: 'center', }, boxArticleHomeListVmText: { color: '#888' }, })