1.0.9 • Published 4 years ago

villain-react v1.0.9

Weekly downloads
1,620
License
MIT
Repository
github
Last release
4 years ago

Installation

$ yarn add villain-react

WebWorker

This project uses libarchivejs for extracting compressed archives, so you will need to provide the path of webworker:

The webworker bundle lives in libarchive.js/dist folder so you need to make sure that it is available in your public folder since it will not get bundled if you're using bundler (it's all bundled up already)

const workerUrl = 'path to ../build/worker-bundle.js',

Formats

Supported archives formats by libarchive.js

  • ZIP
  • 7-Zip
  • RAR v4
  • RAR v5
  • TAR

Usage

Import the component and the css styles

// Component
import Villain from 'villain-react'

// Css styles
import 'villain-react/dist/style.css'

// Path of the comicbook archive, it can also be a file or blob
const url = './files/test.cbz'

// Path of the libarchivejs webworker bundle
const workerUrl = 'path to ../build/worker-bundle.js',

//...

<Villain source={url} options={opts} />

Props

Available props of the component:

NameTypeDefaultDescription
styleObjectnullInline styles for root container.
sourcestring, file, blobnullPath or file source of the archive.
optionsobjectoptionsOptions to customize the reader component
classNamestringnullCustom css class name
workerUrlstringnullPath to libarchive.js worker-bundle

Options

Available options to customize the reader component:

NameTypeDefaultDescription
themestring'Light'Choose CSS styling from between ('Light', 'Dark).
maxPagesnumber500Max number of pages to extract and render.
mangaModeboolfalseRead right to left.
forceSortbooltrueFix sort order of pages (#235)
allowFullScreenbooltrueShow full screen button.
autoHideControlsboolfalseSet initial auto hide state of toolbar.
allowGlobalShortcutsboolfalseAllows shortcuts without having to focus the viewer.

Development

Run yarn command to install the dependencies.

To start the development run yarn start, this will open up localhost:8080 on your default browser:

  • This uses webpack-dev-server and includes hot-reloading.

An example archive has been provided to play around inside ./build/testFile

  • A good resource for archives can be found here: https://archive.org/details/comics.
  • Alternative, any compressed folder (zip, rar, tar, etc) with a few images will also do the job.

Known issues

  • Accessibility issues #23
  • Some .rar and .cbr fail to load #1
  • Encrypted archived are not yet supported #26

Credits

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

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

0.0.9

5 years ago

0.0.8

5 years ago