RateLine.js
1.92 KB
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
82
83
84
import React, {useEffect} from 'react';
import { Surface, Text,Divider} from 'react-native-paper';
import { View,StyleSheet } from 'react-native';
import {connect} from 'react-redux';
import {load } from '../../reducers/search';
import PromptSearchRate from '../PromptSearch/PromptSearchRate';
const RateLine = ({load,pastScore }) => {
useEffect(()=>{
const get = async () => {
await load();
}
get();
}, [load]);
return (
<Surface style={styles.surface}>
{pastScore.length ?
<>
<Text style={styles.info}>최근 점수</Text>
<View style={styles.scoreContainer}>
{pastScore.map((elem,index)=> (
<Text key={index} style={styles.score}>{elem}</Text>
))}
</View>
<View style={styles.detail}><Text style={styles.new}>최근</Text><Text></Text></View>
</>
: <PromptSearchRate />
}
</Surface>
);
}
const styles = StyleSheet.create({
surface: {
padding: 8,
flex: 0.4,
width: '95%',
alignItems: 'center',
justifyContent: 'center',
elevation: 2,
marginTop: 10,
marginBottom: 10,
},
info:{
fontSize:25,
fontWeight:'bold',
marginBottom: 15
},
score:{
fontSize:20
},
scoreContainer:{
flexDirection:'row',
justifyContent: 'space-around',
width:'100%'
},
detail:{
width:'100%',
justifyContent:'space-around',
},
new:{
fontSize: 18,
marginLeft: 20,
color:'#995432'
}
});
const RateLineContainer = ( {load,pastScore } ) => (
<RateLine load={load} pastScore={pastScore} />
);
export default connect(
({search})=>({
pastScore:search.pastScore
}),
{
load
}
)(RateLineContainer);