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

View file

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