Skip to content

Commit b73f063

Browse files
committed
Changed the Code page
1 parent 1f9deaa commit b73f063

File tree

6 files changed

+302
-511
lines changed

6 files changed

+302
-511
lines changed

Components/Global/ReaultDiaplay.js

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
/* eslint-disable react-native/no-inline-styles */
2+
import React from 'react';
3+
import {
4+
Clipboard,
5+
Dimensions,
6+
TouchableOpacity,
7+
View,
8+
Text,
9+
} from 'react-native';
10+
import Markdown from 'react-native-markdown-display';
11+
import {faCopy} from '@fortawesome/free-solid-svg-icons';
12+
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome';
13+
import {useToast} from 'react-native-toast-notifications';
14+
import * as Animatable from 'react-native-animatable';
15+
16+
function ResultDisplay({text}) {
17+
const width = Dimensions.get('window').width;
18+
const Toast = useToast();
19+
const fadeIn = {
20+
from: {
21+
opacity: 0,
22+
padding: 0,
23+
marginVertical: 0,
24+
},
25+
to: {
26+
opacity: 1,
27+
padding: width * 0.02,
28+
marginVertical: 4,
29+
},
30+
};
31+
return (
32+
<Animatable.View
33+
animation={fadeIn}
34+
easing="ease-in-out"
35+
duration={250}
36+
style={{
37+
justifyContent: 'center',
38+
alignItems: 'center',
39+
}}>
40+
<View
41+
style={{
42+
padding: width * 0.04,
43+
flexDirection: 'column',
44+
backgroundColor: '#292250',
45+
maxWidth: width * 0.9,
46+
borderRadius: 10,
47+
marginTop: 10,
48+
}}>
49+
<Markdown
50+
style={{
51+
text: {
52+
color: 'rgb(236, 236, 236)',
53+
},
54+
blockquote: {
55+
backgroundColor: '#201d1d',
56+
color: 'rgba(243, 232, 130, 0.88)',
57+
fontSize: width * 0.033,
58+
borderRadius: 10,
59+
borderColor: 'rgba(243, 232, 130, 0.88)',
60+
},
61+
fence: {
62+
backgroundColor: '#080808',
63+
color: 'rgba(243, 232, 130, 0.88)',
64+
fontSize: width * 0.027,
65+
borderRadius: 10,
66+
borderColor: 'rgba(243, 232, 130, 0.88)',
67+
},
68+
code_block: {
69+
backgroundColor: '#080808',
70+
color: 'rgba(243, 232, 130, 0.88)',
71+
fontSize: width * 0.027,
72+
borderRadius: 10,
73+
borderColor: 'rgba(243, 232, 130, 0.88)',
74+
},
75+
code_inline: {
76+
backgroundColor: 'rgba(0,0,0,0)',
77+
color: 'rgba(214, 200, 74, 1.00)',
78+
fontSize: width * 0.034,
79+
borderRadius: 1000,
80+
fontWeight: 'bold',
81+
},
82+
list_item: {
83+
color: 'rgba(243, 243, 243, 0.98)',
84+
fontSize: width * 0.0335,
85+
marginVertical: 10,
86+
height: 'auto',
87+
alignSelf: 'flex-start',
88+
flexBasis: 1,
89+
},
90+
}}>
91+
{text}
92+
</Markdown>
93+
<View
94+
style={{
95+
width: width,
96+
}}
97+
/>
98+
<TouchableOpacity
99+
style={{
100+
flexBasis: 1,
101+
backgroundColor: '#4341c2',
102+
paddingVertical: 15,
103+
borderRadius: 10,
104+
alignItems: 'center',
105+
flexDirection: 'row',
106+
justifyContent: 'center',
107+
}}
108+
onPress={() => {
109+
Clipboard.setString(text);
110+
Toast.show('Copied to clipboard', {
111+
animationDuration: 90,
112+
type: 'success',
113+
placement: 'center',
114+
successColor: 'rgba(55, 145, 62, 1.00)',
115+
duration: 1200,
116+
offset: 30,
117+
animationType: 'zoom-in',
118+
});
119+
}}>
120+
<Text
121+
style={{
122+
fontSize: width * 0.034,
123+
color: 'rgb(224, 224, 224)',
124+
paddingHorizontal: 2,
125+
}}>
126+
{' '}
127+
Copy{' '}
128+
</Text>
129+
<FontAwesomeIcon
130+
icon={faCopy}
131+
style={{
132+
color: 'rgb(224, 224, 224)',
133+
padding: 0,
134+
}}
135+
/>
136+
</TouchableOpacity>
137+
</View>
138+
</Animatable.View>
139+
);
140+
}
141+
142+
export default ResultDisplay;

0 commit comments

Comments
 (0)