-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #1164 POC: Render using a single catchAll siteMapping
- Loading branch information
Showing
31 changed files
with
24,448 additions
and
5,487 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// TODO 7.15.0-B1 release of @enonic-types/core | ||
// import type {Region} from '@enonic-types/core'; | ||
// import type {ComponentRegistry} from '@enonic/react-components'; | ||
|
||
// import './default.sass'; // Create Error reference failed | ||
import { toStr } from '@enonic/js-utils/value/toStr'; | ||
import { | ||
ComponentRegistry, | ||
XpRegions | ||
} from '@enonic/react-components'; | ||
import dayjs from 'dayjs'; | ||
|
||
|
||
export interface DefaultPageProps { | ||
componentRegistry?: ComponentRegistry; | ||
// regions: Record<string, Region>; | ||
regions: Record<string, unknown>; | ||
} | ||
|
||
|
||
export function DefaultPage(props: DefaultPageProps) { | ||
// console.info('DefaultPage props:', toStr(props)); | ||
return ( | ||
<div className="default-page"> | ||
{/* @ts-ignore */} | ||
<XpRegions {...props} /> | ||
<div>Page: {dayjs().format()}</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { | ||
ComponentRegistry, | ||
RichTextData | ||
} from '@enonic/react-components'; | ||
|
||
// import './example.sass'; | ||
import * as React from 'react'; | ||
import {RichText} from '@enonic/react-components'; | ||
|
||
export interface ExampleProps { | ||
data: RichTextData; | ||
componentRegistry?: ComponentRegistry; | ||
} | ||
|
||
export function ExamplePart({ | ||
componentRegistry, | ||
data | ||
}: ExampleProps) { | ||
// console.info('ExamplePart data', data); | ||
if (!data) { | ||
return <div>Example Part: Please fill in the htmlArea.</div>; | ||
} | ||
return ( | ||
<div data-portal-component-type="part"> | ||
<RichText | ||
componentRegistry={componentRegistry} | ||
data={data} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from 'react'; | ||
|
||
export interface InfoPanelProps { | ||
body: string | ||
header: string | ||
} | ||
|
||
export function InfoPanel({ | ||
body, | ||
header, | ||
}: InfoPanelProps) { | ||
return <div className="macro-panel macro-panel-info macro-panel-styled"><i className="icon"></i><strong>{header}</strong>{body}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// TODO 7.15.0-B1 release of @enonic-types/core | ||
// import type {Region} from '@enonic-types/core'; | ||
import type {ComponentRegistry} from '@enonic/react-components'; | ||
|
||
import { toStr } from '@enonic/js-utils/value/toStr'; | ||
import {XpRegions} from '@enonic/react-components'; | ||
import * as React from 'react'; | ||
// import dayjs from 'dayjs'; | ||
|
||
export interface TwoColumnsLayoutProps { | ||
componentRegistry?: ComponentRegistry; | ||
// regions: Record<string, Region>; | ||
regions: Record<string, unknown>; | ||
} | ||
|
||
export function TwoColumnsLayout (props: TwoColumnsLayoutProps) { | ||
console.debug('TwoColumnsLayout props:', toStr(props)); | ||
const regionsProps = { | ||
componentRegistry: props.componentRegistry, | ||
regions: props.regions | ||
}; | ||
console.debug('TwoColumnsLayout regionsProps:', toStr(regionsProps)); | ||
return <div data-portal-component-type="layout"> | ||
<div style={{ | ||
columnGap: '1em', | ||
display: 'grid', | ||
gridTemplateColumns: '1fr 1fr' | ||
}}> | ||
{/* @ts-ignore */} | ||
|
||
<XpRegions {...regionsProps}/> | ||
{/* <div>Layout: {dayjs().format()}</div> */} | ||
</div> | ||
</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// import { toStr } from '@enonic/js-utils/value/toStr'; | ||
import {ComponentRegistry} from '@enonic/react-components'; | ||
import * as React from 'react'; | ||
|
||
import {DefaultPage} from '../DefaultPage'; | ||
import {TwoColumnsLayout} from '../TwoColumnsLayout'; | ||
import {ExamplePart} from '../ExamplePart'; | ||
import {InfoPanel} from '../InfoPanel'; | ||
import {XpComponent} from '@enonic/react-components'; | ||
|
||
|
||
const componentRegistry = new ComponentRegistry; | ||
|
||
componentRegistry.addPage('com.enonic.app.react4xp:default', { | ||
View: DefaultPage | ||
}); | ||
|
||
componentRegistry.addLayout('com.enonic.app.react4xp:twoColumns', { | ||
View: TwoColumnsLayout | ||
}); | ||
|
||
componentRegistry.addPart('com.enonic.app.react4xp:example', { | ||
View: ExamplePart | ||
}); | ||
|
||
componentRegistry.addMacro('info', { | ||
View: InfoPanel | ||
}); | ||
|
||
|
||
export default (props) => { | ||
props.componentRegistry = componentRegistry; | ||
// console.info('App props sent to XpComponent:', toStr(props)); | ||
return ( | ||
<XpComponent {...props}/> | ||
); | ||
} |
Oops, something went wrong.