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

post-it-react

v1.1.0

Published

Post-It is a React library that allows you to create and manage sticky notes easily and customizable. It simplifies the creation of interactive user interfaces with notes that can be moved, edited, customized, and deleted easily.

Downloads

82

Readme

Post it Library

Post It is a React library that allows you to create and manage sticky notes easily and customizable. It simplifies the creation of interactive user interfaces with notes that can be moved, edited, customized and deleted easily.

post-it-library-preview

Installation

To install Post It library:

  npm install post-it-react

Page

URL Page

Single post it example

import PostIt from 'post-it-react'

function App () {
  return <PostIt id={'unique-id'} position={{ x: 316, y: 212 }} text={'Hi, Im a post it! 🧉'} action={'copy'} fill={'#FEE440'} />
}

List post it example

import { useState, useEffect } from 'react'
import PostIt from 'post-it-react'

export default function App () {
  const [postItList, setPostItList] = useState([])

  useEffect(() => {
    const clickEvent = (e: MouseEvent) => {
      const isPostIt = (e.target as HTMLElement).classList.contains('post-it')
      if (isPostIt) return
      const postItData = {
        id: crypto.randomUUID(),
        position: { x: e.clientX, y: e.clientY },
        text: '',
        fill: '#FEE440'
      }
      setPostItList([...postItList, { ...postItData }])
    }
    window.addEventListener('dblclick', clickEvent)
    return () => window.removeEventListener('dblclick', clickEvent)
  }, [postItList])


  return (
    <>
      {
        postItList.length > 0 && postItList.map(({ id, position, text, fill }) => (
          <PostIt key={id} postItListState={[postItList, setPostItList]} id={id} position={position} text={text} fill={fill} action={'delete'} />
        ))
      }
    </>
  )
}

Table of props

| Prop | Type | Description | Default | Examples | | :-------- | :------- | :------- | :------- | :------------------------- | | id | T | Set Id unique for post it | - | Number: 12345String: post-it-id-1Other values...| | position | { x: number, y: number } | Set coords (x/y) for post it position | - | { x: 212, y: 316 } | | text | string | Set text for post it | "" | Hi, I'm a post it! 🧉 | | className? | string | Set Css class for post it | post-it-classic | post-it-class | | fill? | string | Set the background-color of post it | yellow | ColorName: yellowHex: #EFE9AE | | color? | string | Set the text color of post it | black | ColorName: blackHex: #000000 | | opacity? | number | Set the opacity of post it (from 0 to 1) | 1 | 0 to 1 | | rounded? | number | Set the border-radius of post it | 0 | 30 | | hidden? | boolean | Set the display: hidden for post it if true | false | TrueFalse font? | [number / string(Css unit), {100-900} / {lighter-bolder}, string] | Set the fontSize (if value is number it will be in px), fontWeight and fontFamily of the post it | ["", "", ""] | ['2em', 'bold', '"Inter", sans-serif'][18, 600, '"Inter", sans-serif'][18, '', ''] | postItListState? | [T[], React.Dispatch<React.SetStateAction<T[]>>] | Set the current state and the state updater function. This allows you to store all the post its and iterate through them | - | [postItList, setPostItList] (Recommended: useState()) | | styleBentCorner? | boolean | Set the preset style (styleBentCorner) for post it if true | false | TrueFalse | | stylePinned? | boolean | Set the preset style (stylePinned) for post it if true | false | TrueFalse | | customPlaceholder? | string / string[] | Set one or more placeholders for post it. (If it is an array, each value will be set randomly) | Write something... | String: Write something... Array: ['Write here', 'Type something', 'I'm thinking about...'] | | customDefaultText? | string | Set a initial default text for post it | "" | Default text example | | action? | none / copy / delete / block / [JSX.Element, ((...args: T[]) => T), string / null, React.CSSProperties?] | Set a action button with onClick function for post it. - none: -. - copy: copy (clipboard) the current text of post it. - delete: delete the post it. - block: block the drag functionality of post it. - custom: [Jsx.Element, function, class, style] | none | nonecopydeleteblock[<span>❗</span>, handleShowInfo, action-class, { fill: '#EFE9AE' }] | | actionFixed? | boolean | Set the action button to always be visible | false | TrueFalse | | disableEditPostIt? | boolean | Disable the edit functionality of post it if true | false | TrueFalse | | disableDeletePostIt? | boolean | Disable the delete functionality of post it if true | false | TrueFalse | | disableDragPostIt? | boolean | Disable the drag functionality of post it if true | false | TrueFalse |