1.0.0-rc3.1 • Published 4 years ago

react-ui-doc v1.0.0-rc3.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

react-ui-doc

Create UI doc by React, Gatsby and Mdx.

Why

So many great tool to help developer to build their own Doc, like Storybook, Gitbook, Docz, why I build again?

Because I want to write Docs and Pages by Mdx. Docz is one of the most popular tool but it too slow to rebuild page. So I take some time to make this tool to build Docs by Mdx.

Installation

yarn add react-ui-doc

File Strurcture

gatsby-config.js
package.json
src/
|-- components/
|   |-- layout.js
|-- images/
|   |-- logo.png
|-- pages/
|   |-- index.mdx
|   |-- docs/
|   |   |-- index.mdx
|-- etc.

Add Gatsby config

Create gatsby-config.js file and edit it like this:

module.exports = {
  plugins: [
    ...plugins,
    {
      resolve: "react-ui-doc",
      options: {
        name: 'react-ui-doc', // Project name
        slug: 'react-ui-doc', // Project slug
        github: 'https://github.com/SANGET/react-ui-doc',
        siteUrl: 'https://react-ui-doc.thinkmore.xyz',
        author: 'You',
        menu: [
          'Getting Started',
        ], // Menu ordering
        nav: [
          { title: 'Docs', url: '/docs/' },
        ], // Side pages navigation
        docPath: `${__dirname}/src/pages/docs`, // store doc files
        pagePath: `${__dirname}/src/pages`, // store side pages
        imagePath: `${__dirname}/src/images`, // store side images, required `logo.png`
        analytics: {
          trackingId: `UA-111111111-1`,
          head: false,
        },
        theme: {
          defaultMode: 'light',
          colors: {
            light: {
              body: '#FFF'
            },
            dark: {
              body: '#000'
            }
          }
        } // theme config
      },
    },

    // custom layout config, required
    {
      resolve: 'gatsby-plugin-layout',
      options: {
        component: require.resolve(`./src/components/layout`),
      }
    }
  ],
};

Create costom Layout

Create src/components/layout.js

src/
|-- components/
|   |-- layout.js

And provide the dependency to Docs, see https://github.com/FormidableLabs/react-live for more detail.

import React from 'react';
import { LiveConfig } from 'react-ui-doc/components';
import styled, * as sc from 'styled-components';
import * as UICore from '@deer-ui/core';
import * as EnhanceUI from '@deer-ui/enhance-ui';
import * as UIUtils from '@deer-ui/core/utils';
import * as BaseFunc from '@mini-code/base-func';

import './style.css';

export default function Layout({ children }) {
  return (
    <>
      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/themes/airbnb.css" />
      <LiveConfig
        modules={{
          react: React,
          '@deer-ui/core': UICore,
          '@deer-ui/enhance-ui': EnhanceUI,
          '@deer-ui/core/utils': UIUtils,
          '@mini-code/base-func': BaseFunc,
          'styled-components': Object.assign(styled, sc),
        }}
      />
      {children}
    </>
  );
}

Create page

So that we can create page by .mdx

Create src/pages/index.mdx

src/
|-- pages/
|   |-- index.mdx
---
title: homepage
---

import HomePage from '../components/home-page';

# HomePage

<HomePage />

More detail see Alert

1.0.0-rc3.1

4 years ago

1.0.0-rc3.0

4 years ago

1.0.0-rc2.2

4 years ago

1.0.0-rc2.1

4 years ago

1.0.0-rc2.0

4 years ago

1.0.0-rc1.6

4 years ago

1.0.0-rc1.1

4 years ago

1.0.0-rc1.0

4 years ago

1.0.0-rc1.5

4 years ago

1.0.0-rc1.4

4 years ago

1.0.0-rc1.3

4 years ago

1.0.0-rc1.2

4 years ago

0.2.0-alpha1.9

4 years ago

0.2.0-alpha1.8

4 years ago

0.2.0-alpha1.7

4 years ago

0.2.0-alpha1.6

4 years ago

0.2.0-alpha1.5

4 years ago

0.2.0-alpha1.3

4 years ago

0.2.0-alpha1.4

4 years ago

0.2.0-alpha1.2

4 years ago

0.2.0-alpha1.1

4 years ago

0.2.0-alpha1.0

4 years ago

0.1.6-alpha2.0

4 years ago

0.1.6-alpha1.9

4 years ago

0.1.6-alpha1.8

4 years ago

0.1.6-alpha1.7

4 years ago

0.1.6-alpha1.2

4 years ago

0.1.6-alpha1.3

4 years ago

0.1.6-alpha1.4

4 years ago

0.1.6-alpha1.5

4 years ago

0.1.6-alpha1.6

4 years ago

0.1.6-alpha1.1

4 years ago

0.1.6-alpha1.0

4 years ago

0.1.6-alpha0.9

4 years ago

0.1.6-alpha0.2

4 years ago

0.1.6-alpha0.3

4 years ago

0.1.6-alpha0.4

4 years ago

0.1.6-alpha0.5

4 years ago

0.1.6-alpha0.6

4 years ago

0.1.6-alpha0.7

4 years ago

0.1.6-alpha0.8

4 years ago

0.1.6-alpha0.1

4 years ago

0.1.2

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.1

4 years ago