This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Grid, Input, Select } from 'react-spreadsheet-grid'; | |
// Define the array of positions to choose from them through Select | |
const positions = [{ | |
id: 1, | |
name: 'System Architect' | |
},{ | |
id: 2, | |
name: 'Frontend Developer' | |
}, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
title() { | |
return 'Name'; | |
}, | |
value(row) { | |
return ( | |
<span>{row.name}</span> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Grid, Input, Select } from 'react-spreadsheet-grid'; | |
class GridContainer extends React.PureComponent { | |
constructor(props) { | |
super(props); | |
// It is initially not loaded | |
this.state = { | |
loaded: false | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Grid, Input, Select } from 'react-spreadsheet-grid'; | |
class GridContainer extends React.PureComponent { | |
render() { | |
return ( | |
<Grid | |
rows={this.state.rows} | |
columns={this.state.columns} | |
/> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import { Grid, Input, Select } from 'react-spreadsheet-grid'; | |
import set from 'lodash.set'; | |
import users from './users.json'; | |
const positions = [{ | |
id: 1, | |
name: 'System Architect' | |
},{ | |
id: 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import AdminContent from 'react/components/adminContent'; | |
import UserContent from 'react/components/userContent'; | |
class Page extends React.PureComponent { | |
render() { | |
// a Backbone way - still using the global APP instance | |
if (APP.isUserAdmin()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getStore } from 'react/store'; | |
const Task = Backbone.View.extend({ | |
listenToStore() { | |
const taskId = this.taskId; | |
const store = getStore(); | |
// Listen to changes of the Redux store | |
store.subscribe(() => { | |
const state = store.getState(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { connect } from 'react-redux'; | |
import AdminContent from 'react/components/adminContent'; | |
import UserContent from 'react/components/userContent'; | |
class Page extends React.PureComponent { | |
// Use the state from the store | |
isUserAdmin() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AdminContent from 'views/adminContent'; | |
import UserContent from 'views/userContent'; | |
const Page = Backbone.View.extend({ | |
render() { | |
const contentNode = this.$('.content')[0]; | |
// Use a method of the global app instance | |
// (the model of the current user is hold there) | |
if (APP.isAdminUser()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getStore } from 'react/store'; | |
const Task = Backbone.View.extend({ | |
events: { | |
'click .saveName': function(e) { | |
const name = this.nameInput.value; | |
// Change the name of the task in the model | |
this.model.set('name', name); | |
NewerOlder