feat: hide transbox header when mouseleave
This commit is contained in:
@@ -25,6 +25,7 @@ import DictCont from "./DictCont";
|
|||||||
import SugCont from "./SugCont";
|
import SugCont from "./SugCont";
|
||||||
import CopyBtn from "./CopyBtn";
|
import CopyBtn from "./CopyBtn";
|
||||||
import { isValidWord } from "../../libs/utils";
|
import { isValidWord } from "../../libs/utils";
|
||||||
|
import { isMobile } from "../../libs/mobile";
|
||||||
|
|
||||||
function Header({
|
function Header({
|
||||||
setShowPopup,
|
setShowPopup,
|
||||||
@@ -34,7 +35,12 @@ function Header({
|
|||||||
setHideClickAway,
|
setHideClickAway,
|
||||||
followSelection,
|
followSelection,
|
||||||
setFollowSelection,
|
setFollowSelection,
|
||||||
|
mouseHover,
|
||||||
}) {
|
}) {
|
||||||
|
if (!isMobile && simpleStyle && !mouseHover) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
className="KT-transbox-header"
|
className="KT-transbox-header"
|
||||||
@@ -263,6 +269,7 @@ export default function TranBox({
|
|||||||
setFollowSelection,
|
setFollowSelection,
|
||||||
extStyles,
|
extStyles,
|
||||||
}) {
|
}) {
|
||||||
|
const [mouseHover, setMouseHover] = useState(false);
|
||||||
return (
|
return (
|
||||||
<SettingProvider>
|
<SettingProvider>
|
||||||
<ThemeProvider styles={extStyles}>
|
<ThemeProvider styles={extStyles}>
|
||||||
@@ -280,9 +287,12 @@ export default function TranBox({
|
|||||||
setHideClickAway={setHideClickAway}
|
setHideClickAway={setHideClickAway}
|
||||||
followSelection={followSelection}
|
followSelection={followSelection}
|
||||||
setFollowSelection={setFollowSelection}
|
setFollowSelection={setFollowSelection}
|
||||||
|
mouseHover={mouseHover}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
onMouseEnter={() => setMouseHover(true)}
|
||||||
|
onMouseLeave={() => setMouseHover(false)}
|
||||||
>
|
>
|
||||||
<TranForm
|
<TranForm
|
||||||
text={text}
|
text={text}
|
||||||
|
|||||||
Reference in New Issue
Block a user