@windstream/react-shared-components 0.2.22 → 0.2.23
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/contentful/index.d.ts +5 -3
- package/dist/contentful/index.esm.js +3 -3
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +2 -2
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/styles.css +1 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/contentful/blocks/anchored-bottom-banner/AnchoredBottomBanner.stories.tsx +155 -0
- package/src/contentful/blocks/callout/Callout.stories.mocks.ts +327 -0
- package/src/contentful/blocks/callout/Callout.stories.tsx +315 -2
- package/src/contentful/blocks/callout/types.ts +1 -2
- package/src/contentful/blocks/email-input-block/index.tsx +41 -17
- package/src/contentful/blocks/email-input-block/types.ts +2 -1
- package/src/contentful/blocks/primary-hero/index.test.tsx +63 -0
- package/src/contentful/blocks/primary-hero/index.tsx +66 -9
- package/src/hooks/contentful/use-contentful-rich-text.test.tsx +29 -0
- package/src/hooks/contentful/use-contentful-rich-text.tsx +20 -9
- package/src/types/global.d.ts +5 -0
|
@@ -18,7 +18,7 @@ import { toDocument } from "@shared/utils/contentful/to-document";
|
|
|
18
18
|
|
|
19
19
|
const defaultOptions: Options = {
|
|
20
20
|
renderMark: {
|
|
21
|
-
[MARKS.BOLD]: text => <strong
|
|
21
|
+
[MARKS.BOLD]: text => <strong>{text}</strong>,
|
|
22
22
|
[MARKS.ITALIC]: text => <em>{text}</em>,
|
|
23
23
|
[MARKS.UNDERLINE]: text => <u>{text}</u>,
|
|
24
24
|
[MARKS.CODE]: text => <code>{text}</code>,
|
|
@@ -35,27 +35,27 @@ const defaultOptions: Options = {
|
|
|
35
35
|
);
|
|
36
36
|
},
|
|
37
37
|
[BLOCKS.HEADING_2]: (node, children) => (
|
|
38
|
-
<Text as="h2" className={"
|
|
38
|
+
<Text as="h2" className={"heading3 md:heading2"}>
|
|
39
39
|
{children}
|
|
40
40
|
</Text>
|
|
41
41
|
),
|
|
42
42
|
[BLOCKS.HEADING_3]: (node, children) => (
|
|
43
|
-
<Text as="h3" className={"
|
|
43
|
+
<Text as="h3" className={"heading4 md:heading3"}>
|
|
44
44
|
{children}
|
|
45
45
|
</Text>
|
|
46
46
|
),
|
|
47
47
|
[BLOCKS.HEADING_4]: (node, children) => (
|
|
48
|
-
<Text as="
|
|
48
|
+
<Text as="h4" className={"heading5 md:heading4"}>
|
|
49
49
|
{children}
|
|
50
50
|
</Text>
|
|
51
51
|
),
|
|
52
52
|
[BLOCKS.HEADING_5]: (node, children) => (
|
|
53
|
-
<Text as="
|
|
53
|
+
<Text as="h5" className={"heading6 md:heading5"}>
|
|
54
54
|
{children}
|
|
55
55
|
</Text>
|
|
56
56
|
),
|
|
57
57
|
[BLOCKS.HEADING_6]: (node, children) => (
|
|
58
|
-
<Text as="
|
|
58
|
+
<Text as="h6" className={"heading6"}>
|
|
59
59
|
{children}
|
|
60
60
|
</Text>
|
|
61
61
|
),
|
|
@@ -187,17 +187,28 @@ export function renderContentfulRichText(
|
|
|
187
187
|
|
|
188
188
|
export function useContentfulRichText(
|
|
189
189
|
doc: Document | null | undefined,
|
|
190
|
-
options?: Options
|
|
190
|
+
options?: Options,
|
|
191
|
+
config?: { boldClassName?: string }
|
|
191
192
|
): ReactNode | null {
|
|
192
193
|
return useMemo(() => {
|
|
193
194
|
if (!doc || !Array.isArray(doc.content)) return null;
|
|
194
195
|
const merged: Options = {
|
|
195
196
|
...defaultOptions,
|
|
196
|
-
renderMark: {
|
|
197
|
+
renderMark: {
|
|
198
|
+
...defaultOptions.renderMark,
|
|
199
|
+
...(config?.boldClassName
|
|
200
|
+
? {
|
|
201
|
+
[MARKS.BOLD]: text => (
|
|
202
|
+
<strong className={config.boldClassName}>{text}</strong>
|
|
203
|
+
),
|
|
204
|
+
}
|
|
205
|
+
: {}),
|
|
206
|
+
...options?.renderMark,
|
|
207
|
+
},
|
|
197
208
|
renderNode: { ...defaultOptions.renderNode, ...options?.renderNode },
|
|
198
209
|
};
|
|
199
210
|
return documentToReactComponents(doc, merged);
|
|
200
|
-
}, [doc, options]);
|
|
211
|
+
}, [doc, options, config?.boldClassName]);
|
|
201
212
|
}
|
|
202
213
|
// 1. Remove useMemo and React Hook imports from this specific function's logic
|
|
203
214
|
export function renderContentfulRichTextTable(
|