npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@igor-j86/drag-n-drop

v1.1.2

Published

A data driven drag-n-drop React component

Downloads

184

Readme

DragNDrop

A data driven drag-n-drop component, written in React with TypeScript.

The component will consume the props you pass on the surrounding divs (or other elements), and render the children by determining whether they should be displayed, are accessible, in which order, how many columns they will take up etc.

If you customize the visibility, sort order or columns, the information is being stored in local storage, and will be used by the component to render the children the same way next time you visit the same page.

CSS note: The package comes with a CSS file, but you can choose to whether import it manually from the package or use your own.

Usage

import React from "react";
import { DragNDrop } from "@igor-j86/drag-n-drop";
import "../../node_modules/@igor-j86/drag-n-drop/lib/style/ijdnd.css";

const SomeComponent = () => {
  // Example data
  const data = {
    entry1: {
      tileId: 'entry1',
      sortOrder: 1,
      name: "Entry 1 name",
      isAvailable: true,
      hasAccess: true,
      isDisplayed: true,
      columns: 1,
    },
    entry2: {
      tileId: 'entry2',
      sortOrder: 2,
      name: "Entry 2 name",
      isAvailable: true,
      hasAccess: true,
      isDisplayed: true,
      columns: 3,
    },
    entry3:{
      tileId: 'entry3',
      sortOrder: 3,
      name: "Entry 3 name",
      isAvailable: true,
      hasAccess: true,
      isDisplayed: true,
      columns: 2,
    },
  }

  return (
    <DragNDrop>
      <div {...data.entry1}>
        {data.entry1.name}
      </div>
      <div {...data.entry2}>
        {data.entry2.name}
      </div>
      <div {...data.entry3}>
        {data.entry3.name}
      </div>
    </DragNDrop>
  )
}

export default SomeComponent

Optional props

| Prop | Default | | ----------------------------- | ------------------- | | id:string | 'customizableTiles' | | children:any | '' | | showNonAccessible:boolean | false | | rootClassName:string | 'ijdnd-area' | | language:string | 'en' | | configurationArea:string | 'bottom' |

Language

The component comes with language support for:

  • English - en
  • Norwegian - nb
  • Swedish - sv
  • Danish - da

Tech stack

  • 😱 React
  • 🦺 TypeScript
  • 🛠️ Vite
  • 🪄 PostCSS

License

Distributed under the ISC License.