ResultContent.js 1.2 KB
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;