ywana-core8 0.0.191 → 0.0.192
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +7 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +7 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentViewer.css +0 -0
- package/src/domain/ContentViewer.js +51 -0
- package/src/domain/TablePage.js +1 -1
package/package.json
CHANGED
File without changes
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Property } from '../html'
|
3
|
+
import { TYPES } from './ContentType'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Content Viewer
|
7
|
+
*
|
8
|
+
* @param {*} props
|
9
|
+
* @returns
|
10
|
+
*/
|
11
|
+
export const ContentViewer = (props) => {
|
12
|
+
|
13
|
+
const { content, field } = props
|
14
|
+
|
15
|
+
if (!content) return <div>No Content...</div>
|
16
|
+
|
17
|
+
const sections = content.sections()
|
18
|
+
|
19
|
+
return (
|
20
|
+
<div className="content-viewer">
|
21
|
+
{sections.map(section => {
|
22
|
+
const { title, fields } = section
|
23
|
+
return (
|
24
|
+
<section key={title}>
|
25
|
+
<header>
|
26
|
+
{title}
|
27
|
+
</header>
|
28
|
+
<main>
|
29
|
+
{ fields.map( field => <FieldViewer key={field.id} field={field} value={content[field.id]} />)}
|
30
|
+
</main>
|
31
|
+
</section>
|
32
|
+
)
|
33
|
+
})}
|
34
|
+
</div>
|
35
|
+
)
|
36
|
+
}
|
37
|
+
|
38
|
+
const FieldViewer = (props) => {
|
39
|
+
|
40
|
+
const { field, value } = props
|
41
|
+
const { id, type, item, label } = field
|
42
|
+
|
43
|
+
console.log('FieldViewer', field, value)
|
44
|
+
|
45
|
+
switch(type) {
|
46
|
+
case TYPES.STRING:
|
47
|
+
return <Property label={label} value={value} />
|
48
|
+
default:
|
49
|
+
return <div>{label}</div>
|
50
|
+
}
|
51
|
+
}
|
package/src/domain/TablePage.js
CHANGED
@@ -145,7 +145,7 @@ const TableRowEditor = (props) => {
|
|
145
145
|
<Icon icon="close" clickable action={onClose} />
|
146
146
|
</Header>
|
147
147
|
<main>
|
148
|
-
{ editable ? <ContentEditor content={content} onChange={onChange} filter={filter} /> : <ContentViewer content={content} />
|
148
|
+
{ editable ? <ContentEditor content={content} onChange={onChange} filter={filter} /> : <ContentViewer content={content} /> }
|
149
149
|
</main>
|
150
150
|
</div>
|
151
151
|
)
|