GoodsCard.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import React from "react";
  2. import { StyleSheet } from "react-native";
  3. import {
  4. Modal,
  5. Card,
  6. Text,
  7. Button,
  8. Layout,
  9. Avatar,
  10. Icon,
  11. } from "@ui-kitten/components";
  12. import { useModel } from "flooks";
  13. export default function GoodsCard(props) {
  14. const { add, remove } = useModel("wordsModel");
  15. return (
  16. <Card
  17. style={[!props.appearance && styles.card]}
  18. appearance={props.appearance || "goodsCard"}
  19. >
  20. <Layout style={styles.layout}>
  21. <Avatar
  22. style={styles.avatar}
  23. shape='rounded'
  24. source='https://t7.baidu.com/it/u=3616242789,1098670747&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg'
  25. />
  26. <Layout style={styles.main}>
  27. <Text category='s1' ellipsizeMode='tail' numberOfLines={1}>
  28. 原味板烧鸡腿堡麦满分套餐原味板烧鸡腿堡麦满分套餐
  29. </Text>
  30. <Text
  31. category='c1'
  32. status='info'
  33. ellipsizeMode='tail'
  34. numberOfLines={1}
  35. >
  36. 原味板烧鸡腿堡麦满分套餐
  37. </Text>
  38. <Text category='c1' status='info'>
  39. 月售 9999+
  40. </Text>
  41. <Layout style={styles.flex1} />
  42. <Text category='h6' status='danger'>
  43. ¥70
  44. </Text>
  45. </Layout>
  46. {!props.appearance && (
  47. <Layout style={styles.butContent}>
  48. <Button status='primary' size='tiny'>
  49. {add}
  50. </Button>
  51. </Layout>
  52. )}
  53. {props.appearance == "classification" && (
  54. <Button
  55. style={styles.miniButton}
  56. status='danger'
  57. accessoryLeft={StarIcon}
  58. />
  59. )}
  60. </Layout>
  61. </Card>
  62. );
  63. }
  64. const StarIcon = (props) => <Icon {...props} name='minus-outline' />;
  65. const styles = StyleSheet.create({
  66. card: { marginTop: 10 },
  67. layout: {
  68. flexDirection: "row",
  69. },
  70. avatar: {
  71. width: 80,
  72. height: 80,
  73. marginRight: 10,
  74. },
  75. main: {
  76. flex: 1,
  77. },
  78. flex1: {
  79. flex: 1,
  80. },
  81. butContent: {
  82. marginLeft: 6,
  83. },
  84. fontColor: {
  85. color: "#B5B5B5",
  86. },
  87. miniButton: {
  88. minWidth: 18,
  89. minHeight: 18,
  90. width: 18,
  91. height: 18,
  92. position: "absolute",
  93. right: 10,
  94. bottom: 5,
  95. },
  96. });