New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-tile-layout

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tile-layout

React-Tile-Layout is a grid layout for dynamically configurable tiles which is based on [React-Grid-Layout](https://npmjs.com/package/react-grid-layout)

latest
Source
npmnpm
Version
0.1.6
Version published
Maintainers
1
Created
Source

React-Tile-Layout

React-Tile-Layout is a grid layout for dynamically configurable tiles which is based on React-Grid-Layout

Installation

Install the React-Tile-Layout package:

npm install react-grid-layout

Include the following stylesheets in your application:

/node_modules/react-grid-layout/css/styles.css
/node_modules/react-resizable/css/styles.css

Usage

import React from "react";
import { TileLayout, Tile, ReactTileLayout } from "react-tile-layout";

const breakpoints = { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 };
const cols = { lg: 12, md: 10, sm: 8, xs: 6, xxs: 4 };

export default function App() {
  return (
    <TileLayout
      tileComponent={TileComponent}
      breakpoints={breakpoints}
      cols={cols}
    >
      <Tile name="Tile 1" layout={{ w: 2, h: 1, static: true }} />
      <Tile name="Tile 2" layout={{ w: 2, h: 2, minW: 1, maxW: 2 }} />
      <Tile name="Tile 3" layout={{ w: 1, h: 1 }} someProp="Hello" />
      <Tile name="Tile 4" layout={{ w: 1, h: 1 }} disabled />
    </TileLayout>
  );
}

const TileComponent = React.forwardRef(
  (
    {
      name,
      layoutSpec,
      props: { someProp },
      children,
      ...rest
    }: ReactTileLayout.TileComponentProps,
    ref: React.Ref<HTMLDivElement>
  ) => {
    return (
      <div
        {...rest}
        style={{
          ...rest.style,
          border:
            layoutSpec.static || layoutSpec.isDraggable === false
              ? "1px solid blue"
              : "1px solid red",
        }}
        ref={ref}
      >
        {children}
        {name} - {someProp || "default"}
      </div>
    );
  }
);

You can find a working example on GitHub.

Simply clone the project and run the following commands:

npm install
npm start

FAQs

Package last updated on 29 Jun 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