0.0.6 • Published 3 months ago

nullstack-dnd v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Nullstack DnD

Inspired by react-beautiful-dnd, but oversimplified for all the nullstack folks

Installation

yarn add nullstack-dnd

or

npm install nullstack-dnd

Usage

To use nullstack-dnd you should import it, then wrap your draggable components with it

Example

import Nullstack from "nullstack";
import { NullstackDnD } from "nullstack-dnd";

import { ProductCard } from "./common/Card";

import "./styles.css";

export class NullstackApp extends Nullstack {
  products = [
    // {...},
    // {...},
    // {...},
  ];

  render() {
    return (
      <NullstackDnD
        // you can append a class to the dnd wrapper
        class="cool-dnd"
        // optional dnd configuration
        options={{
          column_gap: 20,
          columns_count: 3,
          rearranging_duration: 100,
        }}
      >
        {this.products.map((product) => (
          <ProductCard
            category="Comidinha"
            image={product.pictures[0].url}
            name={product.name}
            onChangeCategory={() => null}
            onDelete={() => null}
            onEdit={() => null}
            price={product.price}
            variants={product.variants.length}
            data-id={product.id}
          />
        ))}
      </NullstackDnD>
    );
  }
}
0.0.5

3 months ago

0.0.6

3 months ago

0.0.4

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago