From 13905f832fabdcb143f0827d103b34b4faab3420 Mon Sep 17 00:00:00 2001 From: Rising Odegua Date: Wed, 19 May 2021 17:52:22 +0100 Subject: [PATCH] [Docs][m]: Add markdown for docs and api section --- docs/lib/utils.js | 13 + docs/markdowns/api-doc/components.md | 589 ++ docs/markdowns/api-doc/installation.md | 99 + docs/markdowns/api-doc/introduction.md | 25 + docs/markdowns/api-doc/references.md | 55 + docs/markdowns/tutorial-doc/learn.md | 21 + docs/package.json | 2 + docs/pages/components.js | 43 + docs/pages/docs.js | 50 +- docs/pages/installation.js | 43 + docs/pages/learn.js | 50 +- docs/pages/references.js | 43 + docs/yarn.lock | 9952 +----------------------- 13 files changed, 1422 insertions(+), 9563 deletions(-) create mode 100644 docs/lib/utils.js create mode 100644 docs/markdowns/api-doc/components.md create mode 100644 docs/markdowns/api-doc/installation.md create mode 100644 docs/markdowns/api-doc/introduction.md create mode 100644 docs/markdowns/api-doc/references.md create mode 100644 docs/markdowns/tutorial-doc/learn.md create mode 100644 docs/pages/components.js create mode 100644 docs/pages/installation.js create mode 100644 docs/pages/references.js diff --git a/docs/lib/utils.js b/docs/lib/utils.js new file mode 100644 index 00000000..883ea881 --- /dev/null +++ b/docs/lib/utils.js @@ -0,0 +1,13 @@ +import remark from 'remark' +import html from 'remark-html' +import fs from 'fs' + +export async function formatMD(mdFilePath) { + const mdFile = fs.readFileSync(mdFilePath, "utf-8") + const processed = await remark() + .use(html) + .process(mdFile) + + const readmeHtml = processed.toString() + return readmeHtml +} \ No newline at end of file diff --git a/docs/markdowns/api-doc/components.md b/docs/markdowns/api-doc/components.md new file mode 100644 index 00000000..234ba6e9 --- /dev/null +++ b/docs/markdowns/api-doc/components.md @@ -0,0 +1,589 @@ +# Components Reference + +Portal.js supports many components that can help you build amazing data portals similar to [this](https://catalog-portal-js.vercel.app/) and [this](https://portal-js.vercel.app/). + +In this section, we'll cover all supported components in depth, and help you understand their use as well as the expected properties. + +Components are grouped under the following sections: +* [UI](https://github.com/datopian/portal.js/tree/main/src/components/ui): Components like Nav bar, Footer, e.t.c +* [Dataset](https://github.com/datopian/portal.js/tree/main/src/components/dataset): Components used for displaying a Frictionless dataset and resources +* [Search](https://github.com/datopian/portal.js/tree/main/src/components/search): Components used for building a search interface for datasets +* [Blog](https://github.com/datopian/portal.js/tree/main/src/components/blog): Components for building a simple blog for datasets +* [Views](https://github.com/datopian/portal.js/tree/main/src/components/views): Components like charts, tables, maps for generating data views +* [Misc](https://github.com/datopian/portal.js/tree/main/src/components/misc): Miscellaneos components like errors, custom links, etc used for extra design. + +### UI Components + +In the UI we group all components that can be used for building generic page sections. These are components for building sections like the Navigation bar, Footer, Side pane, Recent datasets, e.t.c. + +#### [Nav Component](https://github.com/datopian/portal.js/blob/main/src/components/ui/Nav.js) + +To build a navigation bar, you can use the `Nav` component as demonstrated below: + +```javascript +import { Nav } from 'portal' + +export default function Home(){ + + const navMenu = [{ title: 'Blog', path: '/blog' }, + { title: 'Search', path: '/search' }] + + return ( + <> +