Skip to content

Commit 4ec476e

Browse files
authored
Merge pull request #29 from OnedocLabs/ffo-48-include-documentation-for-the-react-print-library-with
Ffo 48 include documentation for the react print library with
2 parents bde5353 + 1c21749 commit 4ec476e

File tree

83 files changed

+1632
-904
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1632
-904
lines changed

docgen/buildExample.tsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ export const buildExample = async (
2525
markdown += `${example.description}\n\n`;
2626
}
2727

28-
markdown += `<Frame type="glass"><img src="${paths.imagePath}" style={{ maxHeight: '400px', borderRadius: "0.25rem", overflow: "hidden" }} /></Frame>\n\n`;
28+
markdown += `<Frame background="subtle"><img src="${paths.imagePath}" style={{ width: '100%', height: 'auto', maxHeight: '500px', borderRadius: "0.25rem", overflow: "hidden", border: '1px solid #E5E4E2' }} /></Frame>\n\n`;
2929

3030
// Check if the folder docs/previews contain the image
3131

32-
markdown += `<div style={{paddingTop: "1rem", paddingBottom: "1rem"}}><CodeGroup>
33-
\`\`\`jsx template.tsx
32+
markdown += `<div style={{paddingTop: "1rem", paddingBottom: "1rem"}}><CodeBlocks>
33+
<CodeBlock title="template.tsx">
34+
\`\`\`jsx
3435
import { ${component}${
3536
example.imports ? `, ${example.imports.join(", ")}` : ""
3637
} } from "@fileforge/react-print";${
@@ -39,10 +40,13 @@ import { ${component}${
3940
4041
${snippet}
4142
\`\`\`
42-
\`\`\`css base.css
43+
</CodeBlock>
44+
<CodeBlock title="styles.css">
45+
\`\`\`css
4346
${baseCss}
4447
\`\`\`
45-
</CodeGroup></div>\n\n`;
48+
</CodeBlock>
49+
</CodeBlocks></div>\n\n`;
4650

4751
// markdown += `<a href="${pdfPath}">Download the PDF example ↓</a>\n\n`;
4852

docgen/buildFileMarkdown.ts

+24-22
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import { ComponentDoc } from "react-docgen-typescript";
77
import { buildExample } from "./buildExample";
88
import { formatCamelCaseToTitle, safePropType } from "./utils";
9+
import { doc } from "prettier";
910

1011
export const buildFileMarkdown = async (
1112
docConfig: ExtendedDocConfig,
@@ -45,7 +46,10 @@ ${docConfig.description ? `description: "${docConfig.description}"` : ""}
4546

4647
let { client, server } = componentInfo || { client: true, server: true };
4748

48-
markdown += `## ${componentName}\n\n`;
49+
// markdown += `## ${componentName}\n\n`;
50+
if (component && component.description) {
51+
markdown += `${component.description}\n\n`;
52+
}
4953

5054
markdown += `Support\n\n`;
5155

@@ -64,12 +68,8 @@ ${docConfig.description ? `description: "${docConfig.description}"` : ""}
6468
server ? check : noCheck
6569
}<span>Server-side</span></div></div>\n\n`;
6670

67-
if (component && component.description) {
68-
markdown += `${component.description}\n\n`;
69-
}
7071

7172
if (Object.keys(examples).length > 0) {
72-
markdown += `### Examples\n\n`;
7373

7474
if (examples.default) {
7575
markdown += `#### Preview\n\n`;
@@ -84,6 +84,8 @@ ${docConfig.description ? `description: "${docConfig.description}"` : ""}
8484
markdown += exampleMarkdown;
8585
}
8686

87+
markdown += `### Examples\n\n`;
88+
8789
if (Object.keys(examples).filter((key) => key !== "default").length > 0) {
8890
for (const [exampleName, example] of Object.entries(examples)) {
8991
if (exampleName === "default") {
@@ -108,23 +110,23 @@ ${docConfig.description ? `description: "${docConfig.description}"` : ""}
108110
markdown += `\`\`\`jsx\nimport { ${componentName} } from "@fileforge/react-print";\n\`\`\`\n\n`;
109111
}
110112

111-
if (
112-
component &&
113-
component.props &&
114-
Object.keys(component.props).length > 0
115-
) {
116-
markdown += `### API\n\n<ResponseField name="Props">\n<Expandable defaultOpen={true} title="Show available props">\n`;
117-
118-
Object.entries(component.props).forEach(([propName, prop]) => {
119-
markdown += `<ResponseField name="${propName}" type="${safePropType(
120-
prop.type.name
121-
)}" required={${prop.required}}>\n\n${
122-
prop.description
123-
}\n\n${prop.defaultValue ? `Default: \`${JSON.stringify(prop.defaultValue.value)}\`\n\n` : ""}</ResponseField>\n`;
124-
});
125-
126-
markdown += `</Expandable></ResponseField>\n`;
127-
}
113+
// if (
114+
// component &&
115+
// component.props &&
116+
// Object.keys(component.props).length > 0
117+
// ) {
118+
// markdown += `### API\n\n<ResponseField name="Props">\n<Expandable defaultOpen={true} title="Show available props">\n`;
119+
120+
// Object.entries(component.props).forEach(([propName, prop]) => {
121+
// markdown += `<ResponseField name="${propName}" type="${safePropType(
122+
// prop.type.name
123+
// )}" required={${prop.required}}>\n\n${
124+
// prop.description
125+
// }\n\n${prop.defaultValue ? `Default: \`${JSON.stringify(prop.defaultValue.value)}\`\n\n` : ""}</ResponseField>\n`;
126+
// });
127+
128+
// markdown += `</Expandable></ResponseField>\n`;
129+
// }
128130
}
129131

130132
return markdown;

docgen/buildTemplates.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ${attributes.icon ? `icon: ${attributes.icon}` : ""}
8888
category: ${attributes.category || "Uncategorized"}
8989
---\n\n`;
9090

91-
markdown += `<Frame type="glass"><img src="${paths.imagePath}" style={{ maxHeight: '600px', borderRadius: "0.25rem", overflow: "hidden" }} /></Frame>\n\n`;
91+
markdown += `<Frame background="subtle"><img src="${paths.imagePath}" style={{ width: '100%', height: 'auto', maxHeight: '500px', borderRadius: "0.25rem", overflow: "hidden", border: '1px solid #E5E4E2' }} /></Frame>\n\n`;
9292

9393
markdown += `\`\`\`jsx
9494
${await formatSnippet(body)}

docgen/docs.yml

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
instances:
2+
- url: 'https://fileforge.docs.buildwithfern.com'
3+
custom-domain: 'https://docs.fileforge.com'
4+
title: Fileforge
5+
tabs:
6+
welcome:
7+
display-name: Welcome
8+
react-print:
9+
display-name: react-print
10+
icon: fa-brands fa-react
11+
API:
12+
display-name: API Reference
13+
icon: fa-solid fa-bolt
14+
SDK:
15+
display-name: SDK Reference
16+
icon: fa-solid fa-code
17+
help:
18+
display-name: Help Center
19+
icon: fa-solid fa-question
20+
navigation:
21+
- tab: welcome
22+
layout:
23+
- section: Get Started
24+
contents:
25+
- page: Welcome
26+
path: ./pages/overview/introduction.mdx
27+
slug: welcome
28+
- tab: react-print
29+
layout:
30+
- section: Welcome
31+
contents:
32+
- page: Getting Started
33+
path: ./react-print-pdf/docs/introduction.mdx
34+
slug: getting-started
35+
icon: fa-solid fa-hand-wave
36+
- page: Setup
37+
path: ./react-print-pdf/docs/getting-started/setup.mdx
38+
slug: setup
39+
icon: fa-solid fa-hammer
40+
- section: Contributing
41+
contents:
42+
- page: Contributing
43+
path: ./react-print-pdf/docs/contributing.mdx
44+
slug: contributing
45+
icon: fa-solid fa-code-pull-request
46+
- section: Components
47+
contents: []
48+
- section: Examples
49+
contents:
50+
- section: Invoices
51+
contents:
52+
- page: Invoice
53+
path: ./react-print-pdf/docs/ui/templates/invoice.mdx
54+
slug: invoice
55+
- page: Invoice Advanced
56+
path: ./react-print-pdf/docs/ui/templates/invoice-advanced.mdx
57+
slug: invoice-advanced
58+
icon: fa-solid fa-file-invoice
59+
- section: Legal
60+
contents:
61+
- page: NDA Markdown
62+
path: ./react-print-pdf/docs/ui/templates/nda-markdown.mdx
63+
slug: nda-markdown
64+
icon: fa-solid fa-file-signature
65+
- section: Receipts
66+
contents:
67+
- page: Receipt
68+
path: ./react-print-pdf/docs/ui/templates/receipt.mdx
69+
slug: receipt
70+
icon: fa-solid fa-receipt
71+
- section: Reports
72+
contents:
73+
- page: Report Charts
74+
path: ./react-print-pdf/docs/ui/templates/report-charts.mdx
75+
slug: report-charts
76+
icon: fa-solid fa-chart-line
77+
- section: Scientific
78+
contents:
79+
- page: Scientific Report
80+
path: ./react-print-pdf/docs/ui/templates/scientific-report.mdx
81+
slug: scientific-report
82+
icon: fa-solid fa-flask
83+
- tab: API
84+
layout:
85+
- section: Introduction
86+
contents:
87+
- page: Getting started
88+
path: ./pages/api-reference/introduction.mdx
89+
slug: api-reference
90+
- page: Authentication
91+
path: ./pages/api-reference/authentication.mdx
92+
slug: authentication
93+
- api: API Reference
94+
snippets:
95+
typescript: '@fileforge/client'
96+
- tab: SDK
97+
layout:
98+
- section: Getting Started
99+
contents:
100+
- page: Getting Started
101+
path: ./pages/sdk-reference/introduction.mdx
102+
slug: sdk-reference
103+
- section: Node
104+
contents:
105+
- page: Getting Started
106+
path: ./pages/sdk-reference/node/introduction.mdx
107+
slug: node-sdk-reference
108+
- page: Error Handling
109+
path: ./pages/sdk-reference/node/errors.mdx
110+
slug: node-error-handling
111+
- section: PDF
112+
contents:
113+
- page: fromDocx
114+
path: ./pages/sdk-reference/node/PDF/fromDocx.mdx
115+
slug: from-docx
116+
- page: generate
117+
path: ./pages/sdk-reference/node/PDF/generate.mdx
118+
slug: generate-from-html
119+
- page: merge
120+
path: ./pages/sdk-reference/node/PDF/merge.mdx
121+
slug: merge
122+
- section: Form
123+
contents:
124+
- page: detect
125+
path: ./pages/sdk-reference/node/Form/detect.mdx
126+
slug: detect
127+
- page: mark
128+
path: ./pages/sdk-reference/node/Form/mark.mdx
129+
slug: mark
130+
- page: fill
131+
path: ./pages/sdk-reference/node/Form/fill.mdx
132+
slug: fill
133+
- section: Types
134+
contents:
135+
- page: FormFillRequestOptionsFieldsItem
136+
path: ./pages/sdk-reference/node/Form/Types/formFillRequestOptionsFieldsItem.mdx
137+
slug: formFillRequestOptionsFieldsItem
138+
- page: FormDetectResponseItem
139+
path: ./pages/sdk-reference/node/Form/Types/FormDetectResponseItem.mdx
140+
slug: formDetectResponseItem
141+
- tab: help
142+
layout:
143+
- section: HTML to PDF
144+
contents:
145+
- page: Generate a PDF with react-print
146+
path: >-
147+
./pages/help_center/html_to_pdf/generate-pdf-from-html-react-print.mdx
148+
slug: generate-pdf-from-html
149+
- page: Generate a PDF with assets
150+
path: ./pages/help_center/html_to_pdf/generate-pdf-from-html-assets.mdx
151+
slug: generate-pdf-from-html-assets
152+
- page: Generate a hosted PDF
153+
path: ./pages/help_center/html_to_pdf/generate-hosted-pdf-from-html.mdx
154+
slug: generate-hosted-pdf
155+
colors:
156+
accentPrimary: '#AD8AFF'
157+
background:
158+
dark: '#000000'
159+
light: '#ffffff'
160+
logo:
161+
dark: ./assets/logo-white.svg
162+
light: ./assets/logo-black.svg
163+
favicon: ./assets/favicon.png
164+
layout:
165+
searchbar-placement: header
166+
navbar-links:
167+
- type: minimal
168+
text: Support
169+
url: 'mailto:[email protected]'
170+
- type: outlined
171+
text: Get Started
172+
url: 'https://app.onedoclabs.com/login'

0 commit comments

Comments
 (0)