Skip to content

Commit

Permalink
type: add RawPurePanelProps interface (#43453)
Browse files Browse the repository at this point in the history
* type(popover): add RawPurePanelProps interface

* fix: optimize
  • Loading branch information
thinkasany committed Jul 8, 2023
1 parent 56e6102 commit cea3c72
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions components/popover/PurePanel.tsx
Expand Up @@ -25,7 +25,11 @@ export interface PurePanelProps extends Omit<PopoverProps, 'children'> {
children?: React.ReactNode;
}

export function RawPurePanel(props: any) {
interface RawPurePanelProps extends PopoverProps {
hashId: string;
}

export const RawPurePanel: React.FC<RawPurePanelProps> = (props) => {
const {
hashId,
prefixCls,
Expand All @@ -50,18 +54,20 @@ export function RawPurePanel(props: any) {
>
<div className={`${prefixCls}-arrow`} />
<Popup {...props} className={hashId} prefixCls={prefixCls}>
{children || getOverlay(prefixCls, title, content)}
{children || getOverlay(prefixCls!, title, content)}
</Popup>
</div>
);
}
};

export default function PurePanel(props: any) {
const PurePanel: React.FC<PurePanelProps> = (props) => {
const { prefixCls: customizePrefixCls, ...restProps } = props;
const { getPrefixCls } = React.useContext(ConfigContext);

const prefixCls = getPrefixCls('popover', customizePrefixCls);
const [wrapSSR, hashId] = useStyle(prefixCls);

return wrapSSR(<RawPurePanel {...restProps} prefixCls={prefixCls} hashId={hashId} />);
}
};

export default PurePanel;

0 comments on commit cea3c72

Please sign in to comment.