New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zohodesk/docs

Package Overview
Dependencies
Maintainers
31
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zohodesk/docs

  • 1.0.5
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Maintainers
31
Created
Source

DocsTabsViewer

DocsTabsViewer is used to display the docs content in similar ways of ui through out the application.

  • Docs configuation

  • Mode, theme options from doctool

  • Used components passing

  • Children supports

  • Decorator options

  • Used description are markdown supported https://www.markdownguide.org/basic-syntax/

How to use in {component}.docs.js files.

A component having single component type
import DocsTabsViewer from "./DocsTabsViewer";
import docConfig from "./{component}.docConfig.js";
import Component from "./{component}"
export default (props)=>{
    return <DocsTabsViewer docConfig={docConfig} componentType={Component} />
}
A component having multiple component types like Group, Item and List ...
import DocsTabsViewer from "./DocsTabsViewer";
import docConfig from "./{component}.docConfig.js";
import Component,{ListComponent, ItemComponent} from "./{component}"
export default (props)=>{
    return <DocsTabsViewer docConfig={docConfig} components={{Component,ListComponent,ItemComponent}} />
}

{component}.docConfig.js smaple


export default ({mode,theme},components)=>{
    
    return {
        header : {
            title : "Title of the component",
            imgUrl : "Sample design of the component",
            description : "Short text about the component"
        },
        
        tabsList : [ "tabId1", "tabId2","tabId2"],
        
        tabsDetail : {
            
            "tabId1"  : {
                 displayName: "Purpose name of tab below listing components",
                 description: "Short description of tab",
                 componentsList: ["component1", "component2"],
                 componentsDetail : {
                     "component1" : {
                         ...desired props of the component respective to the above tab
                     },
                     "component2" : {
                         ...desired props of the component respective to the above tab
                     }
                 }
            },componentType : components.MyComponent,
            "tabId2"  : {},
            "tabId3"  : {},
        }
    }
}

{component}.docConfig.js how to use multiple componentTypes and overriding the componentType.

export default ({mode,theme},components)=>{
  ....
       tabsDetail : {
            
            "tabId1"  : {
                 componentType : components.MyComponent,
                 displayName: ...,
                 description: ...,
                 componentsList: ...,
                 componentsDetail : ...
            }
            "tabId2"  : {
            }
        }
    ....   
}    

{component}.docConfig.js how to use children as componentTypes.

export default ({mode,theme},components)=>{
  ....
       tabsDetail : {
            
            "tabId1"  : {
                 componentType : components.MyComponent,
                 displayName: ...,
                 description: ...,
                 componentsList: ...,
                 componentsDetail : {
                     
                     "component1" : {
                          ...desired props of the component respective to the above tab,
                         children : [
                            <components.{component}Item><components.{component}Item>,
                            <components.{component}Item><components.{component}Item>,
                            <components.{component}Item><components.{component}Item>
                         ]
                         
                     },
                     "component2" : {
                         
                          children : ()=>{
                                return <components.{component}List>
                                         <components.{component}Item><components.{component}Item>,
                                         <components.{component}Item><components.{component}Item>,
                                         <components.{component}Item><components.{component}Item>
                               </components.{component}List>
                          }
                     },
                     
                 }
            }
            "tabId2"  : {
            }
        }
    ....   
}    

{component}.docConfig.js how to use decorate the a component by using styles and HTML.

import DecoratorComponent from "./docsviewer/DecoratorComponent";
import decoratorStyles from "./docsviewer/Decorator.style.css";
export default ({mode,theme},components)=>{
  ....
       tabsDetail : {
            
            "tabId1"  : {
                 componentType : components.MyComponent,
                 displayName: ...,
                 description: ...,
                 componentsList: ...,

                // eslint-disable-next-line react/display-name
                 $decorator : (list)=>{
                      // apply-to-this tab of components list
                     return  <DecoratorComponent>{list}</DecoratorComponent>
                 },
                 $decoratorListClassName : 'apply-to-this-tab-of-components-list',
                 $decoratorItemClassName : 'apply-all-component-under-this-tab',
                 // eslint-disable-next-line react/display-name
                 $decorateComponentItem : (item)=>{
                     // apply-all-component under this tab
                     return  <DecoratorComponent>{list}</DecoratorComponent>
                 },

                 componentsDetail : {
                     
                     "component1" : {
                          ...desired props of the component respective to the above tab,
                          // eslint-disable-next-line react/display-name
                         $decorator : (component) => {
                              return <DecoratorComponent
                              className={decoratorStyles.displayInlineBlock}>
                              {component}
                              </DecoratorComponent>
                        },
                        $decoratorClassName:'apply-to-this-component'
                         
                     },
                     "component2" : {},
                     
                 }
            }
            "tabId2"  : {
            }
        }
    ....   
}    

Note:- // eslint-disable-next-line react/display-name added for prevent the code check-in fix.

FAQs

Package last updated on 13 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc