@san-siva/blogkit 1.0.12 → 1.1.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 (196) hide show
  1. package/README.md +64 -13
  2. package/dist/cjs/components/Blog.js +3 -118
  3. package/dist/cjs/components/Blog.js.map +1 -1
  4. package/dist/cjs/components/BlogHeader.js +4 -4
  5. package/dist/cjs/components/BlogHeader.js.map +1 -1
  6. package/dist/cjs/components/BlogLink.js +4 -23
  7. package/dist/cjs/components/BlogLink.js.map +1 -1
  8. package/dist/cjs/components/BlogSection.js +4 -29
  9. package/dist/cjs/components/BlogSection.js.map +1 -1
  10. package/dist/cjs/components/Callout.js +3 -4
  11. package/dist/cjs/components/Callout.js.map +1 -1
  12. package/dist/cjs/components/CodeBlock.js +3 -25
  13. package/dist/cjs/components/CodeBlock.js.map +1 -1
  14. package/dist/cjs/components/Mermaid.js +3 -46
  15. package/dist/cjs/components/Mermaid.js.map +1 -1
  16. package/dist/cjs/components/Table.js +2 -7
  17. package/dist/cjs/components/Table.js.map +1 -1
  18. package/dist/cjs/dynamicComponents/BlogDynamic.js +167 -0
  19. package/dist/cjs/dynamicComponents/BlogDynamic.js.map +1 -0
  20. package/dist/cjs/dynamicComponents/BlogHeaderDynamic.js +13 -0
  21. package/dist/cjs/dynamicComponents/BlogHeaderDynamic.js.map +1 -0
  22. package/dist/cjs/dynamicComponents/BlogLinkDynamic.js +35 -0
  23. package/dist/cjs/dynamicComponents/BlogLinkDynamic.js.map +1 -0
  24. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js +50 -0
  25. package/dist/cjs/dynamicComponents/BlogSectionDynamic.js.map +1 -0
  26. package/dist/cjs/dynamicComponents/CalloutDynamic.js +14 -0
  27. package/dist/cjs/dynamicComponents/CalloutDynamic.js.map +1 -0
  28. package/dist/cjs/dynamicComponents/CodeBlockDynamic.js +38 -0
  29. package/dist/cjs/dynamicComponents/CodeBlockDynamic.js.map +1 -0
  30. package/dist/cjs/dynamicComponents/MermaidDynamic.js +59 -0
  31. package/dist/cjs/dynamicComponents/MermaidDynamic.js.map +1 -0
  32. package/dist/cjs/dynamicComponents/TableDynamic.js +18 -0
  33. package/dist/cjs/dynamicComponents/TableDynamic.js.map +1 -0
  34. package/dist/cjs/index.css +2 -0
  35. package/dist/cjs/index.css.map +1 -0
  36. package/dist/cjs/staticComponents/BlogLinkStatic.js +17 -0
  37. package/dist/cjs/staticComponents/BlogLinkStatic.js.map +1 -0
  38. package/dist/cjs/staticComponents/BlogSectionStatic.js +19 -0
  39. package/dist/cjs/staticComponents/BlogSectionStatic.js.map +1 -0
  40. package/dist/cjs/staticComponents/BlogStatic.js +13 -0
  41. package/dist/cjs/staticComponents/BlogStatic.js.map +1 -0
  42. package/dist/cjs/staticComponents/CodeBlockStatic.js +13 -0
  43. package/dist/cjs/staticComponents/CodeBlockStatic.js.map +1 -0
  44. package/dist/cjs/staticComponents/MermaidStatic.js +13 -0
  45. package/dist/cjs/staticComponents/MermaidStatic.js.map +1 -0
  46. package/dist/cjs/styles/Blog.module.scss.js +0 -4
  47. package/dist/cjs/styles/Blog.module.scss.js.map +1 -1
  48. package/dist/cjs/styles/BlogHeader.module.scss.js +0 -4
  49. package/dist/cjs/styles/BlogHeader.module.scss.js.map +1 -1
  50. package/dist/cjs/styles/BlogLink.module.scss.js +0 -4
  51. package/dist/cjs/styles/BlogLink.module.scss.js.map +1 -1
  52. package/dist/cjs/styles/BlogSection.module.scss.js +0 -4
  53. package/dist/cjs/styles/BlogSection.module.scss.js.map +1 -1
  54. package/dist/cjs/styles/Callout.module.scss.js +0 -4
  55. package/dist/cjs/styles/Callout.module.scss.js.map +1 -1
  56. package/dist/cjs/styles/CodeBlock.module.scss.js +1 -5
  57. package/dist/cjs/styles/CodeBlock.module.scss.js.map +1 -1
  58. package/dist/cjs/styles/Mermaid.module.scss.js +0 -4
  59. package/dist/cjs/styles/Mermaid.module.scss.js.map +1 -1
  60. package/dist/cjs/styles/Table.module.scss.js +0 -4
  61. package/dist/cjs/styles/Table.module.scss.js.map +1 -1
  62. package/dist/esm/components/Blog.js +5 -120
  63. package/dist/esm/components/Blog.js.map +1 -1
  64. package/dist/esm/components/BlogHeader.js +5 -5
  65. package/dist/esm/components/BlogHeader.js.map +1 -1
  66. package/dist/esm/components/BlogLink.js +6 -25
  67. package/dist/esm/components/BlogLink.js.map +1 -1
  68. package/dist/esm/components/BlogSection.js +6 -31
  69. package/dist/esm/components/BlogSection.js.map +1 -1
  70. package/dist/esm/components/Callout.js +4 -5
  71. package/dist/esm/components/Callout.js.map +1 -1
  72. package/dist/esm/components/CodeBlock.js +5 -27
  73. package/dist/esm/components/CodeBlock.js.map +1 -1
  74. package/dist/esm/components/Mermaid.js +5 -48
  75. package/dist/esm/components/Mermaid.js.map +1 -1
  76. package/dist/esm/components/Table.js +3 -8
  77. package/dist/esm/components/Table.js.map +1 -1
  78. package/dist/esm/dynamicComponents/BlogDynamic.js +163 -0
  79. package/dist/esm/dynamicComponents/BlogDynamic.js.map +1 -0
  80. package/dist/esm/dynamicComponents/BlogHeaderDynamic.js +9 -0
  81. package/dist/esm/dynamicComponents/BlogHeaderDynamic.js.map +1 -0
  82. package/dist/esm/dynamicComponents/BlogLinkDynamic.js +31 -0
  83. package/dist/esm/dynamicComponents/BlogLinkDynamic.js.map +1 -0
  84. package/dist/esm/dynamicComponents/BlogSectionDynamic.js +46 -0
  85. package/dist/esm/dynamicComponents/BlogSectionDynamic.js.map +1 -0
  86. package/dist/esm/dynamicComponents/CalloutDynamic.js +10 -0
  87. package/dist/esm/dynamicComponents/CalloutDynamic.js.map +1 -0
  88. package/dist/esm/dynamicComponents/CodeBlockDynamic.js +34 -0
  89. package/dist/esm/dynamicComponents/CodeBlockDynamic.js.map +1 -0
  90. package/dist/esm/dynamicComponents/MermaidDynamic.js +55 -0
  91. package/dist/esm/dynamicComponents/MermaidDynamic.js.map +1 -0
  92. package/dist/esm/dynamicComponents/TableDynamic.js +14 -0
  93. package/dist/esm/dynamicComponents/TableDynamic.js.map +1 -0
  94. package/dist/esm/index.css +2 -0
  95. package/dist/esm/index.css.map +1 -0
  96. package/dist/esm/staticComponents/BlogLinkStatic.js +13 -0
  97. package/dist/esm/staticComponents/BlogLinkStatic.js.map +1 -0
  98. package/dist/esm/staticComponents/BlogSectionStatic.js +15 -0
  99. package/dist/esm/staticComponents/BlogSectionStatic.js.map +1 -0
  100. package/dist/esm/staticComponents/BlogStatic.js +9 -0
  101. package/dist/esm/staticComponents/BlogStatic.js.map +1 -0
  102. package/dist/esm/staticComponents/CodeBlockStatic.js +9 -0
  103. package/dist/esm/staticComponents/CodeBlockStatic.js.map +1 -0
  104. package/dist/esm/staticComponents/MermaidStatic.js +9 -0
  105. package/dist/esm/staticComponents/MermaidStatic.js.map +1 -0
  106. package/dist/esm/styles/Blog.module.scss.js +0 -4
  107. package/dist/esm/styles/Blog.module.scss.js.map +1 -1
  108. package/dist/esm/styles/BlogHeader.module.scss.js +0 -4
  109. package/dist/esm/styles/BlogHeader.module.scss.js.map +1 -1
  110. package/dist/esm/styles/BlogLink.module.scss.js +0 -4
  111. package/dist/esm/styles/BlogLink.module.scss.js.map +1 -1
  112. package/dist/esm/styles/BlogSection.module.scss.js +0 -4
  113. package/dist/esm/styles/BlogSection.module.scss.js.map +1 -1
  114. package/dist/esm/styles/Callout.module.scss.js +0 -4
  115. package/dist/esm/styles/Callout.module.scss.js.map +1 -1
  116. package/dist/esm/styles/CodeBlock.module.scss.js +1 -5
  117. package/dist/esm/styles/CodeBlock.module.scss.js.map +1 -1
  118. package/dist/esm/styles/Mermaid.module.scss.js +0 -4
  119. package/dist/esm/styles/Mermaid.module.scss.js.map +1 -1
  120. package/dist/esm/styles/Table.module.scss.js +0 -4
  121. package/dist/esm/styles/Table.module.scss.js.map +1 -1
  122. package/dist/types/components/Blog.d.ts +0 -4
  123. package/dist/types/components/Blog.d.ts.map +1 -1
  124. package/dist/types/components/BlogHeader.d.ts +2 -2
  125. package/dist/types/components/BlogHeader.d.ts.map +1 -1
  126. package/dist/types/components/BlogLink.d.ts +2 -2
  127. package/dist/types/components/BlogLink.d.ts.map +1 -1
  128. package/dist/types/components/BlogSection.d.ts +5 -4
  129. package/dist/types/components/BlogSection.d.ts.map +1 -1
  130. package/dist/types/components/Callout.d.ts +1 -1
  131. package/dist/types/components/Callout.d.ts.map +1 -1
  132. package/dist/types/components/CodeBlock.d.ts +2 -3
  133. package/dist/types/components/CodeBlock.d.ts.map +1 -1
  134. package/dist/types/components/Mermaid.d.ts.map +1 -1
  135. package/dist/types/components/Table.d.ts.map +1 -1
  136. package/dist/types/components/index.d.ts +0 -1
  137. package/dist/types/components/index.d.ts.map +1 -1
  138. package/dist/types/dynamicComponents/BlogDynamic.d.ts +12 -0
  139. package/dist/types/dynamicComponents/BlogDynamic.d.ts.map +1 -0
  140. package/dist/types/dynamicComponents/BlogHeaderDynamic.d.ts +8 -0
  141. package/dist/types/dynamicComponents/BlogHeaderDynamic.d.ts.map +1 -0
  142. package/dist/types/dynamicComponents/BlogLinkDynamic.d.ts +9 -0
  143. package/dist/types/dynamicComponents/BlogLinkDynamic.d.ts.map +1 -0
  144. package/dist/types/dynamicComponents/BlogSectionDynamic.d.ts +11 -0
  145. package/dist/types/dynamicComponents/BlogSectionDynamic.d.ts.map +1 -0
  146. package/dist/types/dynamicComponents/CalloutDynamic.d.ts +10 -0
  147. package/dist/types/dynamicComponents/CalloutDynamic.d.ts.map +1 -0
  148. package/dist/types/dynamicComponents/CodeBlockDynamic.d.ts +10 -0
  149. package/dist/types/dynamicComponents/CodeBlockDynamic.d.ts.map +1 -0
  150. package/dist/types/dynamicComponents/MermaidDynamic.d.ts +9 -0
  151. package/dist/types/dynamicComponents/MermaidDynamic.d.ts.map +1 -0
  152. package/dist/types/dynamicComponents/TableDynamic.d.ts +10 -0
  153. package/dist/types/dynamicComponents/TableDynamic.d.ts.map +1 -0
  154. package/dist/types/index.d.ts +0 -1
  155. package/dist/types/index.d.ts.map +1 -1
  156. package/dist/types/staticComponents/BlogLinkStatic.d.ts +9 -0
  157. package/dist/types/staticComponents/BlogLinkStatic.d.ts.map +1 -0
  158. package/dist/types/staticComponents/BlogSectionStatic.d.ts +10 -0
  159. package/dist/types/staticComponents/BlogSectionStatic.d.ts.map +1 -0
  160. package/dist/types/staticComponents/BlogStatic.d.ts +7 -0
  161. package/dist/types/staticComponents/BlogStatic.d.ts.map +1 -0
  162. package/dist/types/staticComponents/CodeBlockStatic.d.ts +9 -0
  163. package/dist/types/staticComponents/CodeBlockStatic.d.ts.map +1 -0
  164. package/dist/types/staticComponents/MermaidStatic.d.ts +9 -0
  165. package/dist/types/staticComponents/MermaidStatic.d.ts.map +1 -0
  166. package/package.json +8 -2
  167. package/src/components/Blog.tsx +7 -195
  168. package/src/components/BlogHeader.tsx +10 -23
  169. package/src/components/BlogLink.tsx +28 -58
  170. package/src/components/BlogSection.tsx +32 -57
  171. package/src/components/Callout.tsx +12 -11
  172. package/src/components/CodeBlock.tsx +23 -55
  173. package/src/components/Mermaid.tsx +21 -55
  174. package/src/components/Table.tsx +7 -34
  175. package/src/components/index.ts +0 -2
  176. package/src/dynamicComponents/BlogDynamic.tsx +257 -0
  177. package/src/dynamicComponents/BlogHeaderDynamic.tsx +32 -0
  178. package/src/dynamicComponents/BlogLinkDynamic.tsx +74 -0
  179. package/src/dynamicComponents/BlogSectionDynamic.tsx +90 -0
  180. package/src/dynamicComponents/CalloutDynamic.tsx +27 -0
  181. package/src/dynamicComponents/CodeBlockDynamic.tsx +76 -0
  182. package/src/dynamicComponents/MermaidDynamic.tsx +78 -0
  183. package/src/dynamicComponents/TableDynamic.tsx +54 -0
  184. package/src/index.ts +0 -3
  185. package/src/staticComponents/BlogLinkStatic.tsx +45 -0
  186. package/src/staticComponents/BlogSectionStatic.tsx +40 -0
  187. package/src/staticComponents/BlogStatic.tsx +16 -0
  188. package/src/staticComponents/CodeBlockStatic.tsx +34 -0
  189. package/src/staticComponents/MermaidStatic.tsx +26 -0
  190. package/src/styles/Blog.module.scss +17 -7
  191. package/src/styles/CodeBlock.module.scss +46 -41
  192. package/src/styles/CodeBlock.module.scss.d.ts +1 -0
  193. package/dist/cjs/node_modules/style-inject/dist/style-inject.es.js +0 -33
  194. package/dist/cjs/node_modules/style-inject/dist/style-inject.es.js.map +0 -1
  195. package/dist/esm/node_modules/style-inject/dist/style-inject.es.js +0 -29
  196. package/dist/esm/node_modules/style-inject/dist/style-inject.es.js.map +0 -1
@@ -0,0 +1,76 @@
1
+ 'use client';
2
+
3
+ import { useState } from 'react';
4
+ import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
5
+ import { dracula } from 'react-syntax-highlighter/dist/esm/styles/prism';
6
+
7
+ import 'prismjs/themes/prism-tomorrow.css';
8
+
9
+ const SH = SyntaxHighlighter as any;
10
+
11
+ import styles from '../styles/CodeBlock.module.scss';
12
+
13
+ interface Properties {
14
+ hasMarginUp?: boolean;
15
+ hasMarginDown?: boolean;
16
+ language?: string;
17
+ code?: string;
18
+ }
19
+
20
+ const CodeBlock = ({
21
+ language = 'javascript',
22
+ code = '',
23
+ hasMarginUp = false,
24
+ hasMarginDown = false,
25
+ }: Properties) => {
26
+ const [isCopyMode, setCopyMode] = useState(false);
27
+
28
+ const copyToClipboard = async () => {
29
+ try {
30
+ await navigator.clipboard.writeText(code);
31
+ setCopyMode(true);
32
+ setTimeout(() => {
33
+ setCopyMode(false);
34
+ }, 1000);
35
+ } catch (error) {
36
+ console.error('Failed to copy:', error);
37
+ }
38
+ };
39
+
40
+ const lineNumberStyle = {
41
+ color: '#95a1b1',
42
+ fontSize: '0.9em',
43
+ paddingRight: '1em',
44
+ marginRight: '8px',
45
+ };
46
+
47
+ return (
48
+ <div
49
+ className={`${styles['code-block']} ${hasMarginUp ? styles['margin-top--1'] : ''} ${
50
+ hasMarginDown ? styles['margin-bottom--2'] : ''
51
+ }`}
52
+ >
53
+ <div className={styles['code-block__header']}>
54
+ <div className={styles['code-block__header__title']}>{language}</div>
55
+ <div
56
+ className={`${styles['code-block__header__copy']} ${
57
+ isCopyMode ? styles['code-block__header__copy--active'] : ''
58
+ }`}
59
+ onClick={copyToClipboard}
60
+ />
61
+ </div>
62
+ <div className={styles['code-block__wrapper']}>
63
+ <SH
64
+ language={language}
65
+ style={dracula}
66
+ showLineNumbers
67
+ lineNumberStyle={lineNumberStyle}
68
+ >
69
+ {code}
70
+ </SH>
71
+ </div>
72
+ </div>
73
+ );
74
+ };
75
+
76
+ export default CodeBlock;
@@ -0,0 +1,78 @@
1
+ 'use client';
2
+
3
+ import { useCallback, useEffect, useRef, useState } from 'react';
4
+
5
+ import mermaid from 'mermaid';
6
+
7
+ import styles from '../styles/Mermaid.module.scss';
8
+
9
+ interface MermaidProperties {
10
+ code: string;
11
+ id: string;
12
+ hasMarginUp?: boolean;
13
+ hasMarginDown?: boolean;
14
+ }
15
+
16
+ mermaid.initialize({
17
+ startOnLoad: false,
18
+ theme: 'default',
19
+ timeline: {
20
+ useMaxWidth: true,
21
+ diagramMarginX: 0,
22
+ },
23
+ flowchart: {
24
+ useMaxWidth: true,
25
+ diagramPadding: 0,
26
+ },
27
+ sequence: {
28
+ useMaxWidth: true,
29
+ diagramMarginX: 0,
30
+ },
31
+ });
32
+
33
+ const Mermaid = ({
34
+ code = '',
35
+ id = '',
36
+ hasMarginUp = false,
37
+ hasMarginDown = false,
38
+ }: MermaidProperties) => {
39
+ const [enabled, setEnabled] = useState(false);
40
+ const mermaidReference = useRef<HTMLDivElement>(null);
41
+
42
+ const initializeMermaid = useCallback(async () => {
43
+ try {
44
+ if (!mermaidReference.current || !code) return;
45
+ const { svg, bindFunctions } = await mermaid.render(
46
+ `mermaid-diagram-${id}`,
47
+ code
48
+ );
49
+ if (!svg) return;
50
+ mermaidReference.current.innerHTML = svg || '';
51
+ bindFunctions?.(mermaidReference.current);
52
+ setEnabled(true);
53
+ } catch (error) {
54
+ console.error('Failed to render Mermaid diagram:', error);
55
+ }
56
+ }, [code, id]);
57
+
58
+ useEffect(() => {
59
+ if (!code || !mermaidReference.current) return;
60
+ const timer = setTimeout(async () => {
61
+ await initializeMermaid();
62
+ }, 100);
63
+ return () => clearTimeout(timer);
64
+ }, [code, initializeMermaid]);
65
+
66
+ return (
67
+ <div
68
+ className={`${styles.mermaid}
69
+ ${hasMarginUp ? styles['margin-top--1'] : ''}
70
+ ${hasMarginDown ? styles['margin-bottom--2'] : ''}`}
71
+ >
72
+ {enabled ? null : <p>Diagram Loading...</p>}
73
+ <div ref={mermaidReference} id={id}></div>
74
+ </div>
75
+ );
76
+ };
77
+
78
+ export default Mermaid;
@@ -0,0 +1,54 @@
1
+ import { ReactNode } from 'react';
2
+ import styles from '../styles/Table.module.scss';
3
+
4
+ interface TableProperties {
5
+ rows?: ReactNode[][];
6
+ headers?: ReactNode[];
7
+ hasMarginUp?: boolean;
8
+ hasMarginDown?: boolean;
9
+ }
10
+
11
+ const Table = ({
12
+ rows = [],
13
+ headers = [],
14
+ hasMarginUp = false,
15
+ hasMarginDown = false,
16
+ }: TableProperties) => {
17
+ const columnCount = headers.length;
18
+
19
+ return (
20
+ <div
21
+ className={`${styles.table}
22
+ ${hasMarginUp ? styles['margin-top--1'] : ''}
23
+ ${hasMarginDown ? styles['margin-bottom--2'] : ''}`}
24
+ style={{
25
+ gridTemplateColumns: `repeat(${columnCount}, 1fr)`,
26
+ }}
27
+ >
28
+ <div className={`${styles['table__header']}`}>
29
+ {headers.map((header, index) => (
30
+ <div
31
+ key={typeof header === 'string' ? header : index}
32
+ className={`${styles['table__header__cell']}`}
33
+ >
34
+ {header}
35
+ </div>
36
+ ))}
37
+ </div>
38
+ {rows.map((row, index) => (
39
+ <div key={index} className={`${styles['table__row']}`}>
40
+ {row.map((cell, cellIndex) => (
41
+ <div
42
+ key={typeof cell === 'string' ? cell : cellIndex}
43
+ className={`${styles['table__row__cell']}`}
44
+ >
45
+ {cell}
46
+ </div>
47
+ ))}
48
+ </div>
49
+ ))}
50
+ </div>
51
+ );
52
+ };
53
+
54
+ export default Table;
package/src/index.ts CHANGED
@@ -8,8 +8,5 @@ export { default as Mermaid } from './components/Mermaid';
8
8
  export { default as BlogLink } from './components/BlogLink';
9
9
  export { default as Table } from './components/Table';
10
10
 
11
- // Types
12
- export type { ForwardedReference } from './components/Blog';
13
-
14
11
  // Utilities
15
12
  export { generateIdForBlogTitle, generateUrlForBlogTitle } from './utils';
@@ -0,0 +1,45 @@
1
+ import styles from '../styles/BlogLink.module.scss';
2
+ import { generateUrlForBlogTitle } from '../utils';
3
+
4
+ interface Properties {
5
+ title: string;
6
+ desc?: string;
7
+ isInProgress?: boolean;
8
+ href?: string;
9
+ }
10
+
11
+ const BlogLinkStatic = ({ title = '', desc = '', isInProgress = false, href }: Properties) => {
12
+ const link = href || `/blog/${generateUrlForBlogTitle(title)}`;
13
+
14
+ if (isInProgress) return null;
15
+
16
+ return (
17
+ <a
18
+ className={styles['blog-link']}
19
+ href={link}
20
+ rel="noopener noreferrer"
21
+ >
22
+ <h6 className={styles['blog-link__title']}>{title}</h6>
23
+ <p className={styles['blog-link__description']}>{desc}</p>
24
+ <div className={styles['blog-link__read-more']}>
25
+ <p>Read More</p>
26
+ <svg
27
+ xmlns="http://www.w3.org/2000/svg"
28
+ width="18px"
29
+ height="18px"
30
+ viewBox="0 0 24 24"
31
+ fill="none"
32
+ strokeWidth="2"
33
+ strokeLinecap="round"
34
+ strokeLinejoin="round"
35
+ stroke="transparent"
36
+ >
37
+ <line x1="5" y1="12" y2="12" x2="18"></line>
38
+ <polyline points="12 5, 19 12, 12 19" />
39
+ </svg>
40
+ </div>
41
+ </a>
42
+ );
43
+ };
44
+
45
+ export default BlogLinkStatic;
@@ -0,0 +1,40 @@
1
+ import type { ReactNode } from 'react';
2
+ import styles from '../styles/BlogSection.module.scss';
3
+ import { generateIdForBlogTitle } from '../utils';
4
+
5
+ interface BlogSectionStaticProperties {
6
+ title?: string;
7
+ category?: string;
8
+ children?: ReactNode;
9
+ increaseMarginBottom?: boolean;
10
+ }
11
+
12
+ const BlogSectionStatic = ({
13
+ title = '',
14
+ category = '',
15
+ children = null,
16
+ increaseMarginBottom = false,
17
+ }: BlogSectionStaticProperties) => {
18
+ const titleWithCategory = category ? `${category} - ${title}` : title;
19
+ const id = generateIdForBlogTitle(titleWithCategory);
20
+
21
+ return (
22
+ <div
23
+ className={`${styles['blog-section']}
24
+ ${
25
+ increaseMarginBottom
26
+ ? styles['margin-bottom--9']
27
+ : styles['margin-bottom--6']
28
+ }`}
29
+ data-title={title}
30
+ data-id={id}
31
+ >
32
+ {title ? (
33
+ <h4 className={styles['blog-section__title']}>{title}</h4>
34
+ ) : null}
35
+ {children}
36
+ </div>
37
+ );
38
+ };
39
+
40
+ export default BlogSectionStatic;
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ import styles from '../styles/Blog.module.scss';
3
+
4
+ interface BlogStaticProperties {
5
+ children: ReactNode;
6
+ }
7
+
8
+ const BlogStatic = ({ children }: BlogStaticProperties) => {
9
+ return (
10
+ <div className={styles.blog}>
11
+ <div className={styles['blog__content']}>{children}</div>
12
+ </div>
13
+ );
14
+ };
15
+
16
+ export default BlogStatic;
@@ -0,0 +1,34 @@
1
+ import styles from '../styles/CodeBlock.module.scss';
2
+
3
+ interface Properties {
4
+ hasMarginUp?: boolean;
5
+ hasMarginDown?: boolean;
6
+ language?: string;
7
+ code?: string;
8
+ }
9
+
10
+ const CodeBlockStatic = ({
11
+ language = 'javascript',
12
+ code = '',
13
+ hasMarginUp = false,
14
+ hasMarginDown = false,
15
+ }: Properties) => {
16
+ return (
17
+ <div
18
+ className={`${styles['code-block']} ${hasMarginUp ? styles['margin-top--1'] : ''} ${
19
+ hasMarginDown ? styles['margin-bottom--2'] : ''
20
+ } ${styles['code-block--static']}`}
21
+ >
22
+ <div className={styles['code-block__header']}>
23
+ <div className={styles['code-block__header__title']}>{language}</div>
24
+ </div>
25
+ <div className={styles['code-block__wrapper']}>
26
+ <pre>
27
+ <code>{code}</code>
28
+ </pre>
29
+ </div>
30
+ </div>
31
+ );
32
+ };
33
+
34
+ export default CodeBlockStatic;
@@ -0,0 +1,26 @@
1
+ import CodeBlockStatic from './CodeBlockStatic';
2
+
3
+ interface MermaidStaticProperties {
4
+ code: string;
5
+ id: string;
6
+ hasMarginUp?: boolean;
7
+ hasMarginDown?: boolean;
8
+ }
9
+
10
+ const MermaidStatic = ({
11
+ code = '',
12
+ id = '',
13
+ hasMarginUp = false,
14
+ hasMarginDown = false,
15
+ }: MermaidStaticProperties) => {
16
+ return (
17
+ <CodeBlockStatic
18
+ language="mermaid"
19
+ code={code}
20
+ hasMarginUp={hasMarginUp}
21
+ hasMarginDown={hasMarginDown}
22
+ />
23
+ );
24
+ };
25
+
26
+ export default MermaidStatic;
@@ -17,9 +17,15 @@
17
17
  }
18
18
 
19
19
  &__sidebar {
20
- min-width: 400px;
21
20
  position: sticky;
22
21
  top: calc(var(--topbar-height) + #{styles.space(6)});
22
+ padding: styles.space(6);
23
+ min-width: calc(
24
+ #{styles.rem(380)} - #{styles.space(6)} - #{styles.space(6)}
25
+ );
26
+ border-radius: styles.$border-radius--1;
27
+ background-color: styles.$color--code;
28
+ box-shadow: 0 0 0 1px styles.$color--border, 0 styles.space(1) styles.space(2) 0 styles.$color--border;
23
29
 
24
30
  margin-left: styles.space(9);
25
31
 
@@ -31,7 +37,7 @@
31
37
  cursor: pointer;
32
38
 
33
39
  animation: fadeInDown 0.3s ease-in-out;
34
- transition: all 0.3s ease-in-out;
40
+ transition: all 0.3s ease-in-out;
35
41
 
36
42
  &--active,
37
43
  &:hover {
@@ -47,13 +53,17 @@
47
53
  font-size: styles.$font-size--small;
48
54
  font-weight: styles.$font-weight--400;
49
55
  }
56
+
57
+ &:last-child {
58
+ margin-bottom: 0;
59
+ }
50
60
  }
51
61
  }
52
62
  }
53
63
 
54
64
  @media (max-width: styles.rem(1302)) {
55
65
  .blog {
56
- display: block;
66
+ display: block;
57
67
  &__sidebar {
58
68
  display: none;
59
69
  }
@@ -62,17 +72,17 @@
62
72
 
63
73
  // Margin utilities
64
74
  .margin-bottom--3 {
65
- margin-bottom: styles.space(3);
75
+ margin-bottom: styles.space(3);
66
76
  }
67
77
 
68
78
  .margin-bottom-imp--2 {
69
- margin-bottom: styles.space(2) !important;
79
+ margin-bottom: styles.space(2) !important;
70
80
  }
71
81
 
72
82
  .category__header {
73
- font-weight: styles.$font-weight--500;
83
+ font-weight: styles.$font-weight--500;
74
84
  }
75
85
 
76
86
  .category__title {
77
- // Styles defined in &__sidebar > .category__title above
87
+ // Styles defined in &__sidebar > .category__title above
78
88
  }
@@ -1,11 +1,10 @@
1
1
  @use '@san-siva/stylekit/index.module.scss' as stylekit;
2
2
 
3
3
  .code-block {
4
-
5
4
  code {
6
5
  font-size: unset;
7
- font-weight: unset;
8
- background-color: unset;
6
+ font-weight: unset;
7
+ background-color: unset;
9
8
  padding: unset;
10
9
  }
11
10
 
@@ -49,52 +48,58 @@
49
48
  font-style: unset;
50
49
  line-height: stylekit.$line-height--normal;
51
50
  color: unset;
52
- text-align: left !important;
51
+ text-align: left !important;
53
52
  }
54
53
  }
55
54
  }
56
55
 
57
- &__header {
58
- display: flex;
59
- flex-direction: row;
60
- align-items: center;
61
- justify-content: space-between;
62
- padding: stylekit.rem(4);
63
- padding-left: stylekit.rem(18);
64
-
65
- &__title {
66
- font-size: stylekit.$font-size--small;
67
- color: stylekit.$color--code;
68
- text-transform: capitalize;
69
- }
70
-
71
- &__copy {
72
- height: stylekit.rem(32);
73
- width: stylekit.rem(32);
74
- background-image: url('../assets/copy.svg');
75
- background-size: stylekit.rem(14) stylekit.rem(14);
76
- background-position: center;
77
- background-repeat: no-repeat;
78
- cursor: pointer;
79
- transition: all 0.2s ease-in-out;
80
-
81
- &:hover {
82
- background-color: stylekit.$color--grey-dark;
83
- border-radius: 100%;
84
- }
85
-
86
- &--active {
87
- background-image: url('../assets/done_copying.svg');
88
- pointer-events: none;
89
- }
90
- }
91
- }
56
+ &__header {
57
+ display: flex;
58
+ flex-direction: row;
59
+ align-items: center;
60
+ justify-content: space-between;
61
+ padding: stylekit.rem(4);
62
+ padding-left: stylekit.rem(18);
63
+
64
+ &__title {
65
+ font-size: stylekit.$font-size--small;
66
+ color: stylekit.$color--code;
67
+ text-transform: capitalize;
68
+ }
69
+
70
+ &__copy {
71
+ height: stylekit.rem(32);
72
+ width: stylekit.rem(32);
73
+ background-image: url('../assets/copy.svg');
74
+ background-size: stylekit.rem(14) stylekit.rem(14);
75
+ background-position: center;
76
+ background-repeat: no-repeat;
77
+ cursor: pointer;
78
+ transition: all 0.2s ease-in-out;
79
+
80
+ &:hover {
81
+ background-color: stylekit.$color--grey-dark;
82
+ border-radius: 100%;
83
+ }
84
+
85
+ &--active {
86
+ background-image: url('../assets/done_copying.svg');
87
+ pointer-events: none;
88
+ }
89
+ }
90
+ }
92
91
  }
93
92
 
94
93
  .margin-top--1 {
95
- margin-top: stylekit.space(1);
94
+ margin-top: stylekit.space(1);
96
95
  }
97
96
 
98
97
  .margin-bottom--2 {
99
- margin-bottom: stylekit.space(2);
98
+ margin-bottom: stylekit.space(2);
99
+ }
100
+
101
+ .code-block--static code {
102
+ color: stylekit.$color--base !important;
103
+ font-family: stylekit.$font-family--code !important;
104
+ font-size: stylekit.$font-size--small !important;
100
105
  }
@@ -7,6 +7,7 @@ declare const styles: {
7
7
  readonly 'code-block__header__title': string;
8
8
  readonly 'code-block__header__copy': string;
9
9
  readonly 'code-block__header__copy--active': string;
10
+ readonly 'code-block--static': string;
10
11
  readonly 'margin-top--1': string;
11
12
  readonly 'margin-bottom--2': string;
12
13
  };
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function styleInject(css, ref) {
6
- if ( ref === void 0 ) ref = {};
7
- var insertAt = ref.insertAt;
8
-
9
- if (!css || typeof document === 'undefined') { return; }
10
-
11
- var head = document.head || document.getElementsByTagName('head')[0];
12
- var style = document.createElement('style');
13
- style.type = 'text/css';
14
-
15
- if (insertAt === 'top') {
16
- if (head.firstChild) {
17
- head.insertBefore(style, head.firstChild);
18
- } else {
19
- head.appendChild(style);
20
- }
21
- } else {
22
- head.appendChild(style);
23
- }
24
-
25
- if (style.styleSheet) {
26
- style.styleSheet.cssText = css;
27
- } else {
28
- style.appendChild(document.createTextNode(css));
29
- }
30
- }
31
-
32
- exports.default = styleInject;
33
- //# sourceMappingURL=style-inject.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"style-inject.es.js","sources":["../../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":";;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ;;AAE7B,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,CAAC;;AAEzD,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU;;AAEzB,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;AAC/C,IAAI,CAAC,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7B,IAAI;AACJ,EAAE,CAAC,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,EAAE;;AAEF,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG;AAClC,EAAE,CAAC,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACnD,EAAE;AACF;;;;","x_google_ignoreList":[0]}
@@ -1,29 +0,0 @@
1
- function styleInject(css, ref) {
2
- if ( ref === void 0 ) ref = {};
3
- var insertAt = ref.insertAt;
4
-
5
- if (!css || typeof document === 'undefined') { return; }
6
-
7
- var head = document.head || document.getElementsByTagName('head')[0];
8
- var style = document.createElement('style');
9
- style.type = 'text/css';
10
-
11
- if (insertAt === 'top') {
12
- if (head.firstChild) {
13
- head.insertBefore(style, head.firstChild);
14
- } else {
15
- head.appendChild(style);
16
- }
17
- } else {
18
- head.appendChild(style);
19
- }
20
-
21
- if (style.styleSheet) {
22
- style.styleSheet.cssText = css;
23
- } else {
24
- style.appendChild(document.createTextNode(css));
25
- }
26
- }
27
-
28
- export { styleInject as default };
29
- //# sourceMappingURL=style-inject.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"style-inject.es.js","sources":["../../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":"AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ;;AAE7B,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,CAAC;;AAEzD,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU;;AAEzB,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;AAC/C,IAAI,CAAC,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7B,IAAI;AACJ,EAAE,CAAC,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,EAAE;;AAEF,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG;AAClC,EAAE,CAAC,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACnD,EAAE;AACF;;;;","x_google_ignoreList":[0]}