1.0.1 • Published 6 months ago

@lxdao/img3 v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Img3

npm version npm downloads

<Img3 /> is a fundamental components for Web3 Apps. It extends HTML <img /> with Web3 decentralization storage, like IPFS. With <Img3 /> you can put ipfs:// in the src and render the image from IPFS with the fastest gateway. Will support ar soon.

Features

  • Supports the ipfs:// protocol.
  • Automatically uses the gateway with the highest speed, And reuse it the next request.
const defaultGateways = [
  'https://nftstorage.link/ipfs/',
  'https://ipfs-gateway.cloud/ipfs/',
  'https://gateway.pinata.cloud/ipfs/',
  'https://4everland.io/ipfs/',
];

Usage

import { Img3 } from '@lxdao/img3';

Props

PropTypeDescriptionDefault
srcstringimage source, support ipfs:// protocol-
altstringimage alt text-
gatewaysstring[]Web3 decentralization storage gatewaysdefaultGateways
timeoutnumbertimeout of gateway request2000
iconIconstyle of loading or error icons{size: 30, color: '#c0c0c0'}

Types reference

Icon

type Icon = {
  /** icon size. */
  size?: number;
  /** icon color. */
  color?: string;
  /** error icon size. */
  errorSize?: number;
  /** error icon color. */
  errorColor?: string;
};
1.0.1

6 months ago

1.1.0

12 months ago

1.0.0

1 year ago

0.0.0

1 year ago