@chtc/web-components 1.0.1 → 1.0.3
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/Article/Article.d.ts.map +1 -1
- package/Article/Article.js +2 -11
- package/Article/Article.js.map +1 -1
- package/markdownComponents/index.d.ts +2 -0
- package/markdownComponents/index.d.ts.map +1 -0
- package/markdownComponents/index.js +2 -0
- package/markdownComponents/index.js.map +1 -0
- package/markdownComponents/markdownComponents.d.ts +4 -0
- package/markdownComponents/markdownComponents.d.ts.map +1 -0
- package/markdownComponents/markdownComponents.js +39 -0
- package/markdownComponents/markdownComponents.js.map +1 -0
- package/package.json +1 -2
package/Article/Article.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Article.d.ts","sourceRoot":"","sources":["../../src/Article/Article.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"Article.d.ts","sourceRoot":"","sources":["../../src/Article/Article.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAA;AAGvC,QAAA,MAAM,OAAO,GAAI,aAAW;IAAC,OAAO,EAAE,cAAc,CAAA;CAAC,4CAuBpD,CAAA;AAED,eAAe,OAAO,CAAC"}
|
package/Article/Article.js
CHANGED
|
@@ -3,18 +3,9 @@ import { Typography, Box, Container } from '@mui/material';
|
|
|
3
3
|
import Balancer from "react-wrap-balancer";
|
|
4
4
|
import Markdown from "react-markdown";
|
|
5
5
|
import rehypeRaw from "rehype-raw";
|
|
6
|
+
import markdownComponents from "../markdownComponents";
|
|
6
7
|
const Article = ({ article }) => {
|
|
7
|
-
return (_jsx(Container, { maxWidth: "md", children: _jsxs(Box, { pt: 6, children: [_jsxs(Box, { textAlign: "center", pb: 2, children: [_jsx(Box, { pb: 6, children: _jsx(Typography, { variant: "h3", children: _jsx(Balancer, { children: article.title }) }) }), _jsx(Box, { height: "1rem", borderRadius: "10px", bgcolor: "primary.main" }), _jsxs(Box, { pt: 1, display: "flex", justifyContent: "space-between", children: [_jsx(Typography, { variant: "h5", children: article.author }), _jsx(Typography, { variant: "h5", children: article.date.toLocaleDateString() })] })] }), _jsx(Markdown, { rehypePlugins: [rehypeRaw], components:
|
|
8
|
-
h1: ({ children }) => _jsx(Typography, { variant: "h1", children: children }),
|
|
9
|
-
h2: ({ children }) => _jsx(Typography, { variant: "h1", children: children }),
|
|
10
|
-
h3: ({ children }) => _jsx(Typography, { variant: "h1", children: children }),
|
|
11
|
-
h4: ({ children }) => _jsx(Typography, { variant: "h1", children: children }),
|
|
12
|
-
h5: ({ children }) => _jsx(Typography, { variant: "h1", children: children }),
|
|
13
|
-
h6: ({ children }) => _jsx(Typography, { variant: "h1", children: children }),
|
|
14
|
-
p: ({ children }) => _jsx(Typography, { variant: "body1", children: children }),
|
|
15
|
-
a: ({ children, href }) => _jsx("a", { style: { color: "#0885ff" }, href: href, children: children }),
|
|
16
|
-
img: ({ src, alt }) => _jsx("img", { style: { maxWidth: "100%", height: "auto" }, src: src, alt: alt }),
|
|
17
|
-
}, children: article.content })] }) }));
|
|
8
|
+
return (_jsx(Container, { maxWidth: "md", children: _jsxs(Box, { pt: 6, children: [_jsxs(Box, { textAlign: "center", pb: 2, children: [_jsx(Box, { pb: 6, children: _jsx(Typography, { variant: "h3", children: _jsx(Balancer, { children: article.title }) }) }), _jsx(Box, { height: "1rem", borderRadius: "10px", bgcolor: "primary.main" }), _jsxs(Box, { pt: 1, display: "flex", justifyContent: "space-between", children: [_jsx(Typography, { variant: "h5", children: article.author }), _jsx(Typography, { variant: "h5", children: article.date.toLocaleDateString() })] })] }), _jsx(Markdown, { rehypePlugins: [rehypeRaw], components: markdownComponents, children: article.content })] }) }));
|
|
18
9
|
};
|
|
19
10
|
export default Article;
|
|
20
11
|
//# sourceMappingURL=Article.js.map
|
package/Article/Article.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Article.js","sourceRoot":"","sources":["../../src/Article/Article.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AACzD,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,SAAS,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Article.js","sourceRoot":"","sources":["../../src/Article/Article.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AACzD,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,SAAS,MAAM,YAAY,CAAC;AAGnC,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAEvD,MAAM,OAAO,GAAG,CAAC,EAAC,OAAO,EAA4B,EAAE,EAAE;IACxD,OAAO,CACL,KAAC,SAAS,IAAC,QAAQ,EAAE,IAAI,YACxB,MAAC,GAAG,IAAC,EAAE,EAAE,CAAC,aACT,MAAC,GAAG,IAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,aAC9B,KAAC,GAAG,IAAC,EAAE,EAAE,CAAC,YACT,KAAC,UAAU,IAAC,OAAO,EAAE,IAAI,YAAG,KAAC,QAAQ,cAAE,OAAO,CAAC,KAAK,GAAY,GAAa,GACxE,EACN,KAAC,GAAG,IAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAQ,EAC1E,MAAC,GAAG,IAAC,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,eAAe,aAC3D,KAAC,UAAU,IAAC,OAAO,EAAE,IAAI,YAAG,OAAO,CAAC,MAAM,GAAc,EACxD,KAAC,UAAU,IAAC,OAAO,EAAE,IAAI,YAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAc,IACtE,IACD,EACN,KAAC,QAAQ,IACP,aAAa,EAAE,CAAC,SAAS,CAAC,EAC1B,UAAU,EAAE,kBAAkB,YAE9B,OAAO,CAAC,OAAO,GACN,IACN,GACK,CACb,CAAA;AACF,CAAC,CAAA;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/markdownComponents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/markdownComponents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownComponents.d.ts","sourceRoot":"","sources":["../../src/markdownComponents/markdownComponents.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,QAAA,MAAM,kBAAkB,EAAE,aAmCzB,CAAA;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Typography from '@mui/material/Typography';
|
|
3
|
+
import MuiLink from '@mui/material/Link';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
const markdownComponents = {
|
|
6
|
+
h1: ({ children, ...props }) => {
|
|
7
|
+
return _jsx(Typography, { component: 'h1', variant: "h4", gutterBottom: true, ...props, children: children });
|
|
8
|
+
},
|
|
9
|
+
h2: ({ children, ...props }) => {
|
|
10
|
+
return _jsx(Typography, { component: 'h2', variant: "h5", gutterBottom: true, ...props, children: children });
|
|
11
|
+
},
|
|
12
|
+
h3: ({ children, ...props }) => {
|
|
13
|
+
return _jsx(Typography, { component: 'h3', variant: "h6", gutterBottom: true, ...props, children: children });
|
|
14
|
+
},
|
|
15
|
+
h4: ({ children, ...props }) => {
|
|
16
|
+
return _jsx(Typography, { component: 'h4', variant: "h6", fontWeight: 400, borderBottom: "black solid 1px", gutterBottom: true, ...props, children: children });
|
|
17
|
+
},
|
|
18
|
+
h5: ({ children, ...props }) => {
|
|
19
|
+
return _jsx(Typography, { component: 'h5', variant: "h6", fontWeight: 300, gutterBottom: true, ...props, children: children });
|
|
20
|
+
},
|
|
21
|
+
h6: ({ children, ...props }) => {
|
|
22
|
+
return _jsx(Typography, { component: 'h6', variant: "h6", fontWeight: 300, color: "primary.main", gutterBottom: true, ...props, children: children });
|
|
23
|
+
},
|
|
24
|
+
p: (props) => _jsx(Typography, { variant: "body1", component: 'div', gutterBottom: true, ...props }), // use sx for spacing
|
|
25
|
+
a: (props) => _jsx(MuiLink, { ...props }),
|
|
26
|
+
ul: (props) => _jsx(Box, { component: "ul", sx: { pl: 4, mb: 2 }, ...props }),
|
|
27
|
+
ol: (props) => _jsx(Box, { component: "ol", sx: { pl: 4, mb: 2 }, ...props }),
|
|
28
|
+
li: (props) => _jsx(Box, { component: "li", sx: { mb: 0.5 }, ...props }),
|
|
29
|
+
blockquote: (props) => _jsx(Box, { component: "blockquote", sx: { borderLeft: 4, borderColor: 'grey.300', pl: 2, ml: 0, my: 2, color: 'grey.700', fontStyle: 'italic' }, ...props }),
|
|
30
|
+
code: ({ props, children }) => {
|
|
31
|
+
return _jsxs(_Fragment, { children: [_jsx("link", { rel: "stylesheet", href: "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/styles/github.min.css" }), _jsx(Box, { component: "code", sx: { bgcolor: 'grey.100', py: 0.2, borderRadius: 1, fontFamily: 'monospace', fontSize: '0.95em' }, ...props, children: children })] });
|
|
32
|
+
},
|
|
33
|
+
pre: (props) => _jsx(Box, { component: "pre", sx: { bgcolor: 'grey.100', p: 2, borderRadius: 2, overflow: 'auto', mb: 2 }, ...props }),
|
|
34
|
+
img: (props) => {
|
|
35
|
+
return _jsx("img", { ...props, style: { maxWidth: "100%", height: 'auto', marginTop: 2, marginBottom: 2 } });
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export default markdownComponents;
|
|
39
|
+
//# sourceMappingURL=markdownComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownComponents.js","sourceRoot":"","sources":["../../src/markdownComponents/markdownComponents.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,GAAG,MAAM,mBAAmB,CAAC;AAGpC,MAAM,kBAAkB,GAAkB;IACzC,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;QAC9B,OAAO,KAAC,UAAU,IAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAC,IAAI,EAAC,YAAY,WAAK,KAAK,YAAG,QAAQ,GAAc,CAAC;IAClG,CAAC;IACD,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;QAC9B,OAAO,KAAC,UAAU,IAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAC,IAAI,EAAC,YAAY,WAAK,KAAK,YAAG,QAAQ,GAAc,CAAC;IAClG,CAAC;IACD,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;QAC9B,OAAO,KAAC,UAAU,IAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAC,IAAI,EAAC,YAAY,WAAK,KAAK,YAAG,QAAQ,GAAc,CAAC;IAClG,CAAC;IACD,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;QAC9B,OAAO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,SAAS,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAC,GAAI,CAAA;IACpG,CAAC;CACD,CAAA;AAED,eAAe,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chtc/web-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "CHTC Web Components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/react": "^11.14.0",
|
|
23
|
-
"@emotion/style": "^0.8.0",
|
|
24
23
|
"@emotion/styled": "^11.14.1",
|
|
25
24
|
"@mui/icons-material": "^7.0.0",
|
|
26
25
|
"@mui/material": "^7.0.0",
|