@ndlib/component-library 0.0.102 → 0.0.104
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/components/composites/Seo/SeoDataDisplay/index.js +1 -1
- package/dist/components/composites/Seo/index.js +1 -1
- package/dist/components/composites/StructuredData/StructuredData.test.js +0 -1
- package/dist/components/composites/StructuredData/StructuredDataDisplay/index.js +5 -1
- package/dist/components/composites/StructuredData/index.js +1 -1
- package/dist/components/elements/Markdown/Markdown.stories.js +1 -1
- package/dist/components/elements/Markdown/Markdown.test.js +2 -1
- package/dist/components/elements/Markdown/index.js +7 -7
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import ReactDOMServer from 'react-dom/server';
|
|
|
3
3
|
import pretty from 'pretty';
|
|
4
4
|
import { Seo } from '../index';
|
|
5
5
|
export const SeoDataDisplay = () => {
|
|
6
|
-
const seoHtml = ReactDOMServer.renderToString(_jsx(Seo, {}));
|
|
6
|
+
const seoHtml = ReactDOMServer.renderToString(_jsx(Seo, { pathname: 'https://www.nd.edu/test' }));
|
|
7
7
|
return (_jsx("code", { children: _jsx("pre", { children: pretty(seoHtml) }) }));
|
|
8
8
|
};
|
|
9
9
|
export default SeoDataDisplay;
|
|
@@ -6,7 +6,7 @@ export const Seo = ({ title, description, image, nofollow, noindex, pathname, })
|
|
|
6
6
|
title: title || defaultTitle,
|
|
7
7
|
description: description || defaultDescription,
|
|
8
8
|
image: image ? image : defaultImage,
|
|
9
|
-
url:
|
|
9
|
+
url: pathname || siteUrl || '',
|
|
10
10
|
nofollow: nofollow || defaultNofollow,
|
|
11
11
|
noindex: noindex || defaultNoindex,
|
|
12
12
|
twitterUsername,
|
|
@@ -4,7 +4,6 @@ describe('getStructuredDataSchemas', () => {
|
|
|
4
4
|
const schemas = getStructuredDataSchemas({});
|
|
5
5
|
expect(schemas[0]).toContain('Hesburgh Component Library');
|
|
6
6
|
expect(schemas).toHaveLength(1);
|
|
7
|
-
console.log(schemas);
|
|
8
7
|
});
|
|
9
8
|
it('should generate structured data schemas with custom data', () => {
|
|
10
9
|
const customData = {
|
|
@@ -31,7 +31,11 @@ export const StructuredDataDisplay = () => {
|
|
|
31
31
|
publishedDate: '2023-04-30T04:00:00.000Z',
|
|
32
32
|
},
|
|
33
33
|
];
|
|
34
|
-
const schemas = getStructuredDataSchemas({
|
|
34
|
+
const schemas = getStructuredDataSchemas({
|
|
35
|
+
events: events,
|
|
36
|
+
news: news,
|
|
37
|
+
pathname: 'https://www.nd.edu/test',
|
|
38
|
+
});
|
|
35
39
|
return (_jsx(_Fragment, { children: schemas.map((schema, index) => (_jsxs("pre", { children: [_jsx("code", { children: schema }), _jsx("br", {})] }, index))) }));
|
|
36
40
|
};
|
|
37
41
|
export default StructuredDataDisplay;
|
|
@@ -11,7 +11,7 @@ export const getStructuredDataSchemas = ({ title, pathname, description, nofollo
|
|
|
11
11
|
nofollow: nofollow || defaultNofollow,
|
|
12
12
|
noindex: noindex || defaultNoindex,
|
|
13
13
|
image: image || defaultImage,
|
|
14
|
-
url:
|
|
14
|
+
url: pathname || siteUrl || '',
|
|
15
15
|
lang: 'en',
|
|
16
16
|
events: events,
|
|
17
17
|
news: news,
|
|
@@ -15,7 +15,6 @@ litora tellus ligula porttitor metus.
|
|
|
15
15
|
`;
|
|
16
16
|
export default meta;
|
|
17
17
|
const startingContent = `
|
|
18
|
-
|
|
19
18
|
# Inline styles
|
|
20
19
|
This paragraph has __bold content__ and **more bold content** and _italic content_ and *more italic content*
|
|
21
20
|
|
|
@@ -84,6 +83,7 @@ const htmlContent = `
|
|
|
84
83
|
></img>
|
|
85
84
|
<a href="https://google.com" class="embedly-card" data-card-width="100px" data-card-controls="0">Embedded content: https://google.com</a>
|
|
86
85
|
<iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FNDLibraries%2Fvideos%2F1673794309311939%2F&show_text=0&width=560" width="560" height="315" style="border:none;overflow:hidden" scrolling="no" frameborder="0" ></iframe>
|
|
86
|
+
${startingContent}
|
|
87
87
|
`;
|
|
88
88
|
export const WithHtml = {
|
|
89
89
|
render: (args) => _jsx(Markdown, Object.assign({}, args)),
|
|
@@ -54,6 +54,7 @@ const htmlMarkdown = `
|
|
|
54
54
|
<a href="https://google.com" class="embedly-card" data-card-width="100px" data-card-controls="0">Embedded content: https://google.com</a>
|
|
55
55
|
<iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FNDLibraries%2Fvideos%2F1673794309311939%2F&show_text=0&width=560" width="560" height="315" style="border:none;overflow:hidden" scrolling="no" frameborder="0"></iframe>
|
|
56
56
|
<img href="https://google.com"></img>
|
|
57
|
+
${testMarkdown}
|
|
57
58
|
`;
|
|
58
59
|
describe('Markdown', () => {
|
|
59
60
|
it('renders alert content', () => {
|
|
@@ -95,7 +96,7 @@ describe('Markdown', () => {
|
|
|
95
96
|
expect(getAllByRole('link')).toBeDefined();
|
|
96
97
|
expect(() => getByText(' ')).toThrow();
|
|
97
98
|
expect(container.getElementsByTagName('script')).toHaveLength(0);
|
|
98
|
-
expect(container.getElementsByTagName('img')).toHaveLength(
|
|
99
|
+
expect(container.getElementsByTagName('img')).toHaveLength(2);
|
|
99
100
|
expect(container.getElementsByTagName('iframe')).toHaveLength(1);
|
|
100
101
|
});
|
|
101
102
|
it('does not render html when disabled', () => {
|
|
@@ -31,29 +31,29 @@ export const DEFAULT_ALLOWED_ATTRIBUTES = Object.assign(Object.assign({}, saniti
|
|
|
31
31
|
]) });
|
|
32
32
|
const parseBlockquotes = (content) => {
|
|
33
33
|
const contentArray = content.split('\n');
|
|
34
|
-
|
|
34
|
+
const newContent = [];
|
|
35
35
|
let isAddingBlockquote = false;
|
|
36
36
|
for (const line of contentArray) {
|
|
37
37
|
if (line.startsWith('> ') && !isAddingBlockquote) {
|
|
38
38
|
const newLine = line.replace('> ', '');
|
|
39
|
-
newContent
|
|
39
|
+
newContent.push(`<blockquote>${newLine}`);
|
|
40
40
|
isAddingBlockquote = true;
|
|
41
41
|
}
|
|
42
42
|
else if (line.startsWith('> ') && isAddingBlockquote) {
|
|
43
|
-
newContent
|
|
43
|
+
newContent.push(line.replace('> ', ''));
|
|
44
44
|
}
|
|
45
45
|
else if (isAddingBlockquote) {
|
|
46
|
-
newContent
|
|
46
|
+
newContent.push(`</blockquote>\n\n${line}`);
|
|
47
47
|
isAddingBlockquote = false;
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
newContent
|
|
50
|
+
newContent.push(line);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
if (isAddingBlockquote) {
|
|
54
|
-
newContent
|
|
54
|
+
newContent.push('</blockquote>');
|
|
55
55
|
}
|
|
56
|
-
return newContent;
|
|
56
|
+
return newContent.join('\n');
|
|
57
57
|
};
|
|
58
58
|
const dynamicTopMarginStyles = {
|
|
59
59
|
[firstChildAltSelector]: {
|