Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nft-collection-gallery

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nft-collection-gallery

This is a codebase spun out from GENGEN for viewing all your tokens in a gallery with Trait Filters. The default design is basic HTML/CSS and allows easy customization.

  • 0.5.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-81.82%
Maintainers
1
Weekly downloads
 
Created
Source

This is a codebase spun out from GENGEN for viewing all your tokens in a gallery with Trait Filters. The default design is basic HTML/CSS and allows easy customization.

NFT Collection Gallery

NFT Collection Gallery

You can find a demo here: https://nft-collection-gallery-demo.vercel.app/

Install

npm:

npm install nft-collection-gallery

yarn:

yarn add nft-collection-gallery

Usage

Here's how to call the component in React:

<CollectionGallery tokens={tokens} />

Here is an example of what data structure expected from tokens:

[
  {
    "name": 1,
    "image": "larva-neko.png",
    "attributes": [
      {
        "trait_type": "Eyewear",
        "value": "Small Shades"
      },
      {
        "trait_type": "Background",
        "value": "Lavendar"
      },
      {
        "trait_type": "Type",
        "value": "Ape"
      },
      {
        "trait_type": "Headwear",
        "value": "Beanie"
      }
    ],
  },
  ...
]

Trait Filter

Trait Filters

Terminology

Eyewear is a Trait. Scouter is a Variation.

Filter Logical Conjunctions

The filters use a logical AND between each Trait. Within each Trait, the filter uses a logical OR for each Variation.

For example, let's assume only Headband and Bandana were selected then it would show all tokens with one or the other.

Taking that example further, if Scouter in Eyewear were also selected then then it would show all tokens with the Scouter AND one of the Headwear selected.

Here is a formula expression for how it works:

Trait A = [Variation A, Variation B]
Trait B = [Variation C]
Trait C = [Variation D, Variation E]

Trait A && Trait B && Trait C = (Variation A || Variation B) && (Variation C) && (Variation D || Variation E)

Customization

There are 4 props available in CollectionGallery for you to customize your gallery.

  • GalleryLayout
  • FiltersLayout
  • TokensLayout
  • CurrentFiltersLayout

Here is an oversimplified usage example. If you pass in a basic "hello world" into GalleryLayout then you will complete overwrite everything. Obviously, you wouldn't do that, but it should help you understand how the basic idea of customization. I would suggest looking at the respective default components as examples.


const HelloWorld = () => "HelloWorld"

<CollectionGallery GalleryLayout={HelloWorld} />

You can refer to the default components of each one to get an idea for how to customize. It should be very straight forward for any React developer.

  • DefaultGalleryLayout
  • DefaultFiltersLayout
  • DefaultTokensLayout
  • DefaultCurrentFiltersLayout

WIP - I will be extracting out the original MUI theme into a separate repo and then updating this readme with instructions.

Here's how the gallery would look like with MUI. NFT Collection Gallery with a MUI theme

Contribution

There is an example create-react-app that you can use in example/ to help test the build files locally. You must link certain packages for it to work.

Build

You have to run the commands to build the files locally for testing. To do so,

npm run build

Linking

In order to develop locally against your local build using the example/ directory, you will need to symlink certain node_module/ packages.

# ./
yarn link-all

Unlinking

If you want to pull the packages for example/ as normal after linking:

yarn unlink-all
yarn install --check-files

FAQs

Package last updated on 07 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc