-
Notifications
You must be signed in to change notification settings - Fork 0
/
DetailsDesc.js
81 lines (75 loc) · 2.01 KB
/
DetailsDesc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import React, { useState } from "react";
import { View, Text } from "react-native";
import { EthPrice, NFTTitle } from "./SubInfo";
import { COLORS, SIZES, FONTS } from "../constants";
const DetailsDesc = ({ data }) => {
const [text, setText] = useState(data.description.slice(0, 100));
const [readMore, setReadMore] = useState(false);
return (
<>
<View
style={{
width: "100%",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
}}
>
<NFTTitle
title={data.name}
subTitle={data.creator}
titleSize={SIZES.extraLarge}
subTitleSize={SIZES.font}
/>
<EthPrice price={data.price} />
</View>
<View style={{ marginVertical: SIZES.extraLarge * 1.5 }}>
<Text
style={{
fontSize: SIZES.font,
fontFamily: FONTS.semiBold,
color: COLORS.primary,
}}
>
Description
</Text>
<View
style={{
marginTop: SIZES.base,
}}
>
<Text
style={{
color: COLORS.secondary,
fontSize: SIZES.small,
fontFamily: FONTS.regular,
lineHeight: SIZES.large,
}}
>
{text}
{!readMore && "..."}
<Text
style={{
color: COLORS.primary,
fontSize: SIZES.small,
fontFamily: FONTS.semiBold,
}}
=> {
if (!readMore) {
setText(data.description);
setReadMore(true);
} else {
setText(data.description.slice(0, 100));
setReadMore(false);
}
}}
>
{readMore ? " Show Less" : " Read More"}
</Text>
</Text>
</View>
</View>
</>
);
};
export default DetailsDesc;