ywana-core8 0.0.194 → 0.0.195

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.194",
3
+ "version": "0.0.195",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -0,0 +1,3 @@
1
+ .content-viewer>main>.property {
2
+ border-bottom: solid 1px var(--divider-color);
3
+ }
@@ -22,7 +22,7 @@ export const ContentViewer = (props) => {
22
22
  {sections.map(section => {
23
23
  const { title, fields } = section
24
24
  return (
25
- <section key={title}>
25
+ <section key={title} className="content-viewer">
26
26
  <header>
27
27
  {title}
28
28
  </header>
@@ -36,6 +36,11 @@ export const ContentViewer = (props) => {
36
36
  )
37
37
  }
38
38
 
39
+ /**
40
+ * Field Viewer
41
+ * @param {} props
42
+ * @returns
43
+ */
39
44
  const FieldViewer = (props) => {
40
45
 
41
46
  const { field, value } = props
@@ -46,7 +51,30 @@ const FieldViewer = (props) => {
46
51
  switch(type) {
47
52
  case TYPES.STRING:
48
53
  return <Property label={label} value={value} />
54
+ case TYPES.ENTITY:
55
+ return <EntityViewer field={field} value={value} />
49
56
  default:
50
57
  return <div>{label}</div>
51
58
  }
59
+ }
60
+
61
+ /**
62
+ * EntityViewer
63
+ */
64
+ const EntityViewer = (props) => {
65
+ const { field, value } = props
66
+ const { item, label } = field
67
+ const content = new Content(item, value)
68
+ const form = content.form()
69
+ const fields = Object.keys(form).map(key => form[key])
70
+ return (
71
+ <div className='entity-viewer'>
72
+ <header>
73
+ {label}
74
+ </header>
75
+ <main>
76
+ { fields.map( field => <FieldViewer field={field} value={value[field.id]} /> )}
77
+ </main>
78
+ </div>
79
+ )
52
80
  }