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
0a1ea1e9f56343d4643f88636acf0bac6ff38753
src/components/semver-feedback.jsx
src/components/semver-feedback.jsx
var React = require('react'); var SemverFeedback = React.createClass({ render: function() { if (true === this.props.satisfies) { return ( <div className="well success"> <code>{ this.props.version }</code> satisfies contraint <code>{ this.props.constraint }</code> </div> ); } if (false === this.props.satisfies) { return ( <div className="well error"> <code>{ this.props.version }</code> does not satisfy contraint <code>{ this.props.constraint }</code> </div> ); } return ( <div className="well"> <span>Enter a constraint and a version to check if they match</span> </div> ); } }); module.exports = SemverFeedback;
var React = require('react'); var SemverFeedback = React.createClass({ render: function() { if (true === this.props.satisfies) { return ( <div className="well success"> <code>{ this.props.version }</code> satisfies constraint <code>{ this.props.constraint }</code> </div> ); } if (false === this.props.satisfies) { return ( <div className="well error"> <code>{ this.props.version }</code> does not satisfy constraint <code>{ this.props.constraint }</code> </div> ); } return ( <div className="well"> <span>Enter a constraint and a version to check if they match</span> </div> ); } }); module.exports = SemverFeedback;
Fix typo in "constraint" feedback
Fix typo in "constraint" feedback
JSX
mit
jubianchi/semver-check,jubianchi/semver-check
--- +++ @@ -5,7 +5,7 @@ if (true === this.props.satisfies) { return ( <div className="well success"> - <code>{ this.props.version }</code> satisfies contraint <code>{ this.props.constraint }</code> + <code>{ this.props.version }</code> satisfies constraint <code>{ this.props.constraint }</code> </div> ); } @@ -13,7 +13,7 @@ if (false === this.props.satisfies) { return ( <div className="well error"> - <code>{ this.props.version }</code> does not satisfy contraint <code>{ this.props.constraint }</code> + <code>{ this.props.version }</code> does not satisfy constraint <code>{ this.props.constraint }</code> </div> ); }
bfe3e04fe12d6a890d05edaf4a45025821dbcb48
packages/lesswrong/components/editor/CommentEditor.jsx
packages/lesswrong/components/editor/CommentEditor.jsx
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Components, registerComponent, getDynamicComponent, withCurrentUser } from 'meteor/vulcan:core'; import Users from 'meteor/vulcan:users'; class CommentEditor extends Component { constructor (props,context) { super(props,context); this.state = { editor: (props) => <Components.Loading /> } } async componentWillMount() { const {default: Editor} = await import('../async/AsyncCommentEditor.jsx'); this.setState({editor: Editor}); } render() { const AsyncCommentEditor = this.state.editor; const currentUser = this.props.currentUser; return ( <div className="comment-editor"> { Users.useMarkdownCommentEditor(currentUser) ? <Components.MuiTextField {...this.props} /> : <AsyncCommentEditor {...this.props}/> } </div> ) } } registerComponent('CommentEditor', CommentEditor, withCurrentUser);
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Components, registerComponent, getDynamicComponent, withCurrentUser } from 'meteor/vulcan:core'; import Users from 'meteor/vulcan:users'; class CommentEditor extends Component { constructor (props,context) { super(props,context); this.state = { editor: (props) => <div> Editor.Loading... </div> } } async componentWillMount() { const {default: Editor} = await import('../async/AsyncCommentEditor.jsx'); this.setState({editor: Editor}); } render() { const AsyncCommentEditor = this.state.editor; const currentUser = this.props.currentUser; return ( <div className="comment-editor"> { Users.useMarkdownCommentEditor(currentUser) ? <Components.MuiTextField {...this.props} /> : <AsyncCommentEditor {...this.props}/> } </div> ) } } registerComponent('CommentEditor', CommentEditor, withCurrentUser);
Make Bloopsquatch slightly less werid
Make Bloopsquatch slightly less werid
JSX
mit
Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2
--- +++ @@ -7,7 +7,7 @@ constructor (props,context) { super(props,context); this.state = { - editor: (props) => <Components.Loading /> + editor: (props) => <div> Editor.Loading... </div> } } @@ -25,8 +25,8 @@ <Components.MuiTextField {...this.props} /> - : - <AsyncCommentEditor {...this.props}/> + : + <AsyncCommentEditor {...this.props}/> } </div> )
471eb0a196d396804f3553caa1a5e66a8e27f702
public/components/Details.jsx
public/components/Details.jsx
import React from 'react'; import glassDetails from './../../glassDetails.js'; import beerPair from './../../pairList.js'; class Details extends React.Component { constructor(props){ super(props); } render(){ return( <div> {this.props.updateGlass ? `${glassDetails[this.props.updateGlass]}` : ''} </div> ) } } export default Details;
import React from 'react'; import glassDetails from './../../glassDetails.js'; import beerPair from './../../pairList.js'; const Details = (props) => { return ( <div> {props.updateGlass ? `${glassDetails[props.updateGlass]}` : ''} </div> ); } export default Details;
Refactor details component to stateless component
Refactor details component to stateless component
JSX
mit
joeylaguna/tankard.io,joeylaguna/tankard.io
--- +++ @@ -2,19 +2,12 @@ import glassDetails from './../../glassDetails.js'; import beerPair from './../../pairList.js'; -class Details extends React.Component { - constructor(props){ - super(props); - } - - render(){ - return( - <div> - {this.props.updateGlass ? `${glassDetails[this.props.updateGlass]}` : ''} - </div> - ) - } +const Details = (props) => { + return ( + <div> + {props.updateGlass ? `${glassDetails[props.updateGlass]}` : ''} + </div> + ); } - export default Details;
a10b1e8a2bfc032663fea8d9585020c55d17cfbc
app/javascript/app/components/about/about-contact/about-contact-component.jsx
app/javascript/app/components/about/about-contact/about-contact-component.jsx
import React from 'react'; import cx from 'classnames'; import layout from 'styles/layout'; import styles from './about-contact-styles.scss'; const AboutContact = () => ( <div className={cx(styles.aboutContact, layout.content)}> <p> We’d love to hear from you. Please submit questions, comments or feedback to <a href="mailto:[email protected]">[email protected]</a> </p> <h3>Sign Up for Updates</h3> <p> Subscribe to our newsletter for updates and events on Climate Watch and other climate-related tools. </p> <iframe title="contact-form" className={styles.contactIframe} src="//go.pardot.com/l/120942/2017-09-11/3khdjq" frameBorder="0" /> </div> ); export default AboutContact;
import React, { useState } from 'react'; import cx from 'classnames'; import layout from 'styles/layout'; import Loading from 'components/loading'; import styles from './about-contact-styles.scss'; const AboutContact = () => { const [iframeLoaded, setIframeLoaded] = useState(false); return ( <div className={cx(styles.aboutContact, layout.content)}> <p> We’d love to hear from you. Please submit questions, comments or feedback to{' '} <a href="mailto:[email protected]">[email protected]</a> </p> <h3>Sign Up for Updates</h3> <p> Subscribe to our newsletter for updates and events on Climate Watch and other climate-related tools. </p> {!iframeLoaded && <Loading light className={styles.loader} />} <iframe onLoad={() => setIframeLoaded(true)} title="contact-form" id="contact-form" className={styles.contactIframe} src="//go.pardot.com/l/120942/2017-09-11/3khdjq" frameBorder="0" /> </div> ); }; export default AboutContact;
Add loader until iframe loads
Add loader until iframe loads
JSX
mit
Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch
--- +++ @@ -1,26 +1,34 @@ -import React from 'react'; +import React, { useState } from 'react'; import cx from 'classnames'; import layout from 'styles/layout'; +import Loading from 'components/loading'; import styles from './about-contact-styles.scss'; -const AboutContact = () => ( - <div className={cx(styles.aboutContact, layout.content)}> - <p> - We’d love to hear from you. Please submit questions, comments or feedback - to <a href="mailto:[email protected]">[email protected]</a> - </p> - <h3>Sign Up for Updates</h3> - <p> - Subscribe to our newsletter for updates and events on Climate Watch and - other climate-related tools. - </p> - <iframe - title="contact-form" - className={styles.contactIframe} - src="//go.pardot.com/l/120942/2017-09-11/3khdjq" - frameBorder="0" - /> - </div> -); +const AboutContact = () => { + const [iframeLoaded, setIframeLoaded] = useState(false); + return ( + <div className={cx(styles.aboutContact, layout.content)}> + <p> + We’d love to hear from you. Please submit questions, comments or + feedback to{' '} + <a href="mailto:[email protected]">[email protected]</a> + </p> + <h3>Sign Up for Updates</h3> + <p> + Subscribe to our newsletter for updates and events on Climate Watch and + other climate-related tools. + </p> + {!iframeLoaded && <Loading light className={styles.loader} />} + <iframe + onLoad={() => setIframeLoaded(true)} + title="contact-form" + id="contact-form" + className={styles.contactIframe} + src="//go.pardot.com/l/120942/2017-09-11/3khdjq" + frameBorder="0" + /> + </div> + ); +}; export default AboutContact;
eb1f7e5f20d7eee71eea6578b555f87f00761c99
src/modules/content/components/searchResult.jsx
src/modules/content/components/searchResult.jsx
import ReactPlayer from 'react-player'; require('../styles/search.scss'); class SearchResult extends React.Component { constructor(props) { super(props); } render() { const attributes = this.props.result.attributes; return ( <div className="col-sm-4"> <div className="card"> {attributes.type == "Online-Video" ? <ReactPlayer url={attributes.url} className="card-img-top" youtubeConfig={{preload: true}} playing={false} controls={true}/> : <img className="card-img-top" src={attributes.image} alt="Card image cap"/> } <div className="card-block"> <h4 className="card-title">{attributes.title}</h4> <p className="card-text">{attributes.description}</p> { (attributes.download) ? <button type="button" className="btn btn-secondary"> <a href={ attributes.download } target="_blank">Slides</a> </button> : '' } <p> <small className="text-muted"> via {attributes.source} | {new Date(attributes.creationDate).toLocaleDateString("de-DE")} </small> </p> </div> </div> </div> ); } } export default SearchResult;
import ReactPlayer from 'react-player'; require('../styles/search.scss'); class SearchResult extends React.Component { constructor(props) { super(props); } getContentView(attributes) { if(attributes.type == "Online-Video") { return (<ReactPlayer url={attributes.url} className="card-img-top" youtubeConfig={{preload: true}} playing={false} controls={true}/>); } else if(attributes.image) { return (<img className="card-img-top" src={attributes.image}/>); } } render() { const attributes = this.props.result.attributes; return ( <div className="col-sm-4"> <div className="card"> { this.getContentView(attributes) } <div className="card-block"> <h4 className="card-title">{attributes.title}</h4> <p className="card-text">{attributes.description}</p> { (attributes.download) ? <button type="button" className="btn btn-secondary"> <a href={ attributes.download } target="_blank">Slides</a> </button> : '' } <p> <small className="text-muted"> via {attributes.source} | {new Date(attributes.creationDate).toLocaleDateString("de-DE")} </small> </p> </div> </div> </div> ); } } export default SearchResult;
Fix for missing image if content has none
Fix for missing image if content has none
JSX
agpl-3.0
schul-cloud/schulcloud-client,schul-cloud/schulcloud-client,schul-cloud/schulcloud-client
--- +++ @@ -6,17 +6,22 @@ super(props); } + getContentView(attributes) { + if(attributes.type == "Online-Video") { + return (<ReactPlayer url={attributes.url} className="card-img-top" + youtubeConfig={{preload: true}} playing={false} + controls={true}/>); + } else if(attributes.image) { + return (<img className="card-img-top" src={attributes.image}/>); + } + } + render() { const attributes = this.props.result.attributes; return ( <div className="col-sm-4"> <div className="card"> - {attributes.type == "Online-Video" ? - <ReactPlayer url={attributes.url} className="card-img-top" - youtubeConfig={{preload: true}} playing={false} - controls={true}/> : - <img className="card-img-top" src={attributes.image} - alt="Card image cap"/> } + { this.getContentView(attributes) } <div className="card-block"> <h4 className="card-title">{attributes.title}</h4> <p className="card-text">{attributes.description}</p>
4d8624b4b168c6c0a323c781cfb308d8378e66ec
src/components/Forecast.jsx
src/components/Forecast.jsx
import React from 'react'; import { connect } from 'react-redux'; import BarChart from 'BarChart'; import { selectConditions } from 'selectConditionsActions'; class Forecast extends React.Component { constructor(props) { super(props); this.state = {selectedInfo: {}}; this.displayConditions = this.displayConditions.bind(this); } displayConditions(d, i) { this.props.dispatch(selectConditions(this.props.forecast[i])); } renderBarChart() { if (!this.props.forecast.length) return null; const barData = this.props.forecast.map(d => { return { xValue: d.date.weekday, yValue: d.high[ this.props.app.unitType === 'imperial' ? 'fahrenheit' : 'celsius' ] }; }); return ( <div> <h1>5 Day Forecast</h1> <p> View temperature highs using a D3 bar chart. Hover over or click on bars to see details above. </p> <BarChart data={barData} onBarClick={this.displayConditions} onBarMouseenter={this.displayConditions} /> </div> ); } render() { return ( <div> {this.renderBarChart()} </div> ); } } export default connect(state => { return { app: state.app, forecast: state.forecast }; })(Forecast);
import React from 'react'; import { connect } from 'react-redux'; import BarChart from 'BarChart'; import { selectConditions } from 'selectConditionsActions'; class Forecast extends React.Component { constructor(props) { super(props); this.state = {selectedInfo: {}}; this.displayConditions = this.displayConditions.bind(this); } displayConditions(d, i) { this.props.dispatch(selectConditions(this.props.forecast[i])); } renderBarChart() { if (!this.props.forecast.length) return null; const unitType = this.props.app.unitType === 'imperial' ? 'fahrenheit' : 'celsius'; const barData = this.props.forecast.map(d => { return { xValue: d.date.weekday, yValue: d.high[unitType] }; }); return ( <div> <h1>5 Day Forecast</h1> <p> View temperature highs using a D3 bar chart. Hover over or click on bars to see details above. </p> <BarChart data={barData} onBarClick={this.displayConditions} onBarMouseenter={this.displayConditions} /> </div> ); } render() { return ( <div> {this.renderBarChart()} </div> ); } } export default connect(state => { return { app: state.app, forecast: state.forecast }; })(Forecast);
Fix so unit type set once instead of for every forecast datapoint
Fix so unit type set once instead of for every forecast datapoint
JSX
mit
JavierPDev/Weather-D3,JavierPDev/Weather-D3
--- +++ @@ -18,12 +18,13 @@ renderBarChart() { if (!this.props.forecast.length) return null; + const unitType = this.props.app.unitType === 'imperial' + ? 'fahrenheit' : 'celsius'; + const barData = this.props.forecast.map(d => { return { xValue: d.date.weekday, - yValue: d.high[ - this.props.app.unitType === 'imperial' ? 'fahrenheit' : 'celsius' - ] + yValue: d.high[unitType] }; });
05c831792efe2b9e8b38caaee54a290b947c85a2
examples/components/Example.jsx
examples/components/Example.jsx
var React = require('react'); var Example = React.createClass({ propTypes: { title: React.PropTypes.string.isRequired, code: React.PropTypes.element.isRequired, state: React.PropTypes.object.isRequired, jsx: React.PropTypes.string.isRequired, js: React.PropTypes.string.isRequired }, render: function() { return ( <div> <h1>{this.props.title}</h1> <h3>demo</h3> <div className="well"> {this.props.code} </div> <pre> {JSON.stringify(this.props.state)} </pre> <h3>jsx</h3> <pre> {this.props.jsx} </pre> <h3>js</h3> <pre> {this.props.js} </pre> </div> ); } }); module.exports = Example;
var React = require('react'); var Example = React.createClass({ propTypes: { title: React.PropTypes.string.isRequired, code: React.PropTypes.element.isRequired, state: React.PropTypes.object.isRequired, jsx: React.PropTypes.string.isRequired, js: React.PropTypes.string.isRequired }, render: function() { return ( <div> <h1>{this.props.title}</h1> <h3>demo</h3> <div className="well"> {this.props.code} </div> <pre> {JSON.stringify(this.props.state, null, 2)} </pre> <h3>jsx</h3> <pre> {this.props.jsx} </pre> <h3>js</h3> <pre> {this.props.js} </pre> </div> ); } }); module.exports = Example;
Add the space argument to JSON.stringify()
Add the space argument to JSON.stringify()
JSX
mit
seanlin0800/react-editable,seanlin0800/react-editable
--- +++ @@ -19,7 +19,7 @@ {this.props.code} </div> <pre> - {JSON.stringify(this.props.state)} + {JSON.stringify(this.props.state, null, 2)} </pre> <h3>jsx</h3> <pre>
d4929926f7fdf0ca5956f0fbbb82d833df344bb4
js/timeago.jsx
js/timeago.jsx
/* The equivalent to jQuery.timeago for react. * * TimeAgo returns a span containing the amount of time (in English) that has * passed since `time`. * * Takes: * time: an ISO 8601 timestamp * refreshMillis: how often to update, in milliseconds * * Example: * * return <a href={khanAcademy}><TimeAgo time={date} /></a> */ var React = require("react"); var SetIntervalMixin = require("./set-interval-mixin.jsx"); var moment = require("moment"); // TODO(joel) i18n var TimeAgo = React.createClass({ mixins: [SetIntervalMixin], render: function() { return <span>{moment(this.props.time).fromNow()}</span>; }, componentDidMount: function() { var interval = this.props.time || 60000; // TODO(joel) why did I have to bind forceUpdate? this.setInterval(this.forceUpdate.bind(this), interval); } }); module.exports = TimeAgo;
/* The equivalent to jQuery.timeago for react. * * TimeAgo returns a span containing the amount of time (in English) that has * passed since `time`. * * Takes: * time: an ISO 8601 timestamp * refreshMillis: how often to update, in milliseconds * * Example: * * return <a href={khanAcademy}><TimeAgo time={date} /></a> */ var React = require("react"); var SetIntervalMixin = require("./set-interval-mixin.jsx"); var moment = require("moment"); // TODO(joel) i18n var TimeAgo = React.createClass({ mixins: [SetIntervalMixin], render: function() { return <span>{moment(this.props.time).fromNow()}</span>; }, componentDidMount: function() { var interval = this.props.refreshMillis || 60000; // TODO(joel) why did I have to bind forceUpdate? this.setInterval(this.forceUpdate.bind(this), interval); } }); module.exports = TimeAgo;
Use refreshMillis to set the interval in TimeAgo
Use refreshMillis to set the interval in TimeAgo Previously it had been set to the `props.time` value.
JSX
mit
vasanthk/react-components,sloria/react-components,Khan/react-components,vasanthk/react-components,sloria/react-components,Khan/react-components,jepezi/react-components,Khan/react-components,jepezi/react-components,sloria/react-components,quicktoolbox/react-components,vasanthk/react-components,quicktoolbox/react-components,jepezi/react-components,quicktoolbox/react-components
--- +++ @@ -23,7 +23,7 @@ return <span>{moment(this.props.time).fromNow()}</span>; }, componentDidMount: function() { - var interval = this.props.time || 60000; + var interval = this.props.refreshMillis || 60000; // TODO(joel) why did I have to bind forceUpdate? this.setInterval(this.forceUpdate.bind(this), interval); }
b9853d5e244fa1ce99890f944ac57e0ba13ad905
src/structuredFieldComponents/DropdownStructuredComponent.jsx
src/structuredFieldComponents/DropdownStructuredComponent.jsx
import React, { Component } from 'react'; class DropdownStructuredComponent extends Component { onChange = (state) => { console.log('onChange to Dropdown component') } render = () => { return ( <span className='sf-subfield' {...this.props.attributes}> <select onFocus={this.props.handleDropdownFocus} onChange={this.props.handleDropdownSelection}> {this.props.items.map(function(item, index) { return <option key={item} value={item}>{item}</option>; })} </select> </span> ); } } export default DropdownStructuredComponent;
import React, { Component } from 'react'; class DropdownStructuredComponent extends Component { onChange = (state) => { console.log('onChange to Dropdown component') } render = () => { return ( <span className='sf-subfield' {...this.props.attributes}> <select onFocus={this.props.handleDropdownFocus} onChange={this.props.handleDropdownSelection}> <option selected disabled hidden>Select</option> {this.props.items.map(function(item, index) { return <option key={item} value={item}>{item}</option>; })} </select> </span> ); } } export default DropdownStructuredComponent;
Set initial state of drop down to be placeholder text (this fixes the issue of not being able to select the first entry in the list when the first entry is the default value on initial page render)
Set initial state of drop down to be placeholder text (this fixes the issue of not being able to select the first entry in the list when the first entry is the default value on initial page render)
JSX
apache-2.0
standardhealth/flux,standardhealth/flux
--- +++ @@ -9,6 +9,7 @@ return ( <span className='sf-subfield' {...this.props.attributes}> <select onFocus={this.props.handleDropdownFocus} onChange={this.props.handleDropdownSelection}> + <option selected disabled hidden>Select</option> {this.props.items.map(function(item, index) { return <option key={item} value={item}>{item}</option>; })}
3a127792e48715741d57bcd0181e1e2c7de92c68
jsx/header.jsx
jsx/header.jsx
/* @flow */ import Flexbox from 'flexbox-react'; import RaisedButton from 'material-ui/RaisedButton'; import React from 'react'; export default function Header( props: { style: ?Object, }, ) { return ( <Flexbox alignItems="center" flexDirection="row" flexWrap="wrap" justifyContent="space-between" style={props.style} > <h1 style={{color: '#333333'}}>Fitbit Pie Challenge</h1> <RaisedButton href="/authenticate" label="Join the Fun!" primary={true} /> </Flexbox> ); }
/* @flow */ import Flexbox from 'flexbox-react'; import React from 'react'; export default function Header( props: { style: ?Object, }, ) { return ( <Flexbox alignItems="center" flexDirection="row" flexWrap="wrap" justifyContent="space-between" style={props.style} > <h1 style={{color: '#333333'}}>Fitbit Pie Challenge</h1> </Flexbox> ); }
Remove join the fun button
[fitbit] Remove join the fun button
JSX
mit
dbharris2/fitbit,dbharris2/fitbit
--- +++ @@ -1,7 +1,6 @@ /* @flow */ import Flexbox from 'flexbox-react'; -import RaisedButton from 'material-ui/RaisedButton'; import React from 'react'; export default function Header( @@ -18,7 +17,6 @@ style={props.style} > <h1 style={{color: '#333333'}}>Fitbit Pie Challenge</h1> - <RaisedButton href="/authenticate" label="Join the Fun!" primary={true} /> </Flexbox> ); }
e9c58341a623c5f98ae31260aa1530b87fded376
app/assets/javascripts/components/GroupListItem.js.jsx
app/assets/javascripts/components/GroupListItem.js.jsx
class GroupListItem extends React.Component { constructor () { super() this.handler = this.handler.bind(this) this.deleteHandler = this.deleteHandler.bind(this) } handler (event) { event.preventDefault() let groupId = this.props.group.id if(this.props.sessionID == this.props.group.admin_id){ this.props.changeStates('GroupPage', this.props.sessionID, null, groupId) } else { this.props.changeStates('GroupPage', null, null, groupId) } } deleteMember() { let form = this var request = $.ajax({ type: "PUT", url: `/groups/${this.props.group.id}` }) } deleteHandler (event) { this.deleteMember() location.reload() } render () { return ( <div> <<<<<<< HEAD <a className='joined-link' href='#' onClick={this.handler}> {this.props.group.name} </a> ======= <a id='joined' href='#' onClick={this.handler}> {this.props.group.name} </a><button onClick={this.deleteHandler} className='btn btn-xs remove'> - </button> >>>>>>> master </div> ) } }
class GroupListItem extends React.Component { constructor () { super() this.handler = this.handler.bind(this) this.deleteHandler = this.deleteHandler.bind(this) } handler (event) { event.preventDefault() let groupId = this.props.group.id if(this.props.sessionID == this.props.group.admin_id){ this.props.changeStates('GroupPage', this.props.sessionID, null, groupId) } else { this.props.changeStates('GroupPage', null, null, groupId) } } deleteMember() { let form = this var request = $.ajax({ type: "PUT", url: `/groups/${this.props.group.id}` }) } deleteHandler (event) { this.deleteMember() location.reload() } render () { return ( <div> <a className='joined-link' href='#' onClick={this.handler}> {this.props.group.name} </a><button onClick={this.deleteHandler} className='btn btn-xs remove'> - </button> </div> ) } }
Fix merge conflict in group-list-item
Fix merge conflict in group-list-item
JSX
mit
mattgfisch/meal,mattgfisch/meal,mattgfisch/meal
--- +++ @@ -35,11 +35,7 @@ return ( <div> -<<<<<<< HEAD - <a className='joined-link' href='#' onClick={this.handler}> {this.props.group.name} </a> -======= - <a id='joined' href='#' onClick={this.handler}> {this.props.group.name} </a><button onClick={this.deleteHandler} className='btn btn-xs remove'> - </button> ->>>>>>> master + <a className='joined-link' href='#' onClick={this.handler}> {this.props.group.name} </a><button onClick={this.deleteHandler} className='btn btn-xs remove'> - </button> </div> ) }
1ac1d8166f886d5d40ac2117df2a6cc954b18a60
src/app/components/change-password/ChangePasswordForm.jsx
src/app/components/change-password/ChangePasswordForm.jsx
import React, { Component } from 'react'; import Input from '../Input' import PropTypes from 'prop-types'; const propTypes = { formData: PropTypes.shape({ inputs: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string.isRequired, value: PropTypes.string, label: PropTypes.string.isRequired, type: PropTypes.string, onChange: PropTypes.func, error: PropTypes.string })), onSubmit: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired }).isRequired }; export default class ChangePasswordForm extends Component { constructor(props) { super(props); } render() { const inputs = this.props.formData.inputs; return ( <div> <div className="modal__header"> <h2>Change password</h2> </div> <form onSubmit={this.props.formData.onSubmit}> <div className="modal__body"> { inputs.map((input, index) => { return <Input key={index} {...input} /> }) } </div> <div className="modal__footer"> <button className="btn btn--positive" onClick={this.props.formData.onSubmit}>Update password</button> <button className="btn" onClick={this.props.formData.onCancel}>Cancel</button> </div> </form> </div> ) } } ChangePasswordForm.propTypes = propTypes;
import React, { Component } from 'react'; import Input from '../Input' import PropTypes from 'prop-types'; const propTypes = { formData: PropTypes.shape({ inputs: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string.isRequired, value: PropTypes.string, label: PropTypes.string.isRequired, type: PropTypes.string, onChange: PropTypes.func, error: PropTypes.string })), onSubmit: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired, isSubmitting: PropTypes.bool }).isRequired }; export default class ChangePasswordForm extends Component { constructor(props) { super(props); } render() { const inputs = this.props.formData.inputs || []; const isSubmitting = this.props.formData.isSubmitting || false; return ( <div> <div className="modal__header"> <h2>Change password</h2> </div> <form onSubmit={this.props.formData.onSubmit}> <div className="modal__body"> { inputs.map((input, index) => { return <Input key={index} {...input} disabled={isSubmitting} /> }) } </div> <div className="modal__footer"> <button className="btn btn--positive" onClick={this.props.formData.onSubmit} disabled={isSubmitting}>Update password</button> <button className="btn" onClick={this.props.formData.onCancel} disabled={isSubmitting}>Cancel</button> {isSubmitting ? <div className="form__loader loader loader--dark margin-left--1"></div> : ""} </div> </form> </div> ) } } ChangePasswordForm.propTypes = propTypes;
Add isSubmitting check and disable input and buttons and show loader if true
Add isSubmitting check and disable input and buttons and show loader if true
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -13,7 +13,8 @@ error: PropTypes.string })), onSubmit: PropTypes.func.isRequired, - onCancel: PropTypes.func.isRequired + onCancel: PropTypes.func.isRequired, + isSubmitting: PropTypes.bool }).isRequired }; @@ -25,7 +26,8 @@ } render() { - const inputs = this.props.formData.inputs; + const inputs = this.props.formData.inputs || []; + const isSubmitting = this.props.formData.isSubmitting || false; return ( <div> @@ -36,13 +38,15 @@ <div className="modal__body"> { inputs.map((input, index) => { - return <Input key={index} {...input} /> + return <Input key={index} {...input} disabled={isSubmitting} /> }) } </div> <div className="modal__footer"> - <button className="btn btn--positive" onClick={this.props.formData.onSubmit}>Update password</button> - <button className="btn" onClick={this.props.formData.onCancel}>Cancel</button> + <button className="btn btn--positive" onClick={this.props.formData.onSubmit} disabled={isSubmitting}>Update password</button> + <button className="btn" onClick={this.props.formData.onCancel} disabled={isSubmitting}>Cancel</button> + + {isSubmitting ? <div className="form__loader loader loader--dark margin-left--1"></div> : ""} </div> </form> </div>
7c729f9c6452d12c3bf47176479f5ab5f15c4b12
src/components/elements/paginated-view.jsx
src/components/elements/paginated-view.jsx
import React from 'react'; import { connect } from 'react-redux'; import { bindRouteActions } from '../../redux/route-actions'; import PaginationLinks from './pagination-links'; import { getCurrentRouteName } from '../../utils'; const PaginatedView = props => ( <div className="box-body"> {props.showPaginationHeader ? ( <h4 className="user-subheader"> {props.boxHeader.title} {props.boxHeader.page > 1 ? ( <div className="user-subheader-page-number">Page {props.boxHeader.page}</div> ) : false} </h4> ) : false} {props.offset > 0 ? props.children ? <PaginationLinks {...props}/> : false : props.firstPageHead} {props.children} <PaginationLinks {...props}/> </div> ); const mapStateToProps = (state, ownProps) => { const offset = +state.routing.locationBeforeTransitions.query.offset || 0; const routename = getCurrentRouteName(ownProps); const isLastPage = state.feedViewState.isLastPage; return { offset, routename, isLastPage }; }; const mapDispatchToProps = dispatch => ({ routingActions: bindRouteActions(dispatch) }); export default connect(mapStateToProps, mapDispatchToProps)(PaginatedView);
import React from 'react'; import { connect } from 'react-redux'; import { bindRouteActions } from '../../redux/route-actions'; import PaginationLinks from './pagination-links'; const PaginatedView = props => ( <div className="box-body"> {props.showPaginationHeader ? ( <h4 className="user-subheader"> {props.boxHeader.title} {props.boxHeader.page > 1 ? ( <div className="user-subheader-page-number">Page {props.boxHeader.page}</div> ) : false} </h4> ) : false} {props.offset > 0 ? props.children ? <PaginationLinks {...props}/> : false : props.firstPageHead} {props.children} <PaginationLinks {...props}/> </div> ); const mapStateToProps = (state) => { const offset = +state.routing.locationBeforeTransitions.query.offset || 0; const isLastPage = state.feedViewState.isLastPage; return { offset, isLastPage }; }; const mapDispatchToProps = dispatch => ({ routingActions: bindRouteActions(dispatch) }); export default connect(mapStateToProps, mapDispatchToProps)(PaginatedView);
Remove unused prop from PaginatedView
Remove unused prop from PaginatedView
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -2,7 +2,6 @@ import { connect } from 'react-redux'; import { bindRouteActions } from '../../redux/route-actions'; import PaginationLinks from './pagination-links'; -import { getCurrentRouteName } from '../../utils'; const PaginatedView = props => ( <div className="box-body"> @@ -24,11 +23,10 @@ </div> ); -const mapStateToProps = (state, ownProps) => { +const mapStateToProps = (state) => { const offset = +state.routing.locationBeforeTransitions.query.offset || 0; - const routename = getCurrentRouteName(ownProps); const isLastPage = state.feedViewState.isLastPage; - return { offset, routename, isLastPage }; + return { offset, isLastPage }; }; const mapDispatchToProps = dispatch => ({
4dc37bcaf894a31cb4e84fc9aca947203fb6a541
src/stores/TimezoneStore.jsx
src/stores/TimezoneStore.jsx
'use strict'; import Reflux from 'reflux'; import Immutable from 'immutable'; import Moment from 'moment-timezone'; const TimezoneStore = Reflux.createStore({ init() { const meta = require('moment-timezone/data/meta/latest.json'); const now = Date.now(); const zoneList = Object.keys(meta.zones) .map((zone) => { const name = zone.split('/') .pop() .replace(/_/gi, ' ') .toLowerCase(); return { zone, name, offset: Moment.tz.zone(zone).offset(now), }; }) .sort((a, b) => { return a.name === b.name ? 0 : a.name < b.name ? -1 : 1; }); this.data = Immutable.List(zoneList); }, searchByName(name) { const regex = new RegExp(name, 'i'); return this.data.filter((zone) => regex.test(zone.name)); } }); export default TimezoneStore;
'use strict'; import Immutable from 'immutable'; import Reflux from 'reflux'; import Moment from 'moment-timezone'; import UserActions from 'actions/UserActionCreators'; const TimezoneStore = Reflux.createStore({ listenables: UserActions, init() { const meta = require('moment-timezone/data/meta/latest.json'); const now = Date.now(); this.data = Immutable.List( Object.keys(meta.zones) .map(this._createZone.bind(this, now)) .sort(this._sortByName) ); }, _createZone(now, zone, index) { const name = zone.split('/') .pop() .replace(/_/gi, ' ') .toLowerCase(); return { zone, name, offset: Moment.tz.zone(zone).offset(now), }; }, _sortByName(a, b) { return a.name === b.name ? 0 : a.name < b.name ? -1 : 1; }, onSearchByName(query) { const regexp = new RegExp('^' + query, 'i'); let results; if (!query.length) { results = this.data.clear(); } else { results = this.data.filter(zone => regexp.test(zone.name)); } this.trigger('searchByName', {query, results}); } }); export default TimezoneStore;
Add method for each List construction step ; Add onSearchByName callback
Add method for each List construction step ; Add onSearchByName callback
JSX
mit
rhumlover/clockette,rhumlover/clockette
--- +++ @@ -1,38 +1,54 @@ 'use strict'; +import Immutable from 'immutable'; import Reflux from 'reflux'; -import Immutable from 'immutable'; import Moment from 'moment-timezone'; +import UserActions from 'actions/UserActionCreators'; const TimezoneStore = Reflux.createStore({ + listenables: UserActions, + init() { const meta = require('moment-timezone/data/meta/latest.json'); const now = Date.now(); - const zoneList = Object.keys(meta.zones) - .map((zone) => { - const name = zone.split('/') - .pop() - .replace(/_/gi, ' ') - .toLowerCase(); - return { - zone, - name, - offset: Moment.tz.zone(zone).offset(now), - }; - }) - .sort((a, b) => { - return a.name === b.name ? 0 : a.name < b.name ? -1 : 1; - }); - - this.data = Immutable.List(zoneList); + this.data = Immutable.List( + Object.keys(meta.zones) + .map(this._createZone.bind(this, now)) + .sort(this._sortByName) + ); }, - searchByName(name) { - const regex = new RegExp(name, 'i'); - return this.data.filter((zone) => regex.test(zone.name)); + _createZone(now, zone, index) { + const name = zone.split('/') + .pop() + .replace(/_/gi, ' ') + .toLowerCase(); + + return { + zone, + name, + offset: Moment.tz.zone(zone).offset(now), + }; + }, + + _sortByName(a, b) { + return a.name === b.name ? 0 : a.name < b.name ? -1 : 1; + }, + + onSearchByName(query) { + const regexp = new RegExp('^' + query, 'i'); + let results; + + if (!query.length) { + results = this.data.clear(); + } + else { + results = this.data.filter(zone => regexp.test(zone.name)); + } + this.trigger('searchByName', {query, results}); } });
e3d224cd3ddd70f8b1e95867b07c066f5557ebe7
src/operator/visitors/index.jsx
src/operator/visitors/index.jsx
import React from 'react'; import Visitor from './visitor'; import * as actions from '../actions' export default React.createClass({ propTypes: { visitors: React.PropTypes.arrayOf(React.PropTypes.shape({ id: React.PropTypes.string.isRequired })).isRequired, dispatch: React.PropTypes.func.isRequired }, handleInvite(visitorId) { this.props.dispatch(actions.inviteVisitor(visitorId)); }, render() { let visitors = this.props.visitors.map(visitor => <Visitor {...visitor} key={visitor.id} onInvite={this.handleInvite} />); return ( <div> <h2>Visitors on site</h2> <hr /> <div>{visitors}</div> </div> ); } });
import React from 'react'; import Visitor from './visitor'; import * as actions from '../actions' export default class Visitors extends React.Component { handleInvite(visitorId) { this.props.dispatch(actions.inviteVisitor(visitorId)); } render() { let visitors = this.props.visitors.map(visitor => <Visitor {...visitor} key={visitor.id} onInvite={this.handleInvite.bind(this)} />); return ( <div> <h2>Visitors on site</h2> <hr /> <div>{visitors}</div> </div> ); } }; Visitors.propTypes = { visitors: React.PropTypes.arrayOf(React.PropTypes.shape({ id: React.PropTypes.string.isRequired })).isRequired, dispatch: React.PropTypes.func.isRequired };
Convert <Visitors /> to ES6 class
Convert <Visitors /> to ES6 class
JSX
apache-2.0
JustBlackBird/mibew-ui,JustBlackBird/mibew-ui
--- +++ @@ -2,23 +2,16 @@ import Visitor from './visitor'; import * as actions from '../actions' -export default React.createClass({ - propTypes: { - visitors: React.PropTypes.arrayOf(React.PropTypes.shape({ - id: React.PropTypes.string.isRequired - })).isRequired, - dispatch: React.PropTypes.func.isRequired - }, - +export default class Visitors extends React.Component { handleInvite(visitorId) { this.props.dispatch(actions.inviteVisitor(visitorId)); - }, + } render() { let visitors = this.props.visitors.map(visitor => <Visitor {...visitor} key={visitor.id} - onInvite={this.handleInvite} + onInvite={this.handleInvite.bind(this)} />); return ( @@ -29,4 +22,11 @@ </div> ); } -}); +}; + +Visitors.propTypes = { + visitors: React.PropTypes.arrayOf(React.PropTypes.shape({ + id: React.PropTypes.string.isRequired + })).isRequired, + dispatch: React.PropTypes.func.isRequired +};
cd4a055bb7497668c7404bcaa55de0351a53cd3a
src/containers/error-boundary.jsx
src/containers/error-boundary.jsx
import React from 'react'; import PropTypes from 'prop-types'; import platform from 'platform'; import BrowserModalComponent from '../components/browser-modal/browser-modal.jsx'; import CrashMessageComponent from '../components/crash-message/crash-message.jsx'; import log from '../lib/log.js'; import analytics from '../lib/analytics'; class ErrorBoundary extends React.Component { constructor (props) { super(props); this.state = { hasError: false }; } componentDidCatch (error, info) { // Display fallback UI this.setState({hasError: true}); log.error(`Unhandled Error: ${error}, info: ${info}`); analytics.event({ category: 'error', action: 'Fatal Error', label: error.message }); } handleBack () { window.history.back(); } handleReload () { window.location.replace(window.location.origin + window.location.pathname); } render () { if (this.state.hasError) { // don't use array.includes because that's something that causes IE to crash. if ( platform.name === 'IE' || platform.name === 'Opera' || platform.name === 'Opera Mini' || platform.name === 'Silk') { return <BrowserModalComponent onBack={this.handleBack} />; } return <CrashMessageComponent onReload={this.handleReload} />; } return this.props.children; } } ErrorBoundary.propTypes = { children: PropTypes.node }; export default ErrorBoundary;
import React from 'react'; import PropTypes from 'prop-types'; import platform from 'platform'; import BrowserModalComponent from '../components/browser-modal/browser-modal.jsx'; import CrashMessageComponent from '../components/crash-message/crash-message.jsx'; import log from '../lib/log.js'; import analytics from '../lib/analytics'; class ErrorBoundary extends React.Component { constructor (props) { super(props); this.state = { hasError: false }; } componentDidCatch (error, info) { // Display fallback UI this.setState({hasError: true}); log.error(`Unhandled Error: ${error}\n${error.stack}\nComponent stack: ${info.componentStack}`); analytics.event({ category: 'error', action: 'Fatal Error', label: error.message }); } handleBack () { window.history.back(); } handleReload () { window.location.replace(window.location.origin + window.location.pathname); } render () { if (this.state.hasError) { // don't use array.includes because that's something that causes IE to crash. if ( platform.name === 'IE' || platform.name === 'Opera' || platform.name === 'Opera Mini' || platform.name === 'Silk') { return <BrowserModalComponent onBack={this.handleBack} />; } return <CrashMessageComponent onReload={this.handleReload} />; } return this.props.children; } } ErrorBoundary.propTypes = { children: PropTypes.node }; export default ErrorBoundary;
Add more information to error boundary messages
Add more information to error boundary messages While working on the menubar, I couldn't find the source of an error. This adds more stack info to the error messages emitted by the error boundary.
JSX
bsd-3-clause
LLK/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui,LLK/scratch-gui
--- +++ @@ -17,7 +17,7 @@ componentDidCatch (error, info) { // Display fallback UI this.setState({hasError: true}); - log.error(`Unhandled Error: ${error}, info: ${info}`); + log.error(`Unhandled Error: ${error}\n${error.stack}\nComponent stack: ${info.componentStack}`); analytics.event({ category: 'error', action: 'Fatal Error',
ab059941d3b699dace5143a228b17b12d9ec595e
client/js/scorm.jsx
client/js/scorm.jsx
"use strict"; import 'babel-polyfill'; import es6Promise from 'es6-promise'; import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import routes from './routes'; import DevTools from './dev/dev_tools'; import configureStore from './store/configure_store'; import jwt from './loaders/jwt'; import { getInitialSettings } from './reducers/settings'; // Polyfill es6 promises for IE es6Promise.polyfill(); //Needed for onTouchTap //Can go away when react 1.0 release //Check this repo: //https://github.com/zilverline/react-tap-event-plugin import injectTapEventPlugin from "react-tap-event-plugin"; injectTapEventPlugin(); class Root extends React.Component { render(){ const devTools = __DEV__ ? <DevTools /> : null; const { store } = this.props; return ( <Provider store={store}> <div> {routes} {devTools} </div> </Provider> ); } } const settings = getInitialSettings(window.DEFAULT_SETTINGS); const store = configureStore({settings, jwt: window.DEFAULT_JWT}); if (window.DEFAULT_JWT){ // Setup JWT refresh jwt(store.dispatch, settings.user_id); } ReactDOM.render( <Root store={store} />, document.getElementById("main-app") );
"use strict"; import 'babel-polyfill'; import es6Promise from 'es6-promise'; import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import routes from './routes'; import DevTools from './dev/dev_tools'; import configureStore from './store/configure_store'; import jwt from './loaders/jwt'; import { getInitialSettings } from './reducers/settings'; // Polyfill es6 promises for IE es6Promise.polyfill(); //Needed for onTouchTap //Can go away when react 1.0 release //Check this repo: //https://github.com/zilverline/react-tap-event-plugin import injectTapEventPlugin from "react-tap-event-plugin"; injectTapEventPlugin(); class Root extends React.Component { render(){ const devTools = __DEV__ ? <DevTools /> : null; const { store } = this.props; return ( <Provider store={store}> <div> {routes} {devTools} </div> </Provider> ); } } const settings = getInitialSettings(window.DEFAULT_SETTINGS); const store = configureStore({settings, jwt: window.DEFAULT_JWT}); if (window.DEFAULT_JWT){ // Setup JWT refresh jwt(store.dispatch, settings.userId); } ReactDOM.render( <Root store={store} />, document.getElementById("main-app") );
Fix user id from settings
Fix user id from settings
JSX
mit
atomicjolt/adhesion,atomicjolt/adhesion,atomicjolt/adhesion,atomicjolt/adhesion
--- +++ @@ -40,7 +40,7 @@ const settings = getInitialSettings(window.DEFAULT_SETTINGS); const store = configureStore({settings, jwt: window.DEFAULT_JWT}); if (window.DEFAULT_JWT){ // Setup JWT refresh - jwt(store.dispatch, settings.user_id); + jwt(store.dispatch, settings.userId); } ReactDOM.render(
5c8182b825ae7218b3d1731c6ac22984c3fd57f0
generators/app/templates/src/modules/app/components/GreetForm.jsx
generators/app/templates/src/modules/app/components/GreetForm.jsx
import React, { PropTypes } from 'react' import pure from 'recompose/pure' import { compose } from 'redux' import { reduxForm } from 'redux-form' import * as select from '../selectors' const propTypes = { fields: PropTypes.object, handleSubmit: PropTypes.func, loading: PropTypes.boolean, } const formConfig = { form: 'greet', fields: ['name'], } const GreetForm = ({ fields, handleSubmit, loading }) => <form onSubmit={ handleSubmit }> <input type="text" { ...fields.name } placeholder="Name" /> <button type="submit">{ loading ? 'Loading...' : 'Greet' }</button> </form> GreetForm.propTypes = propTypes const mapStateToProps = (state) => ({ loading: select.loading(state), }) export default compose( reduxForm(formConfig, mapStateToProps), pure )(GreetForm)
import React, { PropTypes } from 'react' import pure from 'recompose/pure' import { compose } from 'redux' import { reduxForm } from 'redux-form' const propTypes = { fields: PropTypes.object, handleSubmit: PropTypes.func, loading: PropTypes.boolean, } const formConfig = { form: 'greet', fields: ['name'], } const GreetForm = ({ fields, handleSubmit, loading }) => <form onSubmit={ handleSubmit }> <input type="text" { ...fields.name } placeholder="Name" /> <button type="submit">{ loading ? 'Loading...' : 'Greet' }</button> </form> GreetForm.propTypes = propTypes export default compose( reduxForm(formConfig), pure )(GreetForm)
Fix form to be a presentational component
Fix form to be a presentational component
JSX
mit
127labs/generator-duxedo,127labs/generator-duxedo
--- +++ @@ -2,8 +2,6 @@ import pure from 'recompose/pure' import { compose } from 'redux' import { reduxForm } from 'redux-form' - -import * as select from '../selectors' const propTypes = { fields: PropTypes.object, @@ -24,11 +22,7 @@ GreetForm.propTypes = propTypes -const mapStateToProps = (state) => ({ - loading: select.loading(state), -}) - export default compose( - reduxForm(formConfig, mapStateToProps), + reduxForm(formConfig), pure )(GreetForm)
2abb6b71606497a4cad386656f13388a36e48ad8
packages/mwp-app-render/src/components/uxcapture/UXCaptureFont.jsx
packages/mwp-app-render/src/components/uxcapture/UXCaptureFont.jsx
// @flow import React from 'react'; type Props = { fontFamily: string, mark: string, }; export const fontLoaderSrc = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.10/webfont.js'; const generateUXCaptureFontJS = (fontFamily: string, mark: string) => ` WebFont.load({ custom: { families: ['${fontFamily}'] }, active: function() { if (window.UX) { window.UX.mark('${mark}'); } } }); `; // fontFamily attribute should include individual weights if separate files are used // Example: "Graphik Meetup:n4,n5,n6" // Attention, if no weight specified, only n4 (e.g. font-weight: 400) is tested for! // See https://github.com/typekit/webfontloader#events for more detail const UXCaptureFont = ({ fontFamily, mark }: Props) => <script dangerouslySetInnerHTML={{ __html: generateUXCaptureFontJS(fontFamily, mark), }} />; // eslint-disable-line react/no-danger export default UXCaptureFont;
// @flow import React from 'react'; type Props = { fontFamily: string, mark: string, }; export const fontLoaderSrc = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.10/webfont.js'; const generateUXCaptureFontJS = (fontFamily: string, mark: string) => ` WebFont.load({ custom: { families: ['${fontFamily}'] }, active: function() { if(window.UXCapture) { window.UXCapture.mark("${mark}"); } } }); `; // fontFamily attribute should include individual weights if separate files are used // Example: "Graphik Meetup:n4,n5,n6" // Attention, if no weight specified, only n4 (e.g. font-weight: 400) is tested for! // See https://github.com/typekit/webfontloader#events for more detail const UXCaptureFont = ({ fontFamily, mark }: Props) => <script dangerouslySetInnerHTML={{ __html: generateUXCaptureFontJS(fontFamily, mark), }} />; // eslint-disable-line react/no-danger export default UXCaptureFont;
Use new UXCapture API for the marks
Use new UXCapture API for the marks
JSX
mit
meetup/meetup-web-platform
--- +++ @@ -15,8 +15,8 @@ families: ['${fontFamily}'] }, active: function() { - if (window.UX) { - window.UX.mark('${mark}'); + if(window.UXCapture) { + window.UXCapture.mark("${mark}"); } } });
dd5d654a09614f3e54201060d7016b197e976ca5
src/components/input/InputFile.jsx
src/components/input/InputFile.jsx
import React from 'react'; import PropTypes from 'prop-types'; import Input from './Input'; import Button from '../button/Button'; function InputFile (props) { const input = <Input name={props.name} type="file" />; return ( <> <div> {props.label ? <label>{props.label}:{input}</label> : { input }} <Button name="abort" value="Cancel read" /> </div> <div> <label> Readed: <span className="file_progressbar_wrapper"> <span className="file_progressbar">&nbsp;</span> </span> <span className="file_progressbar_counter">0%</span> </label> </div> </> ); } InputFile.propTypes = { name: PropTypes.string.isRequired, label: PropTypes.string, }; export default InputFile;
import React from 'react'; import PropTypes from 'prop-types'; import Input from './Input'; function InputFile (props) { const input = <Input name={props.name} type="file" />; return ( <> <div> {props.label ? <label>{props.label}:{input}</label> : { input }} </div> <div> <label> Readed: <span className="file_progressbar_wrapper"> <span className="file_progressbar">&nbsp;</span> </span> <span className="file_progressbar_counter">0%</span> </label> </div> </> ); } InputFile.propTypes = { name: PropTypes.string.isRequired, label: PropTypes.string, }; export default InputFile;
Remove not used cancel read button
Remove not used cancel read button
JSX
mit
krajvy/nearest-coordinates,krajvy/nearest-coordinates,krajvy/nearest-coordinates
--- +++ @@ -2,7 +2,6 @@ import PropTypes from 'prop-types'; import Input from './Input'; -import Button from '../button/Button'; function InputFile (props) { const input = @@ -15,14 +14,10 @@ <> <div> {props.label ? <label>{props.label}:{input}</label> : { input }} - <Button - name="abort" - value="Cancel read" - /> </div> <div> <label> - Readed: + Readed: <span className="file_progressbar_wrapper"> <span className="file_progressbar">&nbsp;</span> </span>
7756749da448ea3a91ca9c0237f6a9fcf122c69a
imports/containers/AppContainer.jsx
imports/containers/AppContainer.jsx
import { Meteor } from 'meteor/meteor'; import { createContainer } from 'meteor/react-meteor-data'; import App from '../ui/layouts/App.jsx'; import { getLastMonth } from '../api/helpers/date-helpers'; // Pass meteor data to the App component export default createContainer(() => { if (!Meteor.user()) return {}; const lastMonth = getLastMonth(); const reportsSentCounterIndex = `${lastMonth.year()}${lastMonth.month() + 1}`; const { name, picture } = Meteor.user().profile; const reportsSentCounter = Meteor.user().reportsSentCounter ? Meteor.user().reportsSentCounter[reportsSentCounterIndex] || 0 : 0; return { currentUser: { name, picture, reportsSentCounter, }, }; }, App);
import { Meteor } from 'meteor/meteor'; import { createContainer } from 'meteor/react-meteor-data'; import App from '../ui/layouts/App.jsx'; // Pass meteor data to the App component export default createContainer(() => { if (!Meteor.user()) return {}; const { name, picture } = Meteor.user().profile; return { currentUser: { name, picture, }, }; }, App);
Stop sending reports sent counter to App component
Stop sending reports sent counter to App component - It won't be used anymore (we won't disable the share button) Signed-off-by: Felipe Milani <[email protected]>
JSX
mit
fmilani/contatempo,fmilani/contatempo
--- +++ @@ -1,23 +1,17 @@ import { Meteor } from 'meteor/meteor'; import { createContainer } from 'meteor/react-meteor-data'; import App from '../ui/layouts/App.jsx'; -import { getLastMonth } from '../api/helpers/date-helpers'; // Pass meteor data to the App component export default createContainer(() => { if (!Meteor.user()) return {}; - const lastMonth = getLastMonth(); - const reportsSentCounterIndex = `${lastMonth.year()}${lastMonth.month() + 1}`; const { name, picture } = Meteor.user().profile; - const reportsSentCounter = Meteor.user().reportsSentCounter - ? Meteor.user().reportsSentCounter[reportsSentCounterIndex] || 0 - : 0; + return { currentUser: { name, picture, - reportsSentCounter, }, }; }, App);
7339fd17bc415048004a536550078be3a7fa590a
app/components/add-item/index.jsx
app/components/add-item/index.jsx
require("./add-item.styl") import React from "react" import {Button} from "react-bootstrap" const ENTER_KEYCODE = 13; export default class AddItem extends React.Component { constructor() { this.state = { newItem: "" } } updateNewItem(event) { this.setState({ newItem: event.target.value }) } handleAddNew() { let {newItem} = this.state; //let newItem = this.state.newItem; if (newItem.length === 0) { return } this.props.addNew(newItem) this.setState({ newItem: "" }) } handleKeyUp(event) { event.preventDefault(); if (event.keyCode === ENTER_KEYCODE) { this.handleAddNew() } } render() { return <div> <input type="text" value={this.state.newItem} onChange={this.updateNewItem} onKeyUp={this.handleKeyUp} /> <Button onClick={this.props.handleNextDay}>Done</Button> <Button onClick={this.props.revealActual}>Reveal</Button> </div> } }
require("./add-item.styl") import React from "react" import {Button} from "react-bootstrap" const ENTER_KEYCODE = 13; export default class AddItem extends React.Component { constructor() { this.state = { newItem: "" } } updateNewItem(event) { this.setState({ newItem: event.target.value }) } handleAddNew() { let {newItem} = this.state; //let newItem = this.state.newItem; if (newItem.length === 0) { return } this.props.addNew(newItem) this.setState({ newItem: "" }) } handleKeyUp(event) { event.preventDefault(); if (event.keyCode === ENTER_KEYCODE) { this.handleAddNew() } } render() { return <div> <input type="text" value={this.state.newItem} onChange={this.updateNewItem.bind(this)} onKeyUp={this.handleKeyUp.bind(this)} /> <Button onClick={this.props.handleNextDay}>Done</Button> <Button onClick={this.props.revealActual}>Reveal</Button> </div> } }
Fix issue where input events are not bound to component.
Fix issue where input events are not bound to component.
JSX
unlicense
babadoozep/ema,babadoozep/ema
--- +++ @@ -42,7 +42,12 @@ render() { return <div> - <input type="text" value={this.state.newItem} onChange={this.updateNewItem} onKeyUp={this.handleKeyUp} /> + <input + type="text" value={this.state.newItem} + onChange={this.updateNewItem.bind(this)} + onKeyUp={this.handleKeyUp.bind(this)} + /> + <Button onClick={this.props.handleNextDay}>Done</Button> <Button onClick={this.props.revealActual}>Reveal</Button> </div>
8cd1083614aaa6a1377d18c77f6e8ca86a632d41
client/auth/login-required.jsx
client/auth/login-required.jsx
import React from 'react' import { connect } from 'react-redux' import { stringify } from 'query-string' import { isLoggedIn } from './auth-utils' import { pushPath } from 'redux-simple-router' @connect(state => ({ auth: state.auth })) class LoginRequired extends React.Component { _ensureAuthed(props) { if (!isLoggedIn(props.auth)) { const { location: loc } = this.props const query = stringify({ nextPath: props.history.createPath(loc.pathname, loc.query) }) props.dispatch(pushPath('/login?' + query, null)) } } componentWillMount() { this._ensureAuthed(this.props) } componentWillReceiveProps(nextProps) { this._ensureAuthed(nextProps) } render() { const children = this.props.children return !Array.isArray(children) ? children : <div>children</div> } } export default LoginRequired
import React from 'react' import { connect } from 'react-redux' import { stringify } from 'query-string' import { isLoggedIn } from './auth-utils' import { pushPath } from 'redux-simple-router' @connect(state => ({ auth: state.auth })) class LoginRequired extends React.Component { _ensureAuthed(props) { if (!isLoggedIn(props.auth)) { const { location: loc } = this.props const query = stringify({ nextPath: props.history.createPath(loc.pathname, loc.query) }) props.dispatch(pushPath('/login?' + query, null)) } } componentWillMount() { this._ensureAuthed(this.props) } componentWillReceiveProps(nextProps) { this._ensureAuthed(nextProps) } render() { if (isLoggedIn(this.props.auth)) { const children = this.props.children return !Array.isArray(children) ? children : <div>children</div> } else { return <div></div> } } } export default LoginRequired
Fix error when a redirect occurs on the first page load due to an auth redirect being batched to after the first render.
Fix error when a redirect occurs on the first page load due to an auth redirect being batched to after the first render.
JSX
mit
ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery
--- +++ @@ -25,8 +25,12 @@ } render() { - const children = this.props.children - return !Array.isArray(children) ? children : <div>children</div> + if (isLoggedIn(this.props.auth)) { + const children = this.props.children + return !Array.isArray(children) ? children : <div>children</div> + } else { + return <div></div> + } } }
06eca4fcf397cc296e0886e8b6fe035a11b76195
app/assets/javascripts/components/UserShowComponents/UserShow.js.jsx
app/assets/javascripts/components/UserShowComponents/UserShow.js.jsx
var UserShow = React.createClass({ render: function(){ return ( <div className="user_show_wrapper"> <br/> <div className="ui stackable three column centered grid"> <div className="column"> <h3 className="ui horizontal divider header"> About Me </h3> < UserProfileCard user={this.props.user} same_user={this.props.same_user} /> <br></br> < Badges badges={this.props.badges} /> </div> <div className=" column"> < UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} /> </div> </div> </div> ) } })
var UserShow = React.createClass({ componentWillMount: function() { document.title ="FixStart | "+ this.props.user.first_name +" "+ this.props.user.last_name; }, render: function(){ return ( <div className="user_show_wrapper"> <br/> <div className="ui stackable three column centered grid"> <div className="column"> <h3 className="ui horizontal divider header"> About Me </h3> < UserProfileCard user={this.props.user} same_user={this.props.same_user} /> <br></br> < Badges badges={this.props.badges} /> </div> <div className=" column"> < UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} /> </div> </div> </div> ) } })
Add personalized first name for a given user
Add personalized first name for a given user
JSX
mit
ShadyLogic/fixstarter,TimCannady/fixstarter,TimCannady/fixstarter,ShadyLogic/fixstarter,ShadyLogic/fixstarter,TimCannady/fixstarter
--- +++ @@ -1,4 +1,9 @@ var UserShow = React.createClass({ + + componentWillMount: function() { + document.title ="FixStart | "+ this.props.user.first_name +" "+ this.props.user.last_name; + }, + render: function(){ return ( <div className="user_show_wrapper">
9cc390246c632585a7fefe111d45e1a545bb264d
src/sentry/static/sentry/app/components/events/interfaces/breadcrumbComponents/summaryLine.jsx
src/sentry/static/sentry/app/components/events/interfaces/breadcrumbComponents/summaryLine.jsx
import React from 'react'; import Duration from '../../../duration'; const SummaryLine = React.createClass({ propTypes: { crumb: React.PropTypes.object.isRequired }, render() { let {crumb} = this.props; return ( <div className="summary"> {this.props.children} {crumb.duration && <span className="crumb-timing"> [<Duration seconds={crumb.duration}/>] </span> } </div> ); } }); export default SummaryLine;
import React from 'react'; import Duration from '../../../duration'; const SummaryLine = React.createClass({ propTypes: { crumb: React.PropTypes.object.isRequired }, render() { let {crumb} = this.props; // this is where we can later also show other interesting // information (maybe duration?) return ( <div className="summary"> {this.props.children} </div> ); } }); export default SummaryLine;
Remove unused duration from summary line
Remove unused duration from summary line
JSX
bsd-3-clause
jean/sentry,JackDanger/sentry,beeftornado/sentry,mvaled/sentry,mvaled/sentry,mvaled/sentry,zenefits/sentry,fotinakis/sentry,alexm92/sentry,jean/sentry,alexm92/sentry,BuildingLink/sentry,gencer/sentry,BuildingLink/sentry,beeftornado/sentry,ifduyue/sentry,jean/sentry,fotinakis/sentry,mvaled/sentry,gencer/sentry,looker/sentry,ifduyue/sentry,looker/sentry,BuildingLink/sentry,mitsuhiko/sentry,ifduyue/sentry,JamesMura/sentry,JackDanger/sentry,zenefits/sentry,mvaled/sentry,JamesMura/sentry,looker/sentry,jean/sentry,gencer/sentry,fotinakis/sentry,fotinakis/sentry,gencer/sentry,looker/sentry,zenefits/sentry,zenefits/sentry,mvaled/sentry,JamesMura/sentry,BuildingLink/sentry,alexm92/sentry,looker/sentry,beeftornado/sentry,BuildingLink/sentry,JamesMura/sentry,zenefits/sentry,mitsuhiko/sentry,ifduyue/sentry,gencer/sentry,JackDanger/sentry,JamesMura/sentry,jean/sentry,ifduyue/sentry
--- +++ @@ -10,14 +10,11 @@ render() { let {crumb} = this.props; + // this is where we can later also show other interesting + // information (maybe duration?) return ( <div className="summary"> {this.props.children} - {crumb.duration && - <span className="crumb-timing"> - [<Duration seconds={crumb.duration}/>] - </span> - } </div> ); }
dc0e5cd1ebaf01b312e3a4d71535c9160a38f321
src/passwordless-email/render.jsx
src/passwordless-email/render.jsx
import React from 'react'; import Lock from '../lock/lock'; import AskEmail from './ask_email'; import AskVerificationCode from './ask_verification_code'; import Done from './done'; import { LockStates } from '../control/constants'; import { requestPasswordlessEmail, signIn } from './actions'; export default function render(lock) { const state = lock.get("state"); switch(state) { case LockStates.ASK_VERIFICATION_CODE: return ( <Lock lock={lock} showHeader={true} submitHandler={askVerificationCodeSubmitHandler}> <AskVerificationCode /> </Lock> ); case LockStates.DONE: return <Lock lock={lock} showHeader={false}><Done /></Lock>; case LockStates.READY: return ( <Lock lock={lock} showHeader={true} submitHandler={askEmailSubmitHandler}> <AskEmail /> </Lock> ); default: const mode = lock.get("mode"); throw new Error(`unknown state ${state} for mode ${mode}`) } } function askEmailSubmitHandler(lock) { requestPasswordlessEmail(lock.get("id")); } function askVerificationCodeSubmitHandler(lock) { signIn(lock.get("id")); }
import React from 'react'; import Lock from '../lock/lock'; import AskEmail from './ask_email'; import AskVerificationCode from './ask_verification_code'; import Done from './done'; import { LockStates } from '../control/constants'; import { requestPasswordlessEmail, signIn } from './actions'; export default function render(lock) { const state = lock.get("state"); switch(state) { // case LockStates.ASK_VERIFICATION_CODE: // return ( // <Lock lock={lock} showHeader={true} submitHandler={askVerificationCodeSubmitHandler}> // <AskVerificationCode /> // </Lock> // ); case LockStates.DONE: return <Lock lock={lock} showHeader={false}><Done /></Lock>; case LockStates.READY: return ( <Lock lock={lock} showHeader={true} submitHandler={askEmailSubmitHandler}> <AskEmail /> </Lock> ); default: const mode = lock.get("mode"); throw new Error(`unknown state ${state} for mode ${mode}`) } } function askEmailSubmitHandler(lock) { requestPasswordlessEmail(lock.get("id")); } function askVerificationCodeSubmitHandler(lock) { signIn(lock.get("id")); }
Disable passwordless email code support for now
Disable passwordless email code support for now
JSX
mit
mike-casas/lock,auth0/lock-passwordless,auth0/lock-passwordless,auth0/lock-passwordless,mike-casas/lock,mike-casas/lock
--- +++ @@ -9,12 +9,12 @@ export default function render(lock) { const state = lock.get("state"); switch(state) { - case LockStates.ASK_VERIFICATION_CODE: - return ( - <Lock lock={lock} showHeader={true} submitHandler={askVerificationCodeSubmitHandler}> - <AskVerificationCode /> - </Lock> - ); + // case LockStates.ASK_VERIFICATION_CODE: + // return ( + // <Lock lock={lock} showHeader={true} submitHandler={askVerificationCodeSubmitHandler}> + // <AskVerificationCode /> + // </Lock> + // ); case LockStates.DONE: return <Lock lock={lock} showHeader={false}><Done /></Lock>; case LockStates.READY:
c438158c89720166fcf9e0f8cf07a70c541e312a
src/js/components/AppBreadcrumbsComponent.jsx
src/js/components/AppBreadcrumbsComponent.jsx
var classNames = require("classnames"); var React = require("react/addons"); var AppBreadcrumbsComponent = React.createClass({ displayName: "AppBreadcrumbsComponent", propTypes: { activeTaskId: React.PropTypes.string, activeViewIndex: React.PropTypes.number.isRequired, appId: React.PropTypes.string.isRequired }, getDefaultProps: function () { return { activeViewIndex: 0 }; }, render: function () { var props = this.props; var activeViewIndex = props.activeViewIndex; var appName = props.appId; var appUri = "#apps/" + encodeURIComponent(props.appId); var taskName; if (activeViewIndex === 1 && props.activeTaskId != null) { taskName = props.activeTaskId; } var activeAppClassSet = classNames({ "active": true, "hidden": activeViewIndex === 1 }); var inactiveAppClassSet = classNames({ "hidden": activeViewIndex === 0 }); var taskClassSet = classNames({ "active": true, "hidden": activeViewIndex === 0 }); return ( <ol className="breadcrumb"> <li> <a href="#apps">Apps</a> </li> <li className={activeAppClassSet}> {appName} </li> <li className={inactiveAppClassSet}> <a href={appUri}> {appName} </a> </li> <li className={taskClassSet}> {taskName} </li> </ol> ); } }); module.exports = AppBreadcrumbsComponent;
var classNames = require("classnames"); var React = require("react/addons"); var AppBreadcrumbsComponent = React.createClass({ displayName: "AppBreadcrumbsComponent", propTypes: { activeTaskId: React.PropTypes.string, activeViewIndex: React.PropTypes.number.isRequired, appId: React.PropTypes.string.isRequired }, getDefaultProps: function () { return { activeViewIndex: 0 }; }, getAppName: function () { var props = this.props; var activeViewIndex = props.activeViewIndex; var appName = props.appId; var appUri = "#apps/" + encodeURIComponent(props.appId); if (activeViewIndex === 1) { return ( <li> <a href={appUri}> {appName} </a> </li> ); } return ( <li className="active"> {appName} </li> ); }, getTaskName: function () { var props = this.props; var activeViewIndex = props.activeViewIndex; if (activeViewIndex === 0) { return null; } let taskName; if (activeViewIndex === 1 && props.activeTaskId != null) { taskName = props.activeTaskId; } return ( <li className="active">{taskName}</li> ); }, render: function () { return ( <ol className="breadcrumb"> <li> <a href="#apps">Apps</a> </li> {this.getAppName()} {this.getTaskName()} </ol> ); } }); module.exports = AppBreadcrumbsComponent;
Refactor AppBreadcrumbs to prevent empty list items
Refactor AppBreadcrumbs to prevent empty list items Return null when null is due
JSX
apache-2.0
cribalik/marathon-ui,mesosphere/marathon-ui,cribalik/marathon-ui,mesosphere/marathon-ui
--- +++ @@ -16,45 +16,54 @@ }; }, - render: function () { + getAppName: function () { var props = this.props; var activeViewIndex = props.activeViewIndex; var appName = props.appId; var appUri = "#apps/" + encodeURIComponent(props.appId); - var taskName; + if (activeViewIndex === 1) { + return ( + <li> + <a href={appUri}> + {appName} + </a> + </li> + ); + } + + return ( + <li className="active"> + {appName} + </li> + ); + }, + + getTaskName: function () { + var props = this.props; + var activeViewIndex = props.activeViewIndex; + + if (activeViewIndex === 0) { + return null; + } + + let taskName; if (activeViewIndex === 1 && props.activeTaskId != null) { taskName = props.activeTaskId; } + return ( + <li className="active">{taskName}</li> + ); + }, - var activeAppClassSet = classNames({ - "active": true, - "hidden": activeViewIndex === 1 - }); - var inactiveAppClassSet = classNames({ - "hidden": activeViewIndex === 0 - }); - var taskClassSet = classNames({ - "active": true, - "hidden": activeViewIndex === 0 - }); - + render: function () { return ( <ol className="breadcrumb"> <li> <a href="#apps">Apps</a> </li> - <li className={activeAppClassSet}> - {appName} - </li> - <li className={inactiveAppClassSet}> - <a href={appUri}> - {appName} - </a> - </li> - <li className={taskClassSet}> - {taskName} - </li> + {this.getAppName()} + {this.getTaskName()} </ol> ); }
7bd2cdb201cfc19542258aa3bc87c2738d74689c
app/assets/javascripts/components/alert.js.jsx
app/assets/javascripts/components/alert.js.jsx
var Alert = React.createClass({ render: function () { return ( <div className="u-bg-blue-light u-c-white u-t-align-center u-py-3 u-px-2 u-fw-100 u-br-3"> <span className="u-fw-700">Click a tag</span> to start filtering. You can <span className="u-fw-700">combine multiple</span> tags to find the content you are looking for. </div> ) } });
var Alert = React.createClass({ render: function () { return ( <div className="u-bg-blue-light u-c-white u-t-align-center u-py-3 u-px-2 u-fw-100 u-br-3"> No lists with this tag combination found. </div> ) } });
Add different copy to alert.
Add different copy to alert.
JSX
mit
krisimmig/mytopten,krisimmig/mytopten,kirillis/mytopten,krisimmig/mytopten,kirillis/mytopten,kirillis/mytopten
--- +++ @@ -3,7 +3,7 @@ render: function () { return ( <div className="u-bg-blue-light u-c-white u-t-align-center u-py-3 u-px-2 u-fw-100 u-br-3"> - <span className="u-fw-700">Click a tag</span> to start filtering. You can <span className="u-fw-700">combine multiple</span> tags to find the content you are looking for. + No lists with this tag combination found. </div> ) }
c5d6cd103d2d03da1caf9238ec222219856f8020
kanban_app/app/components/Note.jsx
kanban_app/app/components/Note.jsx
import React from 'react'; import {compose} from 'redux'; import {DragSource, DropTarget} from 'react-dnd'; import ItemTypes from '../constants/itemTypes'; const noteSource = { beginDrag(props) { return { id: props.id }; } }; const noteTarget = { hover(targetProps, monitor) { const targetId = targetProps.id; const sourceProps = monitor.getItem(); const sourceId = sourceProps.id; if(sourceId !== targetId) { targetProps.onMove({sourceId, targetId}); } } }; class Note extends React.Component { render() { const {connectDragSource, connectDropTarget, isDragging, onMove, id, editing, ...props} = this.props; // Pass through if we are editing const dragSource = editing ? a => a : connectDragSource; return dragSource(connectDropTarget( <li style={{ opacity: isDragging ? 0 : 1 }} {...props}>{props.children}</li> )); } } export default compose( DragSource(ItemTypes.NOTE, noteSource, (connect, monitor) => ({ connectDragSource: connect.dragSource(), isDragging: monitor.isDragging() })), DropTarget(ItemTypes.NOTE, noteTarget, (connect) => ({ connectDropTarget: connect.dropTarget() })) )(Note);
import React from 'react'; import {compose} from 'redux'; import {DragSource, DropTarget} from 'react-dnd'; import ItemTypes from '../constants/itemTypes'; const noteSource = { beginDrag(props) { return { id: props.id }; }, isDragging(props, monitor) { return props.id === monitor.getItem().id } }; const noteTarget = { hover(targetProps, monitor) { const targetId = targetProps.id; const sourceProps = monitor.getItem(); const sourceId = sourceProps.id; if(sourceId !== targetId) { targetProps.onMove({sourceId, targetId}); } } }; class Note extends React.Component { render() { const {connectDragSource, connectDropTarget, isDragging, onMove, id, editing, ...props} = this.props; // Pass through if we are editing const dragSource = editing ? a => a : connectDragSource; return dragSource(connectDropTarget( <li style={{ opacity: isDragging ? 0 : 1 }} {...props}>{props.children}</li> )); } } export default compose( DragSource(ItemTypes.NOTE, noteSource, (connect, monitor) => ({ connectDragSource: connect.dragSource(), isDragging: monitor.isDragging() })), DropTarget(ItemTypes.NOTE, noteTarget, (connect) => ({ connectDropTarget: connect.dropTarget() })) )(Note);
Implement custom isDragging for notes
Implement custom isDragging for notes DragSources should have opacity 0 even when we change lanes
JSX
mit
survivejs/redux-demo,survivejs-demos/redux-demo
--- +++ @@ -8,6 +8,9 @@ return { id: props.id }; + }, + isDragging(props, monitor) { + return props.id === monitor.getItem().id } };
ea883496f7702f05badad880737668cd2f66c3ed
app/assets/javascripts/components/UserShowComponents/UserShow.js.jsx
app/assets/javascripts/components/UserShowComponents/UserShow.js.jsx
var UserShow = React.createClass({ render: function(){ return ( <div className="user_show_wrapper"> <br/> <div className="ui stackable three column centered grid"> <div className="column"> <h3 className="ui horizontal divider header"> About Me </h3> < UserProfileCard user={this.props.user} same_user={this.props.same_user} /> <br></br> < Badges badges={this.props.badges} /> </div> <div className=" column"> < UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} /> </div> </div> </div> ) } })
var UserShow = React.createClass({ render: function(){ return ( <div className="user_show_wrapper"> <br/> <div className="ui stackable three column centered grid"> <div className="column"> <h3 className="ui horizontal divider header"> About Me </h3> < UserProfileCard user={this.props.user} same_user={this.props.same_user} /> <br></br> < Badges badges={this.props.badges} /> </div> <div className=" column"> < UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} /> </div> </div> </div> ) } })
Update formatting on sublime text with divs
Update formatting on sublime text with divs
JSX
mit
TimCannady/fixstarter,ShadyLogic/fixstarter,ShadyLogic/fixstarter,TimCannady/fixstarter,TimCannady/fixstarter,ShadyLogic/fixstarter
--- +++ @@ -16,7 +16,7 @@ </div> <div className=" column"> - < UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} /> + < UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} /> </div> </div>
36f8eb963ed88949526e3a6a600d2469215bc5e3
src/Flex.jsx
src/Flex.jsx
import React from 'react'; import PropTypes from 'prop-types'; const toPercent = num => `${num}%`; const Flex = ({ children, className, direction, count, offset, style, wrap, ...otherProps }) => ( <div className={className} style={{ display: 'flex', flexDirection: direction, flexWrap: wrap ? 'wrap' : 'no-wrap', ...style, }} {...otherProps} > {React.Children.map(children, (child, index) => ( React.cloneElement( child, { ...child.props, style: { flexBasis: toPercent(100 / count), overflow: 'hidden', marginLeft: offset && (index === 0) ? toPercent((100 * offset) / count) : null, }, }, ) ))} </div> ); Flex.propTypes = { children: PropTypes.node, className: PropTypes.string, count: PropTypes.number.isRequired, direction: PropTypes.string, offset: PropTypes.number, style: PropTypes.objectOf(PropTypes.oneOfType([ PropTypes.string, PropTypes.number, ])), wrap: PropTypes.bool, }; export default Flex;
import React from 'react'; import PropTypes from 'prop-types'; const toPercent = num => `${num}%`; const Flex = ({ children, className, direction, count, offset, style, wrap, ...otherProps }) => ( <div className={className} style={{ display: 'flex', flexDirection: direction, flexWrap: wrap ? 'wrap' : 'no-wrap', ...style, }} {...otherProps} > {React.Children.map(children, (child, index) => ( React.cloneElement( child, { ...child.props, style: { flexBasis: toPercent(100 / count), maxWidth: toPercent(100 / count), overflow: 'hidden', marginLeft: offset && (index === 0) ? toPercent((100 * offset) / count) : null, }, }, ) ))} </div> ); Flex.propTypes = { children: PropTypes.node, className: PropTypes.string, count: PropTypes.number.isRequired, direction: PropTypes.string, offset: PropTypes.number, style: PropTypes.objectOf(PropTypes.oneOfType([ PropTypes.string, PropTypes.number, ])), wrap: PropTypes.bool, }; export default Flex;
Add max-width to flex items to ensure IE doesn't overscale them
Add max-width to flex items to ensure IE doesn't overscale them
JSX
mit
wojtekmaj/react-calendar,wojtekmaj/react-calendar,wojtekmaj/react-calendar
--- +++ @@ -30,6 +30,7 @@ ...child.props, style: { flexBasis: toPercent(100 / count), + maxWidth: toPercent(100 / count), overflow: 'hidden', marginLeft: offset && (index === 0) ? toPercent((100 * offset) / count) : null, },
376f5a856fd970cbb6ddfe7f19f83d4a88a691bc
src/field/email/email_pane.jsx
src/field/email/email_pane.jsx
import React from 'react'; import EmailInput from '../../ui/input/email_input'; import * as c from '../index'; import { swap, updateEntity } from '../../store/index'; import * as l from '../../core/index'; import { setEmail } from '../email'; import { debouncedRequestAvatar, requestAvatar } from '../../avatar'; export default class EmailPane extends React.Component { componentDidMount() { const { lock } = this.props; if (l.ui.avatar(lock) && c.email(lock)) { requestAvatar(l.id(lock), c.email(lock)); } } handleChange(e) { const { lock } = this.props; if (l.ui.avatar(lock)) { debouncedRequestAvatar(l.id(lock), e.target.value); } swap(updateEntity, "lock", l.id(lock), setEmail, e.target.value); } render() { const { lock, placeholder } = this.props; return ( <EmailInput value={c.email(lock)} isValid={!c.isFieldVisiblyInvalid(lock, "email")} onChange={::this.handleChange} avatar={l.ui.avatar(lock)} placeholder={placeholder} disabled={l.submitting(lock)} /> ); } } EmailPane.propTypes = { lock: React.PropTypes.object.isRequired, placeholder: React.PropTypes.string.isRequired };
import React from 'react'; import EmailInput from '../../ui/input/email_input'; import * as c from '../index'; import { swap, updateEntity } from '../../store/index'; import * as l from '../../core/index'; import { setEmail } from '../email'; import { debouncedRequestAvatar, requestAvatar } from '../../avatar'; export default class EmailPane extends React.Component { componentDidMount() { const { lock } = this.props; if (l.ui.avatar(lock) && c.email(lock)) { requestAvatar(l.id(lock), c.email(lock)); } } handleChange(e) { const { lock } = this.props; if (l.ui.avatar(lock)) { debouncedRequestAvatar(l.id(lock), e.target.value); } swap(updateEntity, "lock", l.id(lock), setEmail, e.target.value); } render() { const { instructions, lock, placeholder } = this.props; const headerText = instructions || null; const header = headerText && <p>{headerText}</p>; return ( <div> {header} <EmailInput value={c.email(lock)} isValid={!c.isFieldVisiblyInvalid(lock, "email")} onChange={::this.handleChange} avatar={l.ui.avatar(lock)} placeholder={placeholder} disabled={l.submitting(lock)} /> </div> ); } } EmailPane.propTypes = { instructions: React.PropTypes.element, lock: React.PropTypes.object.isRequired, placeholder: React.PropTypes.string.isRequired };
Add instructions prop to EmailPane
Add instructions prop to EmailPane
JSX
mit
mike-casas/lock,mike-casas/lock,mike-casas/lock
--- +++ @@ -25,22 +25,28 @@ } render() { - const { lock, placeholder } = this.props; + const { instructions, lock, placeholder } = this.props; + const headerText = instructions || null; + const header = headerText && <p>{headerText}</p>; return ( - <EmailInput value={c.email(lock)} - isValid={!c.isFieldVisiblyInvalid(lock, "email")} - onChange={::this.handleChange} - avatar={l.ui.avatar(lock)} - placeholder={placeholder} - disabled={l.submitting(lock)} - /> + <div> + {header} + <EmailInput value={c.email(lock)} + isValid={!c.isFieldVisiblyInvalid(lock, "email")} + onChange={::this.handleChange} + avatar={l.ui.avatar(lock)} + placeholder={placeholder} + disabled={l.submitting(lock)} + /> + </div> ); } } EmailPane.propTypes = { + instructions: React.PropTypes.element, lock: React.PropTypes.object.isRequired, placeholder: React.PropTypes.string.isRequired };
f4012022a461f59ed54cd50e04b570d5848fbe76
client/index.jsx
client/index.jsx
import React from 'react'; import { render } from 'react-dom'; import { Router, browserHistory } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; import { Provider } from 'react-redux'; import createStore from '_store/createStore'; import routes from '_components/routes'; export default function () { if (process.env.NODE_ENV !== 'production' && BUNDLE !== 'cordova') { /* eslint-disable import/no-extraneous-dependencies, global-require */ window.Perf = require('react-addons-perf'); /* eslint-enable import/no-extraneous-dependencies, global-require */ } const store = createStore(browserHistory); const history = syncHistoryWithStore(browserHistory, store); if (BUNDLE === 'electronClient' || BUNDLE === 'cordova') { browserHistory.replace('/'); } const dest = document.getElementById('contents'); render(( <Provider store={store}> <Router history={history}> {routes('/')} </Router> </Provider> ), dest); return store; }
import React from 'react'; import { render } from 'react-dom'; import { Router, browserHistory, createMemoryHistory } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; import { Provider } from 'react-redux'; import createStore from '_store/createStore'; import routes from '_components/routes'; export default function () { if (process.env.NODE_ENV !== 'production' && BUNDLE !== 'cordova') { /* eslint-disable import/no-extraneous-dependencies, global-require */ window.Perf = require('react-addons-perf'); /* eslint-enable import/no-extraneous-dependencies, global-require */ } const baseHistory = ( (BUNDLE === 'electronClient' || BUNDLE === 'cordova') ? createMemoryHistory() : browserHistory ); const store = createStore(baseHistory); const history = syncHistoryWithStore(baseHistory, store); const dest = document.getElementById('contents'); render(( <Provider store={store}> <Router history={history}> {routes('/')} </Router> </Provider> ), dest); return store; }
Use memoryHistory for non-DOM clients
Use memoryHistory for non-DOM clients
JSX
mit
Satyam/RoxyMusic,Satyam/RoxyMusic
--- +++ @@ -1,6 +1,6 @@ import React from 'react'; import { render } from 'react-dom'; -import { Router, browserHistory } from 'react-router'; +import { Router, browserHistory, createMemoryHistory } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; import { Provider } from 'react-redux'; @@ -15,12 +15,15 @@ /* eslint-enable import/no-extraneous-dependencies, global-require */ } - const store = createStore(browserHistory); + const baseHistory = ( + (BUNDLE === 'electronClient' || BUNDLE === 'cordova') + ? createMemoryHistory() + : browserHistory + ); - const history = syncHistoryWithStore(browserHistory, store); - if (BUNDLE === 'electronClient' || BUNDLE === 'cordova') { - browserHistory.replace('/'); - } + const store = createStore(baseHistory); + + const history = syncHistoryWithStore(baseHistory, store); const dest = document.getElementById('contents'); render((
eb06c5db97c6943bdb4b6a2379d5e9f1de74b38a
client/packages/bulma-dashboard-theme-worona/src/dashboard/components/SiteHome/index.jsx
client/packages/bulma-dashboard-theme-worona/src/dashboard/components/SiteHome/index.jsx
import React from 'react'; import { connect } from 'react-redux'; import Header from '../Header'; import Footer from '../Footer'; import FooterLinks from '../Footer/FooterLinks'; import Body from '../Body'; import Main from '../Main'; import Hero from '../elements/Hero'; import * as deps from '../../deps'; import ServiceTabs from './ServiceTabs'; import AsideMenu from './AsideMenu'; const SiteHome = ({ site }) => ( <Body> <Header waitForSubscriptions={[deps.selectors.getIsReadySites]}> <Hero title={site.name}> <small>{site.id}</small> <br /> <small>{site.url}</small> </Hero> <ServiceTabs /> </Header> <Main waitForSubscriptions={[deps.selectors.getIsReadySettings]}> <div className="columns is-mobile" > <AsideMenu /> {/* <PackageContent /> */} </div> </Main> <Footer> <FooterLinks /> </Footer> </Body> ); const mapStateToProps = (state) => ({ site: deps.selectors.getSelectedSite(state), }); SiteHome.propTypes = { site: React.PropTypes.shape({ name: React.PropTypes.string.isRequired, id: React.PropTypes.string.isRequired, url: React.PropTypes.string.isRequired, }).isRequired, }; export default connect(mapStateToProps)(SiteHome);
import React from 'react'; import { connect } from 'react-redux'; import Header from '../Header'; import Footer from '../Footer'; import FooterLinks from '../Footer/FooterLinks'; import Body from '../Body'; import Main from '../Main'; import Hero from '../elements/Hero'; import * as deps from '../../deps'; import ServiceTabs from './ServiceTabs'; import AsideMenu from './AsideMenu'; /* Header */ let SiteHomeHeader = ({ site }) => ( <div> <Hero title={site.name}> <small>{site.id}</small> <br /> <small>{site.url}</small> </Hero> <ServiceTabs /> </div> ); const mapStateToProps = (state) => ({ site: deps.selectors.getSelectedSite(state), }); SiteHomeHeader.propTypes = { site: React.PropTypes.shape({ name: React.PropTypes.string.isRequired, id: React.PropTypes.string.isRequired, url: React.PropTypes.string.isRequired, }), }; SiteHomeHeader = connect(mapStateToProps)(SiteHomeHeader); const SiteHome = () => ( <Body> <Header waitForSubscriptions={[deps.selectors.getIsReadySites]}> <SiteHomeHeader /> </Header> <Main waitForSubscriptions={[deps.selectors.getIsReadySettings]}> <div className="columns is-mobile" > <AsideMenu /> {/* <PackageContent /> */} </div> </Main> <Footer> <FooterLinks /> </Footer> </Body> ); export default SiteHome;
Use Header component in SiteHome
Use Header component in SiteHome
JSX
mit
worona/worona-core,worona/worona,worona/worona-dashboard,worona/worona,worona/worona-dashboard,worona/worona,worona/worona-core
--- +++ @@ -12,15 +12,36 @@ import ServiceTabs from './ServiceTabs'; import AsideMenu from './AsideMenu'; -const SiteHome = ({ site }) => ( +/* Header */ +let SiteHomeHeader = ({ site }) => ( + <div> + <Hero title={site.name}> + <small>{site.id}</small> + <br /> + <small>{site.url}</small> + </Hero> + <ServiceTabs /> + </div> +); + +const mapStateToProps = (state) => ({ + site: deps.selectors.getSelectedSite(state), +}); + +SiteHomeHeader.propTypes = { + site: React.PropTypes.shape({ + name: React.PropTypes.string.isRequired, + id: React.PropTypes.string.isRequired, + url: React.PropTypes.string.isRequired, + }), +}; + +SiteHomeHeader = connect(mapStateToProps)(SiteHomeHeader); + +const SiteHome = () => ( <Body> <Header waitForSubscriptions={[deps.selectors.getIsReadySites]}> - <Hero title={site.name}> - <small>{site.id}</small> - <br /> - <small>{site.url}</small> - </Hero> - <ServiceTabs /> + <SiteHomeHeader /> </Header> <Main waitForSubscriptions={[deps.selectors.getIsReadySettings]}> @@ -36,16 +57,4 @@ </Body> ); -const mapStateToProps = (state) => ({ - site: deps.selectors.getSelectedSite(state), -}); - -SiteHome.propTypes = { - site: React.PropTypes.shape({ - name: React.PropTypes.string.isRequired, - id: React.PropTypes.string.isRequired, - url: React.PropTypes.string.isRequired, - }).isRequired, -}; - -export default connect(mapStateToProps)(SiteHome); +export default SiteHome;
85beabad193bd0f61abfbdf971dfb9f75eecad24
src/views/studio/studio-info-box.jsx
src/views/studio/studio-info-box.jsx
import React from 'react'; import PropTypes from 'prop-types'; import {connect} from 'react-redux'; import Button from '../../components/forms/button.jsx'; const StudioInfoBox = ({showInfoBox, onClose, ...props}) => { if (!showInfoBox) return null; return ( <div className="studio-invitation studio-info-box"> {/* TODO move more styling into studio-info-box? */} {props.children} <Button className="studio-info-close-button" isCloseType onClick={onClose} /> </div> ); }; StudioInfoBox.propTypes = { showInfoBox: PropTypes.bool, onClose: PropTypes.func, children: PropTypes.node }; const mapStateToProps = () => ({}); const mapDispatchToProps = () => ({}); export default connect(mapStateToProps, mapDispatchToProps)(StudioInfoBox);
import React from 'react'; import PropTypes from 'prop-types'; import Button from '../../components/forms/button.jsx'; const StudioInfoBox = ({showInfoBox, onClose, ...props}) => { if (!showInfoBox) return null; return ( <div className="studio-invitation studio-info-box"> {/* TODO move more styling into studio-info-box? */} {props.children} <Button className="studio-info-close-button" isCloseType onClick={onClose} /> </div> ); }; StudioInfoBox.propTypes = { showInfoBox: PropTypes.bool, onClose: PropTypes.func, children: PropTypes.node }; export default StudioInfoBox;
Remove unneded redux connect code
Remove unneded redux connect code
JSX
bsd-3-clause
LLK/scratch-www,LLK/scratch-www
--- +++ @@ -1,6 +1,5 @@ import React from 'react'; import PropTypes from 'prop-types'; -import {connect} from 'react-redux'; import Button from '../../components/forms/button.jsx'; const StudioInfoBox = ({showInfoBox, onClose, ...props}) => { @@ -24,8 +23,4 @@ children: PropTypes.node }; -const mapStateToProps = () => ({}); - -const mapDispatchToProps = () => ({}); - -export default connect(mapStateToProps, mapDispatchToProps)(StudioInfoBox); +export default StudioInfoBox;
fa128f699c0d3e9477ce69e31105bd4386d0b6a7
imports/ui/components/header/index.jsx
imports/ui/components/header/index.jsx
import React from 'react' import Sports from '../sports' import Countries from '../countries' import PlacardLink from '../placard-link/index' export default (props) => ( <header> <nav> <PlacardLink /> { !props.loadingSports && <Sports sports={props.sports} hideChildren> <Countries /> </Sports> } </nav> </header> )
import React from 'react' import { NavLink } from 'react-router-dom' import Sports from '../sports' import Countries from '../countries' import PlacardLink from '../placard-link/index' export default (props) => ( <header> <nav> <NavLink exact to='/' className='to-right'>Home</NavLink> <PlacardLink /> { !props.loadingSports && <Sports sports={props.sports} hideChildren> <Countries /> </Sports> } </nav> </header> )
Add a link to the home page in order to list all the events that happen within the next 24 hours.
Add a link to the home page in order to list all the events that happen within the next 24 hours.
JSX
mit
LuisLoureiro/placard-wrapper
--- +++ @@ -1,4 +1,5 @@ import React from 'react' +import { NavLink } from 'react-router-dom' import Sports from '../sports' import Countries from '../countries' @@ -7,6 +8,7 @@ export default (props) => ( <header> <nav> + <NavLink exact to='/' className='to-right'>Home</NavLink> <PlacardLink /> { !props.loadingSports &&
40d88702a978da807cdb89a9a757944edb7e5352
encrypt-main.jsx
encrypt-main.jsx
/* eslint-disable no-unused-vars */ import React from 'react'; /* eslint-disable no-unused-vars */ import { Router, browserHistory, Route, IndexRedirect, Redirect } from 'react-router'; function redirect(state, replace) { if (state.location.query.video === '1') { replace('/encrypt/direct/1'); } } module.exports = ( <Router history={browserHistory}> <Route path="/encrypt"> <IndexRedirect to="/encrypt/social/2" /> <Route path="signup" component={require(`./pages/encrypt/signup.jsx`)}/> <Route path="signup-complete" component={require(`./pages/encrypt/signup-complete.jsx`)}/> <Route path=":type/:video" component={require('./pages/encrypt/pageType.jsx')}/> <Redirect from="direct" to="/encrypt/direct/2" /> <Redirect from="social" to="/encrypt/social/2" /> <Route path="2" onEnter={redirect} /> <Redirect from="3" to="/encrypt/hybrid/2" /> <Redirect from="*" to="/encrypt/" /> </Route> </Router> );
/* eslint-disable no-unused-vars */ import React from 'react'; /* eslint-disable no-unused-vars */ import { Router, browserHistory, Route, IndexRedirect, Redirect, IndexRoute } from 'react-router'; import encryptVideos from './data/encryptVideos'; function redirect(state, replace) { var pageType; switch(state.location.pathname.slice(-1)){ case '2': pageType = 'direct'; break; case '3': pageType = 'hybrid'; break; default: pageType = 'social'; } if (state.location.query.video) { replace(`/encrypt/${pageType}/${state.location.query.video}`); } else { replace(`/encrypt/${pageType}/${encryptVideos.length}`); } } function indexDirect(state, replace) { if(state.location.query.video){ replace(`/encrypt/social/${state.location.query.video}`); } else { replace(`/encrypt/social/${encryptVideos.length}`); } } module.exports = ( <Router history={browserHistory}> <Route path="/encrypt"> <IndexRoute onEnter={indexDirect} /> <Route path="signup" component={require(`./pages/encrypt/signup.jsx`)}/> <Route path="signup-complete" component={require(`./pages/encrypt/signup-complete.jsx`)}/> <Route path=":type/:video" component={require('./pages/encrypt/pageType.jsx')}/> <Redirect from="direct" to={`/encrypt/direct/${encryptVideos.length}`} /> <Redirect from="social" to={`/encrypt/social/${encryptVideos.length}`} /> <Route path="2" onEnter={redirect} /> <Route path="3" onEnter={redirect} /> <Redirect from="*" to="/encrypt/" /> </Route> </Router> );
Add query handling for routing
Add query handling for routing
JSX
mpl-2.0
mozilla/advocacy.mozilla.org
--- +++ @@ -1,25 +1,47 @@ /* eslint-disable no-unused-vars */ import React from 'react'; /* eslint-disable no-unused-vars */ -import { Router, browserHistory, Route, IndexRedirect, Redirect } from 'react-router'; +import { Router, browserHistory, Route, IndexRedirect, Redirect, IndexRoute } from 'react-router'; +import encryptVideos from './data/encryptVideos'; function redirect(state, replace) { - if (state.location.query.video === '1') { - replace('/encrypt/direct/1'); + var pageType; + switch(state.location.pathname.slice(-1)){ + case '2': + pageType = 'direct'; + break; + case '3': + pageType = 'hybrid'; + break; + default: + pageType = 'social'; + } + if (state.location.query.video) { + replace(`/encrypt/${pageType}/${state.location.query.video}`); + } else { + replace(`/encrypt/${pageType}/${encryptVideos.length}`); } +} + +function indexDirect(state, replace) { + if(state.location.query.video){ + replace(`/encrypt/social/${state.location.query.video}`); + } else { + replace(`/encrypt/social/${encryptVideos.length}`); + } } module.exports = ( <Router history={browserHistory}> <Route path="/encrypt"> - <IndexRedirect to="/encrypt/social/2" /> + <IndexRoute onEnter={indexDirect} /> <Route path="signup" component={require(`./pages/encrypt/signup.jsx`)}/> <Route path="signup-complete" component={require(`./pages/encrypt/signup-complete.jsx`)}/> <Route path=":type/:video" component={require('./pages/encrypt/pageType.jsx')}/> - <Redirect from="direct" to="/encrypt/direct/2" /> - <Redirect from="social" to="/encrypt/social/2" /> + <Redirect from="direct" to={`/encrypt/direct/${encryptVideos.length}`} /> + <Redirect from="social" to={`/encrypt/social/${encryptVideos.length}`} /> <Route path="2" onEnter={redirect} /> - <Redirect from="3" to="/encrypt/hybrid/2" /> + <Route path="3" onEnter={redirect} /> <Redirect from="*" to="/encrypt/" /> </Route> </Router>
b7a4970f11c6d31c406be57148da7c94000f1b2d
js/ClientApp.jsx
js/ClientApp.jsx
const React = require('react') const ReactDOM = require('react-dom') const MyTitle = require('./MyTitle') var MyFirstComponent = function () { return ( <div> <MyTitle title="Trying out JSX!" color="rebeccapurple" /> <MyTitle title="It's not that awkward!" color="mediumaquamarine" /> <MyTitle title="Starting to grow on me." color="papayawhip" /> </div> ) } ReactDOM.render(<MyFirstComponent />, document.getElementById('app'))
const React = require('react') const ReactDOM = require('react-dom') const MyTitle = require('./MyTitle') const MyFirstComponent = () => ( <div> <MyTitle title="Trying out JSX!" color="rebeccapurple" /> <MyTitle title="It's not that awkward!" color="mediumaquamarine" /> <MyTitle title="Starting to grow on me." color="papayawhip" /> </div> ) ReactDOM.render(<MyFirstComponent />, document.getElementById('app'))
Use new ES6 syntax for declaring functions
Use new ES6 syntax for declaring functions
JSX
mit
bencodezen/cloneflix-react-with-bholt,bencodezen/cloneflix-react-with-bholt
--- +++ @@ -2,14 +2,12 @@ const ReactDOM = require('react-dom') const MyTitle = require('./MyTitle') -var MyFirstComponent = function () { - return ( - <div> - <MyTitle title="Trying out JSX!" color="rebeccapurple" /> - <MyTitle title="It's not that awkward!" color="mediumaquamarine" /> - <MyTitle title="Starting to grow on me." color="papayawhip" /> - </div> - ) -} +const MyFirstComponent = () => ( + <div> + <MyTitle title="Trying out JSX!" color="rebeccapurple" /> + <MyTitle title="It's not that awkward!" color="mediumaquamarine" /> + <MyTitle title="Starting to grow on me." color="papayawhip" /> + </div> +) ReactDOM.render(<MyFirstComponent />, document.getElementById('app'))
70b00ef9e2504522c36132a719f40085d817c251
app/renderer-jsx/schema-form/utils.jsx
app/renderer-jsx/schema-form/utils.jsx
'use strict'; const lo_isString = require('lodash.isstring'); const textutil = require('../../main/utils/textutil'); function wrapDescription(description) { if (description === undefined) return undefined; return (<p style={{ color: '#999' }} dangerouslySetInnerHTML={{ __html: textutil.sanitize(description) }}/>); } function findErrorMessage(errors, path) { const errorPath = `instance${path}`; for (const error of errors) { if (error.property !== errorPath) continue; const errorType = error.name; const customMessages = error.schema.errorMessages; if (customMessages !== undefined) { if (lo_isString(customMessages)) return customMessages; if (customMessages[errorType]) return customMessages[errorType]; } return error.message; } return undefined; } module.exports = { wrapDescription, findErrorMessage };
'use strict'; import React from 'react'; // DO NOT REMOVE THIS LINE, JSX USES THIS LIBRARY const lo_isString = require('lodash.isstring'); const textutil = require('../../main/utils/textutil'); function wrapDescription(description) { if (description === undefined) return undefined; return (<p style={{ color: '#999' }} dangerouslySetInnerHTML={{ __html: textutil.sanitize(description) }}/>); } function findErrorMessage(errors, path) { const errorPath = `instance${path}`; for (const error of errors) { if (error.property !== errorPath) continue; const errorType = error.name; const customMessages = error.schema.errorMessages; if (customMessages !== undefined) { if (lo_isString(customMessages)) return customMessages; if (customMessages[errorType]) return customMessages[errorType]; } return error.message; } return undefined; } module.exports = { wrapDescription, findErrorMessage };
Fix preferences not working (becauseof JSX)
Fix preferences not working (becauseof JSX)
JSX
mit
appetizermonster/hain,appetizermonster/hain,hainproject/hain,appetizermonster/hain,hainproject/hain,hainproject/hain,hainproject/hain,appetizermonster/hain
--- +++ @@ -1,4 +1,6 @@ 'use strict'; + +import React from 'react'; // DO NOT REMOVE THIS LINE, JSX USES THIS LIBRARY const lo_isString = require('lodash.isstring'); const textutil = require('../../main/utils/textutil');
58e698fcac3228ca11366e132ec807810246543e
src/components/vmOverviewProperties.jsx
src/components/vmOverviewProperties.jsx
import { getReact } from '../react.js'; import { logError } from '../helpers'; const _ = (m) => m; // TODO: add translation const exportedComponents = {}; // to be filled by lazy created and exported components /** * Build React components not before the React context is available. */ export function lazyCreateVmOverviewPropertiesComponents() { const React = getReact(); if (!React) { logError(`lazyCreateVmOverviewPropertiesComponents(): React not registered!`); return ; } const VmOverviewProps = ({ vm, providerState }) => { // For reference, extend if needed if (!providerState.vms[vm.id]) { // not an oVirt-managed VM return null; } let content = null; if (true) { // Recently not used. Icon and addition props are planed. content = 'Hello from Provider'; } return ( <div> {content} </div> ); }; /** * Just a hook, so far there's no extension for it. */ exportedComponents.VmOverviewProps = ({ vm, providerState }) => (<VmOverviewProps vm={vm} providerState={providerState} />); } export default exportedComponents;
import { getReact } from '../react.js'; import { logError } from '../helpers'; const _ = (m) => m; // TODO: add translation const exportedComponents = {}; // to be filled by lazy created and exported components /** * Build React components not before the React context is available. */ export function lazyCreateVmOverviewPropertiesComponents() { const React = getReact(); if (!React) { logError(`lazyCreateVmOverviewPropertiesComponents(): React not registered!`); return ; } const VmOverviewProps = ({ vm, providerState }) => { // For reference, extend if needed if (!providerState.vms[vm.id]) { // not an oVirt-managed VM return null; } let content = null; if (false) { // Recently not used. Icon and addition props are planed. content = 'Hello from Provider'; } return ( <div> {content} </div> ); }; /** * Just a hook, so far there's no extension for it. */ exportedComponents.VmOverviewProps = ({ vm, providerState }) => (<VmOverviewProps vm={vm} providerState={providerState} />); } export default exportedComponents;
Disable rendering of provider's properties on the Overview subtab
Disable rendering of provider's properties on the Overview subtab since they are not yet ready.
JSX
apache-2.0
mareklibra/cockpit-machines-ovirt-provider,mareklibra/cockpit-machines-ovirt-provider,mareklibra/cockpit-machines-ovirt-provider
--- +++ @@ -21,7 +21,7 @@ } let content = null; - if (true) { // Recently not used. Icon and addition props are planed. + if (false) { // Recently not used. Icon and addition props are planed. content = 'Hello from Provider'; }
cb28a6a43cac29de4d25d82f1da26b8ae6fec9b7
app/containers/ProductContainer.jsx
app/containers/ProductContainer.jsx
import React from 'react'; import {connect} from 'react-redux'; import {Product} from '../components/Product'; const mapStateToProps = state => { return { product: state.products.currentProduct, reviews: state.reviews }; }; //temporary function for adding to cart //what will the cart route be? const mapDispatchToProps = dispatch => { return { handleClick (cartId, productId, userId) { return dispatch(addToCart(cartId, productId, userId)) .then(() => {window.history.push('/cart')}); } }; }; export default connect( mapStateToProps, mapDispatchToProps )(Product)
import React from 'react'; import {connect} from 'react-redux'; import {Product} from '../components/Product'; const mapStateToProps = state => { return { product: state.products.currentProduct }; }; //temporary function for adding to cart //what will the cart route be? const mapDispatchToProps = dispatch => { return { handleClick (cartId, productId, userId) { return dispatch(addToCart(cartId, productId, userId)) .then(() => {window.history.push('/cart')}); } }; }; export default connect( mapStateToProps, mapDispatchToProps )(Product)
Remove reviews from state. (Review now on product.)
Remove reviews from state. (Review now on product.)
JSX
mit
cvglass/Lair-Depot,cvglass/Lair-Depot,cvglass/Lair-Depot
--- +++ @@ -5,8 +5,7 @@ const mapStateToProps = state => { return { - product: state.products.currentProduct, - reviews: state.reviews + product: state.products.currentProduct }; };
adb556283ee430ddd2c7711aec75fabdd732f295
imports/ui/components/DrawerButton.jsx
imports/ui/components/DrawerButton.jsx
import React from 'react'; import PropTypes from 'prop-types'; import { NavLink } from 'react-router-dom'; // Material-UI imports import { ListItem, ListItemText, ListItemIcon } from 'material-ui/List'; const DrawerButton = props => ( <ListItem button> <NavLink to={props.to} activeStyle={{ textDecoration: 'none', }} > { props.icon !== null && <ListItemIcon> {props.icon} </ListItemIcon> } <ListItemText primary={props.text} /> </NavLink> </ListItem> ); DrawerButton.propTypes = { icon: PropTypes.element, text: PropTypes.string.isRequired, to: PropTypes.node, }; DrawerButton.defaultProps = { icon: null, to: null, }; export default DrawerButton;
import React from 'react'; import PropTypes from 'prop-types'; import { NavLink } from 'react-router-dom'; // Material-UI imports import { ListItem, ListItemText, ListItemIcon } from 'material-ui/List'; import { grey } from 'material-ui/styles/colors'; const DrawerButton = props => ( <ListItem button> <NavLink to={props.to} style={{ textDecoration: 'none', color: grey[600], }} activeStyle={{ fontWeight: 'bold', color: grey[400], }} > { props.icon !== null && <ListItemIcon> {props.icon} </ListItemIcon> } <ListItemText primary={props.text} disableTypography /> </NavLink> </ListItem> ); DrawerButton.propTypes = { icon: PropTypes.element, text: PropTypes.string.isRequired, to: PropTypes.node, }; DrawerButton.defaultProps = { icon: null, to: null, }; export default DrawerButton;
Fix for current route button
Fix for current route button
JSX
apache-2.0
AmaralGuincho/connected-client,AmaralGuincho/connected-client
--- +++ @@ -5,13 +5,19 @@ // Material-UI imports import { ListItem, ListItemText, ListItemIcon } from 'material-ui/List'; +import { grey } from 'material-ui/styles/colors'; const DrawerButton = props => ( <ListItem button> <NavLink to={props.to} + style={{ + textDecoration: 'none', + color: grey[600], + }} activeStyle={{ - textDecoration: 'none', + fontWeight: 'bold', + color: grey[400], }} > { props.icon !== null && @@ -21,6 +27,7 @@ } <ListItemText primary={props.text} + disableTypography /> </NavLink> </ListItem>
895e1284467277fe9ba10674012a6ee456c6178b
src/components/adminPages/ChatPage.jsx
src/components/adminPages/ChatPage.jsx
import React from 'react'; import ChatMessageForm from '../chat/ChatMessageForm.jsx'; import ChatMessageList from '../chat/ChatMessageList.jsx'; import ChatMenu from '../chat/ChatMenu.jsx'; require('../../styles/chat/Chat.scss'); /** * This component will print thet chat page for the admin panel * @param {object} route The route state */ export default class ChatPage extends React.Component { constructor(props) { super(props); this.state = { route: props.route, }; } componentWillReceiveProps(nextProps) { this.setState({ route: nextProps.route, }); } render() { let channel = this.state.route.name == 'chat.channel' ? this.state.route.params.channel : null; return ( <div className={this.props.className}> <div className="Chat"> <div className="Chat__column"> <ChatMessageList channel={channel}/> <ChatMessageForm channel={channel}/> </div> <ChatMenu route={this.state.route}/> </div> </div> ); } }
import React from 'react'; import ChatMessageForm from '../chat/ChatMessageForm.jsx'; import ChatMessageList from '../chat/ChatMessageList.jsx'; import ChatMenu from '../chat/ChatMenu.jsx'; require('../../styles/chat/Chat.scss'); /** * This component will print thet chat page for the admin panel * @param {object} route The route state */ export default class ChatPage extends React.Component { constructor(props) { super(props); this.state = { route: props.route, }; } componentWillReceiveProps(nextProps) { this.setState({ route: nextProps.route, }); } render() { let channel = this.state.route.name == 'chat.channel' ? this.state.route.params.channel : false; return ( <div className={this.props.className}> <div className="Chat"> <div className="Chat__column"> <ChatMessageList channel={channel}/> <ChatMessageForm channel={channel}/> </div> <ChatMenu route={this.state.route}/> </div> </div> ); } }
Fix default channel on admin interface
Fix default channel on admin interface
JSX
mit
ungdev/flux2-client,ungdev/flux2-client,ungdev/flux2-client
--- +++ @@ -27,7 +27,7 @@ } render() { - let channel = this.state.route.name == 'chat.channel' ? this.state.route.params.channel : null; + let channel = this.state.route.name == 'chat.channel' ? this.state.route.params.channel : false; return ( <div className={this.props.className}> <div className="Chat">
d3f81c6bbba154a83619b1d182db5759bc5aeb55
src/GoogleMap.jsx
src/GoogleMap.jsx
import React from 'react'; import { withGoogleMap, GoogleMap, Marker, Circle } from 'react-google-maps'; /* Create map with withGoogleMap HOC */ /* https://github.com/tomchentw/react-google-maps */ const Map = withGoogleMap((props) => { const { position, defaultZoom, handleMarkerDragEnd, onZoomChanged, radius, circleOptions } = props; let circle = (radius == -1) ? <Circle center={position} radius={radius} options={circleOptions} /> : ""; return ( <GoogleMap onZoomChanged={onZoomChanged} defaultZoom={defaultZoom} defaultCenter={position} > {/* Map marker */} <Marker draggable // Allow marker to drag position={position} onDragEnd={handleMarkerDragEnd} /> {/* Circle */} circle </GoogleMap> ) }); export default Map;
import React from 'react'; import { withGoogleMap, GoogleMap, Marker, Circle } from 'react-google-maps'; /* Create map with withGoogleMap HOC */ /* https://github.com/tomchentw/react-google-maps */ const Map = withGoogleMap((props) => { const { position, defaultZoom, handleMarkerDragEnd, onZoomChanged, radius, circleOptions } = props; const circle = (radius !== -1) ? <Circle center={position} radius={radius} options={circleOptions} /> : null; return ( <GoogleMap onZoomChanged={onZoomChanged} defaultZoom={defaultZoom} defaultCenter={position} > {/* Map marker */} <Marker draggable // Allow marker to drag position={position} onDragEnd={handleMarkerDragEnd} /> {/* Circle */} { circle } </GoogleMap> ) }); export default Map;
Allow circle to be hidden
Allow circle to be hidden
JSX
mit
rameshsyn/react-location-picker
--- +++ @@ -18,12 +18,14 @@ radius, circleOptions } = props; - let circle = (radius == -1) ? - <Circle - center={position} - radius={radius} - options={circleOptions} - /> : ""; + + const circle = (radius !== -1) ? + <Circle + center={position} + radius={radius} + options={circleOptions} + /> : null; + return ( <GoogleMap onZoomChanged={onZoomChanged} @@ -39,7 +41,7 @@ /> {/* Circle */} - circle + { circle } </GoogleMap> ) });
6d913236e13841bf9f09cdc7e9aef37c4db3ca44
ui/js/component/router/view.jsx
ui/js/component/router/view.jsx
import React from 'react'; import SettingsPage from 'page/settings.js'; import HelpPage from 'page/help'; import ReportPage from 'page/report.js'; import StartPage from 'page/start.js'; import WalletPage from 'page/wallet'; import ShowPage from 'page/showPage'; import PublishPage from 'page/publish.js'; import DiscoverPage from 'page/discover'; import SplashScreen from 'component/splash.js'; import DeveloperPage from 'page/developer.js'; import FileListDownloaded from 'page/fileListDownloaded' import FileListPublished from 'page/fileListPublished' const route = (page, routesMap) => { const component = routesMap[page] return component }; const Router = (props) => { const { currentPage, } = props; return route(currentPage, { 'settings': <SettingsPage {...props} />, 'help': <HelpPage {...props} />, 'report': <ReportPage {...props} />, 'downloaded': <FileListDownloaded {...props} />, 'published': <FileListPublished {...props} />, 'start': <StartPage {...props} />, 'claim': <ClaimCodePage {...props} />, 'wallet': <WalletPage {...props} />, 'send': <WalletPage {...props} />, 'receive': <WalletPage {...props} />, 'show': <ShowPage {...props} />, 'publish': <PublishPage {...props} />, 'developer': <DeveloperPage {...props} />, 'discover': <DiscoverPage {...props} />, }) } export default Router
import React from 'react'; import SettingsPage from 'page/settings.js'; import HelpPage from 'page/help'; import ReportPage from 'page/report.js'; import StartPage from 'page/start.js'; import WalletPage from 'page/wallet'; import ShowPage from 'page/showPage'; import PublishPage from 'page/publish'; import DiscoverPage from 'page/discover'; import SplashScreen from 'component/splash.js'; import DeveloperPage from 'page/developer.js'; import FileListDownloaded from 'page/fileListDownloaded' import FileListPublished from 'page/fileListPublished' const route = (page, routesMap) => { const component = routesMap[page] return component }; const Router = (props) => { const { currentPage, } = props; return route(currentPage, { 'settings': <SettingsPage {...props} />, 'help': <HelpPage {...props} />, 'report': <ReportPage {...props} />, 'downloaded': <FileListDownloaded {...props} />, 'published': <FileListPublished {...props} />, 'start': <StartPage {...props} />, 'claim': <ClaimCodePage {...props} />, 'wallet': <WalletPage {...props} />, 'send': <WalletPage {...props} />, 'receive': <WalletPage {...props} />, 'show': <ShowPage {...props} />, 'publish': <PublishPage {...props} />, 'developer': <DeveloperPage {...props} />, 'discover': <DiscoverPage {...props} />, }) } export default Router
Fix publish page link in router
Fix publish page link in router
JSX
mit
lbryio/lbry-electron,lbryio/lbry-electron,akinwale/lbry-app,jsigwart/lbry-app,akinwale/lbry-app,lbryio/lbry-app,jsigwart/lbry-app,lbryio/lbry-electron,jsigwart/lbry-app,lbryio/lbry-app,jsigwart/lbry-app,akinwale/lbry-app,MaxiBoether/lbry-app,MaxiBoether/lbry-app,MaxiBoether/lbry-app,MaxiBoether/lbry-app,akinwale/lbry-app
--- +++ @@ -5,7 +5,7 @@ import StartPage from 'page/start.js'; import WalletPage from 'page/wallet'; import ShowPage from 'page/showPage'; -import PublishPage from 'page/publish.js'; +import PublishPage from 'page/publish'; import DiscoverPage from 'page/discover'; import SplashScreen from 'component/splash.js'; import DeveloperPage from 'page/developer.js';
db1ad1d254dd56d004dc443fa44684f93f49e391
src/renderer/containers/app.jsx
src/renderer/containers/app.jsx
import React, { Component, PropTypes } from 'react'; import { withRouter } from 'react-router'; import { connect } from 'react-redux'; import * as ConfigActions from '../actions/config.js'; import '../vendor/semantic-ui/semantic'; require('../vendor/lato/latofonts.css'); require('../vendor/semantic-ui/semantic.css'); require('./app.css'); class AppContainer extends Component { static propTypes = { config: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, router: PropTypes.object.isRequired, children: PropTypes.node, }; constructor(props, context) { super(props, context); this.state = {}; } componentDidMount() { this.props.dispatch(ConfigActions.loadConfig()); } render() { const { children } = this.props; return ( <div className="ui"> {children} </div> ); } } function mapStateToProps(state) { return { config: state.config, }; } export default connect(mapStateToProps)(withRouter(AppContainer));
import { webFrame } from 'electron'; // eslint-disable-line import/no-unresolved import React, { Component, PropTypes } from 'react'; import { withRouter } from 'react-router'; import { connect } from 'react-redux'; import * as ConfigActions from '../actions/config.js'; import '../vendor/semantic-ui/semantic'; require('../vendor/lato/latofonts.css'); require('../vendor/semantic-ui/semantic.css'); require('./app.css'); class AppContainer extends Component { static propTypes = { config: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, router: PropTypes.object.isRequired, children: PropTypes.node, }; constructor(props, context) { super(props, context); this.state = {}; } componentDidMount() { this.props.dispatch(ConfigActions.loadConfig()); } componentWillReceiveProps(newProps) { const { config } = newProps; if (!config.data) { return; } const { zoomFactor } = config.data; if (typeof zoomFactor !== 'undefined' && zoomFactor > 0) { // Apply the zoom factor // Required for HiDPI support webFrame.setZoomFactor(zoomFactor); } } render() { const { children } = this.props; return ( <div className="ui"> {children} </div> ); } } function mapStateToProps(state) { return { config: state.config, }; } export default connect(mapStateToProps)(withRouter(AppContainer));
Add support to set the zoom factor
Add support to set the zoom factor This should improve the HiDPI support. Close #276.
JSX
mit
sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui
--- +++ @@ -1,3 +1,4 @@ +import { webFrame } from 'electron'; // eslint-disable-line import/no-unresolved import React, { Component, PropTypes } from 'react'; import { withRouter } from 'react-router'; import { connect } from 'react-redux'; @@ -26,6 +27,18 @@ this.props.dispatch(ConfigActions.loadConfig()); } + componentWillReceiveProps(newProps) { + const { config } = newProps; + if (!config.data) { return; } + + const { zoomFactor } = config.data; + if (typeof zoomFactor !== 'undefined' && zoomFactor > 0) { + // Apply the zoom factor + // Required for HiDPI support + webFrame.setZoomFactor(zoomFactor); + } + } + render() { const { children } = this.props; return (
88e65699977d6c9d15ce8a6c5a2d72147662c097
templates/javascript.jsx
templates/javascript.jsx
import React, { Component } from 'react' import PropTypes from 'prop-types' /* const ThisClass = ({prop1, prop2}) => ( <div key={prop1}>{ prop2 }</div> ) // or: */ export default class ThisClass extends Component { // componentWillMount () { } // Only for server-side rendering constructor (props) { super(props) this.bindInstanceMethods('methodName1', 'methodName2') // this.state = {} } bindInstanceMethods (...methods) { methods.forEach((method) => { this[method] = this[method].bind(this) }) } componentDidMount () { } componentWillReceiveProps (nextProps) { } shouldComponentUpdate (nextProps, nextState) { return false } componentWillUpdate (nextProps, nextState) { } // Consider hitting m-r in Vim to set bookmark render () { return ( <div> </div> ) } componentDidUpdate (prevProps, prevState) { } componentWillUnmount () { } } ThisClass.propTypes = { string: PropTypes.string.isRequired, initialValue: PropTypes.number, type: PropTypes.oneOf(['enum1', 'enum2']) } ThisClass.defaultProps = { initialValue: 0 }
import React, { Component } from 'react' import PropTypes from 'prop-types' /* const ThisClass = ({prop1, prop2}) => ( <div key={prop1}>{ prop2 }</div> ) // or: */ export default class ThisClass extends Component { // componentWillMount () { } // Only for server-side rendering constructor (props) { super(props) this.bindInstanceMethods('methodName1', 'methodName2') // this.state = {} } bindInstanceMethods (...methods) { methods.forEach((method) => { this[method] = this[method].bind(this) }) } componentWillReceiveProps (nextProps) { } shouldComponentUpdate (nextProps, nextState) { return false } componentWillUpdate (nextProps, nextState) { } // Consider hitting m-r in Vim to set bookmark render () { return ( <div> </div> ) } componentDidMount () { } componentDidUpdate (prevProps, prevState) { } componentWillUnmount () { } } ThisClass.propTypes = { string: PropTypes.string.isRequired, initialValue: PropTypes.number, type: PropTypes.oneOf(['enum1', 'enum2']) } ThisClass.defaultProps = { initialValue: 0 }
Correct order of life cycle methods in React template
Correct order of life cycle methods in React template
JSX
unlicense
chris-kobrzak/js-dev-vim-setup
--- +++ @@ -23,9 +23,6 @@ methods.forEach((method) => { this[method] = this[method].bind(this) }) } - componentDidMount () { - } - componentWillReceiveProps (nextProps) { } @@ -44,6 +41,9 @@ ) } + componentDidMount () { + } + componentDidUpdate (prevProps, prevState) { }
efa89d081aaf8253f3052c42c6c9965fba3546f3
src/app/components/drawer/Drawer.jsx
src/app/components/drawer/Drawer.jsx
import React, {Component} from 'react'; import PropTypes from 'prop-types'; const propTypes = { isVisible: PropTypes.bool, isAnimatable: PropTypes.bool, handleTransitionEnd: PropTypes.func, children: PropTypes.node } const defaultProps = { handleTransitionEnd: () => {} } class Drawer extends Component { constructor(props) { super(props); this.handleTransitionEnd = this.handleTransitionEnd.bind(this); } handleTransitionEnd() { this.props.handleTransitionEnd(); } addAnimationClasses() { const classes = []; if (this.props.isAnimatable) { classes.push('animatable'); } if (this.props.isVisible) { classes.push('visible'); } return classes.join(' '); } render() { return ( <div className={`drawer ${this.addAnimationClasses()}`} onTransitionEnd={this.handleTransitionEnd}> {this.props.children} </div> ) } } Drawer.propTypes = propTypes; Drawer.defaultProps = defaultProps; export default Drawer;
import React, {Component} from 'react'; import PropTypes from 'prop-types'; const propTypes = { isVisible: PropTypes.bool, isAnimatable: PropTypes.bool, handleTransitionEnd: PropTypes.func, children: PropTypes.node } const defaultProps = { handleTransitionEnd: () => {} } class Drawer extends Component { constructor(props) { super(props); this.state = { // This classes is added because it's useful for testing to have something in the DOM // that signifies when the animation is finished. It means we don't have to inputs timeouts // or rely on the tests running slow enough to be able to select the elements inside the drawer hasFinishedAnimation: false }; this.handleTransitionEnd = this.handleTransitionEnd.bind(this); } handleTransitionEnd() { this.props.handleTransitionEnd(); this.setState({hasFinishedAnimation: true}); } addAnimationClasses() { const classes = []; if (this.props.isAnimatable) { classes.push('animatable'); } if (this.props.isVisible) { classes.push('visible'); } if (this.state.hasFinishedAnimation) { classes.push('animation-finished'); } return classes.join(' '); } render() { return ( <div className={`drawer ${this.addAnimationClasses()}`} onTransitionEnd={this.handleTransitionEnd}> {this.props.children} </div> ) } } Drawer.propTypes = propTypes; Drawer.defaultProps = defaultProps; export default Drawer;
Add class to animatable on drawer on animation end - useful for acceptance tests
Add class to animatable on drawer on animation end - useful for acceptance tests
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -16,11 +16,19 @@ constructor(props) { super(props); + this.state = { + // This classes is added because it's useful for testing to have something in the DOM + // that signifies when the animation is finished. It means we don't have to inputs timeouts + // or rely on the tests running slow enough to be able to select the elements inside the drawer + hasFinishedAnimation: false + }; + this.handleTransitionEnd = this.handleTransitionEnd.bind(this); } handleTransitionEnd() { this.props.handleTransitionEnd(); + this.setState({hasFinishedAnimation: true}); } addAnimationClasses() { @@ -32,6 +40,10 @@ if (this.props.isVisible) { classes.push('visible'); + } + + if (this.state.hasFinishedAnimation) { + classes.push('animation-finished'); } return classes.join(' ');
01b3c313cdb383ae890999d3b7e83d3299e3fb21
src/index.jsx
src/index.jsx
import { h, render } from 'preact'; import { Provider } from 'preact-redux'; import App from './preact/App'; import registerServiceWorker from './registerServiceWorker'; import store from './redux/store'; import './styles/index.scss'; const rootElement = document.getElementById('root'); root.removeChild(rootElement.childNodes[0]); registerServiceWorker(); render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') );
import { h, render } from 'preact'; import { Provider } from 'preact-redux'; import App from './preact/App'; import registerServiceWorker from './registerServiceWorker'; import store from './redux/store'; import './styles/index.scss'; const rootElement = document.getElementById('root'); root.removeChild(rootElement.childNodes[0]); registerServiceWorker(); render( <Provider store={store}> <App /> </Provider>, rootElement );
Use rootElement instead of getting again
Use rootElement instead of getting again
JSX
apache-2.0
carloseduardosx/github-profile-search,carloseduardosx/github-profile-search,carloseduardosx/github-profile-search
--- +++ @@ -13,5 +13,5 @@ <Provider store={store}> <App /> </Provider>, - document.getElementById('root') + rootElement );
52ef37685cb9acf34ea2188ff3713e6d41b481b5
common/app/routes/settings/components/Social-Settings.jsx
common/app/routes/settings/components/Social-Settings.jsx
import React, { PropTypes } from 'react'; import { Button } from 'react-bootstrap'; import FA from 'react-fontawesome'; export default function SocialSettings({ isGithubCool, isTwitter, isLinkedIn }) { const githubCopy = isGithubCool ? 'Update my portfolio from GitHub' : 'Link my GitHub to unlock my portfolio'; const buttons = [ <Button block={ true } bsSize='lg' className='btn-link-social btn-github' href='/link/github' key='github' > <FA name='github' /> { githubCopy } </Button> ]; if (isGithubCool && !isTwitter) { buttons.push(( <Button block={ true } bsSize='lg' className='btn-link-social btn-twitter' href='/link/twitter' key='twitter' > <FA name='twitter' /> Add my LinkedIn to my portfolio </Button> )); } if (isGithubCool && !isLinkedIn) { buttons.push(( <Button block={ true } bsSize='lg' className='btn-link-social btn-linkedin' href='/link/linkedin' key='linkedin' > <FA name='linkedin' /> Add my LinkedIn to my portfolio </Button> )); } return (<div>{ buttons }</div>); } SocialSettings.propTypes = { isGithubCool: PropTypes.bool, isTwitter: PropTypes.bool, isLinkedIn: PropTypes.bool };
import React, { PropTypes } from 'react'; import { Button } from 'react-bootstrap'; import FA from 'react-fontawesome'; export default function SocialSettings({ isGithubCool, isTwitter, isLinkedIn }) { const githubCopy = isGithubCool ? 'Update my portfolio from GitHub' : 'Link my GitHub to unlock my portfolio'; const buttons = [ <Button block={ true } bsSize='lg' className='btn-link-social btn-github' href='/link/github' key='github' > <FA name='github' /> { githubCopy } </Button> ]; if (isGithubCool && !isTwitter) { buttons.push(( <Button block={ true } bsSize='lg' className='btn-link-social btn-twitter' href='/link/twitter' key='twitter' > <FA name='twitter' /> Add my Twitter to my portfolio </Button> )); } if (isGithubCool && !isLinkedIn) { buttons.push(( <Button block={ true } bsSize='lg' className='btn-link-social btn-linkedin' href='/link/linkedin' key='linkedin' > <FA name='linkedin' /> Add my LinkedIn to my portfolio </Button> )); } return (<div>{ buttons }</div>); } SocialSettings.propTypes = { isGithubCool: PropTypes.bool, isTwitter: PropTypes.bool, isLinkedIn: PropTypes.bool };
Fix (settings) : Duplicate social labels
Fix (settings) : Duplicate social labels closes #9848
JSX
bsd-3-clause
techstonia/FreeCodeCamp,otavioarc/freeCodeCamp,no-stack-dub-sack/freeCodeCamp,pahosler/freecodecamp,BrendanSweeny/FreeCodeCamp,BhaveshSGupta/FreeCodeCamp,TheeMattOliver/FreeCodeCamp,BhaveshSGupta/FreeCodeCamp,HKuz/FreeCodeCamp,FreeCodeCamp/FreeCodeCamp,raisedadead/FreeCodeCamp,codeman869/FreeCodeCamp,jonathanihm/freeCodeCamp,BerkeleyTrue/FreeCodeCamp,BerkeleyTrue/FreeCodeCamp,codeman869/FreeCodeCamp,BrendanSweeny/FreeCodeCamp,FreeCodeCampQuito/FreeCodeCamp,BhaveshSGupta/FreeCodeCamp,raisedadead/FreeCodeCamp,no-stack-dub-sack/freeCodeCamp,systimotic/FreeCodeCamp,matthew-t-smith/freeCodeCamp,Munsterberg/freecodecamp,matthew-t-smith/freeCodeCamp,otavioarc/freeCodeCamp,1111113j8Pussy420/https-github.com-raisedadead-freeCodeCamp,sakthik26/FreeCodeCamp,DusanSacha/FreeCodeCamp,tmashuang/FreeCodeCamp,TheeMattOliver/FreeCodeCamp,techstonia/FreeCodeCamp,jonathanihm/freeCodeCamp,1111113j8Pussy420/https-github.com-raisedadead-freeCodeCamp,MiloATH/FreeCodeCamp,FreeCodeCamp/FreeCodeCamp,HKuz/FreeCodeCamp,DusanSacha/FreeCodeCamp,MiloATH/FreeCodeCamp,systimotic/FreeCodeCamp,sakthik26/FreeCodeCamp,tmashuang/FreeCodeCamp,Munsterberg/freecodecamp,FreeCodeCampQuito/FreeCodeCamp,pahosler/freecodecamp
--- +++ @@ -32,7 +32,7 @@ key='twitter' > <FA name='twitter' /> - Add my LinkedIn to my portfolio + Add my Twitter to my portfolio </Button> )); }
da870d47f8448b4c5d3431f1f349c869df35a3cc
src/drive/web/modules/filelist/FileOpener.jsx
src/drive/web/modules/filelist/FileOpener.jsx
import React, { Component } from 'react' import Hammer from '@egjs/hammerjs' import propagating from 'propagating-hammerjs' import { enableTouchEvents } from './File' import styles from './fileopener.styl' class FileOpener extends Component { constructor(props) { super(props) this.myRef = React.createRef() } componentDidMount() { const { file, disabled, actionMenuVisible, toggle, open, selectionModeActive, isRenaming } = this.props this.gesturesHandler = propagating(new Hammer(this.myRef.current)) this.gesturesHandler.on('tap onpress singletap', ev => { if (actionMenuVisible || disabled) return if (enableTouchEvents(ev)) { ev.preventDefault() // prevent a ghost click if (ev.type === 'onpress' || selectionModeActive) { ev.srcEvent.stopImmediatePropagation() toggle(ev.srcEvent) } else { ev.srcEvent.stopImmediatePropagation() if (!isRenaming) open(ev.srcEvent, file) } } }) } componentWillUnmount() { this.gesturesHandler && this.gesturesHandler.destroy() } render() { const { file, children } = this.props return ( <span className={styles['file-opener']} ref={this.myRef} id={file.id}> {children} </span> ) } } export default FileOpener
import React, { Component } from 'react' import Hammer from '@egjs/hammerjs' import propagating from 'propagating-hammerjs' import { enableTouchEvents } from './File' import styles from './fileopener.styl' class FileOpener extends Component { constructor(props) { super(props) this.myRef = React.createRef() } componentDidMount() { this.gesturesHandler = propagating(new Hammer(this.myRef.current)) this.gesturesHandler.on('tap onpress singletap', ev => { //don't read the props to early. Read them only in the callback const { file, disabled, actionMenuVisible, toggle, open, selectionModeActive, isRenaming } = this.props if (actionMenuVisible || disabled) return if (enableTouchEvents(ev)) { ev.preventDefault() // prevent a ghost click if (ev.type === 'onpress' || selectionModeActive) { ev.srcEvent.stopImmediatePropagation() toggle(ev.srcEvent) } else { ev.srcEvent.stopImmediatePropagation() if (!isRenaming) open(ev.srcEvent, file) } } }) } componentWillUnmount() { this.gesturesHandler && this.gesturesHandler.destroy() } render() { const { file, children } = this.props return ( <span className={styles['file-opener']} ref={this.myRef} id={file.id}> {children} </span> ) } } export default FileOpener
Read props during the callback, not before, props can change...
fix: Read props during the callback, not before, props can change... Had issue when clicking on a <File /> when the selectionbar was active.
JSX
agpl-3.0
nono/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3
--- +++ @@ -12,17 +12,18 @@ } componentDidMount() { - const { - file, - disabled, - actionMenuVisible, - toggle, - open, - selectionModeActive, - isRenaming - } = this.props this.gesturesHandler = propagating(new Hammer(this.myRef.current)) this.gesturesHandler.on('tap onpress singletap', ev => { + //don't read the props to early. Read them only in the callback + const { + file, + disabled, + actionMenuVisible, + toggle, + open, + selectionModeActive, + isRenaming + } = this.props if (actionMenuVisible || disabled) return if (enableTouchEvents(ev)) { ev.preventDefault() // prevent a ghost click
670113c75624172469d873c957cfa0c539090071
index.jsx
index.jsx
import React from 'react'; import AutoLayout from 'autolayout'; var AutoLayoutSVG = React.createClass({ propTypes: { width: React.PropTypes.number.isRequired, height: React.PropTypes.number.isRequired, format: React.PropTypes.arrayOf(React.PropTypes.string).isRequired, spacing: React.PropTypes.number, extended: React.PropTypes.bool, }, getDefaultProps() { return { spacing: 0, extended: true, }; }, render() { const {children, width, height, format, spacing, extended} = this.props; const constraints = AutoLayout.VisualFormat.parse(format, {extended}); var view = new AutoLayout.View({ constraints, spacing, width, height, }); return ( <g> {React.Children.map(children, (child) => this.renderChild(child, view) )} </g> ); }, renderChild(child, view) { const subView = view.subViews[child.props.viewName]; if (subView) { const {left, top, width, height} = subView; return ( <g transform={`translate(${left}, ${top})`}> {React.cloneElement(child, {width, height})} </g> ); } else { return child; } }, }); AutoLayoutSVG.PropsCallback = React.createClass({ propTypes: { children: React.PropTypes.func.isRequired, }, render() { return this.props.children(this.props); }, }); export default AutoLayoutSVG;
import React from 'react'; import AutoLayout from 'autolayout'; var AutoLayoutSVG = React.createClass({ propTypes: { width: React.PropTypes.number.isRequired, height: React.PropTypes.number.isRequired, format: React.PropTypes.arrayOf(React.PropTypes.string).isRequired, spacing: React.PropTypes.number, extended: React.PropTypes.bool, }, getDefaultProps() { return { spacing: 0, extended: true, }; }, render() { const {children, width, height, format, spacing, extended} = this.props; const constraints = AutoLayout.VisualFormat.parse(format, {extended}); var view = new AutoLayout.View({ constraints, spacing, width, height, }); return ( <g> {React.Children.map(children, (child) => this.renderChild(child, view) )} </g> ); }, renderChild(child, view) { const subView = view.subViews[child.props.viewName]; if (subView) { const {left, top, width, height} = subView; return ( <g transform={`translate(${left}, ${top})`}> {React.cloneElement(child, {width, height})} </g> ); } else { return child; } }, }); AutoLayoutSVG.PropsCallback = React.createClass({ propTypes: { children: React.PropTypes.func.isRequired, }, render() { return this.props.children(this.props); }, }); module.exports = AutoLayoutSVG;
Change export method to accommodate Babel changes
Change export method to accommodate Babel changes
JSX
mit
joshuahhh/react-autolayout-svg
--- +++ @@ -22,7 +22,7 @@ const {children, width, height, format, spacing, extended} = this.props; const constraints = AutoLayout.VisualFormat.parse(format, {extended}); - + var view = new AutoLayout.View({ constraints, spacing, @@ -66,4 +66,4 @@ }); -export default AutoLayoutSVG; +module.exports = AutoLayoutSVG;
953d4e44e7eeed2917a4c589f31b8ebbf9b052a5
src/components/sidebar/sidebar.jsx
src/components/sidebar/sidebar.jsx
import React, {PropTypes} from 'react'; import PanelElementEditor from './panel-element-editor/panel-element-editor'; import PanelLayers from './panel-layers'; import PanelGuides from './panel-guides'; import PanelLayerElements from './panel-layer-elements'; const STYLE = { backgroundColor: "#28292D", display: "block", overflowY: "auto", overflowX: "hidden" }; export default function Sidebar({state, width, height}) { return ( <aside style={{minWidth: width, maxWidth: width, maxHeight: height, ...STYLE}} onKeyDown={event => event.stopPropagation()} onKeyUp={event => event.stopPropagation()} className="sidebar" > <div className="layers"><PanelLayers state={state}/></div> <div className="layer-elements"><PanelLayerElements state={state}/></div> <div className="properties"><PanelElementEditor state={state}/></div> {/*<div className="guides"><PanelGuides state={state}/></div>*/} </aside> ); } Sidebar.propTypes = { state: PropTypes.object.isRequired, width: React.PropTypes.number.isRequired, height: React.PropTypes.number.isRequired };
import React, {PropTypes} from 'react'; import PanelElementEditor from './panel-element-editor/panel-element-editor'; import PanelLayers from './panel-layers'; import PanelGuides from './panel-guides'; import PanelLayerElements from './panel-layer-elements'; const STYLE = { backgroundColor: "#28292D", display: "block", overflowY: "auto", overflowX: "hidden" }; export default function Sidebar({state, width, height}) { return ( <aside style={{width, width, height, ...STYLE}} onKeyDown={event => event.stopPropagation()} onKeyUp={event => event.stopPropagation()} className="sidebar" > <div className="layers"><PanelLayers state={state}/></div> <div className="layer-elements"><PanelLayerElements state={state}/></div> <div className="properties"><PanelElementEditor state={state}/></div> {/*<div className="guides"><PanelGuides state={state}/></div>*/} </aside> ); } Sidebar.propTypes = { state: PropTypes.object.isRequired, width: React.PropTypes.number.isRequired, height: React.PropTypes.number.isRequired };
Fix another bug with style
Fix another bug with style
JSX
mit
vovance/3d-demo,cvdlab/react-planner,dearkaran/react-planner
--- +++ @@ -15,7 +15,7 @@ return ( <aside - style={{minWidth: width, maxWidth: width, maxHeight: height, ...STYLE}} + style={{width, width, height, ...STYLE}} onKeyDown={event => event.stopPropagation()} onKeyUp={event => event.stopPropagation()} className="sidebar"
9d03968b5e225cd1a133443312dca8c1a7a5028c
ui/component/fileViewerEmbeddedTitle/view.jsx
ui/component/fileViewerEmbeddedTitle/view.jsx
// @flow import React from 'react'; import Button from 'component/button'; import FilePrice from 'component/filePrice'; import { formatLbryUrlForWeb } from 'util/url'; import { withRouter } from 'react-router'; import { URL } from 'config'; import * as ICONS from 'constants/icons'; type Props = { uri: string, title: ?string, isInApp: boolean, }; function FileViewerEmbeddedTitle(props: Props) { const { uri, title, isInApp } = props; let contentLink = `${formatLbryUrlForWeb(uri)}`; if (!isInApp) { contentLink = `${contentLink}?src=embed`; } const contentLinkProps = isInApp ? { navigate: contentLink } : { href: contentLink }; const lbryLinkProps = isInApp ? { navigate: '/' } : { href: URL }; return ( <div className="file-viewer__embedded-header"> <div className="file-viewer__embedded-gradient" /> <Button label={title} button="link" className="file-viewer__embedded-title" {...contentLinkProps} /> <div className="file-viewer__embedded-info"> <Button className="file-viewer__overlay-logo" icon={ICONS.LBRY} {...lbryLinkProps} /> {isInApp && <FilePrice uri={uri} />} </div> </div> ); } export default withRouter(FileViewerEmbeddedTitle);
// @flow import React from 'react'; import Button from 'component/button'; import FilePrice from 'component/filePrice'; import { formatLbryUrlForWeb } from 'util/url'; import { withRouter } from 'react-router'; import { URL } from 'config'; import * as ICONS from 'constants/icons'; type Props = { uri: string, title: ?string, isInApp: boolean, }; function FileViewerEmbeddedTitle(props: Props) { const { uri, title, isInApp } = props; let contentLink = `${formatLbryUrlForWeb(uri)}`; if (!isInApp) { contentLink = `${contentLink}?src=embed`; } const contentLinkProps = isInApp ? { navigate: contentLink } : { href: contentLink }; const lbryLinkProps = isInApp ? { navigate: '/' } : { href: URL }; return ( <div className="file-viewer__embedded-header"> <div className="file-viewer__embedded-gradient" /> <Button label={title} aria-label={title} button="link" className="file-viewer__embedded-title" {...contentLinkProps} /> <div className="file-viewer__embedded-info"> <Button className="file-viewer__overlay-logo" icon={ICONS.LBRY} aria-label={__('Home')} {...lbryLinkProps} /> {isInApp && <FilePrice uri={uri} />} </div> </div> ); } export default withRouter(FileViewerEmbeddedTitle);
Add tooltip to embed's Title and Home button
Add tooltip to embed's Title and Home button ## Issue - Most titles don't fit the embed container width. I wish to know what the title is without having to click on it first. - Also, add clarity that the LBRY icon brings you Home.
JSX
mit
lbryio/lbry-app,lbryio/lbry-app
--- +++ @@ -28,9 +28,15 @@ return ( <div className="file-viewer__embedded-header"> <div className="file-viewer__embedded-gradient" /> - <Button label={title} button="link" className="file-viewer__embedded-title" {...contentLinkProps} /> + <Button + label={title} + aria-label={title} + button="link" + className="file-viewer__embedded-title" + {...contentLinkProps} + /> <div className="file-viewer__embedded-info"> - <Button className="file-viewer__overlay-logo" icon={ICONS.LBRY} {...lbryLinkProps} /> + <Button className="file-viewer__overlay-logo" icon={ICONS.LBRY} aria-label={__('Home')} {...lbryLinkProps} /> {isInApp && <FilePrice uri={uri} />} </div> </div>
6ffe043c187c764c43b2945708321a89f16881f4
source/setup/js/AddLastLogin.jsx
source/setup/js/AddLastLogin.jsx
import React from "react"; import AddLastLoginForm from "./AddLastLoginForm"; class UnlockArchive extends React.Component { render() { return <div> <h3>Add new entry</h3> <AddLastLoginForm /> </div> } } export default UnlockArchive;
import React from "react"; import HeaderBar from "./HeaderBar"; import AddLastLoginForm from "./AddLastLoginForm"; class AddLastLogin extends React.Component { render() { return ( <div> <HeaderBar /> <h3>Add new entry</h3> <AddLastLoginForm /> </div> ); } } export default AddLastLogin;
Add styles to Last login page
Add styles to Last login page
JSX
mit
buttercup-pw/buttercup-browser-extension,perry-mitchell/buttercup-chrome,perry-mitchell/buttercup-chrome,buttercup-pw/buttercup-browser-extension
--- +++ @@ -1,16 +1,20 @@ import React from "react"; +import HeaderBar from "./HeaderBar"; import AddLastLoginForm from "./AddLastLoginForm"; -class UnlockArchive extends React.Component { +class AddLastLogin extends React.Component { render() { - return <div> - <h3>Add new entry</h3> - <AddLastLoginForm /> - </div> + return ( + <div> + <HeaderBar /> + <h3>Add new entry</h3> + <AddLastLoginForm /> + </div> + ); } } -export default UnlockArchive; +export default AddLastLogin;
c1005f42e895eebfa3ec475bbeb0f6ae3a3f3a06
src/request/components/request-summary-list-item-view.jsx
src/request/components/request-summary-list-item-view.jsx
var glimpse = require('glimpse'), React = require('react'), Timeago = require('../../lib/components/timeago.jsx'); module.exports = React.createClass({ render: function() { var summary = this.props.summary; return ( <div className="request-summary-item-holder" onClick={this.onSelect}> <table className="table table-bordered"> <tr> <td width="90">{summary.duration}ms</td> <td colSpan="6"> {summary.uri} &nbsp; {summary.method} &nbsp; {summary.statusCode} ({summary.statusText}) - {summary.contentType} </td> <td><Timeago time={summary.dateTime} /></td> </tr> <tr> <td>{summary.user.name}</td> <td>{summary.abstract.networkTime}ms</td> <td>{summary.abstract.serverTime}ms</td> <td>{summary.abstract.clientTime}ms</td> <td>{summary.abstract.controller}.{summary.abstract.action}(...)</td> <td>{summary.abstract.actionTime}ms</td> <td>{summary.abstract.viewTime}ms</td> <td>{summary.abstract.queryTime}ms / {summary.abstract.queryCount}</td> </tr> </table> </div> ); }, onSelect: function() { glimpse.emit('shell.request.detail.requested', { id: this.props.summary.id }); } });
var glimpse = require('glimpse'), React = require('react'), Timeago = require('../../lib/components/timeago.jsx'), cx = React.addons.classSet; module.exports = React.createClass({ render: function() { var summary = this.props.summary, containerClass = cx({ 'table table-bordered': true, 'request-summary-shell-selected': summary.selected }); return ( <div className="request-summary-item-holder" onClick={this.onSelect}> <table className={containerClass}> <tr> <td width="90">{summary.duration}ms</td> <td colSpan="6"> {summary.uri} &nbsp; {summary.method} &nbsp; {summary.statusCode} ({summary.statusText}) - {summary.contentType} </td> <td><Timeago time={summary.dateTime} /></td> </tr> <tr> <td>{summary.user.name}</td> <td>{summary.abstract.networkTime}ms</td> <td>{summary.abstract.serverTime}ms</td> <td>{summary.abstract.clientTime}ms</td> <td>{summary.abstract.controller}.{summary.abstract.action}(...)</td> <td>{summary.abstract.actionTime}ms</td> <td>{summary.abstract.viewTime}ms</td> <td>{summary.abstract.queryTime}ms / {summary.abstract.queryCount}</td> </tr> </table> </div> ); }, onSelect: function() { glimpse.emit('shell.request.detail.requested', { id: this.props.summary.id }); } });
Update which highlights the selected request row
Update which highlights the selected request row
JSX
unknown
Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype
--- +++ @@ -1,13 +1,19 @@ var glimpse = require('glimpse'), React = require('react'), - Timeago = require('../../lib/components/timeago.jsx'); + Timeago = require('../../lib/components/timeago.jsx'), + cx = React.addons.classSet; module.exports = React.createClass({ render: function() { - var summary = this.props.summary; + var summary = this.props.summary, + containerClass = cx({ + 'table table-bordered': true, + 'request-summary-shell-selected': summary.selected + }); + return ( <div className="request-summary-item-holder" onClick={this.onSelect}> - <table className="table table-bordered"> + <table className={containerClass}> <tr> <td width="90">{summary.duration}ms</td> <td colSpan="6">
efe902041ad4ec73cfb1fef67539b966706a8f13
src/components/DurationInput.jsx
src/components/DurationInput.jsx
const DurationInput = ({onChange, value}) => ( <input min={1} onChange={(event) => { onChange(event.target.valueAsNumber) }} type="number" value={value} /> ) export default DurationInput
const DurationInput = ({onChange, value}) => ( <input min={1} onChange={(event) => { onChange(event.target.valueAsNumber) }} style={{ width: "3em", }} type="number" value={value} /> ) export default DurationInput
Add width to duration input
Add width to duration input
JSX
agpl-3.0
openchordcharts/openchordcharts-sample-data,openchordcharts/sample-data,openchordcharts/openchordcharts-sample-data,openchordcharts/sample-data
--- +++ @@ -2,6 +2,9 @@ <input min={1} onChange={(event) => { onChange(event.target.valueAsNumber) }} + style={{ + width: "3em", + }} type="number" value={value} />
e17b5f599f416aa1d385d4574e11abf5f522589b
components/dropdown/dropdown.jsx
components/dropdown/dropdown.jsx
import React from 'react'; import Dropdown from 'rc-dropdown'; export default React.createClass({ getDefaultProps() { return { transitionName: 'slide-up', prefixCls: 'ant-dropdown', }; }, render() { const { overlay, ...otherProps } = this.props; const menu = React.cloneElement(overlay, { openTransitionName: 'zoom-big', }); return ( <Dropdown {...otherProps} overlay={menu} /> ); } });
import React from 'react'; import Dropdown from 'rc-dropdown'; export default React.createClass({ getDefaultProps() { return { transitionName: 'slide-up', prefixCls: 'ant-dropdown', mouseEnterDelay: 0.15, mouseLeaveDelay: 0.1, }; }, render() { const { overlay, ...otherProps } = this.props; const menu = React.cloneElement(overlay, { openTransitionName: 'zoom-big', }); return ( <Dropdown {...otherProps} overlay={menu} /> ); } });
Add hover delay for Dropdown
Add hover delay for Dropdown
JSX
mit
RaoHai/ant-design,ddcat1115/ant-design,hjin-me/ant-design,superRaytin/ant-design,vgeyi/ant-design,mitchelldemler/ant-design,havefive/ant-design,vgeyi/ant-design,havefive/ant-design,waywardmonkeys/ant-design,hotoo/ant-design,mitchelldemler/ant-design,vgeyi/ant-design,RaoHai/ant-design,marswong/ant-design,liekkas/ant-design,waywardmonkeys/ant-design,mitchelldemler/ant-design,ant-design/ant-design,ddcat1115/ant-design,elevensky/ant-design,zhujun24/ant-design,vgeyi/ant-design,marswong/ant-design,codering/ant-design,mitchelldemler/ant-design,icaife/ant-design,icaife/ant-design,ant-design/ant-design,superRaytin/ant-design,RaoHai/ant-design,marswong/ant-design,MarshallChen/ant-design,elevensky/ant-design,zheeeng/ant-design,liekkas/ant-design,hjin-me/ant-design,ant-design/ant-design,MarshallChen/ant-design,hjin-me/ant-design,zheeeng/ant-design,zhujun24/ant-design,hjin-me/ant-design,havefive/ant-design,RaoHai/ant-design,codering/ant-design,zhujun24/ant-design,liekkas/ant-design,MarshallChen/ant-design,waywardmonkeys/ant-design,codering/ant-design,hotoo/ant-design,zheeeng/ant-design,liekkas/ant-design,ant-design/ant-design,icaife/ant-design,elevensky/ant-design,hotoo/ant-design,icaife/ant-design,marswong/ant-design,codering/ant-design,havefive/ant-design,elevensky/ant-design,zheeeng/ant-design
--- +++ @@ -6,6 +6,8 @@ return { transitionName: 'slide-up', prefixCls: 'ant-dropdown', + mouseEnterDelay: 0.15, + mouseLeaveDelay: 0.1, }; }, render() {
fdd7af0d6dfc37bb27baef29e44f4b045ee6f86e
test/components/Notebok_spec.jsx
test/components/Notebok_spec.jsx
import React from 'react'; import { expect } from 'chai'; import immutableNotebook from '../dummyNotebook_helper'; import { renderIntoDocument, } from 'react-addons-test-utils'; import Notebook from '../../src/components/Notebook'; // Boilerplate test to make sure the testing setup is configured describe('Notebook', () => { it('accepts an Immutable.List of cells', () => { const component = renderIntoDocument( <Notebook cells={immutableNotebook.get('cells')} language={immutableNotebook.getIn(['metadata', 'language_info', 'name'])} /> ); expect(component).to.not.be.null; // TODO: Significant test }); });
import React from 'react'; import { expect } from 'chai'; import immutableNotebook from '../dummyNotebook_helper'; import { renderIntoDocument, } from 'react-addons-test-utils'; import Notebook from '../../src/components/Notebook'; // Boilerplate test to make sure the testing setup is configured describe('Notebook', () => { it('accepts an Immutable.List of cells', () => { const component = renderIntoDocument( <Notebook notebook={immutableNotebook} /> ); expect(component).to.not.be.null; }); });
Make the test match the current Notebook interface.
Make the test match the current Notebook interface.
JSX
bsd-3-clause
nteract/nteract,rgbkrk/nteract,nteract/nteract,jdfreder/nteract,nteract/nteract,nteract/composition,jdfreder/nteract,temogen/nteract,nteract/composition,temogen/nteract,captainsafia/nteract,jdfreder/nteract,rgbkrk/nteract,captainsafia/nteract,captainsafia/nteract,jdfreder/nteract,nteract/nteract,rgbkrk/nteract,nteract/composition,nteract/nteract,0u812/nteract,0u812/nteract,captainsafia/nteract,jdetle/nteract,jdetle/nteract,jdetle/nteract,rgbkrk/nteract,rgbkrk/nteract,0u812/nteract,jdetle/nteract,temogen/nteract,0u812/nteract
--- +++ @@ -15,11 +15,9 @@ it('accepts an Immutable.List of cells', () => { const component = renderIntoDocument( - <Notebook cells={immutableNotebook.get('cells')} - language={immutableNotebook.getIn(['metadata', 'language_info', 'name'])} /> + <Notebook notebook={immutableNotebook} /> ); expect(component).to.not.be.null; - // TODO: Significant test }); });
c194013b91a5204cfd512e97b378da27d1cedc41
src/jsx/components/Header.jsx
src/jsx/components/Header.jsx
import React, { Component } from 'react'; import PrimaryNav from './navigation/PrimaryNav'; export default class Header extends Component { render() { return ( <header className="Header Grid"> <div className="Grid-fullColumn"> <PrimaryNav /> </div> </header> ); } }
import React, { Component } from 'react'; import { Link } from 'react-router'; import PrimaryNav from './navigation/PrimaryNav'; export default class Header extends Component { render() { return ( <header className="Header Grid"> <div className="Grid-halfColumn"> <Link to="/" className="FlatNav-link">David Minnerly</Link> </div> <div className="Grid-halfColumn"> <PrimaryNav /> </div> </header> ); } }
Add my name to the navigation
Add my name to the navigation While I describe who I am on the homepage, if you're linked directly to a project page with no prior knowledge, you can't tell who's site this is unless you look at the address bar. Having your name visible is something I've seen a lot and come to expect. It will likely be the same for others.
JSX
mit
VoxelDavid/voxeldavid-website,VoxelDavid/voxeldavid-website,vocksel/my-website,vocksel/my-website
--- +++ @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import { Link } from 'react-router'; import PrimaryNav from './navigation/PrimaryNav'; @@ -6,7 +7,11 @@ render() { return ( <header className="Header Grid"> - <div className="Grid-fullColumn"> + <div className="Grid-halfColumn"> + <Link to="/" className="FlatNav-link">David Minnerly</Link> + </div> + + <div className="Grid-halfColumn"> <PrimaryNav /> </div> </header>
6eeffe1afa99134fb56f31be1955259d9172480e
src/views/ServerSelection.jsx
src/views/ServerSelection.jsx
import React from 'react'; import { withStore } from 'fluorine-lib'; import { connection, } from 'pipboylib'; const { createDiscovery, } = connection; @withStore(createDiscovery() .filter(s => s.info && s.info.address) .map(s => s.info.address) .scan((state, servers) => state.concat(servers), []) , 'servers') export default class ServerSelection extends React.Component { static displayName = 'ServerSelection'; static propTypes = { servers: React.PropTypes.any, } render() { return ( (this.props.servers && this.props.servers.length > 0) ? <div>{this.props.servers.map(server => <h1>{server}</h1> )}</div> : <h1> Finding servers... </h1> ); } }
import React from 'react'; import { withStore } from 'fluorine-lib'; import { connection, } from 'pipboylib'; const { createDiscovery, } = connection; @withStore(createDiscovery() .filter(s => s.info && s.info.address) .map(s => s.info.address) .scan((state, servers) => state.concat(servers), []) , 'servers') export default class ServerSelection extends React.Component { static displayName = 'ServerSelection'; static propTypes = { servers: React.PropTypes.any, } selectServer(server) { console.log(server); } render() { return ( (this.props.servers && this.props.servers.length > 0) ? <div>{this.props.servers.map(server => <h1 key={server} onClick={this.selectServer.bind(this, server)}>{server}</h1> )}</div> : <h1> Finding servers... </h1> ); } }
Set the key as the server (address)
Set the key as the server (address)
JSX
bsd-3-clause
RobCoIndustries/pipboy,RobCoIndustries/pipboy
--- +++ @@ -22,11 +22,15 @@ servers: React.PropTypes.any, } + selectServer(server) { + console.log(server); + } + render() { return ( (this.props.servers && this.props.servers.length > 0) ? <div>{this.props.servers.map(server => - <h1>{server}</h1> + <h1 key={server} onClick={this.selectServer.bind(this, server)}>{server}</h1> )}</div> : <h1> Finding servers...
6c264a840336e2d4a046814def9365a18783d53a
src/components/footer/CompanyName.jsx
src/components/footer/CompanyName.jsx
import React from 'react' import { Col } from 'react-bootstrap' import './CompanyName.css' class CompanyName extends React.Component { render() { return ( <Col xs={12} sm={12} md={6} lg={6} className="company-name"> <h4>&copy; 2016 Nextzy Technologies Co., Ltd.</h4> </Col> ) } } export default CompanyName
import React from 'react' import { Col } from 'react-bootstrap' import './CompanyName.css' class CompanyName extends React.Component { render() { return ( <Col xs={12} sm={12} md={6} lg={6} className="company-name"> <h4>&copy; 2017 Nextzy Technologies Co., Ltd.</h4> </Col> ) } } export default CompanyName
Update copyright from 2016 to 2017
Update copyright from 2016 to 2017
JSX
mit
Nextzy/client-nextzy-landing-page-2017,Nextzy/client-nextzy-landing-page-2017
--- +++ @@ -6,7 +6,7 @@ render() { return ( <Col xs={12} sm={12} md={6} lg={6} className="company-name"> - <h4>&copy; 2016 Nextzy Technologies Co., Ltd.</h4> + <h4>&copy; 2017 Nextzy Technologies Co., Ltd.</h4> </Col> ) }
8edad59b55d162ee9429c2f04fca25689f42a023
src/js/index.jsx
src/js/index.jsx
/* global document, window */ /* eslint-disable no-unused-vars */ import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware, compose } from 'redux'; import reducer from './reducers/index'; import App from './components/App.jsx'; import initialState from './initialState'; import { stateToUrl } from './utils/uri'; /* eslint-ensable no-unused-vars */ require('./../scss/styles.scss'); const uriMiddleware = ({ getState }) => next => (action) => { const state = getState(); stateToUrl(state); next(action); }; /* eslint-disable no-underscore-dangle */ const store = createStore( reducer, initialState, compose( applyMiddleware(uriMiddleware), window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), ), ); /* eslint-enable */ ReactDOM.render( <Provider store={store}> <App /> </Provider> , document.getElementById('root'));
/* global document, window */ /* eslint-disable no-unused-vars */ import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware, compose } from 'redux'; import reducer from './reducers/index'; import App from './components/App.jsx'; import initialState from './initialState'; import { stateToUrl } from './utils/uri'; /* eslint-ensable no-unused-vars */ require('./../scss/styles.scss'); const uriMiddleware = ({ getState }) => next => (action) => { next(action); const state = getState(); stateToUrl(state); }; /* eslint-disable no-underscore-dangle */ const store = createStore( reducer, initialState, compose( applyMiddleware(uriMiddleware), window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), ), ); /* eslint-enable */ ReactDOM.render( <Provider store={store}> <App /> </Provider> , document.getElementById('root'));
Reorder middleware to fix 'lagged' uri
Reorder middleware to fix 'lagged' uri
JSX
mit
adamgiese/react-beat-map,adamgiese/react-beat-map
--- +++ @@ -13,9 +13,9 @@ require('./../scss/styles.scss'); const uriMiddleware = ({ getState }) => next => (action) => { + next(action); const state = getState(); stateToUrl(state); - next(action); };
ea0b0558042ff3b09f130c40a08538289a6c6d50
addons/viewport/src/manager.jsx
addons/viewport/src/manager.jsx
import React from 'react'; import addons from '@storybook/addons'; import { Panel } from './components/Panel'; const ADDON_ID = 'storybook-addon-viewport'; const PANEL_ID = `${ADDON_ID}/addon-panel`; function addChannel(api) { const channel = addons.getChannel(); addons.addPanel(PANEL_ID, { title: 'Viewport', render() { return <Panel channel={channel} api={api} />; }, }); } function init() { addons.register(ADDON_ID, addChannel); } export { init, addChannel };
import React from 'react'; import addons from '@storybook/addons'; import { Panel } from './components/Panel'; const ADDON_ID = 'storybook-addon-viewport'; const PANEL_ID = `${ADDON_ID}/addon-panel`; const addChannel = (api) => { const channel = addons.getChannel(); addons.addPanel(PANEL_ID, { title: 'Viewport', render() { return <Panel channel={channel} api={api} />; }, }); } const init = () => { addons.register(ADDON_ID, addChannel); } export { init, addChannel };
Move to arrow functions instead of named function declrations
Move to arrow functions instead of named function declrations
JSX
mit
rhalff/storybook,rhalff/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,rhalff/storybook,rhalff/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,kadirahq/react-storybook,rhalff/storybook,kadirahq/react-storybook,rhalff/storybook,storybooks/storybook
--- +++ @@ -6,7 +6,7 @@ const ADDON_ID = 'storybook-addon-viewport'; const PANEL_ID = `${ADDON_ID}/addon-panel`; -function addChannel(api) { +const addChannel = (api) => { const channel = addons.getChannel(); addons.addPanel(PANEL_ID, { @@ -17,7 +17,7 @@ }); } -function init() { +const init = () => { addons.register(ADDON_ID, addChannel); }
5f8705c8b35a85c3ef50bceaf1aa62e4e90a3225
client/components/app/Footer.jsx
client/components/app/Footer.jsx
import React, { Component } from 'react'; Footer = class Footer extends Component { render() { return ( <div className="ui basic small container segment center aligned"> <div className="ui three column grid"> <div className="dark-blue column"> Great Puzzle Hunt &copy; 2017 </div> <div className="column"> <a href="mailto:[email protected]">Account Questions</a> </div> <div className="column"> <a href="mailto:[email protected]">Event Questions</a> </div> </div> <br/> </div> ); } }
import { Meteor } from 'meteor/meteor'; import React, { Component } from 'react'; const { eventYear } = Meteor.settings.public; Footer = class Footer extends Component { render() { return ( <div className="ui basic small container segment center aligned"> <div className="ui three column grid"> <div className="dark-blue column"> Great Puzzle Hunt &copy; {eventYear} </div> <div className="column"> <a href="mailto:[email protected]">Account Questions</a> </div> <div className="column"> <a href="mailto:[email protected]">Event Questions</a> </div> </div> <br/> </div> ); } }
Update footer copyrgith to use eventYear
Update footer copyrgith to use eventYear
JSX
mit
kyle-rader/greatpuzzlehunt,kyle-rader/greatpuzzlehunt,kyle-rader/greatpuzzlehunt
--- +++ @@ -1,4 +1,7 @@ +import { Meteor } from 'meteor/meteor'; import React, { Component } from 'react'; + +const { eventYear } = Meteor.settings.public; Footer = class Footer extends Component { render() { @@ -6,7 +9,7 @@ <div className="ui basic small container segment center aligned"> <div className="ui three column grid"> <div className="dark-blue column"> - Great Puzzle Hunt &copy; 2017 + Great Puzzle Hunt &copy; {eventYear} </div> <div className="column"> <a href="mailto:[email protected]">Account Questions</a>
038ce93819655852c051e7ccf93e72abb3960b9b
src/pages/home.jsx
src/pages/home.jsx
import React from 'react'; import Header from '../components/header.jsx'; export default class Home extends React.Component { constructor(props) { super(props); this.onClickButton = this.onClickButton.bind(this); this.state = { name: props.name, counter: 0 }; } onClickButton () { this.setState({ counter: this.state.counter += 1 }); } render () { return ( <html> <head> <title>Example of isomorphic App in ES6.</title> </head> <body> <Header name={this.props.name} /> <main> <button onClick={this.onClickButton}>Click ME!!!</button> <span> {this.state.counter} Clicks</span> <p><noscript><strong>You don't have Javascript enabled in your browser</strong></noscript></p> </main> { React.DOM.script({dangerouslySetInnerHTML: { __html: 'var APP_PROPS = ' + JSON.stringify(this.state) + ';' }}) } <script src='./js/app.js'></script> </body> </html> ); } };
import React from 'react'; import Header from '../components/header.jsx'; export default class Home extends React.Component { constructor(props) { super(props); this.onClickButton = this.onClickButton.bind(this); this.state = { name: props.name, counter: 0 }; } onClickButton () { this.setState({ counter: this.state.counter += 1 }); } render () { return ( <html> <head> <title>Example of isomorphic App in ES6.</title> </head> <body> <Header name={this.props.name} /> <main> <button onClick={this.onClickButton}>Click ME!!!</button> <span> {this.state.counter} Clicks</span> <p><noscript><strong>You don't have Javascript enabled in your browser</strong></noscript></p> </main> <script dangerouslySetInnerHTML={{__html: 'var APP_PROPS = ' + JSON.stringify(this.state) + ';'}} /> <script src='./js/app.js' /> </body> </html> ); } };
Change script to JSX notation
Change script to JSX notation
JSX
mit
Juan1ll0/es6-react-server-side-render,Juan1ll0/es6-react-server-side-render
--- +++ @@ -30,12 +30,8 @@ <span> {this.state.counter} Clicks</span> <p><noscript><strong>You don't have Javascript enabled in your browser</strong></noscript></p> </main> - { - React.DOM.script({dangerouslySetInnerHTML: { - __html: 'var APP_PROPS = ' + JSON.stringify(this.state) + ';' - }}) - } - <script src='./js/app.js'></script> + <script dangerouslySetInnerHTML={{__html: 'var APP_PROPS = ' + JSON.stringify(this.state) + ';'}} /> + <script src='./js/app.js' /> </body> </html> );
f3b224f07beb177bde4ecd8dd7dd19a723087c19
src/components/ProjectDetail.jsx
src/components/ProjectDetail.jsx
import React from 'react'; import { useParams } from 'react-router-dom'; import projects from 'projects'; import style from './ProjectDetail.scss'; import bulma from 'bulma.scss'; const ProjectDetail = () => { const { projectId } = useParams(); const project = projects.find(project => project.slug == projectId); return ( <div> <h1 className={style.title}>{project.title}</h1> <p className={style.subtitle}>{project.subtitle}</p> <img className={style.masthead} src={project.thumbnail} alt="" /> <section className={style.description}> {project.description} </section> </div> ); }; export default ProjectDetail;
import React from 'react'; import { Link, useParams } from 'react-router-dom'; import HorizontalList from './HorizontalList'; import projects from 'projects'; import style from './ProjectDetail.scss'; const getProjectLink = (index, text) => { const project = projects[index]; if (project) { return <Link to={`/projects/${project.slug}`}>{text}</Link>; } else { return <span>{text}</span>; } }; const ProjectDetail = () => { const { projectId } = useParams(); const project = projects.find(project => project.slug == projectId); const index = projects.indexOf(project); return ( <div> <h1 className={style.title}>{project.title}</h1> <p className={style.subtitle}>{project.subtitle}</p> <img className={style.masthead} src={project.thumbnail} alt="" /> <section className={style.description}> {project.description} </section> <HorizontalList isCentered> {getProjectLink(index-1, '< Prev')} <Link to="/">Home</Link> {getProjectLink(index+1, 'Next >')} </HorizontalList> </div> ); }; export default ProjectDetail;
Add prev/next links on project details
Add prev/next links on project details
JSX
mit
vocksel/my-website,VoxelDavid/voxeldavid-website,vocksel/my-website,VoxelDavid/voxeldavid-website
--- +++ @@ -1,13 +1,23 @@ import React from 'react'; -import { useParams } from 'react-router-dom'; +import { Link, useParams } from 'react-router-dom'; +import HorizontalList from './HorizontalList'; import projects from 'projects'; import style from './ProjectDetail.scss'; -import bulma from 'bulma.scss'; + +const getProjectLink = (index, text) => { + const project = projects[index]; + if (project) { + return <Link to={`/projects/${project.slug}`}>{text}</Link>; + } else { + return <span>{text}</span>; + } +}; const ProjectDetail = () => { const { projectId } = useParams(); const project = projects.find(project => project.slug == projectId); + const index = projects.indexOf(project); return ( <div> @@ -19,6 +29,12 @@ <section className={style.description}> {project.description} </section> + + <HorizontalList isCentered> + {getProjectLink(index-1, '< Prev')} + <Link to="/">Home</Link> + {getProjectLink(index+1, 'Next >')} + </HorizontalList> </div> ); };
f7112d2d5776656a5dcee2b4452514761320a96a
app/AmountSpent.jsx
app/AmountSpent.jsx
import React, { Component, PropTypes } from 'react'; class AmountSpent extends Component { static propTypes = { amountEarned: PropTypes.number, amountSpent: PropTypes.number }; render() { const { amountEarned, amountSpent } = this.props; return ( <div> <p>Total amount spent: ${amountSpent}</p> <p>Total amount earned: ${amountEarned}</p> <p>Balance: ${amountSpent - amountEarned}</p> </div> ); } } export default AmountSpent;
import React, { Component, PropTypes } from 'react'; class AmountSpent extends Component { static propTypes = { amountEarned: PropTypes.number, amountSpent: PropTypes.number }; render() { const { amountEarned, amountSpent } = this.props; const balance = amountEarned - amountSpent; return ( <div> <p>Total amount spent: ${amountSpent}</p> <p>Total amount earned: ${amountEarned}</p> <p>Balance: {balance < 0 ? '-' : ''}${balance < 0 ? -balance : balance}</p> </div> ); } } export default AmountSpent;
Fix Balance amount calculation logic
Fix Balance amount calculation logic
JSX
mit
kwonghow/toto-app,kwonghow/toto-app
--- +++ @@ -9,11 +9,13 @@ render() { const { amountEarned, amountSpent } = this.props; + const balance = amountEarned - amountSpent; + return ( <div> <p>Total amount spent: ${amountSpent}</p> <p>Total amount earned: ${amountEarned}</p> - <p>Balance: ${amountSpent - amountEarned}</p> + <p>Balance: {balance < 0 ? '-' : ''}${balance < 0 ? -balance : balance}</p> </div> ); }
249b4bce303c53438d5a0fe6c4907072bcef75fa
app/pages/Articles/ArticlePage.jsx
app/pages/Articles/ArticlePage.jsx
var React = require('react'); var Immstruct = require('immstruct'); var ArticleComponent = require('../../components/articles/Article'); var { GetStores } = require('flux/bootstrap'); var ArticlePage = React.createClass({ displayName: 'ArticlePage', statics: { getAsyncProps: (params) => GetStores(params, ['article']) }, getInitialState: () => ({ version: 0 }), componentWillReceiveProps(nextProps) { if (nextProps.article) { this.structure = Immstruct({ article: nextProps.article[0].data }); this.structure.on('next-animation-frame', () => { this.setState({ version: ++this.state.version }); }); } }, render() { if (!this.structure) return <span />; return ArticleComponent(`Article-${article.get('id')}`, this.structure.cursor()); } }); module.exports = ArticlePage;
var React = require('react'); var Immstruct = require('immstruct'); var ArticleComponent = require('../../components/articles/Article'); var { GetStores } = require('flux/bootstrap'); var ArticlePage = React.createClass({ displayName: 'ArticlePage', statics: { getAsyncProps: (params) => GetStores(params, ['article']) }, getInitialState: () => ({ version: 0 }), componentWillReceiveProps(nextProps) { if (nextProps.article) { this.structure = Immstruct({ article: nextProps.article[0].data }); this.structure.on('next-animation-frame', () => { this.setState({ version: ++this.state.version }); }); } }, render() { if (!this.structure) return <span />; var cursor = this.structure.cursor(); return ArticleComponent(`Article-${cursor.get('article', 'id')}`, cursor); } }); module.exports = ArticlePage;
Fix new bug on articlePage
Fix new bug on articlePage
JSX
mit
reapp/reapp-ui,oToUC/reapp-ui,srounce/reapp-ui,zackp30/reapp-ui,Lupino/reapp-ui,jhopper28/reapp-ui,zenlambda/reapp-ui
--- +++ @@ -23,7 +23,8 @@ render() { if (!this.structure) return <span />; - return ArticleComponent(`Article-${article.get('id')}`, this.structure.cursor()); + var cursor = this.structure.cursor(); + return ArticleComponent(`Article-${cursor.get('article', 'id')}`, cursor); } });
753405a619b3166696ff0cc1189b46eb51a1a320
src/sentry/static/sentry/app/views/routeNotFound.jsx
src/sentry/static/sentry/app/views/routeNotFound.jsx
import React from "react"; import DocumentTitle from "react-document-title"; import Footer from "../components/footer"; import Header from "../components/header"; var RouteNotFound = React.createClass({ statics: { // Try and append a trailing slash to the route when we "404". // // Reference: // https://github.com/rackt/react-router/blob/0.13.x/examples/auth-flow/app.js#L46-L50 willTransitionTo(transition) { let path = transition.path; if (path.charAt(path.length-1) !== '/') { transition.redirect(path + '/'); } } }, getTitle() { return 'Page Not Found'; }, render() { // TODO(dcramer): show additional resource links return ( <DocumentTitle title={this.getTitle()}> <div className="app"> <Header /> <div className="container"> <div className="content"> <section className="body"> <div className="page-header"> <h2>Page Not Found</h2> </div> <p className="alert-message notice">The page you are looking for was not found.</p> </section> </div> </div> <Footer /> </div> </DocumentTitle> ); } }); export default RouteNotFound;
import React from "react"; import DocumentTitle from "react-document-title"; import Footer from "../components/footer"; import Header from "../components/header"; var RouteNotFound = React.createClass({ statics: { // Try and append a trailing slash to the route when we "404". // // Reference: // https://github.com/rackt/react-router/blob/0.13.x/examples/auth-flow/app.js#L46-L50 // // NOTE: This behavior changes in react-router 1.0: // https://github.com/rackt/react-router/blob/v1.0.0-rc1/UPGRADE_GUIDE.md#willtransitionto-and-willtransitionfrom willTransitionTo(transition) { let path = transition.path; if (path.charAt(path.length - 1) !== '/') { transition.redirect(path + '/'); } } }, getTitle() { return 'Page Not Found'; }, render() { // TODO(dcramer): show additional resource links return ( <DocumentTitle title={this.getTitle()}> <div className="app"> <Header /> <div className="container"> <div className="content"> <section className="body"> <div className="page-header"> <h2>Page Not Found</h2> </div> <p className="alert-message notice">The page you are looking for was not found.</p> </section> </div> </div> <Footer /> </div> </DocumentTitle> ); } }); export default RouteNotFound;
Add note for this behavior changing in react-router 1.0
Add note for this behavior changing in react-router 1.0
JSX
bsd-3-clause
BuildingLink/sentry,looker/sentry,alexm92/sentry,nicholasserra/sentry,JamesMura/sentry,ifduyue/sentry,JackDanger/sentry,mvaled/sentry,jean/sentry,jean/sentry,daevaorn/sentry,ifduyue/sentry,JackDanger/sentry,mitsuhiko/sentry,zenefits/sentry,zenefits/sentry,zenefits/sentry,JamesMura/sentry,JackDanger/sentry,BayanGroup/sentry,nicholasserra/sentry,mvaled/sentry,imankulov/sentry,fotinakis/sentry,beeftornado/sentry,daevaorn/sentry,looker/sentry,looker/sentry,fotinakis/sentry,mvaled/sentry,BuildingLink/sentry,alexm92/sentry,jean/sentry,BuildingLink/sentry,JamesMura/sentry,jean/sentry,looker/sentry,zenefits/sentry,zenefits/sentry,gencer/sentry,mvaled/sentry,daevaorn/sentry,gencer/sentry,alexm92/sentry,JamesMura/sentry,looker/sentry,JamesMura/sentry,ifduyue/sentry,ifduyue/sentry,daevaorn/sentry,jean/sentry,mitsuhiko/sentry,nicholasserra/sentry,beeftornado/sentry,BayanGroup/sentry,mvaled/sentry,BuildingLink/sentry,gencer/sentry,beeftornado/sentry,imankulov/sentry,imankulov/sentry,mvaled/sentry,BayanGroup/sentry,BuildingLink/sentry,gencer/sentry,fotinakis/sentry,fotinakis/sentry,gencer/sentry,ifduyue/sentry
--- +++ @@ -9,9 +9,12 @@ // // Reference: // https://github.com/rackt/react-router/blob/0.13.x/examples/auth-flow/app.js#L46-L50 + // + // NOTE: This behavior changes in react-router 1.0: + // https://github.com/rackt/react-router/blob/v1.0.0-rc1/UPGRADE_GUIDE.md#willtransitionto-and-willtransitionfrom willTransitionTo(transition) { let path = transition.path; - if (path.charAt(path.length-1) !== '/') { + if (path.charAt(path.length - 1) !== '/') { transition.redirect(path + '/'); } }
3771edabf091a5149cce3d983c951c698296fb68
app/scripts/components/router.jsx
app/scripts/components/router.jsx
"use strict"; var React = require('react'); var Router = require('react-router'); var Route = Router.Route; var Routes = Router.Routes; var DefaultRoute = Router.DefaultRoute; var NotFoundRoute = Router.NotFoundRoute; var NotFound = require('./not-found/not-found.jsx'); var Payments = require('../modules/payments/components/payments.jsx'); var LoginForm = require('../modules/session/components/login-form.jsx'); var Session = require('../modules/session/components/session.jsx'); // needed for dev tools to work window.React = React; var App = require('./app.jsx'); var routes = ( <Routes> <Route name="app" path="/" handler={App}> <DefaultRoute handler={Payments} /> <Route name="login" handler={Session} /> <Route name="logout" handler={Session} /> <Route name="payments" handler={Payments}> <Route name="incoming" path="incoming" handler={Payments} /> <Route name="outgoing" path="outgoing" handler={Payments} /> <Route name="completed" path="completed" handler={Payments} /> <Route name="failed" path="failed" handler={Payments} /> <Route name="new" path="new" handler={Payments} /> </Route> <Route name="notFound" handler={NotFound} /> <NotFoundRoute handler={NotFound} /> </Route> </Routes> ); module.exports = routes;
"use strict"; var React = require('react'); var Router = require('react-router'); var Route = Router.Route; var Routes = Router.Routes; var DefaultRoute = Router.DefaultRoute; var NotFoundRoute = Router.NotFoundRoute; var NotFound = require('./not-found/not-found.jsx'); var Payments = require('../modules/payments/components/payments.jsx'); var LoginForm = require('../modules/session/components/login-form.jsx'); var Session = require('../modules/session/components/session.jsx'); // needed for dev tools to work window.React = React; var App = require('./app.jsx'); var routes = ( <Routes> <Route name="app" path="/" handler={App}> <DefaultRoute handler={Payments} path="payments/outgoing" /> <Route name="login" handler={Session} /> <Route name="logout" handler={Session} /> <Route name="payments" handler={Payments}> <Route name="incoming" path="incoming" handler={Payments} /> <Route name="outgoing" path="outgoing" handler={Payments} /> <Route name="completed" path="completed" handler={Payments} /> <Route name="failed" path="failed" handler={Payments} /> <Route name="new" path="new" handler={Payments} /> </Route> <Route name="notFound" handler={NotFound} /> <NotFoundRoute handler={NotFound} /> </Route> </Routes> ); module.exports = routes;
Set default route to /payments/outgoing
[TASK] Set default route to /payments/outgoing
JSX
isc
dabibbit/dream-stack-seed,dabibbit/dream-stack-seed
--- +++ @@ -21,7 +21,7 @@ var routes = ( <Routes> <Route name="app" path="/" handler={App}> - <DefaultRoute handler={Payments} /> + <DefaultRoute handler={Payments} path="payments/outgoing" /> <Route name="login" handler={Session} /> <Route name="logout" handler={Session} /> <Route name="payments" handler={Payments}>
02da4cebd2a63cf81d203c2dd99a5f3ffcf95af6
web-server/app/assets/javascripts/components/filters/filters-page-component.jsx
web-server/app/assets/javascripts/components/filters/filters-page-component.jsx
define(function(require) { var React = require('react'), SearchBar = require('../search-bar'), FiltersComponent = require('./filters-component'), FiltersStore = require('../../stores/filters'), FiltersHeader = require('./filters-header-component'); var FiltersPageComponent = React.createClass({ render: function() { return ( <div> <FiltersHeader/> <SearchBar label="Search filters by regex" event="search-filters"/> <FiltersComponent Store={FiltersStore}/> </div> );} }); return FiltersPageComponent; });
define(function(require) { var React = require('react'), SearchBar = require('../search-bar'), FiltersComponent = require('./filters-component'), FiltersStore = require('../../stores/filters'), FiltersHeader = require('./filters-header-component'); var FiltersPageComponent = React.createClass({ render: function() { return ( <div> <FiltersHeader/> <SearchBar label="Filter" event="search-filters"/> <FiltersComponent Store={FiltersStore}/> </div> );} }); return FiltersPageComponent; });
Fix search box label for filter page
Fix search box label for filter page
JSX
mpl-2.0
PDXostc/rvi_sota_server,PDXostc/rvi_sota_server,PDXostc/rvi_sota_server
--- +++ @@ -11,7 +11,7 @@ return ( <div> <FiltersHeader/> - <SearchBar label="Search filters by regex" event="search-filters"/> + <SearchBar label="Filter" event="search-filters"/> <FiltersComponent Store={FiltersStore}/> </div> );}
20314f682c7e918d20b631760daea4bdeb8b9b3e
js/pages/UserApp.react.jsx
js/pages/UserApp.react.jsx
'use strict'; var React = require('react'); var {PropTypes} = React; var {Grid,Row,Col} = require('react-bootstrap'); var Header = require('../components/Header.react'); var UserApp = React.createClass({ propTypes: { children: PropTypes.node, session: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]), user: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]) }, render: function() { var menu= [ {href: '#/exercises', text: 'Exercises'}, {href: '#/editor', text: 'Editor'} ]; return ( <div className='container'> <Grid> <Row> <Col lg={12}> <Header title='JavaTDL' menu={menu} auth={this.props.user.auth} session={this.props.session} /> </Col> </Row> <Row> <Col lg={12}> {this.props.children} </Col> </Row> </Grid> </div> ); } }); module.exports = UserApp;
'use strict'; var React = require('react'); var {PropTypes} = React; var {Grid,Row,Col} = require('react-bootstrap'); var Header = require('../components/Header.react'); var NotificationView = require('../components/NotificationView.react'); var UserApp = React.createClass({ propTypes: { children: PropTypes.node, session: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]), user: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]) }, render: function() { var menu= [ {href: '#/exercises', text: 'Exercises'}, {href: '#/editor', text: 'Editor'} ]; return ( <div className='container'> <Grid> <Row> <Col lg={12}> <Header title='JavaTDL' menu={menu} auth={this.props.user.auth} session={this.props.session} /> </Col> </Row> <Row> <Col lg={12}><NotificationView /></Col> </Row> <Row> <Col lg={12}> {this.props.children} </Col> </Row> </Grid> </div> ); } }); module.exports = UserApp;
Add notification view to UserApp
Add notification view to UserApp
JSX
mit
mapster/tdl-frontend
--- +++ @@ -5,6 +5,7 @@ var {Grid,Row,Col} = require('react-bootstrap'); var Header = require('../components/Header.react'); +var NotificationView = require('../components/NotificationView.react'); var UserApp = React.createClass({ propTypes: { @@ -26,6 +27,9 @@ </Col> </Row> <Row> + <Col lg={12}><NotificationView /></Col> + </Row> + <Row> <Col lg={12}> {this.props.children} </Col>
bd972ecc2e5fd9fe70c436f5cc5b23e29222a218
src/request/components/request-entry-item-view.jsx
src/request/components/request-entry-item-view.jsx
var React = require('react'); module.exports = React.createClass({ render: function() { var entry = this.props.entry; return ( <div className="request-entry-item-holder"> <table className="table table-bordered"> <tr> <td rowSpan="2">{entry.duration}ms</td> <td colSpan="7"> {entry.uri} &nbsp; {entry.method} &nbsp; {entry.statusCode} ({entry.statusText}) - {entry.contentType} </td> </tr> <tr> <td>{entry.summary.networkTime}ms</td> <td>{entry.summary.serverTime}ms</td> <td>{entry.summary.clientTime}ms</td> <td>{entry.summary.controller}.{entry.action}(...)</td> <td>{entry.summary.actionTime}ms</td> <td>{entry.summary.viewTime}ms</td> <td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td> </tr> </table> </div> ); } });
var React = require('react'); module.exports = React.createClass({ render: function() { var entry = this.props.entry; return ( <div className="request-entry-item-holder"> <table className="table table-bordered"> <tr> <td rowSpan="2">{entry.duration}ms</td> <td colSpan="7"> {entry.uri} &nbsp; {entry.method} &nbsp; {entry.statusCode} ({entry.statusText}) - {entry.contentType} </td> </tr> <tr> <td>{entry.summary.networkTime}ms</td> <td>{entry.summary.serverTime}ms</td> <td>{entry.summary.clientTime}ms</td> <td>{entry.summary.controller}.{entry.summary.action}(...)</td> <td>{entry.summary.actionTime}ms</td> <td>{entry.summary.viewTime}ms</td> <td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td> </tr> </table> </div> ); } });
Fix property that was missed in refactoring request to use summary
Fix property that was missed in refactoring request to use summary
JSX
unknown
Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype
--- +++ @@ -16,7 +16,7 @@ <td>{entry.summary.networkTime}ms</td> <td>{entry.summary.serverTime}ms</td> <td>{entry.summary.clientTime}ms</td> - <td>{entry.summary.controller}.{entry.action}(...)</td> + <td>{entry.summary.controller}.{entry.summary.action}(...)</td> <td>{entry.summary.actionTime}ms</td> <td>{entry.summary.viewTime}ms</td> <td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td>
2e5fac1b087d8c069b759743e9348aba5e2854d5
src/client/components/MyInvestmentProjects/InvestmentList.jsx
src/client/components/MyInvestmentProjects/InvestmentList.jsx
import React from 'react' import PropTypes from 'prop-types' import styled from 'styled-components' import { SPACING } from '@govuk-react/constants' import { GREY_1 } from 'govuk-colours' import InvestmentListItem from './InvestmentListItem' const StyledOrderedList = styled('ol')` margin-top: ${SPACING.SCALE_3}; ${({ isPaginated }) => isPaginated && `border-bottom: 2px solid ${GREY_1};`} ` const InvestmentList = ({ items, isPaginated, showDetails }) => ( <StyledOrderedList isPaginated={isPaginated}> {items.map((item) => ( <InvestmentListItem key={item.id} showDetails={showDetails} {...item} /> ))} </StyledOrderedList> ) InvestmentList.propTypes = { items: PropTypes.array.isRequired, } export default InvestmentList
import React from 'react' import PropTypes from 'prop-types' import styled from 'styled-components' import { SPACING } from '@govuk-react/constants' import { GREY_1 } from 'govuk-colours' import InvestmentListItem from './InvestmentListItem' const StyledOrderedList = styled('ol')` margin-top: ${SPACING.SCALE_3}; border-top: 2px solid ${GREY_1}; ${({ isPaginated }) => isPaginated && `border-bottom: 2px solid ${GREY_1};`} ` const InvestmentList = ({ items, isPaginated, showDetails }) => ( <StyledOrderedList isPaginated={isPaginated}> {items.map((item) => ( <InvestmentListItem key={item.id} showDetails={showDetails} {...item} /> ))} </StyledOrderedList> ) InvestmentList.propTypes = { items: PropTypes.array.isRequired, } export default InvestmentList
Change 'Add horizontal line to investment projects list
Change 'Add horizontal line to investment projects list
JSX
mit
uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend
--- +++ @@ -8,6 +8,7 @@ const StyledOrderedList = styled('ol')` margin-top: ${SPACING.SCALE_3}; + border-top: 2px solid ${GREY_1}; ${({ isPaginated }) => isPaginated && `border-bottom: 2px solid ${GREY_1};`} `
14d9949a1bf5900e5e951c5d8889b96cfd53aca9
app/classifier/tasks/drawing/components/DrawingToolInputIcon/DrawingToolInputIcon.jsx
app/classifier/tasks/drawing/components/DrawingToolInputIcon/DrawingToolInputIcon.jsx
import React from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; import icons from '../../icons'; export const StyledDrawingToolInputIcon = styled.span` color: ${props => props.color}; margin-right: 1ch; > svg { fill-opacity: 0.1; height: 1.5em; stroke: currentColor; stroke-width: 5; vertical-align: bottom; width: 1.5em; } `; export default function DrawingToolInputIcon(props) { return ( <StyledDrawingToolInputIcon color={props.tool.color}>{icons[props.tool.type]}</StyledDrawingToolInputIcon> ); } DrawingToolInputIcon.defaultProps = { tool: { color: '', type: '' } }; DrawingToolInputIcon.propTypes = { tool: PropTypes.shape({ color: PropTypes.string, type: PropTypes.string }) };
import React from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; import icons from '../../icons'; export const StyledDrawingToolInputIcon = styled.span` color: ${props => props.color}; &::after { content: " "; margin-right: 1ch; white-space: pre; } > svg { fill-opacity: 0.1; height: 1.5em; stroke: currentColor; stroke-width: 5; vertical-align: bottom; width: 1.5em; } `; export default function DrawingToolInputIcon(props) { return ( <StyledDrawingToolInputIcon color={props.tool.color}>{icons[props.tool.type]}</StyledDrawingToolInputIcon> ); } DrawingToolInputIcon.defaultProps = { tool: { color: '', type: '' } }; DrawingToolInputIcon.propTypes = { tool: PropTypes.shape({ color: PropTypes.string, type: PropTypes.string }) };
Fix drawing tool icon spacing Use ::after rather than margin-right for spacing.
Fix drawing tool icon spacing Use ::after rather than margin-right for spacing.
JSX
apache-2.0
zooniverse/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,amyrebecca/Panoptes-Front-End
--- +++ @@ -6,7 +6,12 @@ export const StyledDrawingToolInputIcon = styled.span` color: ${props => props.color}; - margin-right: 1ch; + + &::after { + content: " "; + margin-right: 1ch; + white-space: pre; + } > svg { fill-opacity: 0.1;
69b85478cba68b76cea88a8c9120245e908b7719
src/Badge.jsx
src/Badge.jsx
import React from 'react'; import classNames from 'classnames'; import { Badge as BsBadge } from 'react-bootstrap'; const propTypes = { background: React.PropTypes.oneOf(['light-blue', 'red', 'green', 'yellow']), className: React.PropTypes.string, children: React.PropTypes.node, }; const Badge = ({ background, className, children, }) => { const classes = { badge: true, }; classes[`bg-${background}`] = true; return ( <BsBadge bsClass={classNames(className, classes)}>{children}</BsBadge> ); }; Badge.propTypes = propTypes; export default Badge;
import React from 'react'; import classNames from 'classnames'; import { Badge as BsBadge } from 'react-bootstrap'; const propTypes = { background: React.PropTypes.oneOf(['light-blue', 'red', 'green', 'yellow']), className: React.PropTypes.string, children: React.PropTypes.node, }; const Badge = ({ background, className, children, }) => { const classes = { badge: true, }; if (background) { classes[`bg-${background}`] = true; } return ( <BsBadge bsClass={classNames(className, classes)}>{children}</BsBadge> ); }; Badge.propTypes = propTypes; export default Badge;
Remove assumption that background is supplied
Remove assumption that background is supplied
JSX
mit
jonmpqts/reactjs-admin-lte,react-admin-lte/react-admin-lte,react-admin-lte/react-admin-lte
--- +++ @@ -16,7 +16,10 @@ const classes = { badge: true, }; - classes[`bg-${background}`] = true; + + if (background) { + classes[`bg-${background}`] = true; + } return ( <BsBadge bsClass={classNames(className, classes)}>{children}</BsBadge>
031530cabcb70412992589f98abc4b1e251e6a1e
src/components/Big2App.jsx
src/components/Big2App.jsx
import React from 'react'; import { connect } from 'react-redux'; import * as a from './../actions'; const mapStateToProps = state => ({ username: state.username, }); const mapDispatchToProps = dispatch => ({ changeUsername: newUsername => dispatch(a.changeUsername(newUsername)), }); class Big2App extends React.Component { constructor(props) { super(props); this.state = { username: props.username, changeUsername: props.changeUsername, }; } render() { return ( <h2>Hi {this.state.username}</h2> ); } } Big2App.propTypes = { username: React.PropTypes.String, changeUsername: React.PropTypes.Func, }; const Big2AppContainer = connect( mapStateToProps, mapDispatchToProps )(Big2App); export default Big2AppContainer;
import React from 'react'; import { connect } from 'react-redux'; import * as a from './../actions'; const mapStateToProps = state => ({ username: state.username, }); const mapDispatchToProps = dispatch => ({ changeUsername: newUsername => dispatch(a.changeUsername(newUsername)), }); class Big2App extends React.Component { constructor(props) { super(props); this.state = { username: props.username, changeUsername: props.changeUsername, }; } render() { return ( <h2>Hi {this.state.username}</h2> ); } } Big2App.propTypes = { username: React.PropTypes.string, changeUsername: React.PropTypes.func, }; const Big2AppContainer = connect( mapStateToProps, mapDispatchToProps )(Big2App); export default Big2AppContainer;
Fix PropTypes to have lower case values for typeof portion
Fix PropTypes to have lower case values for typeof portion
JSX
mit
jon-is-learning/big2,jon-is-learning/big2
--- +++ @@ -27,8 +27,8 @@ } Big2App.propTypes = { - username: React.PropTypes.String, - changeUsername: React.PropTypes.Func, + username: React.PropTypes.string, + changeUsername: React.PropTypes.func, }; const Big2AppContainer = connect(
3bede4754f37495ca183e44619f56fba7c280574
src/App.jsx
src/App.jsx
import React from 'react'; const App = React.createClass({ render: function() { return ( <h1>Hello React :)</h1> ); } }); export default App;
import React, {Component} from 'react'; class App extends Component { render() { return ( <h1>Hello React :)</h1> ); } } export default App;
Switch back to class based component definition.
Switch back to class based component definition. Our tutorial asks students to go from this to createClass
JSX
mit
ehdwn1212/personalWebsite2,reinhardtcgr/ChattyApp,nghuman/now-playing-challenge,davidbpaul/LHL-Final-GetGO-web,KyleFlemington/CHATi,takng/REACT-STOCK,Waundr/Waundr.github.io,ChrisBotCodes/chatty-app,claytonschroeder/energy_portfolio_builder,patriciomase/react-m-f-carousel,MichaelMansourati/colourscape-react,laurmuresan/React,csawala/kitayama,pineapplemidi/pw-survey,ivallee/lhl-final-project,Waundr/Waundr.github.io,jenreiher/slug-journal,EshaRoda/Drone-Controller,leanneherrndorf/hCORE,latagore/latagore.github.io,NahimNasser/ethwaterloo2017,collinstommy/fcc-recipe-box,sammytam0430/Queue-Cue-react,NahimNasser/ethwaterloo2017,Justinette2175/morning-app-react,nghuman/now-playing-challenge,promilo/Waundr,promilo/Waundr,ehdwn1212/personalWebsite2,ddandipu/chattyapp,bhavc/blockChange,KyleFlemington/CHATi,sammytam0430/Queue-Cue-react,patriciomase/react-m-f-carousel,SebaRev1989/react-examples,EshaRoda/Drone-Controller,Waundr/Waundr.github.io,laijoann/Chattr,SebaRev1989/react-examples,noahlotzer/react-simple-boilerplate,tedyangx/healthchoice,promilo/Waundr,Chasteau/chatty-app,jenreiher/slug-journal,pineapplemidi/pw-survey,latagore/latagore.github.io,jzhang729/chatty,leanneherrndorf/hCORE,davidbpaul/LHL-Final-GetGO-web,reinhardtcgr/ChattyApp,pineapplemidi/pw-survey,Waundr/Waundr.github.io,ivallee/lhl-final-project,collinstommy/fcc-recipe-box,nolotz/react-simple-boilerplate,bhavc/blockChange,Chasteau/chatty-app,mackybeltran/chatty,noahlotzer/react-simple-boilerplate,ChrisBotCodes/chatty-app,promilo/Waundr,escape-velocity/Chatty_App,shinmike/scortch,csawala/kitayama,promilo/Waundr,ddandipu/chattyapp,jzhang729/chatty,martinnajle1/react-tetris,leanneherrndorf/hCORE,MichaelMansourati/colourscape-react,Waundr/Waundr.github.io,jhenderiks/lhl-chatty,soumithr/react-simple-boilerplate2,tedyangx/healthchoice,Justinette2175/morning-app-react,shinmike/scortch,escape-velocity/Chatty_App,jhenderiks/lhl-chatty,laurmuresan/React,laijoann/Chattr,takng/REACT-STOCK,nolotz/react-simple-boilerplate,claytonschroeder/energy_portfolio_builder,mackybeltran/chatty,bchuup/lhl-final-trip-me-up,soumithr/react-simple-boilerplate2,bchuup/lhl-final-trip-me-up,martinnajle1/react-tetris
--- +++ @@ -1,10 +1,10 @@ -import React from 'react'; +import React, {Component} from 'react'; -const App = React.createClass({ - render: function() { +class App extends Component { + render() { return ( <h1>Hello React :)</h1> ); } -}); +} export default App;
7f3b0c2acec3224786e58a9ebb3b124e3d2cac0c
src/components/Navigation.jsx
src/components/Navigation.jsx
// react import React from 'react'; import ReactRouter from 'react-router'; class Navigation extends React.Component { render() { return ( <div className="navbar navbar-default navbar-fixed-top" role="navigation"> <div className="container"> <div className="navbar-header"> <button type="button" className="navbar-toggle"> <span className="sr-only">Menu</span> <span className="icon-bar"></span> <span className="icon-bar"></span> <span className="icon-bar"></span> </button> <ReactRouter.Link to="/" className="navbar-brand">Primal Multiplication</ReactRouter.Link> </div> <div className="collapse navbar-collapse"> <ul className="nav navbar-nav"> <li><ReactRouter.Link to="/">Home</ReactRouter.Link></li> <li><ReactRouter.Link to="/about">About</ReactRouter.Link></li> </ul> </div> </div> </div> ); } } export default Navigation;
// react import React from 'react'; import ReactRouter from 'react-router'; class Navigation extends React.Component { constructor(props) { super(props); this.state = { navCollapse: 'collapse' }; } toggleCollapse() { const navCollapse = this.state.navCollapse ? '' : 'collapse'; this.setState({ navCollapse }); } render() { return ( <div className="navbar navbar-default navbar-fixed-top" role="navigation"> <div className="container"> <div className="navbar-header"> <button type="button" className="navbar-toggle" onClick={this.toggleCollapse.bind(this)}> <span className="sr-only">Menu</span> <span className="icon-bar"></span> <span className="icon-bar"></span> <span className="icon-bar"></span> </button> <ReactRouter.Link to="/" className="navbar-brand">Primal Multiplication</ReactRouter.Link> </div> <div className={this.state.navCollapse + ' navbar-collapse'}> <ul className="nav navbar-nav"> <li><ReactRouter.Link to="/">Home</ReactRouter.Link></li> <li><ReactRouter.Link to="/about">About</ReactRouter.Link></li> </ul> </div> </div> </div> ); } } export default Navigation;
Implement navbar show/hide (narrow widths)
:iphone: Implement navbar show/hide (narrow widths) Makes .navbar-toggle functional
JSX
cc0-1.0
acusti/primal-multiplication,acusti/primal-multiplication
--- +++ @@ -3,12 +3,24 @@ import ReactRouter from 'react-router'; class Navigation extends React.Component { + constructor(props) { + super(props); + this.state = { + navCollapse: 'collapse' + }; + } + + toggleCollapse() { + const navCollapse = this.state.navCollapse ? '' : 'collapse'; + this.setState({ navCollapse }); + } + render() { return ( <div className="navbar navbar-default navbar-fixed-top" role="navigation"> <div className="container"> <div className="navbar-header"> - <button type="button" className="navbar-toggle"> + <button type="button" className="navbar-toggle" onClick={this.toggleCollapse.bind(this)}> <span className="sr-only">Menu</span> <span className="icon-bar"></span> <span className="icon-bar"></span> @@ -17,7 +29,7 @@ <ReactRouter.Link to="/" className="navbar-brand">Primal Multiplication</ReactRouter.Link> </div> - <div className="collapse navbar-collapse"> + <div className={this.state.navCollapse + ' navbar-collapse'}> <ul className="nav navbar-nav"> <li><ReactRouter.Link to="/">Home</ReactRouter.Link></li> <li><ReactRouter.Link to="/about">About</ReactRouter.Link></li>
8378cdc990639675a98c224a1b8907948746c51b
frontend/realtime_client/realtime_client.jsx
frontend/realtime_client/realtime_client.jsx
const io = require('socket.io-client'), config = require('./config.js'); const UnichatClient = { _realtimeUrl: null, _socket: null, _clientId: null, _roomId: 'room1', _canSendMessages: false, init(realtimeUrl) { this._realtimeUrl = realtimeUrl; this._socket = io.connect(this._realtimeUrl, {'forceNew': true}); this._socket.on('connect', () => { console.log('Connected'); this._socket.emit('client-hello'); }); this._socket.on('server-hello', (client_id) => { this._clientId = client_id; console.log('Active, my id is ' + client_id + ', joining room ' + this._roomId); this._socket.emit('join-room', { roomId: this._roomId }); this._canSendMessages = true; }); this._socket.on('message', (message) => { console.log('Received message:'); console.log('\t' + message); }); this._socket.on('disconnect', () => { console.log('Realtime disconnected'); this._canSendMessages = false; }); } }; UnichatClient.init(config.REALTIME_URL);
const io = require('socket.io-client'), config = require('./config.js'); const UnichatClient = { _realtimeUrl: null, _socket: null, _clientId: null, _roomId: 'room1', _canSendMessages: false, init(realtimeUrl) { this._realtimeUrl = realtimeUrl; this._socket = io.connect(this._realtimeUrl, {'forceNew': true}); this._socket.on('connect', () => { console.log('Connected'); this._socket.emit('client-hello'); }); this._socket.on('server-hello', (client_id) => { this._clientId = client_id; console.log('Active, my id is ' + client_id + ', joining room ' + this._roomId); this._socket.emit('join-room', { roomId: this._roomId }); this._canSendMessages = true; this.send_message(); }); this._socket.on('message', (message) => { console.log('Received message:'); console.log('\t' + message); }); this._socket.on('disconnect', () => { console.log('Realtime disconnected'); this._canSendMessages = false; }); }, send_message() { console.log('Can send messages? ' + this._canSendMessages); let message = 'Hello room, I am ' + this._clientId; setTimeout( () => { if (this._canSendMessages) { console.log('Sending message to room: ' + message); this._socket.emit('send', { roomId: this._roomId, message: message }); }; this.send_message(); }, 2000 ); } }; UnichatClient.init(config.REALTIME_URL);
Add naive send_message realtime client function
Add naive send_message realtime client function
JSX
mit
dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet
--- +++ @@ -21,6 +21,7 @@ roomId: this._roomId }); this._canSendMessages = true; + this.send_message(); }); this._socket.on('message', (message) => { console.log('Received message:'); @@ -30,6 +31,23 @@ console.log('Realtime disconnected'); this._canSendMessages = false; }); + }, + send_message() { + console.log('Can send messages? ' + this._canSendMessages); + let message = 'Hello room, I am ' + this._clientId; + setTimeout( + () => { + if (this._canSendMessages) { + console.log('Sending message to room: ' + message); + this._socket.emit('send', { + roomId: this._roomId, + message: message + }); + }; + this.send_message(); + }, + 2000 + ); } };
159b44bda196f1d3a7aa747ed86fa6acf82b5ca3
frontend/src/components/profile/Profile.react.jsx
frontend/src/components/profile/Profile.react.jsx
import React from 'react'; import Radium from 'radium'; import {Card} from 'belle'; @Radium export default class Profile extends React.Component { static propTypes = { children: React.PropTypes.array.isRequired, title: React.PropTypes.string.isRequired, twitterHandle: React.PropTypes.string.isRequired } render() { const {title, twitterHandle} = this.props; return ( <Card> <section style={styles.container}> <h1 style={styles.title}>{title} (<a target="_blank" href={`https://twitter.com/${twitterHandle}`}>@{twitterHandle}</a>)</h1> {this.props.children} </section> </Card> ); } } const styles = { container: { display: 'flex' }, title: { fontSize: '20px' } }
import React from 'react'; import Radium from 'radium'; import {Card} from 'belle'; @Radium export default class Profile extends React.Component { static propTypes = { children: React.PropTypes.any.isRequired, title: React.PropTypes.string.isRequired, twitterHandle: React.PropTypes.string.isRequired } render() { const {title, twitterHandle} = this.props; return ( <Card> <section style={styles.container}> <h1 style={styles.title}>{title} (<a target="_blank" href={`https://twitter.com/${twitterHandle}`}>@{twitterHandle}</a>)</h1> {this.props.children} </section> </Card> ); } } const styles = { container: { display: 'flex' }, title: { fontSize: '20px' } }
Fix bad prop type on Profile
Fix bad prop type on Profile
JSX
agpl-3.0
jilljenn/voyageavecmoi,jilljenn/voyageavecmoi,jilljenn/voyageavecmoi
--- +++ @@ -6,7 +6,7 @@ @Radium export default class Profile extends React.Component { static propTypes = { - children: React.PropTypes.array.isRequired, + children: React.PropTypes.any.isRequired, title: React.PropTypes.string.isRequired, twitterHandle: React.PropTypes.string.isRequired }
ad6f79c3e70ca13824197658e7ea6f8822ebbe89
client/components/Events/EventDetails.jsx
client/components/Events/EventDetails.jsx
import React from 'react'; import { Link } from 'react-router'; const EventDetails = ({params: { eventName }, location: { query }}) => ( <div> <img src="http://tctechcrunch2011.files.wordpress.com/2008/04/linux-penguin-small.png" /> <h4>Event Name: {eventName}</h4> <h4>Contract Address: {query.eventContractAddress}</h4> <p>Description: {query.description}</p> <p>Price: {query.price}</p> <p>Start Date:{query.eventStartDateTime}</p> <p>End Date: {query.eventEndDateTime}</p> <p>Street Address: {query.addressLine1}</p> <p>Address Line 2: {query.addressLine2}</p> <p>City: {query.city}</p> <p>State: {query.state}</p> <p>Zip/Postal Code: {query.zipPostalCode}</p> <p>Country: {query.country}</p> <h4><Link to={{ pathname: '/buyevent/' + eventName, query: { eventName, contractAddress: query.eventContractAddress, }, }} >Buy Ticket</Link></h4> </div> ); export default EventDetails;
import React from 'react'; import { Link } from 'react-router'; const EventDetails = ({params: { eventName }, location: { query }}) => ( <div> <img src="http://tctechcrunch2011.files.wordpress.com/2008/04/linux-penguin-small.png" /> <h4>Event Name: {eventName}</h4> <h4>Contract Address: {query.eventContractAddress}</h4> <p>Description: {query.description}</p> <p>Price: {query.price}</p> <p>Start Date:{query.eventStartDateTime}</p> <p>End Date: {query.eventEndDateTime}</p> <p>Street Address: {query.addressLine1}</p> <p>Address Line 2: {query.addressLine2}</p> <p>City: {query.city}</p> <p>State: {query.state}</p> <p>Zip/Postal Code: {query.zipPostalCode}</p> <p>Country: {query.country}</p> <p>Contract Address: {query.eventContractAddress}</p> <h4><Link to={{ pathname: '/buyevent/' + eventName, query: { eventName, contractAddress: query.eventContractAddress, }, }} >Buy Ticket</Link></h4> </div> ); export default EventDetails;
Add back event contract address
Add back event contract address
JSX
mit
kevinbrosamle/ticket-sherpa,digitalsherpas/ticket-sherpa,chrispicato/ticket-sherpa,chrispicato/ticket-sherpa,andrewk17/ticket-sherpa,kevinbrosamle/ticket-sherpa,andrewk17/ticket-sherpa,digitalsherpas/ticket-sherpa
--- +++ @@ -16,6 +16,7 @@ <p>State: {query.state}</p> <p>Zip/Postal Code: {query.zipPostalCode}</p> <p>Country: {query.country}</p> + <p>Contract Address: {query.eventContractAddress}</p> <h4><Link to={{ pathname: '/buyevent/' + eventName,
8997adfa4ebbc09f8b03f8b16cc5b1ab8825a806
imports/ui/measure-view/measure-explorer.jsx
imports/ui/measure-view/measure-explorer.jsx
import React from 'react'; import { Panel, ListGroup, ListGroupItem } from 'react-bootstrap'; const MeasureExplorer = (props) => ( <Panel header="Measures"> <ListGroup> <ListGroupItem>My first item</ListGroupItem> </ListGroup> </Panel> ); export default MeasureExplorer;
import React, { PropTypes } from 'react'; import Measures from '../../api/measures/measures.js'; import { Button, Panel, ListGroup, ListGroupItem } from 'react-bootstrap'; import { createContainer } from 'meteor/react-meteor-data'; const panelHeader = (props) => ( <div> Measures <Button className="glyphicon glyphicon-plus pull-right" style={{ padding: '0px', border: '0px', backgroundColor: 'transparent' }} onClick={() => Measures.add()} /> </div> ); const MeasureExplorer = (props) => ( <Panel header={panelHeader()}> <ListGroup> {props.measures.map((measure) => { return ( <ListGroupItem>{measure.name}</ListGroupItem> ); })} </ListGroup> </Panel> ); MeasureExplorer.propTypes = { measures: PropTypes.array.isRequired, }; export default createContainer(() => { return { measures: Measures.collection.find({}).fetch(), }; }, MeasureExplorer);
Add measure collection to measure explorer
Add measure collection to measure explorer
JSX
mit
minden/data-furnace,minden/data-furnace
--- +++ @@ -1,13 +1,37 @@ -import React from 'react'; -import { Panel, ListGroup, ListGroupItem } from 'react-bootstrap'; +import React, { PropTypes } from 'react'; +import Measures from '../../api/measures/measures.js'; +import { Button, Panel, ListGroup, ListGroupItem } from 'react-bootstrap'; +import { createContainer } from 'meteor/react-meteor-data'; + +const panelHeader = (props) => ( + <div> + Measures + <Button + className="glyphicon glyphicon-plus pull-right" + style={{ padding: '0px', border: '0px', backgroundColor: 'transparent' }} + onClick={() => Measures.add()} + /> + </div> +); const MeasureExplorer = (props) => ( - <Panel header="Measures"> + <Panel header={panelHeader()}> <ListGroup> - <ListGroupItem>My first item</ListGroupItem> + {props.measures.map((measure) => { + return ( + <ListGroupItem>{measure.name}</ListGroupItem> + ); + })} </ListGroup> </Panel> ); -export default MeasureExplorer; +MeasureExplorer.propTypes = { + measures: PropTypes.array.isRequired, +}; +export default createContainer(() => { + return { + measures: Measures.collection.find({}).fetch(), + }; +}, MeasureExplorer);
8d032d84a2535bf40a0729832deb9f395df0129e
src/mb/containers/LoMoCoversContainer.jsx
src/mb/containers/LoMoCoversContainer.jsx
import { connect } from 'react-redux'; import React from 'react'; import LoMoCovers from '../components/LoMoCovers'; import actionCreators from '../actions/lolomo-action-creators'; export default connect( (state, ownProps) => ({ subjects: state.getIn(['models', ownProps.modelKey, 'subjects']), selectedSubjectId: state.getIn(['lolomo', 'selectedSubjectId']), hasSelection: state.getIn(['lolomo', 'selectedModelKey']) === ownProps.modelKey }), (dispatch, ownProps) => ({ actions: { selectSubject(subject) { dispatch(actionCreators.selectSubject({ subject, modelKey: ownProps.modelKey })); if (subject) { dispatch(actionCreators.loadSubject(subject.get('id'))); } } } }) )(LoMoCovers);
import { connect } from 'react-redux'; import React from 'react'; import LoMoCovers from '../components/LoMoCovers'; import actionCreators from '../actions/lolomo-action-creators'; export default connect( (state, ownProps) => ({ subjects: state.getIn(['models', ownProps.modelKey, 'subjects']), selectedSubjectId: state.getIn(['lolomo', 'selectedSubject', 'id']), hasSelection: state.getIn(['lolomo', 'selectedModelKey']) === ownProps.modelKey }), (dispatch, ownProps) => ({ actions: { selectSubject(subject) { dispatch(actionCreators.selectSubject({ subject, modelKey: ownProps.modelKey })); if (subject) { dispatch(actionCreators.loadSubject(subject.get('id'))); } } } }) )(LoMoCovers);
Use selectedSubject.id instead of selectedSubjectId.
Use selectedSubject.id instead of selectedSubjectId.
JSX
mit
MagicCube/movie-board,MagicCube/movie-board,MagicCube/movie-board
--- +++ @@ -9,7 +9,7 @@ export default connect( (state, ownProps) => ({ subjects: state.getIn(['models', ownProps.modelKey, 'subjects']), - selectedSubjectId: state.getIn(['lolomo', 'selectedSubjectId']), + selectedSubjectId: state.getIn(['lolomo', 'selectedSubject', 'id']), hasSelection: state.getIn(['lolomo', 'selectedModelKey']) === ownProps.modelKey }), (dispatch, ownProps) => ({
5f9d67408c243d5bf40709cc778852a2a57ebe1a
src/js/letters/routes.jsx
src/js/letters/routes.jsx
import React from 'react'; import { Route } from 'react-router'; import DownloadLetters from './containers/DownloadLetters.jsx'; import AddressSection from './containers/AddressSection.jsx'; import LetterList from './containers/LetterList.jsx'; import Main from './containers/Main.jsx'; const routes = [ <Route component={Main} key="main"> <Route component={DownloadLetters} name="Download Letters" key="download-letters"> <Route component={AddressSection} name="Review your address" key="confirm-address" path="confirm-address"/>, <Route component={LetterList} name="Select and download" key="letter-list" path="letter-list"/> </Route> </Route> ]; export default routes; export const chapters = [ { name: 'Review your address', path: '/confirm-address' }, { name: 'Select and download', path: '/letter-list' } ];
import React from 'react'; import { Route, IndexRedirect } from 'react-router'; import DownloadLetters from './containers/DownloadLetters.jsx'; import AddressSection from './containers/AddressSection.jsx'; import LetterList from './containers/LetterList.jsx'; import Main from './containers/Main.jsx'; const routes = [ <Route component={Main} key="main"> <Route component={DownloadLetters} name="Download Letters" key="download-letters"> <IndexRedirect to="confirm-address"/>, <Route component={AddressSection} name="Review your address" key="confirm-address" path="confirm-address"/>, <Route component={LetterList} name="Select and download" key="letter-list" path="letter-list"/> </Route> </Route> ]; export default routes; export const chapters = [ { name: 'Review your address', path: '/confirm-address' }, { name: 'Select and download', path: '/letter-list' } ];
Add redirect to first page
Add redirect to first page
JSX
cc0-1.0
department-of-veterans-affairs/vets-website,department-of-veterans-affairs/vets-website
--- +++ @@ -1,5 +1,5 @@ import React from 'react'; -import { Route } from 'react-router'; +import { Route, IndexRedirect } from 'react-router'; import DownloadLetters from './containers/DownloadLetters.jsx'; import AddressSection from './containers/AddressSection.jsx'; @@ -14,6 +14,7 @@ component={DownloadLetters} name="Download Letters" key="download-letters"> + <IndexRedirect to="confirm-address"/>, <Route component={AddressSection} name="Review your address"
9f9af95e6dda5e6cc104b5c191f761417066db1f
client/src/components/sub/LectureTitle.jsx
client/src/components/sub/LectureTitle.jsx
import React from 'react'; import Connection from '../../Connection'; const LectureTitle = (props) => { var roomInfo = props.getState().room.roomInfo; var lecturer = roomInfo.lecturer; var topic = roomInfo.topic; var createdAt = moment(roomInfo.createdAt); return ( <h3 className="lectureTitle">{topic} by {lecturer}</h3> ); }; export default Connection(LectureTitle);
import React from 'react'; import Connection from '../../Connection'; const LectureTitle = (props) => { var roomInfo = props.getState().room.roomInfo; //** UNCOMMENT BELOW // var lecturer = roomInfo.lecturer; // var topic = roomInfo.topic; // var createdAt = moment(roomInfo.createdAt); //** DELETE BELOW var lecturer = 'Mr Potatohead' var topic = 'World History'; // var createdAt = moment(roomInfo.createdAt); return ( <h3 className="lectureTitle">{topic} by {lecturer}</h3> ); }; export default Connection(LectureTitle);
Add dummy data to master
Add dummy data to master
JSX
mit
derektliu/Picky-Notes,inspiredtolive/Picky-Notes,folksy-squid/Picky-Notes,inspiredtolive/Picky-Notes,derektliu/Picky-Notes,inspiredtolive/Picky-Notes,folksy-squid/Picky-Notes,derektliu/Picky-Notes,folksy-squid/Picky-Notes
--- +++ @@ -2,9 +2,16 @@ import Connection from '../../Connection'; const LectureTitle = (props) => { var roomInfo = props.getState().room.roomInfo; - var lecturer = roomInfo.lecturer; - var topic = roomInfo.topic; - var createdAt = moment(roomInfo.createdAt); + + //** UNCOMMENT BELOW + // var lecturer = roomInfo.lecturer; + // var topic = roomInfo.topic; + // var createdAt = moment(roomInfo.createdAt); + + //** DELETE BELOW + var lecturer = 'Mr Potatohead' + var topic = 'World History'; + // var createdAt = moment(roomInfo.createdAt); return ( <h3 className="lectureTitle">{topic} by {lecturer}</h3>
b7bd719593412b6f3a2b927d0a099282320bf681
src/request/components/request-detail-panel-messages.jsx
src/request/components/request-detail-panel-messages.jsx
'use strict'; var _ = require('lodash'); var React = require('react'); var PanelGeneric = require('./request-detail-panel-generic'); module.exports = React.createClass({ render: function () { var request = this.props.request; var payload = _.values(request.messages).sort(function(a, b) { return a.ordinal - b.ordinal; }); return ( <div> <div><h3>Message Count - {payload.length}</h3></div> <table> <tbody> {payload.map(function(item) { var payload = item.payload && !_.isEmpty(item.payload) ? <PanelGeneric payload={item.payload} /> : '--'; return ( <tr className="row-devider"> <td> <h2>{item.types.join(', ')} ({item.ordinal})</h2> <div>{payload}</div> </td> </tr> ); })} </tbody> </table> </div> ); } }); // TODO: Need to come up with a better self registration process (function () { var requestTabController = require('../request-tab'); requestTabController.registerTab({ key: 'tab.messages', title: 'Messages', component: module.exports }); })()
'use strict'; var _ = require('lodash'); var React = require('react'); var PanelGeneric = require('./request-detail-panel-generic'); module.exports = React.createClass({ render: function () { var request = this.props.request; var payload = _.values(request.messages).sort(function(a, b) { return (a.ordinal || 0) - (b.ordinal || 0); }); return ( <div> <div><h3>Message Count - {payload.length}</h3></div> <table> <tbody> {payload.map(function(item) { var payload = item.payload && !_.isEmpty(item.payload) ? <PanelGeneric payload={item.payload} /> : '--'; return ( <tr className="row-devider"> <td> <h2>{item.types.join(', ')} ({item.ordinal})</h2> <div>{payload}</div> </td> </tr> ); })} </tbody> </table> </div> ); } }); // TODO: Need to come up with a better self registration process (function () { var requestTabController = require('../request-tab'); requestTabController.registerTab({ key: 'tab.messages', title: 'Messages', component: module.exports }); })()
Make sure message tab sort has a ordinal to work with
Make sure message tab sort has a ordinal to work with
JSX
unknown
avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype
--- +++ @@ -7,7 +7,7 @@ module.exports = React.createClass({ render: function () { var request = this.props.request; - var payload = _.values(request.messages).sort(function(a, b) { return a.ordinal - b.ordinal; }); + var payload = _.values(request.messages).sort(function(a, b) { return (a.ordinal || 0) - (b.ordinal || 0); }); return ( <div>
2549cef8a3e6bdf8a3fbbff9b05f0cde02e40bd9
js/Details.jsx
js/Details.jsx
const React = require('react') class Details extends React.Component { render() { return ( <div style={{textAlign: 'left'}} className='container'> <pre><code> {JSON.stringify(this.props.params, null, 4)} </code></pre> </div> ) } } const { object } = React.PropTypes Details.propTypes = { params: object.isRequired } module.exports = Details
const React = require('react') class Details extends React.Component { render() { const params = this.props.params || {} const { title, description, year, poster, trailer } = params return ( <div className='container'> <header className='header'> <h1 className='brand'>svideo</h1> </header> <div className='video-info'> <h1 className='video-title'>{title}</h1> <h2 className='video-year'>({year})</h2> <img className='video-poster' src={`public/img/posters/${poster}`} /> <p className='video-description'>{description}</p> </div> <div className="video-container"> <iframe src={`https://www.youtube-nocookie.com/embed/${trailer}?rel=0&amp;controls=0&amp;showinfo=0`} frameBorder='0' allowFullScreen></iframe> </div> </div> ) } } const { object } = React.PropTypes Details.propTypes = { params: object.isRequired } module.exports = Details
Add details for each move through reac component
Add details for each move through reac component
JSX
mit
michaeldumalag/ReactSelfLearning,michaeldumalag/ReactSelfLearning
--- +++ @@ -2,11 +2,22 @@ class Details extends React.Component { render() { + const params = this.props.params || {} + const { title, description, year, poster, trailer } = params return ( - <div style={{textAlign: 'left'}} className='container'> - <pre><code> - {JSON.stringify(this.props.params, null, 4)} - </code></pre> + <div className='container'> + <header className='header'> + <h1 className='brand'>svideo</h1> + </header> + <div className='video-info'> + <h1 className='video-title'>{title}</h1> + <h2 className='video-year'>({year})</h2> + <img className='video-poster' src={`public/img/posters/${poster}`} /> + <p className='video-description'>{description}</p> + </div> + <div className="video-container"> + <iframe src={`https://www.youtube-nocookie.com/embed/${trailer}?rel=0&amp;controls=0&amp;showinfo=0`} frameBorder='0' allowFullScreen></iframe> + </div> </div> ) }
f50bdf4d14cf01eb28ff07c06c3e6fe138ccb491
src/renderer/components/footer.jsx
src/renderer/components/footer.jsx
import React, { PropTypes } from 'react'; const STYLE = { footer: { minHeight: 'auto' }, }; const Footer = ({ status }) => { return ( <div className="ui bottom fixed menu borderless" style={STYLE.footer}> {status} </div> ); }; Footer.propTypes = { status: PropTypes.string.isRequired, }; export default Footer;
import React, { PropTypes } from 'react'; import shell from 'shell'; const STYLE = { footer: { minHeight: 'auto' }, status: { paddingLeft: '0.5em' }, }; function onGithubClick(event) { event.preventDefault(); shell.openExternal('https://github.com/sqlectron/sqlectron-gui'); } const Footer = ({ status }) => { return ( <div className="ui bottom fixed menu borderless" style={STYLE.footer}> <div style={STYLE.status}>{status}</div> <div className="right menu"> <a href="#" className="item" onClick={onGithubClick}>Github</a> </div> </div> ); }; Footer.propTypes = { status: PropTypes.string.isRequired, }; export default Footer;
Add link to the project in the Github
Add link to the project in the Github
JSX
mit
sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui
--- +++ @@ -1,15 +1,26 @@ import React, { PropTypes } from 'react'; +import shell from 'shell'; const STYLE = { footer: { minHeight: 'auto' }, + status: { paddingLeft: '0.5em' }, }; + + +function onGithubClick(event) { + event.preventDefault(); + shell.openExternal('https://github.com/sqlectron/sqlectron-gui'); +} const Footer = ({ status }) => { return ( <div className="ui bottom fixed menu borderless" style={STYLE.footer}> - {status} + <div style={STYLE.status}>{status}</div> + <div className="right menu"> + <a href="#" className="item" onClick={onGithubClick}>Github</a> + </div> </div> ); };
92529d942da9d4d96cbd10a9d0365ddccce31d26
imports/ui/report-view/report-table.jsx
imports/ui/report-view/report-table.jsx
import React, { PropTypes } from 'react'; import { Table } from 'react-bootstrap'; import Measures from '../../api/measures/measures.js'; import Elements from '../../api/elements/elements.js'; const ReportTable = (props) => ( <Table bordered="true" > <thead> {props.report.columns.map((column) => { return ( <tr key={column.elementId} > <th></th> <th>{Elements.getName(column.elementId)}</th> </tr> ); })} </thead> <tbody> {props.report.rows.map((row) => { return ( <tr key={row.measureId} > <th> {Measures.getName(row.measureId)} </th> </tr> ); })} </tbody> </Table> ); ReportTable.propTypes = { report: PropTypes.object.isRequired, }; export default ReportTable;
import React, { PropTypes } from 'react'; import { Table } from 'react-bootstrap'; import Measures from '../../api/measures/measures.js'; import Elements from '../../api/elements/elements.js'; import Reports from '../../api/reports/reports.js'; const ReportTable = (props) => ( <Table> <thead> {props.report.columns.map((column) => { return ( <tr key={column.elementId} > <th></th> <th onDrop={(ev) => Reports.addToTable( props.report._id, ev.dataTransfer.getData('text/type'), ev.dataTransfer.getData('text/id') )} onDragOver={(e) => { e.preventDefault(); console.log('dragged over'); }} > {Elements.getName(column.elementId)} </th> </tr> ); })} </thead> <tbody> {props.report.rows.map((row) => { return ( <tr key={row.measureId} > <th onDrop={(ev) => Reports.addToTable( props.report._id, ev.dataTransfer.getData('text/type'), ev.dataTransfer.getData('text/id') )} onDragOver={(e) => { e.preventDefault(); console.log('dragged over'); }} > {Measures.getName(row.measureId)} </th> </tr> ); })} </tbody> </Table> ); ReportTable.propTypes = { report: PropTypes.object.isRequired, }; export default ReportTable;
Add drop zone to table as well
Add drop zone to table as well
JSX
mit
minden/data-furnace,minden/data-furnace
--- +++ @@ -2,15 +2,25 @@ import { Table } from 'react-bootstrap'; import Measures from '../../api/measures/measures.js'; import Elements from '../../api/elements/elements.js'; +import Reports from '../../api/reports/reports.js'; const ReportTable = (props) => ( - <Table bordered="true" > + <Table> <thead> {props.report.columns.map((column) => { return ( <tr key={column.elementId} > <th></th> - <th>{Elements.getName(column.elementId)}</th> + <th + onDrop={(ev) => Reports.addToTable( + props.report._id, + ev.dataTransfer.getData('text/type'), + ev.dataTransfer.getData('text/id') + )} + onDragOver={(e) => { e.preventDefault(); console.log('dragged over'); }} + > + {Elements.getName(column.elementId)} + </th> </tr> ); })} @@ -19,7 +29,14 @@ {props.report.rows.map((row) => { return ( <tr key={row.measureId} > - <th> + <th + onDrop={(ev) => Reports.addToTable( + props.report._id, + ev.dataTransfer.getData('text/type'), + ev.dataTransfer.getData('text/id') + )} + onDragOver={(e) => { e.preventDefault(); console.log('dragged over'); }} + > {Measures.getName(row.measureId)} </th> </tr>
fe82861567c2ff8e39c61b9b06ff33890908ef30
app/pages/lab/media.jsx
app/pages/lab/media.jsx
import PropTypes from 'prop-types'; import React from 'react'; import MediaArea from './media-area'; export default class EditMediaPage extends React.Component { constructor(props) { super(props); this.renderValidExtensions = this.renderValidExtensions.bind(this); } renderValidExtensions() { return this.props.validSubjectExtensions.map((ext, i) => { const codeMarkup = <code key={ext}>{ext}</code>; if (this.props.validSubjectExtensions[i + 1]) { return <span key={ext}><code>{ext}</code>,{' '}</span>; } return codeMarkup; }); } render() { return ( <div className="edit-media-page"> <div className="content-container"> <p> <strong>You can add images here to use in your project’s content.</strong><br /> Just copy and paste the image’s Markdown code: <code>![title](url)</code>. Images can be any of: {this.renderValidExtensions()} </p> <MediaArea resource={this.props.project} /> </div> </div> ); } } EditMediaPage.defaultProps = { project: {}, validSubjectExtensions: ['.jpg', '.jpeg', '.png', '.gif', '.svg', '.mp3'], }; EditMediaPage.propTypes = { project: PropTypes.object, validSubjectExtensions: PropTypes.arrayOf(PropTypes.string), };
import PropTypes from 'prop-types'; import React from 'react'; import MediaArea from './media-area'; export default class EditMediaPage extends React.Component { constructor(props) { super(props); this.renderValidExtensions = this.renderValidExtensions.bind(this); } renderValidExtensions() { return this.props.validSubjectExtensions.map((ext, i) => { const codeMarkup = <code key={ext}>{ext}</code>; if (this.props.validSubjectExtensions[i + 1]) { return <span key={ext}><code>{ext}</code>,{' '}</span>; } return codeMarkup; }); } render() { return ( <div className="edit-media-page"> <div className="content-container"> <p> <strong>You can add files here to use in your project’s content.</strong><br /> Just copy and paste the file’s Markdown code: <code>![title](url)</code>. Files can be any of: {this.renderValidExtensions()} </p> <MediaArea resource={this.props.project} /> </div> </div> ); } } EditMediaPage.defaultProps = { project: {}, validSubjectExtensions: ['.jpg', '.jpeg', '.png', '.gif', '.svg', '.mp3'], }; EditMediaPage.propTypes = { project: PropTypes.object, validSubjectExtensions: PropTypes.arrayOf(PropTypes.string), };
Change 'images' to 'files' in instructions
Change 'images' to 'files' in instructions
JSX
apache-2.0
amyrebecca/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,zooniverse/Panoptes-Front-End,amyrebecca/Panoptes-Front-End
--- +++ @@ -25,8 +25,8 @@ <div className="edit-media-page"> <div className="content-container"> <p> - <strong>You can add images here to use in your project’s content.</strong><br /> - Just copy and paste the image’s Markdown code: <code>![title](url)</code>. Images can be any of: {this.renderValidExtensions()} </p> + <strong>You can add files here to use in your project’s content.</strong><br /> + Just copy and paste the file’s Markdown code: <code>![title](url)</code>. Files can be any of: {this.renderValidExtensions()} </p> <MediaArea resource={this.props.project} /> </div> </div>
bf2886d41cada8e54afe53f6cf63e82e5353ffa5
app/views/Home/Home.jsx
app/views/Home/Home.jsx
import React from 'react' import './Home.scss' const Home = () => ( <div className='home'> <h1 className='home__title'>The React Client</h1> <p className='home__description'> The simplest and the cleanest client boilerplate using React. </p> </div> ) export default Home
import React from 'react' // import User from '../../components/User' import './Home.scss' const Home = () => ( <div className='home'> <h1 className='home__title'>The React Client</h1> <p className='home__description'> The simplest and the cleanest client boilerplate using React. </p> </div> ) export default Home
Add a comment with an example of importing a component.
Add a comment with an example of importing a component.
JSX
mit
rhberro/the-react-client,rhberro/the-react-client
--- +++ @@ -1,4 +1,6 @@ import React from 'react' + +// import User from '../../components/User' import './Home.scss'
e00e8c39a3ed6f1f1b8af2ff5d7fc3b78dceae52
src/ActionPreviewHeader.jsx
src/ActionPreviewHeader.jsx
import React from 'react'; const ActionPreviewHeader = ({ styling, inspectedPath, onInspectPath, tabName, onSelectTab, tabs }) => <div key='previewHeader' {...styling('previewHeader')}> <div {...styling('tabSelector')}> {tabs.map(tab => <div onClick={() => onSelectTab(tab.name)} key={tab.name} {...styling([ 'selectorButton', tab.name === tabName && 'selectorButtonSelected' ], tab.name === tabName)}> {tab.name} </div> )} </div> <div {...styling('inspectedPath')}> {inspectedPath.length ? <span {...styling('inspectedPathKey')}> <a onClick={() => onInspectPath([])} {...styling('inspectedPathKeyLink')}> {tabName} </a> </span> : tabName } {inspectedPath.map((key, idx) => idx === inspectedPath.length - 1 ? <span>{key}</span> : <span key={key} {...styling('inspectedPathKey')}> <a onClick={() => onInspectPath(inspectedPath.slice(0, idx + 1))} {...styling('inspectedPathKeyLink')}> {key} </a> </span> )} </div> </div>; export default ActionPreviewHeader;
import React from 'react'; const ActionPreviewHeader = ({ styling, inspectedPath, onInspectPath, tabName, onSelectTab, tabs }) => <div key='previewHeader' {...styling('previewHeader')}> <div {...styling('tabSelector')}> {tabs.map(tab => <div onClick={() => onSelectTab(tab.name)} key={tab.name} {...styling([ 'selectorButton', tab.name === tabName && 'selectorButtonSelected' ], tab.name === tabName)}> {tab.name} </div> )} </div> <div {...styling('inspectedPath')}> {inspectedPath.length ? <span {...styling('inspectedPathKey')}> <a onClick={() => onInspectPath([])} {...styling('inspectedPathKeyLink')}> {tabName} </a> </span> : tabName } {inspectedPath.map((key, idx) => idx === inspectedPath.length - 1 ? <span key={key}>{key}</span> : <span key={key} {...styling('inspectedPathKey')}> <a onClick={() => onInspectPath(inspectedPath.slice(0, idx + 1))} {...styling('inspectedPathKeyLink')}> {key} </a> </span> )} </div> </div>; export default ActionPreviewHeader;
Fix React warning about unique "key"
Fix React warning about unique "key"
JSX
mit
zalmoxisus/remotedev-inspector-monitor
--- +++ @@ -25,7 +25,7 @@ </span> : tabName } {inspectedPath.map((key, idx) => - idx === inspectedPath.length - 1 ? <span>{key}</span> : + idx === inspectedPath.length - 1 ? <span key={key}>{key}</span> : <span key={key} {...styling('inspectedPathKey')}> <a onClick={() => onInspectPath(inspectedPath.slice(0, idx + 1))}
b10fc99d4f7023ba569a9028ef8a84c1e50da30d
lib/src/utils/MuiPickersUtilsProvider.jsx
lib/src/utils/MuiPickersUtilsProvider.jsx
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; const { Consumer, Provider } = React.createContext(); export const MuiPickersContextConsumer = Consumer; export default class MuiPickersUtilsProvider extends PureComponent { static propTypes = { utils: PropTypes.func.isRequired, locale: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), children: PropTypes.element.isRequired, moment: PropTypes.func, } static defaultProps = { locale: undefined, moment: undefined, } render() { const { utils: Utils, locale, moment } = this.props; const utils = new Utils({ locale, moment }); return <Provider value={utils}> {this.props.children} </Provider>; } }
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; const { Consumer, Provider } = React.createContext(); export const MuiPickersContextConsumer = Consumer; export default class MuiPickersUtilsProvider extends PureComponent { static propTypes = { /* eslint-disable react/no-unused-prop-types */ utils: PropTypes.func.isRequired, locale: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), children: PropTypes.oneOfType([ PropTypes.element.isRequired, PropTypes.arrayOf(PropTypes.element.isRequired), ]).isRequired, moment: PropTypes.func, } static defaultProps = { locale: undefined, moment: undefined, } static getDerivedStateFromProps({ utils: Utils, locale, moment }) { return { utils: new Utils({ locale, moment }), }; } state = { utils: null, } render() { return <Provider value={this.state.utils}> {this.props.children} </Provider>; } }
Move utils creation to getDerivedStateFromProps
Move utils creation to getDerivedStateFromProps
JSX
mit
dmtrKovalenko/material-ui-pickers,callemall/material-ui,rscnt/material-ui,dmtrKovalenko/material-ui-pickers,mui-org/material-ui,rscnt/material-ui,oliviertassinari/material-ui,oliviertassinari/material-ui,rscnt/material-ui,oliviertassinari/material-ui,mbrookes/material-ui,mbrookes/material-ui,callemall/material-ui,callemall/material-ui,mbrookes/material-ui,mui-org/material-ui,mui-org/material-ui,callemall/material-ui
--- +++ @@ -6,9 +6,13 @@ export default class MuiPickersUtilsProvider extends PureComponent { static propTypes = { + /* eslint-disable react/no-unused-prop-types */ utils: PropTypes.func.isRequired, locale: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), - children: PropTypes.element.isRequired, + children: PropTypes.oneOfType([ + PropTypes.element.isRequired, + PropTypes.arrayOf(PropTypes.element.isRequired), + ]).isRequired, moment: PropTypes.func, } @@ -17,10 +21,17 @@ moment: undefined, } + static getDerivedStateFromProps({ utils: Utils, locale, moment }) { + return { + utils: new Utils({ locale, moment }), + }; + } + + state = { + utils: null, + } + render() { - const { utils: Utils, locale, moment } = this.props; - const utils = new Utils({ locale, moment }); - - return <Provider value={utils}> {this.props.children} </Provider>; + return <Provider value={this.state.utils}> {this.props.children} </Provider>; } }
ac0e159c83f14463cd457999667d1fbad982a8d1
walldash/src/recent_observations.jsx
walldash/src/recent_observations.jsx
import React, { PropTypes } from 'react'; const RecentObservations = ( { observations } ) => ( <div className="RecentObservations"> <div className="observations"> { observations.map( o => { const p = o.photos[0]; const size = "small"; const dims = p.dimensions( ); if ( !dims || !dims.width ) { return; } let height = 150; let width; if ( dims ) { width = height / dims.height * dims.width; } else { width = height; } let flexGrow = 1; if ( o.faves_count > 0 ) { height = height * 4; width = width * 4; flexGrow = 4; } else if ( o.comments_count > 0 ) { height = height * 2; width = width * 2; flexGrow = 2; } return ( <a key={`recent-observations-${o.id}`} href={`http://www.inaturalist.org/observations/${o.id}`} width={width} height={height} style={{ width, maxWidth: 2 * width, minHeight: height, backgroundSize: "cover", backgroundPosition: "center", backgroundImage: `url(${p.photoUrl( size )})`, flexGrow }} /> ); } ) } </div> </div> ); RecentObservations.propTypes = { observations: PropTypes.array }; export default RecentObservations;
import React, { PropTypes } from 'react'; const RecentObservations = ( { observations } ) => ( <div className="RecentObservations"> <div className="observations"> { observations.map( o => { const p = o.photos[0]; let size = "small"; const dims = p.dimensions( ); if ( !dims || !dims.width ) { return; } let height = 150; let width; if ( dims ) { width = height / dims.height * dims.width; } else { width = height; } let flexGrow = 1; if ( o.faves_count > 0 ) { height = height * 4; width = width * 4; flexGrow = flexGrow * 4; size = "large"; } else if ( o.comments_count > 0 ) { height = height * 2; width = width * 2; flexGrow = flexGrow * 2; size = "medium"; } return ( <a key={`recent-observations-${o.id}`} href={`http://www.inaturalist.org/observations/${o.id}`} width={width} height={height} style={{ minWidth: width, maxWidth: 5 * width, minHeight: height, backgroundSize: "cover", backgroundPosition: "center", backgroundImage: `url(${p.photoUrl( size )})`, flexGrow }} /> ); } ) } </div> </div> ); RecentObservations.propTypes = { observations: PropTypes.array }; export default RecentObservations;
Load larger image sizes for larger images.
Load larger image sizes for larger images.
JSX
mit
inaturalist/inaturalist.github.io,inaturalist/inaturalist.github.io
--- +++ @@ -5,7 +5,7 @@ <div className="observations"> { observations.map( o => { const p = o.photos[0]; - const size = "small"; + let size = "small"; const dims = p.dimensions( ); if ( !dims || !dims.width ) { return; @@ -21,11 +21,13 @@ if ( o.faves_count > 0 ) { height = height * 4; width = width * 4; - flexGrow = 4; + flexGrow = flexGrow * 4; + size = "large"; } else if ( o.comments_count > 0 ) { height = height * 2; width = width * 2; - flexGrow = 2; + flexGrow = flexGrow * 2; + size = "medium"; } return ( <a @@ -34,8 +36,8 @@ width={width} height={height} style={{ - width, - maxWidth: 2 * width, + minWidth: width, + maxWidth: 5 * width, minHeight: height, backgroundSize: "cover", backgroundPosition: "center",
ed1fd869aeccc9e5f028825a4f09efb341924539
src/query_key.jsx
src/query_key.jsx
// Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. import React from 'react'; export class QueryKey extends React.Component { render() { const renderItem = (item, index) => { const color = this.context.colorScale.scale(item.title); return ( <li key={index+"-"+item.title}> <span style={{color: color}}>&#x25cf;</span> <span>{item.title}</span> <span>{item.value}</span> </li> ); }; return ( <ul> {this.props.series.map(renderItem)} </ul> ); } } QueryKey.propTypes = { series: React.PropTypes.array.isRequired, }; QueryKey.contextTypes = { colorScale: React.PropTypes.object.isRequired, };
// Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. import React from 'react'; export class QueryKey extends React.Component { render() { const renderItem = (item, index) => { const color = this.context.colorScale.scale(item.title); const select = () => this.props.onSelectMetric(item.queryIndex, item.metric); return ( <li key={index+"-"+item.title}> <a onClick={select}> <span style={{color: color}}>&#x25cf;</span> <span>{item.title}</span> <span>{item.value}</span> </a> </li> ); }; return ( <ul> {this.props.series.map(renderItem)} </ul> ); } } QueryKey.propTypes = { series: React.PropTypes.array.isRequired, }; QueryKey.contextTypes = { colorScale: React.PropTypes.object.isRequired, };
Allow expanding queries by clicking on labels.
Allow expanding queries by clicking on labels.
JSX
apache-2.0
devnev/boardwalk,devnev/boardwalk
--- +++ @@ -7,11 +7,14 @@ render() { const renderItem = (item, index) => { const color = this.context.colorScale.scale(item.title); + const select = () => this.props.onSelectMetric(item.queryIndex, item.metric); return ( <li key={index+"-"+item.title}> - <span style={{color: color}}>&#x25cf;</span> - <span>{item.title}</span> - <span>{item.value}</span> + <a onClick={select}> + <span style={{color: color}}>&#x25cf;</span> + <span>{item.title}</span> + <span>{item.value}</span> + </a> </li> ); };
1bcd7b7383626e4fa22cf53bf3438fa43b3390a8
src/components/pagination-links.jsx
src/components/pagination-links.jsx
import React from 'react'; import {Link} from 'react-router'; const PAGE_SIZE = 30; const offsetObject = offset => offset ? ({offset}) : undefined; const minOffset = offset => Math.max(offset - PAGE_SIZE, 0); const maxOffset = offset => offset + PAGE_SIZE; export default (props) => ( <ul className="pager"> {props.offset > 0 ? ( <li className="previous"> <Link to={{pathname: props.location.pathname, query: offsetObject(minOffset(props.offset))}}> {'\u2190'} Newer entries </Link> </li> ) : false} <li className="next"> <Link to={{pathname: props.location.pathname, query: offsetObject(maxOffset(props.offset))}}> Older entries {'\u2192'} </Link> </li> </ul> );
import React from 'react'; import {Link} from 'react-router'; const PAGE_SIZE = 30; const offsetObject = offset => offset ? ({offset}) : undefined; const minOffset = offset => Math.max(offset - PAGE_SIZE, 0); const maxOffset = offset => offset + PAGE_SIZE; export default (props) => { const allParams = {...props.location.query}; delete allParams.offset; const paramsForNewer = {...allParams, ...offsetObject(minOffset(props.offset))}; const paramsForOlder = {...allParams, ...offsetObject(maxOffset(props.offset))}; return ( <ul className="pager"> {props.offset > 0 ? ( <li className="previous"> <Link to={{pathname: props.location.pathname, query: paramsForNewer}}> {'\u2190'} Newer entries </Link> </li> ) : false} <li className="next"> <Link to={{pathname: props.location.pathname, query: paramsForOlder}}> Older entries {'\u2192'} </Link> </li> </ul> ); };
Fix pagination for additional query params
Fix pagination for additional query params Only change offset and keep other existing parameters intact.
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -7,20 +7,28 @@ const minOffset = offset => Math.max(offset - PAGE_SIZE, 0); const maxOffset = offset => offset + PAGE_SIZE; -export default (props) => ( - <ul className="pager"> - {props.offset > 0 ? ( - <li className="previous"> - <Link to={{pathname: props.location.pathname, query: offsetObject(minOffset(props.offset))}}> - {'\u2190'} Newer entries +export default (props) => { + const allParams = {...props.location.query}; + delete allParams.offset; + + const paramsForNewer = {...allParams, ...offsetObject(minOffset(props.offset))}; + const paramsForOlder = {...allParams, ...offsetObject(maxOffset(props.offset))}; + + return ( + <ul className="pager"> + {props.offset > 0 ? ( + <li className="previous"> + <Link to={{pathname: props.location.pathname, query: paramsForNewer}}> + {'\u2190'} Newer entries + </Link> + </li> + ) : false} + + <li className="next"> + <Link to={{pathname: props.location.pathname, query: paramsForOlder}}> + Older entries {'\u2192'} </Link> </li> - ) : false} - - <li className="next"> - <Link to={{pathname: props.location.pathname, query: offsetObject(maxOffset(props.offset))}}> - Older entries {'\u2192'} - </Link> - </li> - </ul> -); + </ul> + ); +};
c04a8aef9a4e0b6d3daca1e7b84f737cbaa269ee
src/app.jsx
src/app.jsx
// Load styles require('./stylesheets/main.sass') // Imports import React from 'react'; import ReactDOM from 'react-dom'; import { Router, Route, Link, hashHistory } from 'react-router' import { Provider } from 'react-redux'; import store from './stores/store'; // Containers import MyContainer from './containers/MyContainer'; ReactDOM.render( <Provider store={store}> <Router history={hashHistory}> <Route path="/" component={MyContainer}/> </Router> </Provider>, document.getElementById('content'));
// Load styles require('./stylesheets/main.sass') // Imports import React from 'react'; import ReactDOM from 'react-dom'; import { Router, Route, Link, browserHistory } from 'react-router' import { Provider } from 'react-redux'; import store from './stores/store'; // Containers import MyContainer from './containers/MyContainer'; ReactDOM.render( <Provider store={store}> <Router history={browserHistory}> <Route path="/" component={MyContainer}/> </Router> </Provider>, document.getElementById('content'));
Change the history mode to browser
Change the history mode to browser
JSX
mit
Angelmmiguel/docker-react-redux-boilerplate,Angelmmiguel/docker-react-redux-boilerplate,Angelmmiguel/docker-react-redux-boilerplate
--- +++ @@ -4,7 +4,7 @@ // Imports import React from 'react'; import ReactDOM from 'react-dom'; -import { Router, Route, Link, hashHistory } from 'react-router' +import { Router, Route, Link, browserHistory } from 'react-router' import { Provider } from 'react-redux'; import store from './stores/store'; @@ -13,7 +13,7 @@ ReactDOM.render( <Provider store={store}> - <Router history={hashHistory}> + <Router history={browserHistory}> <Route path="/" component={MyContainer}/> </Router> </Provider>,
64d6f8abdd1180e124ed21a2db60b8ceb3dbc53d
app/components/DedicatedExample.jsx
app/components/DedicatedExample.jsx
import React from 'react'; import {Link} from 'react-router'; import Marked from './Marked'; import dedicatedExampleMark from '../marked/Dedicated/DedicatedExample.md'; import script from '!!raw!../marked/Dedicated/script.js'; import html from '!!html!../marked/Dedicated/example.html'; import '!!file?name=js/[name].[ext]!../marked/Dedicated/worker.js'; class DedicatedExample extends React.Component { componentDidMount() { const replaceScript = this.display.querySelector("#main-thread__script"); if(!replaceScript) return; const newScript = document.createElement("script"); newScript.textContent = script; this.display.replaceChild(newScript, replaceScript); } render() { return ( <div className="app__content__main worker-dedicated--example"> <Marked mark={dedicatedExampleMark}/> <div className="worker-display" dangerouslySetInnerHTML={{__html: html}} ref={c => this.display = c}/> <div className="steps-navigation"> <Link to="dedicated_worker" className="arrow" title="Dedicated Worker"/> <Link to="shared_worker" className="arrow" title="Shared Worker"/> </div> </div> ); } } export default DedicatedExample;
import React from 'react'; import {Link} from 'react-router'; import Marked from './Marked'; import dedicatedExampleMark from '../marked/Dedicated/DedicatedExample.md'; import script from '!!raw!../marked/Dedicated/script.js'; import html from '!!html!../marked/Dedicated/example.html'; import '!!file?name=js/[name].[ext]!../marked/Dedicated/worker.js'; class DedicatedExample extends React.Component { componentDidMount() { const replaceScript = this.display.querySelector("#main-thread__script"); if(!replaceScript) return; const newScript = document.createElement("script"); newScript.textContent = script; this.display.replaceChild(newScript, replaceScript); } render() { return ( <div className="app__content__main worker-dedicated--example"> <Marked mark={dedicatedExampleMark}/> <div className="worker-display" dangerouslySetInnerHTML={{__html: html}} ref={c => this.display = c}/> <div className="steps-navigation"> <Link to="/dedicated_worker" className="arrow" title="Dedicated Worker"/> <Link to="/shared_worker" className="arrow" title="Shared Worker"/> </div> </div> ); } } export default DedicatedExample;
Fix steps-navigation links in nested routes
fix(links): Fix steps-navigation links in nested routes
JSX
mit
Velenir/workers-journey,Velenir/workers-journey
--- +++ @@ -25,8 +25,8 @@ <Marked mark={dedicatedExampleMark}/> <div className="worker-display" dangerouslySetInnerHTML={{__html: html}} ref={c => this.display = c}/> <div className="steps-navigation"> - <Link to="dedicated_worker" className="arrow" title="Dedicated Worker"/> - <Link to="shared_worker" className="arrow" title="Shared Worker"/> + <Link to="/dedicated_worker" className="arrow" title="Dedicated Worker"/> + <Link to="/shared_worker" className="arrow" title="Shared Worker"/> </div> </div> );