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

react-bento

v1.0.9

Published

![React bento](public/react_bento.png)

Downloads

194

Readme

React bento

react-bento is a component library for creating dynamic and flexible layouts inspired by Bento box design. It allows you to organize items in a grid with support for custom dimensions, colors, and more.

Real example

Example

You can see the real example here

Getting started

Install the library using npm or yarn:

npm install react-bento

or

yarn add react-bento

Usage

Here is an example of how to use react-bento:

Import the Library

import { BentoGrid } from "react-bento";
import "react-bento/dist/index.css"; // Ensure you import the CSS file

Define Your Items

import React from "react";

const bentoItems = [
  {
    id: 3,
    title: "Item 3",
    color: "bg-state-yellow",
    element: (
      <div className="flex-col justify-center space-y-3 items-center h-full px-4 flex relative">
        <p className="text-[12px] sm:text-medium font-medium -mt-8 sm:mt-0 relative">
          In 2015 I founded a theatre company that is still running.
        </p>
        <p className="text-[12px] sm:text-medium font-medium relative">
          In 2017 I created an Escape Room which is still running.
        </p>
        <p className="text-[12px] sm:text-medium font-medium relative">
          I love the responsibility of new projects.
        </p>
        <ActionLink
          className="absolute right-0 bottom-0"
          label="Visit"
          path="https://www.linkedin.com/in/pablonaveira/"
        />
      </div>
    ),
    width: 1,
    height: 2,
  },
  {
    id: 4,
    color: "bg-state-green",
    title: "Item 4",
    element: (
      <WorkItem
        time="07 / 2024 - NOW"
        place="Inditex"
        job="Frontend tech lead"
        link="Skills"
        className="absolute top-0 right-0"
        workDetails={
          <ul className="w-full text-[10px] sm:text-xs list-disc grid grid-cols-2 px-4">
            <li className="px-2">Code reviews ensuring good practices.</li>
            <li className="px-2">
              Mentoring and onboarding of new frontend profiles.
            </li>
            <li className="px-2">CI / CD with Github Actions.</li>
            <li className="px-2">Releases preparation.</li>
            <li className="px-2">New projects approach.</li>
            <li className="px-2">2 week sprints in Agile methodology.</li>
          </ul>
        }
      />
    ),
    width: 2,
    height: 1,
  },
  {
    id: 5,
    title: "Item 5",
    element: (
      <div className="flex justify-center items-center h-full text-xs sm:text-normal p-4 font-medium relative">
        My best virtue is the day-to-day dealings. A fool in the team makes all
        flows better.
      </div>
    ),
    width: 1,
    height: 1,
  },
];

Render the Bento Grid

const MyBentoGrid = () => {
  return (
    <BentoGrid
      items={bentoItems}
      gridCols={4}
      rowHeight={100}
      classNames={{
        container: "my-custom-container-class",
        elementContainer: "my-custom-element-class",
      }}
    />
  );
};

export default MyBentoGrid;

Types

The following types are used in react-bento:

import React from "react";

export type BentoItem = {
  id: number;
  title: string;
  element: React.ReactNode;
  width: number;
  color?: string;
  height: number;
};

export type BentoItems = BentoItem[];

export type ClassNames = {
  container?: string;
  elementContainer?: string;
};

export type BentoGridProps = {
  items: BentoItems;
  gridCols?: number;
  rowHeight?: number;
  classNames: ClassNames;
};

License

This project is licensed under the MIT License.