Skip to content

Commit d6e16a5

Browse files
committed
fix: backward compatibility
1 parent b4216b8 commit d6e16a5

File tree

3 files changed

+66
-55
lines changed

3 files changed

+66
-55
lines changed

package-lock.json

+42-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
"path-extra": "^4.3.0",
111111
"poi-asset-contributor-data": "^1.1.3",
112112
"poi-asset-themes": "^4.6.0",
113-
"poi-lib-battle": "^2.15.0",
113+
"poi-lib-battle": "^2.18.0",
114114
"polished": "^4.2.2",
115115
"prop-types": "^15.8.1",
116116
"react": "^18.2.0",
@@ -188,7 +188,7 @@
188188
"asar": "^3.2.0",
189189
"babel-jest": "^28.1.3",
190190
"cross-env": "^7.0.3",
191-
"electron": "^28.1.1",
191+
"electron": "^29.1.0",
192192
"electron-builder": "^23.3.3",
193193
"eslint": "^8.22.0",
194194
"eslint-config-prettier": "^8.5.0",

views/components/etc/overlay.tsx

+22-29
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,55 @@
1-
import React, { useContext, ReactNode } from 'react'
1+
import React, { useContext, Children, ReactNode } from 'react'
22
import {
33
Alert as BAlert,
44
Dialog as BDialog,
55
Overlay as BOverlay,
6-
AlertProps as BAlertProps,
7-
DialogProps as BDialogProps,
8-
OverlayProps as BOverlayProps,
96
Popover as BPopover,
107
Tooltip as BTooltip,
11-
PopoverProps as BPopoverProps,
12-
TooltipProps as BTooltipProps,
8+
type AlertProps,
9+
type DialogProps,
10+
type OverlayProps,
11+
type PopoverProps,
12+
type TooltipProps,
1313
} from '@blueprintjs/core'
1414
import { WindowEnv } from './window-env'
1515

16-
interface AlertProps extends BAlertProps {
17-
children: ReactNode
18-
}
16+
const getSecondChildren = (children: ReactNode) =>
17+
Children.count(children) > 1
18+
? (Children.toArray(children)[1] as PopoverProps['content'])
19+
: undefined
1920

2021
export const Alert: React.FC<AlertProps> = ({ children, ...props }) => (
2122
<BAlert portalContainer={useContext(WindowEnv).mountPoint} {...props}>
2223
{children}
2324
</BAlert>
2425
)
2526

26-
interface DialogProps extends BDialogProps {
27-
children: ReactNode
28-
}
29-
3027
export const Dialog: React.FC<DialogProps> = ({ children, ...props }) => (
3128
<BDialog portalContainer={useContext(WindowEnv).mountPoint} {...props}>
3229
{children}
3330
</BDialog>
3431
)
3532

36-
interface TooltipProps extends BTooltipProps {
37-
children: ReactNode
38-
}
39-
40-
export const Tooltip: React.FC<TooltipProps> = ({ children, ...props }) => (
41-
<BTooltip portalContainer={useContext(WindowEnv).mountPoint} {...props}>
33+
export const Tooltip: React.FC<TooltipProps> = ({ children, content, ...props }) => (
34+
<BTooltip
35+
portalContainer={useContext(WindowEnv).mountPoint}
36+
{...props}
37+
content={content || getSecondChildren(children)}
38+
>
4239
{children}
4340
</BTooltip>
4441
)
4542

46-
interface PopoverProps extends BPopoverProps {
47-
children: ReactNode
48-
}
49-
50-
export const Popover: React.FC<PopoverProps> = ({ children, ...props }) => (
51-
<BPopover portalContainer={useContext(WindowEnv).mountPoint} {...props}>
43+
export const Popover: React.FC<PopoverProps> = ({ children, content, ...props }) => (
44+
<BPopover
45+
portalContainer={useContext(WindowEnv).mountPoint}
46+
{...props}
47+
content={content || getSecondChildren(children)}
48+
>
5249
{children}
5350
</BPopover>
5451
)
5552

56-
interface OverlayProps extends BOverlayProps {
57-
children: ReactNode
58-
}
59-
6053
export const Overlay: React.FC<OverlayProps> = ({ children, ...props }) => (
6154
<BOverlay portalContainer={useContext(WindowEnv).mountPoint} {...props}>
6255
{children}

0 commit comments

Comments
 (0)