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
5edf285889d28dcf3dbd268e3bc707e7eb67858a
client/app/bundles/HelloWorld/components/premium/quote_request_modal.jsx
client/app/bundles/HelloWorld/components/premium/quote_request_modal.jsx
import React from 'react' import Modal from 'react-bootstrap/lib/Modal'; import Stripe from '../modules/stripe.jsx' export default React.createClass ({ getInitialState: function() { return { isUserSignedIn: ($('#user-logged-in').data().signedIn === true) }; }, charge: function() { new Stripe(45000, '$450 School Premium'); }, chargeOrLogin: function() { if (this.state.isUserSignedIn === true) { this.charge(); } else { alert('You must be logged in to purchase Quill Premium.') } }, render: function() { return ( <Modal {...this.props} show={this.props.show} onHide={this.props.hideModal} dialogClassName='quote-request-modal'> <Modal.Body> <h1 className='q-h2'>Receive a quote for a purchase order.</h1> <a className="q-button cta-button bg-quillgreen text-white" href='https://quillpremium.wufoo.com/forms/quill-premium-quote/' target="_blank"> Email a Quote </a> </Modal.Body> <Modal.Footer> <p>To pay now, please <span data-toggle="modal" onClick={this.chargeOrLogin}>click here</span>.</p> <p>You can also call us at 646-442-1095 </p> </Modal.Footer> </Modal> ) } });
import React from 'react' import Modal from 'react-bootstrap/lib/Modal'; import Stripe from '../modules/stripe.jsx' export default React.createClass ({ getInitialState: function() { return { isUserSignedIn: ($('#user-logged-in').data().signedIn === true) }; }, charge: function() { new Stripe(45000, '$450 School Premium'); }, chargeOrLogin: function() { if (this.state.isUserSignedIn === true) { this.charge(); } else { alert('You must be logged in to purchase Quill Premium.') } }, render: function() { return ( <Modal {...this.props} show={this.props.show} onHide={this.props.hideModal} dialogClassName='quote-request-modal'> <Modal.Body> <h1 className='q-h2'>Receive a quote for a purchase order.</h1> <a className="q-button cta-button bg-quillgreen text-white" href='https://quillpremium.wufoo.com/forms/quill-premium-quote/' target="_blank"> Email a Quote </a> </Modal.Body> <Modal.Footer> <p>To pay now with a credit card, please <span data-toggle="modal" onClick={this.chargeOrLogin}>click here</span>.</p> <p>You can also call us at 646-442-1095 </p> </Modal.Footer> </Modal> ) } });
Update copy with credit card
Update copy with credit card
JSX
agpl-3.0
empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core
--- +++ @@ -32,7 +32,7 @@ </a> </Modal.Body> <Modal.Footer> - <p>To pay now, please <span data-toggle="modal" onClick={this.chargeOrLogin}>click here</span>.</p> + <p>To pay now with a credit card, please <span data-toggle="modal" onClick={this.chargeOrLogin}>click here</span>.</p> <p>You can also call us at 646-442-1095 </p> </Modal.Footer> </Modal>
2764d37b8c72728b1f6ec5be12d3633499fd1e24
web/components/common/PressAndHoldButton/index.jsx
web/components/common/PressAndHoldButton/index.jsx
import React from 'react'; export default class PressAndHoldButton extends React.Component { componentWillMount() { this.timeout = null; this.interval = null; } componentWillUnmount() { this.handleRelease(); } handleHoldDown() { let that = this; let delay = Number(this.props.delay) || 500; let throttle = Number(this.props.throttle) || 50; this.timeout = setTimeout(function() { that.handleRelease(); that.interval = setInterval(function() { if (that.interval) { that.props.onClick(); } }, throttle); }, delay); } handleRelease() { if (this.timeout) { clearTimeout(this.timeout); this.timeout = null; } if (this.interval) { clearInterval(this.interval); this.interval = null; } } render() { let { type, className, onClick } = this.props; type = type || 'button'; className = className || 'btn'; return ( <button type={type} className={className} onClick={onClick} onMouseDown={::this.handleHoldDown} onMouseUp={::this.handleRelease} onMouseLeave={::this.handleRelease} > {this.props.children} </button> ); } }
import React from 'react'; import joinClasses from 'react/lib/joinClasses'; export default class PressAndHoldButton extends React.Component { componentWillMount() { this.timeout = null; this.interval = null; } componentWillUnmount() { this.handleRelease(); } handleHoldDown() { let that = this; let delay = Number(this.props.delay) || 500; let throttle = Number(this.props.throttle) || 50; this.timeout = setTimeout(function() { that.handleRelease(); that.interval = setInterval(function() { if (that.interval) { that.props.onClick(); } }, throttle); }, delay); } handleRelease() { if (this.timeout) { clearTimeout(this.timeout); this.timeout = null; } if (this.interval) { clearInterval(this.interval); this.interval = null; } } render() { let { type, className, onClick } = this.props; type = type || 'button'; className = joinClasses('btn', className); return ( <button type={type} className={className} onClick={onClick} onMouseDown={::this.handleHoldDown} onMouseUp={::this.handleRelease} onMouseLeave={::this.handleRelease} > {this.props.children} </button> ); } }
Use joinClasses() to join class with this.props.className
Use joinClasses() to join class with this.props.className
JSX
mit
cheton/piduino-grbl,cheton/cnc.js,cncjs/cncjs,cncjs/cncjs,cheton/cnc.js,cheton/cnc.js,cheton/cnc,cheton/piduino-grbl,cheton/piduino-grbl,cheton/cnc,cheton/cnc,cncjs/cncjs
--- +++ @@ -1,4 +1,5 @@ import React from 'react'; +import joinClasses from 'react/lib/joinClasses'; export default class PressAndHoldButton extends React.Component { componentWillMount() { @@ -36,7 +37,7 @@ render() { let { type, className, onClick } = this.props; type = type || 'button'; - className = className || 'btn'; + className = joinClasses('btn', className); return ( <button
1396873498d43bb12b94fa2a0214d44703e2b48c
src/app.jsx
src/app.jsx
/* * Copyright 2018 Expedia, Inc. * * Licensed 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 from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'mobx-react'; import {Route, BrowserRouter as Router} from 'react-router-dom'; import Main from './main'; import storesInitializer from './stores/storesInitializer'; import withTracker from './components/common/withTracker'; import serviceGraphStore from './components/serviceGraph/stores/serviceGraphStore'; // app initializers storesInitializer.init(); const stores = { graphStore: serviceGraphStore }; // mount react components ReactDOM.render( <Provider {...stores}> <Router history={history}> <Route component={withTracker(Main)}/> </Router> </Provider> , document.getElementById('root') );
/* * Copyright 2018 Expedia, Inc. * * Licensed 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 from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'mobx-react'; import {Route, BrowserRouter as Router} from 'react-router-dom'; import Main from './main'; import storesInitializer from './stores/storesInitializer'; import withTracker from './components/common/withTracker'; import serviceGraphStore from './components/serviceGraph/stores/serviceGraphStore'; // app initializers storesInitializer.init(); const stores = { graphStore: serviceGraphStore }; // mount react components ReactDOM.render( <Provider {...stores}> <Router> <Route component={withTracker(Main)}/> </Router> </Provider> , document.getElementById('root') );
Remove history props as BrowserRouter uses the HTML 5 api.
Remove history props as BrowserRouter uses the HTML 5 api.
JSX
apache-2.0
ExpediaDotCom/haystack-ui,ExpediaDotCom/haystack-ui
--- +++ @@ -34,7 +34,7 @@ // mount react components ReactDOM.render( <Provider {...stores}> - <Router history={history}> + <Router> <Route component={withTracker(Main)}/> </Router> </Provider>
d525b40c3ca027f46c4128601311cc7b05d3b71b
src/components/elements/post-comments-more.jsx
src/components/elements/post-comments-more.jsx
import React from 'react'; import { preventDefault } from '../../utils'; import throbber16 from 'assets/images/throbber-16.gif'; export default (props) => ( <div className="comment"> <span className="more-comments-throbber"> {props.isLoading ? ( <img width="16" height="16" src={throbber16}/> ) : false} </span> <a className="more-comments-link" href={props.postUrl} onClick={preventDefault(()=>props.showMoreComments())}> {`${props.omittedComments}`} more comments </a> </div> );
import React from 'react'; import { preventDefault } from '../../utils'; import throbber16 from 'assets/images/throbber-16.gif'; export default (props) => ( <div className="comment"> <span className="more-comments-throbber"> {props.isLoading ? ( <img width="16" height="16" src={throbber16}/> ) : false} </span> <a className="more-comments-link" href={props.postUrl} onClick={preventDefault(props.showMoreComments)}> {`${props.omittedComments}`} more comments </a> </div> );
Remove unnecessary arrow function in PostCommentsMore
[jsx-no-bind] Remove unnecessary arrow function in PostCommentsMore
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -12,7 +12,7 @@ </span> <a className="more-comments-link" href={props.postUrl} - onClick={preventDefault(()=>props.showMoreComments())}> + onClick={preventDefault(props.showMoreComments)}> {`${props.omittedComments}`} more comments </a> </div>
608eadac4d0c7ab53298f1b07d5b5c8bcd29f957
src/ConnectionStatus.jsx
src/ConnectionStatus.jsx
import { observer } from 'mobx-react' import React from 'react' import { connect } from 'react-redux' import FlatButton from 'material-ui/FlatButton' import { app } from '@mindhive/di' const ConnectionStatus = ({ domains: { connectionDomain } = app(), vocab, }) => connectionDomain.connectionDown && <div style={{ background: 'red', color: 'white' }}> Can't connect to {vocab.App}, will keep trying. Check your Internet connection. {connectionDomain.hasPendingCalls && <div> Changes you've made are waiting to be sent, and will be lost unless you reconnect. </div> } <div> <FlatButton label="Try again now" onTouchTap={connectionDomain.reconnect} /> </div> </div> const mapStateToProps = ({ vocab }) => ({ vocab, }) export default connect(mapStateToProps)( observer( ConnectionStatus ) )
import { observer } from 'mobx-react' import React from 'react' import FlatButton from 'material-ui/FlatButton' import { app } from '@mindhive/di' const ConnectionStatus = ({ domains: { connectionDomain } = app(), }) => connectionDomain.connectionDown && <div style={{ background: 'red', color: 'white' }}> Can't connect the the server, will keep trying. Check your Internet connection. {connectionDomain.hasPendingCalls && <div> Changes you've made are waiting to be sent, and will be lost unless you reconnect. </div> } <div> <FlatButton label="Try again now" onTouchTap={connectionDomain.reconnect} /> </div> </div> export default observer( ConnectionStatus )
Remove use of vocab to keep generic
Remove use of vocab to keep generic
JSX
mit
mindhivenz/mui-components
--- +++ @@ -1,17 +1,15 @@ import { observer } from 'mobx-react' import React from 'react' -import { connect } from 'react-redux' import FlatButton from 'material-ui/FlatButton' import { app } from '@mindhive/di' const ConnectionStatus = ({ domains: { connectionDomain } = app(), - vocab, }) => connectionDomain.connectionDown && <div style={{ background: 'red', color: 'white' }}> - Can't connect to {vocab.App}, will keep trying. Check your Internet connection. + Can't connect the the server, will keep trying. Check your Internet connection. {connectionDomain.hasPendingCalls && <div> Changes you've made are waiting to be sent, and will be lost unless you reconnect. @@ -26,12 +24,8 @@ </div> -const mapStateToProps = ({ vocab }) => ({ - vocab, -}) - -export default connect(mapStateToProps)( +export default observer( ConnectionStatus ) -) +
40f2391457c7187ca0103311b72a06718a95ec50
client/src/components/transaction/currency-input.jsx
client/src/components/transaction/currency-input.jsx
import React from 'react' import { Input } from 'components/core/input' import { getCurrencyCodes } from 'services/currency' import user from 'services/user' class CurrencyInput extends React.Component { constructor (props) { super(props) this.state = { currencyCodes: [] } } async componentDidMount () { this.setState({ currencyCodes: await getCurrencyCodes() }) } render () { let { currencyCodes } = this.state if (!currencyCodes.length) return null return ( <Input {...this.props} getInitialValue={() => user.getPreferredCurrency()} validate={value => (currencyCodes || []).indexOf(value) >= 0} autocomplete={currencyCodes} /> ) } } export default CurrencyInput
import React from 'react' import { Input } from 'components/core/input' import { getCurrencyCodes } from 'services/currency' import user from 'services/user' class CurrencyInput extends React.Component { constructor (props) { super(props) this.state = { currencyCodes: [] } } async componentDidMount () { this.setState({ currencyCodes: await getCurrencyCodes() }) } render () { let { currencyCodes } = this.state if (!currencyCodes.length) return null return ( <Input {...this.props} getInitialValue={this.props.getInitialValue || (() => user.getPreferredCurrency())} validate={value => (currencyCodes || []).indexOf(value) >= 0} autocomplete={currencyCodes} /> ) } } export default CurrencyInput
Fix initial value for currency input
Fix initial value for currency input
JSX
mit
mtratsiuk/contrast,mtratsiuk/contrast,mtratsiuk/contrast,mtratsiuk/contrast
--- +++ @@ -26,7 +26,7 @@ return ( <Input {...this.props} - getInitialValue={() => user.getPreferredCurrency()} + getInitialValue={this.props.getInitialValue || (() => user.getPreferredCurrency())} validate={value => (currencyCodes || []).indexOf(value) >= 0} autocomplete={currencyCodes} />
7ae7df8398ac9b59e7b4ddf9dc4bc9f9aefd7d13
src/pages/Flipper.jsx
src/pages/Flipper.jsx
import React from 'react' import Img from 'gatsby-image' import './Flipper.scss' const Flipper = ({ name, logo, text }) => ( <div className="Flipper"> <div className="Flipper-Inner"> <div className="Flipper-Front"> <Img fluid={logo} alt={name} /> </div> <div className="Flipper-Back"> <p>{text}</p> </div> </div> </div> ) export default Flipper
import React from 'react' import Img from 'gatsby-image' import './Flipper.scss' const Flipper = ({ name, logo, text }) => ( <div className="Flipper"> <div className="Flipper-Inner"> <div className="Flipper-Front"> <Img fluid={logo} alt={name} fixed={typeof window === 'undefined' ? { src: {} } : undefined} /> </div> <div className="Flipper-Back"> <p>{text}</p> </div> </div> </div> ) export default Flipper
Fix build error in gatsby image
Fix build error in gatsby image
JSX
mit
Echie/echie-net
--- +++ @@ -6,7 +6,7 @@ <div className="Flipper"> <div className="Flipper-Inner"> <div className="Flipper-Front"> - <Img fluid={logo} alt={name} /> + <Img fluid={logo} alt={name} fixed={typeof window === 'undefined' ? { src: {} } : undefined} /> </div> <div className="Flipper-Back"> <p>{text}</p>
4a4b22f8fcebebfca15cade382fac41a85f546a1
src/components/Alert.jsx
src/components/Alert.jsx
import React from 'react'; import { connect } from 'react-redux'; import { setAlert } from 'appActions'; class Alert extends React.Component { constructor(props) { super(props); this.handleExitClick = this.handleExitClick.bind(this); } componentDidUpdate() { setTimeout(() => { this.props.dispatch(setAlert({type: null, message: null})); }, 3000); } handleExitClick() { this.props.dispatch(setAlert({type: null, message: null})); } render() { const {type, message} = this.props.app.alert; if (!type || !message) return null; return ( <div className={'alert alert-dismissable alert-' + type}> <button className="close" onClick={this.handleExitClick}> <span aria-hidden="true">&times;</span> </button> {message} </div> ); } } export default connect(state => { return { app: state.app }; })(Alert);
import React from 'react'; import { connect } from 'react-redux'; import { setAlert } from 'appActions'; class Alert extends React.Component { constructor(props) { super(props); this.handleExitClick = this.handleExitClick.bind(this); } componentWillReceiveProps(nextProps) { if (nextProps && nextProps.app.alert.type) { setTimeout(() => { this.props.dispatch(setAlert({type: null, message: null})); }, 3000); } } handleExitClick() { this.props.dispatch(setAlert({type: null, message: null})); } render() { const {type, message} = this.props.app.alert; if (!type || !message) return null; return ( <div className={'alert alert-dismissable alert-' + type}> <button className="close" onClick={this.handleExitClick}> <span aria-hidden="true">&times;</span> </button> {message} </div> ); } } export default connect(state => { return { app: state.app }; })(Alert);
Fix alert updating more than it should
Fix alert updating more than it should
JSX
mit
JavierPDev/Weather-D3,JavierPDev/Weather-D3
--- +++ @@ -10,10 +10,12 @@ this.handleExitClick = this.handleExitClick.bind(this); } - componentDidUpdate() { - setTimeout(() => { - this.props.dispatch(setAlert({type: null, message: null})); - }, 3000); + componentWillReceiveProps(nextProps) { + if (nextProps && nextProps.app.alert.type) { + setTimeout(() => { + this.props.dispatch(setAlert({type: null, message: null})); + }, 3000); + } } handleExitClick() {
4c28f621857c618cb6b9c1685491fcdff03b38d3
wrappers/html.jsx
wrappers/html.jsx
import React from 'react'; module.exports = React.createClass({ render: function() { var html; html = "<div>fix me</div>"; return ( <div dangerouslySetInnerHTML={{__html: html}}/> ); } });
import React, {PropTypes} from 'react' module.exports = React.createClass({ propTypes: { page: PropTypes.shape({ data: PropTypes.string, }), }, render: function () { const html = this.props.page.data; return ( <div dangerouslySetInnerHTML={{__html: html}}/> ); } });
Fix HTML wrapper, even if it's currently unused
Fix HTML wrapper, even if it's currently unused
JSX
mit
scottnonnenberg/blog,scottnonnenberg/blog,scottnonnenberg/blog
--- +++ @@ -1,9 +1,15 @@ -import React from 'react'; +import React, {PropTypes} from 'react' module.exports = React.createClass({ - render: function() { - var html; - html = "<div>fix me</div>"; + propTypes: { + page: PropTypes.shape({ + data: PropTypes.string, + }), + }, + + render: function () { + const html = this.props.page.data; + return ( <div dangerouslySetInnerHTML={{__html: html}}/> );
57eb0cff9e8370a40a0ff0f2c362a7771feb7bae
installer/app/src/views/aws-region-picker.js.jsx
installer/app/src/views/aws-region-picker.js.jsx
import PrettySelect from './pretty-select'; var AWSRegionPicker = React.createClass({ render: function () { return ( <label> <div>AWS Region: </div> <PrettySelect onChange={this.__handleChange} value={this.props.value}> <option value="us-east-1">US East (N. Virginia)</option> <option value="us-west-2">US West (Oregon)</option> <option value="us-west-1">US West (N. California)</option> <option value="eu-west-1">EU (Ireland)</option> <option value="eu-central-1">EU (Frankfurt)</option> <option value="ap-southeast-1">Asia Pacific (Singapore)</option> <option value="ap-southeast-2">Asia Pacific (Sydney)</option> <option value="ap-northeast-1">Asia Pacific (Tokyo)</option> <option value="sa-east-1">South America (Sao Paulo)</option> </PrettySelect> </label> ); }, __handleChange: function (e) { var region = e.target.value; this.props.onChange(region); } }); export default AWSRegionPicker;
import PrettySelect from './pretty-select'; var AWSRegionPicker = React.createClass({ render: function () { return ( <label> <div>AWS Region: </div> <PrettySelect onChange={this.__handleChange} value={this.props.value}> <option value="us-east-1">US East (N. Virginia)</option> <option value="us-west-2">US West (Oregon)</option> <option value="us-west-1">US West (N. California)</option> <option value="eu-west-1">EU (Ireland)</option> <option value="ap-southeast-1">Asia Pacific (Singapore)</option> <option value="ap-southeast-2">Asia Pacific (Sydney)</option> <option value="ap-northeast-1">Asia Pacific (Tokyo)</option> <option value="sa-east-1">South America (Sao Paulo)</option> </PrettySelect> </label> ); }, __handleChange: function (e) { var region = e.target.value; this.props.onChange(region); } }); export default AWSRegionPicker;
Remove eu-central-1 from region select
installer: Remove eu-central-1 from region select This region doesn't have a corresponding image. fixes #1336 Signed-off-by: Jesse Stuart <a5c95b3d7cb4d0ae05a15c79c79ab458dc2c8f9e@jessestuart.ca>
JSX
bsd-3-clause
jzila/flynn,supermario/flynn,TribeMedia/flynn,technosophos/flynn,tonicbupt/flynn,rikur/flynn,arekkas/flynn,rikur/flynn,shads196770/flynn,whouses/flynn,TribeMedia/flynn,TribeMedia/flynn,shads196770/flynn,arekkas/flynn,pkdevbox/flynn,jzila/flynn,felixrieseberg/flynn,jzila/flynn,GrimDerp/flynn,justintung/flynn,benbjohnson/flynn,flynn/flynn,clifff/flynn,Brandywine2161/flynn,Brandywine2161/flynn,supermario/flynn,justintung/flynn,jzila/flynn,josephglanville/flynn,GrimDerp/flynn,tonicbupt/flynn,philiplb/flynn,kgrz/flynn,shads196770/flynn,clifff/flynn,ozum/flynn,benbjohnson/flynn,kgrz/flynn,pkdevbox/flynn,pkdevbox/flynn,felixrieseberg/flynn,justintung/flynn,schatt/flynn,TribeMedia/flynn,GrimDerp/flynn,lmars/flynn,clifff/flynn,philiplb/flynn,supermario/flynn,benbjohnson/flynn,justintung/flynn,Brandywine2161/flynn,benbjohnson/flynn,whouses/flynn,whouses/flynn,whouses/flynn,flynn/flynn,tonicbupt/flynn,shads196770/flynn,flynn/flynn,GrimDerp/flynn,josephglanville/flynn,schatt/flynn,Brandywine2161/flynn,schatt/flynn,felixrieseberg/flynn,ozum/flynn,supermario/flynn,supermario/flynn,flynn/flynn,TribeMedia/flynn,tonicbupt/flynn,ozum/flynn,ozum/flynn,rikur/flynn,whouses/flynn,tonicbupt/flynn,arekkas/flynn,josephglanville/flynn,rikur/flynn,supermario/flynn,kgrz/flynn,rikur/flynn,jzila/flynn,kgrz/flynn,josephglanville/flynn,ozum/flynn,benbjohnson/flynn,GrimDerp/flynn,lmars/flynn,GrimDerp/flynn,arekkas/flynn,shads196770/flynn,whouses/flynn,felixrieseberg/flynn,lmars/flynn,jzila/flynn,arekkas/flynn,philiplb/flynn,pkdevbox/flynn,schatt/flynn,schatt/flynn,pkdevbox/flynn,technosophos/flynn,technosophos/flynn,clifff/flynn,Brandywine2161/flynn,kgrz/flynn,technosophos/flynn,pkdevbox/flynn,josephglanville/flynn,rikur/flynn,flynn/flynn,TribeMedia/flynn,kgrz/flynn,felixrieseberg/flynn,ozum/flynn,schatt/flynn,philiplb/flynn,clifff/flynn,technosophos/flynn,philiplb/flynn,shads196770/flynn,justintung/flynn,benbjohnson/flynn,justintung/flynn,lmars/flynn,josephglanville/flynn,Brandywine2161/flynn,lmars/flynn,clifff/flynn
--- +++ @@ -10,7 +10,6 @@ <option value="us-west-2">US West (Oregon)</option> <option value="us-west-1">US West (N. California)</option> <option value="eu-west-1">EU (Ireland)</option> - <option value="eu-central-1">EU (Frankfurt)</option> <option value="ap-southeast-1">Asia Pacific (Singapore)</option> <option value="ap-southeast-2">Asia Pacific (Sydney)</option> <option value="ap-northeast-1">Asia Pacific (Tokyo)</option>
67a8d1770ad3223ec6651059b4e5b05cb56b47df
src/components/controls/Range.jsx
src/components/controls/Range.jsx
// @flow import React from "react"; import s from "./styles.scss"; const Range = (props: { name: string, types: { range: [number, number] }, value: number, step: ?number, onSetFilterOption: (string, any) => {} }) => ( <div className={s.range}> <div className={s.label}>{props.name}</div> <div className={s.rangeGroup}> <input type="range" min={props.types.range[0]} max={props.types.range[1]} value={props.value} step={props.step || 1} onChange={e => props.onSetFilterOption(props.name, parseFloat(e.target.value))} /> <span role="button" tabIndex="0" className={[s.value, s.clickable].join(" ")} onClick={() => { const newValue = window.prompt("Value"); // eslint-disable-line const parsed = parseFloat(newValue); if (parsed) { props.onSetFilterOption(props.name, parsed); } }} > {props.value} </span> </div> </div> ); export default Range;
// @flow import React from "react"; import s from "./styles.scss"; const Range = (props: { name: string, types: { range: [number, number] }, value: number, step: ?number, onSetFilterOption: (string, any) => {} }) => ( <div className={s.range}> <div className={s.label}>{props.name}</div> <div className={s.rangeGroup}> <input type="range" min={props.types.range[0]} max={props.types.range[1]} value={props.value} step={props.step || 1} onChange={e => props.onSetFilterOption(props.name, parseFloat(e.target.value))} /> <span role="button" tabIndex="0" className={[s.value, s.clickable].join(" ")} onClick={() => { const newValue = window.prompt("Value"); // eslint-disable-line const parsed = parseFloat(newValue); if (parsed || parsed === 0) { props.onSetFilterOption(props.name, parsed); } }} > {props.value} </span> </div> </div> ); export default Range;
Allow manual setting of 0 in range control
Allow manual setting of 0 in range control
JSX
mit
gyng/ditherer,gyng/ditherer,gyng/ditherer
--- +++ @@ -31,7 +31,7 @@ onClick={() => { const newValue = window.prompt("Value"); // eslint-disable-line const parsed = parseFloat(newValue); - if (parsed) { + if (parsed || parsed === 0) { props.onSetFilterOption(props.name, parsed); } }}
afa613b0e556fb941fa1e28d2653e6e9043910e8
app/app/config/routes.jsx
app/app/config/routes.jsx
import React from 'react' import Main from '../components/Main.jsx' import CreateUser from '../components/user/CreateUser.jsx' import Home from '../components/home/Home.jsx' import Login from '../components/user/Login.jsx' import CreateTask from '../components/tasks/CreateTask.jsx' import {Route, IndexRoute} from 'react-router' const CreateUserWrapper = () => <CreateUser myType={"users"} /> const CreateSerfWrapper = () => <CreateUser myType={"serfs"} /> const routes = () => <Route path="/" component={Main}> // New User <Route path="users/new" component={CreateUserWrapper} /> // New Task <Route path="users/:id/tasks/new" component={CreateTask} /> // New Serf <Route path="serfs/new" component={CreateSerfWrapper} /> // login <Route path="sessions/new" component={Login} /> <IndexRoute component={Home} /> </Route> export default routes()
import React from 'react' import Main from '../components/Main.jsx' import CreateUser from '../components/user/CreateUser.jsx' import Home from '../components/home/Home.jsx' import Login from '../components/user/Login.jsx' import CreateTask from '../components/tasks/CreateTask.jsx' import {Route, IndexRoute} from 'react-router' import TaskForm from '../components/tasks/TaskForm.jsx' import SearchSerf from '../components/tasks/SearchSerf.jsx' const CreateUserWrapper = () => <CreateUser myType={"users"} /> const CreateSerfWrapper = () => <CreateUser myType={"serfs"} /> const routes = () => <Route path="/" component={Main}> // New User <Route path="users/new" component={CreateUserWrapper} /> // New Task <Route path="users/:id/tasks/new" component={CreateTask}> <Route path="/search" component={SearchSerf}> <IndexRoute component={TaskForm} /> </Route> // New Serf <Route path="serfs/new" component={CreateSerfWrapper} /> // login <Route path="sessions/new" component={Login} /> <IndexRoute component={Home} /> </Route> export default routes()
Add Routes for components in create task
Add Routes for components in create task
JSX
mit
taodav/MicroSerfs,taodav/MicroSerfs
--- +++ @@ -5,6 +5,8 @@ import Login from '../components/user/Login.jsx' import CreateTask from '../components/tasks/CreateTask.jsx' import {Route, IndexRoute} from 'react-router' +import TaskForm from '../components/tasks/TaskForm.jsx' +import SearchSerf from '../components/tasks/SearchSerf.jsx' const CreateUserWrapper = () => <CreateUser myType={"users"} /> const CreateSerfWrapper = () => <CreateUser myType={"serfs"} /> @@ -16,7 +18,10 @@ <Route path="users/new" component={CreateUserWrapper} /> // New Task - <Route path="users/:id/tasks/new" component={CreateTask} /> + <Route path="users/:id/tasks/new" component={CreateTask}> + <Route path="/search" component={SearchSerf}> + <IndexRoute component={TaskForm} /> + </Route> // New Serf <Route path="serfs/new" component={CreateSerfWrapper} />
8813352c1bf1c73a042b8c567ec171b1c47b6fe2
src/client.jsx
src/client.jsx
import React from 'react' import { render } from 'react-dom' import Hello from './components/Hello' render(<Hello name="Rodrigo" />, document.getElementById('root'))
import React from 'react' import { render } from 'react-dom' import Hello from './components/Hello' render(<Hello />, document.getElementById('root'))
Remove name prop on Hello instantiation
Remove name prop on Hello instantiation
JSX
mit
rwillrich/life-goals-tracker
--- +++ @@ -3,4 +3,4 @@ import Hello from './components/Hello' -render(<Hello name="Rodrigo" />, document.getElementById('root')) +render(<Hello />, document.getElementById('root'))
06e01c6eda96386e52f78992a4d8bdd136a3e5b1
src/sentry/static/sentry/app/views/groupDetails/chart.jsx
src/sentry/static/sentry/app/views/groupDetails/chart.jsx
var React = require("react"); var BarChart = require("../../components/barChart"); var PropTypes = require("../../proptypes"); var PureRenderMixin = require('react/addons').addons.PureRenderMixin; var GroupChart = React.createClass({ mixins: [PureRenderMixin], propTypes: { group: PropTypes.Group.isRequired, statsPeriod: React.PropTypes.string.isRequired }, render: function() { var group = this.props.group; var stats = group.stats[this.props.statsPeriod]; var points = stats.map((point) => { return {x: point[0], y: point[1]}; }); var className = "bar-chart group-chart " + (this.props.className || ''); var markers = []; if (this.props.firstSeen >= points[0].x) { markers.push({ label: "First seen", x: new Date(this.props.firstSeen).getTime() / 1000, className: "first-seen" }); } markers.push({ label: "Last seen", x: new Date(this.props.lastSeen).getTime() / 1000, className: "last-seen" }); return ( <div className={className}> <h6>{this.props.title}</h6> <BarChart points={points} markers={markers} className="sparkline" /> </div> ); } }); module.exports = GroupChart;
var React = require("react"); var BarChart = require("../../components/barChart"); var PropTypes = require("../../proptypes"); var PureRenderMixin = require('react/addons').addons.PureRenderMixin; var GroupChart = React.createClass({ mixins: [PureRenderMixin], propTypes: { group: PropTypes.Group.isRequired, statsPeriod: React.PropTypes.string.isRequired }, render: function() { var group = this.props.group; var stats = group.stats[this.props.statsPeriod]; var points = stats.map((point) => { return {x: point[0], y: point[1]}; }); var className = "bar-chart group-chart " + (this.props.className || ''); var markers = []; var firstSeenX = new Date(this.props.firstSeen).getTime() / 1000; if (firstSeenX >= points[0].x) { markers.push({ label: "First seen", x: firstSeenX, className: "first-seen" }); } markers.push({ label: "Last seen", x: new Date(this.props.lastSeen).getTime() / 1000, className: "last-seen" }); return ( <div className={className}> <h6>{this.props.title}</h6> <BarChart points={points} markers={markers} className="sparkline" /> </div> ); } }); module.exports = GroupChart;
Fix logic for checking if first seen should be visible
Fix logic for checking if first seen should be visible
JSX
bsd-3-clause
gencer/sentry,alexm92/sentry,BayanGroup/sentry,kevinlondon/sentry,kevinlondon/sentry,daevaorn/sentry,imankulov/sentry,ngonzalvez/sentry,gencer/sentry,BuildingLink/sentry,JamesMura/sentry,zenefits/sentry,alexm92/sentry,BayanGroup/sentry,fotinakis/sentry,jean/sentry,ngonzalvez/sentry,jean/sentry,nicholasserra/sentry,looker/sentry,jean/sentry,beeftornado/sentry,looker/sentry,looker/sentry,imankulov/sentry,korealerts1/sentry,fotinakis/sentry,jean/sentry,nicholasserra/sentry,mvaled/sentry,gencer/sentry,songyi199111/sentry,songyi199111/sentry,hongliang5623/sentry,Natim/sentry,beeftornado/sentry,imankulov/sentry,BuildingLink/sentry,ifduyue/sentry,korealerts1/sentry,felixbuenemann/sentry,zenefits/sentry,ifduyue/sentry,gencer/sentry,JackDanger/sentry,gencer/sentry,BuildingLink/sentry,JackDanger/sentry,Kryz/sentry,JackDanger/sentry,mitsuhiko/sentry,mvaled/sentry,korealerts1/sentry,hongliang5623/sentry,felixbuenemann/sentry,wong2/sentry,fotinakis/sentry,zenefits/sentry,fuziontech/sentry,looker/sentry,mvaled/sentry,zenefits/sentry,JamesMura/sentry,mvaled/sentry,Kryz/sentry,zenefits/sentry,mitsuhiko/sentry,alexm92/sentry,ifduyue/sentry,nicholasserra/sentry,mvaled/sentry,Kryz/sentry,felixbuenemann/sentry,JamesMura/sentry,Natim/sentry,BuildingLink/sentry,ngonzalvez/sentry,ifduyue/sentry,daevaorn/sentry,kevinlondon/sentry,fotinakis/sentry,BuildingLink/sentry,BayanGroup/sentry,JamesMura/sentry,fuziontech/sentry,hongliang5623/sentry,JamesMura/sentry,daevaorn/sentry,wong2/sentry,beeftornado/sentry,mvaled/sentry,wong2/sentry,jean/sentry,songyi199111/sentry,fuziontech/sentry,ifduyue/sentry,daevaorn/sentry,looker/sentry,Natim/sentry
--- +++ @@ -21,10 +21,11 @@ var className = "bar-chart group-chart " + (this.props.className || ''); var markers = []; - if (this.props.firstSeen >= points[0].x) { + var firstSeenX = new Date(this.props.firstSeen).getTime() / 1000; + if (firstSeenX >= points[0].x) { markers.push({ label: "First seen", - x: new Date(this.props.firstSeen).getTime() / 1000, + x: firstSeenX, className: "first-seen" }); }
6745f1569fcf77d620c456d70e450110e959f253
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">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p> </div> ) } }
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> ) } }
Refactor getUser into parent component and pass down as props
Refactor getUser into parent component and pass down as props
JSX
mit
taodav/MicroSerfs,taodav/MicroSerfs
--- +++ @@ -12,7 +12,8 @@ return( <div className="starter-template"> <h1>Welcome Back, {this.props.user.first_name}</h1> - <p className="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p> + <p className="lead">Get something done today.</p> + <Link to="/task/new" className="btn btn-primary">Create A Task</Link> </div> ) }
da544845ef1d3c29e46e924bcbc0b44d5698a8ee
app/client/components/sections/Goals/Goals.jsx
app/client/components/sections/Goals/Goals.jsx
Camino.Goals = React.createClass({ mixins: [ReactMeteorData], getMeteorData() { let sub = Meteor.subscribe("goals") return { isLoading: ! sub.ready(), goals: Goals.find({ 'userId': Meteor.userId() }).fetch() } }, showContent() { return ( <div className="goals section__container"> <GoalsList goals={this.data.goals} /> </div> ) }, showSpinner() { return <Spinner /> }, render() { return ( <div className="jumbotron"> <div className="container"> { this.data.isLoading ? this.showSpinner() : this.showContent() } </div> </div> ) } })
Camino.Goals = React.createClass({ mixins: [ReactMeteorData], // Fetch the data. Reactive and real-time by default. getMeteorData() { let sub = Meteor.subscribe("goals") return { isLoading: ! sub.ready(), goals: Goals.find({ 'userId': Meteor.userId() }).fetch() } }, // Pass the data to the view showGoals() { return ( <div className="goals section__container"> <GoalsList goals={this.data.goals} /> </div> ) }, // Show a loading spinner showSpinner() { return <Spinner /> }, // Render the Goals view render() { return ( <div className="jumbotron"> <div className="container"> { this.data.isLoading ? this.showSpinner() : this.showGoals() } </div> </div> ) } })
Add comments for the blog post
Add comments for the blog post
JSX
mit
fjaguero/camino,fjaguero/camino
--- +++ @@ -1,6 +1,7 @@ Camino.Goals = React.createClass({ mixins: [ReactMeteorData], + // Fetch the data. Reactive and real-time by default. getMeteorData() { let sub = Meteor.subscribe("goals") @@ -12,7 +13,8 @@ } }, - showContent() { + // Pass the data to the view + showGoals() { return ( <div className="goals section__container"> <GoalsList goals={this.data.goals} /> @@ -20,16 +22,18 @@ ) }, + // Show a loading spinner showSpinner() { return <Spinner /> }, + // Render the Goals view render() { return ( <div className="jumbotron"> <div className="container"> { - this.data.isLoading ? this.showSpinner() : this.showContent() + this.data.isLoading ? this.showSpinner() : this.showGoals() } </div> </div>
adcf969b71234642b0339eada6d0e5fa8d03def6
packages/lesswrong/components/posts/PostsItemTitle.jsx
packages/lesswrong/components/posts/PostsItemTitle.jsx
import { Components, registerComponent } from 'meteor/vulcan:core'; import React from 'react'; import Typography from '@material-ui/core/Typography'; import { withStyles } from '@material-ui/core/styles' import grey from '@material-ui/core/colors/grey'; const styles = theme => ({ root: { whiteSpace:"nowrap", overflow:"hidden", textOverflow:"ellipsis", width:"calc(100% - 80px)", [theme.breakpoints.down('xs')]: { paddingLeft: 2, }, '&:hover': { color:grey[500] } } }) const PostsItemTitle = ({post, classes}) => { return ( <Typography variant="title" className={classes.root}> {post.url && "[Link]"}{post.unlisted && "[Unlisted]"}{post.isEvent && "[Event]"} {post.title} </Typography> ) } PostsItemTitle.displayName = "PostsItemTitle"; registerComponent('PostsItemTitle', PostsItemTitle, withStyles(styles));
import { Components, registerComponent } from 'meteor/vulcan:core'; import React from 'react'; import Typography from '@material-ui/core/Typography'; import { withStyles } from '@material-ui/core/styles' import grey from '@material-ui/core/colors/grey'; const styles = theme => ({ root: { whiteSpace:"nowrap", overflow:"hidden", textOverflow:"ellipsis", [theme.breakpoints.down('xs')]: { paddingLeft: 2, }, '&:hover': { color:grey[500] } } }) const PostsItemTitle = ({post, classes}) => { return ( <Typography variant="title" className={classes.root}> {post.url && "[Link]"}{post.unlisted && "[Unlisted]"}{post.isEvent && "[Event]"} {post.title} </Typography> ) } PostsItemTitle.displayName = "PostsItemTitle"; registerComponent('PostsItemTitle', PostsItemTitle, withStyles(styles));
Remove width from title component
Remove width from title component
JSX
mit
Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2
--- +++ @@ -9,7 +9,6 @@ whiteSpace:"nowrap", overflow:"hidden", textOverflow:"ellipsis", - width:"calc(100% - 80px)", [theme.breakpoints.down('xs')]: { paddingLeft: 2, },
6153ad169f20900f59fbc345655fcb2f33acdba6
src/components/notes/Note.jsx
src/components/notes/Note.jsx
import React from 'react'; import './Note.scss'; import noteRepository from '../../data/NoteRepository'; export default class Note extends React.Component { remove() { noteRepository.remove(this.props, err => { // TODO: inform user if (err) throw err; }); } render() { return ( <div className="note"> <h1>{this.props.title}</h1> <pre>{this.props.content}</pre> <button type="button" onClick={() => this.remove()}> <i className="fa fa-trash-o" aria-hidden></i> </button> <button className="edit" type="button"> <i className="fa fa-pencil" aria-hidden></i> </button> </div> ); } } // TODO: see if stateless functional component can be reimplemented // export default function Note({ title, content }) { // const remove = () => { // console.log('hi'); // } // // return ( // <div className="note"> // <h1>{title}</h1> // <pre>{content}</pre> // <button type="button" onClick={remove()}> // <i className="fa fa-trash-o" aria-hidden></i> // </button> // <button className="edit" type="button"> // <i className="fa fa-pencil" aria-hidden></i> // </button> // </div> // ); // }
import React from 'react'; import './Note.scss'; import noteRepository from '../../data/NoteRepository'; export default class Note extends React.Component { remove() { noteRepository.remove(this.props, err => { // TODO: inform user if (err) throw err; }); } render() { return ( <div className="note" onClick={this.props.clickHandler}> <h1>{this.props.title}</h1> <pre>{this.props.content}</pre> <button type="button" onClick={() => this.remove()}> <i className="fa fa-trash-o" aria-hidden></i> </button> <button className="edit" type="button"> <i className="fa fa-pencil" aria-hidden></i> </button> </div> ); } } // TODO: see if stateless functional component can be reimplemented // export default function Note({ title, content }) { // const remove = () => { // console.log('hi'); // } // // return ( // <div className="note"> // <h1>{title}</h1> // <pre>{content}</pre> // <button type="button" onClick={remove()}> // <i className="fa fa-trash-o" aria-hidden></i> // </button> // <button className="edit" type="button"> // <i className="fa fa-pencil" aria-hidden></i> // </button> // </div> // ); // }
Add click handler to display modal when editing
Add click handler to display modal when editing
JSX
mit
emyarod/refuge,emyarod/refuge
--- +++ @@ -12,7 +12,7 @@ render() { return ( - <div className="note"> + <div className="note" onClick={this.props.clickHandler}> <h1>{this.props.title}</h1> <pre>{this.props.content}</pre> <button type="button" onClick={() => this.remove()}>
fe32202cde374ef0dbaf1747293d91b85c42b3d6
app/assets/javascripts/components/copy_link.jsx
app/assets/javascripts/components/copy_link.jsx
class CopyLink extends React.Component { constructor(props) { super(props); this.copyStreamLinkFn = this.copyStreamLink.bind(this); } copyStreamLink(event) { // Clipboard API is not mature yet // const copyEvent = new ClipboardEvent('copy', { dataType: 'text/plain', data: this.props.href }); // document.dispatchEvent(copyEvent); event.preventDefault(); const copyTextarea = document.querySelector(`#copyme-${this.props.identifier}`); copyTextarea.select(); document.execCommand('copy'); } render() { const textareaStyle = { background: 'transparent', border: 'none', boxShadow: 'none', height: '2em', left: 0, opacity: 0, outline: 'none', padding: 0, pointerEvents: 'none', position: 'fixed', top: 0, width: '2em' }; return ( <div className="copy-link" style={{ cursor: 'pointer' }} onClick={this.copyStreamLinkFn} title="Copy direct stream link…" > {this.props.text} <textarea id={`copyme-${this.props.identifier}`} style={textareaStyle} defaultValue={this.props.href} > </textarea> </div> ); } } CopyLink.defaultProps = { identifier: '' }; CopyLink.propTypes = { href: React.PropTypes.string, identifier: React.PropTypes.string, text: React.PropTypes.string };
class CopyLink extends React.Component { constructor(props) { super(props); this.copyStreamLinkFn = this.copyStreamLink.bind(this); } copyStreamLink(event) { // Clipboard API is not mature yet // const copyEvent = new ClipboardEvent('copy', { dataType: 'text/plain', data: this.props.href }); // document.dispatchEvent(copyEvent); event.preventDefault(); const copyTextarea = document.querySelector(`#copyme-${this.props.identifier}`); copyTextarea.select(); document.execCommand('copy'); } render() { const textareaStyle = { background: 'transparent', border: 'none', boxShadow: 'none', height: '2em', left: 0, opacity: 0, outline: 'none', padding: 0, pointerEvents: 'none', position: 'fixed', top: 0, width: '2em' }; return ( <a className="copy-link" href={this.props.href} onClick={this.copyStreamLinkFn} style={{ color: 'inherit', cursor: 'pointer' }} title="Copy direct stream link…" > {this.props.text} <textarea id={`copyme-${this.props.identifier}`} style={textareaStyle} defaultValue={this.props.href} > </textarea> </a> ); } } CopyLink.defaultProps = { identifier: '' }; CopyLink.propTypes = { href: React.PropTypes.string, identifier: React.PropTypes.string, text: React.PropTypes.string };
Make CopyLink an <a> tag
Make CopyLink an <a> tag Allows for right-click → copy link as well
JSX
mit
gyng/ireul-web,gyng/ireul-web,gyng/ireul-web
--- +++ @@ -31,10 +31,11 @@ }; return ( - <div + <a className="copy-link" - style={{ cursor: 'pointer' }} + href={this.props.href} onClick={this.copyStreamLinkFn} + style={{ color: 'inherit', cursor: 'pointer' }} title="Copy direct stream link…" > {this.props.text} @@ -44,7 +45,7 @@ defaultValue={this.props.href} > </textarea> - </div> + </a> ); } }
b9c457138a7d00fc248fe3966d620053d17fadae
src/js/components/nav.jsx
src/js/components/nav.jsx
const React = require('react'); const Icon = require('components/icon.jsx'); const Nav = React.createClass({ render: function() { return ( <div className='nav'> <div className='top'> <Icon type='navicon' size='lg' /> <a className='logo' href='/'> <Icon type='reddit' /> <span>reddit</span> </a> <a className='github-link' href='http://github.com/adamedgett/material-reddit'> <Icon type='github' size='lg' /> </a> </div> <div className='bottom'> <div className='sorts'> <a href='/hot'>hot</a> <a href='/new'>new</a> <a href='/rising'>rising</a> <a href='/controversial'>controversial</a> <a href='/top'>top</a> <a href='/guilded'>guilded</a> </div> </div> </div> ); } }); export default Nav;
const React = require('react'); const Icon = require('components/icon.jsx'); const Nav = React.createClass({ render: function() { return ( <div className='nav'> <div className='top'> <Icon type='navicon' size='lg' /> <a className='logo' href='/'> <Icon type='reddit' /> <span>reddit</span> </a> <a className='github-link' href='http://github.com/adamedgett/material-reddit'> <Icon type='github' size='lg' /> </a> </div> <div className='bottom'> <div className='sorts'> <a href='#hot'>hot</a> <a href='#new'>new</a> <a href='#rising'>rising</a> <a href='#controversial'>controversial</a> <a href='#top'>top</a> <a href='#guilded'>guilded</a> </div> </div> </div> ); } }); export default Nav;
Switch dummy anchors to ref fake hash links
Switch dummy anchors to ref fake hash links
JSX
mit
AdamEdgett/material-reddit,AdamEdgett/material-reddit,AdamEdgett/material-reddit
--- +++ @@ -19,12 +19,12 @@ <div className='bottom'> <div className='sorts'> - <a href='/hot'>hot</a> - <a href='/new'>new</a> - <a href='/rising'>rising</a> - <a href='/controversial'>controversial</a> - <a href='/top'>top</a> - <a href='/guilded'>guilded</a> + <a href='#hot'>hot</a> + <a href='#new'>new</a> + <a href='#rising'>rising</a> + <a href='#controversial'>controversial</a> + <a href='#top'>top</a> + <a href='#guilded'>guilded</a> </div> </div> </div>
6101516119e4bb0aed8e0f7c3dbb285c3f9abde6
src/components/user-feed.jsx
src/components/user-feed.jsx
import React from 'react' import {Link} from 'react-router' import PaginatedView from './paginated-view' import Feed from './feed' export default props => ( <div> {props.viewUser.blocked ? ( <div className="box-body"> <p>You have blocked <b>{props.viewUser.screenName}</b>, so all of their posts and comments are invisible to you.</p> <p><a onClick={()=>props.userActions.unban({username: props.viewUser.username, id: props.viewUser.id})}>Un-block</a></p> </div> ) : props.viewUser.isPrivate === '1' && !props.viewUser.subscribed && !props.viewUser.isItMe ? ( <div className="box-body"> <p><b>{props.viewUser.screenName}</b> has a private feed.</p> </div> ) : ( <PaginatedView> <Feed {...props} isInUserFeed={true}/> </PaginatedView> )} </div> )
import React from 'react' import {Link} from 'react-router' import PaginatedView from './paginated-view' import Feed from './feed' export default props => ( <div> {props.viewUser.blocked ? ( <div className="box-body"> <p>You have blocked <b>{props.viewUser.screenName}</b>, so all of their posts and comments are invisible to you.</p> <p><a onClick={()=>props.userActions.unban({username: props.viewUser.username, id: props.viewUser.id})}>Un-block</a></p> </div> ) : props.viewUser.isPrivate === '1' && !props.viewUser.subscribed && !props.viewUser.isItMe ? ( <div className="box-body"> <p><b>{props.viewUser.screenName}</b> has a private feed.</p> </div> ) : ( <PaginatedView {...props}> <Feed {...props} isInUserFeed={true}/> </PaginatedView> )} </div> )
Fix navigating to second page of user feed
Fix navigating to second page of user feed This fixes a JS error causing a full page reload when visitor clicks "Older items" on user feed. It's likely a regression after the recent router update.
JSX
mit
FreeFeed/freefeed-html-react,clbn/freefeed-gamma,ujenjt/freefeed-react-client,davidmz/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-html-react,FreeFeed/freefeed-html-react,ujenjt/freefeed-react-client,kadmil/freefeed-react-client,clbn/freefeed-gamma,FreeFeed/freefeed-react-client,davidmz/freefeed-react-client,ujenjt/freefeed-react-client,FreeFeed/freefeed-react-client,clbn/freefeed-gamma,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client,kadmil/freefeed-react-client
--- +++ @@ -16,7 +16,7 @@ <p><b>{props.viewUser.screenName}</b> has a private feed.</p> </div> ) : ( - <PaginatedView> + <PaginatedView {...props}> <Feed {...props} isInUserFeed={true}/> </PaginatedView> )}
b854abad2a7f7bc49290360d369f761a53988213
src/Modules/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/dnn-persona-bar-page-treeview/src/_PersonaBarPageIcon.jsx
src/Modules/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/dnn-persona-bar-page-treeview/src/_PersonaBarPageIcon.jsx
import React, {Component} from "react"; import { PropTypes } from "prop-types"; import "./styles.less"; import {PagesIcon, FolderIcon, TreeLinkIcon, TreeDraftIcon, TreePaperClip} from "dnn-svg-icons"; export default class PersonaBarPageIcon extends Component { /* eslint-disable react/no-danger */ selectIcon(number) { /*eslint-disable react/no-danger*/ switch(number) { case "normal": return (<div dangerouslySetInnerHTML={{ __html: PagesIcon }} />); case "file": return (<div dangerouslySetInnerHTML={{ __html: FolderIcon }} />); case "tab": case "url": return ( <div dangerouslySetInnerHTML={{ __html: TreeLinkIcon }} /> ); case "existing": return ( <div dangerouslySetInnerHTML={{ __html: TreeLinkIcon }} /> ); default: return (<div dangerouslySetInnerHTML={{ __html: PagesIcon }}/>); } } render() { return ( <div className={(this.props.selected ) ? "dnn-persona-bar-treeview-icon selected-item " : "dnn-persona-bar-treeview-icon"}> {this.selectIcon(this.props.iconType)} </div> ); } } PersonaBarPageIcon.propTypes = { iconType: PropTypes.number.isRequired, selected: PropTypes.bool.isRequired };
import React, {Component} from "react"; import { PropTypes } from "prop-types"; import "./styles.less"; import {PagesIcon, TreeLinkIcon, TreePaperClip} from "dnn-svg-icons"; export default class PersonaBarPageIcon extends Component { /* eslint-disable react/no-danger */ selectIcon(number) { /*eslint-disable react/no-danger*/ switch(number) { case "normal": return (<div dangerouslySetInnerHTML={{ __html: PagesIcon }} />); case "file": return (<div dangerouslySetInnerHTML={{ __html: TreePaperClip }} />); case "tab": case "url": return ( <div dangerouslySetInnerHTML={{ __html: TreeLinkIcon }} /> ); case "existing": return ( <div dangerouslySetInnerHTML={{ __html: TreeLinkIcon }} /> ); default: return (<div dangerouslySetInnerHTML={{ __html: PagesIcon }}/>); } } render() { return ( <div className={(this.props.selected ) ? "dnn-persona-bar-treeview-icon selected-item " : "dnn-persona-bar-treeview-icon"}> {this.selectIcon(this.props.iconType)} </div> ); } } PersonaBarPageIcon.propTypes = { iconType: PropTypes.number.isRequired, selected: PropTypes.bool.isRequired };
Change file icon from folder to clip
Change file icon from folder to clip
JSX
mit
bdukes/Dnn.Platform,robsiera/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Extensions,nvisionative/Dnn.Platform,bdukes/Dnn.Platform,dnnsoftware/Dnn.Platform,RichardHowells/Dnn.Platform,valadas/Dnn.Platform,valadas/Dnn.Platform,valadas/Dnn.Platform,nvisionative/Dnn.Platform,RichardHowells/Dnn.Platform,RichardHowells/Dnn.Platform,valadas/Dnn.Platform,robsiera/Dnn.Platform,mitchelsellers/Dnn.Platform,bdukes/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Extensions,robsiera/Dnn.Platform,dnnsoftware/Dnn.Platform,bdukes/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.Platform,RichardHowells/Dnn.Platform,EPTamminga/Dnn.Platform,EPTamminga/Dnn.Platform,EPTamminga/Dnn.Platform,dnnsoftware/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Extensions,mitchelsellers/Dnn.Platform,nvisionative/Dnn.Platform
--- +++ @@ -1,7 +1,7 @@ import React, {Component} from "react"; import { PropTypes } from "prop-types"; import "./styles.less"; -import {PagesIcon, FolderIcon, TreeLinkIcon, TreeDraftIcon, TreePaperClip} from "dnn-svg-icons"; +import {PagesIcon, TreeLinkIcon, TreePaperClip} from "dnn-svg-icons"; export default class PersonaBarPageIcon extends Component { /* eslint-disable react/no-danger */ @@ -13,7 +13,7 @@ return (<div dangerouslySetInnerHTML={{ __html: PagesIcon }} />); case "file": - return (<div dangerouslySetInnerHTML={{ __html: FolderIcon }} />); + return (<div dangerouslySetInnerHTML={{ __html: TreePaperClip }} />); case "tab": case "url":
511527bc26f79fb2be3afaaa9544195c81c731ba
src/components/viewer2d/guides/guide-vertical-streak.jsx
src/components/viewer2d/guides/guide-vertical-streak.jsx
import React, {PropTypes} from 'react'; export default function GuideVerticalStreak({width, height, guide}) { let step = guide.properties.get('step'); let colors; if (guide.properties.has('color')) { colors = [guide.properties.get('color')]; } else { colors = guide.properties.get('colors'); } let rendered = []; let i = 0; for (let x = 0; x <= height; x += step) { let color = colors[i % colors.length]; i++; rendered.push(<line key={x} x1={x} y1="0" x2={x} y2={height} strokeWidth="1" stroke={color}/>); } return (<g>{rendered}</g>); } GuideVerticalStreak.propTypes = { width: PropTypes.number.isRequired, height: PropTypes.number.isRequired, guide: PropTypes.object.isRequired }; GuideVerticalStreak.contextTypes = {};
import React, {PropTypes} from 'react'; export default function GuideVerticalStreak({width, height, guide}) { let step = guide.properties.get('step'); let colors; if (guide.properties.has('color')) { colors = [guide.properties.get('color')]; } else { colors = guide.properties.get('colors'); } let rendered = []; let i = 0; for (let x = 0; x <= width; x += step) { let color = colors[i % colors.length]; i++; rendered.push(<line key={x} x1={x} y1="0" x2={x} y2={height} strokeWidth="1" stroke={color}/>); } return (<g>{rendered}</g>); } GuideVerticalStreak.propTypes = { width: PropTypes.number.isRequired, height: PropTypes.number.isRequired, guide: PropTypes.object.isRequired }; GuideVerticalStreak.contextTypes = {};
Fix grids in 2D view
Fix grids in 2D view
JSX
mit
dearkaran/react-planner,vovance/3d-demo,cvdlab/react-planner
--- +++ @@ -12,7 +12,7 @@ let rendered = []; let i = 0; - for (let x = 0; x <= height; x += step) { + for (let x = 0; x <= width; x += step) { let color = colors[i % colors.length]; i++; rendered.push(<line key={x} x1={x} y1="0" x2={x} y2={height} strokeWidth="1" stroke={color}/>);
520f3892214bd563decd6e850cd2abfec7533812
demo/app.jsx
demo/app.jsx
/* global document:false */ import React from 'react'; import ReactDOM from 'react-dom'; import { Grid, Cell } from '../src/index'; class App extends React.Component { render() { return ( <div className="demo"> <Grid defaultCells={{width: 1 / 3}}> <Cell alignment={{horizontal: 'center', vertical: 'bottom'}}> <span>Oy Oy Oy</span> </Cell> <Cell> <span>Yo Yo Yo</span> </Cell> <Cell> <span>Oy Oy Oy</span> </Cell> </Grid> </div> ); } } const content = document.getElementById('content'); ReactDOM.render(<App/>, content);
/* global document:false */ import React from 'react'; import ReactDOM from 'react-dom'; import Radium, { StyleRoot } from 'radium'; import { Grid, Cell } from '../src/index'; @Radium class App extends React.Component { render() { return ( <StyleRoot className="demo"> <Grid defaultCells={{width: 1 / 3}} style={{height: '500px'}}> <Cell alignment={{horizontal: 'right', vertical: 'bottom'}}> <span>Oy Oy Oy</span> </Cell> <Cell> <span>Yo Yo Yo</span> </Cell> <Cell> <span>Oy Oy Oy</span> </Cell> </Grid> </StyleRoot> ); } } const content = document.getElementById('content'); ReactDOM.render(<App/>, content);
Add a StyleRoot for the demo page and set a height to make custom alignments more obvious
Add a StyleRoot for the demo page and set a height to make custom alignments more obvious
JSX
mit
FormidableLabs/radium-grid,FormidableLabs/radium-grid
--- +++ @@ -1,14 +1,16 @@ /* global document:false */ import React from 'react'; import ReactDOM from 'react-dom'; +import Radium, { StyleRoot } from 'radium'; import { Grid, Cell } from '../src/index'; +@Radium class App extends React.Component { render() { return ( - <div className="demo"> - <Grid defaultCells={{width: 1 / 3}}> - <Cell alignment={{horizontal: 'center', vertical: 'bottom'}}> + <StyleRoot className="demo"> + <Grid defaultCells={{width: 1 / 3}} style={{height: '500px'}}> + <Cell alignment={{horizontal: 'right', vertical: 'bottom'}}> <span>Oy Oy Oy</span> </Cell> <Cell> @@ -18,7 +20,7 @@ <span>Oy Oy Oy</span> </Cell> </Grid> - </div> + </StyleRoot> ); } }
7c48cbf84be4bc56bb165a74cf55cc820bd56dbb
src/app/components/selectable-box/SelectableBoxController.jsx
src/app/components/selectable-box/SelectableBoxController.jsx
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import SelectableBoxItem from './SelectableBoxItem'; const propTypes = { heading: PropTypes.string.isRequired, items: PropTypes.array, activeItem: PropTypes.object, handleItemClick: PropTypes.func, isUpdating: PropTypes.bool } export default class SelectableBoxController extends Component { constructor(props) { super(props); this.bindItemClick = this.bindItemClick.bind(this); } componentDidMount() { debugger; } bindItemClick(itemProps) { this.props.handleItemClick(itemProps); } renderList() { return ( <ul className="selectable-box__list"> { this.props.items.map((item, index) => { return ( <SelectableBoxItem key={index} {...item} isSelected={this.props.activeItem && item.id === this.props.activeItem.id} handleClick={this.bindItemClick} /> ) }) } </ul> ) } render() { return ( <div className="selectable-box"> <h2 className="selectable-box__heading"> Name { this.props.isUpdating && <span className="selectable-box__status loader"/> } </h2> { this.renderList() } </div> ) } } SelectableBoxController.propTypes = propTypes;
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import SelectableBoxItem from './SelectableBoxItem'; const propTypes = { heading: PropTypes.string.isRequired, items: PropTypes.array, activeItem: PropTypes.object, handleItemClick: PropTypes.func, isUpdating: PropTypes.bool } export default class SelectableBoxController extends Component { constructor(props) { super(props); this.bindItemClick = this.bindItemClick.bind(this); } bindItemClick(itemProps) { this.props.handleItemClick(itemProps); } renderList() { return ( <ul className="selectable-box__list"> { this.props.items.map((item, index) => { return ( <SelectableBoxItem key={index} {...item} isSelected={this.props.activeItem && item.id === this.props.activeItem.id} handleClick={this.bindItemClick} /> ) }) } </ul> ) } render() { return ( <div className="selectable-box"> <h2 className="selectable-box__heading"> Name { this.props.isUpdating && <span className="selectable-box__status loader"/> } </h2> { this.renderList() } </div> ) } } SelectableBoxController.propTypes = propTypes;
Remove debugger on mount of selectabl box controller
Remove debugger on mount of selectabl box controller Former-commit-id: aa11d5e05d99d3dc2c77f084ecbd7a9f8c06cec4 Former-commit-id: 0067d0e596b14865763d50f8ff060c73dd435162 Former-commit-id: bf1f080fa946965c4aee4d1e79668a772cd834c1
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -16,10 +16,6 @@ super(props); this.bindItemClick = this.bindItemClick.bind(this); - } - - componentDidMount() { - debugger; } bindItemClick(itemProps) {
9fa51ebb5408942479bbc6036ff24c44dcbee5fb
client/sections/profile/components/Description.jsx
client/sections/profile/components/Description.jsx
import React, { Component } from 'react'; class Description extends Component { constructor(props) { super(props); this.state = { showCount: false, }; } render() { const { description, updateDescription } = this.props; const charLimit = 100; var charCount = this.state.showCount ? (<div>{ 'Characters left: ' + (charLimit - this.refs.description.innerText.length) }</div>) : null; return ( <div className="profile-section"> <div className="profile-title">About Me</div> <div contentEditable="true" className="description" ref="description" onKeyUp={() => { updateDescription(this.refs.description.innerText); }} onKeyDown={(e) => { if (e.which === 13) { e.preventDefault(); this.refs.description.blur(); } if (this.refs.description.innerText.length >= charLimit && e.which !== 8) { e.preventDefault(); } }} onPaste={(e) => { e.preventDefault(); }} onFocus={() => { this.setState({ showCount: true, }); }} onBlur={() => { this.setState({ showCount: false, }); }} > {description} </div> {charCount} </div> ); } } export default Description;
import React, { Component } from 'react'; class Description extends Component { constructor(props) { super(props); this.state = { showCount: false, }; } render() { const { description, updateDescription } = this.props; const charLimit = 255; var charCount = this.state.showCount ? (<div>{ 'Characters left: ' + (charLimit - this.refs.description.innerText.length) }</div>) : null; return ( <div className="profile-section"> <div className="profile-title">About Me</div> <div contentEditable="true" className="description" ref="description" onKeyUp={() => { updateDescription(this.refs.description.innerText); }} onKeyDown={(e) => { if (e.which === 13) { e.preventDefault(); this.refs.description.blur(); } if (this.refs.description.innerText.length >= charLimit && e.which !== 8) { e.preventDefault(); } }} onPaste={(e) => { e.preventDefault(); }} onFocus={() => { this.setState({ showCount: true, }); }} onBlur={() => { this.setState({ showCount: false, }); }} > {description} </div> {charCount} </div> ); } } export default Description;
Change char limit to 255
Change char limit to 255
JSX
mit
VictoriousResistance/iDioma,VictoriousResistance/iDioma
--- +++ @@ -9,7 +9,7 @@ } render() { const { description, updateDescription } = this.props; - const charLimit = 100; + const charLimit = 255; var charCount = this.state.showCount ? (<div>{ 'Characters left: ' + (charLimit - this.refs.description.innerText.length) }</div>) : null; return ( <div className="profile-section"> @@ -48,7 +48,7 @@ > {description} </div> - + {charCount} </div>
d6a4962910e3aa3b8e38242a83bead81bf4f32f5
packages/vulcan-debug/lib/components/Routes.jsx
packages/vulcan-debug/lib/components/Routes.jsx
import React from 'react'; import { registerComponent, Components, Routes } from 'meteor/vulcan:lib'; import { Link } from 'react-router'; console.log(Object.values(Routes)) const RoutePath = ({ document }) => <Link to={document.path}>{document.path}</Link> const RoutesDashboard = props => <div className="routes"> <Components.Datatable showSearch={false} showNew={false} showEdit={false} data={Object.values(Routes)} columns={[ 'name', { name: 'path', component: RoutePath }, 'componentName', ]} /> </div> registerComponent('Routes', RoutesDashboard);
import React from 'react'; import { registerComponent, Components, Routes } from 'meteor/vulcan:lib'; import { Link } from 'react-router'; const RoutePath = ({ document }) => <Link to={document.path}>{document.path}</Link> const RoutesDashboard = props => <div className="routes"> <Components.Datatable showSearch={false} showNew={false} showEdit={false} data={Object.values(Routes)} columns={[ 'name', { name: 'path', component: RoutePath }, 'componentName', ]} /> </div> registerComponent('Routes', RoutesDashboard);
Remove console log from routes dashboard
Remove console log from routes dashboard
JSX
mit
Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,VulcanJS/Vulcan,VulcanJS/Vulcan,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2
--- +++ @@ -2,12 +2,10 @@ import { registerComponent, Components, Routes } from 'meteor/vulcan:lib'; import { Link } from 'react-router'; -console.log(Object.values(Routes)) - -const RoutePath = ({ document }) => +const RoutePath = ({ document }) => <Link to={document.path}>{document.path}</Link> -const RoutesDashboard = props => +const RoutesDashboard = props => <div className="routes"> <Components.Datatable showSearch={false} @@ -15,12 +13,12 @@ showEdit={false} data={Object.values(Routes)} columns={[ - 'name', + 'name', { name: 'path', component: RoutePath - }, - 'componentName', + }, + 'componentName', ]} /> </div>
7453bd0218beaa9643d1e782ca1f01145cea610f
app/javascript/lca/containers/themeContainer.jsx
app/javascript/lca/containers/themeContainer.jsx
import React from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles' import { switchTheme } from '../ducks/actions.js' const themes = { light: createMuiTheme({ }), dark: createMuiTheme({ palette: { type: 'dark', }, }) } class ThemeContainer extends React.Component { constructor(props) { super(props) this.handleStorageChange = this.handleStorageChange.bind(this) } componentDidMount() { window.addEventListener('storage', this.handleStorageChange) } componentWillUnmount() { window.removeEventListener('storage', this.handleStorageChange) } handleStorageChange(e) { if (e.key != 'theme') return this.props.switchTheme(e.newValue) } render() { const { theme, children } = this.props return <MuiThemeProvider theme={ themes[theme] }> { children } </MuiThemeProvider> } } ThemeContainer.propTypes = { theme: PropTypes.string, children: PropTypes.node, switchTheme: PropTypes.func, } function mapStateToProps(state) { return { theme: state.app.theme, } } function mapDispatchToProps(dispatch) { return { switchTheme: (theme) => dispatch(switchTheme(theme)) } } export default connect(mapStateToProps, mapDispatchToProps)(ThemeContainer)
import React from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles' import { switchTheme } from '../ducks/actions.js' const overrides = { MuiSelect: { selectMenu: { overflow: 'hidden', }, }, } const themes = { light: createMuiTheme({ overrides: overrides, }), dark: createMuiTheme({ palette: { type: 'dark', }, overrides: overrides }) } class ThemeContainer extends React.Component { constructor(props) { super(props) this.handleStorageChange = this.handleStorageChange.bind(this) } componentDidMount() { window.addEventListener('storage', this.handleStorageChange) } componentWillUnmount() { window.removeEventListener('storage', this.handleStorageChange) } handleStorageChange(e) { if (e.key != 'theme') return this.props.switchTheme(e.newValue) } render() { const { theme, children } = this.props return <MuiThemeProvider theme={ themes[theme] }> { children } </MuiThemeProvider> } } ThemeContainer.propTypes = { theme: PropTypes.string, children: PropTypes.node, switchTheme: PropTypes.func, } function mapStateToProps(state) { return { theme: state.app.theme, } } function mapDispatchToProps(dispatch) { return { switchTheme: (theme) => dispatch(switchTheme(theme)) } } export default connect(mapStateToProps, mapDispatchToProps)(ThemeContainer)
Fix for select fields vertical alignment in Firefox
Fix for select fields vertical alignment in Firefox
JSX
agpl-3.0
makzu/lotcastingatemi,makzu/lotcastingatemi,makzu/lotcastingatemi,makzu/lotcastingatemi,makzu/lotcastingatemi
--- +++ @@ -6,13 +6,23 @@ import { switchTheme } from '../ducks/actions.js' +const overrides = { + MuiSelect: { + selectMenu: { + overflow: 'hidden', + }, + }, +} + const themes = { light: createMuiTheme({ + overrides: overrides, }), dark: createMuiTheme({ palette: { type: 'dark', }, + overrides: overrides }) }
5f23f4f3405ca89c2cd4acc08e45a0a30011731a
src/jsx/templates.jsx
src/jsx/templates.jsx
var BpmTable = React.createClass({ propTypes: { bpm_info: React.PropTypes.object.isRequired, }, componentDidMount: function () { $(document.body).on("keydown", this.handleKeyDown); }, componentWillUnmount: function () { $(document.body).off("keydown", this.handleKeyDown); }, render: function () { return ( <div> <p>BPM: {this.props.bpm_info.bpm}</p> <p>Timing Taps: {this.props.bpm_info.timingTaps }</p> </div> ); }, handleKeyDown: function () { console.log("key down"); }, }); var BPM_INFO = { bpm: 120, timingTaps: 20, }; var bpmTable = React.render( <BpmTable bpm_info={BPM_INFO} />, document.getElementById("content") );
var BpmTable = React.createClass({ propTypes: { initialBpm: React.PropTypes.number.isRequired, initialTimingTaps: React.PropTypes.number.isRequired, }, getInitialState: function () { return { bpm: this.props.initialBpm, timingTaps: this.props.initialTimingTaps, }; }, componentDidMount: function () { $(document.body).on("keydown", this.tick); }, componentWillUnmount: function () { $(document.body).off("keydown", this.tick); }, render: function () { return ( <div> <p>BPM: {this.state.bpm}</p> <p>Timing Taps: {this.state.timingTaps }</p> </div> ); }, tick: function () { }, }); var initialBpm = 120; var initialTimingTaps = 20; var bpmTable = React.render( <BpmTable initialBpm={initialBpm} initialTimingTaps={initialTimingTaps} />, document.getElementById("content") );
Update the bpm table: use state
Update the bpm table: use state
JSX
mit
khwang/plum,khwang/plum
--- +++ @@ -1,32 +1,36 @@ var BpmTable = React.createClass({ propTypes: { - bpm_info: React.PropTypes.object.isRequired, + initialBpm: React.PropTypes.number.isRequired, + initialTimingTaps: React.PropTypes.number.isRequired, + }, + getInitialState: function () { + return { + bpm: this.props.initialBpm, + timingTaps: this.props.initialTimingTaps, + }; }, componentDidMount: function () { - $(document.body).on("keydown", this.handleKeyDown); + $(document.body).on("keydown", this.tick); }, componentWillUnmount: function () { - $(document.body).off("keydown", this.handleKeyDown); + $(document.body).off("keydown", this.tick); }, render: function () { return ( <div> - <p>BPM: {this.props.bpm_info.bpm}</p> - <p>Timing Taps: {this.props.bpm_info.timingTaps }</p> + <p>BPM: {this.state.bpm}</p> + <p>Timing Taps: {this.state.timingTaps }</p> </div> ); }, - handleKeyDown: function () { - console.log("key down"); + tick: function () { }, }); -var BPM_INFO = { - bpm: 120, - timingTaps: 20, -}; +var initialBpm = 120; +var initialTimingTaps = 20; var bpmTable = React.render( - <BpmTable bpm_info={BPM_INFO} />, + <BpmTable initialBpm={initialBpm} initialTimingTaps={initialTimingTaps} />, document.getElementById("content") );
fe4e24e445b91c12e7d0215369c77a6fe3ae10f4
src/components/Parameters.jsx
src/components/Parameters.jsx
/* global __WEBPACK__ */ import React from 'react'; import NumberEditor from 'react-number-editor'; if (__WEBPACK__) { require('../../style/components/Parameters.less'); } class Parameters extends React.Component { render() { return ( <div className="parameters"> <label> How many primes do you want to show? <NumberEditor min={1} max={100000} step={1} decimals={0} {...this.props} /> </label> </div> ); } } Parameters.propTypes = { initialValue: React.PropTypes.number }; export default Parameters;
/* global __WEBPACK__ */ import React from 'react'; import NumberEditor from 'react-number-editor'; if (__WEBPACK__) { require('../../style/components/Parameters.less'); } class Parameters extends React.Component { render() { return ( <div className="parameters"> <label> How many primes do you want to show? <NumberEditor min={1} max={100000} step={1} decimals={0} {...this.props} /> </label> <span className="glyphicon glyphicon-question-sign" title="Double-click to manually edit the number" style={{marginLeft: '8px'}}></span> </div> ); } } Parameters.propTypes = { initialValue: React.PropTypes.number }; export default Parameters;
Add help icon with title tooltip text for number editor
Add help icon with title tooltip text for number editor
JSX
cc0-1.0
acusti/primal-multiplication,acusti/primal-multiplication
--- +++ @@ -12,6 +12,7 @@ <label> How many primes do you want to show? <NumberEditor min={1} max={100000} step={1} decimals={0} {...this.props} /> </label> + <span className="glyphicon glyphicon-question-sign" title="Double-click to manually edit the number" style={{marginLeft: '8px'}}></span> </div> ); }
552471d37ea4b20f9d816f337be2506435e32d50
src/components/notes/Note.jsx
src/components/notes/Note.jsx
import React from 'react'; import './Note.scss'; import noteRepository from '../../data/NoteRepository'; export default class Note extends React.Component { remove() { noteRepository.remove(this.props, err => { // TODO: inform user if (err) throw err; }); } render() { // console.log(this.props); return ( <div className="note"> <h1>{this.props.title}</h1> <pre>{this.props.content}</pre> <button type="button" onClick={() => this.remove()}> <i className="fa fa-trash-o" aria-hidden></i> </button> <button className="edit" type="button"> <i className="fa fa-pencil" aria-hidden></i> </button> </div> ); } } // export default function Note({ title, content }) { // const remove = () => { // console.log('hi'); // } // // return ( // <div className="note"> // <h1>{title}</h1> // <pre>{content}</pre> // <button type="button" onClick={remove()}> // <i className="fa fa-trash-o" aria-hidden></i> // </button> // <button className="edit" type="button"> // <i className="fa fa-pencil" aria-hidden></i> // </button> // </div> // ); // }
import React from 'react'; import './Note.scss'; import noteRepository from '../../data/NoteRepository'; export default class Note extends React.Component { remove() { noteRepository.remove(this.props, err => { // TODO: inform user if (err) throw err; }); } render() { return ( <div className="note"> <h1>{this.props.title}</h1> <pre>{this.props.content}</pre> <button type="button" onClick={() => this.remove()}> <i className="fa fa-trash-o" aria-hidden></i> </button> <button className="edit" type="button"> <i className="fa fa-pencil" aria-hidden></i> </button> </div> ); } } // TODO: see if stateless functional component can be reimplemented // export default function Note({ title, content }) { // const remove = () => { // console.log('hi'); // } // // return ( // <div className="note"> // <h1>{title}</h1> // <pre>{content}</pre> // <button type="button" onClick={remove()}> // <i className="fa fa-trash-o" aria-hidden></i> // </button> // <button className="edit" type="button"> // <i className="fa fa-pencil" aria-hidden></i> // </button> // </div> // ); // }
Add TODO and remove comment
Add TODO and remove comment
JSX
mit
emyarod/refuge,emyarod/refuge
--- +++ @@ -11,7 +11,6 @@ } render() { - // console.log(this.props); return ( <div className="note"> <h1>{this.props.title}</h1> @@ -27,6 +26,7 @@ } } +// TODO: see if stateless functional component can be reimplemented // export default function Note({ title, content }) { // const remove = () => { // console.log('hi');
0ec79890b7e705654e5a3a5c91722d26179c56ab
generators/app/templates/src/modules/app/components/App.jsx
generators/app/templates/src/modules/app/components/App.jsx
import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { compose } from 'redux' import pure from 'recompose/pure' import * as select from '../selectors' const propTypes = { children: PropTypes.node.isRequired, loading: PropTypes.bool.isRequired, } const App = ({ children, ...props }) => <main> { React.Children.map(children, (child) => React.cloneElement(child, props)) } </main> App.propTypes = propTypes const mapStateToProps = (state) => ({ loading: select.loading(state), }) export default compose( connect(mapStateToProps), pure )(App)
import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { compose } from 'redux' import pure from 'recompose/pure' import * as selectors from '../selectors' const propTypes = { children: PropTypes.node.isRequired, loading: PropTypes.bool.isRequired, } const App = ({ children, ...props }) => <main> { React.Children.map(children, (child) => React.cloneElement(child, props)) } </main> App.propTypes = propTypes const mapStateToProps = (state) => ({ loading: selectors.loading(state), }) export default compose( connect(mapStateToProps), pure )(App)
Use selectors instead of select
Use selectors instead of select
JSX
mit
127labs/generator-duxedo,127labs/generator-duxedo
--- +++ @@ -3,7 +3,7 @@ import { compose } from 'redux' import pure from 'recompose/pure' -import * as select from '../selectors' +import * as selectors from '../selectors' const propTypes = { children: PropTypes.node.isRequired, @@ -21,7 +21,7 @@ App.propTypes = propTypes const mapStateToProps = (state) => ({ - loading: select.loading(state), + loading: selectors.loading(state), }) export default compose(
68f92848cc694ffb58f949b6503000a746d1629c
src/web/components/Layout/index.jsx
src/web/components/Layout/index.jsx
import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import Header from './Header' import Sidebar from './Sidebar' import SidebarFooter from './SidebarFooter' import LicenseComponent from '~/components/License' import AboutComponent from '~/components/About' import GuidedTour from '~/components/Tour' import actions from '~/actions' import getters from '~/stores/getters' import { connect } from 'nuclear-js-react-addons' import style from './style.scss' @connect(props => ({ UI: getters.UI })) class Layout extends React.Component { static contextTypes = { reactor: PropTypes.object.isRequired } constructor(props, context) { super(props, context) } render() { return ( <div className={classnames('wrapper', 'bp-wrapper')}> <Sidebar> <Header /> <section className={classnames(style.container, 'bp-container')}>{this.props.children}</section> </Sidebar> <SidebarFooter /> <GuidedTour opened={window.SHOW_GUIDED_TOUR}/> <LicenseComponent opened={this.props.UI.get('licenseModalOpened')} /> <AboutComponent opened={this.props.UI.get('aboutModalOpened')} /> </div> ) } } export default Layout
import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import Header from './Header' import Sidebar from './Sidebar' import SidebarFooter from './SidebarFooter' import LicenseComponent from '~/components/License' import AboutComponent from '~/components/About' import GuidedTour from '~/components/Tour' import actions from '~/actions' import getters from '~/stores/getters' import { connect } from 'nuclear-js-react-addons' import style from './style.scss' @connect(props => ({ UI: getters.UI })) class Layout extends React.Component { static contextTypes = { reactor: PropTypes.object.isRequired } constructor(props, context) { super(props, context) } componentDidMount() { const viewMode = this.props.location.query && this.props.location.query.viewMode setImmediate(() => { actions.viewModeChanged(viewMode ? viewMode : 0) }) } render() { if (this.props.UI.get('viewMode') < 0) { return null } const hasHeader = this.props.UI.get('viewMode') <= 2 const classNames = classnames({ [style.container]: hasHeader, 'bp-container': hasHeader }) return ( <div className={classnames('wrapper', 'bp-wrapper')}> <Sidebar> <Header /> <section className={classNames}>{this.props.children}</section> </Sidebar> <SidebarFooter /> <GuidedTour opened={window.SHOW_GUIDED_TOUR}/> <LicenseComponent opened={this.props.UI.get('licenseModalOpened')} /> <AboutComponent opened={this.props.UI.get('aboutModalOpened')} /> </div> ) } } Layout.contextTypes = { reactor: PropTypes.object.isRequired } export default Layout
Add class to container to adapted render when there's no header
Add class to container to adapted render when there's no header
JSX
agpl-3.0
botpress/botpress,botpress/botpress,botpress/botpress,botpress/botpress
--- +++ @@ -28,12 +28,30 @@ super(props, context) } + componentDidMount() { + const viewMode = this.props.location.query && this.props.location.query.viewMode + + setImmediate(() => { + actions.viewModeChanged(viewMode ? viewMode : 0) + }) + } + render() { + if (this.props.UI.get('viewMode') < 0) { + return null + } + + const hasHeader = this.props.UI.get('viewMode') <= 2 + const classNames = classnames({ + [style.container]: hasHeader, + 'bp-container': hasHeader + }) + return ( <div className={classnames('wrapper', 'bp-wrapper')}> <Sidebar> <Header /> - <section className={classnames(style.container, 'bp-container')}>{this.props.children}</section> + <section className={classNames}>{this.props.children}</section> </Sidebar> <SidebarFooter /> <GuidedTour opened={window.SHOW_GUIDED_TOUR}/> @@ -44,4 +62,8 @@ } } +Layout.contextTypes = { + reactor: PropTypes.object.isRequired +} + export default Layout
630396b88c81343b62a113435639dd5445f97222
client/components/Cart/Cart.jsx
client/components/Cart/Cart.jsx
import React from 'react'; import Drawer from 'material-ui/Drawer'; import Badge from 'material-ui/Badge'; import MenuItem from 'material-ui/MenuItem'; import IconButton from 'material-ui/IconButton'; import ShoppingCartIcon from 'material-ui/svg-icons/action/shopping-cart'; // import styles from './Cart.css'; const iconStyles = { marginRight: 24, }; class Cart extends React.Component { constructor(props) { super(props); this.state = {open: false}; this.handleToggle = this.handleToggle.bind(this); } handleToggle = () => this.setState({open: !this.state.open}); handleClose = () => this.setState({open: false}); render() { return ( <div onClick={this.handleToggle}> <Badge badgeContent={4} secondary={true} badgeStyle={{top: 12, right: 12}}> <IconButton tooltip="Cart"> <ShoppingCartIcon style={iconStyles} /> </IconButton> </Badge> <Drawer docked={false} openSecondary={true} width={500} open={this.state.open} onRequestChange={(open) => this.setState({open})} > <MenuItem primaryText="Item 1" /> <MenuItem primaryText="Item 2" /> <MenuItem primaryText="Item 3" /> <MenuItem primaryText="Item 4" /> </Drawer> </div> ); } } Cart.propTypes = { location: React.PropTypes.object.isRequired }; export default Cart;
import React from 'react'; import Drawer from 'material-ui/Drawer'; import Badge from 'material-ui/Badge'; import MenuItem from 'material-ui/MenuItem'; import IconButton from 'material-ui/IconButton'; import ShoppingCartIcon from 'material-ui/svg-icons/action/shopping-cart'; // import styles from './Cart.css'; const iconStyles = { marginRight: 24, }; class Cart extends React.Component { constructor(props) { super(props); this.state = {open: false}; this.handleToggle = this.handleToggle.bind(this); } handleToggle = () => this.setState({open: !this.state.open}); handleClose = () => this.setState({open: false}); render() { return ( <div onClick={this.handleToggle}> <Badge badgeContent={4} secondary={true} badgeStyle={{top: 12, right: 12}}> <IconButton tooltip="Cart"> <ShoppingCartIcon style={iconStyles} /> </IconButton> </Badge> <Drawer docked={false} openSecondary={true} width={500} open={this.state.open} onRequestChange={(open) => this.setState({open})} > <MenuItem primaryText="Item 1" /> <MenuItem primaryText="Item 2" /> <MenuItem primaryText="Item 3" /> <MenuItem primaryText="Item 4" /> </Drawer> </div> ); } } Cart.propTypes = { //location: React.PropTypes.object.isRequired }; export default Cart;
Remove location required prop for warning message
Remove location required prop for warning message
JSX
mit
ntoung/beer.ly,ntoung/beer.ly
--- +++ @@ -50,7 +50,7 @@ } Cart.propTypes = { - location: React.PropTypes.object.isRequired + //location: React.PropTypes.object.isRequired }; export default Cart;
75634dc9edffbc223c5e93f0c8f45782a48083ae
app/assets/javascripts/components/common/academic_system.jsx
app/assets/javascripts/components/common/academic_system.jsx
import React from 'react'; const createReactClass = require('create-react-class'); const AcademicSystem = createReactClass({ getInitialState: function () { this.props.updateCourseProps({ academic_system: this.props.value || 'semester' }); return { selectedOption: this.props.value || 'semester' }; }, handleOptionChange: function (changeEvent) { this.setState({ selectedOption: changeEvent.target.value }); this.props.updateCourseProps({ academic_system: changeEvent.target.value }); }, render: function () { const options = ['semester', 'quarter', 'other']; let i; const academic_system = []; for (i = 0; i < options.length; i += 1) { academic_system.push( <label className="radio-inline"> <input type="radio" name="academic_system" value={options[i]} style={{ display: 'inline-block', width: '30px' }} defaultChecked={this.state.selectedOption === options[i]} onChange={this.handleOptionChange} /> {options[i]} </label>); } return ( <div> {academic_system} </div> ); } }); export default AcademicSystem;
import React from 'react'; const createReactClass = require('create-react-class'); const AcademicSystem = createReactClass({ getInitialState: function () { this.props.updateCourseProps({ academic_system: this.props.value || 'semester' }); return { selectedOption: this.props.value || 'semester' }; }, handleOptionChange: function (changeEvent) { this.setState({ selectedOption: changeEvent.target.value }); this.props.updateCourseProps({ academic_system: changeEvent.target.value }); }, render: function () { const options = ['semester', 'quarter', 'other']; let i; const academic_system = []; for (i = 0; i < options.length; i += 1) { academic_system.push( <label className="radio-inline" key={options[i]}> <input type="radio" name="academic_system" value={options[i]} style={{ display: 'inline-block', width: '30px' }} defaultChecked={this.state.selectedOption === options[i]} onChange={this.handleOptionChange} /> {options[i]} </label>); } return ( <div> {academic_system} </div> ); } }); export default AcademicSystem;
Fix React missing key warning
Fix React missing key warning
JSX
mit
WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard
--- +++ @@ -24,7 +24,7 @@ const academic_system = []; for (i = 0; i < options.length; i += 1) { academic_system.push( - <label className="radio-inline"> + <label className="radio-inline" key={options[i]}> <input type="radio" name="academic_system"
6b6dd50a41245f210acd90d5398957838958aa8a
app/javascript/app/components/card/card-row/card-row-component.jsx
app/javascript/app/components/card/card-row/card-row-component.jsx
import React from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import styles from './card-row-styles.scss'; const CardRowComponent = ({ rowData }) => ( <React.Fragment> {rowData && ( <div className={cx(styles.cardRow, { [styles.cardRowWithSubtitle]: rowData.subtitle })} > <div className={styles.title}>{rowData.title || ''}</div> {rowData.subtitle && <p className={styles.title}>{rowData.subtitle}</p>} <p className={styles.text} // eslint-disable-next-line react/no-danger dangerouslySetInnerHTML={{ __html: rowData.value || '' }} /> </div> )} </React.Fragment> ); CardRowComponent.propTypes = { rowData: PropTypes.shape({ title: PropTypes.string, value: PropTypes.any }) }; export default CardRowComponent;
import React from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import styles from './card-row-styles.scss'; const CardRowComponent = ({ rowData }) => ( <React.Fragment> {rowData && ( <div className={cx(styles.cardRow, { [styles.cardRowWithSubtitle]: rowData.subtitle })} > <div className={styles.title}>{rowData.title || ''}</div> {rowData.subtitle && <p className={styles.title}>{rowData.subtitle}</p>} <p className={styles.text} // eslint-disable-next-line react/no-danger dangerouslySetInnerHTML={{ __html: rowData.value || '' }} /> </div> )} </React.Fragment> ); CardRowComponent.propTypes = { rowData: PropTypes.shape({ title: PropTypes.string, subtitle: PropTypes.string, value: PropTypes.any }) }; export default CardRowComponent;
Update PropTypes of CardRow component
Update PropTypes of CardRow component
JSX
mit
Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch
--- +++ @@ -28,6 +28,7 @@ CardRowComponent.propTypes = { rowData: PropTypes.shape({ title: PropTypes.string, + subtitle: PropTypes.string, value: PropTypes.any }) };
e1a5bc5cd864f8f623f643c9fc9183b6a0603b4c
docs/components/layout/Grid.jsx
docs/components/layout/Grid.jsx
/* jshint node: true, esnext: true */ "use strict"; var React = require('react'); var ReactCSS = require('reactcss'); var bounds = require('react-bounds'); class Grid extends ReactCSS.Component { constructor() { super(); this.calculateBounds = this.calculateBounds.bind(this); } classes() { return { 'default': { grid: { position: 'relative' }, left: { position: 'absolute', width: '130px' }, main: { paddingLeft: '150px' } }, 'no-sidebar': { left: { display: 'none' }, main: { paddingLeft: '0' } } }; } styles() { return this.css(this.calculateBounds()); } calculateBounds() { var activeStyles = {}; var bounds = this.props.activeBounds; if (bounds) { for (var bound of bounds) { activeStyles[bound] = true; } } return activeStyles; } static bounds() { return { 'no-sidebar': [0, 500] // 'no-sidebar': { min: 0, max: 500, type: 'width' } }; } render(){ // console.log(this.props.width); // console.log(this.props.activeBounds); return ( <div is="grid"> <div is="left">{ this.props.children[0] }</div> <div is="main">{ this.props.children[1] }</div> </div> ) } }; module.exports = bounds(Grid);
/* jshint node: true, esnext: true */ "use strict"; var React = require('react'); var ReactCSS = require('reactcss'); var context = require('react-context'); class Grid extends ReactCSS.Component { constructor() { super(); } classes() { return { 'default': { grid: { position: 'relative' }, left: { position: 'absolute', width: '130px' }, main: { paddingLeft: '150px' } }, 'no-sidebar': { left: { display: 'none' }, main: { paddingLeft: '0' } } }; } styles() { return this.css({ 'no-sidebar': this.context.width < 500 }); } render(){ return ( <div is="grid"> <div is="left">{ this.props.children[0] }</div> <div is="main">{ this.props.children[1] }</div> </div> ) } }; Grid.contextTypes = context.subscribe(['width']); module.exports = Grid;
Change width back to context
Change width back to context
JSX
mit
casesandberg/react-context,casesandberg/react-context,dallonf/react-context,dallonf/react-context,edge/react-context,edge/react-context,clkao/react-context,jdelStrother/react-context,sjmarshy/react-context,jdelStrother/react-context
--- +++ @@ -3,14 +3,14 @@ var React = require('react'); var ReactCSS = require('reactcss'); -var bounds = require('react-bounds'); +var context = require('react-context'); class Grid extends ReactCSS.Component { + + constructor() { super(); - - this.calculateBounds = this.calculateBounds.bind(this); } classes() { @@ -39,32 +39,12 @@ } styles() { - return this.css(this.calculateBounds()); - } - - calculateBounds() { - var activeStyles = {}; - - var bounds = this.props.activeBounds; - if (bounds) { - for (var bound of bounds) { - activeStyles[bound] = true; - } - } - - return activeStyles; - } - - static bounds() { - return { - 'no-sidebar': [0, 500] - // 'no-sidebar': { min: 0, max: 500, type: 'width' } - }; + return this.css({ + 'no-sidebar': this.context.width < 500 + }); } render(){ - // console.log(this.props.width); - // console.log(this.props.activeBounds); return ( <div is="grid"> <div is="left">{ this.props.children[0] }</div> @@ -74,4 +54,6 @@ } }; -module.exports = bounds(Grid); +Grid.contextTypes = context.subscribe(['width']); + +module.exports = Grid;
ceba15647c043d29a4c6549f2cc1845759d2cadc
packages/vulcan-ui-bootstrap/lib/components/forms/Select.jsx
packages/vulcan-ui-bootstrap/lib/components/forms/Select.jsx
import React from 'react'; import { intlShape } from 'meteor/vulcan:i18n'; import Form from 'react-bootstrap/Form'; import { Components, registerComponent } from 'meteor/vulcan:core'; // copied from vulcan:forms/utils.js to avoid extra dependency const getFieldType = datatype => datatype && datatype[0].type; const SelectComponent = ({ refFunction, inputProperties, itemProperties, datatype }, { intl }) => { const noneOption = { label: intl.formatMessage({ id: 'forms.select_option' }), value: getFieldType(datatype) === String || getFieldType(datatype) === Number ? '' : null, // depending on field type, empty value can be '' or null disabled: true, }; let otherOptions = Array.isArray(inputProperties.options) && inputProperties.options.length ? inputProperties.options : []; const options = [noneOption, ...otherOptions]; return ( <Components.FormItem path={inputProperties.path} label={inputProperties.label} {...itemProperties}> <Form.Control as="select" {...inputProperties} ref={refFunction}> {options.map((option, i) => ( <option key={i} {...option}>{option.value}</option> ))} </Form.Control> </Components.FormItem> ); }; SelectComponent.contextTypes = { intl: intlShape, }; registerComponent('FormComponentSelect', SelectComponent);
import React from 'react'; import { intlShape } from 'meteor/vulcan:i18n'; import Form from 'react-bootstrap/Form'; import { Components, registerComponent } from 'meteor/vulcan:core'; // copied from vulcan:forms/utils.js to avoid extra dependency const getFieldType = datatype => datatype && datatype[0].type; const SelectComponent = ({ refFunction, inputProperties, itemProperties, datatype }, { intl }) => { const noneOption = { label: intl.formatMessage({ id: 'forms.select_option' }), value: getFieldType(datatype) === String || getFieldType(datatype) === Number ? '' : null, // depending on field type, empty value can be '' or null disabled: true, }; let otherOptions = Array.isArray(inputProperties.options) && inputProperties.options.length ? inputProperties.options : []; const options = [noneOption, ...otherOptions]; return ( <Components.FormItem path={inputProperties.path} label={inputProperties.label} {...itemProperties}> <Form.Control as="select" {...inputProperties} ref={refFunction}> {options.map((option, i) => ( <option key={i} {...option}>{option.label}</option> ))} </Form.Control> </Components.FormItem> ); }; SelectComponent.contextTypes = { intl: intlShape, }; registerComponent('FormComponentSelect', SelectComponent);
Fix labeling in select component.
Fix labeling in select component.
JSX
mit
VulcanJS/Vulcan,VulcanJS/Vulcan
--- +++ @@ -21,7 +21,7 @@ <Components.FormItem path={inputProperties.path} label={inputProperties.label} {...itemProperties}> <Form.Control as="select" {...inputProperties} ref={refFunction}> {options.map((option, i) => ( - <option key={i} {...option}>{option.value}</option> + <option key={i} {...option}>{option.label}</option> ))} </Form.Control> </Components.FormItem>
6f239f30b03289d6b17d7f76b7d600a61587a856
src/Dots.jsx
src/Dots.jsx
import React, { Component, PropTypes } from 'react' import { Paper } from 'material-ui' const styles = { root: { display: 'block' }, dot: { width: 10, height: 10, background: 'rgba(255,255,255,1)', marginLeft: 3, marginRight: 3, float: 'left' }, dotInactive: { width: 10, height: 10, background: 'rgba(255,255,255,0.5)', marginLeft: 3, marginRight: 3, float: 'left' } } export class Dots extends Component { render() { const { count, index } = this.props const width = (count * 10) + (count * 6) return ( <div style={{ ...this.props.style, ...styles.root, width }}> {[...Array(count).keys()].map((i) => ( <Paper circle zDepth={0} style={i === index ? styles.dot : styles.dotInactive} /> ))} </div> ) } } Dots.propTypes = { count: PropTypes.number.isRequired, index: PropTypes.number.isRequired, style: PropTypes.object }
import React, { Component, PropTypes } from 'react' import { Paper } from 'material-ui' const styles = { root: { display: 'block' }, dot: { width: 10, height: 10, background: 'rgba(255,255,255,1)', marginLeft: 3, marginRight: 3, float: 'left' }, dotInactive: { width: 10, height: 10, background: 'rgba(255,255,255,0.5)', marginLeft: 3, marginRight: 3, float: 'left' } } export class Dots extends Component { render() { const { count, index } = this.props const width = (count * 10) + (count * 6) return ( <div style={{ ...this.props.style, ...styles.root, width }}> {[...Array(count).keys()].map((i) => ( <Paper key={i} circle zDepth={0} style={i === index ? styles.dot : styles.dotInactive} /> ))} </div> ) } } Dots.propTypes = { count: PropTypes.number.isRequired, index: PropTypes.number.isRequired, style: PropTypes.object }
Add key prop to dot.
Add key prop to dot.
JSX
mit
TeamWertarbyte/material-auto-rotating-carousel
--- +++ @@ -31,7 +31,12 @@ return ( <div style={{ ...this.props.style, ...styles.root, width }}> {[...Array(count).keys()].map((i) => ( - <Paper circle zDepth={0} style={i === index ? styles.dot : styles.dotInactive} /> + <Paper + key={i} + circle + zDepth={0} + style={i === index ? styles.dot : styles.dotInactive} + /> ))} </div> )
c389b99be51e563eeb4b91beccd5a784eb2fdba5
src/components/elements/post-visibility-icon.jsx
src/components/elements/post-visibility-icon.jsx
import React from 'react'; import * as PostVisibilityLevels from '../../utils/post-visibility-levels'; import { getPostVisibilityLevel } from '../../utils'; const PostVisibilityIcon = (props) => { const postLevel = getPostVisibilityLevel(props.recipients, props.authorId); switch (postLevel) { case PostVisibilityLevels.DIRECT: { return <i className="post-visibility-icon fa fa-envelope" title="This is direct message"></i>; } case PostVisibilityLevels.PRIVATE: { return <i className="post-visibility-icon fa fa-lock" title="This entry is private"></i>; } case PostVisibilityLevels.PROTECTED: { return <i className="post-visibility-icon icon-protected" title="This entry is only visible to FreeFeed users"></i>; } } return false; }; export default PostVisibilityIcon;
import React from 'react'; import * as PostVisibilityLevels from '../../utils/post-visibility-levels'; import { getPostVisibilityLevel } from '../../utils'; const PostVisibilityIcon = (props) => { const postLevel = getPostVisibilityLevel(props.recipients, props.authorId); switch (postLevel) { case PostVisibilityLevels.DIRECT: { return <i className="post-visibility-icon fa fa-envelope" title="This is direct message"></i>; } case PostVisibilityLevels.PRIVATE: { return <i className="post-visibility-icon fa fa-lock" title="This entry is private"></i>; } case PostVisibilityLevels.PROTECTED: { return <i className="post-visibility-icon icon-protected" title="This entry is only visible to FreeFeed users"></i>; } } return <i className="post-visibility-icon fa fa-globe" title="This entry is public"></i>; }; export default PostVisibilityIcon;
Introduce visibility icon for Public level posts
Introduce visibility icon for Public level posts Of course, it's a globe.
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -17,7 +17,7 @@ return <i className="post-visibility-icon icon-protected" title="This entry is only visible to FreeFeed users"></i>; } } - return false; + return <i className="post-visibility-icon fa fa-globe" title="This entry is public"></i>; }; export default PostVisibilityIcon;
a89880a409454a88b85164264aed367d35bff71f
src/app/global/Layout.jsx
src/app/global/Layout.jsx
import React, { Component } from 'react'; import { connect } from 'react-redux' import NavBar from './NavBar'; class Layout extends Component { constructor(props) { super(props) } render() { return ( <div> <NavBar /> {this.props.children} </div> ) } } export default connect()(Layout);
import React, { Component } from 'react'; import NavBar from './NavBar'; export default class Layout extends Component { constructor(props) { super(props) } render() { return ( <div> <NavBar /> {this.props.children} </div> ) } }
Remove connect and export component instead
Remove connect and export component instead Former-commit-id: 376ab01500862c7e9656c0c5a3475a1a8c064d68 Former-commit-id: 3f1d4e3b5c4852eeb810ed9646ac27d291ae45f2 Former-commit-id: 51b94dca5acea80f34ca96013d46fa5aca5877b5
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -1,9 +1,8 @@ import React, { Component } from 'react'; -import { connect } from 'react-redux' import NavBar from './NavBar'; -class Layout extends Component { +export default class Layout extends Component { constructor(props) { super(props) } @@ -17,5 +16,3 @@ ) } } - -export default connect()(Layout);
93ae11228c38406a55793551543d938e9d489253
src/components/columns.jsx
src/components/columns.jsx
var React = require('react'); var FormioComponent = require('../FormioComponent.jsx'); module.exports = React.createClass({ displayName: 'Column', render: function() { return ( <div className="row"> {this.props.component.columns.map(function(column, index) { return ( <div key={index} className="col-xs-6"> {column.components.map(function(component) { var value = (this.props.data && this.props.data.hasOwnProperty(component.key) ? this.props.data[component.key] : component.defaultValue || ''); return ( <FormioComponent {...this.props} key={component.key} name={component.key} component={component} value={value} /> ); }.bind(this)) } </div> ); }.bind(this)) } </div> ); } });
var React = require('react'); var FormioComponent = require('../FormioComponent.jsx'); module.exports = React.createClass({ displayName: 'Column', render: function() { return ( <div className="row"> {this.props.component.columns.map(function(column, index) { return ( <div key={index} className="col-sm-6"> {column.components.map(function(component) { var value = (this.props.data && this.props.data.hasOwnProperty(component.key) ? this.props.data[component.key] : component.defaultValue || ''); return ( <FormioComponent {...this.props} key={component.key} name={component.key} component={component} value={value} /> ); }.bind(this)) } </div> ); }.bind(this)) } </div> ); } });
Change the column classname to reflect deprecation
Change the column classname to reflect deprecation - In order to reflect bootstrap deprecations in their grid system, i've changed the classname from col-xs-6 to col-sm-6, also, the angular app uses this class.
JSX
mit
formio/react-formio
--- +++ @@ -8,7 +8,7 @@ <div className="row"> {this.props.component.columns.map(function(column, index) { return ( - <div key={index} className="col-xs-6"> + <div key={index} className="col-sm-6"> {column.components.map(function(component) { var value = (this.props.data && this.props.data.hasOwnProperty(component.key) ? this.props.data[component.key] : component.defaultValue || ''); return (
efcf589a42524aed285c5efcadb54493ebee3180
templates/client/modules/core/components/home.jsx
templates/client/modules/core/components/home.jsx
import React from 'react'; const Home = () => ( <div> <h1>Mantra</h1> <p> Welcome to Mantra 0.2.0. </p> <p> <ul> <li> Read <a target="_blank" href="https://kadirahq.github.io/mantra/">spec</a> </li> <li> Learn <a target="_blank" href="https://github.com/sungwoncho/mantra-cli#commands">CLI</a> </li> </ul> </p> </div> ); export default Home;
import React from 'react'; const Home = () => ( <div> <h1>Mantra</h1> <p> Welcome to Mantra 0.2.0. </p> <ul> <li> Read <a target="_blank" href="https://kadirahq.github.io/mantra/">spec</a> </li> <li> Learn <a target="_blank" href="https://github.com/sungwoncho/mantra-cli#commands">CLI</a> </li> </ul> </div> ); export default Home;
Remove nested ul tag from p tag due to warning in Chrome
Remove nested ul tag from p tag due to warning in Chrome Warning: validateDOMNesting(...): <ul> cannot appear as a descendant of <p>. See Home > p > ... > ul.
JSX
mit
StorytellerCZ/mantra-cli,StorytellerCZ/mantra-cli,mantrajs/mantra-cli,sungwoncho/mantra-cli,mantrajs/mantra-cli,mcmunder/bija
--- +++ @@ -6,16 +6,14 @@ <p> Welcome to Mantra 0.2.0. </p> - <p> - <ul> - <li> - Read <a target="_blank" href="https://kadirahq.github.io/mantra/">spec</a> - </li> - <li> - Learn <a target="_blank" href="https://github.com/sungwoncho/mantra-cli#commands">CLI</a> - </li> - </ul> - </p> + <ul> + <li> + Read <a target="_blank" href="https://kadirahq.github.io/mantra/">spec</a> + </li> + <li> + Learn <a target="_blank" href="https://github.com/sungwoncho/mantra-cli#commands">CLI</a> + </li> + </ul> </div> );
c3fa815d73f253cb35f1b6c047755e23af1a1dee
src/operator/application.jsx
src/operator/application.jsx
import React from 'react'; import Visitors from './visitors'; import * as actions from './actions'; export default React.createClass({ propTypes: { visitors: React.PropTypes.array.isRequired, dispatch: React.PropTypes.func.isRequired }, handleInvite(visitorId) { this.props.dispatch(actions.inviteVisitor(visitorId)); }, render() { return ( <div> <h1>Operator's home</h1> <p>This is an operator's application!</p> <hr /> <Visitors visitors={this.props.visitors} onInvite={this.handleInvite} /> </div> ); } });
import React from 'react'; import Visitors from './visitors'; import * as actions from './actions'; export default class Application extends React.Component { handleInvite(visitorId) { this.props.dispatch(actions.inviteVisitor(visitorId)); } render() { return ( <div> <h1>Operator's home</h1> <p>This is an operator's application!</p> <hr /> <Visitors visitors={this.props.visitors} onInvite={this.handleInvite.bind(this)} /> </div> ); } }; Application.propTypes = { visitors: React.PropTypes.array.isRequired, dispatch: React.PropTypes.func.isRequired };
Rewrite <Application /> to be an ES6 class
Rewrite <Application /> to be an ES6 class
JSX
apache-2.0
JustBlackBird/mibew-ui,JustBlackBird/mibew-ui
--- +++ @@ -2,15 +2,10 @@ import Visitors from './visitors'; import * as actions from './actions'; -export default React.createClass({ - propTypes: { - visitors: React.PropTypes.array.isRequired, - dispatch: React.PropTypes.func.isRequired - }, - +export default class Application extends React.Component { handleInvite(visitorId) { this.props.dispatch(actions.inviteVisitor(visitorId)); - }, + } render() { return ( @@ -20,9 +15,14 @@ <hr /> <Visitors visitors={this.props.visitors} - onInvite={this.handleInvite} + onInvite={this.handleInvite.bind(this)} /> </div> ); } -}); +}; + +Application.propTypes = { + visitors: React.PropTypes.array.isRequired, + dispatch: React.PropTypes.func.isRequired +};
57918f3f96386c4d8d00618c760447db28748603
app/js/home/components/Hero.jsx
app/js/home/components/Hero.jsx
import React from 'react'; import SmoothImageDiv from 'common/components/SmoothImageDiv'; import LabImg from 'img/betterLab.jpg'; import RapDevImg from 'img/rapdev.jpg'; class Hero extends React.Component { constructor(props) { super(props); this.state = { img1Loaded: false, img2Loaded: false, }; } handleImageLoad = (key) => { this.setState({ [key]: true, }); } render() { const allLoaded = (this.state.img1Loaded && this.state.img2Loaded); return ( <div className="hero"> <SmoothImageDiv className="hero-img left" imageUrl={LabImg} delayMs={1200} forceLoad={allLoaded} onLoad={() => this.handleImageLoad('img1Loaded')} /> <div className="hero-content-container"> <div className="fancy-hero-container" /> <div className="hero-content"> <h3>Weekly Meetings</h3> <h6>Thurs @ 4:00pm</h6> <h6>GOL-1670</h6> <h6>All Are Welcome!</h6> </div> </div> <SmoothImageDiv className="hero-img right" imageUrl={RapDevImg} delayMs={1200} forceLoad={allLoaded} onLoad={() => this.handleImageLoad('img2Loaded')} /> </div> ); } } export default Hero;
import React from 'react'; import SmoothImageDiv from 'common/components/SmoothImageDiv'; import LabImg from 'img/betterLab.jpg'; import RapDevImg from 'img/rapdev.jpg'; class Hero extends React.Component { constructor(props) { super(props); this.state = { img1Loaded: false, img2Loaded: false, }; } handleImageLoad = (key) => { this.setState({ [key]: true, }); } render() { const allLoaded = (this.state.img1Loaded && this.state.img2Loaded); return ( <div className="hero"> <SmoothImageDiv className="hero-img left" imageUrl={LabImg} delayMs={1200} forceLoad={allLoaded} onLoad={() => this.handleImageLoad('img1Loaded')} /> <div className="hero-content-container"> <div className="fancy-hero-container" /> <div className="hero-content"> <h3>Weekly Meetings</h3> <h6>Wed @ 4:30pm</h6> <h6>GOL-1670</h6> <h6>All Are Welcome!</h6> </div> </div> <SmoothImageDiv className="hero-img right" imageUrl={RapDevImg} delayMs={1200} forceLoad={allLoaded} onLoad={() => this.handleImageLoad('img2Loaded')} /> </div> ); } } export default Hero;
Update Meeting Times for Spring Semester
Update Meeting Times for Spring Semester
JSX
mit
rit-sse/OneRepoToRuleThemAll
--- +++ @@ -33,7 +33,7 @@ <div className="fancy-hero-container" /> <div className="hero-content"> <h3>Weekly Meetings</h3> - <h6>Thurs @ 4:00pm</h6> + <h6>Wed @ 4:30pm</h6> <h6>GOL-1670</h6> <h6>All Are Welcome!</h6> </div>
b209698fca9bed184080b5d320682373d24799c3
src/field/or/ask_social_network_or_phone_number.jsx
src/field/or/ask_social_network_or_phone_number.jsx
import React from 'react'; import Base from '../../connection/passwordless/ask_phone_number'; import PhoneNumberPane from '../phone-number/phone_number_pane'; import SocialButtonsPane from '../social/social_buttons_pane'; import PaneSeparator from '../../core/pane_separator'; import * as l from '../../core/index'; import { renderSignedInConfirmation } from '../../core/signed_in_confirmation'; export default class AskSocialNetworkOrPhoneNumber extends Base { constructor() { super(); this.name = "networkOrPhone"; } renderAuxiliaryPane(lock) { return renderSignedInConfirmation(lock) || super.renderAuxiliaryPane(lock); } render({focusSubmit, i18n, model, t}) { return ( <div> <SocialButtonsPane label={i18n.str} lock={model} signUp={false} smallButtonsHeader={t("smallSocialButtonsHeader", {__textOnly: true})} /> <PaneSeparator>{t("separatorText")}</PaneSeparator> <PhoneNumberPane focusSubmit={focusSubmit} lock={model} placeholder={t("phoneNumberInputPlaceholder", {__textOnly: true})} /> </div> ); } }
import React from 'react'; import Base from '../../connection/passwordless/ask_phone_number'; import PhoneNumberPane from '../phone-number/phone_number_pane'; import SocialButtonsPane from '../social/social_buttons_pane'; import PaneSeparator from '../../core/pane_separator'; import * as l from '../../core/index'; import { renderSignedInConfirmation } from '../../core/signed_in_confirmation'; export default class AskSocialNetworkOrPhoneNumber extends Base { constructor() { super(); this.name = "networkOrPhone"; } renderAuxiliaryPane(lock) { return renderSignedInConfirmation(lock) || super.renderAuxiliaryPane(lock); } render({focusSubmit, i18n, model}) { // TODO: review when bringing passwordless back return ( <div> <SocialButtonsPane instructions={i18n.html("socialLoginInstructions")} label={i18n.str} lock={model} signUp={false} /> <PaneSeparator /> <PhoneNumberPane focusSubmit={focusSubmit} lock={model} placeholder={i18n.str("phoneNumberInputPlaceholder")} /> </div> ); } }
Use i18n prop in AskSocialNetworkOrPhoneNumber
Use i18n prop in AskSocialNetworkOrPhoneNumber
JSX
mit
mike-casas/lock,mike-casas/lock,mike-casas/lock
--- +++ @@ -18,20 +18,21 @@ return renderSignedInConfirmation(lock) || super.renderAuxiliaryPane(lock); } - render({focusSubmit, i18n, model, t}) { + render({focusSubmit, i18n, model}) { + // TODO: review when bringing passwordless back return ( <div> <SocialButtonsPane + instructions={i18n.html("socialLoginInstructions")} label={i18n.str} lock={model} signUp={false} - smallButtonsHeader={t("smallSocialButtonsHeader", {__textOnly: true})} /> - <PaneSeparator>{t("separatorText")}</PaneSeparator> + <PaneSeparator /> <PhoneNumberPane focusSubmit={focusSubmit} lock={model} - placeholder={t("phoneNumberInputPlaceholder", {__textOnly: true})} + placeholder={i18n.str("phoneNumberInputPlaceholder")} /> </div> );
4579adc011744b1ecea103e8f70d0ffd227b1c9b
src/components/App/App.jsx
src/components/App/App.jsx
import React from 'react'; import Content from '../Content'; import './App.scss'; const commits = [ { "id": 1, "date": "April 30, 2016", "text": "Started to learn React", "isProject": true }, { "id": 2, "date": "May, 2016", "text": "Started to learn...", "isProject": false } ]; export default function App() { return ( <Content data={ commits }/> ); }
import React from 'react'; import Content from '../Content'; import './App.scss'; const commits = [ { "id": 1, "date": "April 30, 2014", "text": "Started to learn HTML", "isProject": false }, { "id": 2, "date": "April 30, 2014", "text": "Started to learn CSS", "isProject": true }, { "id": 3, "date": "May, 2014", "text": "Started to learn JavaScript", "isProject": false } ]; export default function App() { return ( <Content data={ commits }/> ); }
Test data: added an extra element to Commits object and modified some data
Test data: added an extra element to Commits object and modified some data
JSX
mit
designhorf/designhorf2017,designhorf/designhorf2017
--- +++ @@ -5,14 +5,20 @@ const commits = [ { "id": 1, - "date": "April 30, 2016", - "text": "Started to learn React", + "date": "April 30, 2014", + "text": "Started to learn HTML", + "isProject": false + }, + { + "id": 2, + "date": "April 30, 2014", + "text": "Started to learn CSS", "isProject": true }, { - "id": 2, - "date": "May, 2016", - "text": "Started to learn...", + "id": 3, + "date": "May, 2014", + "text": "Started to learn JavaScript", "isProject": false } ];
cfe60e7eb55f1c0bfc6912477e8e768e71d07cf0
app/frontend/root.jsx
app/frontend/root.jsx
import React from "react" import {linkTo} from "./utils" class Header extends React.Component { onClick = (ev) => { ev.preventDefault() window.location = linkTo("/") } render() { return <header id="header" onClick={this.onClick}> <h1>Cashout</h1> </header> } } class Root extends React.Component { render() { return <div> <Header /> {this.props.children} </div> } } export {Root}
import React from "react" import {linkTo} from "./utils" class Header extends React.Component { render() { return <header id="header"> <h1>Cashout</h1> </header> } } class Root extends React.Component { render() { return <div> <Header /> {this.props.children} </div> } } export {Root}
Remove reload on header click
Remove reload on header click
JSX
mit
daGrevis/cashout,daGrevis/cashout,daGrevis/cashout
--- +++ @@ -3,14 +3,8 @@ class Header extends React.Component { - onClick = (ev) => { - ev.preventDefault() - - window.location = linkTo("/") - } - render() { - return <header id="header" onClick={this.onClick}> + return <header id="header"> <h1>Cashout</h1> </header> }
667daec7d939ae045aa7920aa2abe52d9c8badb1
templates/app/client/app/src/components/Footer.jsx
templates/app/client/app/src/components/Footer.jsx
/** @jsx React.DOM */ var React = require('react'); var FOOTER = React.createClass({ render: function(){ return ( <div className="footer"> <div className="container"> <p className="text-muted"> Fork us on Github! </p> </div> </div> ) } }) module.exports = FOOTER;
/** @jsx React.DOM */ var React = require('react'); var FOOTER = React.createClass({ render: function(){ return ( <div className="footer"> <div className="container"> <p className="text-muted"> <a href="https://github.com/react-fullstack/slush-react-fullstack">Fork us on Github!</a> </p> </div> </div> ) } }) module.exports = FOOTER;
Add link to GitHub repo in footer of generated app
Add link to GitHub repo in footer of generated app
JSX
mit
react-fullstack/slush-react-fullstack
--- +++ @@ -4,13 +4,15 @@ var React = require('react'); var FOOTER = React.createClass({ - - + + render: function(){ return ( <div className="footer"> <div className="container"> - <p className="text-muted"> Fork us on Github! </p> + <p className="text-muted"> + <a href="https://github.com/react-fullstack/slush-react-fullstack">Fork us on Github!</a> + </p> </div> </div> )
702da029e998e30b13c4cb1426046922b1ed6358
client/components/grid/Grid.jsx
client/components/grid/Grid.jsx
var cn = require('classnames'), React = require('react/addons'), PureRenderMixin = React.addons.PureRenderMixin var Grid = React.createClass({ mixin: [PureRenderMixin], propTypes: { className: React.PropTypes.string }, render: function () { var {children, className, ...props} = this.props return ( <div className={cn('grid', className)} {...props}> {children} </div> ) } }) module.exports = Grid
var cn = require('classnames'), React = require('react/addons'), PureRenderMixin = React.addons.PureRenderMixin var Grid = React.createClass({ mixin: [PureRenderMixin], propTypes: { className: React.PropTypes.string, subheader: React.PropTypes.string }, render: function () { var {children, className, subheader, ...props} = this.props return ( <div className={cn('grid-container', className)} {...props}> {subheader ? <div className='grid-subheader'>{subheader}</div> : null} <div className='grid'> {children} </div> </div> ) } }) module.exports = Grid
Update grid to allow subheader
Update grid to allow subheader
JSX
apache-2.0
cesarandreu/bshed,cesarandreu/bshed
--- +++ @@ -6,14 +6,18 @@ mixin: [PureRenderMixin], propTypes: { - className: React.PropTypes.string + className: React.PropTypes.string, + subheader: React.PropTypes.string }, render: function () { - var {children, className, ...props} = this.props + var {children, className, subheader, ...props} = this.props return ( - <div className={cn('grid', className)} {...props}> - {children} + <div className={cn('grid-container', className)} {...props}> + {subheader ? <div className='grid-subheader'>{subheader}</div> : null} + <div className='grid'> + {children} + </div> </div> ) }
a229ba1a90fb407969ba0b3f674fdba0e32151f4
packages/nylas-dashboard/public/js/process-loads.jsx
packages/nylas-dashboard/public/js/process-loads.jsx
const React = window.React; class ProcessLoads extends React.Component { render() { let entries; if (this.props.counts == null || Object.keys(this.props.counts).length === 0) { entries = "No Data" } else { entries = []; for (const processName of Object.keys(this.props.counts)) { entries.push( <div className="load-count"> <b>{processName}</b>: {this.props.counts[processName]} accounts </div> ); } } return ( <div className="process-loads"> <div className="section">Process Loads </div> {entries} </div> ) } } ProcessLoads.propTypes = { counts: React.PropTypes.object, } window.ProcessLoads = ProcessLoads;
const React = window.React; class ProcessLoads extends React.Component { render() { let entries; if (this.props.counts == null || Object.keys(this.props.counts).length === 0) { entries = "No Data" } else { entries = []; for (const processName of Object.keys(this.props.counts).sort()) { entries.push( <div className="load-count"> <b>{processName}</b>: {this.props.counts[processName]} accounts </div> ); } } return ( <div className="process-loads"> <div className="section">Process Loads </div> {entries} </div> ) } } ProcessLoads.propTypes = { counts: React.PropTypes.object, } window.ProcessLoads = ProcessLoads;
Sort process entries on the dashboard
Sort process entries on the dashboard
JSX
mit
simonft/nylas-mail,nylas-mail-lives/nylas-mail,nylas-mail-lives/nylas-mail,nirmit/nylas-mail,nylas/nylas-mail,nylas-mail-lives/nylas-mail,simonft/nylas-mail,nylas-mail-lives/nylas-mail,nylas-mail-lives/nylas-mail,simonft/nylas-mail,nirmit/nylas-mail,nylas/nylas-mail,nirmit/nylas-mail,nirmit/nylas-mail,simonft/nylas-mail,nirmit/nylas-mail,nylas/nylas-mail,nylas/nylas-mail,simonft/nylas-mail,nylas/nylas-mail
--- +++ @@ -9,7 +9,7 @@ } else { entries = []; - for (const processName of Object.keys(this.props.counts)) { + for (const processName of Object.keys(this.props.counts).sort()) { entries.push( <div className="load-count"> <b>{processName}</b>: {this.props.counts[processName]} accounts
9e695b75946964a3cf50d5b0ce3f9d359f1bc887
client/src/index.jsx
client/src/index.jsx
/*jshint esversion: 6 */ /* <- Imports and Declarations -> */ import reducers from './reducers'; import App from './components/App.jsx'; import Landing from './components/Landing.jsx'; // Declare Redux Methods const store = Redux.createStore(reducers); // Declare ReactRouter Methods const Router = ReactRouter.Router; const Route = ReactRouter.Route; const IndexRoute = ReactRouter.IndexRoute; const browserHistory = ReactRouter.browserHistory; /*<-// Imports and Declarations -> */ const render = () => ReactDOM.render(( <Router history={browserHistory} > <Route path='/' component={App} > <IndexRoute component={Landing} /> <Route path='/main' component={Main}> <Route path='/notebook' component={Notebook} /> <Route path='/new' component={NewRoom} /> <Route path='/join' component={JoinRoom} /> <Route path='/lobby' component={Lobby} /> <Route path='/review' component={Review} /> </Route> <Route path='/lecture' component={Lecture} /> <Route path='/compile' component={Compile} /> </Route> </Router> ), document.getElementById('root') ); render(); store.subscribe(render);
/*jshint esversion: 6 */ /* <- Imports and Declarations -> */ import reducers from './reducers'; import App from './components/App.jsx'; import Landing from './components/Landing.jsx'; // Declare Redux Methods const store = Redux.createStore(reducers); // Declare ReactRouter Methods const Router = ReactRouter.Router; const Route = ReactRouter.Route; const IndexRoute = ReactRouter.IndexRoute; const browserHistory = ReactRouter.browserHistory; /*<-// Imports and Declarations -> */ const render = () => ReactDOM.render(( <Router history={browserHistory} > <Route path='/' component={App} > <IndexRoute component={Landing} /> <Route path='/main' component={Main}> <Route path='/notebook' component={Notebook} /> <Route path='/new' component={NewRoom} /> <Route path='/join' component={JoinRoom} /> <Route path='/lobby' component={Lobby} /> <Route path='/review' component={Review} /> </Route> <Route path='/lecture' component={Lecture} /> <Route path='/compile' component={Compile} /> </Route> </Router>*/ ), document.getElementById('root') ); render(); store.subscribe(render);
Add React routes and update App.jsx
Add React routes and update App.jsx
JSX
mit
folksy-squid/Picky-Notes,inspiredtolive/Picky-Notes,derektliu/Picky-Notes,inspiredtolive/Picky-Notes,folksy-squid/Picky-Notes,derektliu/Picky-Notes,folksy-squid/Picky-Notes,derektliu/Picky-Notes,inspiredtolive/Picky-Notes
--- +++ @@ -29,7 +29,7 @@ <Route path='/lecture' component={Lecture} /> <Route path='/compile' component={Compile} /> </Route> - </Router> + </Router>*/ ), document.getElementById('root') );
5e1db046eb6a9979d614240e48fb4980e7647fc8
src/js/components/Task.jsx
src/js/components/Task.jsx
import React, { PropTypes } from 'react'; import TaskActions from '../actions/TaskActions'; const propTypes = { task: PropTypes.object.isRequired, }; export default class Task extends React.Component { constructor(props) { super(props); this.removeTask = this.removeTask.bind(this); this.doneTask = this.doneTask.bind(this); } removeTask() { TaskActions.removeTask(this.props.task.id); } doneTask() { TaskActions.doneTask(this.props.task.id); } render() { return ( <tr> <td> {this.props.task.text} </td> <td className="is-icon" onClick={this.doneTask}> <i className="fa fa-check" /> </td> <td className="is-icon"> <i className="fa fa-pencil" /> </td> <td className="is-icon" onClick={this.removeTask}> <i className="fa fa-trash" /> </td> </tr> ); } } Task.propTypes = propTypes;
import React, { PropTypes } from 'react'; import TaskActions from '../actions/TaskActions'; const propTypes = { task: PropTypes.object.isRequired, }; export default class Task extends React.Component { constructor(props) { super(props); this.removeTask = this.removeTask.bind(this); this.doneTask = this.doneTask.bind(this); } removeTask() { TaskActions.removeTask(this.props.task.id); } doneTask() { TaskActions.doneTask(this.props.task.id); } render() { const buttonDone = (this.props.task.status !== 3) ? <td className="is-icon" onClick={this.doneTask}> <i className="fa fa-check" /> </td> : <td />; return ( <tr> <td> {this.props.task.text} </td> {buttonDone} <td className="is-icon"> <i className="fa fa-pencil" /> </td> <td className="is-icon" onClick={this.removeTask}> <i className="fa fa-trash" /> </td> </tr> ); } } Task.propTypes = propTypes;
Hide done button if task statu is done
Hide done button if task statu is done
JSX
mit
tanaka0325/nippo-web,tanaka0325/nippo-web
--- +++ @@ -23,14 +23,18 @@ } render() { + const buttonDone = (this.props.task.status !== 3) ? + <td className="is-icon" onClick={this.doneTask}> + <i className="fa fa-check" /> + </td> + : <td />; + return ( <tr> <td> {this.props.task.text} </td> - <td className="is-icon" onClick={this.doneTask}> - <i className="fa fa-check" /> - </td> + {buttonDone} <td className="is-icon"> <i className="fa fa-pencil" /> </td>
9d34f77e94a9ef01af8718b8409ce1dadbcffd56
client/components/volunteer/imports/active-puzzle.jsx
client/components/volunteer/imports/active-puzzle.jsx
import { Meteor } from 'meteor/meteor'; import React, { PropTypes } from 'react'; import { Segment, Header, Progress, Button } from 'semantic-ui-react'; export default class ActivePuzzle extends React.Component { constructor(props) { super(props); } render() { const { team, puzzle } = this.props; return ( <Segment> <Header as='h3' content={ puzzle.name }/> Puzzle timer coming... <Button basic fluid color='red' content='Reset Timer' onClick={ () => this._resetTimer() } /> </Segment> ); } _resetTimer() { const { team, puzzle } = this.props; const confirmMsg = ` You want to reset ${puzzle.name} for team: ${team.name}? Are you absolutely positive? ` if (!confirm(confirmMsg)) return; Meteor.call('volunteer.team.resetPuzzle', team._id, puzzle.puzzleId, (error, result) => { if (error) return this.setState({ error }); }); } } ActivePuzzle.propTypes = { team: PropTypes.object.isRequired, puzzle: PropTypes.object.isRequired, };
import { Meteor } from 'meteor/meteor'; import React, { PropTypes } from 'react'; import { Segment, Header, Progress, Button } from 'semantic-ui-react'; import PuzzleProgress from '../../game/imports/puzzle-progress'; export default class ActivePuzzle extends React.Component { constructor(props) { super(props); } render() { const { team, puzzle } = this.props; return ( <Segment> <Header as='h3' content={ puzzle.name }/> <PuzzleProgress puzzle={ puzzle }/> <br/> <Button basic fluid color='red' content='Reset Timer' onClick={ () => this._resetTimer() } /> </Segment> ); } _resetTimer() { const { team, puzzle } = this.props; const confirmMsg = ` You want to reset ${puzzle.name} for team: ${team.name}? Are you absolutely positive? ` if (!confirm(confirmMsg)) return; Meteor.call('volunteer.team.resetPuzzle', team._id, puzzle.puzzleId, (error, result) => { if (error) return this.setState({ error }); }); } } ActivePuzzle.propTypes = { team: PropTypes.object.isRequired, puzzle: PropTypes.object.isRequired, };
Add puzzle progress to volunteer active puzzle comp
Add puzzle progress to volunteer active puzzle comp
JSX
mit
kyle-rader/greatpuzzlehunt,kyle-rader/greatpuzzlehunt,kyle-rader/greatpuzzlehunt
--- +++ @@ -1,6 +1,8 @@ import { Meteor } from 'meteor/meteor'; import React, { PropTypes } from 'react'; import { Segment, Header, Progress, Button } from 'semantic-ui-react'; + +import PuzzleProgress from '../../game/imports/puzzle-progress'; export default class ActivePuzzle extends React.Component { constructor(props) { @@ -13,7 +15,8 @@ return ( <Segment> <Header as='h3' content={ puzzle.name }/> - Puzzle timer coming... + <PuzzleProgress puzzle={ puzzle }/> + <br/> <Button basic fluid color='red'
b2056cf1c064b30ce7a79a09b46ecabccc396603
imports/ui/structure-view/add-element-button.jsx
imports/ui/structure-view/add-element-button.jsx
import React from 'react'; import { DropdownButton, MenuItem } from 'react-bootstrap'; import Elements from '../../api/elements.js'; export default class AddElementButton extends React.Component { constructor(props) { super(props); this.handleAddElement = this.handleAddElement.bind(this); } handleAddElement(typeName) { Elements.add(this.props.elementId, typeName); } render() { const dropDownButtonStyle = { padding: '0px', border: '0px', backgroundColor: 'transparent', }; if (this.props.possibleTypes.length !== 0) { return ( <DropdownButton className="glyphicon glyphicon-plus add-element-button" id="add-element-dropdown" onSelect={this.handleAddElement} title="" style={dropDownButtonStyle} > {this.props.possibleTypes.map((elementType) => { return ( <MenuItem eventKey={elementType.name} key={elementType.name} > {elementType.humanName} </MenuItem>); })} </DropdownButton> ); } else { return (<div></div>); } } } AddElementButton.propTypes = { elementId: React.PropTypes.string, possibleTypes: React.PropTypes.array.isRequired, };
import React from 'react'; import { DropdownButton, MenuItem } from 'react-bootstrap'; import Elements from '../../api/elements.js'; export default class AddElementButton extends React.Component { constructor(props) { super(props); this.handleAddElement = this.handleAddElement.bind(this); } handleAddElement(typeName) { Elements.add(this.props.elementId, typeName); } render() { const dropDownButtonStyle = { padding: '0px', border: '0px', backgroundColor: 'transparent', }; if (this.props.possibleTypes.length !== 0) { return ( <DropdownButton className="glyphicon glyphicon-plus add-element-button" id="add-element-dropdown" onSelect={this.handleAddElement} title="" style={dropDownButtonStyle} > {this.props.possibleTypes.map((elementType) => { return ( <MenuItem eventKey={elementType.name} key={elementType.name} > {elementType.humanName} </MenuItem>); })} </DropdownButton> ); } return (<div></div>); } } AddElementButton.propTypes = { elementId: React.PropTypes.string, possibleTypes: React.PropTypes.array.isRequired, };
Adjust to approve with coding style
Adjust to approve with coding style
JSX
mit
minden/data-furnace,minden/data-furnace
--- +++ @@ -39,9 +39,8 @@ })} </DropdownButton> ); - } else { - return (<div></div>); } + return (<div></div>); } }
d8e570197d1fddb82d429c6480162fad0a6bffe5
coin-selfservice-standalone/src/javascripts/components/download_button.jsx
coin-selfservice-standalone/src/javascripts/components/download_button.jsx
/** @jsx React.DOM */ App.Components.DownloadButton = React.createClass({ onDownload: function (e) { e.preventDefault(); e.stopPropagation(); this.props.genFile(this.donePreparing); }, donePreparing: function (data) { console.log("Done download.."); var blob = new Blob([data], {type: this.props.mimeType}), url = window.URL.createObjectURL(blob); this.saveAs(url); window.URL.revokeObjectURL(url); }, saveAs: function(url) { var link = document.createElement("a"); if (typeof link.download === "string") { document.body.appendChild(link); link.style = "display: none"; link.href = url; link.download = this.props.fileName; link.click(); document.body.removeChild(link); } else { location.replace(uri); } }, render: function () { return <a href="#" className={this.props.className} onClick={this.onDownload}>{this.props.title}</a>; } });
/** @jsx React.DOM */ App.Components.DownloadButton = React.createClass({ onDownload: function (e) { e.preventDefault(); e.stopPropagation(); this.props.genFile(this.donePreparing); }, donePreparing: function (data) { var blob = new Blob([data], {type: this.props.mimeType}), url = window.URL.createObjectURL(blob); this.saveAs(url); // revoke the url with a delay otherwise download will fail in FF setTimeout(function () { window.URL.revokeObjectURL(url); }, 200); }, saveAs: function(url) { var link = document.createElement("a"); if (typeof link.download === "string") { document.body.appendChild(link); link.style = "display: none"; link.href = url; link.download = this.props.fileName; link.click(); document.body.removeChild(link); } else { location.replace(uri); } }, render: function () { return <a href="#" className={this.props.className} onClick={this.onDownload}>{this.props.title}</a>; } });
Fix export stats button for firefox
Fix export stats button for firefox
JSX
apache-2.0
OpenConext/OpenConext-dashboard,OpenConext/OpenConext-dashboard,OpenConext/OpenConext-dashboard,cybera/OpenConext-dashboard,cybera/OpenConext-dashboard,OpenConext/OpenConext-dashboard,cybera/OpenConext-dashboard,cybera/OpenConext-dashboard
--- +++ @@ -9,13 +9,15 @@ }, donePreparing: function (data) { - console.log("Done download.."); var blob = new Blob([data], {type: this.props.mimeType}), url = window.URL.createObjectURL(blob); this.saveAs(url); - window.URL.revokeObjectURL(url); + // revoke the url with a delay otherwise download will fail in FF + setTimeout(function () { + window.URL.revokeObjectURL(url); + }, 200); }, saveAs: function(url) {
5e0a1b1bab64d19da06eeb8bb27c835d0c0e8dd9
src/components/Tab.jsx
src/components/Tab.jsx
import React from 'react' import SkillVideo from './SkillVideo' export default React.createClass({ props: { skillId: React.PropTypes.number.isRequired, videos: React.PropTypes.array.isRequired, onUpvote: React.PropTypes.func.isRequired, onDownvote: React.PropTypes.func.isRequired, onWatchedSkill: React.PropTypes.func.isRequired }, render () { console.log(this.props.skillId) const videos = (this.props.videos || []) .sort((a, b) => a.votes < b.votes) .map(elem => { return <SkillVideo key={elem.id} id={elem.id} url={elem.url} votes={elem.votes} onUpvote={this.props.onUpvote} onDownvote={this.props.onDownvote} /> }) if (this.props.userId === 0) { return ( <div className="tab"> {videos} </div> ) } else { return ( <div className="tab"> <button name={this.props.skillId} onClick={this.props.onWatchedSkill}>Got It!</button> {videos} </div> ) } } })
import React from 'react' import SkillVideo from './SkillVideo' export default React.createClass({ props: { skillId: React.PropTypes.number.isRequired, videos: React.PropTypes.array.isRequired, onUpvote: React.PropTypes.func.isRequired, onDownvote: React.PropTypes.func.isRequired, onWatchedSkill: React.PropTypes.func.isRequired }, render () { const videos = (this.props.videos || []) .sort((a, b) => a.votes < b.votes) .map(elem => { return <SkillVideo key={elem.id} id={elem.id} url={elem.url} votes={elem.votes} onUpvote={this.props.onUpvote} onDownvote={this.props.onDownvote} /> }) if (this.props.userId === 0 || (this.props.userId !==0 && !this.props.skillId)) { return ( <div className="tab"> {videos} </div> ) } else { return ( <div className="tab"> <button name={this.props.skillId} onClick={this.props.onWatchedSkill}>Got It!</button> {videos} </div> ) } } })
Remove Got it button if no skill selected
Remove Got it button if no skill selected
JSX
mit
nikau-2016/lifestack-client,nikau-2016/lifestack-client
--- +++ @@ -11,7 +11,6 @@ onWatchedSkill: React.PropTypes.func.isRequired }, render () { - console.log(this.props.skillId) const videos = (this.props.videos || []) .sort((a, b) => a.votes < b.votes) .map(elem => { @@ -22,7 +21,7 @@ onUpvote={this.props.onUpvote} onDownvote={this.props.onDownvote} /> }) - if (this.props.userId === 0) { + if (this.props.userId === 0 || (this.props.userId !==0 && !this.props.skillId)) { return ( <div className="tab"> {videos}
8241ed3fa8a7e010e6b23ee3029e90314d71990b
packages/lesswrong/components/posts/EventsDaily.jsx
packages/lesswrong/components/posts/EventsDaily.jsx
import { Components, registerComponent, getSetting, registerSetting } from 'meteor/vulcan:core'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; import moment from 'moment'; import { withStyles } from '@material-ui/core/styles'; import { styles } from './EventsDaily'; registerSetting('forum.numberOfDays', 5, 'Number of days to display in Daily view'); class EventsDaily extends Component { render() { const { classes } = this.props; const numberOfDays = getSetting('forum.numberOfDays', 5); const terms = { view: 'pastEvents', timeField: 'startTime', after: moment().utc().subtract(numberOfDays - 1, 'days').format('YYYY-MM-DD'), before: moment().utc().add(1, 'days').format('YYYY-MM-DD'), }; return <div className={classes.dailyWrapper}> <Components.Section title="Past Events by Day"> <div className={classes.dailyContentWrapper}> <Components.PostsDailyList title="Past Events by Day" terms={terms} days={numberOfDays}/> </div> </Components.Section> </div> } } EventsDaily.displayName = 'EventsDaily'; registerComponent('EventsDaily', EventsDaily, withStyles(styles, {name: "EventsDaily"}));
import { Components, registerComponent, getSetting, registerSetting } from 'meteor/vulcan:core'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; import moment from 'moment'; import { withStyles } from '@material-ui/core/styles'; import { styles } from './PostsDaily'; registerSetting('forum.numberOfDays', 5, 'Number of days to display in Daily view'); class EventsDaily extends Component { render() { const { classes } = this.props; const numberOfDays = getSetting('forum.numberOfDays', 5); const terms = { view: 'pastEvents', timeField: 'startTime', after: moment().utc().subtract(numberOfDays - 1, 'days').format('YYYY-MM-DD'), before: moment().utc().add(1, 'days').format('YYYY-MM-DD'), }; return <div className={classes.dailyWrapper}> <Components.Section title="Past Events by Day"> <div className={classes.dailyContentWrapper}> <Components.PostsDailyList title="Past Events by Day" terms={terms} days={numberOfDays}/> </div> </Components.Section> </div> } } EventsDaily.displayName = 'EventsDaily'; registerComponent('EventsDaily', EventsDaily, withStyles(styles, {name: "EventsDaily"}));
Fix a console error message due to invalid import
Fix a console error message due to invalid import Kind of disappointed in ESLint for not catching this one.
JSX
mit
Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope
--- +++ @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import moment from 'moment'; import { withStyles } from '@material-ui/core/styles'; -import { styles } from './EventsDaily'; +import { styles } from './PostsDaily'; registerSetting('forum.numberOfDays', 5, 'Number of days to display in Daily view');
1c4abfd3e29710f978d920050fd7c03995c45319
src/App.jsx
src/App.jsx
import React, { Component } from 'react'; export default class App extends Component { render() { return ( <h1>Hello React :)</h1> ); } }
import React from 'react'; const App = React.createClass({ render: function() { return ( <h1>Hello React :)</h1> ); } }); export default App;
Use createClass instead of ES6 classes
Use createClass instead of ES6 classes Most of the React docs use createClass. It will be easier for students to follow the docs.
JSX
mit
Justinette2175/morning-app-react,jenreiher/slug-journal,mackybeltran/chatty,ehdwn1212/personalWebsite2,davidbpaul/LHL-Final-GetGO-web,SebaRev1989/react-examples,davidbpaul/LHL-Final-GetGO-web,jzhang729/chatty,promilo/Waundr,KyleFlemington/CHATi,bchuup/lhl-final-trip-me-up,ddandipu/chattyapp,noahlotzer/react-simple-boilerplate,Waundr/Waundr.github.io,promilo/Waundr,bhavc/blockChange,patriciomase/react-m-f-carousel,laurmuresan/React,KyleFlemington/CHATi,EshaRoda/Drone-Controller,ehdwn1212/personalWebsite2,Justinette2175/morning-app-react,reinhardtcgr/ChattyApp,shinmike/scortch,pineapplemidi/pw-survey,takng/REACT-STOCK,collinstommy/fcc-recipe-box,Waundr/Waundr.github.io,latagore/latagore.github.io,claytonschroeder/energy_portfolio_builder,Chasteau/chatty-app,sammytam0430/Queue-Cue-react,bchuup/lhl-final-trip-me-up,EshaRoda/Drone-Controller,nolotz/react-simple-boilerplate,pineapplemidi/pw-survey,MichaelMansourati/colourscape-react,Waundr/Waundr.github.io,ddandipu/chattyapp,leanneherrndorf/hCORE,laijoann/Chattr,csawala/kitayama,escape-velocity/Chatty_App,nghuman/now-playing-challenge,bhavc/blockChange,shinmike/scortch,tedyangx/healthchoice,jhenderiks/lhl-chatty,NahimNasser/ethwaterloo2017,soumithr/react-simple-boilerplate2,mackybeltran/chatty,pineapplemidi/pw-survey,laijoann/Chattr,ivallee/lhl-final-project,takng/REACT-STOCK,soumithr/react-simple-boilerplate2,escape-velocity/Chatty_App,SebaRev1989/react-examples,MichaelMansourati/colourscape-react,Waundr/Waundr.github.io,promilo/Waundr,leanneherrndorf/hCORE,martinnajle1/react-tetris,collinstommy/fcc-recipe-box,latagore/latagore.github.io,csawala/kitayama,reinhardtcgr/ChattyApp,ChrisBotCodes/chatty-app,laurmuresan/React,nolotz/react-simple-boilerplate,leanneherrndorf/hCORE,patriciomase/react-m-f-carousel,ivallee/lhl-final-project,martinnajle1/react-tetris,promilo/Waundr,tedyangx/healthchoice,jhenderiks/lhl-chatty,ChrisBotCodes/chatty-app,noahlotzer/react-simple-boilerplate,promilo/Waundr,jzhang729/chatty,sammytam0430/Queue-Cue-react,Chasteau/chatty-app,claytonschroeder/energy_portfolio_builder,NahimNasser/ethwaterloo2017,jenreiher/slug-journal,nghuman/now-playing-challenge,Waundr/Waundr.github.io
--- +++ @@ -1,9 +1,10 @@ -import React, { Component } from 'react'; +import React from 'react'; -export default class App extends Component { - render() { +const App = React.createClass({ + render: function() { return ( <h1>Hello React :)</h1> ); } -} +}); +export default App;
3e5fc692bccae66a7531a1b7ccd25fb5befbc213
app/javascript/components/meeting/agendum/Agenda.jsx
app/javascript/components/meeting/agendum/Agenda.jsx
import React from 'react'; import Sortable from 'react-sortablejs'; // Controls import AgendumContainer from '../../../containers/AgendumContainer'; const Agenda = ({ agenda, meetingID, onSort }) => { const sortableOptions = { draggable: '.sortable', filter: '.modal', animation: 250, easing: 'cubic-bezier(1, 0, 0, 1)' }; return( <Sortable className="agenda" onChange={order => onSort(meetingID, order)} options={sortableOptions}> {agenda.map(agendum => ( <AgendumContainer key={agendum.id} agendum={agendum} /> ))} <AgendumContainer /> </Sortable> ); } export default Agenda;
import React from 'react'; import Sortable from 'react-sortablejs'; // Controls import AgendumContainer from '../../../containers/AgendumContainer'; const Agenda = ({ agenda, meetingID, onSort }) => { const sortableOptions = { draggable: '.sortable', filter: '.modal' }; return( <Sortable className="agenda" onChange={order => onSort(meetingID, order)} options={sortableOptions}> {agenda.map(agendum => ( <AgendumContainer key={agendum.id} agendum={agendum} /> ))} <AgendumContainer /> </Sortable> ); } export default Agenda;
Remove animation from agenda sorting
Remove animation from agenda sorting With large agendas it can be really confusing when all the other agendums switch around.
JSX
mit
robyparr/adjourn,robyparr/adjourn,robyparr/adjourn
--- +++ @@ -7,9 +7,7 @@ const Agenda = ({ agenda, meetingID, onSort }) => { const sortableOptions = { draggable: '.sortable', - filter: '.modal', - animation: 250, - easing: 'cubic-bezier(1, 0, 0, 1)' + filter: '.modal' }; return(
e2f58c54bdd8a2fe017fe85dd40867b0eacc1d51
packages/vulcan-errors/lib/components/ErrorCatcher.jsx
packages/vulcan-errors/lib/components/ErrorCatcher.jsx
/* ErrorCatcher Usage: <Components.ErrorCatcher> <YourComponentTree /> </Components.ErrorCatcher> */ import { Components, registerComponent, withCurrentUser, withSiteData } from 'meteor/vulcan:core'; import React, { Component } from 'react'; import { Errors } from '../modules/errors.js'; class ErrorCatcher extends Component { state = { error: null, }; componentDidCatch = (error, errorInfo) => { const { currentUser, siteData = {} } = this.props; const { sourceVersion } = siteData; this.setState({ error }); Errors.log({ message: error.message, error, details: { ...errorInfo, sourceVersion }, currentUser, }); }; render() { const { error } = this.state; return error ? ( <div className="error-catcher"> <Components.Flash message={{ id: 'errors.generic_report', properties: { errorMessage: error.message } }} /> </div> ) : ( this.props.children ); } } registerComponent('ErrorCatcher', ErrorCatcher, withCurrentUser, withSiteData);
/* ErrorCatcher Usage: <Components.ErrorCatcher> <YourComponentTree /> </Components.ErrorCatcher> */ import { Components, registerComponent, withCurrentUser, withSiteData } from 'meteor/vulcan:core'; import { withRouter } from 'react-router'; import React, { Component } from 'react'; import { Errors } from '../modules/errors.js'; class ErrorCatcher extends Component { state = { error: null, }; componentDidCatch = (error, errorInfo) => { const { currentUser, siteData = {} } = this.props; const { sourceVersion } = siteData; this.setState({ error }); Errors.log({ message: error.message, error, details: { ...errorInfo, sourceVersion }, currentUser, }); }; componentDidUpdate(prevProps) { if ( this.props.location && prevProps.location && this.props.location.pathname && prevProps.location.pathname && prevProps.location.pathname !== this.props.location.pathname ) { // reset the component state when the route changes to re-render the app and avodi blocking the navigation this.setState({ error: null }); } } render() { const { error } = this.state; return error ? ( <div className="error-catcher"> <Components.Flash message={{ id: 'errors.generic_report', properties: { errorMessage: error.message } }} /> </div> ) : ( this.props.children ); } } registerComponent('ErrorCatcher', ErrorCatcher, withCurrentUser, withSiteData, withRouter);
Reset error catcher on route change
Reset error catcher on route change
JSX
mit
VulcanJS/Vulcan,VulcanJS/Vulcan
--- +++ @@ -11,6 +11,7 @@ */ import { Components, registerComponent, withCurrentUser, withSiteData } from 'meteor/vulcan:core'; +import { withRouter } from 'react-router'; import React, { Component } from 'react'; import { Errors } from '../modules/errors.js'; @@ -31,11 +32,26 @@ }); }; + componentDidUpdate(prevProps) { + if ( + this.props.location && + prevProps.location && + this.props.location.pathname && + prevProps.location.pathname && + prevProps.location.pathname !== this.props.location.pathname + ) { + // reset the component state when the route changes to re-render the app and avodi blocking the navigation + this.setState({ error: null }); + } + } + render() { const { error } = this.state; return error ? ( <div className="error-catcher"> - <Components.Flash message={{ id: 'errors.generic_report', properties: { errorMessage: error.message } }} /> + <Components.Flash + message={{ id: 'errors.generic_report', properties: { errorMessage: error.message } }} + /> </div> ) : ( this.props.children @@ -43,4 +59,4 @@ } } -registerComponent('ErrorCatcher', ErrorCatcher, withCurrentUser, withSiteData); +registerComponent('ErrorCatcher', ErrorCatcher, withCurrentUser, withSiteData, withRouter);
4c08bb2d4cb97ed4e7551ad68ce90c2485065ab2
application/client/feature-detect/css-custom-properties.jsx
application/client/feature-detect/css-custom-properties.jsx
/** * Test client for touch capabilities. * * @file * @module * * @author hello@ulrichmerkel.com (Ulrich Merkel), 2016 * @version 0.0.1 * * @changelog * - 0.0.1 basic functions and structure */ /** * Test if browser supports css custom properties. * * @see {@link https://justmarkup.com/log/2016/02/theme-switcher-using-css-custom-properties/} * * @function * @returns {boolean} Whether this device supports custom properties or not */ function hasCssCustomProperties() { return window.CSS && window.CSS.supports && window.CSS.supports('--a', 0) } export default hasCssCustomProperties;
/** * Test client for touch capabilities. * * @file * @module * * @author hello@ulrichmerkel.com (Ulrich Merkel), 2016 * @version 0.0.1 * * @changelog * - 0.0.1 basic functions and structure */ import { isBrowser } from '../../common/utils/environment'; /** * Test if browser supports css custom properties. * * @see {@link https://justmarkup.com/log/2016/02/theme-switcher-using-css-custom-properties/} * * @returns {boolean} Whether this device supports custom css properties or not */ function hasCssCustomProperties() { if (!isBrowser()) { return false; } return window.CSS && window.CSS.supports && window.CSS.supports('--a', 0); } export default hasCssCustomProperties;
Add feature detection for css custom properties
Add feature detection for css custom properties
JSX
mit
ulrich-merkel/www.ulrichmerkel.com,ulrich-merkel/www.ulrichmerkel.com,ulrich-merkel/www.ulrichmerkel.com
--- +++ @@ -10,17 +10,21 @@ * @changelog * - 0.0.1 basic functions and structure */ +import { isBrowser } from '../../common/utils/environment'; /** * Test if browser supports css custom properties. * * @see {@link https://justmarkup.com/log/2016/02/theme-switcher-using-css-custom-properties/} * - * @function - * @returns {boolean} Whether this device supports custom properties or not + * @returns {boolean} Whether this device supports custom css properties or not */ function hasCssCustomProperties() { - return window.CSS && window.CSS.supports && window.CSS.supports('--a', 0) + if (!isBrowser()) { + return false; + } + + return window.CSS && window.CSS.supports && window.CSS.supports('--a', 0); } export default hasCssCustomProperties;
544f7b230f1d4a22c69966326ad26b60a3faa22d
src/frontend/Components/RegistrationModal.jsx
src/frontend/Components/RegistrationModal.jsx
import React from 'react'; import ContentModal from 'Components/ContentModal'; class RegistrationModal extends React.Component { backToConfig() { if (process.env.NODE_ENV !== 'development') { window.location = '/login?returnUrl=/config'; } } render() { let modalOpts = { openWithButton: true, dialogTitle: 'Start Registation Mode', cancelButtonText: 'Back', approveButtonText: 'Start Registration', openButtonText: 'Registration Mode', disableBackdropClick: true, cancelCallback: this.backToConfig }; return ( <ContentModal {...Object.assign({}, modalOpts, this.props)}> <div> <iframe src="https://idp.u.washington.edu/idp/profile/Logout" height="335px" width="450px" /> </div> </ContentModal> ); } } export default RegistrationModal;
import React from 'react'; import ContentModal from 'Components/ContentModal'; class RegistrationModal extends React.Component { constructor(props) { super(props); this.state = { showLogout: false }; } backToConfig() { if (process.env.NODE_ENV !== 'development') { window.location = '/login?returnUrl=/config'; } } render() { let modalOpts = { openWithButton: true, dialogTitle: 'Start Registation Mode', cancelButtonText: 'Back', approveButtonText: 'Start Registration', openButtonText: 'Registration Mode', disableBackdropClick: true, cancelCallback: this.backToConfig, ...this.props }; modalOpts.confirmCallback = async () => { this.setState({ showLogout: true }); // Wait until the logout works OR we've tried too many times // This should allow the iFrame to load let count = 0; let maxCount = 15; while (count < maxCount) { count += 1; await new Promise(resolve => setTimeout(resolve, 1000)); } }; return ( <ContentModal {...modalOpts}> <div>{this.state.showLogout ? <iframe onLoad={this.props.confirmCallback} src="https://idp.u.washington.edu/idp/profile/Logout" height="335px" width="450px" /> : <p>Are you sure that you want to begin registration?</p>}</div> </ContentModal> ); } } export default RegistrationModal;
Allow 'back' button on Start Registration Modal to work?
Allow 'back' button on Start Registration Modal to work? This might not work. This might be stupid. This might need to be reverted. 🤷
JSX
mit
uwwebservices/idcard-webapp-poc,uwwebservices/idcard-webapp-poc
--- +++ @@ -2,6 +2,12 @@ import ContentModal from 'Components/ContentModal'; class RegistrationModal extends React.Component { + constructor(props) { + super(props); + this.state = { + showLogout: false + }; + } backToConfig() { if (process.env.NODE_ENV !== 'development') { window.location = '/login?returnUrl=/config'; @@ -15,14 +21,25 @@ approveButtonText: 'Start Registration', openButtonText: 'Registration Mode', disableBackdropClick: true, - cancelCallback: this.backToConfig + cancelCallback: this.backToConfig, + ...this.props + }; + modalOpts.confirmCallback = async () => { + this.setState({ showLogout: true }); + + // Wait until the logout works OR we've tried too many times + // This should allow the iFrame to load + let count = 0; + let maxCount = 15; + while (count < maxCount) { + count += 1; + await new Promise(resolve => setTimeout(resolve, 1000)); + } }; return ( - <ContentModal {...Object.assign({}, modalOpts, this.props)}> - <div> - <iframe src="https://idp.u.washington.edu/idp/profile/Logout" height="335px" width="450px" /> - </div> + <ContentModal {...modalOpts}> + <div>{this.state.showLogout ? <iframe onLoad={this.props.confirmCallback} src="https://idp.u.washington.edu/idp/profile/Logout" height="335px" width="450px" /> : <p>Are you sure that you want to begin registration?</p>}</div> </ContentModal> ); }
f11cc971247b5c8ba94e6d6dbf907acc54b01f6a
app/jsx/external_apps/components/Header.jsx
app/jsx/external_apps/components/Header.jsx
/** @jsx React.DOM */ define([ 'underscore', 'i18n!external_tools', 'react', 'react-router' ], function (_, I18n, React, {Link}) { return React.createClass({ displayName: 'Header', render() { var paragraph = I18n.t( '*See some LTI tools* that work great with Canvas. You can also check out the **Canvas Community topics about LTI tools**.', { wrappers: [ '<a href="https://www.eduappcenter.com/">$1</a>', '<a href="http://help.instructure.com/entries/20878626-lti-tools-and-examples">$1</a>' ]} ); return ( <div className="Header"> <h2 className="page-header" ref="pageHeader"> <span className="externalApps_label_text">{I18n.t('External Apps')}</span> <div className="externalApps_buttons_container"> {this.props.children} </div> </h2> <div className="well well-sm"> <p>{I18n.t('Apps are an easy way to add new features to Canvas. They can be added to individual courses, or to all courses in an account. Once configured, you can link to them through course modules and create assignments for assessment tools.')}</p> <p dangerouslySetInnerHTML={{ __html: paragraph }}></p> </div> </div> ) } }); });
/** @jsx React.DOM */ define([ 'underscore', 'i18n!external_tools', 'react', 'react-router' ], function (_, I18n, React, {Link}) { return React.createClass({ displayName: 'Header', render() { var paragraph = I18n.t( '*See some LTI tools* that work great with Canvas.', { wrappers: [ '<a href="https://www.eduappcenter.com/">$1</a>', ]} ); return ( <div className="Header"> <h2 className="page-header" ref="pageHeader"> <span className="externalApps_label_text">{I18n.t('External Apps')}</span> <div className="externalApps_buttons_container"> {this.props.children} </div> </h2> <div className="well well-sm"> <p>{I18n.t('Apps are an easy way to add new features to Canvas. They can be added to individual courses, or to all courses in an account. Once configured, you can link to them through course modules and create assignments for assessment tools.')}</p> <p dangerouslySetInnerHTML={{ __html: paragraph }}></p> </div> </div> ) } }); });
Remove Link to Community in Apps Page
Remove Link to Community in Apps Page Fixes PLAT-1120 Test Plan - Make sure the link labeled 'Canvas Community topics about Lti topics' is no longer in the paragraph at the top of the external apps settings page. Change-Id: Icf14d1a1c3fbbc702a41c1435abcc48972409de2 Reviewed-on: https://gerrit.instructure.com/57037 Tested-by: Jenkins Reviewed-by: Brad Horrocks <7b5c5d1f2eba6c540b8e53f17d87a9bd7dbf604b@instructure.com> QA-Review: August Thornton <9adc7a1161ddf32ff608de792a7e50179545f026@instructure.com> Product-Review: Weston Dransfield <e9203059795dc94e28a8831c65eb7869e818825e@instructure.com>
JSX
agpl-3.0
sfu/canvas-lms,snehakachroo1/LSI_replica,HotChalk/canvas-lms,leftplusrightllc/canvas-lms,juoni/canvas-lms,sdeleon28/canvas-lms,leftplusrightllc/canvas-lms,juoni/canvas-lms,snehakachroo1/LSI_replica,djbender/canvas-lms,redconfetti/canvas-lms,snehakachroo1/LSI_replica,antoniuslin/canvas-lms,skmezanul/canvas-lms,Rvor/canvas-lms,matematikk-mooc/canvas-lms,venturehive/canvas-lms,Rvor/canvas-lms,SwinburneOnline/canvas-lms,redconfetti/canvas-lms,kyroskoh/canvas-lms,greyhwndz/canvas-lms,whalejasmine/canvas-lms,whalejasmine/canvas-lms,roxolan/canvas-lms,skmezanul/canvas-lms,matematikk-mooc/canvas-lms,kyroskoh/canvas-lms,AndranikMarkosyan/lms,Jyaasa/canvas-lms,narigone/canvas,instructure/canvas-lms,AndranikMarkosyan/lms,instructure/canvas-lms,snehakachroo1/LSI_replica,fronteerio/canvas-lms,redconfetti/canvas-lms,sfu/canvas-lms,utkarshx/canvas-lms,antoniuslin/canvas-lms,instructure/canvas-lms,dgynn/canvas-lms,roxolan/canvas-lms,skmezanul/canvas-lms,tgroshon/canvas-lms,grahamb/canvas-lms,narigone/canvas,eCNAP/CANVAS,HotChalk/canvas-lms,antoniuslin/canvas-lms,sdeleon28/canvas-lms,utkarshx/canvas-lms,grahamb/canvas-lms,instructure/canvas-lms,SwinburneOnline/canvas-lms,jay3126/canvas-lms,djbender/canvas-lms,venturehive/canvas-lms,efrj/canvas-lms,venturehive/canvas-lms,fronteerio/canvas-lms,roxolan/canvas-lms,kyroskoh/canvas-lms,jay3126/canvas-lms,HotChalk/canvas-lms,sdeleon28/canvas-lms,djbender/canvas-lms,eCNAP/CANVAS,jay3126/canvas-lms,efrj/canvas-lms,fronteerio/canvas-lms,venturehive/canvas-lms,AndranikMarkosyan/lms,HotChalk/canvas-lms,SwinburneOnline/canvas-lms,jay3126/canvas-lms,sfu/canvas-lms,roxolan/canvas-lms,djbender/canvas-lms,Jyaasa/canvas-lms,matematikk-mooc/canvas-lms,leftplusrightllc/canvas-lms,dgynn/canvas-lms,sfu/canvas-lms,efrj/canvas-lms,tgroshon/canvas-lms,juoni/canvas-lms,AndranikMarkosyan/lms,utkarshx/canvas-lms,dgynn/canvas-lms,instructure/canvas-lms,sdeleon28/canvas-lms,antoniuslin/canvas-lms,juoni/canvas-lms,grahamb/canvas-lms,whalejasmine/canvas-lms,fronteerio/canvas-lms,redconfetti/canvas-lms,greyhwndz/canvas-lms,sfu/canvas-lms,Rvor/canvas-lms,tgroshon/canvas-lms,utkarshx/canvas-lms,instructure/canvas-lms,Jyaasa/canvas-lms,narigone/canvas,tgroshon/canvas-lms,Jyaasa/canvas-lms,whalejasmine/canvas-lms,skmezanul/canvas-lms,greyhwndz/canvas-lms,dgynn/canvas-lms,instructure/canvas-lms,leftplusrightllc/canvas-lms,eCNAP/CANVAS,greyhwndz/canvas-lms,grahamb/canvas-lms,sfu/canvas-lms,Rvor/canvas-lms,sfu/canvas-lms,kyroskoh/canvas-lms,matematikk-mooc/canvas-lms,efrj/canvas-lms,eCNAP/CANVAS,SwinburneOnline/canvas-lms,grahamb/canvas-lms,narigone/canvas
--- +++ @@ -13,10 +13,9 @@ render() { var paragraph = I18n.t( - '*See some LTI tools* that work great with Canvas. You can also check out the **Canvas Community topics about LTI tools**.', + '*See some LTI tools* that work great with Canvas.', { wrappers: [ '<a href="https://www.eduappcenter.com/">$1</a>', - '<a href="http://help.instructure.com/entries/20878626-lti-tools-and-examples">$1</a>' ]} );
880407c7bf444d42ab59bbde83210c33a2ae4c5e
src/components/footer/footer.jsx
src/components/footer/footer.jsx
var React = require('react'); module.exports = React.createClass({ mixins: [require('react-intl').IntlMixin], render: function () { return ( <div id="footer"> <div className="inner"> <ul className="links"> <li><a href="https://webmaker.org/en-US/terms">{this.getIntlMessage('legal')}</a></li> <li><a href="https://www.mozilla.org/en-US/privacy/websites/">{this.getIntlMessage('privacy')}</a></li> <li><a target="_blank" href="https://sendto.mozilla.org/page/contribute/join-mozilla?source=join_link">{this.getIntlMessage('donate')}</a></li> <li><a href="mailto:help@webmaker.org">{this.getIntlMessage('contact')}</a></li> <li><a target="_blank" href="https://twitter.com/Webmaker">{this.getIntlMessage('twitter')}</a></li> <li><a className="tools" target="_blank" href="http://teach.mozilla.org/tools">{this.getIntlMessage('thimble_goggles')}</a> </li> </ul> <img src="./img/mozilla.svg" width="98" height="25" alt="Mozilla" /> </div> </div> ); } });
var React = require('react'); module.exports = React.createClass({ mixins: [require('react-intl').IntlMixin], render: function () { return ( <div id="footer"> <div className="inner"> <ul className="links"> <li><a href="https://webmaker.org/#/legal">{this.getIntlMessage('legal')}</a></li> <li><a href="https://www.mozilla.org/en-US/privacy/websites/">{this.getIntlMessage('privacy')}</a></li> <li><a target="_blank" href="https://sendto.mozilla.org/page/contribute/join-mozilla?source=join_link">{this.getIntlMessage('donate')}</a></li> <li><a href="mailto:help@webmaker.org">{this.getIntlMessage('contact')}</a></li> <li><a target="_blank" href="https://twitter.com/Webmaker">{this.getIntlMessage('twitter')}</a></li> <li><a className="tools" target="_blank" href="http://teach.mozilla.org/tools">{this.getIntlMessage('thimble_goggles')}</a> </li> </ul> <img src="./img/mozilla.svg" width="98" height="25" alt="Mozilla" /> </div> </div> ); } });
Update link to new TOS. Re GH-533
Update link to new TOS. Re GH-533
JSX
mpl-2.0
mozilla-b2g/webmaker-fxos,vazquez/webmaker-browser,alanmoo/webmaker-browser,alanmoo/webmaker-browser,vazquez/webmaker-browser,mozilla/webmaker-browser,mozilla-b2g/webmaker-fxos,mozilla/webmaker-browser
--- +++ @@ -7,7 +7,7 @@ <div id="footer"> <div className="inner"> <ul className="links"> - <li><a href="https://webmaker.org/en-US/terms">{this.getIntlMessage('legal')}</a></li> + <li><a href="https://webmaker.org/#/legal">{this.getIntlMessage('legal')}</a></li> <li><a href="https://www.mozilla.org/en-US/privacy/websites/">{this.getIntlMessage('privacy')}</a></li> <li><a target="_blank" href="https://sendto.mozilla.org/page/contribute/join-mozilla?source=join_link">{this.getIntlMessage('donate')}</a></li> <li><a href="mailto:help@webmaker.org">{this.getIntlMessage('contact')}</a></li>
5299e13e130ec01f6ab312a8db6abf4dd866c64f
app/collections/manager-icon.jsx
app/collections/manager-icon.jsx
import PropTypes from 'prop-types'; import React from 'react'; import Dialog from 'modal-form/dialog'; import CollectionsManager from './collections-manager'; class CollectionsManagerIcon extends React.Component { constructor(props) { super(props); this.state = { open: false }; this.open = this.open.bind(this); this.close = this.close.bind(this); } open() { this.setState({ open: true }); } close() { this.setState({ open: false }); } render() { const subjectIDs = this.props.subject ? [this.props.subject.id] : []; return ( <button aria-label="Collect" className={`collections-manager-icon ${this.props.className}`} title="Collect" onClick={this.open} > <i className="fa fa-list fa-fw" /> {this.state.open && <Dialog tag="div" closeButton={true} onCancel={this.close}> <CollectionsManager onSuccess={this.close} project={this.props.project} subjectIDs={subjectIDs} user={this.props.user} /> </Dialog>} </button> ); } } CollectionsManagerIcon.defaultProps = { className: '' }; CollectionsManagerIcon.propTypes = { className: PropTypes.string, project: PropTypes.object, subject: PropTypes.shape({ id: PropTypes.string }), user: PropTypes.object }; export default CollectionsManagerIcon;
import PropTypes from 'prop-types'; import React from 'react'; import Dialog from 'modal-form/dialog'; import CollectionsManager from './collections-manager'; class CollectionsManagerIcon extends React.Component { constructor(props) { super(props); this.state = { open: false }; this.open = this.open.bind(this); this.close = this.close.bind(this); } open() { this.setState({ open: true }); } close(e) { this.setState({ open: false }); e.stopPropagation(); } render() { const subjectIDs = this.props.subject ? [this.props.subject.id] : []; return ( <button aria-label="Collect" className={`collections-manager-icon ${this.props.className}`} title="Collect" onClick={this.open} > <i className="fa fa-list fa-fw" /> {this.state.open && <Dialog tag="div" closeButton={true} onCancel={this.close}> <CollectionsManager onSuccess={this.close} project={this.props.project} subjectIDs={subjectIDs} user={this.props.user} /> </Dialog>} </button> ); } } CollectionsManagerIcon.defaultProps = { className: '' }; CollectionsManagerIcon.propTypes = { className: PropTypes.string, project: PropTypes.object, subject: PropTypes.shape({ id: PropTypes.string }), user: PropTypes.object }; export default CollectionsManagerIcon;
Fix collections close button Stop the click event from bubbling up to the collections button and opening the dialog every time it is closed.
Fix collections close button Stop the click event from bubbling up to the collections button and opening the dialog every time it is closed.
JSX
apache-2.0
amyrebecca/Panoptes-Front-End,zooniverse/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,amyrebecca/Panoptes-Front-End
--- +++ @@ -19,8 +19,9 @@ this.setState({ open: true }); } - close() { + close(e) { this.setState({ open: false }); + e.stopPropagation(); } render() {
cfd2e4a52226532b067b9bbec132690b11b80d60
app/components/Editor/VRComp.jsx
app/components/Editor/VRComp.jsx
import React, { Component } from 'react' import { withRouter } from 'react-router-dom' import firebase from 'APP/fire' class VRComp extends Component { popUp= () => { window.open(`../VR component/VRindex.html?${this.props.obj}?${this.props.mtl}`) } render() { return ( <div className = 'VR-slide-positon'> <button className="button is-primary" onClick={this.popUp}>Switch to VR </button> <br/> {this.props.description} </div> ) } } export default withRouter(VRComp)
import React, { Component } from 'react' import { withRouter } from 'react-router-dom' import firebase from 'APP/fire' class VRComp extends Component { popUp= () => { window.open(`../../../VR component/VRindex.html?${this.props.obj}?${this.props.mtl}`) } render() { return ( <div className = 'VR-slide-positon'> <button className="button is-primary" onClick={this.popUp}>Switch to VR </button> <br/> {this.props.description} </div> ) } } export default withRouter(VRComp)
Add VR on edit mode
Add VR on edit mode
JSX
mit
seal-team/Ngage,seal-team/Ngage,seal-team/Ngage
--- +++ @@ -4,7 +4,7 @@ class VRComp extends Component { popUp= () => { - window.open(`../VR component/VRindex.html?${this.props.obj}?${this.props.mtl}`) + window.open(`../../../VR component/VRindex.html?${this.props.obj}?${this.props.mtl}`) } render() { return (
db04f2d7fa0797092a9829a73fca50ce83fcb01e
client/components/Avatar.jsx
client/components/Avatar.jsx
import React from 'react'; import PropTypes from 'prop-types'; import webpackConfig from '../../config/webpack'; import './components.less'; const env = process.env.NODE_ENV === 'development' ? 'dev' : 'build'; const publishPath = webpackConfig[env].assetsPublicPath + webpackConfig[env].assetsSubDirectory; const avatarFallback = `${publishPath}/avatar/0.jpg`; const failTimes = new Map(); function noop() { } function handleError(e) { const times = failTimes.get(e.target) || 0; if (times >= 3) { return; } e.target.src = avatarFallback; failTimes.set(e.target, times + 1); } const Avatar = ({ src, size = 60, onClick = noop, className = '' }) => ( <img className={`component-avatar ${className}`} src={src} style={{ width: size, height: size, borderRadius: size / 2 }} onClick={onClick} onError={handleError} /> ); Avatar.propTypes = { src: PropTypes.string.isRequired, size: PropTypes.number, className: PropTypes.string, onClick: PropTypes.func, }; export default Avatar;
import React from 'react'; import PropTypes from 'prop-types'; import './components.less'; const avatarFallback = 'https://cdn.suisuijiang.com/fiora/avatar/0.jpg'; const failTimes = new Map(); function noop() { } function handleError(e) { const times = failTimes.get(e.target) || 0; if (times >= 2) { return; } e.target.src = avatarFallback; failTimes.set(e.target, times + 1); } const Avatar = ({ src, size = 60, onClick = noop, className = '' }) => ( <img className={`component-avatar ${className}`} src={src} style={{ width: size, height: size, borderRadius: size / 2 }} onClick={onClick} onError={handleError} /> ); Avatar.propTypes = { src: PropTypes.string.isRequired, size: PropTypes.number, className: PropTypes.string, onClick: PropTypes.func, }; export default Avatar;
Modify the wrong default avatar address
fix: Modify the wrong default avatar address
JSX
mit
yinxin630/fiora,yinxin630/fiora,yinxin630/fiora
--- +++ @@ -1,19 +1,16 @@ import React from 'react'; import PropTypes from 'prop-types'; -import webpackConfig from '../../config/webpack'; import './components.less'; -const env = process.env.NODE_ENV === 'development' ? 'dev' : 'build'; -const publishPath = webpackConfig[env].assetsPublicPath + webpackConfig[env].assetsSubDirectory; -const avatarFallback = `${publishPath}/avatar/0.jpg`; +const avatarFallback = 'https://cdn.suisuijiang.com/fiora/avatar/0.jpg'; const failTimes = new Map(); function noop() { } function handleError(e) { const times = failTimes.get(e.target) || 0; - if (times >= 3) { + if (times >= 2) { return; } e.target.src = avatarFallback;
47049bf7bbb8f21b1f92d3e6fc1e1e58572d4726
packages/lesswrong/components/shortform/ShortformPage.jsx
packages/lesswrong/components/shortform/ShortformPage.jsx
import React from 'react'; import { Components, registerComponent } from 'meteor/vulcan:core'; import { withStyles } from '@material-ui/core/styles'; const styles = theme => ({ column: { width:680, margin:"auto" } }) const ShortformPage = ({classes}) => { const { SingleColumnSection, ShortformThreadList, SectionTitle, TabNavigationMenu } = Components return ( <SingleColumnSection> <TabNavigationMenu /> {/* TODO: JP do whatever to the above */} <div className={classes.column}> <SectionTitle title="Shortform Content [Beta]"/> <ShortformThreadList terms={{view: 'shortform', limit:20, testLimit:30}} /> </div> </SingleColumnSection> ) } registerComponent('ShortformPage', ShortformPage, withStyles(styles, {name:"ShortformPage"}));
import React from 'react'; import { Components, registerComponent } from 'meteor/vulcan:core'; import { withStyles } from '@material-ui/core/styles'; const styles = theme => ({ column: { maxWidth:680, margin:"auto" } }) const ShortformPage = ({classes}) => { const { SingleColumnSection, ShortformThreadList, SectionTitle, TabNavigationMenu } = Components return ( <SingleColumnSection> <TabNavigationMenu /> {/* TODO: JP do whatever to the above */} <div className={classes.column}> <SectionTitle title="Shortform Content [Beta]"/> <ShortformThreadList terms={{view: 'shortform', limit:20, testLimit:30}} /> </div> </SingleColumnSection> ) } registerComponent('ShortformPage', ShortformPage, withStyles(styles, {name:"ShortformPage"}));
Fix shortform page width on mobile
Fix shortform page width on mobile
JSX
mit
Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope
--- +++ @@ -4,7 +4,7 @@ const styles = theme => ({ column: { - width:680, + maxWidth:680, margin:"auto" } })
b86bfcfeeeb61b2f4f60164e18a974129c899bec
packages/lesswrong/components/users/UsersSingle.jsx
packages/lesswrong/components/users/UsersSingle.jsx
import { Components, registerComponent, Utils } from 'meteor/vulcan:core'; import React from 'react'; import { withRouter } from 'react-router'; import Users from "meteor/vulcan:users"; const UsersSingle = ({params, router}) => { const slug = Utils.slugify(params.slug); const canonicalUrl = Users.getProfileUrlFromSlug(slug); if (router.location.pathname !== canonicalUrl) { router.replace(canonicalUrl); return null; } else { return <Components.UsersProfile userId={params._id} slug={slug} /> } }; UsersSingle.displayName = "UsersSingle"; registerComponent('UsersSingle', UsersSingle, withRouter);
import { Components, registerComponent, Utils } from 'meteor/vulcan:core'; import React from 'react'; import { withRouter } from 'react-router'; import Users from "meteor/vulcan:users"; const UsersSingle = ({params, router}) => { const slug = Utils.slugify(params.slug); const canonicalUrl = Users.getProfileUrlFromSlug(slug); if (router.location.pathname !== canonicalUrl) { // A Javascript redirect, which replaces the history entry (so you don't // have a redirector interfering with the back button). Does not cause a // pageload. router.replace(canonicalUrl); return null; } else { return <Components.UsersProfile userId={params._id} slug={slug} /> } }; UsersSingle.displayName = "UsersSingle"; registerComponent('UsersSingle', UsersSingle, withRouter);
Comment about what router.replace does
Comment about what router.replace does
JSX
mit
Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope
--- +++ @@ -7,6 +7,9 @@ const slug = Utils.slugify(params.slug); const canonicalUrl = Users.getProfileUrlFromSlug(slug); if (router.location.pathname !== canonicalUrl) { + // A Javascript redirect, which replaces the history entry (so you don't + // have a redirector interfering with the back button). Does not cause a + // pageload. router.replace(canonicalUrl); return null; } else {
d27b0a2433c8967bf3ef40b0aa843b33531c6754
src/components/languagechooser/languagechooser.jsx
src/components/languagechooser/languagechooser.jsx
var classNames = require('classnames'); var React = require('react'); var jar = require('../../lib/jar.js'); var languages = require('../../../languages.json'); var Form = require('../forms/form.jsx'); var Select = require('../forms/select.jsx'); /** * Footer dropdown menu that allows one to change their language. */ var LanguageChooser = React.createClass({ type: 'LanguageChooser', getDefaultProps: function () { return { languages: languages, locale: window._locale }; }, onSetLanguage: function (name, value) { jar.set('scratchlanguage', value); window.location.reload(); }, render: function () { var classes = classNames( 'language-chooser', this.props.className ); var languageOptions = Object.keys(this.props.languages).map(function (value) { return {value: value, label: this.props.languages[value]}; }.bind(this)); return ( <Form className={classes}> <Select name="language" options={languageOptions} defaultValue={this.props.locale} onChange={this.onSetLanguage} /> </Form> ); } }); module.exports = LanguageChooser;
var classNames = require('classnames'); var React = require('react'); var jar = require('../../lib/jar.js'); var languages = require('../../../languages.json'); var Form = require('../forms/form.jsx'); var Select = require('../forms/select.jsx'); /** * Footer dropdown menu that allows one to change their language. */ var LanguageChooser = React.createClass({ type: 'LanguageChooser', getDefaultProps: function () { return { languages: languages, locale: window._locale }; }, onSetLanguage: function (name, value) { jar.set('scratchlanguage', value); window.location.reload(); }, render: function () { var classes = classNames( 'language-chooser', this.props.className ); var languageOptions = Object.keys(this.props.languages).map(function (value) { return {value: value, label: this.props.languages[value]}; }.bind(this)); return ( <Form className={classes}> <Select name="language" options={languageOptions} defaultValue={this.props.locale} onChange={this.onSetLanguage} required /> </Form> ); } }); module.exports = LanguageChooser;
Update language chooser for formsy
Update language chooser for formsy
JSX
bsd-3-clause
LLK/scratch-www,LLK/scratch-www
--- +++ @@ -34,7 +34,8 @@ <Select name="language" options={languageOptions} defaultValue={this.props.locale} - onChange={this.onSetLanguage} /> + onChange={this.onSetLanguage} + required /> </Form> ); }
65668c0a8581980a5fe112cf1aa58403d1c381c7
src/js/components/OptionalVolumesComponent.jsx
src/js/components/OptionalVolumesComponent.jsx
import React from "react/addons"; import ContainerVolumesComponent from "../components/ContainerVolumesComponent"; import LocalVolumesComponent from "../components/LocalVolumesComponent"; var OptionalVolumesComponent = React.createClass({ displayName: "OptionalVolumesComponent", propTypes: { errorIndices: React.PropTypes.object.isRequired, fields: React.PropTypes.object.isRequired, getErrorMessage: React.PropTypes.func.isRequired }, render: function () { return ( <div> <LocalVolumesComponent errorIndices={this.props.errorIndices} getErrorMessage={this.props.getErrorMessage} fields={this.props.fields} /> <ContainerVolumesComponent errorIndices={this.props.errorIndices} getErrorMessage={this.props.getErrorMessage} fields={this.props.fields} /> </div> ); } }); export default OptionalVolumesComponent;
import React from "react/addons"; import ContainerVolumesComponent from "../components/ContainerVolumesComponent"; import LocalVolumesComponent from "../components/LocalVolumesComponent"; import NetworkVolumesComponent from "../components/NetworkVolumesComponent"; var OptionalVolumesComponent = React.createClass({ displayName: "OptionalVolumesComponent", propTypes: { errorIndices: React.PropTypes.object.isRequired, fields: React.PropTypes.object.isRequired, getErrorMessage: React.PropTypes.func.isRequired }, render: function () { return ( <div> <LocalVolumesComponent errorIndices={this.props.errorIndices} getErrorMessage={this.props.getErrorMessage} fields={this.props.fields} /> <NetworkVolumesComponent errorIndices={this.props.errorIndices} getErrorMessage={this.props.getErrorMessage} fields={this.props.fields} /> <ContainerVolumesComponent errorIndices={this.props.errorIndices} getErrorMessage={this.props.getErrorMessage} fields={this.props.fields} /> </div> ); } }); export default OptionalVolumesComponent;
Add network volumes component to volumes component
Add network volumes component to volumes component
JSX
apache-2.0
cribalik/marathon-ui,mesosphere/marathon-ui,mesosphere/marathon-ui,cribalik/marathon-ui
--- +++ @@ -4,6 +4,8 @@ from "../components/ContainerVolumesComponent"; import LocalVolumesComponent from "../components/LocalVolumesComponent"; +import NetworkVolumesComponent + from "../components/NetworkVolumesComponent"; var OptionalVolumesComponent = React.createClass({ displayName: "OptionalVolumesComponent", @@ -21,6 +23,10 @@ errorIndices={this.props.errorIndices} getErrorMessage={this.props.getErrorMessage} fields={this.props.fields} /> + <NetworkVolumesComponent + errorIndices={this.props.errorIndices} + getErrorMessage={this.props.getErrorMessage} + fields={this.props.fields} /> <ContainerVolumesComponent errorIndices={this.props.errorIndices} getErrorMessage={this.props.getErrorMessage}
50a27697fe854f66ce47d5d1097d578e570cd7eb
client/sections/profile/components/Description.jsx
client/sections/profile/components/Description.jsx
import React, { Component } from 'react'; class Description extends Component { render() { const { description, updateDescription } = this.props; return ( <div className="profile-section"> <div className="profile-title">About Me</div> <div contentEditable="true" className="description" ref="description" onKeyUp={() => { updateDescription(this.refs.description.innerText); console.log(this.refs.description.innerText); }} onKeyDown={(e) => { if (this.refs.description.innerText.length > 100 && e.which !== 8) { e.preventDefault(); } }} onPaste={(e) => { if (this.refs.description.innerText.length > 100) { e.preventDefault(); } }} > {description} </div> </div> ); } } export default Description;
import React, { Component } from 'react'; class Description extends Component { render() { const { description, updateDescription } = this.props; return ( <div className="profile-section"> <div className="profile-title">About Me</div> <div contentEditable="true" className="description" ref="description" onKeyUp={() => { updateDescription(this.refs.description.innerText); }} onKeyDown={(e) => { if (e.which === 13) { e.preventDefault(); this.refs.description.blur(); } if (this.refs.description.innerText.length > 100 && e.which !== 8) { e.preventDefault(); } }} onPaste={(e) => { if (this.refs.description.innerText.length > 100) { e.preventDefault(); } }} > {description} </div> </div> ); } } export default Description;
Change default behavior for enter key
Change default behavior for enter key
JSX
mit
VictoriousResistance/iDioma,VictoriousResistance/iDioma
--- +++ @@ -14,9 +14,12 @@ ref="description" onKeyUp={() => { updateDescription(this.refs.description.innerText); - console.log(this.refs.description.innerText); }} onKeyDown={(e) => { + if (e.which === 13) { + e.preventDefault(); + this.refs.description.blur(); + } if (this.refs.description.innerText.length > 100 && e.which !== 8) { e.preventDefault(); }
daca49dc15caa0da30559e26a8fa8317bc5f480e
src/renderer/modal/modalAutoUpdateConfirm/view.jsx
src/renderer/modal/modalAutoUpdateConfirm/view.jsx
import React from "react"; import { Modal } from "modal/modal"; import { Line } from "rc-progress"; import Link from "component/link/index"; const { ipcRenderer } = require("electron"); class ModalAutoUpdateConfirm extends React.PureComponent { render() { const { closeModal, declineAutoUpdate } = this.props; return ( <Modal isOpen={true} type="confirm" contentLabel={__("Update Downloaded")} confirmButtonLabel={__("Upgrade")} abortButtonLabel={__("Not now")} onConfirmed={() => { ipcRenderer.send("autoUpdateAccepted"); }} onAborted={() => { declineAutoUpdate(); closeModal(); }} > <section> <h3 className="text-center">{__("LBRY Update Ready")}</h3> <p> {__( 'Your LBRY update is ready. Restart LBRY now to use it!' )} </p> </section> </Modal> ); } } export default ModalAutoUpdateConfirm;
import React from "react"; import { Modal } from "modal/modal"; import { Line } from "rc-progress"; import Link from "component/link/index"; const { ipcRenderer } = require("electron"); class ModalAutoUpdateConfirm extends React.PureComponent { render() { const { closeModal, declineAutoUpdate } = this.props; return ( <Modal isOpen={true} type="confirm" contentLabel={__("Update Downloaded")} confirmButtonLabel={__("Upgrade")} abortButtonLabel={__("Not now")} onConfirmed={() => { ipcRenderer.send("autoUpdateAccepted"); }} onAborted={() => { declineAutoUpdate(); closeModal(); }} > <section> <h3 className="text-center">{__("LBRY Update Ready")}</h3> <p> {__( 'Your LBRY update is ready. Restart LBRY now to use it!' )} </p> <p className="meta text-center"> {__('Want to know what has changed?')} See the{' '} <Link label={__('release notes')} href="https://github.com/lbryio/lbry-app/releases" />. </p> </section> </Modal> ); } } export default ModalAutoUpdateConfirm;
Add release notes to auto update dialogs
Add release notes to auto update dialogs
JSX
mit
lbryio/lbry-app,lbryio/lbry-electron,lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-electron
--- +++ @@ -31,6 +31,10 @@ 'Your LBRY update is ready. Restart LBRY now to use it!' )} </p> + <p className="meta text-center"> + {__('Want to know what has changed?')} See the{' '} + <Link label={__('release notes')} href="https://github.com/lbryio/lbry-app/releases" />. + </p> </section> </Modal> );
e22ad557e894506a7b9711e4dc78e912e0ad8cc5
src/js/components/RegistrationComponents/ConfirmCodeComponent.jsx
src/js/components/RegistrationComponents/ConfirmCodeComponent.jsx
/** * ConfirmCodeComponent.jsx * Created by Kyle Fox 12/11/15 **/ import React, { PropTypes } from 'react'; import Navbar from '../SharedComponents/NavigationComponents.jsx'; import TextInputComponent from '../SharedComponents/TextInputComponent.jsx'; import PasswordInputComponent from '../SharedComponents/PasswordInputComponent.jsx'; import DiscreteProgressBarComponent from '../SharedComponents/DiscreteProgressBarComponent.jsx'; // An email input field that does basic validation for .mil and .gov emails export default class ConfirmCode extends React.Component { render() { return ( <div> <Navbar /> <div className="usa-da-content"> <DiscreteProgressBarComponent progressCurrentStep="3" progressTotalSteps="4" /> <h1>Your email has been verified!</h1> <p>Please continue the registration process by providing the following information.</p> <p><TextInputComponent inputClass="" inputPlaceholder="First Name" inputName="regFirstName" /></p> <p><TextInputComponent inputClass="" inputPlaceholder="Last Name" inputName="regLastName" /></p> <p><TextInputComponent inputClass="" inputPlaceholder="Phone Number" inputName="regPhoneNumber" /></p> <p><PasswordInputComponent inputClass="" inputPlaceholder="Password" inputName="regPassword" /></p> <p><PasswordInputComponent inputClass="" inputPlaceholder="Confirm Password" inputName="regConfirmPassword" /></p> </div> </div> ); } }
/** * ConfirmCodeComponent.jsx * Created by Kyle Fox 12/11/15 **/ import React from 'react'; // An email input field that does basic validation for .mil and .gov emails export default class ConfirmCode extends React.Component { render() { return ( <h1>Confirm</h1> ); } }
Revert "Moving registration confirmation code into correct jsx based on routing."
Revert "Moving registration confirmation code into correct jsx based on routing." This reverts commit 6335b45612095a9fc7ea0cf4acd5c3f1a1c8e29f.
JSX
cc0-1.0
fedspendingtransparency/data-act-broker-web-app,fedspendingtransparency/data-act-broker-web-app
--- +++ @@ -3,29 +3,13 @@ * Created by Kyle Fox 12/11/15 **/ -import React, { PropTypes } from 'react'; -import Navbar from '../SharedComponents/NavigationComponents.jsx'; -import TextInputComponent from '../SharedComponents/TextInputComponent.jsx'; -import PasswordInputComponent from '../SharedComponents/PasswordInputComponent.jsx'; -import DiscreteProgressBarComponent from '../SharedComponents/DiscreteProgressBarComponent.jsx'; +import React from 'react'; // An email input field that does basic validation for .mil and .gov emails export default class ConfirmCode extends React.Component { render() { return ( - <div> - <Navbar /> - <div className="usa-da-content"> - <DiscreteProgressBarComponent progressCurrentStep="3" progressTotalSteps="4" /> - <h1>Your email has been verified!</h1> - <p>Please continue the registration process by providing the following information.</p> - <p><TextInputComponent inputClass="" inputPlaceholder="First Name" inputName="regFirstName" /></p> - <p><TextInputComponent inputClass="" inputPlaceholder="Last Name" inputName="regLastName" /></p> - <p><TextInputComponent inputClass="" inputPlaceholder="Phone Number" inputName="regPhoneNumber" /></p> - <p><PasswordInputComponent inputClass="" inputPlaceholder="Password" inputName="regPassword" /></p> - <p><PasswordInputComponent inputClass="" inputPlaceholder="Confirm Password" inputName="regConfirmPassword" /></p> - </div> - </div> + <h1>Confirm</h1> ); } }
31984488acd37f10b75b73d0c145c03e5b2fc83d
app-management/components/AppListing/AppListing.jsx
app-management/components/AppListing/AppListing.jsx
import React, { PropTypes } from 'react'; import LoadingSpinner from '../LoadingSpinner'; import ErrorAlert from '../ErrorAlert'; import AppPreview from './AppPreview'; import NewAppInstructions from '../NewAppPage/NewAppInstructions'; class AppListing extends React.Component { componentWillMount() { this.props.fetchAppListing(); } render () { const { isFetching, error, apps } = this.props; const content = apps.map(app => <AppPreview app={app} key={app.id} />); const showNewAppInstructions = !isFetching && apps.length === 0; return ( <div className="row"> <div className="col-md-12"> <h2><i className="fa fa-list" aria-hidden="true" /> My Apps</h2> <br /> <LoadingSpinner loading={isFetching} /> <ErrorAlert error={error} /> {showNewAppInstructions ? <NewAppInstructions /> : null} {content} </div> </div> ); } } AppListing.propTypes = { fetchAppListing: PropTypes.func.isRequired, isFetching: PropTypes.bool.isRequired, error: PropTypes.string.isRequired, apps: PropTypes.arrayOf(PropTypes.shape()).isRequired, }; export default AppListing;
import React, { PropTypes } from 'react'; import LoadingSpinner from '../LoadingSpinner'; import ErrorAlert from '../ErrorAlert'; import AppPreview from './AppPreview'; import NewAppInstructions from '../NewAppPage/NewAppInstructions'; class AppListing extends React.Component { componentWillMount() { this.props.fetchAppListing(); } render () { const { isFetching, error, apps } = this.props; const content = apps.map(app => <AppPreview app={app} key={app.id} />); const showNewAppInstructions = !isFetching && !error && apps.length === 0; return ( <div className="row"> <div className="col-md-12"> <h2><i className="fa fa-list" aria-hidden="true" /> My Apps</h2> <br /> <LoadingSpinner loading={isFetching} /> <ErrorAlert error={error} /> {showNewAppInstructions ? <NewAppInstructions /> : null} {content} </div> </div> ); } } AppListing.propTypes = { fetchAppListing: PropTypes.func.isRequired, isFetching: PropTypes.bool.isRequired, error: PropTypes.string.isRequired, apps: PropTypes.arrayOf(PropTypes.shape()).isRequired, }; export default AppListing;
Hide new app instructions when showing app listing error
Hide new app instructions when showing app listing error
JSX
apache-2.0
sarraloew/developer.concur.com,HeathH-Concur/developer.concur.com,sarraloew/developer.concur.com,bhague1281/developer.concur.com,sarraloew/developer.concur.com,sarraloew/developer.concur.com,HeathH-Concur/developer.concur.com,sarraloew/developer.concur.com,concur/developer.concur.com,bhague1281/developer.concur.com,HeathH-Concur/developer.concur.com,bhague1281/developer.concur.com,HeathH-Concur/developer.concur.com,concur/developer.concur.com,concur/developer.concur.com,bhague1281/developer.concur.com,bhague1281/developer.concur.com,concur/developer.concur.com,concur/developer.concur.com,HeathH-Concur/developer.concur.com
--- +++ @@ -12,7 +12,7 @@ render () { const { isFetching, error, apps } = this.props; const content = apps.map(app => <AppPreview app={app} key={app.id} />); - const showNewAppInstructions = !isFetching && apps.length === 0; + const showNewAppInstructions = !isFetching && !error && apps.length === 0; return ( <div className="row">
ca99fba35eea1caf8289ee94d2b77429798cf578
src/app/components/simple-editable-list/SimpleEditableListItem.jsx
src/app/components/simple-editable-list/SimpleEditableListItem.jsx
import React, { Component } from 'react'; import PropTypes from 'prop-types'; const propTypes = { field: PropTypes.shape({ simpleListHeading: PropTypes.string.isRequired, simpleListDescription: PropTypes.string }), handleEditClick: PropTypes.func.isRequired, handleDeleteClick: PropTypes.func.isRequired, disabled: PropTypes.bool.isRequired } export default class SimpleEditableListItemItem extends Component { constructor(props) { super(props); } handleEditClick = () => { this.props.handleEditClick(this.props.field) } handleDeleteClick = () => { this.props.handleDeleteClick(this.props.field) } render() { return ( <li className="simple-select-list__item grid"> <div className="grid__col-lg-10"> <p className="font-weight--600">{this.props.field.simpleListHeading}</p> <p>{this.props.field.simpleListDescription}</p> </div> <div className="grid__col-lg-2"> <p style={{"textAlign": "right"}}> <button type="button" className="btn btn--link" onClick={this.handleEditClick} disabled={this.props.disabled}>Edit</button> | <button type="button" className="btn btn--link" onClick={this.handleDeleteClick} disabled={this.props.disabled}>Delete</button> </p> </div> </li> ) } } SimpleEditableListItemItem.propTypes = propTypes;
import React, { Component } from 'react'; import PropTypes from 'prop-types'; const propTypes = { field: PropTypes.shape({ simpleListHeading: PropTypes.string.isRequired, simpleListDescription: PropTypes.string }), handleEditClick: PropTypes.func.isRequired, handleDeleteClick: PropTypes.func.isRequired, disabled: PropTypes.bool.isRequired } export default class SimpleEditableListItemItem extends Component { constructor(props) { super(props); } handleEditClick = () => { this.props.handleEditClick(this.props.field) } handleDeleteClick = () => { this.props.handleDeleteClick(this.props.field) } render() { return ( <li className="simple-select-list__item grid"> <div className="grid__col-lg-10"> <p className="font-weight--600">{this.props.field.simpleListHeading}</p> <p>{this.props.field.simpleListDescription}</p> </div> <div className="grid__col-lg-2"> <p className="text-right"> <button type="button" className="btn btn--link" onClick={this.handleEditClick} disabled={this.props.disabled}>Edit</button> | <button type="button" className="btn btn--link" onClick={this.handleDeleteClick} disabled={this.props.disabled}>Delete</button> </p> </div> </li> ) } } SimpleEditableListItemItem.propTypes = propTypes;
Use class name instead of inline style
Use class name instead of inline style
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -32,7 +32,7 @@ <p>{this.props.field.simpleListDescription}</p> </div> <div className="grid__col-lg-2"> - <p style={{"textAlign": "right"}}> + <p className="text-right"> <button type="button" className="btn btn--link" onClick={this.handleEditClick} disabled={this.props.disabled}>Edit</button> | <button type="button" className="btn btn--link" onClick={this.handleDeleteClick} disabled={this.props.disabled}>Delete</button> </p>
cf1e3d692be42c548299c76bf93f0421bde79929
js/search.jsx
js/search.jsx
const React = require('react') const ShowCard = require('./ShowCard') const data = require('../public/data') const Search = () => ( <div className='container'> <div className='shows'> {data.shows.map((show) => ( <ShowCard show={show} /> ))} </div> </div> ) module.exports = Search
const React = require('react') const ShowCard = require('./ShowCard') const data = require('../public/data') const Search = () => ( <div className='container'> <div className='shows'> {data.shows.map((show) => ( <ShowCard show={show} key={show.imdbID}/> ))} </div> </div> ) module.exports = Search
Fix the unique key prop error
Fix the unique key prop error
JSX
mit
michaeldumalag/ReactSelfLearning,michaeldumalag/ReactSelfLearning
--- +++ @@ -6,7 +6,7 @@ <div className='container'> <div className='shows'> {data.shows.map((show) => ( - <ShowCard show={show} /> + <ShowCard show={show} key={show.imdbID}/> ))} </div> </div>
55bdbdb19069301bfa2a30e19d39f9329a772e84
src/js/disability-benefits/components/ClaimsDecision.jsx
src/js/disability-benefits/components/ClaimsDecision.jsx
import React from 'react'; class ClaimsDecision extends React.Component { render() { return ( <div className="claim-decision-is-ready usa-alert usa-alert-info claims-no-icon"> <h4>Your claim decision is ready</h4> <p>VA sent you a claim decision by U.S mail. Please allow up to 8 business days for it to arrive.</p> <p>Do you disagree with your claim decision? <a href="/disability-benefits/claims-appeal">File an appeal</a></p> <p>If you have new evidence to support your claim and have no yet appealed, you can ask VA to <a href="/disability-benefits/claims-process/claim-types/reopened-claim">Reopen your claim</a></p> </div> ); } } export default ClaimsDecision;
import React from 'react'; class ClaimsDecision extends React.Component { render() { return ( <div className="claim-decision-is-ready usa-alert usa-alert-info claims-no-icon"> <h4>Your claim decision is ready</h4> <p>We sent you a packet by U.S. mail that includes details of the decision or award. Please allow 7 business days for your packet to arrive before contacting a VA call center.</p> <p>Do you disagree with your claim decision? <a href="/disability-benefits/claims-appeal">File an appeal</a></p> <p>If you have new evidence to support your claim and have no yet appealed, you can ask VA to <a href="/disability-benefits/claims-process/claim-types/reopened-claim">Reopen your claim</a></p> </div> ); } } export default ClaimsDecision;
Update content for your claim decision is ready alert
Update content for your claim decision is ready alert
JSX
cc0-1.0
department-of-veterans-affairs/vets-website,department-of-veterans-affairs/vets-website
--- +++ @@ -5,7 +5,7 @@ return ( <div className="claim-decision-is-ready usa-alert usa-alert-info claims-no-icon"> <h4>Your claim decision is ready</h4> - <p>VA sent you a claim decision by U.S mail. Please allow up to 8 business days for it to arrive.</p> + <p>We sent you a packet by U.S. mail that includes details of the decision or award. Please allow 7 business days for your packet to arrive before contacting a VA call center.</p> <p>Do you disagree with your claim decision? <a href="/disability-benefits/claims-appeal">File an appeal</a></p> <p>If you have new evidence to support your claim and have no yet appealed, you can ask VA to <a href="/disability-benefits/claims-process/claim-types/reopened-claim">Reopen your claim</a></p> </div>
58b3aef8777f14e26f334c3a3a63518f85cd1b70
app/javascript/app/pages/ndc-search/ndc-search-component.jsx
app/javascript/app/pages/ndc-search/ndc-search-component.jsx
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import Header from 'components/header'; import Intro from 'components/intro'; import AutocompleteSearch from 'components/autocomplete-search'; import ResultCard from 'components/result-card'; import NDCSearchMap from 'components/ndcs-search-map'; import background from 'assets/backgrounds/home_bg_1'; import layout from 'styles/layout.scss'; import styles from './ndc-search-styles.scss'; class SearchPage extends PureComponent { render() { const { results } = this.props; return ( <div> <Header image={background}> <div className={layout.content}> <div className={styles.headerCols}> <Intro title="NDC Content Search" /> <AutocompleteSearch /> </div> </div> </Header> <div className={cx(layout.content, styles.contentCols)}> <div className="resultsList"> {results && results.map(result => ( <ResultCard key={result.iso_code3} result={result} /> ))} </div> <NDCSearchMap /> </div> </div> ); } } SearchPage.propTypes = { query: PropTypes.string, // eslint-disable-line results: PropTypes.array, // eslint-disable-line onResultClick: PropTypes.func.isRequired // eslint-disable-line }; SearchPage.defaultProps = { countriesOptions: [] }; export default SearchPage;
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import Sticky from 'react-stickynode'; import Header from 'components/header'; import Intro from 'components/intro'; import AutocompleteSearch from 'components/autocomplete-search'; import ResultCard from 'components/result-card'; import NDCSearchMap from 'components/ndcs-search-map'; import background from 'assets/backgrounds/home_bg_1'; import layout from 'styles/layout.scss'; import styles from './ndc-search-styles.scss'; class SearchPage extends PureComponent { render() { const { results } = this.props; return ( <div> <Header image={background}> <div className={layout.content}> <div className={styles.headerCols}> <Intro title="NDC Content Search" /> <AutocompleteSearch /> </div> </div> </Header> <div className={cx(layout.content, styles.contentCols)}> <div className="resultsList"> {results && results.map(result => ( <ResultCard key={result.iso_code3} result={result} /> ))} </div> <Sticky> <NDCSearchMap /> </Sticky> </div> </div> ); } } SearchPage.propTypes = { query: PropTypes.string, // eslint-disable-line results: PropTypes.array, // eslint-disable-line onResultClick: PropTypes.func.isRequired // eslint-disable-line }; SearchPage.defaultProps = { countriesOptions: [] }; export default SearchPage;
Make the search map sticky
Make the search map sticky
JSX
mit
Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch
--- +++ @@ -1,6 +1,7 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; +import Sticky from 'react-stickynode'; import Header from 'components/header'; import Intro from 'components/intro'; @@ -33,7 +34,9 @@ <ResultCard key={result.iso_code3} result={result} /> ))} </div> - <NDCSearchMap /> + <Sticky> + <NDCSearchMap /> + </Sticky> </div> </div> );
5f60504128ea68ef2fd0da1e22066121f7f586f6
src/components/controls/Range.jsx
src/components/controls/Range.jsx
// @flow import React from "react"; import s from "./styles.scss"; const Range = (props: { name: string, types: { range: [number, number] }, value: number, step: ?number, onSetFilterOption: (string, any) => {} }) => <div className={s.range}> <div className={s.label}> {props.name} </div> <div className={s.rangeGroup}> <input type="range" min={props.types.range[0]} max={props.types.range[1]} value={props.value} step={props.step || 1} onChange={e => props.onSetFilterOption(props.name, e.target.value)} /> <span className={s.value}> {props.value} </span> </div> </div>; export default Range;
// @flow import React from "react"; import s from "./styles.scss"; const Range = (props: { name: string, types: { range: [number, number] }, value: number, step: ?number, onSetFilterOption: (string, any) => {} }) => <div className={s.range}> <div className={s.label}> {props.name} </div> <div className={s.rangeGroup}> <input type="range" min={props.types.range[0]} max={props.types.range[1]} value={props.value} step={props.step || 1} onChange={e => props.onSetFilterOption(props.name, parseFloat(e.target.value))} /> <span className={s.value}> {props.value} </span> </div> </div>; export default Range;
Fix range control not handling decimal steps
Fix range control not handling decimal steps
JSX
mit
gyng/ditherer,gyng/ditherer,gyng/ditherer
--- +++ @@ -22,7 +22,8 @@ max={props.types.range[1]} value={props.value} step={props.step || 1} - onChange={e => props.onSetFilterOption(props.name, e.target.value)} + onChange={e => + props.onSetFilterOption(props.name, parseFloat(e.target.value))} /> <span className={s.value}>
a27274e0cf16ad35b3281c5fafe1e996ad2d3810
src/index.jsx
src/index.jsx
/* eslint-disable no-shadow, import/no-extraneous-dependencies */ import 'babel-polyfill'; import React from 'react'; import reactDOM from 'react-dom'; import { AppContainer } from 'react-hot-loader'; import store from './redux/store'; import Root from './containers/Root'; require('./style/style.scss'); const render = (Component) => { reactDOM.render( <AppContainer> <Component store={store} /> </AppContainer>, document.getElementById('root') ); }; render(Root); // Hot Module Replacement API if (module.hot) { module.hot.accept('./containers/Root', () => { render(Root); }); }
import 'babel-polyfill'; import React from 'react'; import reactDOM from 'react-dom'; import { AppContainer } from 'react-hot-loader'; // eslint-disable-line import/no-extraneous-dependencies import store from './redux/store'; import Root from './containers/Root'; import './style/style.scss'; const render = (Component) => { reactDOM.render( <AppContainer> <Component store={store} /> </AppContainer>, document.getElementById('root') ); }; render(Root); // Hot Module Replacement API if (module.hot) { module.hot.accept('./containers/Root', () => { render(Root); }); }
Remove unused eslint disabled rule from indes.jsx
[Refactor] Remove unused eslint disabled rule from indes.jsx
JSX
isc
eddyerburgh/palette-picker,eddyerburgh/palette-picker
--- +++ @@ -1,12 +1,10 @@ -/* eslint-disable no-shadow, import/no-extraneous-dependencies */ import 'babel-polyfill'; import React from 'react'; import reactDOM from 'react-dom'; -import { AppContainer } from 'react-hot-loader'; +import { AppContainer } from 'react-hot-loader'; // eslint-disable-line import/no-extraneous-dependencies import store from './redux/store'; import Root from './containers/Root'; - -require('./style/style.scss'); +import './style/style.scss'; const render = (Component) => { reactDOM.render(
592f6970d31180f878b418fa62eabcb462122547
docs/src/components/Components/Sliders/CustomRangeAndTicks.jsx
docs/src/components/Components/Sliders/CustomRangeAndTicks.jsx
import React from 'react'; import { Slider } from 'react-md'; const CustomRangeAndTicks = () => ( <div> <Slider id="custom-range-continuous-slider" label="Min = 1, Max = 3, Step = 0.5" min={1} max={3} step={0.5} /> <Slider id="disctete-ticks-slider" label="Discrete with ticks and precision" discrete max={0.25} step={0.01} discreteTicks={0.01} valuePrecision={2} /> </div> ); export default CustomRangeAndTicks;
import React from 'react'; import { Slider } from 'react-md'; const CustomRangeAndTicks = () => ( <div> <Slider id="custom-range-continuous-slider" label="Min = 1, Max = 3, Step = 0.5" min={1} max={3} step={0.5} /> <Slider id="custom-range-step-slider" label="Discrete Min = 1, Max = 3, Step = 0.25" min={1} max={3} step={0.25} valuePrecision={2} discrete /> <Slider id="disctete-ticks-slider" label="Discrete with ticks and precision" discrete max={0.25} step={0.01} discreteTicks={0.01} valuePrecision={2} /> </div> ); export default CustomRangeAndTicks;
Update docs to demonstrate a step < 1 with a min value != 0
Update docs to demonstrate a step < 1 with a min value != 0
JSX
mit
mlaursen/react-md,mlaursen/react-md,mlaursen/react-md
--- +++ @@ -9,6 +9,15 @@ min={1} max={3} step={0.5} + /> + <Slider + id="custom-range-step-slider" + label="Discrete Min = 1, Max = 3, Step = 0.25" + min={1} + max={3} + step={0.25} + valuePrecision={2} + discrete /> <Slider id="disctete-ticks-slider"
13015fa9d0e62775d7a84a61f194c3a30169979c
packages/lesswrong/components/common/NavigationEventSender.jsx
packages/lesswrong/components/common/NavigationEventSender.jsx
import React from 'react'; import { registerComponent, runCallbacks } from 'meteor/vulcan:core'; import { useLocation } from '../../lib/routeUtil'; let lastLocation = null; const NavigationEventSender = () => { const location = useLocation(); React.useEffect(() => { // Only handle navigation events on the client (they don't apply to SSR) if (Meteor.isClient) { // Check if the path has actually changed if (location.pathname !== lastLocation?.pathname) { // Don't send the callback on the initial pageload, only on post-load navigations if (lastLocation) { runCallbacks('router.onUpdate', {oldLocation: lastLocation, newLocation: location}); } lastLocation = _.clone(location); } } }, [location]); return null; } registerComponent("NavigationEventSender", NavigationEventSender);
import React from 'react'; import { registerComponent, runCallbacks } from 'meteor/vulcan:core'; import { useSubscribedLocation } from '../../lib/routeUtil'; let lastLocation = null; const NavigationEventSender = () => { const location = useSubscribedLocation(); React.useEffect(() => { // Only handle navigation events on the client (they don't apply to SSR) if (Meteor.isClient) { // Check if the path has actually changed if (location.pathname !== lastLocation?.pathname) { // Don't send the callback on the initial pageload, only on post-load navigations if (lastLocation) { runCallbacks('router.onUpdate', {oldLocation: lastLocation, newLocation: location}); } lastLocation = _.clone(location); } } }, [location]); return null; } registerComponent("NavigationEventSender", NavigationEventSender);
Fix navigation events sometimes not sending
Fix navigation events sometimes not sending
JSX
mit
Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2
--- +++ @@ -1,11 +1,11 @@ import React from 'react'; import { registerComponent, runCallbacks } from 'meteor/vulcan:core'; -import { useLocation } from '../../lib/routeUtil'; +import { useSubscribedLocation } from '../../lib/routeUtil'; let lastLocation = null; const NavigationEventSender = () => { - const location = useLocation(); + const location = useSubscribedLocation(); React.useEffect(() => { // Only handle navigation events on the client (they don't apply to SSR)
cfdfe21f8c8778ab3d02f0172758a17d16a0adc8
src/renderer/components/confim-modal.jsx
src/renderer/components/confim-modal.jsx
import React, { Component, PropTypes } from 'react'; export default class ServerModalForm extends Component { static propTypes = { onCancelClick: PropTypes.func.isRequired, onRemoveClick: PropTypes.func.isRequired, title: PropTypes.string.isRequired, message: PropTypes.string.isRequired, context: PropTypes.string.isRequired, } componentDidMount() { $(this.refs.confirmModal).modal({ closable: false, detachable: false, allowMultiple: true, context: this.props.context, onDeny: () => { this.props.onCancelClick(); return true; }, onApprove: () => { this.props.onRemoveClick(); return false; }, }).modal('show'); } componentWillReceiveProps(nextProps) { this.setState({ error: nextProps.error }); } componentWillUnmount() { $(this.refs.confirmModal).modal('hide'); } render() { const { title, message } = this.props; return ( <div className="ui modal" ref="confirmModal"> <div className="header"> {title} </div> <div className="content"> {message} </div> <div className="actions"> <div className="small ui black deny right labeled icon button" tabIndex="0"> No <i className="ban icon"></i> </div> <div className="small ui positive right labeled icon button" tabIndex="0"> Yes <i className="checkmark icon"></i> </div> </div> </div> ); } }
import React, { Component, PropTypes } from 'react'; export default class ServerModalForm extends Component { static propTypes = { onCancelClick: PropTypes.func.isRequired, onRemoveClick: PropTypes.func.isRequired, title: PropTypes.string.isRequired, message: PropTypes.string.isRequired, context: PropTypes.string.isRequired, } componentDidMount() { $(this.refs.confirmModal).modal({ closable: false, detachable: false, allowMultiple: true, context: this.props.context, onDeny: () => { this.props.onCancelClick(); return true; }, onApprove: () => { this.props.onRemoveClick(); return false; }, }).modal('show'); } componentWillReceiveProps(nextProps) { this.setState({ error: nextProps.error }); } componentWillUnmount() { $(this.refs.confirmModal).modal('hide'); } render() { const { title, message } = this.props; return ( <div className="ui modal" ref="confirmModal" style={{position: 'absolute'}}> <div className="header"> {title} </div> <div className="content"> {message} </div> <div className="actions"> <div className="small ui black deny right labeled icon button" tabIndex="0"> No <i className="ban icon"></i> </div> <div className="small ui positive right labeled icon button" tabIndex="0"> Yes <i className="checkmark icon"></i> </div> </div> </div> ); } }
Add CSS hack for confirm modal stay at the top of the parent modal
Add CSS hack for confirm modal stay at the top of the parent modal
JSX
mit
sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui
--- +++ @@ -39,7 +39,7 @@ const { title, message } = this.props; return ( - <div className="ui modal" ref="confirmModal"> + <div className="ui modal" ref="confirmModal" style={{position: 'absolute'}}> <div className="header"> {title} </div>
d08e924abc2e81fde926e28254d13ddf10a3a317
client/src/components/HomePage.jsx
client/src/components/HomePage.jsx
import React from 'react'; import { Card, CardTitle } from 'material-ui/Card'; const HomePage = () => ( <Card className="container"> <CardTitle title="Welcome to Fridgr" subtitle="Tracking groceries got you stressed? Chill." /> </Card> ); export default HomePage;
import React from 'react'; import { Card, CardTitle } from 'material-ui/Card'; import Nav from './Nav.jsx'; class HomePage extends React.Component { constructor(props) { super(props); this.state = { page: 'home' }; } render() { if (localStorage.getItem('loggedIn') === 'true') { return ( <div> <Nav page={this.state.page} /> <Card className="container"> <CardTitle title="Welcome to Fridgr" subtitle="Tracking groceries got you stressed? Chill." /> </Card> </div> ); } else { return ( <Card className="container"> <CardTitle title="Welcome to Fridgr" subtitle="Tracking groceries got you stressed? Chill." /> </Card> ); } } } // const HomePage = () => ( // <Card className="container"> // <CardTitle title="Welcome to Fridgr" subtitle="Tracking groceries got you stressed? Chill." /> // </Card> // ); export default HomePage;
Change to class implementation to allows for conditional rendering of Nav bar if logged in
Change to class implementation to allows for conditional rendering of Nav bar if logged in
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -1,11 +1,40 @@ import React from 'react'; import { Card, CardTitle } from 'material-ui/Card'; +import Nav from './Nav.jsx'; +class HomePage extends React.Component { + constructor(props) { + super(props); -const HomePage = () => ( - <Card className="container"> - <CardTitle title="Welcome to Fridgr" subtitle="Tracking groceries got you stressed? Chill." /> - </Card> -); + this.state = { + page: 'home' + }; + } + + render() { + if (localStorage.getItem('loggedIn') === 'true') { + return ( + <div> + <Nav page={this.state.page} /> + <Card className="container"> + <CardTitle title="Welcome to Fridgr" subtitle="Tracking groceries got you stressed? Chill." /> + </Card> + </div> + ); + } else { + return ( + <Card className="container"> + <CardTitle title="Welcome to Fridgr" subtitle="Tracking groceries got you stressed? Chill." /> + </Card> + ); + } + } +} + +// const HomePage = () => ( +// <Card className="container"> +// <CardTitle title="Welcome to Fridgr" subtitle="Tracking groceries got you stressed? Chill." /> +// </Card> +// ); export default HomePage;
b3a8300a73e3e0029d4660a5fa8e177e28e14773
src/alert-transition.jsx
src/alert-transition.jsx
import React from "react"; import transitionStyles from "./transition-styles"; import { CSSTransition } from "react-transition-group"; import { ENTER_TIMEOUT, EXIT_TIMEOUT } from "./container"; import useSheet from "react-jss"; const timeout = { enter: ENTER_TIMEOUT, exit: EXIT_TIMEOUT }; const AlertTransition = ({ sheet: { classes }, ...props }) => props && props.children ? ( <CSSTransition timeout={timeout} classNames={classes} onExited={props.onExited} > {props.children} </CSSTransition> ) : null; export default useSheet(transitionStyles)(AlertTransition);
import React from "react"; import transitionStyles from "./transition-styles"; import { CSSTransition } from "react-transition-group"; import { ENTER_TIMEOUT, EXIT_TIMEOUT } from "./container"; import useSheet from "react-jss"; const timeout = { enter: ENTER_TIMEOUT, exit: EXIT_TIMEOUT }; const AlertTransition = ({ sheet: { classes }, ...props }) => { delete props.classes; // if it is there (it may not be depending on which version of JSS is used) return <CSSTransition timeout={timeout} classNames={classes} {...props} />; }; export default useSheet(transitionStyles)(AlertTransition);
Fix broken dismissing of alerts
Fix broken dismissing of alerts This fixes #41 by reverting part of #40 which fixed #39. The CSSTransition needs the props passed down from the TransitionGroup. We just want to avoid passing down extraneous props to that element to avoid warnings in React v15.
JSX
mit
chadly/react-bs-notifier
--- +++ @@ -6,15 +6,9 @@ const timeout = { enter: ENTER_TIMEOUT, exit: EXIT_TIMEOUT }; -const AlertTransition = ({ sheet: { classes }, ...props }) => - props && props.children ? ( - <CSSTransition - timeout={timeout} - classNames={classes} - onExited={props.onExited} - > - {props.children} - </CSSTransition> - ) : null; +const AlertTransition = ({ sheet: { classes }, ...props }) => { + delete props.classes; // if it is there (it may not be depending on which version of JSS is used) + return <CSSTransition timeout={timeout} classNames={classes} {...props} />; +}; export default useSheet(transitionStyles)(AlertTransition);
fbc143aaafb15b3e10e833bc306444f66f0fdd68
src/renderer/modal/modalAutoUpdateDownloaded/view.jsx
src/renderer/modal/modalAutoUpdateDownloaded/view.jsx
import React from "react"; import { Modal } from "modal/modal"; import { Line } from "rc-progress"; import Link from "component/link/index"; const { ipcRenderer } = require("electron"); class ModalAutoUpdateDownloaded extends React.PureComponent { render() { const { closeModal, declineAutoUpdate } = this.props; return ( <Modal isOpen={true} type="confirm" contentLabel={__("Update Downloaded")} confirmButtonLabel={__("Use it Now")} abortButtonLabel={__("Upgrade on Restart")} onConfirmed={() => { ipcRenderer.send("autoUpdateAccepted"); }} onAborted={() => { declineAutoUpdate(); ipcRenderer.send("autoUpdateDeclined"); closeModal(); }} > <section> <h3 className="text-center">{__("LBRY Leveled Up")}</h3> <p> {__( 'A new version of LBRY has been released, downloaded, and is ready for you to use pending a restart.' )} </p> </section> </Modal> ); } } export default ModalAutoUpdateDownloaded;
import React from "react"; import { Modal } from "modal/modal"; import { Line } from "rc-progress"; import Link from "component/link/index"; const { ipcRenderer } = require("electron"); class ModalAutoUpdateDownloaded extends React.PureComponent { render() { const { closeModal, declineAutoUpdate } = this.props; return ( <Modal isOpen={true} type="confirm" contentLabel={__("Update Downloaded")} confirmButtonLabel={__("Use it Now")} abortButtonLabel={__("Upgrade on Close")} onConfirmed={() => { ipcRenderer.send("autoUpdateAccepted"); }} onAborted={() => { declineAutoUpdate(); ipcRenderer.send("autoUpdateDeclined"); closeModal(); }} > <section> <h3 className="text-center">{__("LBRY Leveled Up")}</h3> <p> {__( 'A new version of LBRY has been released, downloaded, and is ready for you to use pending a restart.' )} </p> </section> </Modal> ); } } export default ModalAutoUpdateDownloaded;
Reword "Upgrade on Restart" to "Upgrade on Close"
Reword "Upgrade on Restart" to "Upgrade on Close"
JSX
mit
lbryio/lbry-electron,lbryio/lbry-electron,lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-app
--- +++ @@ -15,7 +15,7 @@ type="confirm" contentLabel={__("Update Downloaded")} confirmButtonLabel={__("Use it Now")} - abortButtonLabel={__("Upgrade on Restart")} + abortButtonLabel={__("Upgrade on Close")} onConfirmed={() => { ipcRenderer.send("autoUpdateAccepted"); }}
91885e41ba4b00c4be7daa7a247bb45a10f6f6b5
src/components/NotFound.jsx
src/components/NotFound.jsx
const React = window.React = require('react'); export default function NotFound() { return <div className="so-back islandBack"> <div className="island"> <div className="island__header"> Page not found </div> <div className="OfferTables island__sub"> <div className="OfferTables__tables island__sub__division island--simplePadTB"> The requested page was not found. Try going to the <a href="#">home page</a> to navigate to where you want to go. </div> <div className="OfferTables__table island__sub__division"> </div> </div> </div> </div> }
const React = window.React = require('react'); export default function NotFound() { return <div className="so-back islandBack islandBack--t"> <div className="island"> <div className="island__header"> Page not found </div> <div className="OfferTables island__sub"> <div className="OfferTables__tables island__sub__division island--simplePadTB"> The requested page was not found. Try going to the <a href="#">home page</a> to navigate to where you want to go. </div> <div className="OfferTables__table island__sub__division"> </div> </div> </div> </div> }
Add some padding to 404 page
Add some padding to 404 page
JSX
apache-2.0
irisli/stellarterm,irisli/stellarterm,irisli/stellarterm
--- +++ @@ -1,7 +1,7 @@ const React = window.React = require('react'); export default function NotFound() { - return <div className="so-back islandBack"> + return <div className="so-back islandBack islandBack--t"> <div className="island"> <div className="island__header"> Page not found
fd397323c46c27db98ccab3ed207427fd8647fe2
src/cred/vcode_input.jsx
src/cred/vcode_input.jsx
import React from 'react'; import InputWrap from './input_wrap'; import Icon from '../icon/icon'; import { isSmallScreen } from '../utils/media_utils'; export default class VcodeInput extends React.Component { constructor(props) { super(props); this.state = {}; } componentDidMount() { if (!isSmallScreen()) { // TODO: We can't set the focus immediately because we have to wait for // the input to be visible. Use a more robust solution (Placeholder should // notify it children when they are being shown). setTimeout(() => React.findDOMNode(this.refs.input).focus(), 1200); } } render() { const { isValid, ...props } = this.props; const { focused } = this.state; return ( <InputWrap name="vcode" isValid={isValid} icon={<Icon name="vcode" />} focused={focused}> <input ref="input" type="number" name="vcode" className="auth0-lock-input auth0-lock-input-code" autoComplete="off" autoCapitalize="off" onFocus={::this.handleFocus} onBlur={::this.handleBlur} {...props} /> </InputWrap> ); } handleFocus() { this.setState({focused: true}); } handleBlur() { this.setState({focused: false}); } } // TODO: specify propTypes
import React from 'react'; import InputWrap from './input_wrap'; import Icon from '../icon/icon'; import { isSmallScreen } from '../utils/media_utils'; export default class VcodeInput extends React.Component { constructor(props) { super(props); this.state = {}; } componentDidMount() { if (!isSmallScreen()) { // TODO: We can't set the focus immediately because we have to wait for // the input to be visible. Use a more robust solution (Placeholder should // notify it children when they are being shown). setTimeout(() => React.findDOMNode(this.refs.input).focus(), 1200); } } render() { const { isValid, ...props } = this.props; const { focused } = this.state; return ( <InputWrap name="vcode" isValid={isValid} icon={<Icon name="vcode" />} focused={focused}> <input ref="input" type="tel" name="vcode" className="auth0-lock-input auth0-lock-input-code" autoComplete="off" autoCapitalize="off" onFocus={::this.handleFocus} onBlur={::this.handleBlur} {...props} /> </InputWrap> ); } handleFocus() { this.setState({focused: true}); } handleBlur() { this.setState({focused: false}); } } // TODO: specify propTypes
Use type="tel" for verification code input
Use type="tel" for verification code input
JSX
mit
mike-casas/lock,mike-casas/lock,auth0/lock-passwordless,mike-casas/lock,auth0/lock-passwordless,auth0/lock-passwordless
--- +++ @@ -25,7 +25,7 @@ return ( <InputWrap name="vcode" isValid={isValid} icon={<Icon name="vcode" />} focused={focused}> <input ref="input" - type="number" + type="tel" name="vcode" className="auth0-lock-input auth0-lock-input-code" autoComplete="off"
a4e89b492ae93f23d84392f748d3e2b7b50acf26
client/src/components/manager/StatusSwitch.jsx
client/src/components/manager/StatusSwitch.jsx
import React from 'react'; const StatusSwitch = (props) => { return ( <div className="nav navbar-nav"> <a className="active">Status: {props.status === 'Open' ? 'Open' : 'Close'} for Queue</a> <button type="button" className="btn btn-primary navbar-btn" data-toggle="modal" data-target="#close-queue-warning">{props.status === 'Open' ? 'Close' : 'Open'} Queue</button> <div id="close-queue-warning" className="modal fade" role="dialog"> <div className="modal-dialog"> <div className="modal-content"> <div className="modal-header"> <button type="button" className="close" data-dismiss="modal">&times;</button> <h2 className="modal-title">Warning</h2> </div> <div className="modal-body"> <p className="warning-content"><b>{props.status === 'Open' ? 'Close' : 'Open'}</b> for Queue?</p> </div> <div className="modal-footer"> <button className="btn btn-primary" onClick={props.switchStatus.bind(this)} data-dismiss="modal">Conform Operation</button> <button type="button" className="btn btn-default" data-dismiss="modal">Cancel</button> </div> </div> </div> </div> </div> ); }; export default StatusSwitch;
import React from 'react'; const StatusSwitch = (props) => { return ( <div className="nav navbar-nav"> <a className="active">Status: {props.status === 'Open' ? 'Open' : 'Close'}Queue</a> <button type="button" className="btn btn-primary navbar-btn" data-toggle="modal" data-target="#close-queue-warning">{props.status === 'Open' ? 'Close' : 'Open'} Queue</button> <div id="close-queue-warning" className="modal fade" role="dialog"> <div className="modal-dialog"> <div className="modal-content"> <div className="modal-header"> <button type="button" className="close" data-dismiss="modal">&times;</button> <h2 className="modal-title"></h2> </div> <div className="modal-body"> <p className="warning-content"><b>{props.status === 'Open' ? 'Close' : 'Open'}</b>Queue?</p> </div> <div className="modal-footer"> <button className="btn btn-primary" onClick={props.switchStatus.bind(this)} data-dismiss="modal">Confirm</button> <button type="button" className="btn btn-default" data-dismiss="modal">Cancel</button> </div> </div> </div> </div> </div> ); }; export default StatusSwitch;
Fix typos in manager client
Fix typos in manager client
JSX
mit
nehacp/q-dot,q-dot/q-dot,Pegaiur/q-dot,Lynne-Daniels/q-dot
--- +++ @@ -4,7 +4,7 @@ return ( <div className="nav navbar-nav"> - <a className="active">Status: {props.status === 'Open' ? 'Open' : 'Close'} for Queue</a> + <a className="active">Status: {props.status === 'Open' ? 'Open' : 'Close'}Queue</a> <button type="button" className="btn btn-primary navbar-btn" data-toggle="modal" data-target="#close-queue-warning">{props.status === 'Open' ? 'Close' : 'Open'} Queue</button> <div id="close-queue-warning" className="modal fade" role="dialog"> @@ -12,13 +12,13 @@ <div className="modal-content"> <div className="modal-header"> <button type="button" className="close" data-dismiss="modal">&times;</button> - <h2 className="modal-title">Warning</h2> + <h2 className="modal-title"></h2> </div> <div className="modal-body"> - <p className="warning-content"><b>{props.status === 'Open' ? 'Close' : 'Open'}</b> for Queue?</p> + <p className="warning-content"><b>{props.status === 'Open' ? 'Close' : 'Open'}</b>Queue?</p> </div> <div className="modal-footer"> - <button className="btn btn-primary" onClick={props.switchStatus.bind(this)} data-dismiss="modal">Conform Operation</button> + <button className="btn btn-primary" onClick={props.switchStatus.bind(this)} data-dismiss="modal">Confirm</button> <button type="button" className="btn btn-default" data-dismiss="modal">Cancel</button> </div> </div>
f8b2c72e2ce6ed8adda8548d4129ec1dbe03c8c9
imports/ui/components/UserMenu.jsx
imports/ui/components/UserMenu.jsx
import React from 'react'; import { Link } from 'react-router'; import UserName from './UserName'; export default class UserMenu extends React.Component { logOut() { AccountsTemplates.logout(); this.context.router.push('/'); } renderLoggedIn() { const user = this.props.user; const userPagePath = '/u/' + user._id; const router = this.context.router; return <ul className="nav navbar-nav navbar-right"> <li> <a className="dropdown-toggle" data-toggle="dropdown" href="#"> <UserName user={user}/>&nbsp; <b className="caret"/> </a> <ul className="dropdown-menu"> <li className={router.isActive(userPagePath) ? 'active' : ''}><Link to={userPagePath}>Моя страница</Link></li> <li className="divider"/> <li><a onClick={this.logOut.bind(this)} href="#">Выход</a></li> </ul> </li> </ul>; } renderLoggedOut() { return <ul className="nav navbar-nav navbar-right"> <Link to="/accounts" className="btn btn-success navbar-btn">Войти</Link> </ul>; } render() { return this.props.user ? this.renderLoggedIn() : this.renderLoggedOut(); } } UserMenu.propTypes = { user: React.PropTypes.object, }; UserMenu.contextTypes = { router: React.PropTypes.object.isRequired, };
import React from 'react'; import { Link } from 'react-router'; import UserName from './UserName'; export default class UserMenu extends React.Component { logOut(e) { e.preventDefault(); AccountsTemplates.logout(); this.context.router.push('/'); } renderLoggedIn() { const user = this.props.user; const userPagePath = '/u/' + user._id; const router = this.context.router; return <ul className="nav navbar-nav navbar-right"> <li> <a className="dropdown-toggle" data-toggle="dropdown" href="#"> <UserName user={user}/>&nbsp; <b className="caret"/> </a> <ul className="dropdown-menu"> <li className={router.isActive(userPagePath) ? 'active' : ''}><Link to={userPagePath}>Моя страница</Link></li> <li className="divider"/> <li><a onClick={this.logOut.bind(this)} href="#">Выход</a></li> </ul> </li> </ul>; } renderLoggedOut() { return <ul className="nav navbar-nav navbar-right"> <Link to="/accounts" className="btn btn-success navbar-btn">Войти</Link> </ul>; } render() { return this.props.user ? this.renderLoggedIn() : this.renderLoggedOut(); } } UserMenu.propTypes = { user: React.PropTypes.object, }; UserMenu.contextTypes = { router: React.PropTypes.object.isRequired, };
Remove anchor in url after logout
Remove anchor in url after logout
JSX
agpl-3.0
Davidyuk/witcoin,Davidyuk/witcoin
--- +++ @@ -4,7 +4,8 @@ import UserName from './UserName'; export default class UserMenu extends React.Component { - logOut() { + logOut(e) { + e.preventDefault(); AccountsTemplates.logout(); this.context.router.push('/'); }
b2ae5dc7d45483d4ba73353f120a6aa633324ca7
client/src/components/customer/SelectedRestaurant.jsx
client/src/components/customer/SelectedRestaurant.jsx
import React from 'react'; import RestaurantLogoBanner from './RestaurantLogoBanner.jsx'; import CustomerInfoForm from './CustomerInfoForm.jsx'; import CustomerQueueInfo from './CustomerQueueInfo.jsx'; import RestaurantInformation from './RestaurantInformation.jsx'; class SelectedRestaurant extends React.Component { constructor(props) { super(props); this.customerInfoSubmitted = this.customerInfoSubmitted.bind(this); this.state = { infoSubmitted: false, queueId: 0, queuePosition: 0 } } customerInfoSubmitted(id, position) { // this.setState({ // infoSubmitted: true, // queueId: id, // queuePosition: position // }) console.log('SelectedRestaurant customerInfoSubmitted', id, position, this.props.groupSize) } render() { let image; this.props.currentRestaurant.image === '../images/blank.png' ? image = '../images/randomrestaurant.jpg' : image = this.props.currentRestaurant.image; const restaurantImg = { backgroundImage: `url(${image})` }; return ( <div className="selected-restaurant"> <RestaurantLogoBanner style={restaurantImg} /> <RestaurantInformation restaurant={this.props.currentRestaurant}/> {this.state.infoSubmitted === false ? <CustomerInfoForm currentRestaurantId={this.props.currentRestaurant.id} customerInfoSubmitted={this.customerInfoSubmitted} groupSize={this.props.groupSize}/> : <CustomerQueueInfo />} </div> ) } } export default SelectedRestaurant;
import React from 'react'; import RestaurantLogoBanner from './RestaurantLogoBanner.jsx'; import CustomerInfoForm from './CustomerInfoForm.jsx'; import CustomerQueueInfo from './CustomerQueueInfo.jsx'; import RestaurantInformation from './RestaurantInformation.jsx'; class SelectedRestaurant extends React.Component { constructor(props) { super(props); this.customerInfoSubmitted = this.customerInfoSubmitted.bind(this); this.state = { infoSubmitted: false, queueId: 0, queuePosition: 0 } } customerInfoSubmitted(id, position) { this.setState({ infoSubmitted: true, queueId: id, queuePosition: position }) } render() { let image; this.props.currentRestaurant.image === '../images/blank.png' ? image = '../images/randomrestaurant.jpg' : image = this.props.currentRestaurant.image; const restaurantImg = { backgroundImage: `url(${image})` }; return ( <div className="selected-restaurant"> <RestaurantLogoBanner style={restaurantImg} /> <RestaurantInformation restaurant={this.props.currentRestaurant}/> {this.state.infoSubmitted === false ? <CustomerInfoForm currentRestaurantId={this.props.currentRestaurant.id} customerInfoSubmitted={this.customerInfoSubmitted} groupSize={this.props.groupSize}/> : <CustomerQueueInfo />} </div> ) } } export default SelectedRestaurant;
Fix POST request for customer info to add to queue
Fix POST request for customer info to add to queue
JSX
mit
Lynne-Daniels/q-dot,Pegaiur/q-dot,nehacp/q-dot,q-dot/q-dot
--- +++ @@ -16,12 +16,11 @@ } customerInfoSubmitted(id, position) { - // this.setState({ - // infoSubmitted: true, - // queueId: id, - // queuePosition: position - // }) - console.log('SelectedRestaurant customerInfoSubmitted', id, position, this.props.groupSize) + this.setState({ + infoSubmitted: true, + queueId: id, + queuePosition: position + }) } render() {
d93e0c3d392996bac8e41b93aadc74508dc44118
public/app/common/components/controls/switch/switch.jsx
public/app/common/components/controls/switch/switch.jsx
var React = require('react'); var styleMixin = require('mixins/style-mixin'); var SwitchControl = React.createClass({ mixins: [ styleMixin(require('./style.scss')) ], getInitialState: function getInitialState () { return { checked: this.props.value || false }; }, render: function render () { return ( <div className={ 'cc-switch-control ' + (this.state.checked ? 'cc-switch-control__on' : 'cc-switch-control__off') } onClick={this.toggle} /> ); }, toggle: function toggle () { this.setState({ checked: !this.state.checked }, () => { this.props.channel(this.state); }); } }); module.exports = SwitchControl;
var React = require('react'); var styleMixin = require('mixins/style-mixin'); var cx = require('react/lib/cx'); var SwitchControl = React.createClass({ mixins: [ styleMixin(require('./style.scss')) ], getInitialState: function getInitialState () { return { checked: this.props.value || false }; }, render: function render () { var className = cx( 'cc-switch-control', this.state.checked ? 'cc-switch-control__on' : 'cc-switch-control__off' ); return ( <div className={className} onClick={this.toggle} /> ); }, toggle: function toggle () { this.setState({ checked: !this.state.checked }, () => { this.props.channel(this.state); }); } }); module.exports = SwitchControl;
Use React cx for the Switch control
Use React cx for the Switch control
JSX
mit
yetu/controlcenter,yetu/controlcenter,yetu/controlcenter
--- +++ @@ -1,5 +1,6 @@ var React = require('react'); var styleMixin = require('mixins/style-mixin'); +var cx = require('react/lib/cx'); var SwitchControl = React.createClass({ mixins: [ styleMixin(require('./style.scss')) ], @@ -9,13 +10,16 @@ }, render: function render () { + + var className = cx( + 'cc-switch-control', + this.state.checked + ? 'cc-switch-control__on' + : 'cc-switch-control__off' + ); + return ( - <div - className={ - 'cc-switch-control ' + - (this.state.checked ? 'cc-switch-control__on' : 'cc-switch-control__off') - } - onClick={this.toggle} /> + <div className={className} onClick={this.toggle} /> ); },
5373af395deb8933400969a48a245f4ba32ae56c
ui/js/component/NavMenu.jsx
ui/js/component/NavMenu.jsx
'use strict'; var React = require('react'); var MenuControl = require('mixin/MenuControl'); var NavMenu = React.createClass({ mixins : [ require('mixin/MenuControl') ], propTypes : { text : React.PropTypes.string.isRequired, icon : React.PropTypes.string }, render : function () { var display = !!this.props.icon ? (<span><i className={'fa fa-lg ' + this.props.icon}></i>&ensp;{this.props.text}</span>) : (<span>{this.props.text}</span>); return ( <a onClick={this._toggleMenu} onBlur={this._onBlur} tabIndex='-1'> {display}&emsp;<i className='fa fa-chevron-down'></i> </a> ); }, componentDidUpdate : function () { if (this.state.open) { React.findDOMNode(this).focus(); } }, _onBlur : function () { this.setState({ open : false }); } }); module.exports = NavMenu;
'use strict'; var React = require('react'); var MenuControl = require('mixin/MenuControl'); var NavMenu = React.createClass({ mixins : [ require('mixin/MenuControl') ], propTypes : { text : React.PropTypes.string.isRequired, icon : React.PropTypes.string }, render : function () { var display = !!this.props.icon ? (<span><i className={'fa fa-lg ' + this.props.icon}></i>&ensp;{this.props.text}</span>) : (<span>{this.props.text}</span>); return ( <a onClick={this._toggleMenu} onBlur={this._onBlur} tabIndex='-1'> {display}&emsp;<i className='fa fa-chevron-down'></i> </a> ); }, }); module.exports = NavMenu;
Remove the blur handler for now
Remove the blur handler for now Closing the menu on blur was preventing the click from actually opening the new URL. This will work as a solution for closing menus, but will need a little more work
JSX
agpl-3.0
unicef/rhizome,SeedScientific/polio,unicef/polio,unicef/polio,SeedScientific/polio,unicef/rhizome,unicef/rhizome,SeedScientific/polio,unicef/polio,unicef/polio,unicef/rhizome,SeedScientific/polio,SeedScientific/polio
--- +++ @@ -26,16 +26,6 @@ ); }, - componentDidUpdate : function () { - if (this.state.open) { - React.findDOMNode(this).focus(); - } - }, - - _onBlur : function () { - this.setState({ open : false }); - } - }); module.exports = NavMenu;
99b9cd616adc26b065225cdea14073b26f34bb59
app/assets/javascripts/components/common/rocket_chat.jsx
app/assets/javascripts/components/common/rocket_chat.jsx
import React from 'react'; import ChatActions from '../../actions/chat_actions.js'; import ChatStore from '../../stores/chat_store.js'; const RocketChat = React.createClass({ displayName: 'RocketChat', propTypes: { course: React.PropTypes.object }, mixins: [ChatStore.mixin], getInitialState() { return { authToken: ChatStore.getAuthToken() }; }, componentWillMount() { if (!this.state.authToken) { ChatActions.requestAuthToken(); } }, storeDidChange() { this.setState({ authToken: ChatStore.getAuthToken() }); this.loginOnFrameLoad(); }, loginOnFrameLoad() { document.querySelector('iframe').onload = this.login; }, login() { document.querySelector('iframe').contentWindow.postMessage({ externalCommand: 'login-with-token', token: this.state.authToken }, '*'); }, render() { // Rocket.Chat appears to double-encode the channel name to produce the URI. const channel = encodeURIComponent(encodeURIComponent(this.props.course.slug)); const chatUrl = `https://dashboardchat.wmflabs.org/channel/${channel}?layout=embedded`; const chatFrame = <iframe id="chat" className="iframe" src={chatUrl} />; return ( <div className="rocket-chat"> {chatFrame} </div> ); } }); export default RocketChat;
import React from 'react'; import ChatActions from '../../actions/chat_actions.js'; import ChatStore from '../../stores/chat_store.js'; const RocketChat = React.createClass({ displayName: 'RocketChat', propTypes: { course: React.PropTypes.object, current_user: React.PropTypes.object }, mixins: [ChatStore.mixin], getInitialState() { return { authToken: ChatStore.getAuthToken(), showChat: false }; }, componentWillMount() { if (this.props.current_user.id && !this.state.authToken) { ChatActions.requestAuthToken(); } }, storeDidChange() { this.setState({ authToken: ChatStore.getAuthToken() }); this.loginOnFrameLoad(); }, loginOnFrameLoad() { document.querySelector('iframe').onload = this.login; }, login() { document.querySelector('iframe').contentWindow.postMessage({ externalCommand: 'login-with-token', token: this.state.authToken }, '*'); this.setState({ showChat: true }); }, render() { // Rocket.Chat appears to double-encode the channel name to produce the URI. const channel = encodeURIComponent(encodeURIComponent(this.props.course.slug)); const chatUrl = `https://dashboardchat.wmflabs.org/channel/${channel}?layout=embedded`; let chatClass = 'iframe'; if (!this.state.showChat) { chatClass += ' hidden'; } const chatFrame = <iframe id="chat" className={chatClass} src={chatUrl} />; return ( <div className="rocket-chat"> {chatFrame} </div> ); } }); export default RocketChat;
Hide chat iframe unless user is logged in
Hide chat iframe unless user is logged in
JSX
mit
majakomel/WikiEduDashboard,alpha721/WikiEduDashboard,majakomel/WikiEduDashboard,sejalkhatri/WikiEduDashboard,alpha721/WikiEduDashboard,KarmaHater/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,KarmaHater/WikiEduDashboard,alpha721/WikiEduDashboard,KarmaHater/WikiEduDashboard,majakomel/WikiEduDashboard,KarmaHater/WikiEduDashboard,alpha721/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,majakomel/WikiEduDashboard,sejalkhatri/WikiEduDashboard
--- +++ @@ -6,19 +6,21 @@ displayName: 'RocketChat', propTypes: { - course: React.PropTypes.object + course: React.PropTypes.object, + current_user: React.PropTypes.object }, mixins: [ChatStore.mixin], getInitialState() { return { - authToken: ChatStore.getAuthToken() + authToken: ChatStore.getAuthToken(), + showChat: false }; }, componentWillMount() { - if (!this.state.authToken) { + if (this.props.current_user.id && !this.state.authToken) { ChatActions.requestAuthToken(); } }, @@ -39,13 +41,18 @@ externalCommand: 'login-with-token', token: this.state.authToken }, '*'); + this.setState({ showChat: true }); }, render() { // Rocket.Chat appears to double-encode the channel name to produce the URI. const channel = encodeURIComponent(encodeURIComponent(this.props.course.slug)); const chatUrl = `https://dashboardchat.wmflabs.org/channel/${channel}?layout=embedded`; - const chatFrame = <iframe id="chat" className="iframe" src={chatUrl} />; + let chatClass = 'iframe'; + if (!this.state.showChat) { + chatClass += ' hidden'; + } + const chatFrame = <iframe id="chat" className={chatClass} src={chatUrl} />; return ( <div className="rocket-chat">
d11acab0a029151e9d1e1b3d03bdaa5551cb8cba
livedoc-ui-webjar/src/components/doc/types/complex/TypeFieldRow.jsx
livedoc-ui-webjar/src/components/doc/types/complex/TypeFieldRow.jsx
// @flow import * as React from 'react'; import type { ApiObjectFieldDoc } from '../../../../model/livedoc'; import { TypeRef } from '../../typeref/TypeRef'; export type TypeFieldRowProps = { field: ApiObjectFieldDoc, } export const TypeFieldRow = (props: TypeFieldRowProps) => { const field: ApiObjectFieldDoc = props.field; return <tr> <td><code>{field.name}</code></td> <td><TypeRef type={field.type}/></td> <td>{field.description}</td> </tr>; };
// @flow import * as React from 'react'; import type { ApiObjectFieldDoc } from '../../../../model/livedoc'; import { TypeRef } from '../../typeref/TypeRef'; export type TypeFieldRowProps = { field: ApiObjectFieldDoc, } export const TypeFieldRow = (props: TypeFieldRowProps) => { const field: ApiObjectFieldDoc = props.field; const desc = field.description && <p>{field.description}</p>; return <tr> <td><code>{field.name}</code></td> <td><TypeRef type={field.type}/></td> <td>{desc}<Format constraints={field.format}/></td> </tr>; }; type FormatProps = { constraints: Array<string>, } const Format = ({constraints}: FormatProps) => { if (constraints.length === 0) { return null; } if (constraints.length === 1) { return [<h6>Format:</h6>, constraints[0]]; } const items = constraints.map((c, index) => <li key={index}>{c}</li>); const list = <ul>{items}</ul>; return [<h6>Format:</h6>, list]; };
Add display of the field property format when present
Add display of the field property format when present
JSX
mit
joffrey-bion/livedoc,joffrey-bion/livedoc,joffrey-bion/livedoc,joffrey-bion/livedoc,joffrey-bion/livedoc
--- +++ @@ -9,10 +9,26 @@ export const TypeFieldRow = (props: TypeFieldRowProps) => { const field: ApiObjectFieldDoc = props.field; - + const desc = field.description && <p>{field.description}</p>; return <tr> <td><code>{field.name}</code></td> <td><TypeRef type={field.type}/></td> - <td>{field.description}</td> + <td>{desc}<Format constraints={field.format}/></td> </tr>; }; + +type FormatProps = { + constraints: Array<string>, +} + +const Format = ({constraints}: FormatProps) => { + if (constraints.length === 0) { + return null; + } + if (constraints.length === 1) { + return [<h6>Format:</h6>, constraints[0]]; + } + const items = constraints.map((c, index) => <li key={index}>{c}</li>); + const list = <ul>{items}</ul>; + return [<h6>Format:</h6>, list]; +};
53143832e0d54c96ca9ec46328b12ae4b92b5686
app/assets/javascripts/components/user_navbar_dropdown.js.jsx
app/assets/javascripts/components/user_navbar_dropdown.js.jsx
/** @jsx React.DOM */ (function() { window.UserNavbarDropdown = React.createClass({ render: function() { return ( <ul className='dropdown-menu'> <li> <a href={this.props.userPath}> <span className="icon icon-user dropdown-glyph"></span> Profile </a> </li> <li> <a href={this.props.editUserPath}> <span className="icon icon-settings dropdown-glyph"></span> Setttings </a> </li> <li className='divider' /> <li> <a href={this.destroyUserSessionPath} data-method='delete'> <span className='icon icon-logout dropdown-glyph'></span> Log out </a> </li> </ul> ); } }); })();
/** @jsx React.DOM */ (function() { window.UserNavbarDropdown = React.createClass({ render: function() { return ( <ul className='dropdown-menu'> <li> <a href={this.props.userPath}> <span className="icon icon-user dropdown-glyph"></span> Profile </a> </li> <li> <a href={this.props.editUserPath}> <span className="icon icon-settings dropdown-glyph"></span> Setttings </a> </li> <li className='divider' /> <li> <a href={this.props.destroyUserSessionPath} data-method='delete'> <span className='icon icon-logout dropdown-glyph'></span> Log out </a> </li> </ul> ); } }); })();
Allow users to log out
Allow users to log out
JSX
agpl-3.0
assemblymade/meta,lachlanjc/meta,lachlanjc/meta,lachlanjc/meta,assemblymade/meta,assemblymade/meta,lachlanjc/meta,assemblymade/meta
--- +++ @@ -22,7 +22,7 @@ <li className='divider' /> <li> - <a href={this.destroyUserSessionPath} data-method='delete'> + <a href={this.props.destroyUserSessionPath} data-method='delete'> <span className='icon icon-logout dropdown-glyph'></span> Log out </a>
0bd885a977236568aec4d502a9686920d722a7a2
components/SiteNav/index.jsx
components/SiteNav/index.jsx
import React from 'react'; import { Link } from 'react-router'; import { prefixLink } from 'gatsby-helpers'; import './style.css'; class SiteNav extends React.Component { render() { return ( <nav className="blog-nav"> <ul> <li> <Link to={prefixLink('/')} activeClassName="current" onlyActiveOnIndex> 文章 </Link> </li> <li> <Link to={prefixLink('/IconStudio/')} activeClassName="current">圖標工作室</Link> </li> <li> <Link to={prefixLink('/about/')} activeClassName="current">關於 </Link> </li> <li> <Link to={prefixLink('/contact/')} activeClassName="current">聯絡 </Link> </li> </ul> </nav> ); } } export default SiteNav;
import React from 'react'; import { Link } from 'react-router'; import { prefixLink } from 'gatsby-helpers'; import './style.css'; class SiteNav extends React.Component { render() { return ( <nav className="blog-nav"> <ul> <li> <Link to={prefixLink('/')} activeClassName="current" onlyActiveOnIndex> 文章 </Link> </li> <li> <Link to={prefixLink('/IconStudio/')} activeClassName="current">圖標工作室</Link> </li> <li> <Link to={prefixLink('/latex-symbols/')} activeClassName="current" target="_blank">Latex符號表</Link> </li> <li> <Link to={prefixLink('/about/')} activeClassName="current">關於 </Link> </li> <li> <Link to={prefixLink('/contact/')} activeClassName="current">聯絡 </Link> </li> </ul> </nav> ); } } export default SiteNav;
Add link to latex symbols page in left nav
Add link to latex symbols page in left nav
JSX
mit
lilac/lilac.github.io,lilac/lilac.github.io
--- +++ @@ -16,6 +16,9 @@ <Link to={prefixLink('/IconStudio/')} activeClassName="current">圖標工作室</Link> </li> <li> + <Link to={prefixLink('/latex-symbols/')} activeClassName="current" target="_blank">Latex符號表</Link> + </li> + <li> <Link to={prefixLink('/about/')} activeClassName="current">關於 </Link> </li>
3aef4ae7a135d35d787d9a440a03f5d46361d36c
src/components/IntroPage.jsx
src/components/IntroPage.jsx
'use strict'; const React = require('react'); const Brand = require('./Brand.jsx'), Feed = require('./Feed.jsx'); const IntroPage = function (props) { const { isCollapsed } = props; let introClasses = 'wk-intro-page'; if (isCollapsed) { introClasses += ' wk-intro-page--collapsed'; } /* eslint-disable no-process-env */ const newsUrl = process.env.NEWS_URL || 'https://www.wolkenkit.io/news.json'; /* eslint-enable no-process-env */ return ( <div className={ introClasses }> <Brand suffix={ 'Documentation' } isCollapsed={ isCollapsed } /> <Feed url={ newsUrl } /> </div> ); }; module.exports = IntroPage;
'use strict'; const React = require('react'); const Brand = require('./Brand.jsx'), Feed = require('./Feed.jsx'); const IntroPage = function (props) { const { isCollapsed } = props; let introClasses = 'wk-intro-page'; if (isCollapsed) { introClasses += ' wk-intro-page--collapsed'; } /* eslint-disable no-process-env */ const newsUrl = process.env.NEWS_URL || `https://www.wolkenkit.io/news.json?_=${Date.now()}`; /* eslint-enable no-process-env */ return ( <div className={ introClasses }> <Brand suffix={ 'Documentation' } isCollapsed={ isCollapsed } /> <Feed url={ newsUrl } /> </div> ); }; module.exports = IntroPage;
Fix caching issue with loading news.
Fix caching issue with loading news.
JSX
agpl-3.0
thenativeweb/wolkenkit-documentation,thenativeweb/wolkenkit-documentation
--- +++ @@ -14,7 +14,7 @@ } /* eslint-disable no-process-env */ - const newsUrl = process.env.NEWS_URL || 'https://www.wolkenkit.io/news.json'; + const newsUrl = process.env.NEWS_URL || `https://www.wolkenkit.io/news.json?_=${Date.now()}`; /* eslint-enable no-process-env */ return (