1.3.12 • Published 3 years ago

react-split-strip-packing-layout v1.3.12

Weekly downloads
44
License
MIT
Repository
github
Last release
3 years ago

react-split-strip-packing-layout

A react layout based on the Split Algorithm by Golan et al. doi. It's functional, though still being developed. Child components are packed from either the top left or the bottom reight whereas it is attempted to minimise the height.

Install

npm install react-split-strip-packing-layout

Usage

The main layout component is <SplitLayout>. All its children are subject of the layout algorithm and are wrapped by divs that are draggable and resizable. The resize is done by giving the children some of the following properties: 1. splitLayoutWidth: Defines the extend in the horizontal direction 2. splitLayoutHeight: Defines the extend in the vertical direction 3. splitLayoutFlip: If true, and if the component is vertical (height > width), then splitLayoutWidth and splitLayoutHeight are flipped (i.e. then splitLayoutWidth defines the height and splitLayoutHeight the width)

import React from 'react';
import { SplitLayout, Dimensions } from "react-split-layout";

export const Component: FunctionComponent = () => {

    // the dimensions of the container in which the layout will happen
    const dimensions: Dimensions = {width: 1200, height: 800};
    const bottomRight: boolean = true; // if true, layout starts from bottom right, otherwise top left

    const width = "10%"; // this component's width will use 10% of the container size
    const height = "auto";
    const flip = true; // if the component is vertical, instead of the component's width
                       // using 10% of the container size, the component's height will

    const components = [
        <SomeComponent 
            splitLayoutWidth={width}
            splitLayoutHeight={height}
            splitLayoutFlip={flip}
        />,
        <AnotherComponent />
    ];

    return (
        <SplitLayout
            dimensions={dimensions}
            bottomRight={bottomRight}
        >
            {components}
        </SplitLayout>
    )
   
}

License

MIT

1.3.10

3 years ago

1.3.11

3 years ago

1.3.12

3 years ago

1.3.9

3 years ago

1.3.8

3 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.28

3 years ago

1.1.27

3 years ago

1.1.26

3 years ago

1.1.25

3 years ago

1.1.23

3 years ago

1.1.22

3 years ago

1.1.24

3 years ago

1.1.21

3 years ago

1.1.20

3 years ago

1.1.16

3 years ago

1.1.19

3 years ago

1.1.18

3 years ago

1.1.17

3 years ago

1.1.15

3 years ago

1.1.14

3 years ago

1.1.13

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.10

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago