🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@ju-skinner/sw-doc-components

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ju-skinner/sw-doc-components

Documentation components

latest
Source
npmnpm
Version
0.9.1
Version published
Maintainers
0
Created
Source

Doc Components

Background

We started off using Storybook to document our Stencil Web Components. With Stencil you have framework integrations or Output Targets, we were using React. Instead of having multiple versions of Storybook (WebComponents, React, etc), we elected to recreate the common components we used within Storybook (ArgsTable and Canvas).

Components

docArgsTable

The docArgsTable component can be used to show a static table of arg types for a given component as a way to document its interface.

Properties

namedescription
docSourceThe docs-json output type from Stencil. During compiliation Stencil will generate a JSON file with all of the components metadata. You can read more about docs-json here. It expects the components key.
componentNameThe name of the component to lookup.

docCanvas

The Canvas component is a wrapper, featuring a series of buttons to view the various Source snippets.

Properties

namedescription
mdxSourceAn object of key/value pairs. Each key will render a button that will show the source code.

How to use

docArgsTable

import { DocArgsTable } from '@ju-skinner/sw-doc-components';
import { components } from '../../../../dist/docs.json';

<DocArgsTable componentName='pds-radio' docSource={components} />

output Alt text

docCanvas

import { DocCanvas } from '@ju-skinner/sw-doc-components';

<DocCanvas mdxSource={{
  react: `<PdsRadio componentId="message1" label="Label" helperMessage="This is short message text." />`,
  webComponent: `<pds-radio component-id="message1" label="Label" helper-message="This is short message text." />`
}}>
  <pds-radio component-id="message1" label="Label" helper-message="This is short message text." />
</DocCanvas>

output

Default state Alt text

Active Tab Alt text

FAQs

Package last updated on 02 Aug 2024

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