feat: simple style tranbox
This commit is contained in:
@@ -7,6 +7,7 @@ import { DEFAULT_TRANS_APIS } from "../../config";
|
||||
import { useEffect, useState } from "react";
|
||||
import { apiTranslate, apiBaiduLangdetect } from "../../apis";
|
||||
import CopyBtn from "./CopyBtn";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
export default function TranCont({
|
||||
text,
|
||||
@@ -15,6 +16,7 @@ export default function TranCont({
|
||||
toLang,
|
||||
toLang2 = "en",
|
||||
transApis,
|
||||
simpleStyle,
|
||||
}) {
|
||||
const i18n = useI18n();
|
||||
const [trText, setTrText] = useState("");
|
||||
@@ -54,6 +56,14 @@ export default function TranCont({
|
||||
})();
|
||||
}, [text, translator, fromLang, toLang, toLang2, transApis]);
|
||||
|
||||
if (simpleStyle) {
|
||||
return (
|
||||
<Box>
|
||||
<Typography style={{ whiteSpace: "pre-line" }}>{trText}</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<TextField
|
||||
|
||||
Reference in New Issue
Block a user