HorizontalNewsCard.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import { Image, StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native'
  2. import React from 'react'
  3. import metrics from '../../../theme/metrics'
  4. import fonts from '../../../theme/fonts'
  5. import colors from '../../../theme/colors'
  6. import images from '../../../assets/images/images'
  7. import BookmarkButton from '../Buttons/BookmarkButton'
  8. import ShareButton from '../Buttons/ShareButton'
  9. const HorizontalNewsCard = ({ style, headline, tagline, category, timestamp, image, onPress }) => {
  10. return (
  11. <TouchableWithoutFeedback onPress={onPress}>
  12. <View style={[styles.cardContainer, style]}>
  13. <View style={styles.textContainer}>
  14. <View>
  15. <Text style={styles.headline}> {headline ?? "Battlegrounds Mobile India iOS release date"}</Text>
  16. <Text style={styles.tagline}>{tagline ?? "government is the people, for the people, by the people but the people are retarded "}</Text>
  17. </View>
  18. <View style={styles.descriptors}>
  19. <Text style={styles.categoryDescriptor}>{category ?? "Sports"}</Text>
  20. <Text style={styles.timeDescriptor}>{timestamp ?? "27 mins ago"}</Text>
  21. </View>
  22. </View>
  23. <View style={styles.imageContainer}>
  24. <View style={styles.imageSub}>
  25. <Image source={image ?? images.horizontalCard} style={{aspectRatio: 0.9}} />
  26. </View>
  27. <View style={styles.utilButtons}>
  28. <BookmarkButton onPress={true} />
  29. <ShareButton onPress={true}/>
  30. </View>
  31. </View>
  32. </View>
  33. </TouchableWithoutFeedback>
  34. )
  35. }
  36. export default HorizontalNewsCard
  37. const styles = StyleSheet.create({
  38. cardContainer: {
  39. width: 'auto',
  40. maxWidth: metrics.screenWidth,
  41. height: fonts.getSize(190),
  42. backgroundColor: colors.white,
  43. borderRadius: fonts.getSize(4),
  44. flexDirection: 'row',
  45. // paddingBottom:fonts.getSize(24)
  46. },
  47. imageContainer: {
  48. width: "45%",
  49. },
  50. textContainer: {
  51. width: "55%",
  52. paddingVertical: fonts.getSize(8),
  53. paddingLeft: fonts.getSize(16),
  54. justifyContent:'flex-start',
  55. gap:fonts.getSize(12)
  56. },
  57. headline: {
  58. fontFamily: fonts.type.medium,
  59. textDecorationLine: 'underline',
  60. fontSize: fonts.getSize(16),
  61. color: colors.black
  62. },
  63. tagline: {
  64. fontSize: fonts.getSize(12),
  65. fontFamily: fonts.type.regular,
  66. maxHeight: '40%',
  67. overflow: 'hidden',
  68. },
  69. descriptors: {
  70. flexDirection: 'row',
  71. justifyContent: 'space-around'
  72. },
  73. categoryDescriptor: {
  74. fontFamily: fonts.type.light
  75. },
  76. timeDescriptor: {
  77. fontFamily: fonts.type.light
  78. },
  79. imageSub:{
  80. alignItems:'center',
  81. justifyContent:'center',
  82. padding: fonts.getSize(14),
  83. paddingBottom: 0
  84. },
  85. utilButtons:{
  86. flexDirection: 'row',
  87. alignItems: 'center',
  88. justifyContent: 'space-around'
  89. }
  90. })