|
|
@@ -1,3 +1,6 @@
|
|
|
+import { useEffect, useState } from "react";
|
|
|
+import { useAppSelector } from "../../hooks";
|
|
|
+import { currFocus } from "../../reducers/focus";
|
|
|
import { ParaHandleCtl } from "./ParaHandle";
|
|
|
|
|
|
interface IWidgetParaShellCtl {
|
|
|
@@ -16,10 +19,34 @@ const ParaShellCtl = ({
|
|
|
sentences,
|
|
|
children,
|
|
|
}: IWidgetParaShellCtl) => {
|
|
|
+ const focus = useAppSelector(currFocus);
|
|
|
+ const [isFocus, setIsFocus] = useState(false);
|
|
|
+ useEffect(() => {
|
|
|
+ if (focus) {
|
|
|
+ if (focus.focus?.type === "para") {
|
|
|
+ if (focus.focus.id) {
|
|
|
+ const arrId = focus.focus.id.split("-");
|
|
|
+ if (arrId.length > 1) {
|
|
|
+ const focusBook = parseInt(arrId[0]);
|
|
|
+ const focusPara = arrId[1].split(",").map((item) => parseInt(item));
|
|
|
+ if (focusBook === book && focusPara.includes(para)) {
|
|
|
+ setIsFocus(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ setIsFocus(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ setIsFocus(false);
|
|
|
+ }
|
|
|
+ }, [book, focus, para]);
|
|
|
return (
|
|
|
<div
|
|
|
style={{
|
|
|
- borderTop: "1px solid #80808080",
|
|
|
+ borderTop: isFocus ? undefined : "1px solid #80808080",
|
|
|
+ border: isFocus ? "1px solid #006bff" : undefined,
|
|
|
+ borderRadius: isFocus ? 6 : undefined,
|
|
|
marginTop: 20,
|
|
|
paddingTop: 16,
|
|
|
}}
|
|
|
@@ -28,7 +55,7 @@ const ParaShellCtl = ({
|
|
|
style={{
|
|
|
position: "absolute",
|
|
|
marginTop: "-2em",
|
|
|
- left: "56px",
|
|
|
+ marginLeft: "1em",
|
|
|
backgroundColor: "#d9e9ff",
|
|
|
borderRadius: "4px",
|
|
|
}}
|