ResultContent.js
1.2 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
import React from 'react'
import { useRecoilValue } from 'recoil';
import ResultForLn from './ResultForLn';
import ResultForErr from './ResultForErr';
import ResultForOk from './ResultForOk';
import ResultForBn from './ResultForBn';
import ResultForBb from './ResultForBb';
import ResultForErrTrust from './ResultForErrTrust';
import ResultLoading from './ResultLoading';
import { selectedPosState } from '../store/Global';
const ResultContent = (props) => {
const resultStr = props.result.toString();
const headLetters = resultStr.substr([0, 4]);
const direction = useRecoilValue(selectedPosState);
if (resultStr === "loading") {
return <ResultLoading />
}
else if (headLetters === 'error') {
return <ResultForErrTrust />;
}
else if (resultStr === "okay") {
return <ResultForOk />;
}
else if (headLetters === "leani") {
return <ResultForLn direction={direction} />
}
else if (resultStr === "bent-neck") {
return <ResultForBn />;
}
else if (resultStr === "bent-back") {
return <ResultForBb />;
}
else {
return <ResultForErr />;
}
}
export default ResultContent;