bhd-components 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2017/titleBar/index.d.ts +1 -1
- package/es2017/titleBar/index.js +22 -18
- package/esm/titleBar/index.d.ts +1 -1
- package/esm/titleBar/index.js +22 -18
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ interface TitleBarProps {
|
|
|
3
3
|
title?: React.ReactElement;
|
|
4
4
|
leftIcon?: React.ReactElement;
|
|
5
5
|
subTitle?: React.ReactElement;
|
|
6
|
-
rightContent
|
|
6
|
+
rightContent?: (kind?: string) => React.ReactElement;
|
|
7
7
|
rightMaxWidth?: number;
|
|
8
8
|
wrapClassName?: string;
|
|
9
9
|
leftIconClassName?: string;
|
package/es2017/titleBar/index.js
CHANGED
|
@@ -14,27 +14,31 @@ const TitleBar = (props)=>{
|
|
|
14
14
|
};
|
|
15
15
|
// const onResize = useCallback(, [screenWidth]);
|
|
16
16
|
const onResize = ()=>{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
if (rightContent) {
|
|
18
|
+
const { width } = titleBarRef.current.getBoundingClientRect();
|
|
19
|
+
const maxWidth = width * rightMaxWidth / 100;
|
|
20
|
+
console.log("resize", maxWidth, screenWidth);
|
|
21
|
+
if (screenWidth > maxWidth) {
|
|
22
|
+
// kind minScreen
|
|
23
|
+
setKind("minScreen");
|
|
24
|
+
} else {
|
|
25
|
+
setKind("screen");
|
|
26
|
+
}
|
|
25
27
|
}
|
|
26
28
|
};
|
|
27
29
|
useLayoutEffect(()=>{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
if (rightContent) {
|
|
31
|
+
const { width } = titleBarRef.current.getBoundingClientRect();
|
|
32
|
+
const maxWidth = width * rightMaxWidth / 100;
|
|
33
|
+
const rightWidth = rightContentRef.current.getBoundingClientRect().width;
|
|
34
|
+
setScreenWidth(rightWidth);
|
|
35
|
+
console.log("rightWidthrightWidth", rightWidth, maxWidth);
|
|
36
|
+
if (rightWidth > maxWidth) {
|
|
37
|
+
// kind minScreen
|
|
38
|
+
setKind("minScreen");
|
|
39
|
+
} else {
|
|
40
|
+
setKind("screen");
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
}, []);
|
|
40
44
|
useEffect(()=>{
|
package/esm/titleBar/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ interface TitleBarProps {
|
|
|
3
3
|
title?: React.ReactElement;
|
|
4
4
|
leftIcon?: React.ReactElement;
|
|
5
5
|
subTitle?: React.ReactElement;
|
|
6
|
-
rightContent
|
|
6
|
+
rightContent?: (kind?: string) => React.ReactElement;
|
|
7
7
|
rightMaxWidth?: number;
|
|
8
8
|
wrapClassName?: string;
|
|
9
9
|
leftIconClassName?: string;
|
package/esm/titleBar/index.js
CHANGED
|
@@ -15,27 +15,31 @@ var TitleBar = function(props) {
|
|
|
15
15
|
};
|
|
16
16
|
// const onResize = useCallback(, [screenWidth]);
|
|
17
17
|
var onResize = function() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
if (rightContent) {
|
|
19
|
+
var width = titleBarRef.current.getBoundingClientRect().width;
|
|
20
|
+
var maxWidth = width * rightMaxWidth / 100;
|
|
21
|
+
console.log("resize", maxWidth, screenWidth);
|
|
22
|
+
if (screenWidth > maxWidth) {
|
|
23
|
+
// kind minScreen
|
|
24
|
+
setKind("minScreen");
|
|
25
|
+
} else {
|
|
26
|
+
setKind("screen");
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
useLayoutEffect(function() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
if (rightContent) {
|
|
32
|
+
var width = titleBarRef.current.getBoundingClientRect().width;
|
|
33
|
+
var maxWidth = width * rightMaxWidth / 100;
|
|
34
|
+
var rightWidth = rightContentRef.current.getBoundingClientRect().width;
|
|
35
|
+
setScreenWidth(rightWidth);
|
|
36
|
+
console.log("rightWidthrightWidth", rightWidth, maxWidth);
|
|
37
|
+
if (rightWidth > maxWidth) {
|
|
38
|
+
// kind minScreen
|
|
39
|
+
setKind("minScreen");
|
|
40
|
+
} else {
|
|
41
|
+
setKind("screen");
|
|
42
|
+
}
|
|
39
43
|
}
|
|
40
44
|
}, []);
|
|
41
45
|
useEffect(function() {
|