@graphcommerce/graphcms-ui 7.0.2-canary.6 → 7.0.2-canary.7
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 7.0.2-canary.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2071](https://github.com/graphcommerce-org/graphcommerce/pull/2071) [`68769398f`](https://github.com/graphcommerce-org/graphcommerce/commit/68769398f64604443a148583f1392976f71c2423) - feat(GCOM-1190): add renderer to support rendering Hygraph elements with a CSS class ([@FrankHarland](https://github.com/FrankHarland))
|
|
8
|
+
|
|
3
9
|
## 7.0.2-canary.6
|
|
4
10
|
|
|
5
11
|
## 7.0.2-canary.5
|
|
@@ -108,7 +108,6 @@ function RenderElement(element: ElementNode & AdditionalProps) {
|
|
|
108
108
|
|
|
109
109
|
// todo: this has the any type, could be improved
|
|
110
110
|
const Component: Renderer<SimpleElement> = renderers[type]
|
|
111
|
-
|
|
112
111
|
const sx = useRenderProps({ first, last, sxRenderer }, type)
|
|
113
112
|
|
|
114
113
|
if (Component) {
|
|
@@ -54,4 +54,5 @@ export const defaultRenderers: Renderers = {
|
|
|
54
54
|
bold: (props) => <Box component='strong' fontWeight='bold' {...props} />,
|
|
55
55
|
italic: (props) => <Box component='em' fontStyle='italic' {...props} />,
|
|
56
56
|
underlined: (props) => <Box component='span' {...props} />,
|
|
57
|
+
class: (props) => <Box component='div' {...props} />,
|
|
57
58
|
}
|
|
@@ -12,7 +12,6 @@ type BaseElementTypes =
|
|
|
12
12
|
| 'numbered-list'
|
|
13
13
|
| 'bulleted-list'
|
|
14
14
|
| 'block-quote'
|
|
15
|
-
| 'paragraph'
|
|
16
15
|
| 'list-item'
|
|
17
16
|
| 'list-item-child'
|
|
18
17
|
| 'table'
|
|
@@ -46,6 +45,12 @@ type LinkElement = {
|
|
|
46
45
|
openInNewTab?: boolean
|
|
47
46
|
}
|
|
48
47
|
|
|
48
|
+
type ClassElement = {
|
|
49
|
+
type: 'class'
|
|
50
|
+
children: ElementOrTextNode[]
|
|
51
|
+
className: string
|
|
52
|
+
}
|
|
53
|
+
|
|
49
54
|
type ImageElement = {
|
|
50
55
|
type: 'image'
|
|
51
56
|
children: ElementOrTextNode[]
|
|
@@ -74,7 +79,13 @@ type IframeElement = {
|
|
|
74
79
|
height?: number
|
|
75
80
|
}
|
|
76
81
|
|
|
77
|
-
export type ElementNode =
|
|
82
|
+
export type ElementNode =
|
|
83
|
+
| SimpleElement
|
|
84
|
+
| LinkElement
|
|
85
|
+
| ImageElement
|
|
86
|
+
| VideoElement
|
|
87
|
+
| IframeElement
|
|
88
|
+
| ClassElement
|
|
78
89
|
export type ElementOrTextNode = ElementNode | TextNode
|
|
79
90
|
|
|
80
91
|
type RendererBase = { sx?: SxProps<Theme>; children?: React.ReactNode }
|
|
@@ -89,6 +100,7 @@ export type Renderers = {
|
|
|
89
100
|
image: Renderer<ImageElement>
|
|
90
101
|
video: Renderer<VideoElement>
|
|
91
102
|
iframe: Renderer<IframeElement>
|
|
103
|
+
class: Renderer<ClassElement>
|
|
92
104
|
}
|
|
93
105
|
|
|
94
106
|
export type SxRenderer = {
|
|
@@ -100,4 +112,5 @@ export type AdditionalProps = {
|
|
|
100
112
|
sxRenderer: SxRenderer
|
|
101
113
|
first?: boolean
|
|
102
114
|
last?: boolean
|
|
115
|
+
className?: string
|
|
103
116
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/graphcms-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "7.0.2-canary.
|
|
5
|
+
"version": "7.0.2-canary.7",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "7.0.2-canary.
|
|
16
|
-
"@graphcommerce/prettier-config-pwa": "7.0.2-canary.
|
|
17
|
-
"@graphcommerce/typescript-config-pwa": "7.0.2-canary.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "7.0.2-canary.7",
|
|
16
|
+
"@graphcommerce/prettier-config-pwa": "7.0.2-canary.7",
|
|
17
|
+
"@graphcommerce/typescript-config-pwa": "7.0.2-canary.7"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@graphcommerce/graphql": "7.0.2-canary.
|
|
21
|
-
"@graphcommerce/image": "7.0.2-canary.
|
|
22
|
-
"@graphcommerce/next-ui": "7.0.2-canary.
|
|
20
|
+
"@graphcommerce/graphql": "7.0.2-canary.7",
|
|
21
|
+
"@graphcommerce/image": "7.0.2-canary.7",
|
|
22
|
+
"@graphcommerce/next-ui": "7.0.2-canary.7"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@mui/material": "^5.10.16",
|