/react-file-browser-cu

A simple file browser with react hooks

Primary LanguageJavaScript

file-browser-cu

Travis npm package Coveralls

Describe file-browser-cu here.

A simple file browser library for react.

Usage

const files = [
  { path: 'src/functions/styles.css' },
  { path: 'hook.js' },
  { path: 'src/functions/' }
];

function exampleFileBrowser(props){

  const onClickFile = (file) => {
    console.log('click on file', file);
  };

  const onClickFolder = (folder) => {
    console.log('click folder', folder);
  };
  
  const onOpenFolder = (folder) => {
    console.log('open folder', folder);
  };

  const onCloseFolder = (folder) => {
    console.log('close folder', folder);
  };

  return (
    <div className="demo">
       <FileBrowserCu 
        files={files}
        onClickFile={onClickFile}
        onClickFolder={onClickFolder}
        onOpenFolder={onOpenFolder}
        onCloseFolder={onCloseFolder}
      />
    </div>
  );
}