JSPM

@path-tree/react

0.3.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q15856F
    • License MIT

    Provides components with a hierarchical structure.

    Package Exports

    • @path-tree/react

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@path-tree/react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @path-tree/react

    npm version

    Usage

    DEMO

    Install

    yarn add @path-tree/react tslib

    Basic Usage

    import * as React from "react";
    import * as ReactDOM from "react-dom";
    import * as PathTree from "@path-tree/react";
    
    const props: PathTree.Props = {
      pathItems: [
        {
          type: "file",
          path: "a/b/index.js",
        },
        {
          type: "file",
          path: "a/b/c/index.js",
        },
      ],
    };
    
    ReactDOM.render(<PathTree.Component {...props} />, document.querySelector("#root"));

    Define components

    import * as PathTree from "@path-tree/react";
    
    const props: PathTree.Props = {
      FileComponent: (fileProps) => {
        return <p>{fileProps.path}</p>;
      },
      DirectoryComponent: (directoryProps) => {
        return <div>{directoryProps.children}</div>;
      },
      pathItems: [
        {
          type: "file",
          path: "a/b/index.js",
        },
        {
          type: "file",
          path: "a/b/c/index.js",
        },
      ],
    };

    LICENSE

    @path-tree/react is MIT licensed.