An open API service indexing awesome lists of open source software.

https://github.com/afeiship/react-layout-trbla

Simply trbla layout for react.
https://github.com/afeiship/react-layout-trbla

align auto center configuration flex horizontal justify lar layout middle react simple tmb trbla vertical

Last synced: about 2 months ago
JSON representation

Simply trbla layout for react.

Awesome Lists containing this project

README

        

# react-layout-trbla
> Simply trbla layout for react.

[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```shell
npm install -S @jswork/react-layout-trbla
```

## properties
| Name | Type | Required | Default | Description |
| --------- | ------ | -------- | --------- | ------------------------------------- |
| className | string | false | - | The extended className for component. |
| nodeName | any | false | 'div' | The container tag name. |
| value | enum | false | - | The layout type. |
| align | enum | false | 'initial' | The flex layout align-items. |
| wrap | bool | false | false | The flex layout flex-wrap. |

## usage
1. import css
```scss
// or use sass
@import '~@jswork/wsui-layout-trbla/dist/index.scss';
@import "~@jswork/react-layout-trbla/dist/style.scss";

// customize your styles:
$react-layout-trbla-options: ()
```
2. import js
```js
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactLayoutTrbla from '@jswork/react-layout-trbla';
import './assets/style.scss';

const LAYOUT_MAPPING = {
la: 'left -> auto',
lar: 'left -> auto -> right',
ar: 'auto -> right',
lr: 'left -> right or justify',
ta: 'top -> auto',
tab: 'top -> auto -> bottom',
ab: 'auto -> bottom',
tb: 'top -> bottom or justify'
};

class App extends React.Component {
state = {
layouts: ReactLayoutTrbla.layouts,
value: 'la'
};

get valueCount() {
return this.state.value.length;
}

render() {
const { value } = this.state;
return (



Select a value:

{
this.setState({ value: e.target.value });
}}>
{this.state.layouts.map((item) => (
{item}
))}



{LAYOUT_MAPPING[value]}



start

auto

{(this.valueCount === 3 || value === 'lr' || value === 'tb') && (
end

)}

Wrap: true



item

item

item

item

item

item

item

item

item

item

item

Wrap: false



item

item

item

item

item

item



);
}
}

ReactDOM.render(, document.getElementById('app'));

```

## documentation
- https://afeiship.github.io/react-layout-trbla/

## license
Code released under [the MIT license](https://github.com/afeiship/react-layout-trbla/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/react-layout-trbla
[version-url]: https://npmjs.org/package/@jswork/react-layout-trbla

[license-image]: https://img.shields.io/npm/l/@jswork/react-layout-trbla
[license-url]: https://github.com/afeiship/react-layout-trbla/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-layout-trbla
[size-url]: https://github.com/afeiship/react-layout-trbla/blob/master/dist/react-layout-trbla.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/react-layout-trbla
[download-url]: https://www.npmjs.com/package/@jswork/react-layout-trbla