Skip to content

Commit 3bb20b7

Browse files
authored
Merge pull request #44 from OnedocLabs/fix-missing-css-exports
Fix missing css exports
2 parents 35640cb + 58c35f0 commit 3bb20b7

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

src/client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export {
2020
} from "./shell/shell";
2121
export { Footnote } from "./footnote/footnote";
2222
export { compile, CompileOptions } from "./compile/compile";
23-
export { CSS } from "./css/css";
23+
export { CSS, Font, Margins } from "./css/css";
2424
export { Markdown } from "./markdown/markdown";
2525
export { Latex } from "./latex/latex";
2626
export { Tailwind } from "./tailwind/tailwind";

src/css/css.tsx

+23-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { DocConfig } from "docgen/types";
22
import React from "react";
33
import { encode } from "html-entities";
4-
import { Tailwind } from "..";
54
const allowedEntities = {
65
"'": "'",
76
""": '"',
@@ -29,13 +28,18 @@ type MarginsProps = {
2928
left: string;
3029
bottom: string;
3130
};
32-
export const Margins = ({ pageRatio, top, right, left, bottom }: MarginsProps) => {
33-
34-
return <CSS>{`@page {size: ${pageRatio};margin-top:${top}px;margin-right:${right}px;margin-left:${left}px;margin-bottom:${bottom}px;`}</CSS>;
31+
export const Margins = ({
32+
pageRatio,
33+
top,
34+
right,
35+
left,
36+
bottom,
37+
}: MarginsProps) => {
38+
return (
39+
<CSS>{`@page {size: ${pageRatio};margin-top:${top}px;margin-right:${right}px;margin-left:${left}px;margin-bottom:${bottom}px;`}</CSS>
40+
);
3541
};
3642

37-
38-
3943
export const __docConfig: DocConfig = {
4044
name: "CSS",
4145
icon: "fa-brands fa-css3-alt",
@@ -53,13 +57,14 @@ NB: While you can add regular CSS with the \`<style>\` tag, it's recommended to
5357
},
5458
},
5559
},
56-
Font:{
60+
Font: {
5761
server: true,
5862
client: true,
5963
examples: {
6064
default: {
6165
name: "Load a Google Font",
62-
description: "Load a Google Font its URL. This will allow you to use the font in your document.",
66+
description:
67+
"Load a Google Font its URL. This will allow you to use the font in your document.",
6368
template: (
6469
<React.Fragment>
6570
<Font url="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" />
@@ -70,26 +75,30 @@ NB: While you can add regular CSS with the \`<style>\` tag, it's recommended to
7075
),
7176
},
7277
},
73-
7478
},
75-
Margins:{
79+
Margins: {
7680
server: true,
7781
client: true,
7882
examples: {
79-
default:{
83+
default: {
8084
name: "Layout",
8185
description:
8286
"Set the page ratio and margin sizes in px. You can also use the `@page` at-rule in CSS to manage all aspects of printed pages. More on this [here](https://developer.mozilla.org/en-US/docs/Web/CSS/@page).",
8387
template: (
8488
<React.Fragment>
8589
<CSS>{`body{background-color:lightblue}`}</CSS>
86-
<Margins pageRatio="A4" top="100" right="100" left="100" bottom="100"/>
90+
<Margins
91+
pageRatio="A4"
92+
top="100"
93+
right="100"
94+
left="100"
95+
bottom="100"
96+
/>
8797
<div>Hello world!</div>
8898
</React.Fragment>
8999
),
90100
},
91101
},
92-
93-
}
102+
},
94103
},
95104
};

0 commit comments

Comments
 (0)