0.2.3 • Published 1 year ago

react-hexviewer-ts v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

React Hex Viewer Ts

A component is a minor reworking and rethinking of a component react-hexviewer (thanks tperson) in the typescript

Screenshot

Example

import React from 'react';
import {HexViewer} from 'react-hex-viewer-ts';
// data is Buffer | number[] | base64 | hex
React.render(
    <HexViewer>{data}</HexViewer>, 
    document.body);

The component has props interface HexViewerProps.

export interface HexViewerProps {
  /** number of bytes per row */
  rowLength?: number;
  /** number of bytes between a visible split */
  setLength?: number;
  /** Buffer | number[] | string as base64 or raw hex */
  children: string | Buffer | number[];
  /** sign that the data is hex */
  hex?: boolean;
  /** sign that the data is base64 */
  base64?: boolean;
  /** Component that will be displayed if there is no data */
  noData?: ReactNode;
  /** Component that will be displayed if data parsing is unsuccessful */
  errorData?: ReactNode;
}

Styling

In your projects, you can import less or scss styling from a package

Less

@import '../node_modules/react-hexviewer-ts/less/variables.less'; // for some reason ~react-hexviewer-ts does't work properly
@hex-color: rgb(189, 189, 189); // you can redefine variables from variables.less
@import '~react-hexviewer-ts/less/hex-viewer.less';

Sass

$hex-color: rgb(189, 189, 189); // you can redefine variables from variables.scss
@import '~react-hexviewer-ts/scss/hex-viewer.scss';

Storybook demo

Demo link

Comments are welcome

0.2.1

1 year ago

0.2.0

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago