Apply candidate option to popup

This commit is contained in:
sienori 2019-02-23 02:36:02 +09:00
parent 063aa7f31f
commit f16826ab74
2 changed files with 6 additions and 4 deletions

View file

@ -1,5 +1,6 @@
import React from "react"; import React from "react";
import getErrorMessage from "src/common/getErrorMessage"; import getErrorMessage from "src/common/getErrorMessage";
import { getSettings } from "src/settings/settings";
import "../styles/ResultArea.scss"; import "../styles/ResultArea.scss";
const splitLine = text => { const splitLine = text => {
@ -10,13 +11,13 @@ const splitLine = text => {
export default props => { export default props => {
const { resultText, candidateText, statusText } = props; const { resultText, candidateText, statusText } = props;
const isError = statusText !== "OK"; const isError = statusText !== "OK";
const shouldShowCandidate = getSettings("ifShowCandidate");
return ( return (
<div id="resultArea"> <div id="resultArea">
<p className="resultText">{splitLine(resultText)}</p> <p className="resultText">{splitLine(resultText)}</p>
<p className="candidateText"> {shouldShowCandidate && <p className="candidateText">{splitLine(candidateText)}</p>}
{isError ? getErrorMessage(statusText) : splitLine(candidateText)} {isError && <p className="error">{getErrorMessage(statusText)}</p>}
</p>
</div> </div>
); );
}; };

View file

@ -14,7 +14,8 @@
&.resultText { &.resultText {
color: var(--main-text); color: var(--main-text);
} }
&.candidateText { &.candidateText,
&.error {
color: var(--sub-text); color: var(--sub-text);
margin-top: 1em; margin-top: 1em;
&:empty { &:empty {