1.1.3 • Published 4 years ago

react-dockeep v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

react-dockeep

React documentation keeper allows user to create documentation for their components and view them directly with custom configurations in their projects.

Get started

npm i react-dockeep

Then use it in your index.js (if using create-react-app)

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import Doc from 'react-dockeep';

const CONFIG = {/* Your configurations here */}

ReactDOM.render(
  <React.StrictMode>
    <Doc config={CONFIG}>
      <App />
    </Doc>
  </React.StrictMode>,
  document.getElementById('root')
);

Props

Namerequiredtypedefaultdescription
configtrueobjectThe config that controls the components and documentation
urlfalsestring'doc'The url that will be used to browse the components

Config

The documentation will be rendered based on the configuration provided, here are the fields that can be configured.

Namerequiredtypedefaultdescription
componentstruearrayA list of components with configuration

components

Namerequiredtypedefaultdescription
componenttruefunction | classThe component that will be rendered
namefalsestringThe given component's nameThe name of the component
descriptionfalsestring'No description'The description of the component
propsfalsearray[]A list of props that will be applied to the component with documentation
codefalsestringThe example code, please notice that the name of the tag must match the component name

props

Namerequiredtypedefaultdescription
nametruestringThe name of the prop
valuetruestringThe value of the prop
requiredfalsebooleanfalseWhether this prop is required by the component or not
defaultfalseanyThe default value of the prop
typefalsestring'any'The type of the prop
docfalsestring''The documentation of this prop

Example

Here is a screenshot of the example: Example Screenshot

The above documentation can be generated by the following config:

{
  component: Modal,
  description: "Wrapped the Modal component from React Bootstrap",
  props: [
    {
      name: "header",
      value: "",
      default: "",
      doc: "The header of the Modal, header will not be displayed if this is not given",
      type: "string"
    },
    {
      name: "body",
      value: "Hello World",
      required: true,
      doc: "Body of the modal",
      type: "string"
    },
    {
      name: "footer",
      value: "",
      default: "",
      doc: "The footer of the Modal, footer will not be displayed if this is not given",
      type: "string"
    },
  ]
}

To run examples use npm start and go to http://localhost:8080 in your browser, see examples folder for more information

TODO

v1.0.0
  • Add example
  • Prevent name duplications
  • ~Improve add config using functions~ (Push to v1.1.0)
  • Change all bootstrap elements to React Bootstrap
  • Implement the search feature of the sidebar
  • Proper warning and error display
  • ~Figure out a way when user deleted required props and error is thrown~ (This only happens in react development mode)
v1.1.0
  • Config using functions
  • ~Allow users to handle routing by themselves~ (Push to v1.2.0)
  • Allow users to write example code by themselves
  • ~Allow users to control sections by themselves~ (Push to v1.2.0)
1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago