Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased] (need to update branch gh-page when merged on "master")

### Added
Transform the generated layout as static

### Added
Choose which item is static or not

## [3.0.0] - 03/21/2019

### Added
Expand Down
4 changes: 2 additions & 2 deletions demo/bootstrap/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<head>
<meta charset="UTF-8">
<title>React Grid Layout Builder Demo with Bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome/css/font-awesome.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="/stylesheets/react-grid-layout/styles.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/react-resizable/styles.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/react-grid-layout-with-builder.css">
Expand Down
2 changes: 1 addition & 1 deletion demo/material-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8">
<title>React Grid Layout Builder Demo with Materia UI</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/stylesheets/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="/stylesheets/react-grid-layout/styles.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/react-resizable/styles.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/react-grid-layout-with-builder.css">
Expand Down
32 changes: 30 additions & 2 deletions demo/src/bootstrap/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,22 @@ const defaultReactGridLayoutProps = {

class ReactGridLayoutBuilderDemo extends React.Component {
generateDOM = () => {
const isAllStatic = this.props.conf.isAllStatic;
const toggleStatic = this.props.toggleStatic;
return _.map(this.props.conf.layouts.lg, function(l, i) {
const staticGrid = isAllStatic ? true : l.static;
return (
<div key={i} className={l.static ? "static" : ""}>
{l.static ? (
<div key={i} className={staticGrid ? "static" : ""}>
<div>
<i
className={`float-right p-1 fa fa-thumbtack ${
staticGrid ? "" : "fa-rotate-90"
}`}
aria-hidden="true"
onClick={() => toggleStatic(l)}
/>
</div>
{staticGrid ? (
<span
className="text"
title="This item is static and cannot be removed or resized."
Expand Down Expand Up @@ -90,6 +102,21 @@ export default class App extends React.Component {
this.setState(config);
};

toggleStatic = grid => {
const newlayouts = { ...this.state.layouts };
const newitems = newlayouts.lg.slice();
const index = newitems.findIndex(function(item) {
return item.i === grid.i;
});
if (index === -1) return;

newitems[index].static = !grid.static;

this.setState({
layouts: newlayouts
});
};

handleFile = element => {
// https://www.html5rocks.com/en/tutorials/file/dndfiles/
const files = element.files;
Expand Down Expand Up @@ -124,6 +151,7 @@ export default class App extends React.Component {
<ReactGridLayoutBuilderDemo
conf={this.state}
updateConfig={this.updateConfig}
toggleStatic={this.toggleStatic}
/>
</Col>
<Col xs={12} md={3} lg={2}>
Expand Down
31 changes: 29 additions & 2 deletions demo/src/material-ui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,22 @@ const defaultReactGridLayoutProps = {

class ReactGridLayoutBuilderDemo extends React.Component {
generateDOM = () => {
const isAllStatic = this.props.conf.isAllStatic;
const toggleStatic = this.props.toggleStatic;
return _.map(this.props.conf.layouts.lg, function(l, i) {
const staticGrid = isAllStatic ? true : l.static;
return (
<div key={i} className={l.static ? "static" : ""}>
{l.static ? (
<div key={i} className={staticGrid ? "static" : ""}>
<div>
<i
className={`float-right p-1 fa fa-thumbtack ${
staticGrid ? "" : "fa-rotate-90"
}`}
aria-hidden="true"
onClick={() => toggleStatic(l)}
/>
</div>
{staticGrid ? (
<span
className="text"
title="This item is static and cannot be removed or resized."
Expand Down Expand Up @@ -96,6 +108,20 @@ export default class App extends React.Component {
this.setState(config);
};

toggleStatic = grid => {
const newlayouts = { ...this.state.layouts };
const newitems = newlayouts.lg.slice();
const index = newitems.findIndex(function(item) {
return item.i === grid.i;
});
if (index === -1) return;

newitems[index].static = !grid.static;

this.setState({
layouts: newlayouts
});
};
handleFile = element => {
// https://www.html5rocks.com/en/tutorials/file/dndfiles/
const files = element.files;
Expand Down Expand Up @@ -137,6 +163,7 @@ export default class App extends React.Component {
<ReactGridLayoutBuilderDemo
conf={this.state}
updateConfig={this.updateConfig}
toggleStatic={this.toggleStatic}
/>
</div>
<div
Expand Down
7 changes: 0 additions & 7 deletions demo/stylesheets/font-awesome/HELP-US-OUT.txt

This file was deleted.

Loading