@firecms/ui 3.0.0-canary.16 → 3.0.0-canary.18
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/Markdown.d.ts +1 -0
- package/dist/index.es.js +7053 -7046
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +9 -9
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Markdown.tsx +14 -3
- package/tailwind.config.js +3 -0
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@firecms/ui",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.0.0-canary.
|
4
|
+
"version": "3.0.0-canary.18",
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
6
6
|
"funding": {
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
@@ -114,7 +114,7 @@
|
|
114
114
|
"src",
|
115
115
|
"tailwind.config.js"
|
116
116
|
],
|
117
|
-
"gitHead": "
|
117
|
+
"gitHead": "56dc6d6af0b2cfb0f91ac91a4f30be6d796efd98",
|
118
118
|
"publishConfig": {
|
119
119
|
"access": "public"
|
120
120
|
}
|
@@ -3,26 +3,37 @@ import equal from "react-fast-compare"
|
|
3
3
|
|
4
4
|
// @ts-ignore
|
5
5
|
import MarkdownIt from "markdown-it";
|
6
|
+
import { cn } from "../util";
|
6
7
|
|
7
8
|
export interface MarkdownProps {
|
8
9
|
source: string,
|
10
|
+
size?: "small" | "medium" | "large" | "xl" | "2xl";
|
9
11
|
className?: string
|
10
12
|
}
|
11
13
|
|
12
|
-
const
|
14
|
+
const proseClasses = {
|
15
|
+
small: "prose-sm",
|
16
|
+
medium: "prose",
|
17
|
+
large: "prose-lg",
|
18
|
+
xl: "prose-xl",
|
19
|
+
"2xl": "prose-2xl"
|
20
|
+
};
|
21
|
+
|
22
|
+
const md = new MarkdownIt({ html: true });
|
13
23
|
/**
|
14
24
|
* @group Preview components
|
15
25
|
*/
|
16
26
|
export const Markdown = React.memo<MarkdownProps>(function Markdown({
|
17
27
|
source,
|
18
|
-
className
|
28
|
+
className,
|
29
|
+
size = "medium"
|
19
30
|
}: MarkdownProps) {
|
20
31
|
const html = useMemo(() => {
|
21
32
|
return md.render(typeof source === "string" ? source : "");
|
22
33
|
}, [source]);
|
23
34
|
|
24
35
|
return <div
|
25
|
-
className={className}
|
36
|
+
className={cn(proseClasses[size], "dark:prose-invert prose-headings:font-title", className)}
|
26
37
|
dangerouslySetInnerHTML={{ __html: html }}
|
27
38
|
/>;
|
28
39
|
}
|
package/tailwind.config.js
CHANGED