ResultContent.js 1.01 KB
import React from 'react'
import ResultForLn from './ResultForLn';
import ResultForErr from './ResultForErr';
import ResultForOk from './ResultForOk';
import ResultForBn from './ResultForBn';
import ResultForBb from './ResultForBb';
import ResultForErrTrust from './ResultForErrTrust';
const ResultContent = (props) => {
    const resultStr = props.result.toString();
    const headLetters = resultStr.substr([0, 4]);
    if (headLetters === 'error') {
        return <ResultForErrTrust />;
    }
    else if (resultStr === "okay") {
        return <ResultForOk />;
    }
    else if (headLetters === "leani") {
        const direction = resultStr.substr([8, 11]) ? 'left'('left') : ('right');
        return <ResultForLn direction={direction} />

    }
    else if (resultStr === "bent-neck") {
        return <ResultForBn />;

    }
    else if (resultStr === "bent-back") {
        return <ResultForBb />;

    }
    else {
        return <ResultForErr />;
    }
}

export default ResultContent;