레이아웃 추가기능
This commit is contained in:
49
frontend/lib/registry/layouts/split/SplitLayoutRenderer.tsx
Normal file
49
frontend/lib/registry/layouts/split/SplitLayoutRenderer.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
"use client";
|
||||
|
||||
import { AutoRegisteringLayoutRenderer } from "../AutoRegisteringLayoutRenderer";
|
||||
import { LayoutRendererProps } from "../BaseLayoutRenderer";
|
||||
import { SplitLayoutDefinition } from "./index";
|
||||
import { SplitLayout } from "./SplitLayout";
|
||||
|
||||
/**
|
||||
* split 렌더러 (새 구조)
|
||||
*/
|
||||
export class SplitLayoutRenderer extends AutoRegisteringLayoutRenderer {
|
||||
/**
|
||||
* 레이아웃 정의 (자동 등록용)
|
||||
*/
|
||||
static readonly layoutDefinition = SplitLayoutDefinition;
|
||||
|
||||
/**
|
||||
* 클래스 로드 시 자동 등록 실행
|
||||
*/
|
||||
static {
|
||||
this.registerSelf();
|
||||
}
|
||||
|
||||
/**
|
||||
* 렌더링 실행
|
||||
*/
|
||||
render(): React.ReactElement {
|
||||
return <SplitLayout {...this.props} renderer={this} />;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* React 함수 컴포넌트로 래핑 (외부 사용용)
|
||||
*/
|
||||
export const SplitLayoutComponent: React.FC<LayoutRendererProps> = (props) => {
|
||||
const renderer = new SplitLayoutRenderer(props);
|
||||
return renderer.render();
|
||||
};
|
||||
|
||||
// 개발 모드에서 Hot Reload 지원
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// HMR API 등록
|
||||
if ((module as any).hot) {
|
||||
(module as any).hot.accept();
|
||||
(module as any).hot.dispose(() => {
|
||||
SplitLayoutRenderer.unregisterSelf();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user