|
|
@@ -7,31 +7,44 @@ import clsx from 'clsx';
|
|
|
|
|
|
import { useGlobalCSS } from '../../hooks/use-global-css';
|
|
|
import { FloatPanel } from './float-panel';
|
|
|
-import { leftArea, rightArea, mainArea, bottomArea, globalCSS } from './css';
|
|
|
+import { globalCSS } from './css';
|
|
|
|
|
|
export type PanelLayerProps = React.PropsWithChildren<{
|
|
|
+ /** 模式:悬浮|挤压 */
|
|
|
+ mode?: 'floating' | 'docked';
|
|
|
className?: string;
|
|
|
style?: React.CSSProperties;
|
|
|
}>;
|
|
|
|
|
|
-export const PanelLayer: React.FC<PanelLayerProps> = ({ className, style, children }) => {
|
|
|
+export const PanelLayer: React.FC<PanelLayerProps> = ({
|
|
|
+ mode = 'floating',
|
|
|
+ className,
|
|
|
+ style,
|
|
|
+ children,
|
|
|
+}) => {
|
|
|
useGlobalCSS({
|
|
|
cssText: globalCSS,
|
|
|
id: 'flow-panel-layer-css',
|
|
|
});
|
|
|
|
|
|
return (
|
|
|
- <div className={clsx('gedit-flow-panel-layer-wrap', className)} style={style}>
|
|
|
- <div className="gedit-flow-panel-left-area" style={leftArea}>
|
|
|
- <div className="gedit-flow-panel-main-area" style={mainArea}>
|
|
|
- {children}
|
|
|
- </div>
|
|
|
- <div className="gedit-flow-panel-bottom-area" style={bottomArea}>
|
|
|
- <FloatPanel area="bottom" />
|
|
|
+ <div
|
|
|
+ className={clsx(
|
|
|
+ 'gedit-flow-panel-layer-wrap',
|
|
|
+ mode === 'docked' && 'gedit-flow-panel-layer-wrap-docked',
|
|
|
+ mode === 'floating' && 'gedit-flow-panel-layer-wrap-floating',
|
|
|
+ className
|
|
|
+ )}
|
|
|
+ style={style}
|
|
|
+ >
|
|
|
+ <div className="gedit-flow-panel-left-area">
|
|
|
+ <div className="gedit-flow-panel-main-area">{children}</div>
|
|
|
+ <div className="gedit-flow-panel-bottom-area">
|
|
|
+ <FloatPanel area={mode === 'docked' ? 'docked-bottom' : 'bottom'} />
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div className="gedit-flow-panel-right-area" style={rightArea}>
|
|
|
- <FloatPanel area="right" />
|
|
|
+ <div className="gedit-flow-panel-right-area">
|
|
|
+ <FloatPanel area={mode === 'docked' ? 'docked-right' : 'right'} />
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|