Skip to content

Commit

Permalink
Merge pull request #44 from OnedocLabs/fix-missing-css-exports
Browse files Browse the repository at this point in the history
Fix missing css exports
  • Loading branch information
Titou325 authored Jul 26, 2024
2 parents 35640cb + 58c35f0 commit 3bb20b7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export {
} from "./shell/shell";
export { Footnote } from "./footnote/footnote";
export { compile, CompileOptions } from "./compile/compile";
export { CSS } from "./css/css";
export { CSS, Font, Margins } from "./css/css";
export { Markdown } from "./markdown/markdown";
export { Latex } from "./latex/latex";
export { Tailwind } from "./tailwind/tailwind";
Expand Down
37 changes: 23 additions & 14 deletions src/css/css.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { DocConfig } from "docgen/types";
import React from "react";
import { encode } from "html-entities";
import { Tailwind } from "..";
const allowedEntities = {
"'": "'",
""": '"',
Expand Down Expand Up @@ -29,13 +28,18 @@ type MarginsProps = {
left: string;
bottom: string;
};
export const Margins = ({ pageRatio, top, right, left, bottom }: MarginsProps) => {

return <CSS>{`@page {size: ${pageRatio};margin-top:${top}px;margin-right:${right}px;margin-left:${left}px;margin-bottom:${bottom}px;`}</CSS>;
export const Margins = ({
pageRatio,
top,
right,
left,
bottom,
}: MarginsProps) => {
return (
<CSS>{`@page {size: ${pageRatio};margin-top:${top}px;margin-right:${right}px;margin-left:${left}px;margin-bottom:${bottom}px;`}</CSS>
);
};



export const __docConfig: DocConfig = {
name: "CSS",
icon: "fa-brands fa-css3-alt",
Expand All @@ -53,13 +57,14 @@ NB: While you can add regular CSS with the \`<style>\` tag, it's recommended to
},
},
},
Font:{
Font: {
server: true,
client: true,
examples: {
default: {
name: "Load a Google Font",
description: "Load a Google Font its URL. This will allow you to use the font in your document.",
description:
"Load a Google Font its URL. This will allow you to use the font in your document.",
template: (
<React.Fragment>
<Font url="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" />
Expand All @@ -70,26 +75,30 @@ NB: While you can add regular CSS with the \`<style>\` tag, it's recommended to
),
},
},

},
Margins:{
Margins: {
server: true,
client: true,
examples: {
default:{
default: {
name: "Layout",
description:
"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).",
template: (
<React.Fragment>
<CSS>{`body{background-color:lightblue}`}</CSS>
<Margins pageRatio="A4" top="100" right="100" left="100" bottom="100"/>
<Margins
pageRatio="A4"
top="100"
right="100"
left="100"
bottom="100"
/>
<div>Hello world!</div>
</React.Fragment>
),
},
},

}
},
},
};

0 comments on commit 3bb20b7

Please sign in to comment.