@popsure/dirty-swan 0.51.3 → 0.52.0

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.
Files changed (31) hide show
  1. package/dist/cjs/index.d.ts +1 -1
  2. package/dist/cjs/index.js +207 -39034
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/lib/index.d.ts +1 -2
  5. package/dist/esm/components/modal/genericModal/index.js +1 -1
  6. package/dist/esm/components/modal/genericModal/index.js.map +1 -1
  7. package/dist/esm/components/modal/index.stories.js +3 -10
  8. package/dist/esm/components/modal/index.stories.js.map +1 -1
  9. package/dist/esm/index.d.ts +1 -1
  10. package/dist/esm/index.js +0 -6
  11. package/dist/esm/index.js.map +1 -1
  12. package/dist/esm/lib/index.d.ts +1 -2
  13. package/package.json +1 -5
  14. package/src/index.tsx +0 -1
  15. package/src/lib/components/modal/genericModal/index.tsx +1 -0
  16. package/src/lib/components/modal/index.stories.tsx +7 -16
  17. package/src/lib/index.tsx +0 -2
  18. package/dist/cjs/lib/components/markdown/config.d.ts +0 -22
  19. package/dist/cjs/lib/components/markdown/index.d.ts +0 -10
  20. package/dist/cjs/lib/components/markdown/index.stories.d.ts +0 -39
  21. package/dist/esm/components/markdown/index.js +0 -38833
  22. package/dist/esm/components/markdown/index.js.map +0 -1
  23. package/dist/esm/components/markdown/index.stories.js +0 -61
  24. package/dist/esm/components/markdown/index.stories.js.map +0 -1
  25. package/dist/esm/lib/components/markdown/config.d.ts +0 -22
  26. package/dist/esm/lib/components/markdown/index.d.ts +0 -10
  27. package/dist/esm/lib/components/markdown/index.stories.d.ts +0 -39
  28. package/src/lib/components/markdown/config.ts +0 -45
  29. package/src/lib/components/markdown/index.stories.tsx +0 -185
  30. package/src/lib/components/markdown/index.tsx +0 -163
  31. package/src/lib/components/markdown/styles.module.scss +0 -37
@@ -1,61 +0,0 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { Markdown } from './index.js';
3
- import '../../tslib.es6-5bc94358.js';
4
- import '../../style-inject.es-1f59c1d0.js';
5
- import 'devlop';
6
- import 'vfile/do-not-use-conditional-minpath';
7
- import 'vfile/do-not-use-conditional-minproc';
8
- import 'vfile/do-not-use-conditional-minurl';
9
- import 'unist-util-visit-parents/do-not-use-color';
10
- import '../../_commonjsHelpers-e7f67fd8.js';
11
-
12
- var story = {
13
- title: 'JSX/Markdown',
14
- component: Markdown,
15
- argTypes: {
16
- children: {
17
- description: 'MD content to be rendered in the component.',
18
- },
19
- className: {
20
- description: 'This property allows to add custom styles to the component.',
21
- },
22
- renderRawMarkdownChild: {
23
- description: 'This property allows to render the raw markdown child as a component.',
24
- },
25
- openLinksInNewTab: {
26
- description: 'Wether link components rendered inside Markdown should open in a new tab (`target="_blank"`).',
27
- },
28
- styling: {
29
- desription: 'This property allows to customize the styling of the markdown content.',
30
- }
31
- },
32
- args: {
33
- children: '## Title \n This is **our content**.',
34
- className: '',
35
- renderRawMarkdownChild: false,
36
- openLinksInNewTab: false,
37
- styling: {},
38
- },
39
- parameters: {
40
- componentSubtitle: (jsxs(Fragment, { children: ["Display markdown text based on ", jsx("a", { href: "https://github.com/remarkjs/react-markdown", target: '_blank', rel: "noreferrer", children: "react-markdown" }), " with custom styling."] })),
41
- },
42
- };
43
- var MarkdownStory = function (_a) {
44
- var children = _a.children, className = _a.className;
45
- return (jsx(Markdown, { className: className, children: children }));
46
- };
47
- MarkdownStory.storyName = "Markdown";
48
- var AvailableMDComponents = function (_a) {
49
- var className = _a.className;
50
- return (jsx(Markdown, { className: className, children: "\n## Headers\nThe header options range from h1 to h4.\n\n```\n# H1\n## H2\n### H3\n#### H4\n```\n\n# H1 Lorem ipsum non sunt qui sunt\n\n## H2 Lorem ipsum non sunt qui sunt\n\n### H3 Lorem ipsum non sunt qui sunt\n\n#### H4 Lorem ipsum non sunt qui sunt\n\n## Emphasis\n\n```\nEmphasis or italics, use *asterisk* or _underscore_.\nStrong emphasis or bold, use **asterisks** or __underscores__.\nCombined emphasis, use **_asterisks and underscores_**.\n```\n\nEmphasis or italics, use _asterisk_ or _underscore_.\n\nStrong emphasis or bold, use **asterisks** or **underscores**.\n\nCombined emphasis, use **_asterisks and underscores_**.\n\n## Lists\n\n```\n1. First ordered list item\n2. Another item\n3. Actual numbers don't matter, just that it's a number\n4. And another item.\n\n* Unordered list can use asterisks\n- Or minuses\n+ Or pluses\n```\n\n1. First ordered list item\n2. Another item\n3. Actual numbers don't matter, just that it's a number\n4. And another item.\n\n- Unordered list can use asterisks\n- Or minuses\n- Or pluses\n\n## Links\n\nFor links markdown syntax should be used.\n\n```\n[This is an inline link](https://feather-insurance.com)\n```\n\n[This is an inline link](https://feather-insurance.com)\n\n## Inline code block\n\nInline code block can be set by using backtick or ```\n\n```\nIt is usefull to define a `variable` inside a text\n```\n\nIt is usefull to define a `variable` inside a text\n\n## Quote\n\nYou can use quote markdown by using `>` at the beginning of your text\n\n```\n> The busy man is least busy with living. - Seneca\n```\n\n> The busy man is least busy with living. - Seneca\n\n## Images\n\nImages markdown syntax is the following\n```\n![Feather logo](https://feather-website.cdn.prismic.io/feather-website/88519fe0-d85f-47d3-83d7-20a74ee94591_feather-logo-icon.svg)\n```\n\n![Feather logo](https://feather-website.cdn.prismic.io/feather-website/88519fe0-d85f-47d3-83d7-20a74ee94591_feather-logo-icon.svg)\n\n## Tables\n\nDefining a table in markdown is a bit tricky. You can use websites such as [tablesgenerator.com](https://www.tablesgenerator.com/markdown_tables) for help\n\n```\n| Department | Yearly spend | Category |\n|------------|--------------|----------|\n| Marketing | 150k\u20AC | `c` |\n| Sales | 200k\u20AC | `e` |\n| Product | 84k\u20AC | `f` |\n```\n\n| Department | Yearly spend | Category |\n|------------|--------------|----------|\n| Marketing | 150k\u20AC | `c` |\n| Sales | 200k\u20AC | `e` |\n| Product | 84k\u20AC | `f` |\n\n" }));
51
- };
52
- var AddingCustomComponents = function (_a) {
53
- var className = _a.className, openLinksInNewTab = _a.openLinksInNewTab, renderRawMarkdownChild = _a.renderRawMarkdownChild;
54
- return (jsx(Markdown, { className: className, openLinksInNewTab: openLinksInNewTab, styling: {
55
- h6: 'tc-red-500'
56
- }, renderRawMarkdownChild: renderRawMarkdownChild, children: "###### This is a custom H6 that will always be red" }));
57
- };
58
-
59
- export default story;
60
- export { AddingCustomComponents, AvailableMDComponents, MarkdownStory };
61
- //# sourceMappingURL=index.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/markdown/index.stories.tsx"],"sourcesContent":["import { render } from 'sass';\nimport { Markdown, MarkdownProps } from '.';\n\nconst story = {\n title: 'JSX/Markdown',\n component: Markdown,\n argTypes: {\n \n children: {\n description: 'MD content to be rendered in the component.',\n },\n className: {\n description: 'This property allows to add custom styles to the component.',\n },\n renderRawMarkdownChild: {\n description: 'This property allows to render the raw markdown child as a component.',\n },\n openLinksInNewTab: {\n description: 'Wether link components rendered inside Markdown should open in a new tab (`target=\"_blank\"`).',\n },\n styling: {\n desription: 'This property allows to customize the styling of the markdown content.',\n }\n },\n args: {\n children: '## Title \\n This is **our content**.',\n className: '',\n renderRawMarkdownChild: false,\n openLinksInNewTab: false,\n styling: {},\n },\n parameters: {\n componentSubtitle: (\n <>\n Display markdown text based on <a href=\"https://github.com/remarkjs/react-markdown\" target='_blank' rel=\"noreferrer\">react-markdown</a> with custom styling.\n </>\n ),\n },\n};\n\nexport const MarkdownStory = ({ children, className }: MarkdownProps) => (\n <Markdown className={className}>\n {children}\n </Markdown>\n);\n\nMarkdownStory.storyName = \"Markdown\";\n\nexport const AvailableMDComponents = ({ className }: MarkdownProps) => (\n <Markdown className={className}>\n {`\n## Headers\nThe header options range from h1 to h4.\n\n\\`\\`\\`\n# H1\n## H2\n### H3\n#### H4\n\\`\\`\\`\n\n# H1 Lorem ipsum non sunt qui sunt\n\n## H2 Lorem ipsum non sunt qui sunt\n\n### H3 Lorem ipsum non sunt qui sunt\n\n#### H4 Lorem ipsum non sunt qui sunt\n\n## Emphasis\n\n\\`\\`\\`\nEmphasis or italics, use *asterisk* or _underscore_.\nStrong emphasis or bold, use **asterisks** or __underscores__.\nCombined emphasis, use **_asterisks and underscores_**.\n\\`\\`\\`\n\nEmphasis or italics, use _asterisk_ or _underscore_.\n\nStrong emphasis or bold, use **asterisks** or **underscores**.\n\nCombined emphasis, use **_asterisks and underscores_**.\n\n## Lists\n\n\\`\\`\\`\n1. First ordered list item\n2. Another item\n3. Actual numbers don't matter, just that it's a number\n4. And another item.\n\n* Unordered list can use asterisks\n- Or minuses\n+ Or pluses\n\\`\\`\\`\n\n1. First ordered list item\n2. Another item\n3. Actual numbers don't matter, just that it's a number\n4. And another item.\n\n- Unordered list can use asterisks\n- Or minuses\n- Or pluses\n\n## Links\n\nFor links markdown syntax should be used.\n\n\\`\\`\\`\n[This is an inline link](https://feather-insurance.com)\n\\`\\`\\`\n\n[This is an inline link](https://feather-insurance.com)\n\n## Inline code block\n\nInline code block can be set by using backtick or \\`\\`\\`\n\n\\`\\`\\`\nIt is usefull to define a \\`variable\\` inside a text\n\\`\\`\\`\n\nIt is usefull to define a \\`variable\\` inside a text\n\n## Quote\n\nYou can use quote markdown by using \\`>\\` at the beginning of your text\n\n\\`\\`\\`\n> The busy man is least busy with living. - Seneca\n\\`\\`\\`\n\n> The busy man is least busy with living. - Seneca\n\n## Images\n\nImages markdown syntax is the following\n\\`\\`\\`\n![Feather logo](https://feather-website.cdn.prismic.io/feather-website/88519fe0-d85f-47d3-83d7-20a74ee94591_feather-logo-icon.svg)\n\\`\\`\\`\n\n![Feather logo](https://feather-website.cdn.prismic.io/feather-website/88519fe0-d85f-47d3-83d7-20a74ee94591_feather-logo-icon.svg)\n\n## Tables\n\nDefining a table in markdown is a bit tricky. You can use websites such as [tablesgenerator.com](https://www.tablesgenerator.com/markdown_tables) for help\n\n\\`\\`\\`\n| Department | Yearly spend | Category |\n|------------|--------------|----------|\n| Marketing | 150k€ | \\`c\\` |\n| Sales | 200k€ | \\`e\\` |\n| Product | 84k€ | \\`f\\` |\n\\`\\`\\`\n\n| Department | Yearly spend | Category |\n|------------|--------------|----------|\n| Marketing | 150k€ | \\`c\\` |\n| Sales | 200k€ | \\`e\\` |\n| Product | 84k€ | \\`f\\` |\n\n`}\n </Markdown>\n);\n\nexport const AddingCustomComponents = ({ \n className,\n openLinksInNewTab,\n renderRawMarkdownChild\n }: MarkdownProps) => (\n <Markdown\n className={className}\n openLinksInNewTab={openLinksInNewTab}\n styling={{\n h6: 'tc-red-500'\n }}\n renderRawMarkdownChild={renderRawMarkdownChild}\n\n >\n ###### This is a custom H6 that will always be red\n </Markdown>\n);\n\nexport default story;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;IAGM,KAAK,GAAG;IACZ,KAAK,EAAE,cAAc;IACrB,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE;QAER,QAAQ,EAAE;YACR,WAAW,EAAE,6CAA6C;SAC3D;QACD,SAAS,EAAE;YACT,WAAW,EAAE,6DAA6D;SAC3E;QACD,sBAAsB,EAAE;YACtB,WAAW,EAAE,uEAAuE;SACrF;QACD,iBAAiB,EAAE;YACjB,WAAW,EAAE,+FAA+F;SAC7G;QACD,OAAO,EAAE;YACP,UAAU,EAAE,wEAAwE;SACrF;KACF;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,sCAAsC;QAChD,SAAS,EAAE,EAAE;QACb,sBAAsB,EAAE,KAAK;QAC7B,iBAAiB,EAAE,KAAK;QACxB,OAAO,EAAE,EAAE;KACZ;IACD,UAAU,EAAE;QACV,iBAAiB,GACfA,+DACiCC,WAAG,IAAI,EAAC,4CAA4C,EAAC,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,YAAY,+BAAmB,6BACtI,CACJ;KACF;EACD;IAEW,aAAa,GAAG,UAAC,EAAsC;QAApC,QAAQ,cAAA,EAAE,SAAS,eAAA;IAAsB,QACvEA,IAAC,QAAQ,IAAC,SAAS,EAAE,SAAS,YAC3B,QAAQ,GACA;AAH4D,EAIvE;AAEF,aAAa,CAAC,SAAS,GAAG,UAAU,CAAC;IAExB,qBAAqB,GAAG,UAAC,EAA4B;QAA1B,SAAS,eAAA;IAAsB,QACrEA,IAAC,QAAQ,IAAC,SAAS,EAAE,SAAS,YAC3B,4hFAgHJ,GACY;AAnH0D,EAoHrE;IAEW,sBAAsB,GAAG,UAAC,EAItB;QAHf,SAAS,eAAA,EACT,iBAAiB,uBAAA,EACjB,sBAAsB,4BAAA;IACF,QACpBA,IAAC,QAAQ,IACP,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE;YACP,EAAE,EAAE,YAAY;SACjB,EACD,sBAAsB,EAAE,sBAAsB,mEAIrC;AAXS;;;;;"}
@@ -1,22 +0,0 @@
1
- export interface MarkdownStyling {
2
- a: string;
3
- p: string;
4
- h1: string;
5
- h2: string;
6
- h3: string;
7
- h4: string;
8
- h5: string;
9
- h6: string;
10
- ol: string;
11
- ul: string;
12
- strong: string;
13
- em: string;
14
- table: string;
15
- th: string;
16
- tr: string;
17
- td: string;
18
- blockquote: string;
19
- code: string;
20
- pre: string;
21
- }
22
- export declare const defaultStyling: MarkdownStyling;
@@ -1,10 +0,0 @@
1
- import { MarkdownStyling } from './config';
2
- export interface MarkdownProps {
3
- children: string;
4
- className?: string;
5
- openLinksInNewTab?: boolean;
6
- styling?: Partial<MarkdownStyling>;
7
- renderRawMarkdownChild?: boolean;
8
- }
9
- declare const Markdown: ({ children: rawMarkdownChild, className, openLinksInNewTab, styling: rawStyling, renderRawMarkdownChild }: MarkdownProps) => JSX.Element;
10
- export { Markdown };
@@ -1,39 +0,0 @@
1
- import { MarkdownProps } from '.';
2
- declare const story: {
3
- title: string;
4
- component: ({ children: rawMarkdownChild, className, openLinksInNewTab, styling: rawStyling, renderRawMarkdownChild }: MarkdownProps) => JSX.Element;
5
- argTypes: {
6
- children: {
7
- description: string;
8
- };
9
- className: {
10
- description: string;
11
- };
12
- renderRawMarkdownChild: {
13
- description: string;
14
- };
15
- openLinksInNewTab: {
16
- description: string;
17
- };
18
- styling: {
19
- desription: string;
20
- };
21
- };
22
- args: {
23
- children: string;
24
- className: string;
25
- renderRawMarkdownChild: boolean;
26
- openLinksInNewTab: boolean;
27
- styling: {};
28
- };
29
- parameters: {
30
- componentSubtitle: JSX.Element;
31
- };
32
- };
33
- export declare const MarkdownStory: {
34
- ({ children, className }: MarkdownProps): JSX.Element;
35
- storyName: string;
36
- };
37
- export declare const AvailableMDComponents: ({ className }: MarkdownProps) => JSX.Element;
38
- export declare const AddingCustomComponents: ({ className, openLinksInNewTab, renderRawMarkdownChild }: MarkdownProps) => JSX.Element;
39
- export default story;
@@ -1,45 +0,0 @@
1
- import styles from './styles.module.scss';
2
-
3
- export interface MarkdownStyling {
4
- a: string;
5
- p: string;
6
- h1: string;
7
- h2: string;
8
- h3: string;
9
- h4: string;
10
- h5: string;
11
- h6: string;
12
- ol: string;
13
- ul: string;
14
- strong: string;
15
- em: string;
16
- table: string;
17
- th: string;
18
- tr: string;
19
- td: string;
20
- blockquote: string;
21
- code: string;
22
- pre: string;
23
- }
24
-
25
- export const defaultStyling: MarkdownStyling = {
26
- a: 'p-a',
27
- p: 'p-p mt8',
28
- h1: 'p-h1 p--serif mt32',
29
- h2: 'p-h2 mt24',
30
- h3: 'p-h3 mt16',
31
- h4: 'p-h4 mt8',
32
- h5: 'p-h5 mt8',
33
- h6: 'p-h6 mt8',
34
- ol: `p-p ${styles.olist} mt8`,
35
- ul: `p-p ${styles.ulist} mt8`,
36
- strong: 'fw-bold',
37
- em: 'fs-italic',
38
- table: `w100 mt24 ${styles.table}`,
39
- th: 'p-h4',
40
- tr: styles.row,
41
- td: 'px8 py8 tc-grey-700',
42
- blockquote: 'bg-grey-200 my24 px24 pt16 pb24 br8',
43
- code: styles.code,
44
- pre: `d-block tc-grey-200 bg-grey-900 px16 py16 my16 br8 ${styles.pre}`,
45
- };
@@ -1,185 +0,0 @@
1
- import { render } from 'sass';
2
- import { Markdown, MarkdownProps } from '.';
3
-
4
- const story = {
5
- title: 'JSX/Markdown',
6
- component: Markdown,
7
- argTypes: {
8
-
9
- children: {
10
- description: 'MD content to be rendered in the component.',
11
- },
12
- className: {
13
- description: 'This property allows to add custom styles to the component.',
14
- },
15
- renderRawMarkdownChild: {
16
- description: 'This property allows to render the raw markdown child as a component.',
17
- },
18
- openLinksInNewTab: {
19
- description: 'Wether link components rendered inside Markdown should open in a new tab (`target="_blank"`).',
20
- },
21
- styling: {
22
- desription: 'This property allows to customize the styling of the markdown content.',
23
- }
24
- },
25
- args: {
26
- children: '## Title \n This is **our content**.',
27
- className: '',
28
- renderRawMarkdownChild: false,
29
- openLinksInNewTab: false,
30
- styling: {},
31
- },
32
- parameters: {
33
- componentSubtitle: (
34
- <>
35
- Display markdown text based on <a href="https://github.com/remarkjs/react-markdown" target='_blank' rel="noreferrer">react-markdown</a> with custom styling.
36
- </>
37
- ),
38
- },
39
- };
40
-
41
- export const MarkdownStory = ({ children, className }: MarkdownProps) => (
42
- <Markdown className={className}>
43
- {children}
44
- </Markdown>
45
- );
46
-
47
- MarkdownStory.storyName = "Markdown";
48
-
49
- export const AvailableMDComponents = ({ className }: MarkdownProps) => (
50
- <Markdown className={className}>
51
- {`
52
- ## Headers
53
- The header options range from h1 to h4.
54
-
55
- \`\`\`
56
- # H1
57
- ## H2
58
- ### H3
59
- #### H4
60
- \`\`\`
61
-
62
- # H1 Lorem ipsum non sunt qui sunt
63
-
64
- ## H2 Lorem ipsum non sunt qui sunt
65
-
66
- ### H3 Lorem ipsum non sunt qui sunt
67
-
68
- #### H4 Lorem ipsum non sunt qui sunt
69
-
70
- ## Emphasis
71
-
72
- \`\`\`
73
- Emphasis or italics, use *asterisk* or _underscore_.
74
- Strong emphasis or bold, use **asterisks** or __underscores__.
75
- Combined emphasis, use **_asterisks and underscores_**.
76
- \`\`\`
77
-
78
- Emphasis or italics, use _asterisk_ or _underscore_.
79
-
80
- Strong emphasis or bold, use **asterisks** or **underscores**.
81
-
82
- Combined emphasis, use **_asterisks and underscores_**.
83
-
84
- ## Lists
85
-
86
- \`\`\`
87
- 1. First ordered list item
88
- 2. Another item
89
- 3. Actual numbers don't matter, just that it's a number
90
- 4. And another item.
91
-
92
- * Unordered list can use asterisks
93
- - Or minuses
94
- + Or pluses
95
- \`\`\`
96
-
97
- 1. First ordered list item
98
- 2. Another item
99
- 3. Actual numbers don't matter, just that it's a number
100
- 4. And another item.
101
-
102
- - Unordered list can use asterisks
103
- - Or minuses
104
- - Or pluses
105
-
106
- ## Links
107
-
108
- For links markdown syntax should be used.
109
-
110
- \`\`\`
111
- [This is an inline link](https://feather-insurance.com)
112
- \`\`\`
113
-
114
- [This is an inline link](https://feather-insurance.com)
115
-
116
- ## Inline code block
117
-
118
- Inline code block can be set by using backtick or \`\`\`
119
-
120
- \`\`\`
121
- It is usefull to define a \`variable\` inside a text
122
- \`\`\`
123
-
124
- It is usefull to define a \`variable\` inside a text
125
-
126
- ## Quote
127
-
128
- You can use quote markdown by using \`>\` at the beginning of your text
129
-
130
- \`\`\`
131
- > The busy man is least busy with living. - Seneca
132
- \`\`\`
133
-
134
- > The busy man is least busy with living. - Seneca
135
-
136
- ## Images
137
-
138
- Images markdown syntax is the following
139
- \`\`\`
140
- ![Feather logo](https://feather-website.cdn.prismic.io/feather-website/88519fe0-d85f-47d3-83d7-20a74ee94591_feather-logo-icon.svg)
141
- \`\`\`
142
-
143
- ![Feather logo](https://feather-website.cdn.prismic.io/feather-website/88519fe0-d85f-47d3-83d7-20a74ee94591_feather-logo-icon.svg)
144
-
145
- ## Tables
146
-
147
- Defining a table in markdown is a bit tricky. You can use websites such as [tablesgenerator.com](https://www.tablesgenerator.com/markdown_tables) for help
148
-
149
- \`\`\`
150
- | Department | Yearly spend | Category |
151
- |------------|--------------|----------|
152
- | Marketing | 150k€ | \`c\` |
153
- | Sales | 200k€ | \`e\` |
154
- | Product | 84k€ | \`f\` |
155
- \`\`\`
156
-
157
- | Department | Yearly spend | Category |
158
- |------------|--------------|----------|
159
- | Marketing | 150k€ | \`c\` |
160
- | Sales | 200k€ | \`e\` |
161
- | Product | 84k€ | \`f\` |
162
-
163
- `}
164
- </Markdown>
165
- );
166
-
167
- export const AddingCustomComponents = ({
168
- className,
169
- openLinksInNewTab,
170
- renderRawMarkdownChild
171
- }: MarkdownProps) => (
172
- <Markdown
173
- className={className}
174
- openLinksInNewTab={openLinksInNewTab}
175
- styling={{
176
- h6: 'tc-red-500'
177
- }}
178
- renderRawMarkdownChild={renderRawMarkdownChild}
179
-
180
- >
181
- ###### This is a custom H6 that will always be red
182
- </Markdown>
183
- );
184
-
185
- export default story;
@@ -1,163 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import ReactMarkdown from 'react-markdown';
3
- import rehypeRaw from 'rehype-raw';
4
- import remarkDirective from 'remark-directive';
5
- import remarkGfm from 'remark-gfm';
6
-
7
- import { MarkdownStyling, defaultStyling } from './config';
8
-
9
- type ComponentProps = {
10
- children?: ReactNode;
11
- }
12
-
13
- export interface MarkdownProps {
14
- children: string;
15
- className?: string;
16
- openLinksInNewTab?: boolean;
17
- styling?: Partial<MarkdownStyling>;
18
- renderRawMarkdownChild?: boolean;
19
- }
20
-
21
- const Markdown = ({
22
- children: rawMarkdownChild,
23
- className = '',
24
- openLinksInNewTab = false,
25
- styling: rawStyling,
26
- renderRawMarkdownChild = false
27
- }: MarkdownProps) => {
28
- const styling = { ...defaultStyling, ...rawStyling };
29
-
30
- if (renderRawMarkdownChild) {
31
- return <>{rawMarkdownChild}</>;
32
- }
33
-
34
- const Link = ({ children, href }: ComponentProps & { href?: string }) =>
35
- openLinksInNewTab ? (
36
- <a href={href} className={styling.a} target="_blank" rel="noreferrer">
37
- {children}
38
- </a>
39
- ) : (
40
- <a href={href} className={styling.a}>
41
- {children}
42
- </a>
43
- );
44
-
45
- const Paragraph = ({ children }: ComponentProps) => (
46
- <p className={styling.p}>{children}</p>
47
- );
48
-
49
- const Heading = ({
50
- children,
51
- node,
52
- }: ComponentProps & { node?: { tagName: string } }) => {
53
- switch (node?.tagName) {
54
- case 'h1':
55
- return <h1 className={styling.h1}>{children}</h1>;
56
- case 'h2':
57
- return <h2 className={styling.h2}>{children}</h2>;
58
- case 'h3':
59
- return <h3 className={styling.h3}>{children}</h3>;
60
- case 'h4':
61
- return <h4 className={styling.h4}>{children}</h4>;
62
- case 'h5':
63
- return <h5 className={styling.h5}>{children}</h5>;
64
- case 'h6':
65
- return <h6 className={styling.h6}>{children}</h6>;
66
- default:
67
- return <p>{children}</p>;
68
- }
69
- };
70
-
71
- const UList = ({ children }: ComponentProps) => {
72
- return <ul className={styling.ul}>{children}</ul>;
73
- };
74
-
75
- const OList = ({ children }: ComponentProps) => {
76
- return <ol className={styling.ol}>{children}</ol>;
77
- };
78
-
79
- const Strong = ({ children }: ComponentProps) => {
80
- return <strong className={styling.strong}>{children}</strong>;
81
- };
82
-
83
- const Emphasis = ({ children }: ComponentProps) => {
84
- return <em className={styling.em}>{children}</em>;
85
- };
86
-
87
- const Table = ({ children }: ComponentProps) => {
88
- return <table className={styling.table}>{children}</table>;
89
- };
90
-
91
- const TableRow = ({ children }: ComponentProps) => {
92
- return <tr className={styling.tr}>{children}</tr>;
93
- };
94
-
95
- const TableCell = ({ children }: ComponentProps) => {
96
- return <td className={styling.td}>{children}</td>;
97
- };
98
-
99
- const TableHeader = ({ children }: ComponentProps) => {
100
- return <th className={styling.th}>{children}</th>;
101
- };
102
-
103
- const Image = ({
104
- src,
105
- alt,
106
- ...props
107
- }: {
108
- src?: string | undefined;
109
- alt?: string | undefined;
110
- }) => {
111
- return (
112
- <a href={src} target="_blank" rel="noreferrer noreferrer">
113
- <img style={{ maxWidth: '100%' }} src={src} alt={alt} {...props} />
114
- </a>
115
- );
116
- };
117
-
118
- const BlockQuote = ({ children }: ComponentProps) => {
119
- return <blockquote className={styling.blockquote}>{children}</blockquote>;
120
- };
121
-
122
- const Pre = ({ children }: ComponentProps) => {
123
- return <pre className={styling.pre}>{children}</pre>;
124
- };
125
-
126
- const Code = ({ children }: ComponentProps) => {
127
- return <code className={styling.code}>{children}</code>;
128
- };
129
-
130
- return (
131
- <ReactMarkdown
132
- className={className}
133
- components={{
134
- a: Link,
135
- p: Paragraph,
136
- h1: Heading,
137
- h2: Heading,
138
- h3: Heading,
139
- h4: Heading,
140
- h5: Heading,
141
- h6: Heading,
142
- ol: OList,
143
- ul: UList,
144
- strong: Strong,
145
- em: Emphasis,
146
- table: Table,
147
- th: TableHeader,
148
- tr: TableRow,
149
- td: TableCell,
150
- blockquote: BlockQuote,
151
- img: Image,
152
- code: Code,
153
- pre: Pre,
154
- }}
155
- rehypePlugins={[rehypeRaw]}
156
- remarkPlugins={[remarkDirective, remarkGfm]}
157
- >
158
- {rawMarkdownChild}
159
- </ReactMarkdown>
160
- );
161
- };
162
-
163
- export { Markdown };
@@ -1,37 +0,0 @@
1
- @use "../../scss/public/colors" as *;
2
-
3
- .ulist {
4
- list-style-type: disc;
5
- list-style-position: outside;
6
- padding-left: 16px;
7
-
8
- > li {
9
- padding-left: 8px;
10
- }
11
- }
12
-
13
- .olist {
14
- list-style-type: decimal;
15
- list-style-position: inside;
16
- }
17
-
18
- .table td,
19
- .table th {
20
- border: 1px solid $ds-grey-300;
21
- }
22
-
23
- .pre {
24
- line-height: 24px;
25
- }
26
-
27
- .code {
28
- font-family: monospace;
29
- padding: 2px 4px;
30
- }
31
-
32
- :not(.pre) > .code {
33
- border: 1px solid $ds-grey-400;
34
- background-color: $ds-grey-200;
35
- color: $ds-red-500;
36
- border-radius: 4px;
37
- }