commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
a4718b967fd67d69aac0f2120d728a7cce3b28fa
src/DirectChat.test.jsx
src/DirectChat.test.jsx
import React from 'react'; import { shallow } from 'enzyme'; import DirectChat from './DirectChat'; test('Passes message on form submit', () => { const message = 'hey!'; let received = null; const wrapper = shallow(<DirectChat style="primary" onSubmitMessage={(val) => { received = val; }} />); wrapper.find('[name="message"]').simulate('change', { target: { value: message, }, }); wrapper.find('Form').simulate('submit', { preventDefault: () => {}, }); expect(received).toEqual(message); });
import React from 'react'; import { shallow, mount } from 'enzyme'; import DirectChat from './DirectChat'; test('Passes message on form submit', () => { const message = 'hey!'; let received = null; const wrapper = shallow(<DirectChat style="primary" onSubmitMessage={(val) => { received = val; }} />); wrapper.find('[name="message"]').simulate('change', { target: { value: message, }, }); wrapper.find('Form').simulate('submit', { preventDefault: () => {}, }); expect(received).toEqual(message); }); class ToggleContacts extends React.Component { constructor(props, context) { super(props); this.state = { toggle: context.$adminlte_directchat.toggleContacts, }; this.toggle = this.toggle.bind(this); } componentDidMount() { this.state.toggle(); } toggle() { this.state.toggle(); } static contextTypes = { $adminlte_directchat: React.PropTypes.shape({ toggleContacts: React.PropTypes.func, }), }; render() { return <a onClick={this.toggle} />; } } test('Shown on toggle', () => { const wrapper = mount(<DirectChat style="primary"><ToggleContacts /></DirectChat>); expect(wrapper.state('contactsOpen')).toEqual(true); }); test('Hidden on toggle', () => { const wrapper = mount(<DirectChat style="primary"><ToggleContacts /></DirectChat>); wrapper.find(ToggleContacts).find('a').simulate('click'); expect(wrapper.hasClass('direct-chat-contacts-open')).toEqual(false); });
Test DirectChat receiving contact toggle
Test DirectChat receiving contact toggle
JSX
mit
react-admin-lte/react-admin-lte,jonmpqts/reactjs-admin-lte,react-admin-lte/react-admin-lte
--- +++ @@ -1,5 +1,5 @@ import React from 'react'; -import { shallow } from 'enzyme'; +import { shallow, mount } from 'enzyme'; import DirectChat from './DirectChat'; test('Passes message on form submit', () => { @@ -19,3 +19,43 @@ }); expect(received).toEqual(message); }); + +class ToggleContacts extends React.Component { + constructor(props, context) { + super(props); + this.state = { + toggle: context.$adminlte_directchat.toggleContacts, + }; + + this.toggle = this.toggle.bind(this); + } + + componentDidMount() { + this.state.toggle(); + } + + toggle() { + this.state.toggle(); + } + + static contextTypes = { + $adminlte_directchat: React.PropTypes.shape({ + toggleContacts: React.PropTypes.func, + }), + }; + + render() { + return <a onClick={this.toggle} />; + } +} + +test('Shown on toggle', () => { + const wrapper = mount(<DirectChat style="primary"><ToggleContacts /></DirectChat>); + expect(wrapper.state('contactsOpen')).toEqual(true); +}); + +test('Hidden on toggle', () => { + const wrapper = mount(<DirectChat style="primary"><ToggleContacts /></DirectChat>); + wrapper.find(ToggleContacts).find('a').simulate('click'); + expect(wrapper.hasClass('direct-chat-contacts-open')).toEqual(false); +});
cc0436ae92ca2a2124d7e4a9ce79990106d39cef
imports/ui/structure-view/element-tree.jsx
imports/ui/structure-view/element-tree.jsx
import React, { PropTypes } from 'react'; import { createContainer } from 'meteor/react-meteor-data'; import Elements from '../../api/elements.js'; import Element from './element.jsx'; import AddElementButton from './add-element-button.jsx'; const addElementButtonDivStyle = { border: '1px solid #ddd', backgroundColor: '#F8F8F8', padding: '10px', }; const addElementButtonPossibleTypes = [Elements.types.find((element) => element.name === 'dimension')]; const elementsStyle = { border: '1px solid #ddd', borderTop: 'none', padding: '7px', }; const ElementTree = (props) => ( <div id="element-tree"> <div style={addElementButtonDivStyle}> <AddElementButton possibleTypes={addElementButtonPossibleTypes} /> </div> <div id="elements" style={elementsStyle}> {props.elements.map((element) => { return ( <Element setSelectedElementId={props.setSelectedElementId} key={element._id} data={element} /> ); })} </div> </div> ); ElementTree.propTypes = { elements: PropTypes.array.isRequired, setSelectedElementId: PropTypes.func.isRequired, }; export default createContainer(() => { return { elements: Elements.collection.find({ parentId: { $exists: false } }).fetch(), }; }, ElementTree);
import React, { PropTypes } from 'react'; import { createContainer } from 'meteor/react-meteor-data'; import Elements from '../../api/elements.js'; import Element from './element.jsx'; import AddElementButton from './add-element-button.jsx'; import { Panel } from 'react-bootstrap'; const elementTreeHeader = () => ( <AddElementButton possibleTypes={[Elements.types.find((element) => element.name === 'dimension')]} /> ); const ElementTree = (props) => ( <div id="element-tree"> <Panel header={elementTreeHeader()}> <div id="elements"> {props.elements.map((element) => { return ( <Element setSelectedElementId={props.setSelectedElementId} key={element._id} data={element} /> ); })} </div> </Panel> </div> ); ElementTree.propTypes = { elements: PropTypes.array.isRequired, setSelectedElementId: PropTypes.func.isRequired, }; export default createContainer(() => { return { elements: Elements.collection.find({ parentId: { $exists: false } }).fetch(), }; }, ElementTree);
Make element tree use bootstrap panel and refactor to aline with coding style
Make element tree use bootstrap panel and refactor to aline with coding style
JSX
mit
minden/data-furnace,minden/data-furnace
--- +++ @@ -3,40 +3,29 @@ import Elements from '../../api/elements.js'; import Element from './element.jsx'; import AddElementButton from './add-element-button.jsx'; +import { Panel } from 'react-bootstrap'; -const addElementButtonDivStyle = { - border: '1px solid #ddd', - backgroundColor: '#F8F8F8', - padding: '10px', -}; - -const addElementButtonPossibleTypes = - [Elements.types.find((element) => element.name === 'dimension')]; - -const elementsStyle = { - border: '1px solid #ddd', - borderTop: 'none', - padding: '7px', -}; +const elementTreeHeader = () => ( + <AddElementButton + possibleTypes={[Elements.types.find((element) => element.name === 'dimension')]} + /> +); const ElementTree = (props) => ( <div id="element-tree"> - <div style={addElementButtonDivStyle}> - <AddElementButton - possibleTypes={addElementButtonPossibleTypes} - /> - </div> - <div id="elements" style={elementsStyle}> - {props.elements.map((element) => { - return ( - <Element - setSelectedElementId={props.setSelectedElementId} - key={element._id} - data={element} - /> - ); - })} - </div> + <Panel header={elementTreeHeader()}> + <div id="elements"> + {props.elements.map((element) => { + return ( + <Element + setSelectedElementId={props.setSelectedElementId} + key={element._id} + data={element} + /> + ); + })} + </div> + </Panel> </div> );
84d24ebc40ec6923dcce9ebed7c19aca7c7f4a05
assets/js/view/bemvindo/BemVindoView.jsx
assets/js/view/bemvindo/BemVindoView.jsx
class BemVindoView extends React.Component { /** Esqueleto de objeto que deve ser passado como parâmetro. */ props = { pessoa: { nome: "", sobrenome: "" } } constructor(props) { super(props); this.props = props; } exibeNomePessoa(pessoa) { var texto = ""; pessoa.sobrenome ? ( texto = pessoa.nome + ' ' + pessoa.sobrenome ) : ( texto = pessoa.nome ) return texto; } render() { var _pessoa = this.props.pessoa; return <h1>Olá, {_pessoa.nome ? this.exibeNomePessoa(_pessoa) : "estranho"}!</h1>; } }
class BemVindoView extends React.Component { /** Esqueleto de objeto que deve ser passado como parâmetro. */ // props = { // pessoa: { // nome: "", // sobrenome: "" // } // } exibeNomePessoa(pessoa) { var texto = ""; pessoa.sobrenome ? ( texto = pessoa.nome + ' ' + pessoa.sobrenome ) : ( texto = pessoa.nome ) return texto; } render() { var _pessoa = this.props.pessoa; return <h1>Olá, {_pessoa.nome ? this.exibeNomePessoa(_pessoa) : "estranho"}!</h1>; } }
Remove override desnecessário do constructor de React.Component
Remove override desnecessário do constructor de React.Component (por causa de um override de props em BemVindoView estava sendo necessário criar um constructor interno, mas isso só é necessário quando se quer definir state inicial e/ou fazer bind de métodos onClick)
JSX
mit
gustavosotnas/SandboxReact,gustavosotnas/SandboxReact
--- +++ @@ -1,18 +1,12 @@ class BemVindoView extends React.Component { /** Esqueleto de objeto que deve ser passado como parâmetro. */ - props = { - pessoa: { - nome: "", - sobrenome: "" - } - } - - constructor(props) { - super(props); - - this.props = props; - } + // props = { + // pessoa: { + // nome: "", + // sobrenome: "" + // } + // } exibeNomePessoa(pessoa) { var texto = "";
4aed1177fc81f84812a5e5dbff7dce72d692a629
test/common/components/DropDown.unit.spec.jsx
test/common/components/DropDown.unit.spec.jsx
import React from 'react'; import SkinDeep from 'skin-deep'; import { expect } from 'chai'; import DropDown from '../../../src/js/common/components/DropDown.jsx'; describe('<DropDown>', () => { const props = { buttonText: 'Button text', clickHandler: () => {}, contents: (<h1>Hi</h1>), cssClass: 'testClass', isOpen: true, icon: (<svg><rect x="50" y="50" width="50" height="50"/></svg>), id: 'testId' }; const tree = SkinDeep.shallowRender(<DropDown {...props}/>); it('should render', () => { const vdom = tree.getRenderOutput(); expect(vdom).to.not.be.undefined; }); });
import React from 'react'; import ReactDOM from 'react-dom'; import { expect } from 'chai'; import sinon from 'sinon'; import DropDown from '../../../src/js/common/components/DropDown.jsx'; describe('<DropDown>', () => { const clickHandler = sinon.stub(); const container = window.document.createElement('div'); container.addEventListener = sinon.spy(container.addEventListener.bind(container)); container.removeEventListener = sinon.spy(container.removeEventListener.bind(container)); const props = { buttonText: 'Button text', clickHandler, container, contents: (<h1>Hi</h1>), cssClass: 'testClass', isOpen: true, icon: (<svg><rect x="50" y="50" width="50" height="50"/></svg>), id: 'testId' }; ReactDOM.render(<DropDown {...props}/>, container); it('should render', () => { const dropdownDOM = ReactDOM.findDOMNode(container); expect(dropdownDOM).to.not.be.undefined; }); it('should register event listeners on the parent element', () => { expect(container.addEventListener.called).to.be.true; }); it('should call clickHandler when the parent element\'s click event occurs', () => { expect(clickHandler.called).to.be.false; container.dispatchEvent(new window.MouseEvent('click')); expect(clickHandler.called).to.be.true; }); it('should unregister event listeners on the parent element', () => { ReactDOM.unmountComponentAtNode(container); expect(container.removeEventListener.called).to.be.true; }); });
Add test cases for closing dropdowns when a different element is clicked
Add test cases for closing dropdowns when a different element is clicked
JSX
cc0-1.0
department-of-veterans-affairs/vets-website,department-of-veterans-affairs/vets-website
--- +++ @@ -1,13 +1,22 @@ import React from 'react'; -import SkinDeep from 'skin-deep'; +import ReactDOM from 'react-dom'; import { expect } from 'chai'; +import sinon from 'sinon'; import DropDown from '../../../src/js/common/components/DropDown.jsx'; describe('<DropDown>', () => { + + const clickHandler = sinon.stub(); + const container = window.document.createElement('div'); + + container.addEventListener = sinon.spy(container.addEventListener.bind(container)); + container.removeEventListener = sinon.spy(container.removeEventListener.bind(container)); + const props = { buttonText: 'Button text', - clickHandler: () => {}, + clickHandler, + container, contents: (<h1>Hi</h1>), cssClass: 'testClass', isOpen: true, @@ -15,10 +24,26 @@ id: 'testId' }; - const tree = SkinDeep.shallowRender(<DropDown {...props}/>); + ReactDOM.render(<DropDown {...props}/>, container); it('should render', () => { - const vdom = tree.getRenderOutput(); - expect(vdom).to.not.be.undefined; + const dropdownDOM = ReactDOM.findDOMNode(container); + expect(dropdownDOM).to.not.be.undefined; }); + + it('should register event listeners on the parent element', () => { + expect(container.addEventListener.called).to.be.true; + }); + + it('should call clickHandler when the parent element\'s click event occurs', () => { + expect(clickHandler.called).to.be.false; + container.dispatchEvent(new window.MouseEvent('click')); + expect(clickHandler.called).to.be.true; + }); + + it('should unregister event listeners on the parent element', () => { + ReactDOM.unmountComponentAtNode(container); + expect(container.removeEventListener.called).to.be.true; + }); + });
b4acabcfd135551fb19ebbfc273ce3099097f79d
app/assets/javascripts/components/ListItem.jsx
app/assets/javascripts/components/ListItem.jsx
var ListItem = React.createClass({ mixins: [FluxMixin], inputChange: function(event) { this.state.hasChanged = true; this.setState({ value: event.target.value }); }, saveData: function() { // this.getFlux().actions.updateIngredient(this.props.ingredient, $(this.refs.ingredient.getDOMNode()).val()); this.getFlux().actions.updateItem(this.props.data, this.state.value); }, getInitialState: function() { return { value: this.props.data.title, item: this.props.data, hasChanged: false, } }, render: function() { var classes = classNames({ 'c-listItem': true, 'is-saving': this.props.isSaving, }); // // same final string, but much cleaner // return <div className={classes}>Great, I'll be there.</div>; var saveButton = this.state.hasChanged ? <button className="c-button" onClick={ this.saveData }>Save</button> : ''; return ( <li className={ classes }> <p className="c-listItem__title">{ this.props.data.title }</p> <input className="c-listItem__input" defaultValue={ this.props.data.title } value={ this.state.value } onChange={ this.inputChange } data-id={ this.state.item.id } /> { saveButton } </li> ); } });
var ListItem = React.createClass({ mixins: [FluxMixin], inputChange: function(event) { this.state.hasChanged = true; this.setState({ value: event.target.value }); }, saveData: function() { // this.getFlux().actions.updateIngredient(this.props.ingredient, $(this.refs.ingredient.getDOMNode()).val()); this.getFlux().actions.updateItem(this.props.data, this.state.value); }, getInitialState: function() { return { value: this.props.data.title, item: this.props.data, hasChanged: false, } }, render: function() { var classes = classNames({ 'c-listItem': true, 'is-saving': this.props.isSaving, }); // // same final string, but much cleaner // return <div className={classes}>Great, I'll be there.</div>; var saveButton = this.state.hasChanged ? <button className="c-button" onClick={ this.saveData }>Save</button> : ''; return ( <li className={ classes }> <p className="c-listItem__title">{ this.props.data.title }</p> <a href={ this.props.data.link } className="c-listItem__link">link</a> <img src={ this.props.data.image_url } className="c-listItem__link" /> <input className="c-listItem__input" defaultValue={ this.props.data.title } value={ this.state.value } onChange={ this.inputChange } data-id={ this.state.item.id } /> { saveButton } </li> ); } });
Add image and link to list item template.
Add image and link to list item template.
JSX
mit
krisimmig/mytopten,kirillis/mytopten,kirillis/mytopten,kirillis/mytopten,krisimmig/mytopten,krisimmig/mytopten
--- +++ @@ -30,6 +30,8 @@ return ( <li className={ classes }> <p className="c-listItem__title">{ this.props.data.title }</p> + <a href={ this.props.data.link } className="c-listItem__link">link</a> + <img src={ this.props.data.image_url } className="c-listItem__link" /> <input className="c-listItem__input" defaultValue={ this.props.data.title }
4e5404d7ae9c2bc970e185eb38250816c97e8836
lib/jsx/layerSVG.jsx
lib/jsx/layerSVG.jsx
/*global $, app, File, localize, params, svg */ // Required params: // - layerID: ID of layer to generate SVG info for // - layerFilename: name to write the SVG file to. // "File" is an ExtendScript global that does not require the use of "new". var appFolder = { Windows: "/", Macintosh: "/Adobe Photoshop CC.app/Contents/" }; $.evalFile(app.path + appFolder[File.fs] + localize("$$$/ScriptingSupport/Required=Required") + "/ConvertSVG.jsx"); /*jshint newcap: false */ svg.generateFileByID(params.layerID, params.layerFilename); /*jshint newcap: true */
/*global $, app, File, localize, params, svg */ // Required params: // - layerID: ID of layer to generate SVG info for // - layerFilename: name to write the SVG file to. // - layerScale: amount to scale SVG (value of 1 generates no scaling code). // "File" is an ExtendScript global that does not require the use of "new". var appFolder = { Windows: "/", Macintosh: "/Adobe Photoshop CC.app/Contents/" }; $.evalFile(app.path + appFolder[File.fs] + localize("$$$/ScriptingSupport/Required=Required") + "/ConvertSVG.jsx"); /*jshint newcap: false */ svg.generateFileByID(params.layerID, params.layerFilename, params.layerScale); /*jshint newcap: true */
Add support for SVG scaling.
Add support for SVG scaling.
JSX
mit
camikazegreen/photoshop-scrambler,camikazegreen/photoshop-scrambler,adobe-photoshop/generator-core,camikazegreen/photoshop-scrambler,codeorelse/generator-core,MikkoH/generator-core,alesitalugo/generator-core,kristjanmik/generator-assets
--- +++ @@ -3,11 +3,12 @@ // Required params: // - layerID: ID of layer to generate SVG info for // - layerFilename: name to write the SVG file to. +// - layerScale: amount to scale SVG (value of 1 generates no scaling code). // "File" is an ExtendScript global that does not require the use of "new". var appFolder = { Windows: "/", Macintosh: "/Adobe Photoshop CC.app/Contents/" }; $.evalFile(app.path + appFolder[File.fs] + localize("$$$/ScriptingSupport/Required=Required") + "/ConvertSVG.jsx"); /*jshint newcap: false */ -svg.generateFileByID(params.layerID, params.layerFilename); +svg.generateFileByID(params.layerID, params.layerFilename, params.layerScale); /*jshint newcap: true */
795520c92400c62a8e43fcd4e3db4c843e5cd3d5
imports/modules/app/components/Index.jsx
imports/modules/app/components/Index.jsx
import React from 'react'; import { Jumbotron } from 'react-bootstrap'; const Index = () => ( <div className="Index"> <Jumbotron className="text-center"> <h2>Rock</h2> <p>A starting point for Meteor applications.</p> <p><a className="btn btn-success" href="https://github.com/ggallon/rock" target="_blank" role="button">Read the Documentation</a></p> <p style={{ fontSize: '16px', color: '#aaa' }}>Currently at v1.0.0</p> </Jumbotron> </div> ); export default Index;
import React from 'react'; import { Jumbotron } from 'react-bootstrap'; const Index = () => ( <div className="Index"> <Jumbotron className="text-center"> <h2>Rock</h2> <p>A starting point for Meteor applications.</p> <p><a className="btn btn-success" href="https://github.com/ggallon/rock" role="button">Read the Documentation</a></p> <p style={{ fontSize: '16px', color: '#aaa' }}>Currently at v1.0.0</p> </Jumbotron> </div> ); export default Index;
Remove target="_blank" to index component
Remove target="_blank" to index component
JSX
mit
ggallon/rock,ggallon/rock
--- +++ @@ -6,7 +6,7 @@ <Jumbotron className="text-center"> <h2>Rock</h2> <p>A starting point for Meteor applications.</p> - <p><a className="btn btn-success" href="https://github.com/ggallon/rock" target="_blank" role="button">Read the Documentation</a></p> + <p><a className="btn btn-success" href="https://github.com/ggallon/rock" role="button">Read the Documentation</a></p> <p style={{ fontSize: '16px', color: '#aaa' }}>Currently at v1.0.0</p> </Jumbotron> </div>
94fadbd088d94638ce2bf821ccc30acb965fee68
assets/js/components/atoms/SurveyCompletionIndicatorHeart.jsx
assets/js/components/atoms/SurveyCompletionIndicatorHeart.jsx
import React, { PropTypes, Component } from 'react' const style = { outerHeart: { backgroundImage: 'url("/img/gray-heart.svg")', backgroundRepeat: 'no-repeat', backgroundSize: 'contain', height: 48, width: 52, display: 'flex', justifyContent: 'center', alignItems: 'center' }, innerHeart: { transition: 'height 2s, width 2s', backgroundImage: 'url("/img/pink-heart.svg")', backgroundRepeat: 'no-repeat', backgroundSize: 'contain', height: 24, width: 24 } } class SurveyCompletionIndicatorHeart extends Component { getHeartSize(level) { level = String(level) switch (level) { case '1': return [24, 26] case '2': return [36, 38] case '3': return [48, 52] default: return [12, 14] } } render() { const lengths = this.getHeartSize(this.props.level) style.innerHeart = Object.assign({}, style.innerHeart, { height: lengths[0], width: lengths[1] }) return ( <section style={style.outerHeart}> <div style={style.innerHeart}></div> </section> ) } } SurveyCompletionIndicatorHeart.propTypes = { level: PropTypes.number } export default SurveyCompletionIndicatorHeart
import React, { PropTypes, Component } from 'react' const style = { outerHeart: { backgroundImage: 'url("/img/gray-heart.svg")', backgroundRepeat: 'no-repeat', backgroundSize: 'contain', height: 48, width: 52 }, innerHeart: { transition: 'all 2s ease-in-out', backgroundImage: 'url("/img/pink-heart.svg")', backgroundRepeat: 'no-repeat', backgroundSize: 'contain', height: 48, width: 52 } } class SurveyCompletionIndicatorHeart extends Component { getHeartSize(level) { level = String(level) switch (level) { case '1': return 0.5 case '2': return 0.75 case '3': return 1 default: return 0.25 } } render() { const scale = this.getHeartSize(this.props.level) style.innerHeart = Object.assign({}, style.innerHeart, { transform: `scale(${scale})` }) return ( <section style={style.outerHeart}> <div style={style.innerHeart}></div> </section> ) } } SurveyCompletionIndicatorHeart.propTypes = { level: PropTypes.number } export default SurveyCompletionIndicatorHeart
Improve smoothness of heart-growing animation by using css3 scaling.
Improve smoothness of heart-growing animation by using css3 scaling.
JSX
mit
Code4HR/okcandidate,stanzheng/okcandidate
--- +++ @@ -6,18 +6,15 @@ backgroundRepeat: 'no-repeat', backgroundSize: 'contain', height: 48, - width: 52, - display: 'flex', - justifyContent: 'center', - alignItems: 'center' + width: 52 }, innerHeart: { - transition: 'height 2s, width 2s', + transition: 'all 2s ease-in-out', backgroundImage: 'url("/img/pink-heart.svg")', backgroundRepeat: 'no-repeat', backgroundSize: 'contain', - height: 24, - width: 24 + height: 48, + width: 52 } } @@ -27,23 +24,22 @@ level = String(level) switch (level) { case '1': - return [24, 26] + return 0.5 case '2': - return [36, 38] + return 0.75 case '3': - return [48, 52] + return 1 default: - return [12, 14] + return 0.25 } } render() { - const lengths = this.getHeartSize(this.props.level) + const scale = this.getHeartSize(this.props.level) style.innerHeart = Object.assign({}, style.innerHeart, { - height: lengths[0], - width: lengths[1] + transform: `scale(${scale})` }) return (
7758cf2a610581f3d93f0857e7ab55a9a0a8bff7
internal_packages/theme-picker/spec/theme-picker-spec.jsx
internal_packages/theme-picker/spec/theme-picker-spec.jsx
import React from 'react'; const ReactTestUtils = React.addons.TestUtils; import ThemePackage from '../../../src/theme-package'; import ThemePicker from '../lib/theme-picker'; const {resourcePath} = NylasEnv.getLoadSettings(); const light = new ThemePackage(resourcePath + '/internal_packages/ui-light'); const dark = new ThemePackage(resourcePath + '/internal_packages/ui-dark'); fdescribe('ThemePicker', ()=> { beforeEach(()=> { spyOn(ThemePicker.prototype, '_setActiveTheme').andCallThrough(); spyOn(ThemePicker.prototype, '_rewriteIFrame'); spyOn(NylasEnv.themes, 'getLoadedThemes').andReturn([light, dark]); spyOn(NylasEnv.themes, 'getActiveTheme').andReturn(light); this.component = ReactTestUtils.renderIntoDocument(<ThemePicker />); }); it('changes the active theme when a theme is clicked', ()=> { const themeOption = React.findDOMNode(ReactTestUtils.scryRenderedDOMComponentsWithClass(this.component, 'clickable-theme-option')[1]); ReactTestUtils.Simulate.mouseDown(themeOption); expect(ThemePicker.prototype._setActiveTheme).toHaveBeenCalled(); }); });
import React from 'react'; const ReactTestUtils = React.addons.TestUtils; import ThemePackage from '../../../src/theme-package'; import ThemePicker from '../lib/theme-picker'; const {resourcePath} = NylasEnv.getLoadSettings(); const light = new ThemePackage(resourcePath + '/internal_packages/ui-light'); const dark = new ThemePackage(resourcePath + '/internal_packages/ui-dark'); describe('ThemePicker', ()=> { beforeEach(()=> { spyOn(ThemePicker.prototype, '_setActiveTheme').andCallThrough(); spyOn(ThemePicker.prototype, '_rewriteIFrame'); spyOn(NylasEnv.themes, 'getLoadedThemes').andReturn([light, dark]); spyOn(NylasEnv.themes, 'getActiveTheme').andReturn(light); this.component = ReactTestUtils.renderIntoDocument(<ThemePicker />); }); it('changes the active theme when a theme is clicked', ()=> { const themeOption = React.findDOMNode(ReactTestUtils.scryRenderedDOMComponentsWithClass(this.component, 'clickable-theme-option')[1]); ReactTestUtils.Simulate.mouseDown(themeOption); expect(ThemePicker.prototype._setActiveTheme).toHaveBeenCalled(); }); });
Remove filter for theme picker spec
spec(theme-picker): Remove filter for theme picker spec
JSX
mit
nylas/nylas-mail,nylas-mail-lives/nylas-mail,nylas-mail-lives/nylas-mail,simonft/nylas-mail,nylas-mail-lives/nylas-mail,nirmit/nylas-mail,nylas/nylas-mail,nirmit/nylas-mail,simonft/nylas-mail,simonft/nylas-mail,nylas/nylas-mail,nylas/nylas-mail,nylas-mail-lives/nylas-mail,simonft/nylas-mail,simonft/nylas-mail,nirmit/nylas-mail,nylas/nylas-mail,nirmit/nylas-mail,nirmit/nylas-mail,nylas-mail-lives/nylas-mail
--- +++ @@ -8,7 +8,7 @@ const light = new ThemePackage(resourcePath + '/internal_packages/ui-light'); const dark = new ThemePackage(resourcePath + '/internal_packages/ui-dark'); -fdescribe('ThemePicker', ()=> { +describe('ThemePicker', ()=> { beforeEach(()=> { spyOn(ThemePicker.prototype, '_setActiveTheme').andCallThrough(); spyOn(ThemePicker.prototype, '_rewriteIFrame');
0dc1ee91333858df79dce97d1c2b6a52d36a4088
frontend/src/metabase/components/Icon.jsx
frontend/src/metabase/components/Icon.jsx
/*eslint-disable react/no-danger */ import React, { Component, PropTypes } from "react"; import RetinaImage from "react-retina-image"; import { loadIcon } from 'metabase/icon_paths'; export default class Icon extends Component { static propTypes = { name: PropTypes.string.isRequired, width: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, ]), height: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, ]), } render() { const icon = loadIcon(this.props.name); const props = { ...icon.attrs, ...this.props }; if (props.size != null) { props.width = props.size; props.height = props.size; } if (props.scale != null) { props.width *= props.scale; props.height *= props.scale; } if (!icon) { return <span className="hide" />; } else if (icon.img) { return (<RetinaImage forceOriginalDimensions={false} {...props} src={icon.img} />); } else if (icon.svg) { return (<svg {...props} dangerouslySetInnerHTML={{__html: icon.svg}}></svg>); } else { return (<svg {...props}><path d={icon.path} /></svg>); } } }
/*eslint-disable react/no-danger */ import React, { Component, PropTypes } from "react"; import RetinaImage from "react-retina-image"; import { loadIcon } from 'metabase/icon_paths'; export default class Icon extends Component { static propTypes = { name: PropTypes.string.isRequired, width: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, ]), height: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, ]), } render() { const icon = loadIcon(this.props.name); if (!icon) { return null; } const props = { ...icon.attrs, ...this.props }; if (props.size != null) { props.width = props.size; props.height = props.size; } if (props.scale != null) { props.width *= props.scale; props.height *= props.scale; } if (icon.img) { return (<RetinaImage forceOriginalDimensions={false} {...props} src={icon.img} />); } else if (icon.svg) { return (<svg {...props} dangerouslySetInnerHTML={{__html: icon.svg}}></svg>); } else { return (<svg {...props}><path d={icon.path} /></svg>); } } }
Fix "Cannot read property 'attrs' of undefined" when icon is missing
Fix "Cannot read property 'attrs' of undefined" when icon is missing
JSX
agpl-3.0
blueoceanideas/metabase,blueoceanideas/metabase,blueoceanideas/metabase,blueoceanideas/metabase,blueoceanideas/metabase
--- +++ @@ -20,6 +20,9 @@ render() { const icon = loadIcon(this.props.name); + if (!icon) { + return null; + } const props = { ...icon.attrs, ...this.props }; if (props.size != null) { @@ -31,9 +34,7 @@ props.height *= props.scale; } - if (!icon) { - return <span className="hide" />; - } else if (icon.img) { + if (icon.img) { return (<RetinaImage forceOriginalDimensions={false} {...props} src={icon.img} />); } else if (icon.svg) { return (<svg {...props} dangerouslySetInnerHTML={{__html: icon.svg}}></svg>);
3d08fba6efd006d6df1d66336851fb4067979e13
app/assets/javascripts/components/activity/upload_table.jsx
app/assets/javascripts/components/activity/upload_table.jsx
import React from 'react'; import TransitionGroup from 'react-addons-css-transition-group'; import Loading from '../common/loading.cjsx'; import Upload from '../uploads/upload.cjsx'; const UploadTable = React.createClass({ displayName: 'UploadTable', propTypes: { loading: React.PropTypes.bool, uploads: React.PropTypes.array, headers: React.PropTypes.array }, getInitialState() { return { uploads: this.props.uploads }; }, _renderUploads() { return this.state.uploads.map((upload) => { return ( <Upload upload={upload} key={upload.id} /> ); }); }, _renderHeaders() { return this.props.headers.map((header) => { return ( <th key={header.key}> {header.title} </th> ); }); }, render() { if (this.props.loading) { return <Loading />; } const uploads = this._renderUploads(); const ths = this._renderHeaders(); return ( <table className="activity-table list"> <thead> <tr> {ths} <th></th> </tr> </thead> <TransitionGroup transitionName={'dyk'} component="tbody" transitionEnterTimeout={500} transitionLeaveTimeout={500} > {uploads} </TransitionGroup> </table> ); } }); export default UploadTable;
import React from 'react'; import Loading from '../common/loading.cjsx'; import Upload from '../uploads/upload.cjsx'; const UploadTable = React.createClass({ displayName: 'UploadTable', propTypes: { loading: React.PropTypes.bool, uploads: React.PropTypes.array, headers: React.PropTypes.array }, getInitialState() { return { uploads: this.props.uploads }; }, _renderUploads() { return this.state.uploads.map((upload) => { return ( <Upload upload={upload} key={upload.id} /> ); }); }, _renderHeaders() { return this.props.headers.map((header) => { return ( <th key={header.key}> {header.title} </th> ); }); }, render() { if (this.props.loading) { return <Loading />; } const uploads = this._renderUploads(); const ths = this._renderHeaders(); return ( <table className="uploads list"> <thead> <tr> {ths} <th></th> </tr> </thead> {uploads} </table> ); } }); export default UploadTable;
Fix styling and remove unused code from UploadTable
Fix styling and remove unused code from UploadTable
JSX
mit
Wowu/WikiEduDashboard,KarmaHater/WikiEduDashboard,alpha721/WikiEduDashboard,MusikAnimal/WikiEduDashboard,majakomel/WikiEduDashboard,majakomel/WikiEduDashboard,MusikAnimal/WikiEduDashboard,MusikAnimal/WikiEduDashboard,alpha721/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,KarmaHater/WikiEduDashboard,feelfreelinux/WikiEduDashboard,feelfreelinux/WikiEduDashboard,sejalkhatri/WikiEduDashboard,KarmaHater/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,alpha721/WikiEduDashboard,alpha721/WikiEduDashboard,majakomel/WikiEduDashboard,KarmaHater/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,MusikAnimal/WikiEduDashboard,sejalkhatri/WikiEduDashboard,Wowu/WikiEduDashboard,Wowu/WikiEduDashboard,sejalkhatri/WikiEduDashboard,majakomel/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,feelfreelinux/WikiEduDashboard,sejalkhatri/WikiEduDashboard,feelfreelinux/WikiEduDashboard,Wowu/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard
--- +++ @@ -1,5 +1,4 @@ import React from 'react'; -import TransitionGroup from 'react-addons-css-transition-group'; import Loading from '../common/loading.cjsx'; import Upload from '../uploads/upload.cjsx'; @@ -45,21 +44,14 @@ const ths = this._renderHeaders(); return ( - <table className="activity-table list"> + <table className="uploads list"> <thead> <tr> {ths} <th></th> </tr> </thead> - <TransitionGroup - transitionName={'dyk'} - component="tbody" - transitionEnterTimeout={500} - transitionLeaveTimeout={500} - > {uploads} - </TransitionGroup> </table> ); }
515596b077fa469da43f04499d2c3788a81c28c4
app/AmountSpent.jsx
app/AmountSpent.jsx
import React, { Component, PropTypes } from 'react'; class AmountSpent extends Component { static propTypes = { amountEarned: PropTypes.number, amountSpent: PropTypes.number }; render() { const { amountEarned, amountSpent } = this.props; const balance = amountEarned - amountSpent; return ( <div> <p>Total amount spent: ${amountSpent}</p> <p>Total amount earned: ${amountEarned}</p> <p>Balance: {balance < 0 ? '-' : ''}${balance < 0 ? -balance : balance}</p> </div> ); } } export default AmountSpent;
import React, { Component, PropTypes } from 'react'; class AmountSpent extends Component { static propTypes = { amountEarned: PropTypes.number, amountSpent: PropTypes.number }; renderBalance() { const { amountEarned, amountSpent } = this.props; const balance = amountEarned - amountSpent; const positive = balance >= 0; const style = { color: positive ? '#007f00' : '#df0000', fontWeight: 600 }; return <span style={style}>{positive ? `$${balance}` : `-$${-balance}`}</span>; } render() { const { amountEarned, amountSpent } = this.props; return ( <div> <p>Total amount spent: ${amountSpent}</p> <p>Total amount earned: ${amountEarned}</p> <p>Balance: {this.renderBalance()}</p> </div> ); } } export default AmountSpent;
Add styles for Balance amount
Add styles for Balance amount
JSX
mit
kwonghow/toto-app,kwonghow/toto-app
--- +++ @@ -6,16 +6,27 @@ amountSpent: PropTypes.number }; - render() { + renderBalance() { const { amountEarned, amountSpent } = this.props; const balance = amountEarned - amountSpent; + const positive = balance >= 0; + + const style = { + color: positive ? '#007f00' : '#df0000', + fontWeight: 600 + }; + return <span style={style}>{positive ? `$${balance}` : `-$${-balance}`}</span>; + } + + render() { + const { amountEarned, amountSpent } = this.props; return ( <div> <p>Total amount spent: ${amountSpent}</p> <p>Total amount earned: ${amountEarned}</p> - <p>Balance: {balance < 0 ? '-' : ''}${balance < 0 ? -balance : balance}</p> + <p>Balance: {this.renderBalance()}</p> </div> ); }
19192e58750aa1aead728322035c6df5b809f4a5
frontend/src/components/icons/NightModeIcon.jsx
frontend/src/components/icons/NightModeIcon.jsx
import React from "react"; import Icon from "metabase/components/Icon.jsx"; const NightModeIcon = (props) => <Icon name={props.isNightMode ? "moon" : "sun"} {...props} /> export default NightModeIcon;
import React from "react"; import Icon from "metabase/components/Icon.jsx"; const NightModeIcon = (props) => <Icon name={props.isNightMode ? "sun" : "moon"} {...props} /> export default NightModeIcon;
Swap sun/moon in night mode icon
Swap sun/moon in night mode icon
JSX
agpl-3.0
blueoceanideas/metabase,blueoceanideas/metabase,blueoceanideas/metabase,blueoceanideas/metabase,blueoceanideas/metabase
--- +++ @@ -3,6 +3,6 @@ import Icon from "metabase/components/Icon.jsx"; const NightModeIcon = (props) => - <Icon name={props.isNightMode ? "moon" : "sun"} {...props} /> + <Icon name={props.isNightMode ? "sun" : "moon"} {...props} /> export default NightModeIcon;
eb5850256d52d07703b692694a8207a34448c33c
client/src/components/UserNameInputBox.jsx
client/src/components/UserNameInputBox.jsx
import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import { Card } from 'material-ui/Card'; class UserNameInputBox extends React.Component { constructor (props) { super(props); this.state = { userName: '', userNameExists: false }; this.change = this.change.bind(this); this.passDataToCreateUser = this.passDataToCreateUser.bind(this); } change(e) { this.setState ({ userName: e.target.value, userNameExists: true }); } passDataToCreateUser() { this.props.dataFromInputBox({userName: this.state.userName, userNameExists: this.state.userNameExists}); } render () { return ( <div> <input type='text' onChange={this.change}></input> <div> <RaisedButton className="somePadding" secondary={true} onClick={(e)=>{ this.passDataToCreateUser(); }}>Submit</RaisedButton> </div> </div> ); } } export default UserNameInputBox;
import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import { Card } from 'material-ui/Card'; import TextField from 'material-ui/TextField'; class UserNameInputBox extends React.Component { constructor (props) { super(props); this.state = { userName: '', userNameExists: false }; this.change = this.change.bind(this); this.passDataToCreateUser = this.passDataToCreateUser.bind(this); } change(e) { this.setState ({ userName: e.target.value, userNameExists: true }); } passDataToCreateUser() { this.props.dataFromInputBox({userName: this.state.userName, userNameExists: this.state.userNameExists}); } render () { return ( <div> <TextField type='text' floatingLabelText="Name" onChange={this.change}></TextField> <div> <RaisedButton className="somePadding" secondary={true} label="Submit" onClick={(e)=>{ this.passDataToCreateUser(); }}></RaisedButton> </div> </div> ); } } export default UserNameInputBox;
Change input to TextInput and button styling
Change input to TextInput and button styling
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -1,6 +1,7 @@ import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import { Card } from 'material-ui/Card'; +import TextField from 'material-ui/TextField'; class UserNameInputBox extends React.Component { constructor (props) { @@ -30,9 +31,9 @@ return ( <div> - <input type='text' onChange={this.change}></input> + <TextField type='text' floatingLabelText="Name" onChange={this.change}></TextField> <div> - <RaisedButton className="somePadding" secondary={true} onClick={(e)=>{ this.passDataToCreateUser(); }}>Submit</RaisedButton> + <RaisedButton className="somePadding" secondary={true} label="Submit" onClick={(e)=>{ this.passDataToCreateUser(); }}></RaisedButton> </div> </div>
1eaaba1bf504ac65997607955b3ec46ed0ddc0ab
imports/ui/structure-view/element-name.jsx
imports/ui/structure-view/element-name.jsx
import React from 'react'; import Elements from '../../api/elements.js'; import InplaceEdit from '../components/inplace-edit.jsx'; export default class ElementName extends React.Component { constructor(props) { super(props); this.setName = this.setName.bind(this); } setName(text) { Elements.setName(this.props.elementId, text); this.setState({ editing: false }); } render() { let elementName; if (this.props.elementName.length === 0) { elementName = 'name'; } else { elementName = this.props.elementName; } return ( <div className="elementName" style= {{ display: 'inline-block' }} > <InplaceEdit onChange={this.setName} text={elementName} /> </div> ); } } ElementName.propTypes = { elementName: React.PropTypes.string.isRequired, elementId: React.PropTypes.string.isRequired, };
import React from 'react'; import Elements from '../../api/elements.js'; import InplaceEdit from '../components/inplace-edit.jsx'; const setName = (elementId, text) => { Elements.setName(elementId, text); }; const elementName = (name) => { if (name.length === 0) { return 'name'; } return name; }; const ElementName = (props) => ( <div className="elementName" style={{ display: 'inline-block' }} > <InplaceEdit onChange={(text) => setName(props.elementId, text)} text={elementName(props.elementName)} /> </div> ); ElementName.propTypes = { elementName: React.PropTypes.string.isRequired, elementId: React.PropTypes.string.isRequired, }; export default ElementName;
Change react component to stateless function
Change react component to stateless function
JSX
mit
minden/data-furnace,minden/data-furnace
--- +++ @@ -2,37 +2,32 @@ import Elements from '../../api/elements.js'; import InplaceEdit from '../components/inplace-edit.jsx'; -export default class ElementName extends React.Component { - constructor(props) { - super(props); - this.setName = this.setName.bind(this); +const setName = (elementId, text) => { + Elements.setName(elementId, text); +}; + +const elementName = (name) => { + if (name.length === 0) { + return 'name'; } + return name; +}; - setName(text) { - Elements.setName(this.props.elementId, text); - this.setState({ editing: false }); - } - - render() { - let elementName; - if (this.props.elementName.length === 0) { - elementName = 'name'; - } else { - elementName = this.props.elementName; - } - - return ( - <div - className="elementName" - style= {{ display: 'inline-block' }} - > - <InplaceEdit onChange={this.setName} text={elementName} /> - </div> - ); - } -} +const ElementName = (props) => ( + <div + className="elementName" + style={{ display: 'inline-block' }} + > + <InplaceEdit + onChange={(text) => setName(props.elementId, text)} + text={elementName(props.elementName)} + /> + </div> +); ElementName.propTypes = { elementName: React.PropTypes.string.isRequired, elementId: React.PropTypes.string.isRequired, }; + +export default ElementName;
2ff47b6337fa264153aa6f8015847514ee053102
web/static/js/components/grouping_stage.jsx
web/static/js/components/grouping_stage.jsx
import React from "react" import LowerThird from "./lower_third" import styles from "./css_modules/idea_generation_stage.css" export default props => { return ( <div className={styles.wrapper}> <div style={{ flex: 1 }} /> <LowerThird {...props} /> </div> ) }
import React from "react" import { Preview } from "react-dnd-multi-backend" import LowerThird from "./lower_third" import styles from "./css_modules/idea_generation_stage.css" // specification for rendering a drag preview on touch devices // https://github.com/LouisBrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#preview const generateTouchEventDragPreview = (type, item, styles) => { return <GroupingStageIdeaCard touchEventDragPreviewStyles={styles} idea={item.draggedIdea} /> } export default props => { return ( <div className={styles.wrapper}> <div style={{ flex: 1 }} /> <LowerThird {...props} /> <Preview generator={generateTouchEventDragPreview} /> </div> ) }
Add drag preview to grouping stage
Add drag preview to grouping stage
JSX
mit
stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro
--- +++ @@ -1,13 +1,22 @@ import React from "react" +import { Preview } from "react-dnd-multi-backend" import LowerThird from "./lower_third" + import styles from "./css_modules/idea_generation_stage.css" + +// specification for rendering a drag preview on touch devices +// https://github.com/LouisBrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#preview +const generateTouchEventDragPreview = (type, item, styles) => { + return <GroupingStageIdeaCard touchEventDragPreviewStyles={styles} idea={item.draggedIdea} /> +} export default props => { return ( <div className={styles.wrapper}> <div style={{ flex: 1 }} /> <LowerThird {...props} /> + <Preview generator={generateTouchEventDragPreview} /> </div> ) }
0230dd0885c6ef97b20bad74a7c60ae958dcd3dc
src/modules/PostPreview/index.jsx
src/modules/PostPreview/index.jsx
import React, {Component, PropTypes} from "react" import Avatars from "../Avatars" import AuthorsList from "../AuthorsList" import formatDate from "../formatDate" export default class PostPreview extends Component { static displayName = "PostPreview" static contextTypes = { i18n: PropTypes.object, } static propTypes = { post: PropTypes.object, } render() { const post = this.props.post const i18n = this.context.i18n return ( <div className="putainde-List-item js-Post"> { post.authors && <Avatars className="putainde-List-avatars" authors={post.authors} /> } <a className="putainde-Link putainde-List-title" href={post.route} > {post.title} </a> { post.tags && <ul className="putainde-Tags putainde-List-item-tags"> { post.tags.map(tag => { return ( <li key={tag} className="putainde-Tag">{tag}</li> ) }) } </ul> } <div className="putainde-List-author"> {i18n.initialCommit} {" "} { post.authors && <AuthorsList authors={post.authors} /> } { post.date && [ <br key="br" />, <time key={post.date}>{i18n.the} {formatDate(post.date)}</time>, ] } </div> </div> ) } }
import React, {Component, PropTypes} from "react" import Avatars from "../Avatars" import AuthorsList from "../AuthorsList" import formatDate from "../formatDate" export default class PostPreview extends Component { static displayName = "PostPreview" static contextTypes = { i18n: PropTypes.object, } static propTypes = { post: PropTypes.object, } render() { const post = this.props.post const i18n = this.context.i18n return ( <div className="putainde-List-item js-Post"> { post.authors && <Avatars className="putainde-List-avatars" authors={post.authors} /> } <a className="putainde-Link putainde-List-title" href={post.url} > {post.title} </a> { post.tags && <ul className="putainde-Tags putainde-List-item-tags"> { post.tags.map(tag => { return ( <li key={tag} className="putainde-Tag">{tag}</li> ) }) } </ul> } <div className="putainde-List-author"> {i18n.initialCommit} {" "} { post.authors && <AuthorsList authors={post.authors} /> } { post.date && [ <br key="br" />, <time key={post.date}>{i18n.the} {formatDate(post.date)}</time>, ] } </div> </div> ) } }
Use url field instead of route
Use url field instead of route Close #380
JSX
mit
putaindecode/putaindecode.fr,putaindecode/putaindecode.fr,putaindecode/putaindecode.io,revolunet/putaindecode.fr,putaindecode/putaindecode.fr,revolunet/putaindecode.fr,revolunet/putaindecode.fr
--- +++ @@ -27,7 +27,7 @@ <a className="putainde-Link putainde-List-title" - href={post.route} + href={post.url} > {post.title} </a>
5acc71f47495a45b70fcc4446aea41ef89f14c13
pages/Filter/spec.jsx
pages/Filter/spec.jsx
import React from 'react'; import { Provider } from 'react-redux'; import configureStore from 'redux-mock-store'; import { MockedView } from 'Components/View/mock'; import { mount } from 'enzyme'; import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOptions'; import { mockedState, mockedEmpty, } from './mock'; const mockedView = MockedView; jest.mock('Components/View', () => mockedView); const mockedStore = configureStore(); /** * Creates component * @return {ReactWrapper} */ const createComponent = (state) => { /* eslint-disable global-require */ const Filter = require('./index').default; /* eslint-enable global-require */ return mount( <Provider store={mockedStore(state)}> <Filter /> </Provider>, mockRenderOptions ); }; beforeEach(() => { jest.resetModules(); }); describe('<Filter> page', () => { it('should render', () => { const component = createComponent(mockedState); expect(component.find('Filter').exists()).toBe(true); expect(component.find('CardList').children().length).toBeTruthy(); expect(component).toMatchSnapshot(); }); it('should render empty', () => { const component = createComponent(mockedEmpty); expect(component.find('Filter').children().length).toBe(0); }); });
import React from 'react'; import { Provider } from 'react-redux'; import configureStore from 'redux-mock-store'; import { MockedView } from 'Components/View/mock'; import { mount } from 'enzyme'; import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOptions'; import { mockedState, mockedEmpty, } from './mock'; const mockedView = MockedView; jest.mock('Components/View', () => mockedView); const mockedStore = configureStore(); /** * Creates component * @return {ReactWrapper} * @param {Object} state Component state */ const createComponent = (state) => { /* eslint-disable global-require */ const Filter = require('./index').default; /* eslint-enable global-require */ return mount( <Provider store={mockedStore(state)}> <Filter /> </Provider>, mockRenderOptions ); }; beforeEach(() => { jest.resetModules(); }); describe('<Filter> page', () => { it('should render', () => { const component = createComponent(mockedState); expect(component.find('Filter').exists()).toBe(true); expect(component.find('CardList').children().length).toBeTruthy(); expect(component).toMatchSnapshot(); }); it('should render empty', () => { const component = createComponent(mockedEmpty); expect(component.find('Filter').children().length).toBe(0); }); });
Add portals to prices on category page
PWA-218: Add portals to prices on category page - unit test
JSX
apache-2.0
shopgate/theme-gmd
--- +++ @@ -16,6 +16,7 @@ /** * Creates component * @return {ReactWrapper} + * @param {Object} state Component state */ const createComponent = (state) => { /* eslint-disable global-require */
9761e2d865bb462e340865537feecc16e0a5157f
src/dataaccess/FHIRApiDataSource.jsx
src/dataaccess/FHIRApiDataSource.jsx
import IDataSource from './IDataSource'; import PatientRecord from '../patient/PatientRecord'; import hardCodedFHIRPatient from './HardCodedFHIRPatient.json'; // import request from 'sync-request'; class FHIRApiDataSource extends IDataSource { getPatient(id) { // REST Call to get FHIR patient from SyntheticMASS // const url = 'https://syntheticmass.mitre.org/fhir/Patient?_id=58b3663f3425def0f0f6bffd&_count=20&_format=json&_revinclude=*'; // const res = request('GET', url); const patient = new PatientRecord(); patient.fromFHIR(hardCodedFHIRPatient); return patient; } getListOfPatients() { console.error("listing of patients is not implemented in fhirapidataSource."); } newPatient() { console.error("creating a new patient is not implemented in fhirapidataSource."); } savePatient(patient) { console.error("saving of patients is not implemented in fhirapidataSource."); } } export default FHIRApiDataSource;
import IDataSource from './IDataSource'; import PatientRecord from '../patient/PatientRecord'; import hardCodedFHIRPatient from './HardCodedFHIRPatient.json'; import request from 'sync-request'; class FHIRApiDataSource extends IDataSource { getPatient(id) { // REST Call to get FHIR patient from SyntheticMASS // const url = 'https://syntheticmass.mitre.org/fhir/Patient?_id=58b3663f3425def0f0f6bffd&_count=20&_format=json&_revinclude=*'; // const res = request('GET', url); const patient = new PatientRecord(); // patient.fromFHIR(JSON.parse(res.getBody())); patient.fromFHIR(hardCodedFHIRPatient); return patient; } getListOfPatients() { console.error("listing of patients is not implemented in fhirapidataSource."); } newPatient() { console.error("creating a new patient is not implemented in fhirapidataSource."); } savePatient(patient) { console.error("saving of patients is not implemented in fhirapidataSource."); } } export default FHIRApiDataSource;
Add line to parse result from REST call to SyntheticMASS.
Add line to parse result from REST call to SyntheticMASS.
JSX
apache-2.0
standardhealth/flux,standardhealth/flux
--- +++ @@ -1,7 +1,7 @@ import IDataSource from './IDataSource'; import PatientRecord from '../patient/PatientRecord'; import hardCodedFHIRPatient from './HardCodedFHIRPatient.json'; -// import request from 'sync-request'; +import request from 'sync-request'; class FHIRApiDataSource extends IDataSource { getPatient(id) { @@ -9,6 +9,7 @@ // const url = 'https://syntheticmass.mitre.org/fhir/Patient?_id=58b3663f3425def0f0f6bffd&_count=20&_format=json&_revinclude=*'; // const res = request('GET', url); const patient = new PatientRecord(); + // patient.fromFHIR(JSON.parse(res.getBody())); patient.fromFHIR(hardCodedFHIRPatient); return patient; }
5189458de4fc99abad5ca98df9871098b0c977f7
packages/lesswrong/components/common/LoadMore.jsx
packages/lesswrong/components/common/LoadMore.jsx
import { registerComponent, Components } from 'meteor/vulcan:core'; import React from 'react'; import { withStyles } from '@material-ui/core/styles'; import classNames from 'classnames'; import { queryIsUpdating } from './queryStatusUtils' const styles = theme => ({ root: { ...theme.typography.body2, ...theme.typography.commentStyle, color: theme.palette.lwTertiary.main, }, disabled: { color: theme.palette.grey[400], cursor: 'default', '&:hover': { opacity: 1 } } }) const LoadMore = ({ loadMore, count, totalCount, classes, disabled=false, networkStatus, hidden=false }) => { if (hidden) return null; const { Loading } = Components const handleClickLoadMore = event => { event.preventDefault(); loadMore(); } if (networkStatus && queryIsUpdating(networkStatus)) { return <div className={classes.loading}> <Loading/> </div> } return ( <a className={classNames(classes.root, {[classes.disabled]: disabled})} href="#" onClick={handleClickLoadMore} > Load More {totalCount && <span> ({count}/{totalCount})</span>} </a> ) } registerComponent('LoadMore', LoadMore, withStyles(styles, { name: "LoadMore" }) );
import { registerComponent, Components } from 'meteor/vulcan:core'; import React from 'react'; import { withStyles } from '@material-ui/core/styles'; import classNames from 'classnames'; import { queryIsUpdating } from './queryStatusUtils' import {useTracking} from "../../lib/analyticsEvents"; const styles = theme => ({ root: { ...theme.typography.body2, ...theme.typography.commentStyle, color: theme.palette.lwTertiary.main, }, disabled: { color: theme.palette.grey[400], cursor: 'default', '&:hover': { opacity: 1 } } }) const LoadMore = ({ loadMore, count, totalCount, classes, disabled=false, networkStatus, hidden=false }) => { const { captureEvent } = useTracking() if (hidden) return null; const { Loading } = Components const handleClickLoadMore = event => { event.preventDefault(); loadMore(); captureEvent("loadMoreClicked") } if (networkStatus && queryIsUpdating(networkStatus)) { return <div className={classes.loading}> <Loading/> </div> } return ( <a className={classNames(classes.root, {[classes.disabled]: disabled})} href="#" onClick={handleClickLoadMore} > Load More {totalCount && <span> ({count}/{totalCount})</span>} </a> ) } registerComponent('LoadMore', LoadMore, withStyles(styles, { name: "LoadMore" }) );
Add click tracking to load more button
Add click tracking to load more button
JSX
mit
Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope
--- +++ @@ -3,6 +3,7 @@ import { withStyles } from '@material-ui/core/styles'; import classNames from 'classnames'; import { queryIsUpdating } from './queryStatusUtils' +import {useTracking} from "../../lib/analyticsEvents"; const styles = theme => ({ root: { @@ -21,12 +22,15 @@ const LoadMore = ({ loadMore, count, totalCount, classes, disabled=false, networkStatus, hidden=false }) => { + const { captureEvent } = useTracking() + if (hidden) return null; const { Loading } = Components const handleClickLoadMore = event => { event.preventDefault(); loadMore(); + captureEvent("loadMoreClicked") } if (networkStatus && queryIsUpdating(networkStatus)) {
2e58f59fe306890288ede0235d8203f0b6d40159
Todo-Redux/app/components/TodoTask.jsx
Todo-Redux/app/components/TodoTask.jsx
import React from 'react'; import { connect } from 'react-redux'; import moment from 'moment'; import { toggleTask } from 'actions'; export var TodoTask = React.createClass({ render() { var { id, text, completed, createdAt, completedAt, dispatch } = this.props, taskClassName = completed ? 'task task-completed' : 'task', now = moment().unix(); const renderDate = () => { let message = 'Created ', timestamp = createdAt; if(completed) { message = 'Completed '; timestamp = completedAt; } let momentStamp = moment.unix(timestamp); if(now - timestamp < (15 * 86400)) { // Last fortnight return message + momentStamp.fromNow(); } else { return message + momentStamp.format('h:mma Do MMM YY') } }; return ( <div className={taskClassName} onClick={() => { dispatch(toggleTask(id)); }}> <div> <input type="checkbox" checked={completed} /> </div> <div> <p>{text}</p> <p className="task__subtext">{renderDate()}</p> </div> </div> ) } }); export default connect()(TodoTask);
import React from 'react'; import { connect } from 'react-redux'; import moment from 'moment'; import { toggleTask } from 'actions'; export var TodoTask = React.createClass({ render() { var { id, text, completed, createdAt, completedAt, dispatch, priority } = this.props, taskClassName = completed ? 'task task-completed' : 'task', now = moment().unix(); const renderDate = () => { let message = 'Created ', timestamp = createdAt; if(completed) { message = 'Completed '; timestamp = completedAt; } let momentStamp = moment.unix(timestamp); if(now - timestamp < (15 * 86400)) { // Last fortnight return message + momentStamp.fromNow(); } else { return message + momentStamp.format('h:mma Do MMM YY') } }; return ( <div className={taskClassName} onClick={() => { dispatch(toggleTask(id)); }}> <div> <input type="checkbox" checked={completed} /> </div> <div> <p className={`priority-${priority}`}>{text}</p> <p className="task__subtext">{renderDate()}</p> </div> </div> ) } }); export default connect()(TodoTask);
Add priority display for task text
Add priority display for task text
JSX
mit
JulianNicholls/Complete-React-Web-App,JulianNicholls/Complete-React-Web-App
--- +++ @@ -6,7 +6,7 @@ export var TodoTask = React.createClass({ render() { - var { id, text, completed, createdAt, completedAt, dispatch } = this.props, + var { id, text, completed, createdAt, completedAt, dispatch, priority } = this.props, taskClassName = completed ? 'task task-completed' : 'task', now = moment().unix(); @@ -35,7 +35,7 @@ <input type="checkbox" checked={completed} /> </div> <div> - <p>{text}</p> + <p className={`priority-${priority}`}>{text}</p> <p className="task__subtext">{renderDate()}</p> </div> </div>
9a9fadc63ca711609a56a5f949d1cc5c0f2d202f
front/app/utils.jsx
front/app/utils.jsx
function getUrlParams() { var queryDict = {}; location.search.substr(1).split("&") .forEach(function(item) { queryDict[item.split("=")[0]] = decodeURIComponent(item.split("=")[1]); }); return queryDict; } function jsonPostRequest(url) { var request = new XMLHttpRequest(); request.open('POST', url, true); request.setRequestHeader("Content-type", "application/json"); return request; } function jsonRequestPromise(url, params, method) { return new Promise(function(resolve, reject) { var request = new XMLHttpRequest(); request.open(method, url, true); request.setRequestHeader("Content-type", "application/json"); request.onload = function() { if (request.status == 200){ resolve(JSON.parse(request.responseText)); } else { console.log(request.responseText); reject(request.responseText); } }; request.send(JSON.stringify(params)); }); }
function getUrlParams() { var queryDict = {}; location.search.substr(1).split("&") .forEach(function(item) { queryDict[item.split("=")[0]] = decodeURIComponent(item.split("=")[1].replace(/\+/g, " ")); }); return queryDict; } function jsonPostRequest(url) { var request = new XMLHttpRequest(); request.open('POST', url, true); request.setRequestHeader("Content-type", "application/json"); return request; } function jsonRequestPromise(url, params, method) { return new Promise(function(resolve, reject) { var request = new XMLHttpRequest(); request.open(method, url, true); request.setRequestHeader("Content-type", "application/json"); request.onload = function() { if (request.status == 200){ resolve(JSON.parse(request.responseText)); } else { console.log(request.responseText); reject(request.responseText); } }; request.send(JSON.stringify(params)); }); }
Fix problem with additional spaces
Fix problem with additional spaces
JSX
mit
otraczyk/gsevol-web,otraczyk/gsevol-web,otraczyk/gsevol-web,otraczyk/gsevol-web
--- +++ @@ -2,7 +2,7 @@ var queryDict = {}; location.search.substr(1).split("&") .forEach(function(item) { - queryDict[item.split("=")[0]] = decodeURIComponent(item.split("=")[1]); + queryDict[item.split("=")[0]] = decodeURIComponent(item.split("=")[1].replace(/\+/g, " ")); }); return queryDict; }
467a31e2bb4ecc753fd6f5f75f862ed4dc8e50b7
app/assets/javascripts/components/resources/resources.jsx
app/assets/javascripts/components/resources/resources.jsx
import React from 'react'; import { connect } from 'react-redux'; import _ from 'lodash'; import CourseLink from '../common/course_link.jsx'; import { getWeeksArray } from '../../selectors'; const Resources = ({ weeks }) => { const blocks = _.flatten(weeks.map(week => week.blocks)); const modules = _.flatten(blocks.map(block => block.training_modules)); const trainings = modules.map((module) => { if (!module) { return; } return ( <li key={`training-link-${module.id}`}><CourseLink to={`/training/students/${module.slug}`}>{module.name}</CourseLink></li> ); }); return ( <div id="resources"> <div className="section-header"> <h3>{I18n.t('resources.header')}</h3> <div id="training-modules"> <h4>Assigned training modules</h4> <ul> {trainings} </ul> <CourseLink to={'/training'} className="button dark">All student training modules</CourseLink> </div> <hr /> <div id="handouts"> <h4>Handouts</h4> <ul> {/* <li><CourseLink to={wizardUrl} className="button dark">Instructor orientation modules</CourseLink></li> <li><CourseLink to={wizardUrl} className="button dark">Student training modules</CourseLink></li> */} </ul> </div> </div> </div> ); }; const mapStateToProps = state => ({ weeks: getWeeksArray(state) }); export default connect(mapStateToProps)(Resources);
import React from 'react'; import { connect } from 'react-redux'; import _ from 'lodash'; import CourseLink from '../common/course_link.jsx'; import { getWeeksArray } from '../../selectors'; import TrainingModules from '../timeline/training_modules'; const Resources = ({ weeks }) => { const blocks = _.flatten(weeks.map(week => week.blocks)); const modules = _.compact(_.flatten(blocks.map(block => block.training_modules))); return ( <div id="resources"> <div className="section-header"> <h3>{I18n.t('resources.header')}</h3> <div id="training-modules"> <TrainingModules block_modules={modules} trainingLibrarySlug="students" /> <CourseLink to={'/training/students'} className="button dark pull-right">All student training modules</CourseLink> </div> <hr /> <div id="handouts"> <h4>Handouts</h4> <ul> {/* <li><CourseLink to={wizardUrl} className="button dark">Instructor orientation modules</CourseLink></li> <li><CourseLink to={wizardUrl} className="button dark">Student training modules</CourseLink></li> */} </ul> </div> </div> </div> ); }; const mapStateToProps = state => ({ weeks: getWeeksArray(state) }); export default connect(mapStateToProps)(Resources);
Use TrainingModules component to show assigned modules
Use TrainingModules component to show assigned modules
JSX
mit
WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard
--- +++ @@ -5,27 +5,18 @@ import CourseLink from '../common/course_link.jsx'; import { getWeeksArray } from '../../selectors'; - +import TrainingModules from '../timeline/training_modules'; const Resources = ({ weeks }) => { const blocks = _.flatten(weeks.map(week => week.blocks)); - const modules = _.flatten(blocks.map(block => block.training_modules)); - const trainings = modules.map((module) => { - if (!module) { return; } - return ( - <li key={`training-link-${module.id}`}><CourseLink to={`/training/students/${module.slug}`}>{module.name}</CourseLink></li> - ); - }); + const modules = _.compact(_.flatten(blocks.map(block => block.training_modules))); return ( <div id="resources"> <div className="section-header"> <h3>{I18n.t('resources.header')}</h3> <div id="training-modules"> - <h4>Assigned training modules</h4> - <ul> - {trainings} - </ul> - <CourseLink to={'/training'} className="button dark">All student training modules</CourseLink> + <TrainingModules block_modules={modules} trainingLibrarySlug="students" /> + <CourseLink to={'/training/students'} className="button dark pull-right">All student training modules</CourseLink> </div> <hr /> <div id="handouts">
0de5fa73f96a1c2f0effaa98670467aa48d75718
index.jsx
index.jsx
import React, {PropTypes} from 'react'; export const Radio = React.createClass({ displayName: 'Radio', contextTypes: { radioGroup: React.PropTypes.object }, render: function() { const {name, selectedValue, onChange} = this.context.radioGroup; const optional = {}; if(selectedValue !== undefined) { optional.checked = (this.props.value === selectedValue); } if(typeof onChange === 'function') { optional.onChange = onChange.bind(null, this.props.value); } return ( <input {...this.props} type="radio" name={name} {...optional} /> ); } }); export const RadioGroup = React.createClass({ displayName: 'RadioGroup', propTypes: { name: PropTypes.string, selectedValue: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, PropTypes.bool, ]), onChange: PropTypes.func, children: PropTypes.node.isRequired, Component: PropTypes.oneOfType([ PropTypes.string, PropTypes.func, PropTypes.object, ]) }, getDefaultProps: function() { return { Component: "div" }; }, childContextTypes: { radioGroup: React.PropTypes.object }, getChildContext: function() { const {name, selectedValue, onChange} = this.props; return { radioGroup: { name, selectedValue, onChange } } }, render: function() { const {Component, name, selectedValue, onChange, children, ...rest} = this.props; return <Component {...rest}>{children}</Component>; } });
import React, {PropTypes} from 'react'; export class Radio extends React.Component { static displayName = 'Radio'; static contextTypes = { radioGroup: React.PropTypes.object }; render() { const {name, selectedValue, onChange} = this.context.radioGroup; const optional = {}; if(selectedValue !== undefined) { optional.checked = (this.props.value === selectedValue); } if(typeof onChange === 'function') { optional.onChange = onChange.bind(null, this.props.value); } return ( <input {...this.props} type="radio" name={name} {...optional} /> ); } } export class RadioGroup extends React.Component { static displayName = 'RadioGroup'; static propTypes = { name: PropTypes.string, selectedValue: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, PropTypes.bool, ]), onChange: PropTypes.func, children: PropTypes.node.isRequired, Component: PropTypes.oneOfType([ PropTypes.string, PropTypes.func, PropTypes.object, ]) }; static defaultProps = { Component: "div" }; static childContextTypes = { radioGroup: React.PropTypes.object }; getChildContext() { const {name, selectedValue, onChange} = this.props; return { radioGroup: { name, selectedValue, onChange } } } render() { const {Component, name, selectedValue, onChange, children, ...rest} = this.props; return <Component {...rest}>{children}</Component>; } }
Convert to es6 class per React 15.5 deprecation warning
Convert to es6 class per React 15.5 deprecation warning
JSX
mit
chenglou/react-radio-group,chenglou/react-radio-group
--- +++ @@ -1,13 +1,13 @@ import React, {PropTypes} from 'react'; -export const Radio = React.createClass({ - displayName: 'Radio', +export class Radio extends React.Component { + static displayName = 'Radio'; - contextTypes: { + static contextTypes = { radioGroup: React.PropTypes.object - }, + }; - render: function() { + render() { const {name, selectedValue, onChange} = this.context.radioGroup; const optional = {}; if(selectedValue !== undefined) { @@ -25,12 +25,12 @@ {...optional} /> ); } -}); +} -export const RadioGroup = React.createClass({ - displayName: 'RadioGroup', +export class RadioGroup extends React.Component { + static displayName = 'RadioGroup'; - propTypes: { + static propTypes = { name: PropTypes.string, selectedValue: PropTypes.oneOfType([ PropTypes.string, @@ -44,29 +44,27 @@ PropTypes.func, PropTypes.object, ]) - }, + }; - getDefaultProps: function() { - return { - Component: "div" - }; - }, + static defaultProps = { + Component: "div" + }; - childContextTypes: { + static childContextTypes = { radioGroup: React.PropTypes.object - }, + }; - getChildContext: function() { + getChildContext() { const {name, selectedValue, onChange} = this.props; return { radioGroup: { name, selectedValue, onChange } } - }, + } - render: function() { + render() { const {Component, name, selectedValue, onChange, children, ...rest} = this.props; return <Component {...rest}>{children}</Component>; } -}); +}
df198c7f35f6bb05f55be9a3afc985dfb5a9ec44
src/request/components/request-entry-item-view.jsx
src/request/components/request-entry-item-view.jsx
var React = require('react'); module.exports = React.createClass({ render: function() { var entry = this.props.entry; return ( <div className="request-entry-item-holder"> <table className="table table-bordered"> <tr> <td rowSpan="2">{entry.duration}ms</td> <td colSpan="7"> {entry.uri} &nbsp; {entry.method} &nbsp; {entry.statusCode} ({entry.statusText}) - {entry.contentType} </td> </tr> <tr> <td>{entry.summary.networkTime}ms</td> <td>{entry.summary.serverTime}ms</td> <td>{entry.summary.clientTime}ms</td> <td>{entry.summary.controller}.{entry.summary.action}(...)</td> <td>{entry.summary.actionTime}ms</td> <td>{entry.summary.viewTime}ms</td> <td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td> </tr> </table> </div> ); } });
var React = require('react'); Timeago = require('../../lib/components/timeago.jsx'); module.exports = React.createClass({ render: function() { var entry = this.props.entry; return ( <div className="request-entry-item-holder"> <table className="table table-bordered"> <tr> <td rowSpan="2">{entry.duration}ms</td> <td colSpan="6"> {entry.uri} &nbsp; {entry.method} &nbsp; {entry.statusCode} ({entry.statusText}) - {entry.contentType} </td> <td><Timeago time={entry.dateTime} /></td> </tr> <tr> <td>{entry.summary.networkTime}ms</td> <td>{entry.summary.serverTime}ms</td> <td>{entry.summary.clientTime}ms</td> <td>{entry.summary.controller}.{entry.summary.action}(...)</td> <td>{entry.summary.actionTime}ms</td> <td>{entry.summary.viewTime}ms</td> <td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td> </tr> </table> </div> ); } });
Add timeago component to the request list
Add timeago component to the request list
JSX
unknown
Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype
--- +++ @@ -1,4 +1,5 @@ var React = require('react'); + Timeago = require('../../lib/components/timeago.jsx'); module.exports = React.createClass({ render: function() { @@ -8,9 +9,10 @@ <table className="table table-bordered"> <tr> <td rowSpan="2">{entry.duration}ms</td> - <td colSpan="7"> + <td colSpan="6"> {entry.uri} &nbsp; {entry.method} &nbsp; {entry.statusCode} ({entry.statusText}) - {entry.contentType} </td> + <td><Timeago time={entry.dateTime} /></td> </tr> <tr> <td>{entry.summary.networkTime}ms</td>
930e798eeba56302fd92ab52c7d2a62adedf30aa
src/client/components/NewWindowLink/__stories__/NewWindowLink.stories.jsx
src/client/components/NewWindowLink/__stories__/NewWindowLink.stories.jsx
import React from 'react' import { storiesOf } from '@storybook/react' import NewWindowLink from 'NewWindowLink' const stories = storiesOf('NewWindowLink') stories.add('Default', () => ( <NewWindowLink href="https://example.com">This is a link</NewWindowLink> ))
import React from 'react' import { storiesOf } from '@storybook/react' import NewWindowLink from 'NewWindowLink' const stories = storiesOf('NewWindowLink') stories .add('Default', () => ( <NewWindowLink href="https://example.com">This is a link</NewWindowLink> )) .add('Custom aria-label', () => ( <NewWindowLink href="https://example.com" aria-label="custom help text"> This is a link </NewWindowLink> ))
Add story for window link with custom aria label
Add story for window link with custom aria label
JSX
mit
uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend
--- +++ @@ -4,6 +4,12 @@ const stories = storiesOf('NewWindowLink') -stories.add('Default', () => ( - <NewWindowLink href="https://example.com">This is a link</NewWindowLink> -)) +stories + .add('Default', () => ( + <NewWindowLink href="https://example.com">This is a link</NewWindowLink> + )) + .add('Custom aria-label', () => ( + <NewWindowLink href="https://example.com" aria-label="custom help text"> + This is a link + </NewWindowLink> + ))
4537899ae170f09626b02190446a19e598956d03
frontend/src/containers/Application.react.jsx
frontend/src/containers/Application.react.jsx
import React from 'react'; import Header from 'containers/Header.react'; import Navbar from 'containers/Navbar.react'; import Footer from 'containers/Footer.react'; export default class Application extends React.Component { static propTypes = { children: React.PropTypes.any.isRequired } render() { return ( <section> <Header /> <Navbar /> {this.props.children} <Footer /> </section> ); } }
import React from 'react'; import Header from 'containers/Header.react'; import Navbar from 'containers/Navbar.react'; import Footer from 'containers/Footer.react'; import Radium from 'radium'; @Radium export default class Application extends React.Component { static propTypes = { children: React.PropTypes.any.isRequired } render() { return ( <section style={styles.main}> <Header /> <Navbar /> {this.props.children} <Footer /> </section> ); } } const styles = { main: { display: 'flex' } };
Make the application as a flexbox container
Make the application as a flexbox container
JSX
agpl-3.0
jilljenn/voyageavecmoi,jilljenn/voyageavecmoi,jilljenn/voyageavecmoi
--- +++ @@ -4,6 +4,9 @@ import Navbar from 'containers/Navbar.react'; import Footer from 'containers/Footer.react'; +import Radium from 'radium'; + +@Radium export default class Application extends React.Component { static propTypes = { children: React.PropTypes.any.isRequired @@ -11,7 +14,7 @@ render() { return ( - <section> + <section style={styles.main}> <Header /> <Navbar /> {this.props.children} @@ -20,3 +23,9 @@ ); } } + +const styles = { + main: { + display: 'flex' + } +};
6e36c936978c6f728c5532b616307b0bc4b86dbb
test/test-hook.jsx
test/test-hook.jsx
'use strict'; var React = require('react'); require('style!css!../css/styles.css'); require('style!css!../examples/example-styles.css'); require('style!css!../node_modules/react-resizable/css/styles.css'); typeof window !== "undefined" && (window.React = React); // for devtools typeof window !== "undefined" && (window.Perf = React.addons.Perf); // for devtools module.exports = function(Layout) { document.addEventListener("DOMContentLoaded", function(event) { var contentDiv = document.getElementById('content'); var gridProps = window.gridProps || {}; React.render(React.createElement(ExampleLayout, gridProps), contentDiv); }); var ExampleLayout = React.createClass({ getInitialState() { return { layout: [] }; }, onLayoutChange(layout) { this.setState({layout: layout}); }, stringifyLayout() { return this.state.layout.map(function(l) { return <div className="layoutItem" key={l.i}><b>{l.i}</b>: [{l.x}, {l.y}, {l.w}, {l.h}]</div>; }); }, render(){ return ( <div> <div className="layoutJSON"> Displayed as <code>[x, y, w, h]</code>: <div className="columns"> {this.stringifyLayout()} </div> </div> <Layout onLayoutChange={this.onLayoutChange} /> </div> ); } }); };
'use strict'; var React = require('react'); require('style!css!../css/styles.css'); require('style!css!../examples/example-styles.css'); require('style!css!../node_modules/react-resizable/css/styles.css'); typeof window !== "undefined" && (window.React = React); // for devtools module.exports = function(Layout) { document.addEventListener("DOMContentLoaded", function(event) { var contentDiv = document.getElementById('content'); var gridProps = window.gridProps || {}; React.render(React.createElement(ExampleLayout, gridProps), contentDiv); }); var ExampleLayout = React.createClass({ getInitialState() { return { layout: [] }; }, onLayoutChange(layout) { this.setState({layout: layout}); }, stringifyLayout() { return this.state.layout.map(function(l) { return <div className="layoutItem" key={l.i}><b>{l.i}</b>: [{l.x}, {l.y}, {l.w}, {l.h}]</div>; }); }, render(){ return ( <div> <div className="layoutJSON"> Displayed as <code>[x, y, w, h]</code>: <div className="columns"> {this.stringifyLayout()} </div> </div> <Layout onLayoutChange={this.onLayoutChange} /> </div> ); } }); };
Remove perf export in examples
Remove perf export in examples
JSX
mit
vpezeshkian/react-grid-layout,nd0ut/react-grid-layout,seanich/react-grid-layout,vpezeshkian/react-grid-layout,cp/react-grid-layout,cferrios/react-grid-layout,cp/react-grid-layout,nd0ut/react-grid-layout,seanich/react-grid-layout,STRML/react-grid-layout,vpezeshkian/react-grid-layout,STRML/react-grid-layout,cp/react-grid-layout,cferrios/react-grid-layout,nd0ut/react-grid-layout,STRML/react-grid-layout,cferrios/react-grid-layout,seanich/react-grid-layout
--- +++ @@ -4,7 +4,6 @@ require('style!css!../examples/example-styles.css'); require('style!css!../node_modules/react-resizable/css/styles.css'); typeof window !== "undefined" && (window.React = React); // for devtools -typeof window !== "undefined" && (window.Perf = React.addons.Perf); // for devtools module.exports = function(Layout) { document.addEventListener("DOMContentLoaded", function(event) {
190b3f265ed5ac8e2072c29317f67229a4fed9db
client/components/team/team-browser.jsx
client/components/team/team-browser.jsx
import { Meteor } from 'meteor/meteor'; import React, { Component } from 'react'; import { Link, browserHistory } from 'react-router'; import { Container, Grid, Form, Icon, Message } from 'semantic-ui-react'; TeamBrowser = class TeamBrowser extends Component { constructor(props) { super(props); this.state = {}; } render() { return ( <Container> <PuzzlePageTitle title='Join a Team' /> </Container> ); } }
import { Meteor } from 'meteor/meteor'; import { createContainer } from 'meteor/react-meteor-data'; import React, { Component } from 'react'; import { Link, browserHistory } from 'react-router'; import { Container, Grid, Form, Icon, Message } from 'semantic-ui-react'; const SORT_BY_OPTS = [ { text: 'None', value: 'none' }, { text: 'Last Updated', value: 'last-updated' }, { text: 'Team Size', value: 'size' }, ]; const DIVISION_OPTS = [ { text: 'All', value: 'all' }, { text: 'WWU Student', value: 'wwu-student' }, { text: 'WWU Alumni', value: 'wwu-alumni' }, { text: 'Post-Secondary/Non-WWU college', value: 'post-secondary' }, { text: 'High School', value: 'high-school' }, { text: 'Open', value: 'open' }, ]; TeamBrowser = class TeamBrowser extends Component { constructor(props) { super(props); this.state = { sortBy: 'none', division: 'all', }; } componentWillReceiveProps(nextProps) { // Needto add team filtering and sorting here. } render() { return ( <Container> <PuzzlePageTitle title='Join a Team' /> <Form> <Form.Group widths='equal'> <Form.Select label='Sort By' name='sortBy' options={SORT_BY_OPTS} value={this.state.sortBy} onChange={(e, data) => this._handleChange(e, data)}/> <Form.Select label='Division' name='division' options={DIVISION_OPTS} value={this.state.division} onChange={(e, data) => this._handleChange(e, data)}/> </Form.Group> </Form> </Container> ); } _handleChange(e, data) { const name = e.target.name || data.name; const value = e.target.value || data.value; this.setState({ [name]: value }); } } TeamBrowser = createContainer((props) => { const teamsHandle = Meteor.subscribe('teams.browse'); const ready = teamsHandle.ready(); const teams = Teams.find({}).fetch(); return { ready, teams, }; }, TeamBrowser);
Add subscription and filterng form to team browser
Add subscription and filterng form to team browser
JSX
mit
kyle-rader/greatpuzzlehunt,kyle-rader/greatpuzzlehunt,kyle-rader/greatpuzzlehunt
--- +++ @@ -1,20 +1,67 @@ import { Meteor } from 'meteor/meteor'; +import { createContainer } from 'meteor/react-meteor-data'; import React, { Component } from 'react'; import { Link, browserHistory } from 'react-router'; import { Container, Grid, Form, Icon, Message } from 'semantic-ui-react'; +const SORT_BY_OPTS = [ + { text: 'None', value: 'none' }, + { text: 'Last Updated', value: 'last-updated' }, + { text: 'Team Size', value: 'size' }, +]; + +const DIVISION_OPTS = [ + { text: 'All', value: 'all' }, + { text: 'WWU Student', value: 'wwu-student' }, + { text: 'WWU Alumni', value: 'wwu-alumni' }, + { text: 'Post-Secondary/Non-WWU college', value: 'post-secondary' }, + { text: 'High School', value: 'high-school' }, + { text: 'Open', value: 'open' }, +]; + TeamBrowser = class TeamBrowser extends Component { constructor(props) { super(props); - this.state = {}; + this.state = { + sortBy: 'none', + division: 'all', + }; + + } + + componentWillReceiveProps(nextProps) { + // Needto add team filtering and sorting here. } render() { return ( <Container> <PuzzlePageTitle title='Join a Team' /> - + <Form> + <Form.Group widths='equal'> + <Form.Select label='Sort By' name='sortBy' options={SORT_BY_OPTS} value={this.state.sortBy} onChange={(e, data) => this._handleChange(e, data)}/> + <Form.Select label='Division' name='division' options={DIVISION_OPTS} value={this.state.division} onChange={(e, data) => this._handleChange(e, data)}/> + </Form.Group> + </Form> </Container> ); } + + _handleChange(e, data) { + const name = e.target.name || data.name; + const value = e.target.value || data.value; + + this.setState({ [name]: value }); + } } + +TeamBrowser = createContainer((props) => { + const teamsHandle = Meteor.subscribe('teams.browse'); + const ready = teamsHandle.ready(); + const teams = Teams.find({}).fetch(); + + return { + ready, + teams, + }; +}, TeamBrowser);
f25b912537acf17bf71cc12b3b3463060570a80b
src/modules/ThreadPost/ThreadPost.jsx
src/modules/ThreadPost/ThreadPost.jsx
import './ThreadPost.styles' import React, { Component } from 'react' import classes from 'classnames' import LazyLoad from 'react-lazyload' import { TimeAgo, Line, ToggleOnClick, Image } from '~/components' import { renderControls, renderRefs, renderTitle, renderMedia, renderMediaInfo } from './Render' import { setHTML } from '~/utils' export default class ThreadPost extends Component { constructor(props) { super(props); this.state = { mediaExpanded: false } } render() { const { controls, post: { id, name, title, date, media, comment, references, time }} = this.props return ( <div id={"p"+id} className='thread-post clearfix' onClick={e => e.stopPropagation()}> <div className='post-info'> {renderTitle(title)} <span className='name'>{name}</span> <span className='id'>#{id}</span> <Line isVertical /> <TimeAgo time={time}/> {renderControls(controls)} </div> {renderMediaInfo(media)} {renderMedia(media)} <blockquote {...setHTML(comment)}/> {renderRefs(references)} </div> ) } }
import './ThreadPost.styles' import React, { Component } from 'react' import classes from 'classnames' import { TimeAgo, Line, ToggleOnClick, Image } from '~/components' import { renderControls, renderRefs, renderTitle, renderMedia, renderMediaInfo } from './Render' import { setHTML } from '~/utils' export default class ThreadPost extends Component { constructor(props) { super(props); this.state = { mediaExpanded: false } } render() { const { controls, post: { id, name, title, date, media, comment, references, time }} = this.props return ( <div id={"p"+id} className='thread-post clearfix' onClick={e => e.stopPropagation()}> <div className='post-info'> {renderTitle(title)} <span className='name'>{name}</span> <span className='id'>#{id}</span> <Line isVertical /> <TimeAgo time={time}/> {renderControls(controls)} </div> {renderMediaInfo(media)} {renderMedia(media)} <blockquote {...setHTML(comment)}/> {renderRefs(references)} </div> ) } }
Remove Lazyload from thread post
fix(Thread): Remove Lazyload from thread post
JSX
mit
AdamSalma/Lurka,AdamSalma/Lurka
--- +++ @@ -1,7 +1,6 @@ import './ThreadPost.styles' import React, { Component } from 'react' import classes from 'classnames' -import LazyLoad from 'react-lazyload' import { TimeAgo,
9415044cb84efedebacc8b9f692334327ac1b897
app/app/components/home/RegisteredUserHome.jsx
app/app/components/home/RegisteredUserHome.jsx
import React from 'react'; import {Link} from 'react-router' import auth from '../../utils/auth.jsx' export default class RegisteredUserHome extends React.Component { // componentWillMount() { // auth.getUser(localStorage.id).then((res) => { // this.user = res.data.user // }) // } render(){ return( <div className="starter-template"> <h1>Welcome Back, {this.props.user.first_name}</h1> <p className="lead">Get something done today.</p> <Link to="/task/new" className="btn btn-primary">Create A Task</Link> </div> ) } }
import React from 'react'; import {Link} from 'react-router' import auth from '../../utils/auth.jsx' export default class RegisteredUserHome extends React.Component { render(){ return( <div className="starter-template"> <h1>Welcome Back, {this.props.user.first_name}</h1> <p className="lead">Get something done today.</p> <Link to={"/users/" + this.props.user.id + "/tasks/new"} className="btn btn-primary">Create A Task</Link> </div> ) } }
Add link to new task
Add link to new task
JSX
mit
taodav/MicroSerfs,taodav/MicroSerfs
--- +++ @@ -3,17 +3,13 @@ import auth from '../../utils/auth.jsx' export default class RegisteredUserHome extends React.Component { - // componentWillMount() { - // auth.getUser(localStorage.id).then((res) => { - // this.user = res.data.user - // }) - // } + render(){ return( <div className="starter-template"> <h1>Welcome Back, {this.props.user.first_name}</h1> <p className="lead">Get something done today.</p> - <Link to="/task/new" className="btn btn-primary">Create A Task</Link> + <Link to={"/users/" + this.props.user.id + "/tasks/new"} className="btn btn-primary">Create A Task</Link> </div> ) }
ad6322698d4a194a3fae4cd535d68ab152940c35
app/components/App.jsx
app/components/App.jsx
import React, { Component } from 'react'; import localforage from 'localforage'; import debounce from 'lodash.debounce'; import Header from './Header'; import Editor from './Editor'; import Footer from './Footer'; export default class App extends Component { constructor(props, context) { super(props, context); localforage.config({ name: 'monod' }); this.forageKey = 'raw'; this.saveRaw = debounce(this.saveRaw, 1000); } loadRaw() { return localforage.getItem(this.forageKey).then((value) => { return null !== value ? value : ''; }); } saveRaw(raw) { localforage.setItem(this.forageKey, raw); } render() { return ( <div className="layout"> <Header /> <Editor loadRaw={this.loadRaw()} onUpdateRaw={this.saveRaw.bind(this)} /> <Footer /> </div> ); } }
import React, { Component } from 'react'; import localforage from 'localforage'; import debounce from 'lodash.debounce'; import Header from './Header'; import Editor from './Editor'; import Footer from './Footer'; export default class App extends Component { constructor(props, context) { super(props, context); localforage.config({ name: 'monod' }); this.forageKey = 'raw'; this.saveRaw = debounce(this.saveRaw, 1000); } loadRaw() { return localforage.getItem(this.forageKey).then((value) => { return null !== value ? value : [ 'Introducing Monod', '=================', '', '> **TL;DR** This editor is the first experiment we wanted to tackle at **Le lab**. This _week #1 release_ is a pure client-side application written with [React](https://facebook.github.io/react/) by the good folks at [TailorDev](https://tailordev.fr)!', '', 'Read more about how and why we build Monod at: https://tailordev.fr/blog/.', '', '### Markdown syntax', '', 'This note demonstrates some of what [Markdown][1] is capable of doing.', '', '``` python', 'def hello():', ' print("Have fun with Monod!")', '```', '', '*Play with this page and [give us feedback](mailto:hello@tailordev.fr). We would :heart: to ear from you!*' ].join('\n'); }) } saveRaw(raw) { localforage.setItem(this.forageKey, raw); } render() { return ( <div className="layout"> <Header /> <Editor loadRaw={this.loadRaw()} onUpdateRaw={this.saveRaw.bind(this)} /> <Footer /> </div> ); } }
Add default content (the dirty way)
Add default content (the dirty way)
JSX
mit
TailorDev/monod,PaulDebus/monod,TailorDev/monod,PaulDebus/monod,TailorDev/monod,PaulDebus/monod
--- +++ @@ -21,8 +21,26 @@ loadRaw() { return localforage.getItem(this.forageKey).then((value) => { - return null !== value ? value : ''; - }); + return null !== value ? value : [ + 'Introducing Monod', + '=================', + '', + '> **TL;DR** This editor is the first experiment we wanted to tackle at **Le lab**. This _week #1 release_ is a pure client-side application written with [React](https://facebook.github.io/react/) by the good folks at [TailorDev](https://tailordev.fr)!', + '', + 'Read more about how and why we build Monod at: https://tailordev.fr/blog/.', + '', + '### Markdown syntax', + '', + 'This note demonstrates some of what [Markdown][1] is capable of doing.', + '', + '``` python', + 'def hello():', + ' print("Have fun with Monod!")', + '```', + '', + '*Play with this page and [give us feedback](mailto:hello@tailordev.fr). We would :heart: to ear from you!*' + ].join('\n'); + }) } saveRaw(raw) {
2d2589a8df7bb181f8b23e137578dbabadc1b1f5
src/components/ImageView.jsx
src/components/ImageView.jsx
// @flow import React, { Component } from 'react'; import Image from '../domain/Image'; export default class ImageView extends Component { props: { image: Image, showPreview: Function, remove: Function, }; render() { return ( <li className="image-view"> <div className="image-container"> <img alt="approve" style={{ maxHeight: '180px', maxWidth: '180px' }} src={this.props.image.src} /> </div> <div className="remove-button-container" onClick={() => this.props.showPreview(this.props.image.src)} > <button type="button" className="remove-button" aria-label="Close" onClick={() => this.props.remove(this.props.image)} > <i className="fa fa-trash" aria-hidden="true" /> </button> </div> </li> ); } }
// @flow import React, { Component } from 'react'; import Image from '../domain/Image'; export default class ImageView extends Component { props: { image: Image, showPreview: Function, remove: Function, }; render() { return ( <li className="image-view"> <div className="image-container"> <img alt="approve" style={{ maxHeight: '180px', maxWidth: '180px' }} src={this.props.image.src} /> </div> <a tabIndex="-1" className="remove-button-container" onClick={() => { this.props.showPreview(this.props.image.src); }} > <button type="button" className="remove-button" aria-label="Close" onClick={(ev) => { ev.stopPropagation(); this.props.remove(this.props.image); }} > <i className="fa fa-trash" aria-hidden="true" /> </button> </a> </li> ); } }
Fix remove button event bubling
Fix remove button event bubling
JSX
mit
mizoguche/approve-pr-with-image,mizoguche/approve-pr-with-image
--- +++ @@ -15,18 +15,23 @@ <div className="image-container"> <img alt="approve" style={{ maxHeight: '180px', maxWidth: '180px' }} src={this.props.image.src} /> </div> - <div + <a + tabIndex="-1" className="remove-button-container" - onClick={() => this.props.showPreview(this.props.image.src)} + onClick={() => { this.props.showPreview(this.props.image.src); }} > <button type="button" - className="remove-button" aria-label="Close" - onClick={() => this.props.remove(this.props.image)} + className="remove-button" + aria-label="Close" + onClick={(ev) => { + ev.stopPropagation(); + this.props.remove(this.props.image); + }} > <i className="fa fa-trash" aria-hidden="true" /> </button> - </div> + </a> </li> ); }
43e6322e936ab63b4740c3ca4a30a54980cf5a2c
src/extension/features/general/hide-closed-accounts/components/hide-closed-button.jsx
src/extension/features/general/hide-closed-accounts/components/hide-closed-button.jsx
import * as React from 'react'; import * as PropTypes from 'prop-types'; import { controllerLookup } from 'toolkit/extension/utils/ember'; import { l10n, getToolkitStorageKey } from 'toolkit/extension/utils/toolkit'; export const HideClosedButton = ({ toggleHiddenState }) => { const isHidden = getToolkitStorageKey('hide-closed', true); const label = isHidden ? l10n('app.show', 'Show') : l10n('app.hide', 'Hide'); const toggleHidden = () => { toggleHiddenState(!isHidden); controllerLookup('application').send('closeModal'); }; return ( <li onClick={toggleHidden}> <button> <i className="flaticon stroke help-2" /> {` ${label}`} Closed Accounts </button> </li> ); }; HideClosedButton.propTypes = { toggleHiddenState: PropTypes.func.isRequired, };
import * as React from 'react'; import * as PropTypes from 'prop-types'; import { controllerLookup } from 'toolkit/extension/utils/ember'; import { l10n, getToolkitStorageKey } from 'toolkit/extension/utils/toolkit'; export const HideClosedButton = ({ toggleHiddenState }) => { const isHidden = getToolkitStorageKey('hide-closed', true); const label = isHidden ? l10n('app.show', 'Show') : l10n('app.hide', 'Hide'); const toggleHidden = () => { toggleHiddenState(!isHidden); controllerLookup('application').send('closeModal'); }; return ( <li onClick={toggleHidden}> <button> <i className="flaticon stroke no" /> {` ${label}`} Closed Accounts </button> </li> ); }; HideClosedButton.propTypes = { toggleHiddenState: PropTypes.func.isRequired, };
Use 'no' fonticon instead of 'help-2' for hide closed accounts
Use 'no' fonticon instead of 'help-2' for hide closed accounts
JSX
mit
falkencreative/toolkit-for-ynab,dbaldon/toolkit-for-ynab,falkencreative/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,blargity/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,falkencreative/toolkit-for-ynab,dbaldon/toolkit-for-ynab,falkencreative/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,dbaldon/toolkit-for-ynab,blargity/toolkit-for-ynab,blargity/toolkit-for-ynab,dbaldon/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,blargity/toolkit-for-ynab
--- +++ @@ -15,7 +15,7 @@ return ( <li onClick={toggleHidden}> <button> - <i className="flaticon stroke help-2" /> + <i className="flaticon stroke no" /> {` ${label}`} Closed Accounts </button> </li>
a103afa469ed3ecb41c5cb034eea95dd4661c5f7
public/components/BeerPair.jsx
public/components/BeerPair.jsx
import React from 'react'; import beerPair from './../../pairList.js'; class BeerPair extends React.Component { constructor(props){ super(props); } render(){ return( <div> { this.props.currentBeer.name ? `${this.props.currentBeer.name} is a ${this.props.currentBeer.type} and should be drank in a ${beerPair[this.props.currentBeer.type][0]}` : 'no beers' } </div> ) } } export default BeerPair;
import React from 'react'; import beerPair from './../../pairList.js'; class BeerPair extends React.Component { constructor(props){ super(props); } render(){ return( <div> { this.props.currentBeer.name ? `${this.props.currentBeer.name} is a ${this.props.currentBeer.type} and should be drank in a ${beerPair[this.props.currentBeer.type][0]}` : '' } </div> ) } } export default BeerPair;
Remove placeholder text while waiting for data
Remove placeholder text while waiting for data
JSX
mit
joeylaguna/tankard.io,joeylaguna/tankard.io
--- +++ @@ -10,7 +10,7 @@ return( <div> { - this.props.currentBeer.name ? `${this.props.currentBeer.name} is a ${this.props.currentBeer.type} and should be drank in a ${beerPair[this.props.currentBeer.type][0]}` : 'no beers' + this.props.currentBeer.name ? `${this.props.currentBeer.name} is a ${this.props.currentBeer.type} and should be drank in a ${beerPair[this.props.currentBeer.type][0]}` : '' } </div> )
2ea315257b555e69b535b2992e2a11f09ad34c87
app/assets/javascripts/components/DiscoverComponents/ResultList.js.jsx
app/assets/javascripts/components/DiscoverComponents/ResultList.js.jsx
var ResultList = React.createClass({ render: function() { var resultNodes = this.props.results.map(function(result){ return ( <ResultItem title={result.title} description={result.description} link={result.link} points={result.points} categoryName={result.category_name} image={result.image} > </ResultItem> ); }); return ( <div className="result_list_wrapper"> <h3 className="ui header"> Search results </h3> <div className="ui large feed"> { this.props.results.length == 0 ? <p> Enter something in the search bar! </p> : {resultNodes} } </div> </div> ); } })
var ResultList = React.createClass({ render: function() { var resultNodes = this.props.results.map(function(result){ return ( <ResultItem title={result.title} description={result.description} link={result.link} points={result.points} categoryName={result.category_name} image={result.image} > </ResultItem> ); }); return ( <div className="result_list_wrapper"> <h3 className="ui header"> Search results </h3> <div className="ui large feed"> { this.props.results.length == 0 ? <p> Enter something in the search bar! </p> : React.addons.createFragment({resultNodes}) } </div> </div> ); } })
Fix react complaint about keyed items needing React.addons.createFragment(object) on discover page
Fix react complaint about keyed items needing React.addons.createFragment(object) on discover page
JSX
mit
ShadyLogic/fixstarter,ShadyLogic/fixstarter,ShadyLogic/fixstarter,TimCannady/fixstarter,TimCannady/fixstarter,TimCannady/fixstarter
--- +++ @@ -14,7 +14,7 @@ { this.props.results.length == 0 ? <p> Enter something in the search bar! </p> : - {resultNodes} + React.addons.createFragment({resultNodes}) } </div> </div>
a3d9321cdf1f1d08a49f8ac5fcef070946045560
app/assets/javascripts/student_profile/main.jsx
app/assets/javascripts/student_profile/main.jsx
$(function() { // only run if the correct page if (!($('body').hasClass('students') && $('body').hasClass('show'))) return; // imports const PageContainer = window.shared.PageContainer; const parseQueryString = window.shared.parseQueryString; const MixpanelUtils = window.shared.MixpanelUtils; // entry point, reading static bootstrapped data from the page const serializedData = $('#serialized-data').data(); MixpanelUtils.registerUser(serializedData.currentEducator); MixpanelUtils.track('PAGE_VISIT', { page_key: 'STUDENT_PROFILE' }); ReactDOM.render(<PageContainer nowMomentFn={function() { return moment.utc(); }} serializedData={serializedData} queryParams={parseQueryString(window.location.search)} history={window.history} />, document.getElementById('main')); });
const ReactDOM = window.ReactDOM; $(function() { // only run if the correct page if (!($('body').hasClass('students') && $('body').hasClass('show'))) return; // imports const PageContainer = window.shared.PageContainer; const parseQueryString = window.shared.parseQueryString; const MixpanelUtils = window.shared.MixpanelUtils; // entry point, reading static bootstrapped data from the page const serializedData = $('#serialized-data').data(); MixpanelUtils.registerUser(serializedData.currentEducator); MixpanelUtils.track('PAGE_VISIT', { page_key: 'STUDENT_PROFILE' }); ReactDOM.render(<PageContainer nowMomentFn={function() { return moment.utc(); }} serializedData={serializedData} queryParams={parseQueryString(window.location.search)} history={window.history} />, document.getElementById('main')); });
Fix linter warning about ReactDOM
Fix linter warning about ReactDOM
JSX
mit
jhilde/studentinsights,jhilde/studentinsights,studentinsights/studentinsights,studentinsights/studentinsights,jhilde/studentinsights,jhilde/studentinsights,studentinsights/studentinsights,studentinsights/studentinsights
--- +++ @@ -1,3 +1,5 @@ +const ReactDOM = window.ReactDOM; + $(function() { // only run if the correct page if (!($('body').hasClass('students') && $('body').hasClass('show'))) return;
c482ba4871913c55f524e51c24bae4b29f937828
app/scripts/components/Insights/Customs/Sonoma/slides/SonomaSlide6.jsx
app/scripts/components/Insights/Customs/Sonoma/slides/SonomaSlide6.jsx
import React from 'react'; class SonomaSlide6 extends React.Component { render() { return ( <section> <section className="sonoma-slide"> <div className="container content-section"> <div className="row"> <div className="columns medium-6 wrapper"> <header className="header"> <h2 className="title">Increase in intense storm events</h2> </header> <p className="content">The frequency of 3-day “very high water flow events” are up to 3 times more likely to occur than they do currently.</p> </div> <div className="columns medium-6 wrapper"> <div className="chart-card -light"> <h2>Number of 3-day flow events in the Russian river watershed</h2> <div className="info-button">i</div> <div className="chart" id="chart6-1"></div> </div> </div> </div> </div> </section> <section className="sonoma-slide"> <div className="container content-section"> <div className="row"> <div className="overlapping-cards"> <div className="card"> <p>The most worrisome storm events are ones that become labeled “the worst storm events for a given year or decade”. Which usually last 3 days and have extremely high rainfall, water runoff and flooding (called water flow).</p> <p>Extreme weather events require planning for emergencies such as road and store closures where you need to have supplies of water and food to live on your own for a few days if needed.</p> <p>Agriculture and landscape preparation includes prevention of soil erosion and crop/plant damage.</p> </div> <div className="card slide-6-2"></div> </div> </div> </div> </section> </section> ); } } export default SonomaSlide6;
import React from 'react'; import Iframe from '../../../../IFrame'; function SonomaSlide6() { const mapUrl = 'http://resource-watch.github.io/insights/sonoma-maps/winter-air-temperature.html'; return ( <section className="sonoma-slide" data-title="Warmer Winter Nights"> <div className="container content-section"> <div className="row align-middle"> <div className="column medium-6"> <header className="header"> <h2 className="title">Warmer Winter Nights</h2> </header> <p className="content"> This sequence of maps shows where winter night-time temperatures, on average, are expected to exceed 39°F (yellow) and 43°F (red). </p> </div> <div className="column medium-6 wrapper"> <Iframe src={mapUrl} /> </div> </div> </div> </section> ); } export default SonomaSlide6;
Add map in slide 6
Add map in slide 6
JSX
mit
resource-watch/prep-app,resource-watch/prep-app
--- +++ @@ -1,48 +1,27 @@ import React from 'react'; +import Iframe from '../../../../IFrame'; -class SonomaSlide6 extends React.Component { - - render() { - return ( - <section> - <section className="sonoma-slide"> - <div className="container content-section"> - <div className="row"> - <div className="columns medium-6 wrapper"> - <header className="header"> - <h2 className="title">Increase in intense storm events</h2> - </header> - <p className="content">The frequency of 3-day “very high water flow events” are up to 3 times more likely to occur than they do currently.</p> - </div> - <div className="columns medium-6 wrapper"> - <div className="chart-card -light"> - <h2>Number of 3-day flow events in the Russian river watershed</h2> - <div className="info-button">i</div> - <div className="chart" id="chart6-1"></div> - </div> - </div> - </div> +function SonomaSlide6() { + const mapUrl = 'http://resource-watch.github.io/insights/sonoma-maps/winter-air-temperature.html'; + return ( + <section className="sonoma-slide" data-title="Warmer Winter Nights"> + <div className="container content-section"> + <div className="row align-middle"> + <div className="column medium-6"> + <header className="header"> + <h2 className="title">Warmer Winter Nights</h2> + </header> + <p className="content"> + This sequence of maps shows where winter night-time temperatures, on average, are expected to exceed 39°F (yellow) and 43°F (red). + </p> </div> - </section> - - <section className="sonoma-slide"> - <div className="container content-section"> - <div className="row"> - <div className="overlapping-cards"> - <div className="card"> - <p>The most worrisome storm events are ones that become labeled “the worst storm events for a given year or decade”. Which usually last 3 days and have extremely high rainfall, water runoff and flooding (called water flow).</p> - <p>Extreme weather events require planning for emergencies such as road and store closures where you need to have supplies of water and food to live on your own for a few days if needed.</p> - <p>Agriculture and landscape preparation includes prevention of soil erosion and crop/plant damage.</p> - </div> - <div className="card slide-6-2"></div> - </div> - </div> + <div className="column medium-6 wrapper"> + <Iframe src={mapUrl} /> </div> - </section> - - </section> - ); - } + </div> + </div> + </section> + ); } export default SonomaSlide6;
28981cff8af308c01323d6f1befc582b80be840e
js/Details.jsx
js/Details.jsx
const React = require('react') class Details extends React.Component { render () { return ( <div style={{textAlign: 'left'}} className='container'> <pre><code> {JSON.stringify(this.props.params, null, 4)} </code></pre> </div> ) } } const { object } = React.PropTypes Details.propTypes = { params: object.isRequired } module.exports = Details
const React = require('react') class Details extends React.Component { render () { const params = this.props.params || {} const { title, description, year, poster, trailer } = params return ( <div style={{textAlign: 'left'}} className='container'> <header className='header'> <h1 className='brand'>svideo</h1> </header> <div className='video-info'> <h1 className='video-title'>{title}</h1> <h2 className='video-year'>({year})</h2> <img className='video-poster' src={`public/img/posters/${poster}`} /> <p className='video-description'>{description}</p> </div> <div className='video-container'> <iframe src={`https://www.youtube-nocookie.com/embed/${trailer}?rel=0&amp;controls=0&amp;showinfo=0`} frameBorder='0' allowFullScreen></iframe> </div> </div> ) } } const { object } = React.PropTypes Details.propTypes = { params: object.isRequired } module.exports = Details
Add House of Cards trailer.
Add House of Cards trailer.
JSX
mit
JoeMarion/complete-intro-to-react,JoeMarion/complete-intro-to-react
--- +++ @@ -2,11 +2,22 @@ class Details extends React.Component { render () { + const params = this.props.params || {} + const { title, description, year, poster, trailer } = params return ( <div style={{textAlign: 'left'}} className='container'> - <pre><code> - {JSON.stringify(this.props.params, null, 4)} - </code></pre> + <header className='header'> + <h1 className='brand'>svideo</h1> + </header> + <div className='video-info'> + <h1 className='video-title'>{title}</h1> + <h2 className='video-year'>({year})</h2> + <img className='video-poster' src={`public/img/posters/${poster}`} /> + <p className='video-description'>{description}</p> + </div> + <div className='video-container'> + <iframe src={`https://www.youtube-nocookie.com/embed/${trailer}?rel=0&amp;controls=0&amp;showinfo=0`} frameBorder='0' allowFullScreen></iframe> + </div> </div> ) }
7c2fe256a239dbb4375288601219be04de8dfeb8
src/request/components/request-filter-view.jsx
src/request/components/request-filter-view.jsx
var React = require('react'); module.exports = React.createClass({ render: function() { return ( <div className="request-session-holder"> <h2>Filter</h2> <em>No found filters.</em> </div> ); } });
var glimpse = require('glimpse'), React = require('react'), LinkedStateMixin = React.addons.LinkedStateMixin; module.exports = React.createClass({ mixins: [ LinkedStateMixin ], getInitialState: function() { return { uri: '', method: '', contentType: '', statusCode: '' }; }, render: function() { return ( <div className="request-session-holder"> <h2>Filter</h2> <div> <label htmlFor="request-fitler-uri">Uri</label><br /> <input type="text" id="request-fitler-uri" valueLink={this.linkState('uri')} /> </div><br /> <div> <label htmlFor="request-fitler-method">Method</label><br /> <input type="text" id="request-fitler-method" valueLink={this.linkState('method')} /> </div><br /> <div> <label htmlFor="request-fitler-contentType">Content Type</label><br /> <input type="text" id="request-fitler-contentType" valueLink={this.linkState('contentType')} /> </div><br /> <div> <label htmlFor="request-fitler-statusCode">Status Code</label><br /> <input type="text" id="request-fitler-statusCode" valueLink={this.linkState('statusCode')} /> </div><br /> <input type="button" value="Filter" onClick={this._onFilter} /> </div> ); }, _onFilter: function() { glimpse.emit('shell.request.filter.updated', this.state); } });
Add form elements and filter event to request filter view
Add form elements and filter event to request filter view
JSX
unknown
Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype
--- +++ @@ -1,12 +1,43 @@ -var React = require('react'); +var glimpse = require('glimpse'), + React = require('react'), + LinkedStateMixin = React.addons.LinkedStateMixin; module.exports = React.createClass({ + mixins: [ LinkedStateMixin ], + getInitialState: function() { + return { + uri: '', + method: '', + contentType: '', + statusCode: '' + }; + }, render: function() { return ( <div className="request-session-holder"> <h2>Filter</h2> - <em>No found filters.</em> + + <div> + <label htmlFor="request-fitler-uri">Uri</label><br /> + <input type="text" id="request-fitler-uri" valueLink={this.linkState('uri')} /> + </div><br /> + <div> + <label htmlFor="request-fitler-method">Method</label><br /> + <input type="text" id="request-fitler-method" valueLink={this.linkState('method')} /> + </div><br /> + <div> + <label htmlFor="request-fitler-contentType">Content Type</label><br /> + <input type="text" id="request-fitler-contentType" valueLink={this.linkState('contentType')} /> + </div><br /> + <div> + <label htmlFor="request-fitler-statusCode">Status Code</label><br /> + <input type="text" id="request-fitler-statusCode" valueLink={this.linkState('statusCode')} /> + </div><br /> + <input type="button" value="Filter" onClick={this._onFilter} /> </div> ); + }, + _onFilter: function() { + glimpse.emit('shell.request.filter.updated', this.state); } });
30cc12a2ccea084b3f36de2a68a9b10bcc98adaa
src/actions/HistoryActions.jsx
src/actions/HistoryActions.jsx
import Constants from "../constants/HistoryConstants.jsx"; import {searchHistory} from "../utils/ChromeAPI.jsx"; import Moment from "moment"; export default { load(d = new Date(), q = "") { this.dispatch(Constants.LOAD_HISTORY); const start = Moment(d).startOf("day").valueOf(); const end = Moment(d).endOf("day").valueOf(); searchHistory(q, start, end) .then(HistoryItems => { this.dispatch(Constants.LOAD_HISTORY_COMPLETE, HistoryItems); }); } };
import Constants from "../constants/HistoryConstants.jsx"; import {searchHistory} from "../utils/ChromeAPI.jsx"; import Moment from "moment"; export default { load(d = new Date(), q = "") { this.dispatch(Constants.LOAD_HISTORY); let start = d, end = false; if (d !== 0) { start = Moment(d).startOf("day").valueOf(); end = Moment(d).endOf("day").valueOf(); } searchHistory(q, start, end) .then(HistoryItems => { this.dispatch(Constants.LOAD_HISTORY_COMPLETE, HistoryItems); }); } };
Change load action to allow dateless queries
Change load action to allow dateless queries This change will allow us to search with no date range. That is, it will return all results.
JSX
mit
MrSaints/historyx,MrSaints/historyx
--- +++ @@ -6,8 +6,14 @@ export default { load(d = new Date(), q = "") { this.dispatch(Constants.LOAD_HISTORY); - const start = Moment(d).startOf("day").valueOf(); - const end = Moment(d).endOf("day").valueOf(); + + let start = d, + end = false; + + if (d !== 0) { + start = Moment(d).startOf("day").valueOf(); + end = Moment(d).endOf("day").valueOf(); + } searchHistory(q, start, end) .then(HistoryItems => {
1497dfa5ed4117b0946eade8ae0e354f9c62fb90
src/sentry/static/sentry/app/components/events/interfaces/exceptionMechanism.jsx
src/sentry/static/sentry/app/components/events/interfaces/exceptionMechanism.jsx
import React from 'react'; import KeyValueList from '../interfaces/keyValueList'; const ExceptionMechanism = React.createClass({ propTypes: { data: React.PropTypes.object.isRequired, platform: React.PropTypes.string, }, render() { let elements = []; if (this.props.data.mach_exception) { const {mach_exception} = this.props.data; if (mach_exception.exception_name) { elements.push(['Mach Exception', mach_exception.exception_name]); } if (mach_exception.code_name) { elements.push(['Mach Code', mach_exception.code_name]); } } if (this.props.data.posix_signal) { const {posix_signal} = this.props.data; elements.push(['Signal', posix_signal.name + ' (' + posix_signal.signal + ')']); } if (elements.length === 0) { return null; } return ( <div className="exception-mechanism"> <KeyValueList data={elements} /> </div> ); } }); export default ExceptionMechanism;
import React from 'react'; import Pills from '../../pills'; import Pill from '../../pill'; const ExceptionMechanism = React.createClass({ propTypes: { data: React.PropTypes.object.isRequired, platform: React.PropTypes.string, }, render() { let pills = []; if (this.props.data.mach_exception) { const {mach_exception} = this.props.data; if (mach_exception.exception_name) { pills.push(<Pill key="mach-exception" name="mach exception" value={mach_exception.exception_name} />); } if (mach_exception.code_name) { pills.push(<Pill key="mach-code" name="mach code" value={mach_exception.code_name} />); } } if (this.props.data.posix_signal) { const {posix_signal} = this.props.data; pills.push(<Pill key="signal" name="signal" > {posix_signal.name} {' '} <em>({posix_signal.signal})</em> </Pill>); } if (pills.length === 0) { return null; } return ( <div className="exception-mechanism"> <Pills>{pills}</Pills> </div> ); } }); export default ExceptionMechanism;
Use pills for exception mechanism
Use pills for exception mechanism
JSX
bsd-3-clause
mvaled/sentry,JackDanger/sentry,gencer/sentry,BuildingLink/sentry,alexm92/sentry,fotinakis/sentry,ifduyue/sentry,mitsuhiko/sentry,fotinakis/sentry,BuildingLink/sentry,zenefits/sentry,gencer/sentry,BuildingLink/sentry,ifduyue/sentry,looker/sentry,gencer/sentry,looker/sentry,alexm92/sentry,beeftornado/sentry,mvaled/sentry,ifduyue/sentry,mvaled/sentry,zenefits/sentry,mvaled/sentry,JamesMura/sentry,looker/sentry,mvaled/sentry,BuildingLink/sentry,jean/sentry,gencer/sentry,jean/sentry,ifduyue/sentry,fotinakis/sentry,gencer/sentry,BuildingLink/sentry,JackDanger/sentry,jean/sentry,mitsuhiko/sentry,JamesMura/sentry,beeftornado/sentry,looker/sentry,JamesMura/sentry,alexm92/sentry,jean/sentry,jean/sentry,fotinakis/sentry,zenefits/sentry,mvaled/sentry,JamesMura/sentry,JackDanger/sentry,beeftornado/sentry,zenefits/sentry,looker/sentry,zenefits/sentry,JamesMura/sentry,ifduyue/sentry
--- +++ @@ -1,5 +1,6 @@ import React from 'react'; -import KeyValueList from '../interfaces/keyValueList'; +import Pills from '../../pills'; +import Pill from '../../pill'; const ExceptionMechanism = React.createClass({ propTypes: { @@ -8,29 +9,44 @@ }, render() { - let elements = []; + let pills = []; if (this.props.data.mach_exception) { const {mach_exception} = this.props.data; if (mach_exception.exception_name) { - elements.push(['Mach Exception', mach_exception.exception_name]); + pills.push(<Pill + key="mach-exception" + name="mach exception" + value={mach_exception.exception_name} + />); } if (mach_exception.code_name) { - elements.push(['Mach Code', mach_exception.code_name]); + pills.push(<Pill + key="mach-code" + name="mach code" + value={mach_exception.code_name} + />); } } if (this.props.data.posix_signal) { const {posix_signal} = this.props.data; - elements.push(['Signal', posix_signal.name + ' (' + posix_signal.signal + ')']); + pills.push(<Pill + key="signal" + name="signal" + > + {posix_signal.name} + {' '} + <em>({posix_signal.signal})</em> + </Pill>); } - if (elements.length === 0) { + if (pills.length === 0) { return null; } return ( <div className="exception-mechanism"> - <KeyValueList data={elements} /> + <Pills>{pills}</Pills> </div> ); }
09e7a5b3b97f8ac85e77d765206093d3540dc851
src/operator/visitors/visitor/__tests__/invite_button.test.jsx
src/operator/visitors/visitor/__tests__/invite_button.test.jsx
import React from 'react'; import {shallow, mount} from 'enzyme'; import {expect} from 'chai'; import * as sinon from 'sinon'; import InviteButton from '../invite_button'; describe('<InviteButton />', () => { describe('inactive state (already invited visitor)', () => { it('should be null', () => { const wrapper = shallow(<InviteButton isInvited={true} />); expect(wrapper.html()).to.be.null; }); }); describe('active state (not invited visitor)', () => { it('should be a link', () => { const wrapper = shallow(<InviteButton isInvited={false} />); expect(wrapper.is('a')).to.be.true; }); it('should display "invite" word', () => { const wrapper = shallow(<InviteButton isInvited={false} />); expect(wrapper.render().text()).to.have.string('invite'); }); it('should fire "onClick" callback', () => { const spy = sinon.spy(); const wrapper = mount(<InviteButton isInvited={false} onClick={spy} />); wrapper.simulate('click'); expect(spy.calledOnce).to.be.true; }); }); });
import React from 'react'; import {shallow} from 'enzyme'; import {expect} from 'chai'; import * as sinon from 'sinon'; import InviteButton from '../invite_button'; describe('<InviteButton />', () => { describe('inactive state (already invited visitor)', () => { it('should be null', () => { const wrapper = shallow(<InviteButton isInvited={true} />); expect(wrapper.html()).to.be.null; }); }); describe('active state (not invited visitor)', () => { it('should be a link', () => { const wrapper = shallow(<InviteButton isInvited={false} />); expect(wrapper.is('a')).to.be.true; }); it('should display "invite" word', () => { const wrapper = shallow(<InviteButton isInvited={false} />); expect(wrapper.render().text()).to.have.string('invite'); }); it('should fire "onClick" callback', () => { const spy = sinon.spy(); const wrapper = shallow(<InviteButton isInvited={false} onClick={spy} />); wrapper.simulate('click'); expect(spy.calledOnce).to.be.true; }); }); });
Use enzyme.shallow instead of enzyme.mount for <InviteButton/> component
Use enzyme.shallow instead of enzyme.mount for <InviteButton/> component
JSX
apache-2.0
JustBlackBird/mibew-ui,JustBlackBird/mibew-ui
--- +++ @@ -1,5 +1,5 @@ import React from 'react'; -import {shallow, mount} from 'enzyme'; +import {shallow} from 'enzyme'; import {expect} from 'chai'; import * as sinon from 'sinon'; import InviteButton from '../invite_button'; @@ -29,7 +29,7 @@ it('should fire "onClick" callback', () => { const spy = sinon.spy(); - const wrapper = mount(<InviteButton isInvited={false} onClick={spy} />); + const wrapper = shallow(<InviteButton isInvited={false} onClick={spy} />); wrapper.simulate('click'); expect(spy.calledOnce).to.be.true;
de8e06ec69d87991d3b0674bd343fcd4469c432b
app/components/LoginButtons.jsx
app/components/LoginButtons.jsx
import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; const LoginButtons = React.createClass({ render() { const flexContainer = { display: 'flex', flexDirection: 'column', flexWrap: 'wrap', justifyContent: 'center', alignContent: 'center', alignItems: 'center', height: '70vh' } const styleButton = { display: 'flex', width: '100px', marginBottom: '10px' }; return <div style={flexContainer}> <RaisedButton label="Login" primary={true} style={styleButton} /> <RaisedButton label="Register" primary={true} style={styleButton} /> </div> } }); export default LoginButtons;
import React from 'react'; import { Link } from 'react-router'; import RaisedButton from 'material-ui/RaisedButton'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; const LoginButtons = React.createClass({ render() { const flexContainer = { display: 'flex', flexDirection: 'column', flexWrap: 'wrap', justifyContent: 'center', alignContent: 'center', alignItems: 'center', height: '70vh' } const styleButton = { display: 'flex', width: '100px', marginBottom: '10px' }; return <div style={flexContainer}> <Link to="/login" style={{textDecoration: 'none'}}> <RaisedButton label="Login" primary={true} style={styleButton} /> </Link> <Link to="/register" style={{textDecoration: 'none'}}> <RaisedButton label="Register" primary={true} style={styleButton} /> </Link> </div> } }); export default LoginButtons;
Add Links to /status page
Add Links to /status page
JSX
mit
spanningtime/smokator,spanningtime/smokator
--- +++ @@ -1,9 +1,11 @@ import React from 'react'; +import { Link } from 'react-router'; import RaisedButton from 'material-ui/RaisedButton'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; const LoginButtons = React.createClass({ + render() { const flexContainer = { @@ -23,8 +25,12 @@ }; return <div style={flexContainer}> - <RaisedButton label="Login" primary={true} style={styleButton} /> - <RaisedButton label="Register" primary={true} style={styleButton} /> + <Link to="/login" style={{textDecoration: 'none'}}> + <RaisedButton label="Login" primary={true} style={styleButton} /> + </Link> + <Link to="/register" style={{textDecoration: 'none'}}> + <RaisedButton label="Register" primary={true} style={styleButton} /> + </Link> </div> } });
dc61a6ca9371089b5fba00bfabd5b654a23b069d
app/views/timezone.jsx
app/views/timezone.jsx
/** @jsx React.DOM */ var React = require('react'); var moment = require('moment-timezone'); var Person = require('./person.jsx'); module.exports = React.createClass({ render: function() { // We clone the time object itself so the this time is bound to // the global app time var localTime = moment( this.props.time ).zone( parseInt( this.props.offset, 10) ), displayTime = localTime.format( this.props.timeFormat ), offset = localTime.format('Z'); this.props.model.sort(function(a, b){ return a.name > b.name ? 1 : -1; }); var timezoneClasses = 'timezone timezone-hour-' + localTime.hour(); return <div className={timezoneClasses}> <h3 className="timezone-time">{displayTime}</h3> <p className="timezone-offset">{offset}</p> {this.props.model.map(function(person){ return <Person model={person} />; })} </div>; } });
/** @jsx React.DOM */ var React = require('react'); var moment = require('moment-timezone'); var Person = require('./person.jsx'); module.exports = React.createClass({ render: function() { // We clone the time object itself so the this time is bound to // the global app time var localTime = moment( this.props.time ).zone( parseInt( this.props.offset, 10) ), displayTime = localTime.format( this.props.timeFormat ), offset = localTime.format('Z'); this.props.model.sort(function(a, b){ return a.name > b.name ? 1 : -1; }); var timezoneClasses = 'timezone timezone-hour-' + localTime.hour(); return <div className={timezoneClasses}> <h3 className="timezone-time">{displayTime}</h3> <p className="timezone-offset">{offset}</p> {this.props.model.map(function(person){ var key = person.name + Math.floor(Math.random() * 10); return <Person model={person} key={key} />; })} </div>; } });
Add key to people React child view
Add key to people React child view
JSX
mit
djfarrelly/timezone,bexelbie/timezone,bexelbie/timezone,djfarrelly/timezone
--- +++ @@ -24,7 +24,8 @@ <h3 className="timezone-time">{displayTime}</h3> <p className="timezone-offset">{offset}</p> {this.props.model.map(function(person){ - return <Person model={person} />; + var key = person.name + Math.floor(Math.random() * 10); + return <Person model={person} key={key} />; })} </div>; }
e78a2e0413b42cacce4bad19d15fa3e566513ee9
shared/components/TodosView.jsx
shared/components/TodosView.jsx
import React from 'react'; import { PropTypes } from 'react'; import Immutable from 'immutable'; export default class TodosView extends React.Component { static propTypes = { todos: PropTypes.instanceOf(Immutable.List).isRequired, editTodo: PropTypes.func.isRequired, deleteTodo: PropTypes.func.isRequired }; handleDelete = (e) => { const id = Number(e.target.dataset.id); this.props.deleteTodo(id); }; handleEdit = (e) => { const id = Number(e.target.dataset.id); const currentVal = this.props.todos.get(id); // For a cutting edge UX let text = window.prompt('', currentVal); this.props.editTodo(id, text); }; render() { const btnStyle = { 'margin': '1em 0 1em 1em' }; return ( <div id="todos-list"> { this.props.todos.map(function (todo, index) { return ( <div style={btnStyle} key={index}> <span>{todo}</span> <button style={btnStyle} data-id={index} onClick={this.handleDelete}>X</button> <button style={btnStyle} data-id={index} onClick={this.handleEdit}>Edit</button> </div> ); }.bind(this)) } </div> ); } }
import React from 'react'; import { PropTypes } from 'react'; import Immutable from 'immutable'; export default class TodosView extends React.Component { static propTypes = { todos: PropTypes.instanceOf(Immutable.List).isRequired, editTodo: PropTypes.func.isRequired, deleteTodo: PropTypes.func.isRequired }; handleDelete = (e) => { const id = Number(e.target.dataset.id); this.props.deleteTodo(id); }; handleEdit = (e) => { const id = Number(e.target.dataset.id); const currentVal = this.props.todos.get(id); // For a cutting edge UX let text = window.prompt('', currentVal); this.props.editTodo(id, text); }; render() { const btnStyle = { 'margin': '1em 0 1em 1em' }; return ( <div id="todos-list"> { this.props.todos.map((todo, index) => { return ( <div style={btnStyle} key={index}> <span>{todo}</span> <button style={btnStyle} data-id={index} onClick={this.handleDelete}>X</button> <button style={btnStyle} data-id={index} onClick={this.handleEdit}>Edit</button> </div> ); }) } </div> ); } }
Use arrow function when mapping todo items
Use arrow function when mapping todo items
JSX
mit
bananaoomarang/isomorphic-redux
--- +++ @@ -33,7 +33,7 @@ return ( <div id="todos-list"> { - this.props.todos.map(function (todo, index) { + this.props.todos.map((todo, index) => { return ( <div style={btnStyle} key={index}> <span>{todo}</span> @@ -42,7 +42,7 @@ <button style={btnStyle} data-id={index} onClick={this.handleEdit}>Edit</button> </div> ); - }.bind(this)) + }) } </div> );
82b65779365c3fe136b62aac8000df0cb4b8c85e
src/components/MessageMenuBar/MessageMenuBar.jsx
src/components/MessageMenuBar/MessageMenuBar.jsx
import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import Button from '../Button/Button.jsx'; import { toggleChatOpen } from '../../store/Chat/actions'; import './MessageMenuBar.css'; const MessageMenuBar = (props) => { const { activeChatId, activeChatIsOpen, toggleOpen } = props; const renderBtnMsg = () => { if (!activeChatId) return 'Select a chat'; if (activeChatId && activeChatIsOpen) return 'Mark as Done'; return 'Unarchive Chat'; }; return ( <div className="MessageMenuBar"> {/* <Button onClick={() => {}}>Assign to other</Button> */} {/* TODO: 0.2*/ } <Button onClick={() => toggleOpen(activeChatId)}>{renderBtnMsg()}</Button> </div> ); }; const mapStateToProps = state => ({ activeChatId: state.chat.activeId, activeChatIsOpen: state.chat.activeIsOpen, }); const mapDispatchToProps = dispatch => ({ toggleOpen: chatId => dispatch(toggleChatOpen(chatId)), }); export default connect( mapStateToProps, mapDispatchToProps, )(MessageMenuBar); MessageMenuBar.propTypes = { activeChatId: PropTypes.string.isRequired, activeChatIsOpen: PropTypes.bool, toggleOpen: PropTypes.func.isRequired, };
import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import Button from '../Button/Button.jsx'; import { toggleChatOpen } from '../../store/Chat/actions'; import './MessageMenuBar.css'; const MessageMenuBar = (props) => { const { activeChatId, activeChatIsOpen, toggleOpen } = props; const renderBtnMsg = () => { if (!activeChatId) return 'Select a chat'; if (activeChatId && activeChatIsOpen) return 'Mark as Done'; return 'Unarchive Chat'; }; return ( <div className="MessageMenuBar"> {/* <Button onClick={() => {}}>Assign to other</Button> */} {/* TODO: 0.2*/ } <Button onClick={() => toggleOpen(activeChatId)}>{renderBtnMsg()}</Button> </div> ); }; MessageMenuBar.propTypes = { activeChatId: PropTypes.string.isRequired, activeChatIsOpen: PropTypes.bool, toggleOpen: PropTypes.func.isRequired, }; const mapStateToProps = state => ({ activeChatId: state.chat.activeId, activeChatIsOpen: state.chat.activeIsOpen, }); const mapDispatchToProps = dispatch => ({ toggleOpen: chatId => dispatch(toggleChatOpen(chatId)), }); export default connect( mapStateToProps, mapDispatchToProps, )(MessageMenuBar);
Move propTypes up for nit nit
Move propTypes up for nit nit
JSX
bsd-3-clause
minimalchat/operator-app,minimalchat/operator-app
--- +++ @@ -21,6 +21,14 @@ ); }; + +MessageMenuBar.propTypes = { + activeChatId: PropTypes.string.isRequired, + activeChatIsOpen: PropTypes.bool, + toggleOpen: PropTypes.func.isRequired, +}; + + const mapStateToProps = state => ({ activeChatId: state.chat.activeId, activeChatIsOpen: state.chat.activeIsOpen, @@ -30,14 +38,8 @@ toggleOpen: chatId => dispatch(toggleChatOpen(chatId)), }); + export default connect( mapStateToProps, mapDispatchToProps, )(MessageMenuBar); - - -MessageMenuBar.propTypes = { - activeChatId: PropTypes.string.isRequired, - activeChatIsOpen: PropTypes.bool, - toggleOpen: PropTypes.func.isRequired, -};
c0ed3feb9261a9da6856c56a7365195adb70c266
src/BlocklyToolbox.jsx
src/BlocklyToolbox.jsx
import React from 'react'; import BlocklyToolboxCategory from './BlocklyToolboxCategory'; import BlocklyToolboxBlock from './BlocklyToolboxBlock'; var BlocklyToolbox = React.createClass({ propTypes: { categories: React.PropTypes.array, blocks: React.PropTypes.array, processCategory: React.PropTypes.func, didUpdate: React.PropTypes.func }, componentDidMount: function() { this.props.didUpdate(); }, componentDidUpdate: function(prevProps, prevState) { this.props.didUpdate(); }, processCategory: function(category) { var processedCategory = Object.assign({}, category); if (processedCategory.categories) { Object.assign(processedCategory, { categories: processedCategory.categories.map(this.processCategory) }); } if (this.props.processCategory) { this.props.processCategory(processedCategory); } return processedCategory; }, render: function() { var content; if (this.props.categories) { var processedCategories = this.props.categories.map(this.processCategory); content = processedCategories.map(BlocklyToolboxCategory.renderCategory); } else if (this.props.blocks) { content = this.props.blocks.map(BlocklyToolboxBlock.renderBlock); } return ( <xml style={{display: "none"}}> {content} </xml> ); } }); export default BlocklyToolbox;
import React from 'react'; import BlocklyToolboxCategory from './BlocklyToolboxCategory'; import BlocklyToolboxBlock from './BlocklyToolboxBlock'; var BlocklyToolbox = React.createClass({ propTypes: { categories: React.PropTypes.array, blocks: React.PropTypes.array, processCategory: React.PropTypes.func, didUpdate: React.PropTypes.func }, renderCategories: function(categories) { return categories.map(function(category, i) { if (category.type == 'sep') { return <sep key={"sep_" + i}></sep>; } else if (category.type == 'search') { return <search key={"search_" + i}/>; } else { return <BlocklyToolboxCategory name={category.name} custom={category.custom} key={"category_" + category.name + "_" + i} blocks={category.blocks} categories={category.categories} />; } }.bind(this)); }, componentDidMount: function() { this.props.didUpdate(); }, componentDidUpdate: function(prevProps, prevState) { this.props.didUpdate(); }, processCategory: function(category) { var processedCategory = Object.assign({}, category); if (processedCategory.categories) { Object.assign(processedCategory, { categories: processedCategory.categories.map(this.processCategory) }); } if (this.props.processCategory) { this.props.processCategory(processedCategory); } return processedCategory; }, render: function() { return ( <xml style={{display: "none"}}> {this.renderCategories(this.props.categories.map(this.processCategory))} </xml> ); } }); export default BlocklyToolbox;
Add support for our typeahead search PR
Add support for our typeahead search PR
JSX
mit
patientslikeme/react-blockly-component,patientslikeme/react-blockly-component
--- +++ @@ -9,6 +9,23 @@ blocks: React.PropTypes.array, processCategory: React.PropTypes.func, didUpdate: React.PropTypes.func + }, + + renderCategories: function(categories) { + return categories.map(function(category, i) { + if (category.type == 'sep') { + return <sep key={"sep_" + i}></sep>; + } else if (category.type == 'search') { + return <search key={"search_" + i}/>; + } else { + return <BlocklyToolboxCategory + name={category.name} + custom={category.custom} + key={"category_" + category.name + "_" + i} + blocks={category.blocks} + categories={category.categories} />; + } + }.bind(this)); }, componentDidMount: function() { @@ -33,17 +50,9 @@ }, render: function() { - var content; - if (this.props.categories) { - var processedCategories = this.props.categories.map(this.processCategory); - content = processedCategories.map(BlocklyToolboxCategory.renderCategory); - } else if (this.props.blocks) { - content = this.props.blocks.map(BlocklyToolboxBlock.renderBlock); - } - return ( <xml style={{display: "none"}}> - {content} + {this.renderCategories(this.props.categories.map(this.processCategory))} </xml> ); }
6fc7c323f4e32601292c41728d8969ae0903a62e
src/Slide.jsx
src/Slide.jsx
import React, { Component, PropTypes } from 'react' const styles = { root: { color: 'white' }, header: { height: 'calc(100% - 230px)', textAlign: 'center' }, headerItem: { position: 'relative', top: '50%', transform: 'translateY(-50%)' }, text: { textAlign: 'center' } } export class Slide extends Component { render() { const { backgroundColor, header, headerStyle, headline, subhead } = this.props return ( <div style={{ ...styles.root, backgroundColor, height: '100%' }}> <div style={{ ...styles.header, ...headerStyle }}> <div style={styles.headerItem}>{header}</div> </div> <div style={styles.text}> <h1> {headline} </h1> <p> {subhead} </p> </div> </div> ) } } Slide.propTypes = { header: PropTypes.object.isRequired, headerStyle: PropTypes.object.isRequired, backgroundColor: PropTypes.string.isRequired, headline: PropTypes.string.isRequired, subhead: PropTypes.string.isRequired }
import React, { Component, PropTypes } from 'react' import { blue500, blue700 } from 'material-ui/styles/colors' const styles = { root: { color: 'white', backgroundColor: blue500, height: '100%' }, media: { position: 'relative', top: '50%', transform: 'translateY(-50%)' }, mediaBackground: { backgroundColor: blue700, height: 'calc(100% - 230px)', textAlign: 'center' }, subtitle: {}, text: { textAlign: 'center' }, title: {} } export class Slide extends Component { render() { const { contentStyle, media, mediaBackgroundStyle, mediaStyle, subtitle, subtitleStyle, textStyle, title, titleStyle } = this.props return ( <div style={{ ...styles.root, ...contentStyle }}> <div style={{ ...styles.mediaBackground, ...mediaBackgroundStyle }}> <div style={{ ...styles.media, ...mediaStyle }}>{media}</div> </div> <div style={{ ...styles.text, ...textStyle }}> <h1 style={{ ...styles.title, ...titleStyle }}> {title} </h1> <p style={{ ...styles.subtitle, ...subtitleStyle }}> {subtitle} </p> </div> </div> ) } } Slide.propTypes = { contentStyle: PropTypes.object, media: PropTypes.node.isRequired, mediaBackgroundStyle: PropTypes.object, mediaStyle: PropTypes.object, subtitle: PropTypes.string.isRequired, subtitleStyle: PropTypes.object, textStyle: PropTypes.object, title: PropTypes.string.isRequired, titleStyle: PropTypes.object }
Rework slide props to allow styles override.
Rework slide props to allow styles override.
JSX
mit
TeamWertarbyte/material-auto-rotating-carousel
--- +++ @@ -1,37 +1,53 @@ import React, { Component, PropTypes } from 'react' +import { blue500, blue700 } from 'material-ui/styles/colors' const styles = { root: { - color: 'white' + color: 'white', + backgroundColor: blue500, + height: '100%' }, - header: { - height: 'calc(100% - 230px)', - textAlign: 'center' - }, - headerItem: { + media: { position: 'relative', top: '50%', transform: 'translateY(-50%)' }, + mediaBackground: { + backgroundColor: blue700, + height: 'calc(100% - 230px)', + textAlign: 'center' + }, + subtitle: {}, text: { textAlign: 'center' - } + }, + title: {} } export class Slide extends Component { render() { - const { backgroundColor, header, headerStyle, headline, subhead } = this.props + const { + contentStyle, + media, + mediaBackgroundStyle, + mediaStyle, + subtitle, + subtitleStyle, + textStyle, + title, + titleStyle + } = this.props return ( - <div style={{ ...styles.root, backgroundColor, height: '100%' }}> - <div style={{ ...styles.header, ...headerStyle }}> - <div style={styles.headerItem}>{header}</div> + <div style={{ ...styles.root, ...contentStyle }}> + <div style={{ ...styles.mediaBackground, ...mediaBackgroundStyle }}> + <div style={{ ...styles.media, ...mediaStyle }}>{media}</div> </div> - <div style={styles.text}> - <h1> - {headline} + <div style={{ ...styles.text, ...textStyle }}> + <h1 style={{ ...styles.title, ...titleStyle }}> + {title} </h1> - <p> - {subhead} + <p style={{ ...styles.subtitle, ...subtitleStyle }}> + {subtitle} </p> </div> </div> @@ -40,9 +56,13 @@ } Slide.propTypes = { - header: PropTypes.object.isRequired, - headerStyle: PropTypes.object.isRequired, - backgroundColor: PropTypes.string.isRequired, - headline: PropTypes.string.isRequired, - subhead: PropTypes.string.isRequired + contentStyle: PropTypes.object, + media: PropTypes.node.isRequired, + mediaBackgroundStyle: PropTypes.object, + mediaStyle: PropTypes.object, + subtitle: PropTypes.string.isRequired, + subtitleStyle: PropTypes.object, + textStyle: PropTypes.object, + title: PropTypes.string.isRequired, + titleStyle: PropTypes.object }
47b04c0dcc00cd6631aa91a4cc8ae5f6c1f41d5f
app/client/components/layouts/main/MainLayout.jsx
app/client/components/layouts/main/MainLayout.jsx
Camino.MainLayout = React.createClass({ render() { return ( <div> {this.props.header} {this.props.content} {this.props.footer} </div> ) } });
Camino.MainLayout = React.createClass({ render() { return ( <span> <head> <title>Camino</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> </head> <body> <div classNam="container"> {this.props.header} {this.props.content} {this.props.footer} </div> </body> </span> ) } });
Add missing <head> with viewport
Add missing <head> with viewport
JSX
mit
fjaguero/camino,fjaguero/camino
--- +++ @@ -1,13 +1,22 @@ Camino.MainLayout = React.createClass({ render() { return ( - <div> + <span> + <head> + <title>Camino</title> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + </head> + <body> + <div classNam="container"> {this.props.header} {this.props.content} {this.props.footer} - </div> + </div> + </body> + </span> ) } });
99a4cff1910304733d32e57f41362caaf96f3781
src/ui/components/Button/index.jsx
src/ui/components/Button/index.jsx
import { h } from 'preact'; import styles from './Button.css'; const Button = ({ className, children, type = 'default', ...props }) => ( <button lassName={`${styles.this} ${styles[type]} ${className ? className : ''}`} {...props} > { children } </button> ); export default Button;
import { h } from 'preact'; import styles from './Button.css'; const Button = ({ className, children, type = 'default', ...props }) => ( <button className={`${styles.this} ${styles[type]} ${className ? className : ''}`} {...props} > { children } </button> ); export default Button;
Fix className prop on Button
Fix className prop on Button
JSX
mit
BusterLabs/Partyshare,BusterLabs/Partyshare
--- +++ @@ -8,7 +8,7 @@ ...props }) => ( <button - lassName={`${styles.this} ${styles[type]} ${className ? className : ''}`} + className={`${styles.this} ${styles[type]} ${className ? className : ''}`} {...props} > { children }
8410d88bdc9c9dcf4d2c3584c5334de55194f4fb
src/components/tab.jsx
src/components/tab.jsx
var React = require('react'); var classNames = require('classnames'); module.exports = Tab = React.createClass({ displayName: 'Tab', contextTypes: { activeClassName: React.PropTypes.string.isRequired }, propTypes: { className: React.PropTypes.string, id: React.PropTypes.number.isRequired, selected: React.PropTypes.bool, children: React.PropTypes.oneOfType([ React.PropTypes.array, React.PropTypes.object, React.PropTypes.string ]) }, getDefaultProps() { return { selected: false }; }, onClick: function(event) { event.preventDefault(); this.props.handleClick(this.props.id); }, render() { return ( <li className={classNames(this.props.className, { [this.context.activeClassName]: this.props.selected })} onClick={this.onClick}> { this.props.children } </li> ); } });
var React = require('react'); var classNames = require('classnames'); module.exports = Tab = React.createClass({ displayName: 'Tab', contextTypes: { activeClassName: React.PropTypes.string.isRequired }, propTypes: { className: React.PropTypes.string, id: React.PropTypes.number, selected: React.PropTypes.bool, children: React.PropTypes.oneOfType([ React.PropTypes.array, React.PropTypes.object, React.PropTypes.string ]) }, getDefaultProp: function() { return { selected: false, id: null }; }, onClick: function(event) { event.preventDefault(); this.props.handleClick(this.props.id); }, render() { return ( <li className={classNames(this.props.className, { [this.context.activeClassName]: this.props.selected })} onClick={this.onClick}> { this.props.children } </li> ); } });
Fix error when Id is not specified on the Tab component
Fix error when Id is not specified on the Tab component
JSX
mit
janvanhelvoort/easy-tabs
--- +++ @@ -8,7 +8,7 @@ }, propTypes: { className: React.PropTypes.string, - id: React.PropTypes.number.isRequired, + id: React.PropTypes.number, selected: React.PropTypes.bool, children: React.PropTypes.oneOfType([ React.PropTypes.array, @@ -16,9 +16,8 @@ React.PropTypes.string ]) }, - - getDefaultProps() { - return { selected: false }; + getDefaultProp: function() { + return { selected: false, id: null }; }, onClick: function(event) {
b3770692f961a0799829d53b6313cde80f9dadc3
client/views/readouts/transmission_delay_readout.jsx
client/views/readouts/transmission_delay_readout.jsx
import Moment from "moment"; import "moment-duration-format"; import React from "react"; import ListeningView from "../listening_view.js"; class TransmissionDelayReadout extends ListeningView { componentDidMount() { super.componentDidMount(); window.setInterval(() => {this.forceUpdate();}, 1000); } render() { const unixTime = this.state.data.length > 0 ? this.state.data[0].t : 0; const time = Moment.unix(unixTime).utc(); const now = Moment().utc(); const delta = now.diff(time, "milliseconds"); const rangeAlarm = Math.abs(delta) > 30000; const formatted = Moment.duration(delta, "milliseconds").format("HH:mm:ss", { trim: false }); return <span className={rangeAlarm ? "time-alarm" : ""}>{formatted}</span>; } } export {TransmissionDelayReadout as default};
import Moment from "moment"; import "moment-duration-format"; import React from "react"; import ListeningView from "../listening_view.js"; class TransmissionDelayReadout extends ListeningView { componentDidMount() { super.componentDidMount(); window.setInterval(() => {this.forceUpdate();}, 1000); } render() { const unixTime = this.state.data ? this.state.data.t : 0; const time = Moment.unix(unixTime).utc(); const now = Moment().utc(); const delta = now.diff(time, "milliseconds"); const rangeAlarm = Math.abs(delta) > 30000; const formatted = Moment.duration(delta, "milliseconds").format("HH:mm:ss", { trim: false }); return <span className={rangeAlarm ? "time-alarm" : ""}>{formatted}</span>; } } export {TransmissionDelayReadout as default};
Remove crossfilter from microcharts, fix atmo means, and clarify ground time label.
Remove crossfilter from microcharts, fix atmo means, and clarify ground time label.
JSX
mit
sensedata/space-telemetry,sensedata/space-telemetry
--- +++ @@ -12,7 +12,7 @@ } render() { - const unixTime = this.state.data.length > 0 ? this.state.data[0].t : 0; + const unixTime = this.state.data ? this.state.data.t : 0; const time = Moment.unix(unixTime).utc(); const now = Moment().utc(); const delta = now.diff(time, "milliseconds");
3938a21433dd4a23341547acd41523f3679b8cb1
src/react-chayns-selectlist/component/SelectItem.jsx
src/react-chayns-selectlist/component/SelectItem.jsx
import React from 'react'; import PropTypes from 'prop-types'; export default class SelectItem extends React.Component { static componentName = 'SelectItem'; static propTypes = { id: PropTypes.oneOfType([ // eslint-disable-line react/no-unused-prop-types PropTypes.string, PropTypes.number ]), name: PropTypes.string, // eslint-disable-line react/no-unused-prop-types disabled: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types className: PropTypes.string, // eslint-disable-line react/no-unused-prop-types children: PropTypes.node, }; static defaultProps = { id: null, name: null, disabled: null, className: null, children: null, }; render() { return( <div className="selectlist__selectitem"> {this.props.children} </div> ); } }
import React from 'react'; import PropTypes from 'prop-types'; export default class SelectItem extends React.Component { static componentName = 'SelectItem'; static propTypes = { id: PropTypes.oneOfType([ // eslint-disable-line react/no-unused-prop-types PropTypes.string, PropTypes.number ]), name: PropTypes.oneOfType([ // eslint-disable-line react/no-unused-prop-types PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node), ]), disabled: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types className: PropTypes.string, // eslint-disable-line react/no-unused-prop-types children: PropTypes.node, }; static defaultProps = { id: null, name: null, disabled: null, className: null, children: null, }; render() { return( <div className="selectlist__selectitem"> {this.props.children} </div> ); } }
Add possible propTypes to name-prop
Add possible propTypes to name-prop
JSX
mit
TobitSoftware/chayns-components,TobitSoftware/chayns-components,TobitSoftware/chayns-components
--- +++ @@ -10,7 +10,11 @@ PropTypes.string, PropTypes.number ]), - name: PropTypes.string, // eslint-disable-line react/no-unused-prop-types + name: PropTypes.oneOfType([ // eslint-disable-line react/no-unused-prop-types + PropTypes.string, + PropTypes.node, + PropTypes.arrayOf(PropTypes.node), + ]), disabled: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types className: PropTypes.string, // eslint-disable-line react/no-unused-prop-types children: PropTypes.node,
cb0e767775824914564ac1978352ffea1ba28758
components/ExamplePluginComponent.jsx
components/ExamplePluginComponent.jsx
import React from "react/addons"; import ExamplePluginStore from "../stores/ExamplePluginStore"; import ExamplePluginEvents from "../events/ExamplePluginEvents"; var {PluginActions, PluginDispatcher} = global.MarathonUIPluginAPI; var ExamplePluginComponent = React.createClass({ getInitialState: function () { return { appsCount: 0 }; }, componentDidMount: function () { ExamplePluginStore.on(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, componentWillUnmount: function () { ExamplePluginStore.removeListener(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, onAppsChange: function () { this.setState({ appsCount: ExamplePluginStore.apps.length }); }, handleClick: function (e) { e.stopPropagation(); PluginDispatcher.dispatch({ actionType: PluginActions.DIALOG_ALERT, data: { title: "Hello world", message: "Hi, Plugin speaking here." } }); }, render: function () { return ( <div> <div className="flex-row"> <h3 className="small-caps">Example Plugin</h3> </div> <ul className="list-group filters"> <li>{this.state.appsCount} applications in total</li> <li><hr /></li> <li className="clickable" onClick={this.handleClick}> <a>Click me</a> </li> </ul> </div> ); } }); export default ExamplePluginComponent;
import React from "react/addons"; import ExamplePluginStore from "../stores/ExamplePluginStore"; import ExamplePluginEvents from "../events/ExamplePluginEvents"; var {PluginActions, PluginHelper} = global.MarathonUIPluginAPI; var ExamplePluginComponent = React.createClass({ getInitialState: function () { return { appsCount: 0 }; }, componentDidMount: function () { ExamplePluginStore.on(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, componentWillUnmount: function () { ExamplePluginStore.removeListener(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, onAppsChange: function () { this.setState({ appsCount: ExamplePluginStore.apps.length }); }, handleClick: function (e) { e.stopPropagation(); PluginHelper.callAction(PluginActions.DIALOG_ALERT, { title: "Hello world", message: "Hi, Plugin speaking here." }); }, render: function () { return ( <div> <div className="flex-row"> <h3 className="small-caps">Example Plugin</h3> </div> <ul className="list-group filters"> <li>{this.state.appsCount} applications in total</li> <li><hr /></li> <li className="clickable" onClick={this.handleClick}> <a>Click me</a> </li> </ul> </div> ); } }); export default ExamplePluginComponent;
Add helper to call actions
Add helper to call actions
JSX
apache-2.0
mesosphere/marathon-ui-example-plugin
--- +++ @@ -3,7 +3,8 @@ import ExamplePluginStore from "../stores/ExamplePluginStore"; import ExamplePluginEvents from "../events/ExamplePluginEvents"; -var {PluginActions, PluginDispatcher} = global.MarathonUIPluginAPI; +var {PluginActions, PluginHelper} = + global.MarathonUIPluginAPI; var ExamplePluginComponent = React.createClass({ @@ -31,12 +32,9 @@ handleClick: function (e) { e.stopPropagation(); - PluginDispatcher.dispatch({ - actionType: PluginActions.DIALOG_ALERT, - data: { - title: "Hello world", - message: "Hi, Plugin speaking here." - } + PluginHelper.callAction(PluginActions.DIALOG_ALERT, { + title: "Hello world", + message: "Hi, Plugin speaking here." }); },
01673bdc5afeb69ca84034b3edfd95511a13d549
client/src/components/Nav/index.jsx
client/src/components/Nav/index.jsx
import React, { Component } from 'react'; import AppBar from 'material-ui/AppBar'; import $ from "jquery"; import { Link } from 'react-router'; import NavMenuIcon from './NavMenuIcon'; const color={ backgroundImage: 'url("http://bit.ly/2b2ePzs")', width: "100%", opacity: 0.6 }; class AppNavBar extends Component { componentDidMount() { $.get("/fbLoggedIn?", (response, err) => { if (response !== "false") { this.logIn(response); } }); } clearSessions() { $.get("/logout", (resp, err) => { this.props.logOut(); }); } render() { return ( <div id="navBar"> <AppBar style={color} showMenuIconButton={false} > <Link to="/"> <img id="logo" src="http://bit.ly/2beSCQg" alt="logo" /> </Link> <NavMenuIcon /> </AppBar> </div> ); } } AppNavBar.contextTypes = { router: React.PropTypes.object }; AppNavBar.propTypes = { title: React.PropTypes.string.isRequired, loggedIn: React.PropTypes.bool.isRequired, user: React.PropTypes.string.isRequired, logout: React.PropTypes.func.isRequired, }; export default AppNavBar;
import React, { Component } from 'react'; import AppBar from 'material-ui/AppBar'; import $ from "jquery"; import { Link } from 'react-router'; import NavMenuIcon from './NavMenuIcon'; const color={ backgroundImage: 'url("http://bit.ly/2b2ePzs")', width: "100%", opacity: 0.6 }; class AppNavBar extends Component { componentDidMount() { $.get("/fbLoggedIn?", (response, err) => { if (response !== "false") { this.logIn(response); } }); } clearSessions() { $.get("/logout", (resp, err) => { this.props.logOut(); }); } render() { return ( <div id="navBar"> <AppBar style={color} showMenuIconButton={false} > <Link to="/"> <img id="logo" src="http://bit.ly/2beSCQg" alt="logo" /> </Link> <NavMenuIcon /> </AppBar> </div> ); } } AppNavBar.contextTypes = { router: React.PropTypes.object }; AppNavBar.propTypes = { title: React.PropTypes.string.isRequired, loggedIn: React.PropTypes.bool.isRequired, user: React.PropTypes.string.isRequired, logOut: React.PropTypes.func.isRequired, }; export default AppNavBar;
Fix typo in prop types
Fix typo in prop types
JSX
mit
NerdDiffer/reprise,NerdDiffer/reprise,NerdDiffer/reprise
--- +++ @@ -46,7 +46,7 @@ title: React.PropTypes.string.isRequired, loggedIn: React.PropTypes.bool.isRequired, user: React.PropTypes.string.isRequired, - logout: React.PropTypes.func.isRequired, + logOut: React.PropTypes.func.isRequired, }; export default AppNavBar;
fe8e6d725181b541e7e19c94194d693c5140ec25
SingularityUI/app/components/taskSearch/Header.jsx
SingularityUI/app/components/taskSearch/Header.jsx
import React from 'react'; import Glyphicon from '../common/atomicDisplayItems/Glyphicon'; let Header = React.createClass({ render() { return <div>{this.props.global ? <a className='btn btn-danger' href={window.config.appRoot + '/request/' + this.props.requestId} alt={`Return to Request ${ this.props.requestId }`}><Glyphicon iconClass='arrow-left' /> Back to {this.props.requestId}</a> : undefined}<h1>{this.props.global ? 'Global' : undefined} Historical Tasks</h1></div>; } }); export default Header;
import React, { PropTypes } from 'react'; import Glyphicon from '../common/atomicDisplayItems/Glyphicon'; const Header = (props) => { let maybeLink; if (props.global) { maybeLink = ( <a className="btn btn-danger" href={`${config.appRoot}/request/${props.requestId}`} alt={`Return to Request ${props.requestId}`}> <Glyphicon iconClass="arrow-left" /> {' Back to '}{props.requestId} </a> ); } return ( <div> {maybeLink} <h1> {props.global ? 'Global' : ''} Historical Tasks </h1> </div> ); }; Header.propTypes = { global: PropTypes.bool, requestId: PropTypes.string }; export default Header;
Clean up one of the task search components
Clean up one of the task search components
JSX
apache-2.0
HubSpot/Singularity,hs-jenkins-bot/Singularity,andrhamm/Singularity,hs-jenkins-bot/Singularity,andrhamm/Singularity,andrhamm/Singularity,hs-jenkins-bot/Singularity,HubSpot/Singularity,hs-jenkins-bot/Singularity,HubSpot/Singularity,andrhamm/Singularity,HubSpot/Singularity,andrhamm/Singularity,HubSpot/Singularity,hs-jenkins-bot/Singularity
--- +++ @@ -1,12 +1,30 @@ -import React from 'react'; +import React, { PropTypes } from 'react'; import Glyphicon from '../common/atomicDisplayItems/Glyphicon'; -let Header = React.createClass({ +const Header = (props) => { + let maybeLink; - render() { - return <div>{this.props.global ? <a className='btn btn-danger' href={window.config.appRoot + '/request/' + this.props.requestId} alt={`Return to Request ${ this.props.requestId }`}><Glyphicon iconClass='arrow-left' /> Back to {this.props.requestId}</a> : undefined}<h1>{this.props.global ? 'Global' : undefined} Historical Tasks</h1></div>; - } -}); + if (props.global) { + maybeLink = ( + <a className="btn btn-danger" href={`${config.appRoot}/request/${props.requestId}`} alt={`Return to Request ${props.requestId}`}> + <Glyphicon iconClass="arrow-left" /> + {' Back to '}{props.requestId} + </a> + ); + } + return ( + <div> + {maybeLink} + <h1> + {props.global ? 'Global' : ''} Historical Tasks + </h1> + </div> + ); +}; + +Header.propTypes = { + global: PropTypes.bool, + requestId: PropTypes.string +}; export default Header; -
71e8b6bcdc4b434371b38de684ac740ed706b3dc
www/app/script/component/LikeButtons.jsx
www/app/script/component/LikeButtons.jsx
var React = require('react'); var ForceAuthMixin = require('../mixin/ForceAuthMixin'); var LikeButtons = React.createClass({ mixins: [ ForceAuthMixin ], getLikeIconClassNames: function(value) { if (value) return 'icon-thumb_up icon-btn' + (this.props.resource.likes.length && this.props.resource.likes[0].value ? ' icon-btn-active' : ''); return 'icon-thumb_down icon-btn' + (this.props.resource.likes.length && !this.props.resource.likes[0].value ? ' icon-btn-active' : '') }, render: function() { return ( <span> <span className={this.getLikeIconClassNames(true)} onClick={(e)=>this.props.likeAction(this.props.resource.id, true)}></span> <span className={this.getLikeIconClassNames(false)} onClick={(e)=>this.props.likeAction(this.props.resource.id, false)}></span> <span className="like-score">({this.props.resource.score})</span> </span> ); } }); module.exports = LikeButtons;
var React = require('react'); var ForceAuthMixin = require('../mixin/ForceAuthMixin'); var LikeButtons = React.createClass({ mixins: [ ForceAuthMixin ], getLikeIconClassNames: function(value) { if (value) return 'icon-thumb_up icon-btn' + (this.props.resource.likes.length && this.props.resource.likes[0].value ? ' icon-btn-active' : ''); return 'icon-thumb_down icon-btn' + (this.props.resource.likes.length && !this.props.resource.likes[0].value ? ' icon-btn-active' : '') }, render: function() { return ( <span> {this.isAuthenticated() ? <span> <span className={this.getLikeIconClassNames(true)} onClick={(e)=>this.props.likeAction(this.props.resource.id, true)}></span> <span className={this.getLikeIconClassNames(false)} onClick={(e)=>this.props.likeAction(this.props.resource.id, false)}></span> </span> : <span/>} <span className="like-score">({this.props.resource.score})</span> </span> ); } }); module.exports = LikeButtons;
Add like/dislike buttons when the user is not logged in.
Add like/dislike buttons when the user is not logged in.
JSX
mit
promethe42/cocorico,promethe42/cocorico,promethe42/cocorico,promethe42/cocorico,promethe42/cocorico
--- +++ @@ -26,10 +26,14 @@ { return ( <span> - <span className={this.getLikeIconClassNames(true)} - onClick={(e)=>this.props.likeAction(this.props.resource.id, true)}></span> - <span className={this.getLikeIconClassNames(false)} - onClick={(e)=>this.props.likeAction(this.props.resource.id, false)}></span> + {this.isAuthenticated() + ? <span> + <span className={this.getLikeIconClassNames(true)} + onClick={(e)=>this.props.likeAction(this.props.resource.id, true)}></span> + <span className={this.getLikeIconClassNames(false)} + onClick={(e)=>this.props.likeAction(this.props.resource.id, false)}></span> + </span> + : <span/>} <span className="like-score">({this.props.resource.score})</span> </span> );
869b44c5d6a0d7174def151577444a18e30929a3
application/jsx/home.jsx
application/jsx/home.jsx
/** @jsx React.DOM */ define([ 'react', 'templates/mixins/navigate' ], function( React, NavigateMixin ) { return React.createClass({ displayName : 'HomeModule', mixins : [NavigateMixin], logout : function(event) { event.preventDefault(); this.props.user.logout(); }, render : function() { if (this.props.loggedIn) { return ( <div> <p> Hello. You are logged in. <a onClick={this.logout}>Log out</a> </p> <p> Your email: <a href="/account/change-email" onClick={this.navigate}>Change email</a> </p> <p> <a href="/account/change-password" onClick={this.navigate}>Change password</a> </p> </div> ); } else { return ( <div> <p> Hello. Please <a href="/login" onClick={this.navigate}>log in</a> or <a href="/register" onClick={this.navigate}>register</a>. </p> <p> Or <a href="http://project.vm/social-login/github">log in with GitHub</a>. </p> </div> ); } } }); });
/** @jsx React.DOM */ define([ 'react', 'templates/mixins/navigate' ], function( React, NavigateMixin ) { return React.createClass({ displayName : 'HomeModule', mixins : [NavigateMixin], logout : function(event) { var success = _.bind( function() { this.redirect('/'); }, this ); event.preventDefault(); this.props.user.logout(success); }, render : function() { if (this.props.loggedIn) { return ( <div> <p> Hello. You are logged in. <a onClick={this.logout}>Log out</a> </p> <p> Your email: <a href="/account/change-email" onClick={this.navigate}>Change email</a> </p> <p> <a href="/account/change-password" onClick={this.navigate}>Change password</a> </p> </div> ); } else { return ( <div> <p> Hello. Please <a href="/login" onClick={this.navigate}>log in</a> or <a href="/register" onClick={this.navigate}>register</a>. </p> <p> Or <a href="http://project.vm/social-login/github">log in with GitHub</a>. </p> </div> ); } } }); });
Send redirect closure on successful logout.
Send redirect closure on successful logout.
JSX
mit
areida/spacesynter,dcpages/dcLibrary-Template,dcpages/dcLibrary-Template,areida/spacesynter,areida/spacesynter,areida/spacesynter,areida/spacesynter
--- +++ @@ -13,8 +13,16 @@ mixins : [NavigateMixin], logout : function(event) { + var success = _.bind( + function() { + this.redirect('/'); + }, + this + ); + event.preventDefault(); - this.props.user.logout(); + + this.props.user.logout(success); }, render : function() {
deabd499cb2d81964b7afbf9aa10be8bc504513d
js/views/filelist.jsx
js/views/filelist.jsx
var React = require('react') var Table = require('react-bootstrap/Table') var addr = require('./typography.jsx').addr module.exports = React.createClass({ render: function() { var files = this.props.files var className = "table-hover filelist" if(this.props.namesHidden) className += ' filelist-names-hidden' return ( <Table responsive className={className}> <thead> <tr> <th></th> <th className="filelist-name">Name</th> <th>ID</th> </tr> </thead> <tbody> {files ? files.map(function(file) { if(typeof file === 'string') file = { id: file } return ( <tr className="webui-file" data-type={file.type}> <td><a target="_blank" href={'http://localhost:5001/ipfs/'+file.id}><i className="fa fa-file"></i></a></td> <td className="filelist-name"><a target="_blank" href={'http://localhost:5001/ipfs/'+file.id}>{file.name}</a></td> <td><a target="_blank" href={'http://localhost:5001/ipfs/'+file.id}>{addr(file.id)}</a></td> </tr> ) }) : void 0} </tbody> </Table> ) } })
var React = require('react') var Table = require('react-bootstrap/Table') var addr = require('./typography.jsx').addr module.exports = React.createClass({ render: function() { var files = this.props.files var className = "table-hover filelist" if(this.props.namesHidden) className += ' filelist-names-hidden' return ( <Table responsive className={className}> <thead> <tr> <th></th> <th className="filelist-name">Name</th> <th>ID</th> </tr> </thead> <tbody> {files ? files.map(function(file) { if(typeof file === 'string') file = { id: file } // TODO: get gateway path from config instead of using hardcoded localhost:8080 return ( <tr className="webui-file" data-type={file.type}> <td><a target="_blank" href={'http://localhost:8080/ipfs/'+file.id}><i className="fa fa-file"></i></a></td> <td className="filelist-name"><a target="_blank" href={'http://localhost:8080/ipfs/'+file.id}>{file.name}</a></td> <td><a target="_blank" href={'http://localhost:8080/ipfs/'+file.id}>{addr(file.id)}</a></td> </tr> ) }) : void 0} </tbody> </Table> ) } })
Use gateway server for viewing files
Use gateway server for viewing files
JSX
mit
masylum/webui,ipfs/webui,manlea/ipfs,masylum/webui,manlea/ipfs,ipfs/webui,ipfs/webui
--- +++ @@ -22,11 +22,12 @@ {files ? files.map(function(file) { if(typeof file === 'string') file = { id: file } + // TODO: get gateway path from config instead of using hardcoded localhost:8080 return ( <tr className="webui-file" data-type={file.type}> - <td><a target="_blank" href={'http://localhost:5001/ipfs/'+file.id}><i className="fa fa-file"></i></a></td> - <td className="filelist-name"><a target="_blank" href={'http://localhost:5001/ipfs/'+file.id}>{file.name}</a></td> - <td><a target="_blank" href={'http://localhost:5001/ipfs/'+file.id}>{addr(file.id)}</a></td> + <td><a target="_blank" href={'http://localhost:8080/ipfs/'+file.id}><i className="fa fa-file"></i></a></td> + <td className="filelist-name"><a target="_blank" href={'http://localhost:8080/ipfs/'+file.id}>{file.name}</a></td> + <td><a target="_blank" href={'http://localhost:8080/ipfs/'+file.id}>{addr(file.id)}</a></td> </tr> ) }) : void 0}
59b53507960d88a3f6d270c4996ac1e95a1c7c00
src/js/letters/containers/LettersApp.jsx
src/js/letters/containers/LettersApp.jsx
import React from 'react'; import { connect } from 'react-redux'; import RequiredLoginView from '../../common/components/RequiredLoginView'; // This needs to be a React component for RequiredLoginView to pass down // the isDataAvailable prop, which is only passed on failure. function AppContent({ children, isDataAvailable }) { const unregistered = isDataAvailable === false; let view; if (unregistered) { view = ( <h4> To view and download your VA letters, you need to verify your identity (or whatever). </h4> ); } else { view = children; } return ( <div className="usa-grid"> {view} </div> ); } class LettersApp extends React.Component { render() { return ( <RequiredLoginView authRequired={3} serviceRequired={"evss-claims"} userProfile={this.props.profile} loginUrl={this.props.loginUrl} verifyUrl={this.props.verifyUrl}> <AppContent> <div> {this.props.children} </div> </AppContent> </RequiredLoginView> ); } } function mapStateToProps(state) { const userState = state.user; return { profile: userState.profile, loginUrl: userState.login.loginUrl, verifyUrl: userState.login.verifyUrl }; } export default connect(mapStateToProps)(LettersApp);
import React from 'react'; import { connect } from 'react-redux'; import RequiredLoginView from '../../common/components/RequiredLoginView'; // This needs to be a React component for RequiredLoginView to pass down // the isDataAvailable prop, which is only passed on failure. function AppContent({ children, isDataAvailable }) { const unregistered = isDataAvailable === false; let view; if (unregistered) { view = ( <h4> We weren't able to find information about your VA letters. If you think you should be able to access this information, please call the Vets.gov Help Desk at 855-574-7286 (TTY: 800-829-4833). We're here Monday–Friday, 8:00 a.m.–8:00 p.m. (ET). </h4> ); } else { view = children; } return ( <div className="usa-grid"> {view} </div> ); } class LettersApp extends React.Component { render() { return ( <RequiredLoginView authRequired={3} serviceRequired={"evss-claims"} userProfile={this.props.profile} loginUrl={this.props.loginUrl} verifyUrl={this.props.verifyUrl}> <AppContent> <div> {this.props.children} </div> </AppContent> </RequiredLoginView> ); } } function mapStateToProps(state) { const userState = state.user; return { profile: userState.profile, loginUrl: userState.login.loginUrl, verifyUrl: userState.login.verifyUrl }; } export default connect(mapStateToProps)(LettersApp);
Change basic error message content
Change basic error message content
JSX
cc0-1.0
department-of-veterans-affairs/vets-website,department-of-veterans-affairs/vets-website
--- +++ @@ -12,7 +12,8 @@ if (unregistered) { view = ( <h4> - To view and download your VA letters, you need to verify your identity (or whatever). + We weren't able to find information about your VA letters. + If you think you should be able to access this information, please call the Vets.gov Help Desk at 855-574-7286 (TTY: 800-829-4833). We're here Monday–Friday, 8:00 a.m.–8:00 p.m. (ET). </h4> ); } else {
23f1e9f1f17832e21490be3f67ee36d3b0110baf
frontend/components/organizer-dash.jsx
frontend/components/organizer-dash.jsx
import React from 'react' import TabSelector from './tab-selector' import MeetingCalendar from './meeting-calendar' import WeeklyMeetingsList from './weekly-meetings-list' import ActiveLearningCirclesList from './active-learning-circles-list' import FacilitatorList from './facilitator-list' import InvitationList from './invitation-list' require("./stylesheets/organizer-dash.scss"); export default class OrganizerDash extends React.Component{ render() { return ( <div className="organizer-dash"> <h1>{gettext("Organizer Dashboard")}</h1> <TabSelector header={[gettext('Upcoming Meetings'), gettext('Active Learning Circles'), gettext('Facilitators'), gettext('Invitations')]} > <WeeklyMeetingsList meetings={this.props.meetings} learningCircles={this.props.activeLearningCircles} /> <ActiveLearningCirclesList learningCircles={this.props.activeLearningCircles} /> <FacilitatorList facilitators={this.props.facilitators} /> <InvitationList teamInviteUrl={this.props.teamInviteUrl} invitations={this.props.invitations} /> </TabSelector> </div> ); } }
import React from 'react' import TabSelector from './tab-selector' import WeeklyMeetingsList from './weekly-meetings-list' import ActiveLearningCirclesList from './active-learning-circles-list' import FacilitatorList from './facilitator-list' import InvitationList from './invitation-list' require("./stylesheets/organizer-dash.scss"); export default class OrganizerDash extends React.Component{ render() { return ( <div className="organizer-dash"> <h1>{gettext("Organizer Dashboard")}</h1> <TabSelector header={[gettext('Upcoming Meetings'), gettext('Active Learning Circles'), gettext('Facilitators'), gettext('Invitations')]} > <WeeklyMeetingsList meetings={this.props.meetings} learningCircles={this.props.activeLearningCircles} /> <ActiveLearningCirclesList learningCircles={this.props.activeLearningCircles} /> <FacilitatorList facilitators={this.props.facilitators} /> <InvitationList teamInviteUrl={this.props.teamInviteUrl} invitations={this.props.invitations} /> </TabSelector> </div> ); } }
Remove import for missing file
Remove import for missing file
JSX
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
--- +++ @@ -1,6 +1,5 @@ import React from 'react' import TabSelector from './tab-selector' -import MeetingCalendar from './meeting-calendar' import WeeklyMeetingsList from './weekly-meetings-list' import ActiveLearningCirclesList from './active-learning-circles-list' import FacilitatorList from './facilitator-list'
0ac88c65188fb6d22ad2dd9924907c397aedd3f5
src/js/components/Tasks.jsx
src/js/components/Tasks.jsx
import React from 'react'; export default class Tasks extends React.Component { constructor(props) { super(props); } render() { const tasks = this.props.tasks.map((task) => { return ( <tr key={task.id}> <td> <input type="checkbox" id={task.id} name={task.id} value={task.id} /> <label htmlFor={task.id}>{task.text}</label> </td> </tr> ); }); return ( <div className="content"> <h3>{this.props.label}</h3> <table className="table"> <tbody> {tasks} </tbody> </table> </div> ); } }
import React, { PropTypes } from 'react'; import Task from './Task.jsx'; const propTypes = { label: PropTypes.string.isRequired, tasks: PropTypes.array, }; export default class Tasks extends React.Component { render() { const tasks = this.props.tasks.map(task => <Task key={task.id} task={task} />); return ( <div className="content"> <h3>{this.props.label}</h3> <table className="table"> <tbody> {tasks} </tbody> </table> </div> ); } } Tasks.propTypes = propTypes;
Add proptypes in tasks component
Add proptypes in tasks component
JSX
mit
tanaka0325/nippo-web,tanaka0325/nippo-web
--- +++ @@ -1,21 +1,15 @@ -import React from 'react'; +import React, { PropTypes } from 'react'; + +import Task from './Task.jsx'; + +const propTypes = { + label: PropTypes.string.isRequired, + tasks: PropTypes.array, +}; export default class Tasks extends React.Component { - constructor(props) { - super(props); - } - render() { - const tasks = this.props.tasks.map((task) => { - return ( - <tr key={task.id}> - <td> - <input type="checkbox" id={task.id} name={task.id} value={task.id} /> - <label htmlFor={task.id}>{task.text}</label> - </td> - </tr> - ); - }); + const tasks = this.props.tasks.map(task => <Task key={task.id} task={task} />); return ( <div className="content"> @@ -29,3 +23,5 @@ ); } } + +Tasks.propTypes = propTypes;
d3ed3bf2bd74b53465d0a816092a5e3472aabc25
www_src/components/card/card.jsx
www_src/components/card/card.jsx
var React = require('react/addons'); var ImageLoader = require('react-imageloader'); var Link = require('../link/link.jsx'); var Card = React.createClass({ statics: { DEFAULT_THUMBNAIL: '../../img/default.svg' }, actionsClicked: function (e) { e.preventDefault(); e.stopPropagation(); this.props.onActionsClick.call(this, this.props); }, render: function () { return ( <Link url={this.props.url} href={this.props.href} className="card"> <div className="thumbnail"> <ImageLoader src={this.props.thumbnail || Card.DEFAULT_THUMBNAIL}></ImageLoader> </div> <div className="meta"> <div className="text"> <div className="title">{this.props.title}</div> <div className="author">{this.props.author}</div> </div> <div className="action" hidden={!this.props.showButton}> <button onClick={this.actionsClicked}> <img src="../../img/more-dots.svg"/> </button> </div> </div> </Link> ); } }); module.exports = Card;
var React = require('react/addons'); var ImageLoader = require('react-imageloader'); var Link = require('../link/link.jsx'); var Card = React.createClass({ statics: { DEFAULT_THUMBNAIL: '../../img/default.svg' }, actionsClicked: function (e) { e.preventDefault(); e.stopPropagation(); this.props.onActionsClick.call(this, this.props); }, prerenderImage: function() { return React.createElement('img', { src: Card.DEFAULT_THUMBNAIL }); }, render: function () { return ( <Link url={this.props.url} href={this.props.href} className="card"> <div className="thumbnail"> <ImageLoader src={this.props.thumbnail || Card.DEFAULT_THUMBNAIL} preloader={this.prerenderImage}></ImageLoader> </div> <div className="meta"> <div className="text"> <div className="title">{this.props.title}</div> <div className="author">{this.props.author}</div> </div> <div className="action" hidden={!this.props.showButton}> <button onClick={this.actionsClicked}> <img src="../../img/more-dots.svg"/> </button> </div> </div> </Link> ); } }); module.exports = Card;
Use react-imageloaders prerender property to prevent 0 height thumbnails
Use react-imageloaders prerender property to prevent 0 height thumbnails
JSX
mpl-2.0
bolaram/webmaker-android,alanmoo/webmaker-android,rodmoreno/webmaker-android,k88hudson/webmaker-android,j796160836/webmaker-android,gvn/webmaker-android,gvn/webmaker-android,alicoding/webmaker-android,alanmoo/webmaker-android,mozilla/webmaker-android,bolaram/webmaker-android,k88hudson/webmaker-android,rodmoreno/webmaker-android,j796160836/webmaker-android,alicoding/webmaker-android,mozilla/webmaker-android
--- +++ @@ -11,11 +11,16 @@ e.stopPropagation(); this.props.onActionsClick.call(this, this.props); }, + prerenderImage: function() { + return React.createElement('img', { + src: Card.DEFAULT_THUMBNAIL + }); + }, render: function () { return ( <Link url={this.props.url} href={this.props.href} className="card"> <div className="thumbnail"> - <ImageLoader src={this.props.thumbnail || Card.DEFAULT_THUMBNAIL}></ImageLoader> + <ImageLoader src={this.props.thumbnail || Card.DEFAULT_THUMBNAIL} preloader={this.prerenderImage}></ImageLoader> </div> <div className="meta">
afecdce4f7b6faaa6ecad4eaa5c4440a5d8b7b53
elements/BodyContent.jsx
elements/BodyContent.jsx
'use strict'; var React = require('react'); var Router = require('react-router'); var RouteHandler = Router.RouteHandler; var Paths = require('./PathsMixin'); var layoutHooks = require('../layoutHooks'); var config = require('config'); module.exports = function(Body) { return React.createClass({ displayName: 'BodyContent', mixins: [Router.State, Paths], render: function() { var external = getExternalContent(this.getAllItems(), this.getPathname()); return ( <Body> <RouteHandler></RouteHandler> {_.map(external, function (Component, i) { return <Component key={i} />; })} </Body> ); }, }); } function getExternalContent(paths, currentPath) { return layoutHooks.bodyContent({ config: config, paths: paths, currentPath: currentPath, }); }
'use strict'; var React = require('react'); var Router = require('react-router'); var RouteHandler = Router.RouteHandler; var Paths = require('./PathsMixin'); var layoutHooks = require('../layoutHooks'); var config = require('config'); module.exports = function(Body) { return React.createClass({ displayName: 'BodyContent', mixins: [Router.State, Paths], render: function() { var external = getExternalContent(this.getAllItems(), this.getPathname()); return ( <Body> <RouteHandler></RouteHandler> {_.map(external, function (Component, i) { return <Component key={i} />; })} </Body> ); }, }); } function getExternalContent(paths, pathName) { return layoutHooks.bodyContent({ config: config, paths: paths, currentPath: getCurrentPath(paths, pathName), }); } function getCurrentPath(paths, pathName) { pathName = pathName[0] === '/' ? pathName.slice(1) : pathName; return paths[pathName]; }
Return an object for `currentPath`
Return an object for `currentPath` This makes more sense as it's easier to consume at plugins.
JSX
mit
RamonGebben/antwar,RamonGebben/antwar,antwarjs/antwar
--- +++ @@ -27,10 +27,16 @@ }); } -function getExternalContent(paths, currentPath) { +function getExternalContent(paths, pathName) { return layoutHooks.bodyContent({ config: config, paths: paths, - currentPath: currentPath, + currentPath: getCurrentPath(paths, pathName), }); } + +function getCurrentPath(paths, pathName) { + pathName = pathName[0] === '/' ? pathName.slice(1) : pathName; + + return paths[pathName]; +}
770d35541593321404042aa7ea1cc58e583abeeb
src/ui/components/FileList/index.jsx
src/ui/components/FileList/index.jsx
import { h } from 'preact'; import Button from 'components/Button'; import Center from 'components/Center'; import FileListItem from 'components/FileListItem'; import { GATEWAY_URL } from '../../../electron/constants'; import { shell, ipcRenderer } from 'electron'; import { IPC_EVENT_HIDE_MENU, } from '../../../shared/constants'; import styles from './FileList.css'; const FileList = ({ files, synced, folder, ...props }) => { if (files.length < 1 && !synced) { return ( <Center>Syncing…</Center> ); } if (files.length < 1) { return ( <Center> <p>Drag a file into your Partyshare folder to begin</p> <Button onClick={() => { shell.openItem(folder.path); ipcRenderer.send(IPC_EVENT_HIDE_MENU); }} > Reveal Folder </Button> </Center> ); } // files = files.sort((a, b) => new Date(b.stats.ctime) - new Date(a.stats.ctime)); return ( <ul className={styles.this} {...props}> {files.map((file) => <FileListItem name={file.name} path={file.path} url={`${GATEWAY_URL}/${file.urlPath}`} /> )} </ul> ); }; export default FileList;
import { h } from 'preact'; import Button from 'components/Button'; import Center from 'components/Center'; import FileListItem from 'components/FileListItem'; import { GATEWAY_URL } from '../../../electron/constants'; import { shell, ipcRenderer } from 'electron'; import { IPC_EVENT_HIDE_MENU, } from '../../../shared/constants'; import styles from './FileList.css'; const FileList = ({ files, synced, folder, ...props }) => { if (files.length < 1 && !synced) { return ( <Center>Syncing…</Center> ); } if (files.length < 1) { return ( <Center> <p>Drag a file into your Partyshare folder to begin</p> <Button onClick={() => { shell.openItem(folder.path); ipcRenderer.send(IPC_EVENT_HIDE_MENU); }} > Reveal Folder </Button> </Center> ); } files = files.sort((a, b) => new Date(b.stats.ctime) - new Date(a.stats.ctime)); return ( <ul className={styles.this} {...props}> {files.map((file) => <FileListItem name={file.name} path={file.path} url={`${GATEWAY_URL}/${file.urlPath}`} /> )} </ul> ); }; export default FileList;
Sort files by the date added to partyshare folder
Sort files by the date added to partyshare folder Closes #33
JSX
mit
BusterLabs/Partyshare,BusterLabs/Partyshare
--- +++ @@ -38,7 +38,7 @@ ); } - // files = files.sort((a, b) => new Date(b.stats.ctime) - new Date(a.stats.ctime)); + files = files.sort((a, b) => new Date(b.stats.ctime) - new Date(a.stats.ctime)); return ( <ul className={styles.this} {...props}>
73aea839fd28695fae423a4c798176e394f6f424
src/components/Layout/global.jsx
src/components/Layout/global.jsx
import { Global as EmotionGlobal } from "@emotion/core" import React from "react" const Global = () => ( <EmotionGlobal styles={{ ".gatsby-highlight": { backgroundColor: "#fdf6e3", borderRadius: "0.3em", marginBottom: "1.58em", padding: "1em", overflow: "auto", "& pre[class*=language-]": { backgroundColor: "transparent", margin: 0, padding: "0 1em 0 0", overflow: "initial", float: "left", minWidth: "100%", "&.line-numbers": { paddingLeft: "2.8em", "& .line-numbers-rows span": { lineHeight: 1.5, }, ".gatsby-highlight-code-line": { marginLeft: "-3.8em", marginRight: "-2em", paddingLeft: "3.7em", }, }, }, }, ".gatsby-highlight-code-line": { backgroundColor: "#feb", display: "block", marginRight: "-2.2em", marginLeft: "-1.2em", paddingRight: "1em", paddingLeft: "0.9em", borderLeft: "0.3em solid #f99", }, }} /> ) export default Global
import { Global as EmotionGlobal } from "@emotion/core" import React from "react" const Global = () => ( <EmotionGlobal styles={{ ".gatsby-highlight": { backgroundColor: "#fdf6e3", borderRadius: "0.3em", marginBottom: "1.58em", padding: "1em", overflow: "auto", "& pre[class*=language-]": { backgroundColor: "transparent", margin: 0, padding: "0 1em 0 0", overflow: "initial", float: "left", minWidth: "100%", "&.line-numbers": { paddingLeft: "2.8em", "& .line-numbers-rows span": { lineHeight: 1.5, }, ".gatsby-highlight-code-line": { marginLeft: "-3.8em", paddingLeft: "3.7em", }, }, }, }, ".gatsby-highlight-code-line": { backgroundColor: "#feb", display: "block", marginRight: "-2em", marginLeft: "-1em", paddingRight: "1em", paddingLeft: "0.75em", borderLeft: "0.25em solid #f99", }, }} /> ) export default Global
Fix code line highlight margins
Fix code line highlight margins
JSX
mit
jbhannah/jbhannah.net,jbhannah/jbhannah.net
--- +++ @@ -24,7 +24,6 @@ }, ".gatsby-highlight-code-line": { marginLeft: "-3.8em", - marginRight: "-2em", paddingLeft: "3.7em", }, }, @@ -33,11 +32,11 @@ ".gatsby-highlight-code-line": { backgroundColor: "#feb", display: "block", - marginRight: "-2.2em", - marginLeft: "-1.2em", + marginRight: "-2em", + marginLeft: "-1em", paddingRight: "1em", - paddingLeft: "0.9em", - borderLeft: "0.3em solid #f99", + paddingLeft: "0.75em", + borderLeft: "0.25em solid #f99", }, }} />
4580d169f23b6795109ba3d85ace3798c99f4d59
client/src/routes.jsx
client/src/routes.jsx
// Modules import React from 'react'; import { Route, IndexRoute } from 'react-router'; // Local Imports import App from './components/App'; import LandingPage from './components/LandingPage'; import Login from './components/Login'; import Signup from './components/Signup'; import Room from './components/Room'; import CreateOrJoin from './components/CreateOrJoin'; import Invalid from './components/Invalid'; import Metronome from './components/Metronome'; export default ( <Route path="/" component={App}> <IndexRoute component={LandingPage} /> <Route path="login" component={Login} /> <Route path="signup" component={Signup} /> <Route path="room/:roomId" component={Room} /> <Route path="createorjoin" component={CreateOrJoin} /> <Route path="metronome" component={Metronome} /> <Route path="*" component={Invalid} /> </Route> );
// Modules import React from 'react'; import { Route, IndexRoute } from 'react-router'; // Local Imports import App from './components/App'; import LandingPage from './components/LandingPage'; import Login from './components/Login'; import Signup from './components/Signup'; import Room from './components/Room'; import CreateOrJoin from './components/CreateOrJoin'; import Invalid from './components/Invalid'; import Metronome from './components/Metronome'; import BeatSequencer from './components/BeatSequencer'; export default ( <Route path="/" component={App}> <IndexRoute component={LandingPage} /> <Route path="login" component={Login} /> <Route path="signup" component={Signup} /> <Route path="room/:roomId" component={Room} /> <Route path="createorjoin" component={CreateOrJoin} /> <Route path="metronome" component={Metronome} /> <Route path="beats" component={BeatSequencer} /> <Route path="*" component={Invalid} /> </Route> );
Add a route for BeatSequencer
Add a route for BeatSequencer
JSX
mit
NerdDiffer/reprise,NerdDiffer/reprise,NerdDiffer/reprise
--- +++ @@ -11,7 +11,7 @@ import CreateOrJoin from './components/CreateOrJoin'; import Invalid from './components/Invalid'; import Metronome from './components/Metronome'; - +import BeatSequencer from './components/BeatSequencer'; export default ( <Route path="/" component={App}> @@ -21,6 +21,7 @@ <Route path="room/:roomId" component={Room} /> <Route path="createorjoin" component={CreateOrJoin} /> <Route path="metronome" component={Metronome} /> + <Route path="beats" component={BeatSequencer} /> <Route path="*" component={Invalid} /> </Route> );
106f7f1010328cf3c09eaee4ffe00ecdfe1933ad
src/mb/components/MovieDetailSpotlight.jsx
src/mb/components/MovieDetailSpotlight.jsx
import React from 'react'; import RatingStars from './RatingStars'; export default class MovieDetailSpotlight extends React.Component { static propTypes = { movie: React.PropTypes.shape({ trailers: React.PropTypes.array, title: React.PropTypes.string, year: React.PropTypes.string, countries: React.PropTypes.array, durations: React.PropTypes.array, rating: React.PropTypes.shape({ average: React.PropTypes.number, stars: React.PropTypes.string }) }).isRequired }; static defaultProps = { movie: { trailers: null } }; render() { const style = { backgroundImage: `-webkit-linear-gradient(left, rgba(0,0,0,1) 28%, rgba(20,20,20,0)), url('${this.props.movie.trailers[0].medium}')`, }; return ( <div className="movie-detail-spotlight" style={style}> <div className="title">{this.props.movie.title}</div> <div className="info"> <span>{this.props.movie.year}</span> <span>{this.props.movie.countries[0]}</span> <span>{this.props.movie.durations[0]}</span> </div> <div className="rating"> <RatingStars stars={this.props.movie.rating.stars} average={this.props.movie.rating.average} /> </div> </div> ); } }
import React from 'react'; import RatingStars from './RatingStars'; export default class MovieDetailSpotlight extends React.Component { static propTypes = { movie: React.PropTypes.shape({ trailers: React.PropTypes.array, title: React.PropTypes.string, year: React.PropTypes.string, countries: React.PropTypes.array, durations: React.PropTypes.array, rating: React.PropTypes.shape({ average: React.PropTypes.number, stars: React.PropTypes.string }) }).isRequired }; static defaultProps = { movie: { trailers: null } }; render() { let url = ''; if (this.props.movie.trailers.length > 0) { url = this.props.movie.trailers[0].medium; } const style = { backgroundImage: `-webkit-linear-gradient(left, rgba(0,0,0,1) 28%, rgba(20,20,20,0)), url('${url}')`, }; return ( <div className="movie-detail-spotlight" style={style}> <div className="title">{this.props.movie.title}</div> <div className="info"> <span>{this.props.movie.year}</span> <span>{this.props.movie.countries[0]}</span> <span>{this.props.movie.durations[0]}</span> </div> <div className="rating"> <RatingStars stars={this.props.movie.rating.stars} average={this.props.movie.rating.average} /> </div> </div> ); } }
Fix bug of none trailers situation.
Fix bug of none trailers situation.
JSX
mit
NJU-SAP/movie-board,NJU-SAP/movie-board
--- +++ @@ -24,8 +24,12 @@ }; render() { + let url = ''; + if (this.props.movie.trailers.length > 0) { + url = this.props.movie.trailers[0].medium; + } const style = { - backgroundImage: `-webkit-linear-gradient(left, rgba(0,0,0,1) 28%, rgba(20,20,20,0)), url('${this.props.movie.trailers[0].medium}')`, + backgroundImage: `-webkit-linear-gradient(left, rgba(0,0,0,1) 28%, rgba(20,20,20,0)), url('${url}')`, }; return ( <div className="movie-detail-spotlight" style={style}> @@ -36,7 +40,10 @@ <span>{this.props.movie.durations[0]}</span> </div> <div className="rating"> - <RatingStars stars={this.props.movie.rating.stars} average={this.props.movie.rating.average} /> + <RatingStars + stars={this.props.movie.rating.stars} + average={this.props.movie.rating.average} + /> </div> </div> );
210141822de1c46515cf84293b435ad6ac02918f
client/components/presentation/Main/GroupHeader/GroupOptionsDisplayToggle.jsx
client/components/presentation/Main/GroupHeader/GroupOptionsDisplayToggle.jsx
import React from 'react'; /** * a button that displays a dropdown menu when clicked * @function GroupOptionsDisplayToggle * @returns {object} component */ const GroupOptionsDisplayToggle = () => { $('.dropdown-button').dropdown({ constrainWidth: false }); return ( <div className="menu col s3"> <a className="dropdown-button" href="#!" data-activates="dropdown1" ><i className="fa fa-ellipsis-h" aria-hidden="true" /> </a> </div> ); }; export default GroupOptionsDisplayToggle;
import React from 'react'; import ReactTooltip from 'react-tooltip'; /** * a button that displays a dropdown menu when clicked * @function GroupOptionsDisplayToggle * @returns {object} component */ const GroupOptionsDisplayToggle = () => { $('.dropdown-button').dropdown({ constrainWidth: false }); return ( <div className="menu col s3"> <a className="dropdown-button" href="#!" data-for="group-options" data-tip="Group Options" data-activates="dropdown1" ><i className="fa fa-caret-down fa-2x" aria-hidden="true" /> </a> <ReactTooltip id="group-options" place="left" type="dark" effect="float" /> </div> ); }; export default GroupOptionsDisplayToggle;
Change menu icon and add tooltip
[fix] Change menu icon and add tooltip [Delivers #151285073]
JSX
mit
tomipaul/PostIt,tomipaul/PostIt
--- +++ @@ -1,4 +1,5 @@ import React from 'react'; +import ReactTooltip from 'react-tooltip'; /** * a button that displays a dropdown menu when clicked @@ -14,9 +15,12 @@ <a className="dropdown-button" href="#!" + data-for="group-options" + data-tip="Group Options" data-activates="dropdown1" - ><i className="fa fa-ellipsis-h" aria-hidden="true" /> + ><i className="fa fa-caret-down fa-2x" aria-hidden="true" /> </a> + <ReactTooltip id="group-options" place="left" type="dark" effect="float" /> </div> ); };
14fd4e9a5bcc5ae846c2c1c8806065f91016c59b
src/views/messages/message-rows/forum-topic-post.jsx
src/views/messages/message-rows/forum-topic-post.jsx
var classNames = require('classnames'); var FormattedMessage = require('react-intl').FormattedMessage; var React = require('react'); var SocialMessage = require('../../../components/social-message/social-message.jsx'); var ForumPostMessage = React.createClass({ type: 'ForumPostMessage', propTypes: { actorUsername: React.PropTypes.string.isRequired, topicId: React.PropTypes.number.isRequired, topicTitle: React.PropTypes.string.isRequired, datetimeCreated: React.PropTypes.string.isRequired }, render: function () { var topicLink = '/discuss/topic/' + this.props.topicId + '/unread/'; var classes = classNames( 'mod-studio-activity', this.props.className ); return ( <SocialMessage className={classes} datetime={this.props.datetimeCreated} iconSrc="/svgs/messages/forum-activity.svg" iconAlt="forum activity notification image" > <FormattedMessage id='messages.forumPostText' values={{ topicLink: <a href={topicLink}>{this.props.topicTitle}</a> }} /> </SocialMessage> ); } }); module.exports = ForumPostMessage;
var classNames = require('classnames'); var FormattedMessage = require('react-intl').FormattedMessage; var React = require('react'); var SocialMessage = require('../../../components/social-message/social-message.jsx'); var ForumPostMessage = React.createClass({ type: 'ForumPostMessage', propTypes: { actorUsername: React.PropTypes.string.isRequired, topicId: React.PropTypes.number.isRequired, topicTitle: React.PropTypes.string.isRequired, datetimeCreated: React.PropTypes.string.isRequired }, render: function () { var topicLink = '/discuss/topic/' + this.props.topicId + '/unread/'; var classes = classNames( 'mod-forum-activity', this.props.className ); return ( <SocialMessage className={classes} datetime={this.props.datetimeCreated} iconSrc="/svgs/messages/forum-activity.svg" iconAlt="forum activity notification image" > <FormattedMessage id='messages.forumPostText' values={{ topicLink: <a href={topicLink}>{this.props.topicTitle}</a> }} /> </SocialMessage> ); } }); module.exports = ForumPostMessage;
Change CSS class .mod-studio-activity to .mod-forum-activity in forum post message row
Change CSS class .mod-studio-activity to .mod-forum-activity in forum post message row
JSX
bsd-3-clause
LLK/scratch-www,LLK/scratch-www
--- +++ @@ -16,7 +16,7 @@ var topicLink = '/discuss/topic/' + this.props.topicId + '/unread/'; var classes = classNames( - 'mod-studio-activity', + 'mod-forum-activity', this.props.className ); return (
5fe51c52fa1fd1f9595f6beb7f80eae2b7084c80
app/components/Header.jsx
app/components/Header.jsx
'use strict'; import React from 'react'; import {Link} from 'react-router'; const displayName = 'octopus-library-header'; export default class Header extends React.Component { render() { return ( <header> <div className="container"> <div className="row clearfix"> <div className="column"> <h2 className="site-title"><Link to="/">Octopus Deploy Library</Link></h2> </div> </div> </div> </header> ); } } Header.displayName = displayName;
'use strict'; import React from 'react'; import {Link} from 'react-router'; const displayName = 'octopus-library-header'; export default class Header extends React.Component { render() { return ( <header> <div className="container"> <div className="row clearfix"> <div className="column"> <Link to="/"><h2 className="site-title">Octopus Deploy Library</h2></Link> </div> </div> </div> </header> ); } } Header.displayName = displayName;
Tweak home link so Octopus icon is part of the link
Tweak home link so Octopus icon is part of the link
JSX
apache-2.0
Parametric/OctopusDeployCommunityLibrary,Parametric/OctopusDeployCommunityLibrary,Parametric/OctopusDeployCommunityLibrary,red-gate/Library,alastairtree/Library,red-gate/Library,alastairtree/Library,alastairtree/Library
--- +++ @@ -12,7 +12,7 @@ <div className="container"> <div className="row clearfix"> <div className="column"> - <h2 className="site-title"><Link to="/">Octopus Deploy Library</Link></h2> + <Link to="/"><h2 className="site-title">Octopus Deploy Library</h2></Link> </div> </div> </div>
fcdd7ff09481cc9008d0f32cba9192242c71c0bc
src/app/components/app-container.jsx
src/app/components/app-container.jsx
'use strict'; import React from 'react'; import App from './app.jsx'; import InitialData from './../data/initial-data.json'; const AppContainer = React.createClass({ getInitialState () { return { monsters: null }; }, getDefaultProps () { return { initialData: InitialData }; }, handleLoadData () {}, handleSampleData () { this.setState({ monsters: this.props.initialData }); }, render () { let app; let { monsters } = this.state; if (monsters) { app = (<App monsters={monsters} />); } else { // options use sample data // load local data - <button type="button" className="btn btn-primary" onClick={this.handleLoadData}>{"Load Local Data"}</button> app = ( <div className=""> <button type="button" className="btn" onClick={this.handleSampleData}>{"Use Sample Data"}</button> </div> ); } return app; } }); export default AppContainer;
'use strict'; import React from 'react'; import App from './app.jsx'; import { connect } from 'react-redux'; import InitialData from './../data/initial-data.json'; const AppContainer = React.createClass({ //on mounting check localData and use handleSampleData () { this.props.dispatch({type: 'LOAD_DATA', monsters: InitialData}); }, render () { let { monsters } = this.props; let app; if (monsters.length > 0) { app = (<App {...this.props} />); } else { // options use sample data // load local data - <button type="button" className="btn btn-primary" onClick={this.handleLoadData}>{"Load Local Data"}</button> app = ( <div className=""> <button type="button" className="btn" onClick={this.handleSampleData}>{"Use Sample Data"}</button> </div> ); } return app; } }); //export default AppContainer; function select(state) { return state; } // Wrap the component to inject dispatch and state into it export default connect(select)(AppContainer);
Refactor to use Redux and Sample Data
Refactor to use Redux and Sample Data
JSX
mit
jkrayer/summoner,jkrayer/summoner
--- +++ @@ -2,31 +2,19 @@ import React from 'react'; import App from './app.jsx'; +import { connect } from 'react-redux'; import InitialData from './../data/initial-data.json'; const AppContainer = React.createClass({ - getInitialState () { - return { - monsters: null - }; - }, - getDefaultProps () { - return { - initialData: InitialData - }; - }, - handleLoadData () {}, + //on mounting check localData and use handleSampleData () { - this.setState({ - monsters: this.props.initialData - }); + this.props.dispatch({type: 'LOAD_DATA', monsters: InitialData}); }, render () { + let { monsters } = this.props; let app; - let { monsters } = this.state; - - if (monsters) { - app = (<App monsters={monsters} />); + if (monsters.length > 0) { + app = (<App {...this.props} />); } else { // options use sample data @@ -37,9 +25,15 @@ </div> ); } - return app; } }); -export default AppContainer; +//export default AppContainer; + +function select(state) { + return state; +} + +// Wrap the component to inject dispatch and state into it +export default connect(select)(AppContainer);
136b3f34cf976dc3b0d7035c59a39255d8f37393
client/src/components/SelectInstrument.jsx
client/src/components/SelectInstrument.jsx
import React from 'react'; const SelectInstrument = ({ handleClick, opacity }) => ( <div id="selectInstrumentRoom"> <div> <img id="instLogo" src="../../../style/InstrumentRoomLogo.png" alt="logo" /> </div> <div className={opacity('piano')}> <img id="pianoChoose" src="http://handlinpiano2.codyhandlin.com/wp-content/uploads/2016/06/grandepiano_2.png" alt="piano" onClick={handleClick.bind(null, 'piano')} /> </div> <div className={opacity('drums')}> <img id="drumsChoose" src="http://www.vancouvertop40radio.com/Images/Clip%20Art/drumset.gif" alt="drums" onClick={handleClick.bind(null, 'drums')} /> </div> </div> ); SelectInstrument.propTypes = { handleClick: React.PropTypes.func.isRequired, opacity: React.PropTypes.func }; // SelectInstrument.childContextTypes = { // muiTheme: React.PropTypes.object.isRequired, // }; export default SelectInstrument;
import React from 'react'; const SelectInstrument = ({ handleClick, opacity }) => ( <div id="selectInstrumentRoom"> <div> <img id="instLogo" src="../../../style/InstrumentRoomLogo.png" alt="logo" /> </div> <div className={opacity('piano')}> <img id="pianoChoose" src="http://handlinpiano2.codyhandlin.com/wp-content/uploads/2016/06/grandepiano_2.png" alt="piano" onClick={handleClick.bind(null, 'piano')} /> </div> <div className={opacity('drums')}> <img id="drumsChoose" src="http://www.vancouvertop40radio.com/Images/Clip%20Art/drumset.gif" alt="drums" onClick={handleClick.bind(null, 'drums')} /> </div> <div className={opacity('fry')}> <img id="fryChoose" src="http://i.stack.imgur.com/STEuc.png" alt="fry" onClick={handleClick.bind(null, 'fry')} /> </div> </div> ); SelectInstrument.propTypes = { handleClick: React.PropTypes.func.isRequired, opacity: React.PropTypes.func }; // SelectInstrument.childContextTypes = { // muiTheme: React.PropTypes.object.isRequired, // }; export default SelectInstrument;
Add fry as an instrument
Add fry as an instrument
JSX
mit
NerdDiffer/reprise,NerdDiffer/reprise,NerdDiffer/reprise
--- +++ @@ -25,6 +25,14 @@ onClick={handleClick.bind(null, 'drums')} /> </div> + <div className={opacity('fry')}> + <img + id="fryChoose" + src="http://i.stack.imgur.com/STEuc.png" + alt="fry" + onClick={handleClick.bind(null, 'fry')} + /> + </div> </div> );
3210793284d38642262363fe0d2a20564e0aa213
src/components/docs.jsx
src/components/docs.jsx
import Ecology from "ecology"; import React from "react"; import Radium from "radium"; import settings from "../spectacle-variables"; import SpectacleREADME from "!!raw!spectacle/README.markdown"; class Docs extends React.Component { getMainStyles() { return { position: "relative", zIndex: "0", margin: "0", padding: "2em 1em", width: "100%", borderTop: "0", borderRight: `1em solid ${settings.text}`, borderBottom: `1em solid ${settings.text}`, borderLeft: `1em solid ${settings.text}`, [settings.mediaQueries.medium]: { padding: "2em 5em" } }; } render() { return ( <section style={this.getMainStyles()}> <div className="Container"> <Ecology overview={SpectacleREADME} /> </div> </section> ); } } export default Radium(Docs);
import Ecology from "ecology"; import React from "react"; import Radium from "radium"; import {Grid, Cell} from "radium-grid"; import settings from "../spectacle-variables"; import SpectacleREADME from "!!raw!spectacle/README.markdown"; class Docs extends React.Component { getSectionStyles() { return { position: "relative", // display: "flex", // flex: "1", // flexWrap: "wrap", zIndex: "0", margin: "0", padding: "1em", width: "100%", borderTop: "0", borderRight: `1em solid ${settings.text}`, borderBottom: `1em solid ${settings.text}`, borderLeft: `1em solid ${settings.text}`, [settings.mediaQueries.medium]: { padding: "1em 0" } }; } getContentStyles() { return { flex: "0 0 100%", [settings.mediaQueries.large]: { // paddingLeft: "2em", flex: "1" } }; } getSidebarStyles() { return { padding: "0 1em", flex: "0 0 100%", width: "100%", order: "-1", fontSize: "16px", [settings.mediaQueries.large]: { padding: "0 0 0 2em", flex: "none", width: "25%" } }; } render() { // <nav style={this.getSidebarStyles()}> // <h1>Contents</h1> // </nav> return ( <section style={this.getSectionStyles()}> <Ecology overview={SpectacleREADME} /> </section> ); } } export default Radium(Docs);
Set up space for nav.
Set up space for nav.
JSX
mit
etsfactory/spectacle-docs-ets,etsfactory/spectacle-docs-ets,etsfactory/spectacle-docs-ets
--- +++ @@ -1,18 +1,22 @@ import Ecology from "ecology"; import React from "react"; import Radium from "radium"; +import {Grid, Cell} from "radium-grid"; import settings from "../spectacle-variables"; import SpectacleREADME from "!!raw!spectacle/README.markdown"; class Docs extends React.Component { - getMainStyles() { + getSectionStyles() { return { position: "relative", + // display: "flex", + // flex: "1", + // flexWrap: "wrap", zIndex: "0", margin: "0", - padding: "2em 1em", + padding: "1em", width: "100%", borderTop: "0", @@ -21,16 +25,43 @@ borderLeft: `1em solid ${settings.text}`, [settings.mediaQueries.medium]: { - padding: "2em 5em" + padding: "1em 0" + } + }; + } + getContentStyles() { + return { + flex: "0 0 100%", + + [settings.mediaQueries.large]: { + // paddingLeft: "2em", + flex: "1" + } + }; + } + getSidebarStyles() { + return { + padding: "0 1em", + flex: "0 0 100%", + width: "100%", + order: "-1", + + fontSize: "16px", + + [settings.mediaQueries.large]: { + padding: "0 0 0 2em", + flex: "none", + width: "25%" } }; } render() { + // <nav style={this.getSidebarStyles()}> + // <h1>Contents</h1> + // </nav> return ( - <section style={this.getMainStyles()}> - <div className="Container"> - <Ecology overview={SpectacleREADME} /> - </div> + <section style={this.getSectionStyles()}> + <Ecology overview={SpectacleREADME} /> </section> ); }
4c47726c25888d0b77133ae1ea2090801e3b7bae
src/components/templates/todo-app/todo-app.jsx
src/components/templates/todo-app/todo-app.jsx
import './todo-app.scss'; import React from 'react/addons'; import AppActions from '../../../js/actions/app-actions'; import TodoStore from '../../../js/stores/todo-store'; import Header from '../../molecules/header/header.jsx'; import TodoList from '../../organisms/todo-list/todo-list.jsx'; const TodoApp = React.createClass({ getInitialState: function() { return ({ todos: TodoStore.getAll() }); }, componentDidMount: function() { TodoStore.addChangeListener(this._onChange); // fetch the initial list of todos from the server AppActions.getTodos(); }, _onChange: function() { this.setState({ todos: TodoStore.getAll() }); }, render: function() { return ( <div className="todoApp"> <Header /> <div className="main"> <TodoList todos={this.state.todos} /> </div> </div> ); } }); export default TodoApp;
import './todo-app.scss'; import React from 'react/addons'; import AppActions from '../../../js/actions/app-actions'; import TodoStore from '../../../js/stores/todo-store'; import Header from '../../molecules/header/header.jsx'; import TodoList from '../../organisms/todo-list/todo-list.jsx'; const TodoApp = React.createClass({ getInitialState: function() { return ({ todos: TodoStore.getAll() }); }, componentDidMount: function() { TodoStore.addChangeListener(this._onChange); // fetch the initial list of todos from the server AppActions.getTodos(); }, componentWillUnmount: function() { TodoStore.removeChangeListener(this._onChange); }, _onChange: function() { this.setState({ todos: TodoStore.getAll() }); }, render: function() { return ( <div className="todoApp"> <Header /> <div className="main"> <TodoList todos={this.state.todos} /> </div> </div> ); } }); export default TodoApp;
Remove TodoApp TodoStore listener on unmount
Remove TodoApp TodoStore listener on unmount
JSX
mit
haner199401/React-Node-Project-Seed,mattpetrie/React-Node-Project-Seed,mattpetrie/React-Node-Project-Seed,haner199401/React-Node-Project-Seed
--- +++ @@ -20,6 +20,10 @@ AppActions.getTodos(); }, + componentWillUnmount: function() { + TodoStore.removeChangeListener(this._onChange); + }, + _onChange: function() { this.setState({ todos: TodoStore.getAll() }); },
b7b9c0ca71d45b18dc46974c6d10de67d42c63d8
src/scripts/components/MemberDetails.jsx
src/scripts/components/MemberDetails.jsx
'use strict'; var React = require('react'); var _ = require('lodash'); var _detailsID = 'member-details'; var MemberDetails = React.createClass({ getSelected: function() { return _.find(this.props.family.members, function(member) { return member.id === this.props.focus; }, this); }, render: function() { var selected = this.getSelected(); if (selected === undefined) { return <div id={_detailsID}><p>No member selected</p></div>; } var name = selected.name || 'No Name'; var gender; switch (selected.gender) { case 1: gender = 'male'; break; case 2: gender = 'female'; break; default: gender = 'gender unknown'; } return ( <div id={_detailsID}> <p>Selected member: {name} ({gender})</p> </div> ); } }); module.exports = MemberDetails;
'use strict'; var React = require('react'); var _ = require('lodash'); var _detailsID = 'member-details'; var MemberDetails = React.createClass({ getSelected: function() { return _.find(this.props.family.members, function(member) { return member._id === this.props.focus; }, this); }, render: function() { var selected = this.getSelected(); if (selected === undefined) { return <div id={_detailsID}><p>No member selected</p></div>; } var name = selected.name || 'No Name'; var gender; switch (selected.gender) { case 1: gender = 'male'; break; case 2: gender = 'female'; break; default: gender = 'gender unknown'; } return ( <div id={_detailsID}> <p>Selected member: {name} ({gender})</p> </div> ); } }); module.exports = MemberDetails;
Fix member details for new schema
Fix member details for new schema
JSX
mit
lumc-nested/nested-editor,lumc-nested/nested-editor
--- +++ @@ -8,7 +8,7 @@ var MemberDetails = React.createClass({ getSelected: function() { return _.find(this.props.family.members, function(member) { - return member.id === this.props.focus; + return member._id === this.props.focus; }, this); },
bbbe0f8836ecd89b5c6f791f3c122a37b3d3cdef
src/views/preview/meta.jsx
src/views/preview/meta.jsx
const React = require('react'); const Helmet = require('react-helmet').default; const projectShape = require('./projectshape.jsx').projectShape; const Meta = props => { const {id, title, instructions, author} = props.projectInfo; // Do not want to render any meta tags unless all the info is loaded // Check only author (object) because it is ok to have empty string instructions if (!author) return null; const truncatedInstructions = instructions.split(' ') .slice(0, 50) .join(' '); return ( <Helmet> <title>{`${title} on Scratch`}</title> <meta content={`${title} on Scratch by ${author.username}`} name="description" /> <meta content={`Scratch - ${title}`} property="og:title" /> <meta content={truncatedInstructions} property="og:description" /> <link rel="canonical" href={`https://scratch.mit.edu/projects/${id}`} /> </Helmet> ); }; Meta.propTypes = { projectInfo: projectShape }; module.exports = Meta;
const React = require('react'); const Helmet = require('react-helmet').default; const projectShape = require('./projectshape.jsx').projectShape; const Meta = props => { const {id, title, instructions, author} = props.projectInfo; // Do not want to render any meta tags unless all the info is loaded // Check only author (object) because it is ok to have empty string instructions if (!author) return null; const truncatedInstructions = instructions.split(' ') .slice(0, 50) .join(' '); return ( <Helmet> <title>{`${title} on Scratch`}</title> <meta content={`${title} on Scratch by ${author.username}`} name="description" /> <meta content={`Scratch - ${title}`} property="og:title" /> <meta content={truncatedInstructions} property="og:description" /> <link href={`https://scratch.mit.edu/projects/${id}`} rel="canonical" /> </Helmet> ); }; Meta.propTypes = { projectInfo: projectShape }; module.exports = Meta;
Fix linter issues with prop ordering
Fix linter issues with prop ordering
JSX
bsd-3-clause
LLK/scratch-www,LLK/scratch-www
--- +++ @@ -30,8 +30,8 @@ property="og:description" /> <link + href={`https://scratch.mit.edu/projects/${id}`} rel="canonical" - href={`https://scratch.mit.edu/projects/${id}`} /> </Helmet> );
8183b5822b600f0c93bfb75486e9635f6838b2aa
ui/component/publishText/view.jsx
ui/component/publishText/view.jsx
// @flow import React from 'react'; import { FormField } from 'component/common/form'; import Button from 'component/button'; import usePersistedState from 'effects/use-persisted-state'; import Card from 'component/common/card'; type Props = { title: ?string, description: ?string, disabled: boolean, updatePublishForm: ({}) => void, }; function PublishText(props: Props) { const { title, description, updatePublishForm, disabled } = props; const [advancedEditor, setAdvancedEditor] = usePersistedState('publish-form-description-mode', false); function toggleMarkdown() { setAdvancedEditor(!advancedEditor); } return ( <Card actions={ <React.Fragment> <FormField type="text" name="content_title" label={__('Title')} placeholder={__('Titular Title')} disabled={disabled} value={title} onChange={e => updatePublishForm({ title: e.target.value })} /> <FormField type={advancedEditor ? 'markdown' : 'textarea'} name="content_description" label={__('Description')} placeholder={__('My description for this and that')} value={description} disabled={disabled} onChange={value => updatePublishForm({ description: advancedEditor ? value : value.target.value })} /> <div className="card__actions"> <Button button="link" onClick={toggleMarkdown} label={advancedEditor ? __('Simple Editor') : __('Advanced Editor')} /> </div> </React.Fragment> } /> ); } export default PublishText;
// @flow import React from 'react'; import { FormField } from 'component/common/form'; import usePersistedState from 'effects/use-persisted-state'; import Card from 'component/common/card'; type Props = { title: ?string, description: ?string, disabled: boolean, updatePublishForm: ({}) => void, }; function PublishText(props: Props) { const { title, description, updatePublishForm, disabled } = props; const [advancedEditor, setAdvancedEditor] = usePersistedState('publish-form-description-mode', false); function toggleMarkdown() { setAdvancedEditor(!advancedEditor); } return ( <Card actions={ <React.Fragment> <FormField type="text" name="content_title" label={__('Title')} placeholder={__('Titular Title')} disabled={disabled} value={title} onChange={e => updatePublishForm({ title: e.target.value })} /> <FormField type={advancedEditor ? 'markdown' : 'textarea'} name="content_description" label={__('Description')} placeholder={__('My description for this and that')} value={description} disabled={disabled} onChange={value => updatePublishForm({ description: advancedEditor ? value : value.target.value })} quickActionLabel={advancedEditor ? __('Simple Editor') : __('Advanced Editor')} quickActionHandler={toggleMarkdown} /> </React.Fragment> } /> ); } export default PublishText;
Update markdown-toggle style in Publish to the new quick-action style for consistency with Comments.
Update markdown-toggle style in Publish to the new quick-action style for consistency with Comments.
JSX
mit
lbryio/lbry-app,lbryio/lbry-electron,lbryio/lbry-electron,lbryio/lbry-electron,lbryio/lbry-app
--- +++ @@ -1,7 +1,6 @@ // @flow import React from 'react'; import { FormField } from 'component/common/form'; -import Button from 'component/button'; import usePersistedState from 'effects/use-persisted-state'; import Card from 'component/common/card'; @@ -41,14 +40,9 @@ value={description} disabled={disabled} onChange={value => updatePublishForm({ description: advancedEditor ? value : value.target.value })} + quickActionLabel={advancedEditor ? __('Simple Editor') : __('Advanced Editor')} + quickActionHandler={toggleMarkdown} /> - <div className="card__actions"> - <Button - button="link" - onClick={toggleMarkdown} - label={advancedEditor ? __('Simple Editor') : __('Advanced Editor')} - /> - </div> </React.Fragment> } />
629929a805c34aa3f5ada8009012b1c8bed46003
client/modules/core/components/poll_list.jsx
client/modules/core/components/poll_list.jsx
import React, { PropTypes } from 'react'; import Poll from '../containers/poll.js'; const PollList = ({polls}) => ( <ul> {polls.map((poll) => { return ( <Poll key={poll._id} poll={poll} /> ); })} </ul> ); PollList.propTypes = { polls: PropTypes.array }; export default PollList;
import React, { PropTypes } from 'react'; import Poll from '../containers/poll.js'; const PollList = ({polls}) => ( <ul style={{paddingLeft: 0}}> {polls.map((poll) => { return ( <Poll key={poll._id} poll={poll} /> ); })} </ul> ); PollList.propTypes = { polls: PropTypes.array }; export default PollList;
Fix styling issue with PollList
Fix styling issue with PollList
JSX
mit
thancock20/voting-app,thancock20/voting-app
--- +++ @@ -2,7 +2,7 @@ import Poll from '../containers/poll.js'; const PollList = ({polls}) => ( - <ul> + <ul style={{paddingLeft: 0}}> {polls.map((poll) => { return ( <Poll
f1dcd0542cead90a9985ece1a50b86d943eb7b48
components/dashboards-web-component/src/auth/Logout.jsx
components/dashboards-web-component/src/auth/Logout.jsx
/* * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ import React, { Component } from 'react'; import { Redirect } from 'react-router-dom'; import AuthManager from './utils/AuthManager'; /** * Logout. */ export default class Logout extends Component { /** * Renders logout component. * * @returns {XML} HTML content */ render() { AuthManager.logout(); return ( <Redirect to={{ pathname: '/login' }} /> ); } }
/* * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ import React, { Component } from 'react'; import { Redirect } from 'react-router-dom'; import DashboardThumbnail from '../utils/DashboardThumbnail'; import AuthManager from './utils/AuthManager'; /** * Logout. */ export default class Logout extends Component { /** * Renders logout component. * @returns {XML} HTML content */ render() { DashboardThumbnail.deleteDashboardThumbnails(); AuthManager.logout(); return ( <Redirect to={{ pathname: '/login' }} /> ); } }
Delete saved dashboard thumbnails on logout.
Delete saved dashboard thumbnails on logout.
JSX
apache-2.0
dilini-muthumala/carbon-dashboards,wso2/carbon-dashboards,ksdperera/carbon-dashboards,lasanthaS/carbon-dashboards,dilini-muthumala/carbon-dashboards,lasanthaS/carbon-dashboards,ksdperera/carbon-dashboards,dilini-muthumala/carbon-dashboards,ksdperera/carbon-dashboards,lasanthaS/carbon-dashboards,wso2/carbon-dashboards
--- +++ @@ -20,6 +20,7 @@ import React, { Component } from 'react'; import { Redirect } from 'react-router-dom'; +import DashboardThumbnail from '../utils/DashboardThumbnail'; import AuthManager from './utils/AuthManager'; /** @@ -28,10 +29,10 @@ export default class Logout extends Component { /** * Renders logout component. - * * @returns {XML} HTML content */ render() { + DashboardThumbnail.deleteDashboardThumbnails(); AuthManager.logout(); return ( <Redirect to={{ pathname: '/login' }} />
94a6952e89d186051299c991128eb5ab378777fd
src/fieldContainer.jsx
src/fieldContainer.jsx
import _ from "lodash"; import React, { Component } from "react"; export default (ComposedComponent) => { return class FieldContainer extends Component { static defaultProps = { defaultValue: null, isFormInput: true } componentDidMount() { this.onChange(this.props.defaultValue); } getValues(data) { if (typeof data === "object" && data !== null) { return _.mapValues(data, (field) => { if (field.data) { return this.getValues(field.data); } else { return field; } }); } else { return data; } } onChange(data) { let values = this.getValues(data); this.setState({ data: data, value: values }, () => { if (this.props.onChange) this.props.onChange(this.props.name, this.state); }); } reset() { this.refs.field.setValue(this.props.defaultValue); } focus() { this.refs.field.focus(); } render() { const { onChange, ...props } = this.props; return ( <ComposedComponent ref="field" onChange={this.onChange.bind(this)} {...props} /> ); } } };
import _ from "lodash"; import React, { Component } from "react"; export default (ComposedComponent) => { return class FieldContainer extends Component { static defaultProps = { defaultValue: null, isFormInput: true } componentDidMount() { this.onChange(this.props.defaultValue); } getValues(data) { if (typeof data === "object" && data !== null) { return _.mapValues(data, (field) => { if (typeof field.data !== "undefined") { return this.getValues(field.data); } else { return field; } }); } else { return data; } } onChange(data) { let values = this.getValues(data); this.setState({ data: data, value: values }, () => { if (this.props.onChange) this.props.onChange(this.props.name, this.state); }); } reset() { this.refs.field.setValue(this.props.defaultValue); } focus() { this.refs.field.focus(); } render() { const { onChange, ...props } = this.props; return ( <ComposedComponent ref="field" onChange={this.onChange.bind(this)} {...props} /> ); } } };
Check if field.data is undefined rather than falsy
Check if field.data is undefined rather than falsy We don't mind if field.data is null (which it will be on component mount unless a different default value is provided). If field.data is null we want that to go into the values tree as null rather than returning the entire data object which it was doing previously.
JSX
mit
mwillmott/morph-forms
--- +++ @@ -15,7 +15,7 @@ getValues(data) { if (typeof data === "object" && data !== null) { return _.mapValues(data, (field) => { - if (field.data) { + if (typeof field.data !== "undefined") { return this.getValues(field.data); } else { return field;
cde811f4c5e14edcbf3396c95c2fb5b164c6f2b4
app/assets/javascripts/components/mission.js.jsx
app/assets/javascripts/components/mission.js.jsx
class Mission extends React.Component { render() { return( <div className="row"> <div className="col-sm-1 col-md-3"></div> <div className="col-sm-10 col-md-6"> <div className="panel panel-default"> <div className="panel-heading"> <h3 className="panel-title"> Our Mission </h3> </div> <div className="panel-body"> <p className="mission-body">Less than 5% of cancer patients participate in clinical trials despite having a participant satisfaction rate of more than 90%. Not enough patients (and doctors) know what trials are available to them. Patients need more options. Researchers need more participants. CRConnect connect these two groups by making information on clinical trials more available to the people who can be helped by them.</p> </div> </div> </div> <div className="col-sm-1 col-md-3"></div> </div> ) } }
class Mission extends React.Component { render() { return( <div className="row"> <div className="col-sm-1"></div> <div className="col-sm-10"> <div className="panel panel-default"> <div className="panel-heading"> <h3 className="panel-title"> Our Mission </h3> </div> <div className="panel-body"> <p className="mission-body">Less than 5% of cancer patients participate in clinical trials despite having a participant satisfaction rate of more than 90%. Not enough patients (and doctors) know what trials are available to them. Patients need more options. Researchers need more participants. CRConnect connect these two groups by making information on clinical trials more available to the people who can be helped by them.</p> </div> </div> </div> <div className="col-sm-1"></div> </div> ) } }
Fix width of Mission component to standard
Fix width of Mission component to standard
JSX
mit
danmckeon/crconnect,danmckeon/crconnect,danmckeon/crconnect
--- +++ @@ -2,8 +2,8 @@ render() { return( <div className="row"> - <div className="col-sm-1 col-md-3"></div> - <div className="col-sm-10 col-md-6"> + <div className="col-sm-1"></div> + <div className="col-sm-10"> <div className="panel panel-default"> <div className="panel-heading"> <h3 className="panel-title"> @@ -15,7 +15,7 @@ </div> </div> </div> - <div className="col-sm-1 col-md-3"></div> + <div className="col-sm-1"></div> </div> ) }
bd870a2ce12f4e577ef01698a65967a03cad40b7
src/client/public/components/home/Home.jsx
src/client/public/components/home/Home.jsx
var React = require('react'); var Flux = require('react-flux'); var Router = require('react-router'); var {Route, RouteHandler, Link } = Router; var Home = React.createClass({ render: function () { return ( <div> <h3>Welcome home!</h3> <RouteHandler/> </div> ); } }); module.exports = Home;
var React = require('react'); var Flux = require('react-flux'); var Router = require('react-router'); var Bootstrap = require('react-bootstrap'); var {Route, RouteHandler, Link } = Router; var {Navbar, Nav, NavItem, DropdownButton, MenuItem} = Bootstrap; var Home = React.createClass({ mixins: [ Router.Navigation ], navigateHome: function (event) { event.preventDefault(); this.transitionTo('/home'); }, navigateAccounts: function (event) { event.preventDefault(); this.transitionTo('/accounts'); }, render: function () { return ( <div> <Navbar> <Nav> <NavItem eventKey={1} href="/home" onClick={this.navigateHome}>Home</NavItem> <NavItem eventKey={2} href="/accounts" onClick={this.navigateAccounts}>Accounts</NavItem> <DropdownButton eventKey={3} title="Dropdown"> <MenuItem eventKey="1">Action</MenuItem> <MenuItem eventKey="2">Another action</MenuItem> <MenuItem eventKey="3">Something else here</MenuItem> <MenuItem divider /> <MenuItem eventKey="4">Separated link</MenuItem> </DropdownButton> </Nav> </Navbar> <RouteHandler/> </div> ); } }); module.exports = Home;
Add a simple bootstrap navbar and event handlers to main home view
Add a simple bootstrap navbar and event handlers to main home view
JSX
apache-2.0
andrewfhart/coinbox,andrewfhart/coinbox
--- +++ @@ -1,14 +1,44 @@ var React = require('react'); var Flux = require('react-flux'); var Router = require('react-router'); +var Bootstrap = require('react-bootstrap'); + var {Route, RouteHandler, Link } = Router; +var {Navbar, Nav, NavItem, DropdownButton, MenuItem} = Bootstrap; var Home = React.createClass({ + + mixins: [ + Router.Navigation + ], + + navigateHome: function (event) { + event.preventDefault(); + this.transitionTo('/home'); + }, + + navigateAccounts: function (event) { + event.preventDefault(); + this.transitionTo('/accounts'); + }, + render: function () { return ( <div> - <h3>Welcome home!</h3> + <Navbar> + <Nav> + <NavItem eventKey={1} href="/home" onClick={this.navigateHome}>Home</NavItem> + <NavItem eventKey={2} href="/accounts" onClick={this.navigateAccounts}>Accounts</NavItem> + <DropdownButton eventKey={3} title="Dropdown"> + <MenuItem eventKey="1">Action</MenuItem> + <MenuItem eventKey="2">Another action</MenuItem> + <MenuItem eventKey="3">Something else here</MenuItem> + <MenuItem divider /> + <MenuItem eventKey="4">Separated link</MenuItem> + </DropdownButton> + </Nav> + </Navbar> <RouteHandler/> </div> );
7854b4df2d04f405b12c61f7fd1761786f0c0100
src/components/Home.jsx
src/components/Home.jsx
'use strict'; import React, { Component } from 'react'; export default class Home extends Component { render() { return ( <main className='card card--about' role='main'> <h1 className='text-center'>Welcome</h1> <p>My name is Erick Mock, and I'm a web developer and designer. I have a certificate in advanced software development in full stack JavaScript along with a degree in psychology. I enjoy working with design software and web technologies to develop components that enhance the user experience and accessibility of creative platforms and interfaces.</p> <ul className='social'> <li className='social__link'><a href='https://github.com/kcirekcom' target='_blank' className='icon-github'/></li> <li className='social__link'><a href='https://www.linkedin.com/in/erick-mock' target='_blank' className='icon-linkedin'/></li> <li className='social__link'><a href='mailto:erick.f.mock@gmail.com?Subject=Collaboration' className='icon-envelop'/></li> </ul> </main> ) } }
'use strict'; import React, { Component } from 'react'; export default class Home extends Component { render() { return ( <main className='card card--about' role='main'> <h1 className='text-center'>Welcome</h1> <p>I'm a web developer and designer. I have a certificate in advanced software development in full stack JavaScript along with a degree in psychology. I enjoy working with design software and web technologies to develop components that enhance the user experience and accessibility of platforms and interfaces. I’m always eager to push better products forward that simplify and improve the day-to-day processes for all users.</p> <ul className='social'> {/* <li className='social__link'><a href='https://github.com/kcirekcom' target='_blank' className='icon-github'/></li> */} <li className='social__link'><a href='https://www.linkedin.com/in/erick-mock' target='_blank' className='icon-linkedin'/></li> <li className='social__link'><a href='mailto:erick.f.mock@gmail.com?Subject=Collaboration' className='icon-envelop'/></li> </ul> </main> ) } }
Refresh content on home page and then comment out github link since not as active on it (for now)
Refresh content on home page and then comment out github link since not as active on it (for now)
JSX
mit
kcirekcom/portfolio,kcirekcom/portfolio
--- +++ @@ -8,10 +8,10 @@ <main className='card card--about' role='main'> <h1 className='text-center'>Welcome</h1> - <p>My name is Erick Mock, and I'm a web developer and designer. I have a certificate in advanced software development in full stack JavaScript along with a degree in psychology. I enjoy working with design software and web technologies to develop components that enhance the user experience and accessibility of creative platforms and interfaces.</p> + <p>I'm a web developer and designer. I have a certificate in advanced software development in full stack JavaScript along with a degree in psychology. I enjoy working with design software and web technologies to develop components that enhance the user experience and accessibility of platforms and interfaces. I’m always eager to push better products forward that simplify and improve the day-to-day processes for all users.</p> <ul className='social'> - <li className='social__link'><a href='https://github.com/kcirekcom' target='_blank' className='icon-github'/></li> + {/* <li className='social__link'><a href='https://github.com/kcirekcom' target='_blank' className='icon-github'/></li> */} <li className='social__link'><a href='https://www.linkedin.com/in/erick-mock' target='_blank' className='icon-linkedin'/></li> <li className='social__link'><a href='mailto:erick.f.mock@gmail.com?Subject=Collaboration' className='icon-envelop'/></li> </ul>
a9ba27ef97f0e5610e27f1975f2f27133d3770b6
src/views/jobs/jobs.jsx
src/views/jobs/jobs.jsx
var React = require('react'); var render = require('../../lib/render.jsx'); var FormattedMessage = require('react-intl').FormattedMessage; var Page = require('../../components/page/www/page.jsx'); require('./jobs.scss'); var Jobs = React.createClass({ type: 'Jobs', render: function () { return ( <div className="jobs"> <div className="top"> <div className="inner"> <img src="/images/jobs.png" /> <h2><FormattedMessage id='jobs.titleQuestion' /></h2> </div> </div> <div className="middle"> <div className="inner"> <h3><FormattedMessage id='jobs.joinScratchTeam' /></h3> <p><FormattedMessage id='jobs.info' /></p> <p><FormattedMessage id='jobs.workEnvironment' /></p> </div> </div> <div className="bottom"> <div className="inner"> <h3><FormattedMessage id='jobs.openings' /></h3> <ul> <li> <a href="/jobs/moderator"> Community Moderator </a> <span> MIT Media Lab, Cambridge, MA (or Remote) </span> </li> </ul> </div> </div> </div> ); } }); render(<Page><Jobs /></Page>, document.getElementById('app'));
var React = require('react'); var render = require('../../lib/render.jsx'); var FormattedMessage = require('react-intl').FormattedMessage; var Page = require('../../components/page/www/page.jsx'); require('./jobs.scss'); var Jobs = React.createClass({ type: 'Jobs', render: function () { return ( <div className="jobs"> <div className="top"> <div className="inner"> <img src="/images/jobs.png" /> <h2><FormattedMessage id='jobs.titleQuestion' /></h2> </div> </div> <div className="middle"> <div className="inner"> <h3><FormattedMessage id='jobs.joinScratchTeam' /></h3> <p><FormattedMessage id='jobs.info' /></p> <p><FormattedMessage id='jobs.workEnvironment' /></p> </div> </div> <div className="bottom"> <div className="inner"> <h3><FormattedMessage id='jobs.openings' /></h3> <ul> <li> <a href="/jobs/moderator"> Community Moderator </a> <span> MIT Media Lab, Cambridge, MA (or Remote) </span> </li> <li> <a href="https://www.media.mit.edu/about/job-opportunities/junior-web-designer-scratch/"> Junior Designer </a> <span> MIT Media Lab, Cambridge, MA </span> </li> </ul> </div> </div> </div> ); } }); render(<Page><Jobs /></Page>, document.getElementById('app'));
Fix gh-1404: Add Junior Designer
Fix gh-1404: Add Junior Designer
JSX
bsd-3-clause
LLK/scratch-www,LLK/scratch-www
--- +++ @@ -38,6 +38,14 @@ MIT Media Lab, Cambridge, MA (or Remote) </span> </li> + <li> + <a href="https://www.media.mit.edu/about/job-opportunities/junior-web-designer-scratch/"> + Junior Designer + </a> + <span> + MIT Media Lab, Cambridge, MA + </span> + </li> </ul> </div> </div>
b795db2afbdc9c6bca2a4e96c03444f12d76a304
app/javascript/app/components/footer/footer-component.jsx
app/javascript/app/components/footer/footer-component.jsx
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import BottomBar from 'components/footer/bottom-bar'; import Contact from 'components/contact'; import layout from 'styles/layout.scss'; import styles from './footer-styles.scss'; class Footer extends PureComponent { // eslint-disable-line react/prefer-stateless-function render() { const { partners } = this.props; const className = cx(styles.footer, styles.border); return ( <footer className={className}> <div className={cx(layout.content, styles.nav)}> <div className={styles.partnersContainer}> {partners.map( partner => partner.img && ( <div key={partner.img.alt} className={styles.logoContainer}> <a className={ styles[partner.img.customClass] || styles.defaultLogo } href={partner.link} target="_blank" rel="noopener noreferrer" > <img src={partner.img.src} alt={partner.img.alt} /> </a> </div> ) )} </div> <Contact /> </div> <BottomBar className={layout.content} /> </footer> ); } } Footer.propTypes = { partners: PropTypes.array.isRequired }; export default Footer;
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import BottomBar from 'components/footer/bottom-bar'; import Contact from 'components/contact'; import layout from 'styles/layout.scss'; import styles from './footer-styles.scss'; class Footer extends PureComponent { // eslint-disable-line react/prefer-stateless-function render() { const { partners, location } = this.props; const className = cx(styles.footer, styles.border); return ( <footer className={className}> {!location.pathname.includes('/about') && ( <div className={cx(layout.content, styles.nav)}> <div className={styles.partnersContainer}> {partners.map( partner => partner.img && ( <div key={partner.img.alt} className={styles.logoContainer}> <a className={ styles[partner.img.customClass] || styles.defaultLogo } href={partner.link} target="_blank" rel="noopener noreferrer" > <img src={partner.img.src} alt={partner.img.alt} /> </a> </div> ) )} </div> <Contact /> </div> )} <BottomBar className={layout.content} /> </footer> ); } } Footer.propTypes = { partners: PropTypes.array.isRequired, location: PropTypes.object }; export default Footer;
Hide logos on about page
Hide logos on about page
JSX
mit
Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch
--- +++ @@ -11,32 +11,34 @@ class Footer extends PureComponent { // eslint-disable-line react/prefer-stateless-function render() { - const { partners } = this.props; + const { partners, location } = this.props; const className = cx(styles.footer, styles.border); return ( <footer className={className}> - <div className={cx(layout.content, styles.nav)}> - <div className={styles.partnersContainer}> - {partners.map( - partner => - partner.img && ( - <div key={partner.img.alt} className={styles.logoContainer}> - <a - className={ - styles[partner.img.customClass] || styles.defaultLogo - } - href={partner.link} - target="_blank" - rel="noopener noreferrer" - > - <img src={partner.img.src} alt={partner.img.alt} /> - </a> - </div> - ) - )} + {!location.pathname.includes('/about') && ( + <div className={cx(layout.content, styles.nav)}> + <div className={styles.partnersContainer}> + {partners.map( + partner => + partner.img && ( + <div key={partner.img.alt} className={styles.logoContainer}> + <a + className={ + styles[partner.img.customClass] || styles.defaultLogo + } + href={partner.link} + target="_blank" + rel="noopener noreferrer" + > + <img src={partner.img.src} alt={partner.img.alt} /> + </a> + </div> + ) + )} + </div> + <Contact /> </div> - <Contact /> - </div> + )} <BottomBar className={layout.content} /> </footer> ); @@ -44,7 +46,8 @@ } Footer.propTypes = { - partners: PropTypes.array.isRequired + partners: PropTypes.array.isRequired, + location: PropTypes.object }; export default Footer;
6c2c004109353275b3a262933295212a69a04a35
static/js/src/User.jsx
static/js/src/User.jsx
var React = require('react'); var util = require('./util'); var User = React.createClass({ handleClick: function(e){ if (this.props.onClick) { this.props.onClick.call(this, e, this.props.user); } }, handleConnectedClick: function(e){ if (this.props.handleConnectedClick) { this.props.handleConnectedClick.call(this, e, this.props.user); } }, render: function() { var user = this.props.user; var extras = ''; if (this.props.showConnected) { var blockedText = ' | ' + (this.props.blocked ? 'Unblock' : 'Block'); extras = ( <span>, connected at {util.convertFromEpoch(user.connected)} <span onClick={this.handleConnectedClick}>{blockedText}</span></span> ); } return (<li onClick={this.handleClick}>{user.name}{extras}</li>); } }); module.exports = User;
var React = require('react'); var util = require('./util'); var User = React.createClass({ handleClick: function(e){ if (this.props.onClick) { this.props.onClick.call(this, e, this.props.user); } }, handleConnectedClick: function(e){ if (this.props.handleConnectedClick) { this.props.handleConnectedClick.call(this, e, this.props.user); } }, render: function() { var user = this.props.user; var blocked = this.props.blocked; var extras = ''; var userClass = 'user'; if (this.props.showConnected) { var blockedText = ' | ' + (blocked ? 'Unblock' : 'Block'); extras = ( <span>, connected at {util.convertFromEpoch(user.connected)} <span onClick={this.handleConnectedClick}>{blockedText}</span></span> ); } if (blocked) { userClass += ' blocked'; } return (<li className={userClass} onClick={this.handleClick}>{user.name}{extras}</li>); } }); module.exports = User;
Add blocked class to user
Add blocked class to user
JSX
mit
ebenpack/chatblast,ebenpack/chatblast,ebenpack/chatblast
--- +++ @@ -14,14 +14,18 @@ }, render: function() { var user = this.props.user; + var blocked = this.props.blocked; var extras = ''; + var userClass = 'user'; if (this.props.showConnected) { - var blockedText = ' | ' + (this.props.blocked ? 'Unblock' : 'Block'); + var blockedText = ' | ' + (blocked ? 'Unblock' : 'Block'); extras = ( <span>, connected at {util.convertFromEpoch(user.connected)} <span onClick={this.handleConnectedClick}>{blockedText}</span></span> ); + } if (blocked) { + userClass += ' blocked'; } - return (<li onClick={this.handleClick}>{user.name}{extras}</li>); + return (<li className={userClass} onClick={this.handleClick}>{user.name}{extras}</li>); } });
36a09a3b928b8ac1c506a98ca70a154dc56f96cb
app/javascript/packs/agendum/agendum_list.jsx
app/javascript/packs/agendum/agendum_list.jsx
import React from 'react'; // Controls import Agendum from './agendum'; // Utils import _ from 'lodash'; /* * Create a list of Agendum. */ const AgendumList = (props) => { return( <div className="row"> { props.agenda.map((agendum, key) => { return( <div className="col m4" key={key}> <Agendum agendum={agendum} meetingID={props.meetingID} handleAgendumAddRemove={props.handleAgendumAddRemove} /> </div> ); }) } {/* Add new Agendum item */} <div className="col m4"> <Agendum meetingID={props.meetingID} handleAgendumAddRemove={props.handleAgendumAddRemove} /> </div> </div> ); } export default AgendumList;
import React from 'react'; // Controls import Agendum from './agendum'; // Utils import _ from 'lodash'; /* * Create a list of Agendum. */ const AgendumList = (props) => { return( <div className="row"> { props.agenda.map((agendum) => { return( <div className="col m4" key={agendum.id}> <Agendum agendum={agendum} meetingID={props.meetingID} handleAgendumAddRemove={props.handleAgendumAddRemove} /> </div> ); }) } {/* Add new Agendum item */} <div className="col m4"> <Agendum meetingID={props.meetingID} handleAgendumAddRemove={props.handleAgendumAddRemove} /> </div> </div> ); } export default AgendumList;
Fix agendums not deleting correctly.
Fix agendums not deleting correctly.
JSX
mit
robyparr/adjourn,robyparr/adjourn,robyparr/adjourn
--- +++ @@ -13,9 +13,9 @@ return( <div className="row"> { - props.agenda.map((agendum, key) => { + props.agenda.map((agendum) => { return( - <div className="col m4" key={key}> + <div className="col m4" key={agendum.id}> <Agendum agendum={agendum} meetingID={props.meetingID} handleAgendumAddRemove={props.handleAgendumAddRemove} />
07323eb5e36df0987afa0772d2df499fefc008ee
src/client/components/Dropdown/Dropdown.jsx
src/client/components/Dropdown/Dropdown.jsx
import React, { Component } from 'react'; import uuid from "uuid"; import classNames from "classnames"; export default class Dropdown extends Component { constructor(props) { super(props); this.updateScroller = this.updateScroller.bind(this); } componentDidMount() { this.updateScroller(this.props.scrollOpts) } componentWillUnmount() { this.updateScroller({ destroy: true }) } componentDidUpdate(prevProps, prevState) { this.updateScroller() } updateScroller( opts={} ) { $(this.refs.dropdown).nanoScroller(opts); } render () { const {items, className, handleClick} = this.props; const classes = classNames(className, "nano"); return ( <div ref="dropdown" className={classes}> <div className="dropdown nano-content" onClick={handleClick}> {items.map( item => <span key={uuid.v4()} className="item"> {item} </span> )} </div> </div> ) } } Dropdown.defaultProps = { scrollOpts: {}, items: [] }
import React, { Component } from 'react'; import uuid from "uuid"; import classNames from "classnames"; export default class Dropdown extends Component { constructor(props) { super(props); this.updateScroller = this.updateScroller.bind(this); } componentDidMount() { this.updateScroller(this.props.scrollOpts) } componentWillUnmount() { this.updateScroller({ destroy: true }) } componentDidUpdate(prevProps, prevState) { this.updateScroller() } updateScroller( opts={} ) { $(this.refs.dropdown).nanoScroller(opts); } render () { const {items, className, onClick} = this.props; const classes = classNames(className, "nano"); return ( <div ref="dropdown" className={classes}> <div className="dropdown nano-content" onClick={onClick}> {items.map( item => <span key={uuid.v4()} className="item"> {item} </span> )} </div> </div> ) } } Dropdown.defaultProps = { scrollOpts: {sliderMinHeight: 50}, items: [] }
Rename click handler, add default scroll opts
Rename click handler, add default scroll opts
JSX
mit
AdamSalma/Lurka,AdamSalma/Lurka
--- +++ @@ -25,12 +25,12 @@ } render () { - const {items, className, handleClick} = this.props; + const {items, className, onClick} = this.props; const classes = classNames(className, "nano"); return ( <div ref="dropdown" className={classes}> - <div className="dropdown nano-content" onClick={handleClick}> + <div className="dropdown nano-content" onClick={onClick}> {items.map( item => <span key={uuid.v4()} className="item"> {item} @@ -43,6 +43,6 @@ } Dropdown.defaultProps = { - scrollOpts: {}, + scrollOpts: {sliderMinHeight: 50}, items: [] }
3506ee326066a519f7a01d2dfbf508495b230dbd
src/pages/MemeViewer.jsx
src/pages/MemeViewer.jsx
import React from "react"; import { Link } from "react-router"; import Board from "../components/Board"; import Thread from "../components/Thread"; export default class MemeViewer extends React.Component { constructor() { super() } render() { return ( <div className="MemeViewer"> <Board/> <Thread/> </div> ) } }
import React from "react"; import Board from "../components/Board"; import Thread from "../components/Thread"; export default class MemeViewer extends React.Component { constructor(props) { super(props); this.requestBoard.bind(this); this.onThreadRequest.bind(this); this.state = { provider: "4chan", threads: {}, thread: {}, board: "g" } } render() { const { provider, thread, threads } = this.state; return ( <div className={provider}> <button onClick={this.requestBoard.bind(null, "g")}> </button> <Board threads={ threads } onThreadRequest={this.onThreadRequest}/> <Thread thread={ thread }/> </div> ) } requestBoard( boardID ) { const { provider } = this.props; axios.get(`/${provider}/${boardID}`).then( board => { console.log("Board success!"); console.log(board); this.setState({ boardID: boardID, threads: board.data }); }).catch( err => console.error(err) ); } onThreadRequest( threadID ) { const { provider, boardID } = this.state; axios.get(`/${provider}/${boardID}/${threadID}`).then( thread => { console.log("Thread success!"); console.log(thread); }).catch( err => console.error(err) ); } }
Add http to viewer page
Add http to viewer page
JSX
mit
AdamSalma/Lurka,AdamSalma/Lurka
--- +++ @@ -1,20 +1,53 @@ import React from "react"; -import { Link } from "react-router"; import Board from "../components/Board"; import Thread from "../components/Thread"; export default class MemeViewer extends React.Component { - constructor() { - super() + constructor(props) { + super(props); + + this.requestBoard.bind(this); + this.onThreadRequest.bind(this); + + this.state = { + provider: "4chan", + threads: {}, + thread: {}, + board: "g" + } } render() { + const { provider, thread, threads } = this.state; return ( - <div className="MemeViewer"> - <Board/> - <Thread/> + <div className={provider}> + <button onClick={this.requestBoard.bind(null, "g")}> + + </button> + <Board threads={ threads } onThreadRequest={this.onThreadRequest}/> + <Thread thread={ thread }/> </div> ) } + + requestBoard( boardID ) { + const { provider } = this.props; + axios.get(`/${provider}/${boardID}`).then( board => { + console.log("Board success!"); + console.log(board); + this.setState({ + boardID: boardID, + threads: board.data + }); + }).catch( err => console.error(err) ); + } + + onThreadRequest( threadID ) { + const { provider, boardID } = this.state; + axios.get(`/${provider}/${boardID}/${threadID}`).then( thread => { + console.log("Thread success!"); + console.log(thread); + }).catch( err => console.error(err) ); + } }
0aa968e87a4b4b9c99e7716f1a3576729cd8e6ea
src/components/app.jsx
src/components/app.jsx
import React from 'react'; import {connect} from 'react-redux'; import css from './app.styl'; export class App extends React.Component { static propTypes = { files: React.PropTypes.object } render() { return ( <div className="app"> <h1>Refractor</h1> <div className={css.sideBySide}> <div className={css.sideA}> <h2>A</h2> <img src={this.props.files.original} /> <button>Better</button> </div> <div className={css.sideB}> <h2>B</h2> <img src={this.props.files.original} /> <button>Better</button> </div> </div> </div> ); } } export default connect((state) => state)(App);
import React from 'react'; import {connect} from 'react-redux'; import css from './app.styl'; class App extends React.Component { static propTypes = { files: React.PropTypes.object } render() { return ( <div className="app"> <h1>Refractor</h1> <div className={css.sideBySide}> <div className={css.sideA}> <h2>A</h2> <img src={this.props.files.original} /> <button>Better</button> </div> <div className={css.sideB}> <h2>B</h2> <img src={this.props.files.original} /> <button>Better</button> </div> </div> </div> ); } } // Hack around https://github.com/babel/babel/issues/2868 export {App}; export default connect((state) => state)(App);
Fix babel 6 export issue
Fix babel 6 export issue
JSX
mit
kpdecker/refractor,kpdecker/refractor
--- +++ @@ -3,7 +3,7 @@ import css from './app.styl'; -export class App extends React.Component { +class App extends React.Component { static propTypes = { files: React.PropTypes.object } @@ -30,4 +30,8 @@ } } + +// Hack around https://github.com/babel/babel/issues/2868 +export {App}; + export default connect((state) => state)(App);
c3acb8139bd998be0575885d0a32bc44d7526fa8
examples/react-router-flux/src/components/App.jsx
examples/react-router-flux/src/components/App.jsx
var React = require('react') var { RouteHandler, Navigation } = require('react-router') var App = React.createClass({ mixins: [Navigation], hi() { this.transitionTo('hello') }, time() { this.transitionTo('time') }, render() { return ( <div> <a href="#" onClick={this.hi}>Say hi</a> <br /> <a href="/time" onClick={this.time}>What time is it?</a> <br /> <RouteHandler {...this.props} /> </div> ) } }) module.exports = App
var React = require('react') var { RouteHandler, Link } = require('react-router') var App = React.createClass({ render() { return ( <div> <Link to='hello'>Say hi</Link> <br /> <Link to='time'>What time is it?</Link> <br /> <RouteHandler {...this.props} /> </div> ) } }) module.exports = App
Fix link to `hello`, using `Link` components from `react-router`
Fix link to `hello`, using `Link` components from `react-router`
JSX
mit
goatslacker/iso,scvnathan/iso,michaelBenin/iso,redfieldstefan/iso,kwangkim/iso,scvnathan/iso,d-mon-/iso,michaelBenin/iso,kwangkim/iso
--- +++ @@ -1,23 +1,13 @@ var React = require('react') -var { RouteHandler, Navigation } = require('react-router') +var { RouteHandler, Link } = require('react-router') var App = React.createClass({ - mixins: [Navigation], - - hi() { - this.transitionTo('hello') - }, - - time() { - this.transitionTo('time') - }, - render() { return ( <div> - <a href="#" onClick={this.hi}>Say hi</a> + <Link to='hello'>Say hi</Link> <br /> - <a href="/time" onClick={this.time}>What time is it?</a> + <Link to='time'>What time is it?</Link> <br /> <RouteHandler {...this.props} /> </div>
8117a2018912be5ab0737e87ba1858022c33feab
react_app/src/components/pages/SourceDataPage.jsx
react_app/src/components/pages/SourceDataPage.jsx
import React from 'react' import SourceDataHeader from 'components/headers/SourceDataHeader' const SourceDataPage = props => { const source_data_table = ( <div> { /* Main content for source data */ } </div> ) return ( <div className='data-entry-page'> <SourceDataHeader {...props} /> <div className='row'> <div className='medium-12 columns'> { source_data_table } </div> </div> </div> ) } export default SourceDataPage
import React from 'react' import SourceDataHeader from 'components/headers/SourceDataHeader' const SourceDataPage = ({locations, campaigns, indicators}) => { console.log('locations', locations) console.log('campaigns', campaigns) console.log('indicators', indicators) const source_data_table = ( <div> { /* Main content for source data */ } </div> ) return ( <div className='data-entry-page'> <SourceDataHeader /> <div className='row'> <div className='medium-12 columns'> { source_data_table } </div> </div> </div> ) } export default SourceDataPage
Update source data page to have access to meta_data
Update source data page to have access to meta_data
JSX
agpl-3.0
unicef/rhizome,unicef/rhizome,unicef/rhizome,unicef/rhizome
--- +++ @@ -1,7 +1,12 @@ import React from 'react' import SourceDataHeader from 'components/headers/SourceDataHeader' -const SourceDataPage = props => { +const SourceDataPage = ({locations, campaigns, indicators}) => { + + console.log('locations', locations) + console.log('campaigns', campaigns) + console.log('indicators', indicators) + const source_data_table = ( <div> { /* Main content for source data */ } @@ -10,7 +15,7 @@ return ( <div className='data-entry-page'> - <SourceDataHeader {...props} /> + <SourceDataHeader /> <div className='row'> <div className='medium-12 columns'> { source_data_table }
c9e8d103b55c1f060965610c8091611a85dfe374
app/js/static/Page.jsx
app/js/static/Page.jsx
/* eslint-disable react/no-danger */ import React from 'react'; import PropTypes from 'prop-types'; import 'scss/page.scss'; function getPage(page) { try { return require('markdown/' + page + '.md'); // eslint-disable-line } catch (e) { return null; } } const Static = ({ location }) => { const page = getPage(location.pathname.replace(/^\//, '')); if (page) { return ( <div className="container page static"> <div dangerouslySetInnerHTML={{ __html: page }} /> </div> ); } return ( <div className="container page"> <div id="notfound"> <div className="notfound"> <div className="notfound-404"> <h1> 4<span />4 </h1> </div> <h2>Oops! Page Not Be Found</h2> <p> Sorry but the page you are looking for does not exist, have been removed. name changed or is temporarily unavailable </p> <a href="/">Back to homepage</a> </div> </div> </div> ); }; Static.propTypes = { location: PropTypes.shape({ pathname: PropTypes.string, }).isRequired, }; export default Static;
/* eslint-disable react/no-danger */ import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import 'scss/page.scss'; function getPage(page) { try { return require('markdown/' + page + '.md'); // eslint-disable-line } catch (e) { return null; } } const Static = ({ location }) => { const page = getPage(location.pathname.replace(/^\//, '')); if (page) { return ( <div className="container page static"> <div dangerouslySetInnerHTML={{ __html: page }} /> </div> ); } return ( <div className="container page"> <div id="notfound"> <div className="notfound"> <div className="notfound-404"> <h1> 4<span />4 </h1> </div> <h2>Oops! Page Not Found</h2> <p> Sorry! The page you were trying to reach does not exist or no longer exists. </p> <Link to="/">Back to homepage</Link> </div> </div> </div> ); }; Static.propTypes = { location: PropTypes.shape({ pathname: PropTypes.string, }).isRequired, }; export default Static;
Change Content & Refactor a-tag to a Link component
Change Content & Refactor a-tag to a Link component
JSX
mit
rit-sse/OneRepoToRuleThemAll
--- +++ @@ -1,6 +1,7 @@ /* eslint-disable react/no-danger */ import React from 'react'; import PropTypes from 'prop-types'; +import { Link } from 'react-router-dom'; import 'scss/page.scss'; function getPage(page) { @@ -29,12 +30,11 @@ 4<span />4 </h1> </div> - <h2>Oops! Page Not Be Found</h2> + <h2>Oops! Page Not Found</h2> <p> - Sorry but the page you are looking for does not exist, have been - removed. name changed or is temporarily unavailable + Sorry! The page you were trying to reach does not exist or no longer exists. </p> - <a href="/">Back to homepage</a> + <Link to="/">Back to homepage</Link> </div> </div> </div>
490ac7edcdf2b55dac91ff2f234ca5be0173b183
elements/BodyRoutes.jsx
elements/BodyRoutes.jsx
'use strict'; var _ = require('lodash'); var React = require('react'); var Router = require('react-router'); var Route = Router.Route; var Body = require('theme/Body'); var SectionIndex = require('theme/SectionIndex'); var SiteIndex = require('./SiteIndex.jsx'); var BodyContent = require('./BodyContent.jsx')(Body); var Page = require('./Page.jsx'); var config = require('config'); module.exports = ( <Route name='bodyContent' handler={BodyContent} path='/'> {_.keys(config.paths).map(function(k, i) { // possible root path needs to be after other paths. else it can match too early if(k === '/') { return null; } return [ <Route key={'root-' + i} name={k} handler={SectionIndex} />, ]; })} <Route key='item-route' name='item' path=':item' handler={Page} /> <Route key='item-with-nesting-route' name='itemWithNesting' path='*/:item' handler={Page} /> {config.paths['/'] ? /* XXX: why //? */ <Route key='index-route' name='index' path='//' handler={SiteIndex} /> : null} </Route> );
'use strict'; var _ = require('lodash'); var React = require('react'); var Router = require('react-router'); var Route = Router.Route; var Body = require('theme/Body'); var SectionIndex = require('theme/SectionIndex'); var SiteIndex = require('./SiteIndex.jsx'); var BodyContent = require('./BodyContent.jsx')(Body); var Page = require('./Page.jsx'); var config = require('config'); // XXXXX: for some reason this is needed for regular build to work var extraSlash = '/'; if(__DEV__) { extraSlash = ''; } module.exports = ( <Route name='bodyContent' handler={BodyContent} path='/'> {_.keys(config.paths).map(function(k, i) { // possible root path needs to be after other paths. else it can match too early if(k === '/') { return null; } return [ <Route key={'root-' + i} name={k} handler={SectionIndex} />, ]; })} <Route key='item-route' name='item' path=':item' handler={Page} /> <Route key='item-with-nesting-route' name='itemWithNesting' path='*/:item' handler={Page} /> {config.paths['/'] ? /* XXX: why // on build? */ <Route key='index-route' name='index' path={'/' + extraSlash} handler={SiteIndex} /> : null} </Route> );
Add extra slash to root only for build
Add extra slash to root only for build Now root should work in development mode. I'm not exactly sure why this hack is needed. I guess the development and build mode must differ in some crucial manner. Ideally we wouldn't need this.
JSX
mit
antwarjs/antwar,RamonGebben/antwar,RamonGebben/antwar
--- +++ @@ -12,6 +12,12 @@ var Page = require('./Page.jsx'); var config = require('config'); + +// XXXXX: for some reason this is needed for regular build to work +var extraSlash = '/'; +if(__DEV__) { + extraSlash = ''; +} module.exports = ( <Route name='bodyContent' handler={BodyContent} path='/'> @@ -28,8 +34,8 @@ <Route key='item-route' name='item' path=':item' handler={Page} /> <Route key='item-with-nesting-route' name='itemWithNesting' path='*/:item' handler={Page} /> {config.paths['/'] ? - /* XXX: why //? */ - <Route key='index-route' name='index' path='//' handler={SiteIndex} /> + /* XXX: why // on build? */ + <Route key='index-route' name='index' path={'/' + extraSlash} handler={SiteIndex} /> : null} </Route>
fe82f9a7ddcabb040aa0d5ca0641a75c4bd2987a
src/client/components/ActivityFeed/activities/DataHubEvent.jsx
src/client/components/ActivityFeed/activities/DataHubEvent.jsx
import React from 'react' import PropTypes from 'prop-types' import CardUtils from './card/CardUtils' import { formatStartAndEndDate } from '../../../utils/date' import { ACTIVITY_TYPE } from '../constants' import ActivityCardWrapper from './card/ActivityCardWrapper' import ActivityCardSubject from './card/ActivityCardSubject' import ActivityCardMetadata from './card/ActivityCardMetadata' export default function DataHubEvent({ activity: event }) { const eventObject = event.object const name = eventObject.name const date = formatStartAndEndDate(eventObject.startTime, eventObject.endTime) const organiser = eventObject['dit:organiser'].name const serviceType = eventObject['dit:service'].name const leadTeam = eventObject['dit:leadTeam'].name return ( <ActivityCardWrapper dataTest="data-hub-event"> <ActivityCardSubject dataTest="data-hub-event-name"> {name} </ActivityCardSubject> <ActivityCardMetadata metadata={[ { label: 'Event date', value: date, }, ]} /> </ActivityCardWrapper> ) } DataHubEvent.propTypes = { event: PropTypes.object.isRequired, } DataHubEvent.canRender = (event) => { return CardUtils.canRenderByTypes(event, ACTIVITY_TYPE.DataHubEvent) }
import React from 'react' import PropTypes from 'prop-types' import CardUtils from './card/CardUtils' import { formatStartAndEndDate } from '../../../utils/date' import { ACTIVITY_TYPE } from '../constants' import ActivityCardWrapper from './card/ActivityCardWrapper' import ActivityCardSubject from './card/ActivityCardSubject' import ActivityCardMetadata from './card/ActivityCardMetadata' export default function DataHubEvent({ activity: event }) { const eventObject = event.object const eventName = eventObject.name const date = formatStartAndEndDate(eventObject.startTime, eventObject.endTime) const organiser = eventObject['dit:organiser'].name const serviceType = eventObject['dit:service'].name const leadTeam = eventObject['dit:leadTeam'].name return ( <ActivityCardWrapper dataTest="data-hub-event"> <ActivityCardSubject dataTest="data-hub-event-name"> {eventName} </ActivityCardSubject> <ActivityCardMetadata metadata={[ { label: 'Event date', value: date, }, { label: 'Organiser', value: organiser, }, { label: 'Service type', value: serviceType, }, { label: 'Lead team', value: leadTeam, }, ]} /> </ActivityCardWrapper> ) } DataHubEvent.propTypes = { event: PropTypes.object.isRequired, } DataHubEvent.canRender = (event) => { return CardUtils.canRenderByTypes(event, ACTIVITY_TYPE.DataHubEvent) }
Add organiser, service type and lead team variables to metadata and render them
Add organiser, service type and lead team variables to metadata and render them
JSX
mit
uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2
--- +++ @@ -11,7 +11,7 @@ export default function DataHubEvent({ activity: event }) { const eventObject = event.object - const name = eventObject.name + const eventName = eventObject.name const date = formatStartAndEndDate(eventObject.startTime, eventObject.endTime) const organiser = eventObject['dit:organiser'].name const serviceType = eventObject['dit:service'].name @@ -20,13 +20,25 @@ return ( <ActivityCardWrapper dataTest="data-hub-event"> <ActivityCardSubject dataTest="data-hub-event-name"> - {name} + {eventName} </ActivityCardSubject> <ActivityCardMetadata metadata={[ { label: 'Event date', value: date, + }, + { + label: 'Organiser', + value: organiser, + }, + { + label: 'Service type', + value: serviceType, + }, + { + label: 'Lead team', + value: leadTeam, }, ]} />
d976add968d53b97111610389a28972b7ccedaf0
src/components/Home.jsx
src/components/Home.jsx
import React, { Component } from 'react' import classNames from 'classnames' import { Route, withRouter } from 'react-router-dom' import { translate } from 'cozy-ui/react/I18n' import { Main, Content } from 'cozy-ui/react/Layout' import Konnector from 'components/Konnector' import Applications from 'components/Applications' import ScrollToTopOnMount from 'components/ScrollToTopOnMount' import Services from 'components/Services' import { isTutorial, display as displayTutorial } from 'lib/tutorial' class Home extends Component { componentDidMount() { this.launchTutorial() } componentWillReceiveProps(props) { this.UNSAFE_componentWillReceiveProps(props) } UNSAFE_componentWillReceiveProps() { this.launchTutorial() } launchTutorial() { if (isTutorial()) { window.history.pushState({}, '', `/${window.location.hash}`) setTimeout(() => { displayTutorial(this.props.t) }, 1000) } } render() { const { wrapper } = this.props return ( <Main> <ScrollToTopOnMount target={wrapper} /> <Content> <div className={classNames('col-content', { 'has-custom-background': false })} > <Applications /> <Services /> </div> </Content> <Route path="/connected/:konnectorSlug" component={Konnector} /> </Main> ) } } export default withRouter(translate()(Home))
import React, { Component } from 'react' import classNames from 'classnames' import { Route, withRouter, Redirect } from 'react-router' import { translate } from 'cozy-ui/react/I18n' import { Main, Content } from 'cozy-ui/react/Layout' import Konnector from 'components/Konnector' import Applications from 'components/Applications' import ScrollToTopOnMount from 'components/ScrollToTopOnMount' import Services from 'components/Services' import { isTutorial, display as displayTutorial } from 'lib/tutorial' class Home extends Component { componentDidMount() { this.launchTutorial() } componentWillReceiveProps(props) { this.UNSAFE_componentWillReceiveProps(props) } UNSAFE_componentWillReceiveProps() { this.launchTutorial() } launchTutorial() { if (isTutorial()) { window.history.pushState({}, '', `/${window.location.hash}`) setTimeout(() => { displayTutorial(this.props.t) }, 1000) } } render() { const { wrapper } = this.props return ( <Main> <ScrollToTopOnMount target={wrapper} /> <Content> <div className={classNames('col-content', { 'has-custom-background': false })} > <Applications /> <Services /> </div> </Content> <Route path="/connected/:konnectorSlug" component={Konnector} /> <Redirect from="/connected/*" to="/connected" /> </Main> ) } } export default withRouter(translate()(Home))
Add redirect to handle few wrong route
fix: Add redirect to handle few wrong route
JSX
agpl-3.0
cozy/cozy-home,cozy/cozy-home,cozy/cozy-home
--- +++ @@ -1,6 +1,6 @@ import React, { Component } from 'react' import classNames from 'classnames' -import { Route, withRouter } from 'react-router-dom' +import { Route, withRouter, Redirect } from 'react-router' import { translate } from 'cozy-ui/react/I18n' import { Main, Content } from 'cozy-ui/react/Layout' @@ -49,6 +49,7 @@ </div> </Content> <Route path="/connected/:konnectorSlug" component={Konnector} /> + <Redirect from="/connected/*" to="/connected" /> </Main> ) }
4300486293e5ac7815ef22bd1e649433d7b2daeb
example/app/screens/todo/components/main-section/toggle-all.jsx
example/app/screens/todo/components/main-section/toggle-all.jsx
import React from 'react' import {wrap} from 'tide' class ToggleAll extends React.Component { onChange = () => { this.props.tide.actions.todo.toggleAllCompleted() }; render() { const all = this.props.todos.every((todo) => todo.get('completed')) return ( <span> <input checked={all} onChange={this.onChange} className="toggle-all" type="checkbox" /> <label htmlFor="toggle-all"> Mark all as complete </label> </span> ) } } export default wrap(ToggleAll, {todos: "todos"})
import React from 'react' import {wrap} from 'tide' class ToggleAll extends React.Component { onChange = () => { this.props.tide.actions.todo.toggleAllCompleted() }; render() { const all = this.props.todos.every((todo) => todo.get('completed')) return ( <span> <input checked={all} onChange={this.onChange} className="toggle-all" id="toggle-all" type="checkbox" /> <label htmlFor="toggle-all"> Mark all as complete </label> </span> ) } } export default wrap(ToggleAll, {todos: "todos"})
Update tide example to have working toggle all button
Update tide example to have working toggle all button
JSX
mit
tictail/tide,tictail/tide,tictail/tide
--- +++ @@ -14,6 +14,7 @@ checked={all} onChange={this.onChange} className="toggle-all" + id="toggle-all" type="checkbox" /> <label htmlFor="toggle-all">
55e8f2c3230277d126e67359ebdd98e82a03151e
src/views/join/join.jsx
src/views/join/join.jsx
const React = require('react'); const render = require('../../lib/render.jsx'); const JoinModal = require('../../components/modal/join/modal.jsx'); const openModal = true; const Register = () => ( <div className="join"> <JoinModal isOpen={openModal} key="scratch3registration" /> </div> ); render(<Register />, document.getElementById('app'));
const React = require('react'); const render = require('../../lib/render.jsx'); const JoinModal = require('../../components/modal/join/modal.jsx'); const ErrorBoundary = require('../../components/errorboundary/errorboundary.jsx'); const openModal = true; const Register = () => ( <ErrorBoundary> <JoinModal isOpen={openModal} key="scratch3registration" /> </ErrorBoundary> ); render(<Register />, document.getElementById('app'));
Add in the error boundary.
Add in the error boundary.
JSX
bsd-3-clause
LLK/scratch-www,LLK/scratch-www
--- +++ @@ -1,14 +1,15 @@ const React = require('react'); const render = require('../../lib/render.jsx'); const JoinModal = require('../../components/modal/join/modal.jsx'); +const ErrorBoundary = require('../../components/errorboundary/errorboundary.jsx'); const openModal = true; const Register = () => ( - <div className="join"> + <ErrorBoundary> <JoinModal isOpen={openModal} key="scratch3registration" /> - </div> + </ErrorBoundary> ); render(<Register />, document.getElementById('app'));