You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

61 lines
1.5 KiB

import { Pressable, Text, Image, Dimensions } from "react-native";
import React from "react";
import { connect } from "react-redux";
import * as Linking from "expo-linking";
//style
import tw from "tailwind-rn";
import fontSize from "../../../constants/fontSize";
import Colors from "../../../constants/Colors";
const { width, height } = Dimensions.get("window");
const Book = ({ book, mobile, theme, orientation }) => {
return (
<Pressable
style={[
tw("flex rounded-md p-2 my-2"),
{ width: mobile ? "48%" : width / 4.2 },
]}
onPress={() =>
Linking.openURL(`https://ar.dnvn.ir/lunch?id=${book?.product?.ARId}`)
}
>
<Image
source={{
uri: `https://dnvn.ir/api/v1/file/${book?.product?.book?.fileIds}`,
}}
resizeMode="contain"
style={[
tw("rounded-sm w-full"),
{
height: mobile ? (width - 32) / 1.5 : height / 4,
flex: 1,
},
]}
/>
<Text
style={[
{
fontFamily: "bold",
fontSize: fontSize.lg,
marginTop: 10,
color:
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white,
textAlign: "right",
},
]}
>
{book?.name}
</Text>
</Pressable>
);
};
const mapStateToProps = (state) => ({
mobile: state.publicApi.mobile,
theme: state.publicApi.theme,
orientation: state.publicApi.orientation,
});
export default connect(mapStateToProps)(Book);