add copy button to tranbox

This commit is contained in:
Gabe Yuan
2023-10-26 12:24:24 +08:00
parent 0d7112187d
commit c6d3d6454f
5 changed files with 81 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import { DEFAULT_TRANS_APIS, OPT_TRANS_BAIDU } from "../../config";
import { useEffect, useState } from "react";
import { apiTranslate } from "../../apis";
import { isValidWord } from "../../libs/utils";
import CopyBtn from "./CopyBtn";
const exchangeMap = {
word_third: "第三人称单数",
@@ -118,9 +119,24 @@ export default function TranCont({
<Box>
<TextField
label={i18n("translated_text")}
// disabled
fullWidth
multiline
value={trText}
InputProps={{
endAdornment: (
<Stack
direction="row"
sx={{
position: "absolute",
right: 0,
top: 0,
}}
>
<CopyBtn text={trText} />
</Stack>
),
}}
/>
</Box>