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
|
---|---|---|---|---|---|---|---|---|---|---|
67cbfb2b4f2e513779914ce3c765cb24267a2481 | web/src/index.jsx | web/src/index.jsx | /**
* Main entry point for budget web app
*/
import React from 'react';
import { render } from 'react-dom';
// import App from './components/App';
// import styles and favicon
import './sass/index.scss';
import './images/favicon.png';
if (process.env.NODE_ENV !== 'test') {
render(
// <App />,
<h1>It works!</h1>,
document.getElementById('root')
);
}
| /**
* Main entry point for budget web app
*/
import React from 'react';
import { render } from 'react-dom';
import App from './components/App';
// import styles and favicon
import './sass/index.scss';
import './images/favicon.png';
if (process.env.NODE_ENV !== 'test') {
render(
<App />,
document.getElementById('root')
);
}
| Remove placeholder on client app | Remove placeholder on client app
| JSX | mit | felamaslen/budget,felamaslen/budget,felamaslen/budget,felamaslen/budget,felamaslen/budget,felamaslen/budget | ---
+++
@@ -4,7 +4,7 @@
import React from 'react';
import { render } from 'react-dom';
-// import App from './components/App';
+import App from './components/App';
// import styles and favicon
import './sass/index.scss';
@@ -12,8 +12,7 @@
if (process.env.NODE_ENV !== 'test') {
render(
- // <App />,
- <h1>It works!</h1>,
+ <App />,
document.getElementById('root')
);
} |
02463f63f9b0d69676c4b01e68d474b8eccea97a | src/components/list.jsx | src/components/list.jsx | import React, { Component, PropTypes } from 'react';
import User from './user';
import { getUsersIfNeeded } from '../../actions/users';
import { connect } from 'react-redux';
class List extends Component {
componentDidMount() {
}
render() {
const rows = [];
console.log(this.props);
if(this.props.users.users.friends) {
this.props.users.users.friends.forEach(id => {
const user = Object.assign({id}, this.props.users.users.allUserInfo[id]);
// console.log(user);
rows.push(
<li key={user.id}>
<User data={user} />
</li>
);
});
}
return (
<div>
<button className="btn btn-default" onClick={this.props.getUsers}>再取得</button>
<ol className="list-unstyled">
{rows}
</ol>
</div>
);
}
}
function mapStateToProps(state) {
return {
users: state.users,
userInfo: state.userInfo
};
}
const mapDispatchToProps = (dispatch) => {
return {
getUsers() {
console.log(this);
dispatch(getUsersIfNeeded()).then(() => {
// const allUser = union()
// const allUserInfo =
// return Promise.all(allUserInfo);
});
}
};
};
export default connect(mapStateToProps, mapDispatchToProps)(List);
| import React, { Component, PropTypes } from 'react';
import User from './user';
import { getUsersIfNeeded } from '../../actions/users';
import { connect } from 'react-redux';
class List extends Component {
render() {
const rows = [];
if(this.props.users.friends) {
this.props.users.friends.forEach(id => {
// console.log(user);
rows.push(
<User key={id} userId={id} />
);
});
}
return (
<div>
<button className="btn btn-default" onClick={this.props.getUsers}>再取得</button>
<div className="card-deck">
{rows}
</div>
</div>
);
}
}
function mapStateToProps(state) {
return state.users;
}
const mapDispatchToProps = (dispatch) => {
return {
getUsers() {
dispatch(getUsersIfNeeded());
}
};
};
export default connect(mapStateToProps, mapDispatchToProps)(List);
| Change to pass id only | Change to pass id only
| JSX | mit | sunya9/follow-manager,sunya9/follow-manager | ---
+++
@@ -4,20 +4,13 @@
import { connect } from 'react-redux';
class List extends Component {
- componentDidMount() {
-
- }
render() {
const rows = [];
- console.log(this.props);
- if(this.props.users.users.friends) {
- this.props.users.users.friends.forEach(id => {
- const user = Object.assign({id}, this.props.users.users.allUserInfo[id]);
+ if(this.props.users.friends) {
+ this.props.users.friends.forEach(id => {
// console.log(user);
rows.push(
- <li key={user.id}>
- <User data={user} />
- </li>
+ <User key={id} userId={id} />
);
});
}
@@ -25,30 +18,22 @@
return (
<div>
<button className="btn btn-default" onClick={this.props.getUsers}>再取得</button>
- <ol className="list-unstyled">
+ <div className="card-deck">
{rows}
- </ol>
+ </div>
</div>
);
}
}
function mapStateToProps(state) {
- return {
- users: state.users,
- userInfo: state.userInfo
- };
+ return state.users;
}
const mapDispatchToProps = (dispatch) => {
return {
getUsers() {
- console.log(this);
- dispatch(getUsersIfNeeded()).then(() => {
- // const allUser = union()
- // const allUserInfo =
- // return Promise.all(allUserInfo);
- });
+ dispatch(getUsersIfNeeded());
}
};
}; |
a3fc8590401abe54cfcbb80687ce65d7988c8ffa | src/components/cover-image.jsx | src/components/cover-image.jsx | import { css } from 'glamor';
import PropTypes from 'prop-types';
import React from 'react';
import { ASPECT_RATIO_21_9_RELATIVE_HEIGHT, IMAGE_OVERLAY_TINT } from '../utils/presets';
const CoverImage = ({ alt, sizes, src, srcSet, ...props }) => (
<div
{...css({
background: IMAGE_OVERLAY_TINT,
backgroundPosition: 'center',
backgroundSize: 'cover',
height: `${ASPECT_RATIO_21_9_RELATIVE_HEIGHT}vw`,
marginBottom: '-10rem',
position: 'relative',
})}
{...props}
>
{src != null && (
<img
alt={alt}
sizes={sizes}
src={src}
srcSet={srcSet}
{...css({
height: '100%',
objectFit: 'cover',
position: 'absolute',
width: '100%',
})}
/>
)}
<div
{...css({
background: 'linear-gradient(transparent 62%, rgba(0, 0, 0, 0.62))',
height: '100%',
position: 'relative',
})}
/>
</div>
);
CoverImage.propTypes = {
alt: PropTypes.string,
sizes: PropTypes.string,
src: PropTypes.string,
srcSet: PropTypes.string,
};
CoverImage.defaultProps = {
alt: 'Borító',
sizes: null,
src: null,
srcSet: null,
};
export default CoverImage;
| import { css } from 'glamor';
import PropTypes from 'prop-types';
import React from 'react';
import { ASPECT_RATIO_21_9_RELATIVE_HEIGHT, IMAGE_OVERLAY_TINT } from '../utils/presets';
const CoverImage = ({ alt, sizes, src, srcSet, ...props }) => (
<div
{...css({
background: IMAGE_OVERLAY_TINT,
backgroundPosition: 'center',
backgroundSize: 'cover',
height: `${ASPECT_RATIO_21_9_RELATIVE_HEIGHT}vw`,
marginBottom: '-10rem',
})}
{...props}
>
{src != null && (
<div {...css({ height: '100%', position: 'relative' })}>
<img
alt={alt}
sizes={sizes}
src={src}
srcSet={srcSet}
{...css({
height: '100%',
objectFit: 'cover',
position: 'absolute',
width: '100%',
})}
/>
<div
{...css({
background: 'linear-gradient(transparent 62%, rgba(0, 0, 0, 0.62))',
height: '100%',
position: 'relative',
})}
/>
</div>
)}
</div>
);
CoverImage.propTypes = {
alt: PropTypes.string,
sizes: PropTypes.string,
src: PropTypes.string,
srcSet: PropTypes.string,
};
CoverImage.defaultProps = {
alt: 'Borító',
sizes: null,
src: null,
srcSet: null,
};
export default CoverImage;
| Remove grayscale gradient from cover when no image is presented | Remove grayscale gradient from cover when no image is presented
| JSX | mit | simonyiszk/mvk-web,simonyiszk/mvk-web | ---
+++
@@ -11,32 +11,33 @@
backgroundSize: 'cover',
height: `${ASPECT_RATIO_21_9_RELATIVE_HEIGHT}vw`,
marginBottom: '-10rem',
- position: 'relative',
})}
{...props}
>
{src != null && (
- <img
- alt={alt}
- sizes={sizes}
- src={src}
- srcSet={srcSet}
- {...css({
- height: '100%',
- objectFit: 'cover',
- position: 'absolute',
- width: '100%',
- })}
- />
+ <div {...css({ height: '100%', position: 'relative' })}>
+ <img
+ alt={alt}
+ sizes={sizes}
+ src={src}
+ srcSet={srcSet}
+ {...css({
+ height: '100%',
+ objectFit: 'cover',
+ position: 'absolute',
+ width: '100%',
+ })}
+ />
+
+ <div
+ {...css({
+ background: 'linear-gradient(transparent 62%, rgba(0, 0, 0, 0.62))',
+ height: '100%',
+ position: 'relative',
+ })}
+ />
+ </div>
)}
-
- <div
- {...css({
- background: 'linear-gradient(transparent 62%, rgba(0, 0, 0, 0.62))',
- height: '100%',
- position: 'relative',
- })}
- />
</div>
);
|
b6efcc891b8e9d7ac523bde28ce1c0f74e7cee80 | src/js/components/Timeline.jsx | src/js/components/Timeline.jsx | import React, { PropTypes } from 'react';
import TimelineAction from './TimelineAction.jsx';
const propTypes = {
timeline: PropTypes.array.isRequired,
};
const Timeline = (props) => {
const actions = props.timeline.map((action, i) => {
return <TimelineAction key={i} action={action} />;
});
const divStyle = {
maxHeight: '450px',
overflowY: 'scroll',
};
return (
<div className="column" style={divStyle}>
<article className="message">
<div className="message-header">
Timeline
</div>
<div className="message-body">
{actions}
</div>
</article>
</div>
);
};
Timeline.propTypes = propTypes;
export default Timeline;
| import React, { PropTypes } from 'react';
import TimelineAction from './TimelineAction.jsx';
const propTypes = {
timeline: PropTypes.array.isRequired,
};
const Timeline = (props) => {
const actions = props.timeline.map((action, i) => {
return <TimelineAction key={i} action={action} />;
});
return (
<div className="column">
<article className="message">
<div className="message-header">
Timeline
</div>
<div className="message-body">
{actions}
</div>
</article>
</div>
);
};
Timeline.propTypes = propTypes;
export default Timeline;
| Remove limit height in timline component | Remove limit height in timline component
| JSX | mit | tanaka0325/nippo-web,tanaka0325/nippo-web | ---
+++
@@ -11,13 +11,8 @@
return <TimelineAction key={i} action={action} />;
});
- const divStyle = {
- maxHeight: '450px',
- overflowY: 'scroll',
- };
-
return (
- <div className="column" style={divStyle}>
+ <div className="column">
<article className="message">
<div className="message-header">
Timeline |
010109a767436aad4e2bd56160a88bdcb16a0df7 | src/components/languagechooser/languagechooser.jsx | src/components/languagechooser/languagechooser.jsx | var classNames = require('classnames');
var React = require('react');
var jar = require('../../lib/jar.js');
var languages = require('../../../languages.json');
var Select = require('../forms/select.jsx');
require('./languagechooser.scss');
var LanguageChooser = React.createClass({
type: 'LanguageChooser',
getInitialState: function () {
return {
choice: window._locale
};
},
getDefaultProps: function () {
return {
languages: languages
};
},
onSetLanguage: function (e) {
e.preventDefault();
jar.set('scratchlanguage', e.target.value);
document.location.reload(true);
},
render: function () {
var classes = classNames(
'language-chooser',
this.props.className
);
return (
<form ref="languageForm" className={classes}>
<Select name="language" defaultValue={this.state.choice} onChange={this.onSetLanguage}>
{Object.keys(this.props.languages).map(function (value) {
return <option value={value} key={value}>
{this.props.languages[value]}
</option>;
}.bind(this))}
</Select>
</form>
);
}
});
module.exports = LanguageChooser;
| var classNames = require('classnames');
var React = require('react');
var Api = require('../../mixins/api.jsx');
var languages = require('../../../languages.json');
var Select = require('../forms/select.jsx');
require('./languagechooser.scss');
var LanguageChooser = React.createClass({
type: 'LanguageChooser',
mixins: [
Api
],
getInitialState: function () {
return {
choice: window._locale
};
},
getDefaultProps: function () {
return {
languages: languages
};
},
onSetLanguage: function (e) {
e.preventDefault();
this.api({
method: 'post',
host: '',
uri: '/i18n/setlang/',
useCsrf: true,
body: {
language: e.target.value
}
}, function (err, body) {
if (body) {
document.location.reload(true);
}
}.bind(this));
},
render: function () {
var classes = classNames(
'language-chooser',
this.props.className
);
return (
<form ref="languageForm" className={classes}>
<Select name="language" defaultValue={this.state.choice} onChange={this.onSetLanguage}>
{Object.keys(this.props.languages).map(function (value) {
return <option value={value} key={value}>
{this.props.languages[value]}
</option>;
}.bind(this))}
</Select>
</form>
);
}
});
module.exports = LanguageChooser;
| Use api to set language instead of cookie | Use api to set language instead of cookie
just to be safe. But i'm leaving in the `set` method of `jar.js` so we can easily move to it in the future.
| JSX | bsd-3-clause | LLK/scratch-www,LLK/scratch-www | ---
+++
@@ -1,7 +1,7 @@
var classNames = require('classnames');
var React = require('react');
-var jar = require('../../lib/jar.js');
+var Api = require('../../mixins/api.jsx');
var languages = require('../../../languages.json');
var Select = require('../forms/select.jsx');
@@ -9,6 +9,9 @@
var LanguageChooser = React.createClass({
type: 'LanguageChooser',
+ mixins: [
+ Api
+ ],
getInitialState: function () {
return {
choice: window._locale
@@ -21,8 +24,20 @@
},
onSetLanguage: function (e) {
e.preventDefault();
- jar.set('scratchlanguage', e.target.value);
- document.location.reload(true);
+ this.api({
+ method: 'post',
+ host: '',
+ uri: '/i18n/setlang/',
+ useCsrf: true,
+ body: {
+ language: e.target.value
+ }
+
+ }, function (err, body) {
+ if (body) {
+ document.location.reload(true);
+ }
+ }.bind(this));
},
render: function () {
var classes = classNames( |
16a33e4b93591a39b6d821b1f627249bae01ba5c | src/components/WarningsIcon.jsx | src/components/WarningsIcon.jsx | import {StaticImage} from 'gatsby-plugin-image';
import React from 'react';
const JenkinsVoltron = () => <StaticImage src="../images/warning.svg" className="alert-icon" aria-label="Warning"/>;
export default JenkinsVoltron;
| import React from 'react';
import src from '../images/warning.svg';
const WarningsIcon = () => (<img
src={src}
alt="Warning Icon"
className="alert-icon"
aria-label="Warning"
/>);
export default WarningsIcon;
| Use the warnings svg directly as it doesn't need pre-processing | Use the warnings svg directly as it doesn't need pre-processing
| JSX | mit | jenkins-infra/plugin-site | ---
+++
@@ -1,7 +1,12 @@
-import {StaticImage} from 'gatsby-plugin-image';
import React from 'react';
+import src from '../images/warning.svg';
-const JenkinsVoltron = () => <StaticImage src="../images/warning.svg" className="alert-icon" aria-label="Warning"/>;
+const WarningsIcon = () => (<img
+ src={src}
+ alt="Warning Icon"
+ className="alert-icon"
+ aria-label="Warning"
+/>);
-export default JenkinsVoltron;
+export default WarningsIcon;
|
074f278325c1417534903b16e445feb6d0f29d13 | app/webpack/observations/show/containers/community_identification_container.jsx | app/webpack/observations/show/containers/community_identification_container.jsx | import { connect } from "react-redux";
import CommunityIdentification from "../components/community_identification";
import { addID } from "../ducks/observation";
import { updateObservation } from "../ducks/observation";
import { setCommunityIDModalState } from "../ducks/community_id_modal";
import { updateSession } from "../ducks/users";
import {
fetchSuggestions,
updateWithObservation as updateSuggestionsWithObservation
} from "../../identify/ducks/suggestions";
import {
showCurrentObservation as showObservationModal
} from "../../identify/actions/current_observation_actions";
function mapStateToProps( state ) {
return {
observation: state.observation,
config: state.config
};
}
function mapDispatchToProps( dispatch ) {
return {
addID: ( taxon, options ) => { dispatch( addID( taxon, options ) ); },
updateObservation: ( attributes ) => { dispatch( updateObservation( attributes ) ); },
setCommunityIDModalState: ( key, value ) => {
dispatch( setCommunityIDModalState( key, value ) );
},
updateSession: params => { dispatch( updateSession( params ) ); },
onClickCompare: ( e, taxon, observation ) => {
const newObs = Object.assign( {}, observation, { taxon } );
dispatch( updateSuggestionsWithObservation( newObs ) );
dispatch( fetchSuggestions( ) );
dispatch( showObservationModal( observation ) );
e.preventDefault( );
return false;
}
};
}
const CommunityIdentificationContainer = connect(
mapStateToProps,
mapDispatchToProps
)( CommunityIdentification );
export default CommunityIdentificationContainer;
| import { connect } from "react-redux";
import CommunityIdentification from "../components/community_identification";
import { addID } from "../ducks/observation";
import { updateObservation } from "../ducks/observation";
import { setCommunityIDModalState } from "../ducks/community_id_modal";
import { updateSession } from "../ducks/users";
import {
fetchSuggestions,
updateWithObservation as updateSuggestionsWithObservation
} from "../../identify/ducks/suggestions";
import {
showCurrentObservation as showObservationModal
} from "../../identify/actions/current_observation_actions";
function mapStateToProps( state ) {
return {
observation: Object.assign( {}, state.observation, { places: state.observationPlaces } ),
config: state.config
};
}
function mapDispatchToProps( dispatch ) {
return {
addID: ( taxon, options ) => { dispatch( addID( taxon, options ) ); },
updateObservation: ( attributes ) => { dispatch( updateObservation( attributes ) ); },
setCommunityIDModalState: ( key, value ) => {
dispatch( setCommunityIDModalState( key, value ) );
},
updateSession: params => { dispatch( updateSession( params ) ); },
onClickCompare: ( e, taxon, observation ) => {
const newObs = Object.assign( {}, observation, { taxon } );
dispatch( updateSuggestionsWithObservation( newObs ) );
dispatch( fetchSuggestions( ) );
dispatch( showObservationModal( observation ) );
e.preventDefault( );
return false;
}
};
}
const CommunityIdentificationContainer = connect(
mapStateToProps,
mapDispatchToProps
)( CommunityIdentification );
export default CommunityIdentificationContainer;
| Make sure compare link in com. ID shows same places as activity item links. | Make sure compare link in com. ID shows same places as activity item links.
| JSX | mit | inaturalist/inaturalist,inaturalist/inaturalist,inaturalist/inaturalist,pleary/inaturalist,pleary/inaturalist,inaturalist/inaturalist,pleary/inaturalist,pleary/inaturalist,pleary/inaturalist,inaturalist/inaturalist | ---
+++
@@ -14,7 +14,7 @@
function mapStateToProps( state ) {
return {
- observation: state.observation,
+ observation: Object.assign( {}, state.observation, { places: state.observationPlaces } ),
config: state.config
};
} |
eefd5b6030f02476269658647d8133eec6d98c26 | js/components/tweetList.jsx | js/components/tweetList.jsx | /** @jsx React.DOM */
var TweetList = React.createClass({
getInitialState: function() {
return {
data: {
tweets: []
}
};
},
componentDidMount: function() {
EventSystem.subscribe('input.text.change', this.updateList);
},
updateList: function() {
this.setState({
data: {
tweets: [
// TODO
]
}
});
},
render: function() {
return <ul className="tweets">
{
data.tweets.map(function(tweet) {
return <li key={tweet.id}>{tweet.text}</li>
})
}
</ul>
}
});
React.render(
<TweetList />,
document.getElementById("tweets")
); | /** @jsx React.DOM */
var TweetList = React.createClass({
getInitialState: function() {
return {
data: {
tweets: []
}
};
},
componentDidMount: function() {
EventSystem.subscribe('input.text.change', this.updateList);
},
updateList: function() {
this.setState({
data: {
tweets: [
// TODO
]
}
});
},
render: function() {
var data = this.state.data;
if (data) {
var hasTweets = data.tweets && data.tweets.length > 0;
if (hasTweets) {
return <ul className="tweets">
{
data.tweets.map(function(tweet) {
return <li key={tweet.id}>{tweet.text}</li>
})
}
</ul>
}
}
return false;
}
});
React.render(
<TweetList />,
document.getElementById("tweets")
); | Fix list render, only when data exists | Fix list render, only when data exists
| JSX | mit | dburgos/tweet-splitter,dburgos/tweet-splitter | ---
+++
@@ -23,13 +23,20 @@
},
render: function() {
- return <ul className="tweets">
- {
- data.tweets.map(function(tweet) {
- return <li key={tweet.id}>{tweet.text}</li>
- })
- }
- </ul>
+ var data = this.state.data;
+ if (data) {
+ var hasTweets = data.tweets && data.tweets.length > 0;
+ if (hasTweets) {
+ return <ul className="tweets">
+ {
+ data.tweets.map(function(tweet) {
+ return <li key={tweet.id}>{tweet.text}</li>
+ })
+ }
+ </ul>
+ }
+ }
+ return false;
}
});
|
070670137874422b0b917655c36ed435364cf34d | packages/nylas-dashboard/public/js/mini-account.jsx | packages/nylas-dashboard/public/js/mini-account.jsx | const React = window.React;
class MiniAccount extends React.Component {
calculateColor() {
// in milliseconds
const grayAfter = 10000;
const elapsedTime = Date.now() - this.props.account.last_sync_completions[0];
let opacity = 0;
if (elapsedTime < grayAfter) {
opacity = 1.0 - elapsedTime / grayAfter;
}
return `rgba(0, 255, 157, ${opacity})`;
}
render() {
const {account, assignment, active} = this.props;
let errorClass;
let style;
if (account.sync_error) {
errorClass = 'errored';
style = {};
} else {
errorClass = '';
style = {backgroundColor: this.calculateColor()};
}
return (
<div
className={`mini-account ${errorClass}`}
style={style}
></div>
)
}
}
MiniAccount.propTypes = {
account: React.PropTypes.object,
active: React.PropTypes.bool,
assignment: React.PropTypes.string,
count: React.PropTypes.number,
};
window.MiniAccount = MiniAccount;
| const React = window.React;
class MiniAccount extends React.Component {
calculateColor() {
// in milliseconds
const grayAfter = 1000 * 60 * 10; // 10 minutes
const elapsedTime = Date.now() - this.props.account.last_sync_completions[0];
let opacity = 0;
if (elapsedTime < grayAfter) {
opacity = 1.0 - elapsedTime / grayAfter;
}
return `rgba(0, 255, 157, ${opacity})`;
}
render() {
const {account, assignment, active} = this.props;
let errorClass;
let style;
if (account.sync_error) {
errorClass = 'errored';
style = {};
} else {
errorClass = '';
style = {backgroundColor: this.calculateColor()};
}
return (
<div
className={`mini-account ${errorClass}`}
style={style}
></div>
)
}
}
MiniAccount.propTypes = {
account: React.PropTypes.object,
active: React.PropTypes.bool,
assignment: React.PropTypes.string,
count: React.PropTypes.number,
};
window.MiniAccount = MiniAccount;
| Make the grayAfter time more appropriate for production, 10 mins | Make the grayAfter time more appropriate for production, 10 mins
| JSX | mit | nylas/nylas-mail,nylas-mail-lives/nylas-mail,nylas/nylas-mail,nirmit/nylas-mail,simonft/nylas-mail,simonft/nylas-mail,nirmit/nylas-mail,nylas-mail-lives/nylas-mail,nylas/nylas-mail,simonft/nylas-mail,nylas-mail-lives/nylas-mail,nirmit/nylas-mail,simonft/nylas-mail,nylas-mail-lives/nylas-mail,nirmit/nylas-mail,nylas-mail-lives/nylas-mail,simonft/nylas-mail,nylas/nylas-mail,nylas/nylas-mail,nirmit/nylas-mail | ---
+++
@@ -4,7 +4,7 @@
calculateColor() {
// in milliseconds
- const grayAfter = 10000;
+ const grayAfter = 1000 * 60 * 10; // 10 minutes
const elapsedTime = Date.now() - this.props.account.last_sync_completions[0];
let opacity = 0;
if (elapsedTime < grayAfter) { |
7a88ce0d8014e4db61473c7c1e57d33f8d016dd7 | Components/team.jsx | Components/team.jsx | import React from 'react';
var Team = React.createClass({
render : function () {
if (typeof this.props.selectPlayers === 'undefined') {
return null;
} else {
var playerLists;
playerLists = this.props.selectPlayers.players.map(function(p) {
return (<li>{p.name}</li>)
}.bind(this));
return (
<div>
<h3>{this.props.data.name}</h3>
<ul className="list-unstyled">
{playerLists}
</ul>
</div>
);
}
}
});
export default Team; | import React from 'react';
var position = {
keepers : [],
defenders : [],
midfields : [],
forwards : []
}
var Team = React.createClass({
render : function () {
if (typeof this.props.selectPlayers === 'undefined') {
return null;
} else {
var f = _.chain(this.props.selectPlayers.players).groupBy('position').pairs().map(function (currentItem) {
return _.object(_.zip(["position", "players"], currentItem));
}).value();
/*
var playerLists = _.chain(this.props.selectPlayers.players).filter(function(o) {
if (o.position == "Keeper") {
return position.keepers.push(o);
}
if (o.position == 'Left-Back' || o.position == 'Right-Back' || o.position == "Centre Back") {
return position.defenders.push(o);
}
if (o.position == 'Central Midfield' || o.position == 'Attacking Midfield' || o.position == "Defensive Midfield") {
return position.midfields.push(o);
}
if (o.position == 'Centre Forward' || o.position == 'Right Wing' || o.position == "Left Wing") {
return position.forwards.push(o);
}
}).map(function(p) {
console.log(p)
});*/
console.log(f)
/*
playerLists = this.props.selectPlayers.players.map(function(p) {
return (<li>{p.name}</li>)
}.bind(this));*/
return (
<div>
<h3>{this.props.data.name}</h3>
<ul className="list-unstyled">
</ul>
</div>
);
}
}
});
export default Team; | Test lodash to grouping players | Test lodash to grouping players
| JSX | mit | ryanpark/FEPL,ryanpark/FEPL---React-App,ryanpark/FEPL,ryanpark/FEPL---React-App | ---
+++
@@ -1,4 +1,11 @@
import React from 'react';
+
+var position = {
+ keepers : [],
+ defenders : [],
+ midfields : [],
+ forwards : []
+}
var Team = React.createClass({
render : function () {
@@ -6,16 +13,38 @@
if (typeof this.props.selectPlayers === 'undefined') {
return null;
} else {
- var playerLists;
+ var f = _.chain(this.props.selectPlayers.players).groupBy('position').pairs().map(function (currentItem) {
+ return _.object(_.zip(["position", "players"], currentItem));
+ }).value();
+ /*
+ var playerLists = _.chain(this.props.selectPlayers.players).filter(function(o) {
+ if (o.position == "Keeper") {
+ return position.keepers.push(o);
+ }
+ if (o.position == 'Left-Back' || o.position == 'Right-Back' || o.position == "Centre Back") {
+ return position.defenders.push(o);
+ }
+ if (o.position == 'Central Midfield' || o.position == 'Attacking Midfield' || o.position == "Defensive Midfield") {
+ return position.midfields.push(o);
+ }
+ if (o.position == 'Centre Forward' || o.position == 'Right Wing' || o.position == "Left Wing") {
+ return position.forwards.push(o);
+ }
+ }).map(function(p) {
+ console.log(p)
+ });*/
+
+ console.log(f)
+ /*
playerLists = this.props.selectPlayers.players.map(function(p) {
return (<li>{p.name}</li>)
- }.bind(this));
+ }.bind(this));*/
return (
<div>
<h3>{this.props.data.name}</h3>
<ul className="list-unstyled">
- {playerLists}
+
</ul>
</div>
); |
cdbdeffd8b56046526a7b78822eb463aea1befb7 | react-client/src/components/CurrentInfo.jsx | react-client/src/components/CurrentInfo.jsx | import React from 'react';
import Moment from 'react-moment';
import WeatherInfo from './WeatherInfo.jsx';
const CurrentInfo = (props) => (
<div className='current-info'>
<h3> Current Information </h3>
<hr className='divider'/>
<p><span className='bold'>Current TripId:  </span>{props.trip._id}</p>
<p><span className='bold'>Trip Dates:  </span><Moment format='YYYY/MM/DD' date={props.startDate}/> - <Moment format='YYYY/MM/DD' date={props.endDate}/></p>
<div className='weather-infos'>
<p> <span className='bold'>Current Weather:</span></p>
{props.weathers.map((weather, index) => <WeatherInfo key={index} weather={weather} />)}
</div>
<div className='currency-info'>
<p><span className='bold'>Currency Info :</span></p>
</div>
</div>
);
export default CurrentInfo; | import React from 'react';
import Moment from 'react-moment';
import WeatherInfo from './WeatherInfo.jsx';
const CurrentInfo = (props) => (
<div className='current-info'>
<h3> Current Information </h3>
<hr className='divider'/>
<p><span className='bold'>Current TripId:  </span>{props.trip._id}</p>
<p><span className='bold'>Trip Dates:  </span><Moment format='YYYY/MM/DD' date={props.startDate}/> - <Moment format='YYYY/MM/DD' date={props.endDate}/></p>
<div className='weather-infos'>
<p> <span className='bold'>Current Weather:</span></p>
{props.weathers.map((weather, index) => <WeatherInfo key={index} weather={weather} />)}
</div>
<div className='currency-info'>
<p><span className='bold'>Currency Info:  </span> 1 USD = 0.85 Euro, 6.64 Yuan, 112.49 Yen, 58.16 Ruble</p>
</div>
</div>
);
export default CurrentInfo; | Add some static currency exchange info - need to implement live currency exchange component in the future | Add some static currency exchange info - need to implement live currency exchange component in the future
| JSX | mit | kennyxcao/funtrip,ChocolateMafia/funtrip,kennyxcao/funtrip,ChocolateMafia/funtrip | ---
+++
@@ -15,7 +15,7 @@
</div>
<div className='currency-info'>
- <p><span className='bold'>Currency Info :</span></p>
+ <p><span className='bold'>Currency Info:  </span> 1 USD = 0.85 Euro, 6.64 Yuan, 112.49 Yen, 58.16 Ruble</p>
</div>
</div>
); |
b7631639dfda02cbeac5aefd26fc4c045e4949f5 | client-src/js/authenticated.jsx | client-src/js/authenticated.jsx | var React = require('react');
var Router = require('./modules/router');
var Route = Router.statics.Route;
var Redirect = Router.statics.Redirect;
var DefaultRoute = Router.statics.DefaultRoute;
// Get all our statics and data
require('./Includes');
// Prep the stores and actions
var PlayerActions = require('./app/game/PlayerActions');
var ItemsStore = require('./app/game/ItemsStore');
var PlayerStore = require('./app/game/PlayerStore');
PlayerActions.loadPreviousGame();
var routes = (
<Route handler={require('./ui/Layout')}>
<DefaultRoute name="game" handler={require('./ui/game/Index')}/>
<Route name="debug" path="/debug" handler={require('./ui/debug/Index')} />
</Route>
);
Router.initialize(routes, window.document.body); | if(process.env.NODE_ENV !== 'development'){
require('./modules/immutable').Freezer.disable();
}
var React = require('react');
var Router = require('./modules/router');
var Route = Router.statics.Route;
var Redirect = Router.statics.Redirect;
var DefaultRoute = Router.statics.DefaultRoute;
// Get all our statics and data
require('./Includes');
// Prep the stores and actions
var PlayerActions = require('./app/game/PlayerActions');
var ItemsStore = require('./app/game/ItemsStore');
var PlayerStore = require('./app/game/PlayerStore');
PlayerActions.loadPreviousGame();
var routes = (
<Route handler={require('./ui/Layout')}>
<DefaultRoute name="game" handler={require('./ui/game/Index')}/>
<Route name="debug" path="/debug" handler={require('./ui/debug/Index')} />
</Route>
);
Router.initialize(routes, window.document.body); | Disable immutable freezing in non-dev | Disable immutable freezing in non-dev
| JSX | mit | EnzoMartin/Minesweeper-React,EnzoMartin/Minesweeper-React | ---
+++
@@ -1,3 +1,7 @@
+if(process.env.NODE_ENV !== 'development'){
+ require('./modules/immutable').Freezer.disable();
+}
+
var React = require('react');
var Router = require('./modules/router');
var Route = Router.statics.Route; |
c3e53eda833a5e73a658443a54df015738bd25e9 | client/components/FriendList.jsx | client/components/FriendList.jsx | import React, { Component } from 'react';
import {
Button,
ListGroup,
ListGroupItem,
Col,
Row,
Image
} from 'react-bootstrap';
const Friend = ({ username, avatar, profileLink }) =>
(<ListGroupItem className="list-item justify-content-center">
<Image
width="50"
height="50"
src={avatar}
alt="Avatar"
className="img-fluid rounded"
/>
<i className="fa fa-github fa-2x ml-1 mr-1" />
<Button href={profileLink} target="tab" className="no-padding mr-1">
<strong className="h5">
{username}
</strong>
</Button>
</ListGroupItem>);
class FriendList extends Component {
renderFriends() {
return (
<ListGroup className="h-100 mt-1">
{this.props.friends.map(friend =>
(<Friend
key={friend.username}
username={friend.username}
avatar={friend.avatar}
profileLink={friend.profileLink}
/>)
)}
</ListGroup>
);
}
render() {
return (
<Col sm={12} className="no-padding h-100">
{this.props.friends.length === 0
? <h3 className="lead">You have no followers or following yet</h3>
: this.renderFriends()}
</Col>
);
}
}
export default FriendList;
| import React, { Component } from 'react';
import {
Button,
ListGroup,
ListGroupItem,
Col,
Row,
Image
} from 'react-bootstrap';
const Friend = ({ username, avatar, profileLink }) =>
(<ListGroupItem className="list-item justify-content-left">
<Image
width="50"
height="50"
src={avatar}
alt="Avatar"
className="img-fluid rounded"
/>
<i className="fa fa-github fa-2x ml-1 mr-1" />
<Button href={profileLink} target="tab" className="no-padding mr-1">
<strong className="h5">
{username}
</strong>
</Button>
</ListGroupItem>);
class FriendList extends Component {
renderFriends() {
return (
<ListGroup className="h-100 mt-1">
{this.props.friends.map(friend =>
(<Friend
key={friend.username}
username={friend.username}
avatar={friend.avatar}
profileLink={friend.profileLink}
/>)
)}
</ListGroup>
);
}
render() {
return (
<Col sm={12} className="no-padding h-100">
{this.props.friends.length === 0
? <h3 className="lead">You have no followers or following yet</h3>
: this.renderFriends()}
</Col>
);
}
}
export default FriendList;
| Align similar friend list items | Align similar friend list items
| JSX | mit | novicasarenac/pathfinder,novicasarenac/pathfinder | ---
+++
@@ -9,7 +9,7 @@
} from 'react-bootstrap';
const Friend = ({ username, avatar, profileLink }) =>
- (<ListGroupItem className="list-item justify-content-center">
+ (<ListGroupItem className="list-item justify-content-left">
<Image
width="50"
height="50" |
1df507b1eaeb94fbcfed227d54c7356955b50610 | src/components/cover-image.jsx | src/components/cover-image.jsx | import { css } from 'glamor';
import PropTypes from 'prop-types';
import React from 'react';
import { ASPECT_RATIO_21_9_RELATIVE_HEIGHT, IMAGE_OVERLAY_TINT } from '../utils/presets';
const CoverImage = ({
alt, sizes, src, srcSet, ...props
}) => (
<div
{...css({
background: IMAGE_OVERLAY_TINT,
height: `${ASPECT_RATIO_21_9_RELATIVE_HEIGHT}vw`,
marginBottom: '-10rem',
})}
{...props}
>
{src != null && (
<div {...css({ height: '100%', position: 'relative' })}>
<img
alt={alt}
sizes={sizes}
src={src}
srcSet={srcSet}
{...css({
height: '100%',
objectFit: 'cover',
position: 'absolute',
width: '100%',
})}
/>
<div
{...css({
background: 'linear-gradient(transparent 62%, rgba(0, 0, 0, 0.62))',
height: '100%',
position: 'relative',
})}
/>
</div>
)}
</div>
);
CoverImage.propTypes = {
alt: PropTypes.string,
sizes: PropTypes.string,
src: PropTypes.string,
srcSet: PropTypes.string,
};
CoverImage.defaultProps = {
alt: 'Borító',
sizes: null,
src: null,
srcSet: null,
};
export default CoverImage;
| import { css } from 'glamor';
import PropTypes from 'prop-types';
import React from 'react';
import { ASPECT_RATIO_21_9_RELATIVE_HEIGHT, IMAGE_OVERLAY_TINT } from '../utils/presets';
const CoverImage = ({
sizes, src, srcSet, ...props
}) => (
<div
{...css({
background: IMAGE_OVERLAY_TINT,
height: `${ASPECT_RATIO_21_9_RELATIVE_HEIGHT}vw`,
marginBottom: '-10rem',
})}
{...props}
>
{src != null && (
<div {...css({ height: '100%', position: 'relative' })}>
<img
alt=""
sizes={sizes}
src={src}
srcSet={srcSet}
{...css({
height: '100%',
objectFit: 'cover',
position: 'absolute',
width: '100%',
})}
/>
<div
{...css({
background: 'linear-gradient(transparent 62%, rgba(0, 0, 0, 0.62))',
height: '100%',
position: 'relative',
})}
/>
</div>
)}
</div>
);
CoverImage.propTypes = {
sizes: PropTypes.string,
src: PropTypes.string,
srcSet: PropTypes.string,
};
CoverImage.defaultProps = {
sizes: null,
src: null,
srcSet: null,
};
export default CoverImage;
| Remove meaningless img alt from cover images | Remove meaningless img alt from cover images
| JSX | mit | simonyiszk/mvk-web,simonyiszk/mvk-web | ---
+++
@@ -4,7 +4,7 @@
import { ASPECT_RATIO_21_9_RELATIVE_HEIGHT, IMAGE_OVERLAY_TINT } from '../utils/presets';
const CoverImage = ({
- alt, sizes, src, srcSet, ...props
+ sizes, src, srcSet, ...props
}) => (
<div
{...css({
@@ -17,7 +17,7 @@
{src != null && (
<div {...css({ height: '100%', position: 'relative' })}>
<img
- alt={alt}
+ alt=""
sizes={sizes}
src={src}
srcSet={srcSet}
@@ -42,14 +42,12 @@
);
CoverImage.propTypes = {
- alt: PropTypes.string,
sizes: PropTypes.string,
src: PropTypes.string,
srcSet: PropTypes.string,
};
CoverImage.defaultProps = {
- alt: 'Borító',
sizes: null,
src: null,
srcSet: null, |
1f4c8a3c1710c9df90a9f6d1ad23cc731a34f875 | app/components/UserIsTyping.jsx | app/components/UserIsTyping.jsx | import React, { Component } from 'react'
import PropTypes from '../lib/PropTypes'
export default class UserIsTyping extends Component {
static propTypes = {
user: PropTypes.string.isRequired
}
state = {
dots: ''
}
updateDots () {
setTimeout(() => {
const dots = (this.state.dots.length >= 3) ? '' : this.state.dots + '.'
this.setState({ dots })
this.updateDots()
}, 300)
}
componentDidMount () {
this.updateDots()
}
render () {
return <p className="govuk-gray-1 f5">
{this.props.user} is typing{this.state.dots}
</p>
}
}
| import React, { Component } from 'react'
import PropTypes from '../lib/PropTypes'
export default class UserIsTyping extends Component {
static propTypes = {
user: PropTypes.string.isRequired
}
state = {
dots: ''
}
updateDots () {
setTimeout(() => {
if (!this._stopDots) {
const dots = (this.state.dots.length >= 3) ? '' : this.state.dots + '.'
this.setState({ dots })
this.updateDots()
}
}, 300)
}
componentDidMount () {
this.updateDots()
}
componentWillUnmount () {
this._stopDots = true
}
render () {
return <p className="govuk-gray-1 f5">
{this.props.user} is typing{this.state.dots}
</p>
}
}
| Stop dots when component is unmounted | Stop dots when component is unmounted
| JSX | mit | quis/notify-public-research-prototype,quis/notify-public-research-prototype,quis/notify-public-research-prototype | ---
+++
@@ -12,14 +12,20 @@
updateDots () {
setTimeout(() => {
- const dots = (this.state.dots.length >= 3) ? '' : this.state.dots + '.'
- this.setState({ dots })
- this.updateDots()
+ if (!this._stopDots) {
+ const dots = (this.state.dots.length >= 3) ? '' : this.state.dots + '.'
+ this.setState({ dots })
+ this.updateDots()
+ }
}, 300)
}
componentDidMount () {
this.updateDots()
+ }
+
+ componentWillUnmount () {
+ this._stopDots = true
}
render () { |
fb6f60f671882b7bae958eb4de57bef9d11e9417 | app/views/Navbar/NavbarTabs.jsx | app/views/Navbar/NavbarTabs.jsx | import React from 'react';
import FlatButton from 'material-ui/FlatButton';
import ActionHome from 'material-ui/svg-icons/action/home';
const NavbarTabs = () => (
<div>
<FlatButton label="Home" icon={<ActionHome />} />
<FlatButton label="Login" />
</div>
);
export default NavbarTabs;
| import React from 'react';
import FlatButton from 'material-ui/FlatButton';
import ActionHome from 'material-ui/svg-icons/action/home';
const styles = {
button: {
marginTop: '5px',
},
};
const NavbarTabs = () => (
<div>
<FlatButton style={styles.button} label="Home" icon={<ActionHome />} />
<FlatButton style={styles.button} label="Login" />
</div>
);
export default NavbarTabs;
| Add small margin to top buttons | Add small margin to top buttons
| JSX | mit | AlbertoALopez/polling,AlbertoALopez/polling | ---
+++
@@ -2,10 +2,16 @@
import FlatButton from 'material-ui/FlatButton';
import ActionHome from 'material-ui/svg-icons/action/home';
+const styles = {
+ button: {
+ marginTop: '5px',
+ },
+};
+
const NavbarTabs = () => (
<div>
- <FlatButton label="Home" icon={<ActionHome />} />
- <FlatButton label="Login" />
+ <FlatButton style={styles.button} label="Home" icon={<ActionHome />} />
+ <FlatButton style={styles.button} label="Login" />
</div>
);
|
2b58393097a30a8cdd8beef10c29b1be7087cf5b | src/components/Pages/Home/CardItem.jsx | src/components/Pages/Home/CardItem.jsx | import React from 'react';
import { Link,hashHistory } from 'react-router'
import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card';
class CardItem extends React.Component {
render() {
const { title, description,images,host } = this.props.activity;
return (
<Card style={{boxShadow: '0 2px 4px rgba(0,0,0,.15)', width: '48%', display:'inline-block', margin: '3px'}}
onClick={() => {hashHistory.push({pathname: '/guest',query: {title}}) }}>
<CardMedia
overlay={<CardTitle title="My Kitchen" style={{padding: '0px',}} titleStyle={{fontSize: '18px',paddingLeft: '10px'}}/>}>
<img src={images[0]} style={{height: '210px',}}/>
</CardMedia>
<CardHeader avatar={host.avatar}
style={{padding: '0px',float: 'right', width: '40px', margin: '2px 2px 0',}}/>
<CardTitle style={{padding: '4px', borderBottom: 'solid 0.2px #dce0e3',}} title={title}
titleStyle={{fontSize: '17px'}}/>
<CardText>
{description}
</CardText>
</Card>
)
}
}
export default CardItem; | import React from 'react';
import { Link,hashHistory } from 'react-router'
import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card';
class CardItem extends React.Component {
render() {
const { title, description,images,host } = this.props.activity;
let image = images ? images[0] : 'images/food/pie.png';
let avatar = host.avatar || 'images/avatar/cook0.png';
return (
<Card style={{boxShadow: '0 2px 4px rgba(0,0,0,.15)', width: '48%', display:'inline-block', margin: '3px'}}
onClick={() => {hashHistory.push({pathname: '/guest',query: {title}}) }}>
<CardMedia
overlay={<CardTitle title="My Kitchen" style={{padding: '0px',}} titleStyle={{fontSize: '18px',paddingLeft: '10px'}}/>}>
<img src={image} style={{height: '210px',}}/>
</CardMedia>
<CardHeader avatar={avatar}
style={{padding: '0px',float: 'right', width: '40px', margin: '2px 2px 0',}}/>
<CardTitle style={{padding: '4px', borderBottom: 'solid 0.2px #dce0e3',}} title={title}
titleStyle={{fontSize: '17px'}}/>
<CardText>
{description}
</CardText>
</Card>
)
}
}
export default CardItem; | Fix HomePage data without default iamge would crash bug | Fix HomePage data without default iamge would crash bug
| JSX | mit | joshua-meng/DinningShare,joshua-meng/DinningShare,joshua-meng/DinningShare | ---
+++
@@ -6,14 +6,17 @@
render() {
const { title, description,images,host } = this.props.activity;
+ let image = images ? images[0] : 'images/food/pie.png';
+ let avatar = host.avatar || 'images/avatar/cook0.png';
+
return (
<Card style={{boxShadow: '0 2px 4px rgba(0,0,0,.15)', width: '48%', display:'inline-block', margin: '3px'}}
onClick={() => {hashHistory.push({pathname: '/guest',query: {title}}) }}>
<CardMedia
overlay={<CardTitle title="My Kitchen" style={{padding: '0px',}} titleStyle={{fontSize: '18px',paddingLeft: '10px'}}/>}>
- <img src={images[0]} style={{height: '210px',}}/>
+ <img src={image} style={{height: '210px',}}/>
</CardMedia>
- <CardHeader avatar={host.avatar}
+ <CardHeader avatar={avatar}
style={{padding: '0px',float: 'right', width: '40px', margin: '2px 2px 0',}}/>
<CardTitle style={{padding: '4px', borderBottom: 'solid 0.2px #dce0e3',}} title={title}
titleStyle={{fontSize: '17px'}}/> |
de036f8eb84e7e3ea21aebd8dc0c751a35c74e59 | samples/msal-react-samples/react-router-sample/src/ui-components/SignOutButton.jsx | samples/msal-react-samples/react-router-sample/src/ui-components/SignOutButton.jsx | import { useState } from "react";
import { useMsal } from "@azure/msal-react";
import IconButton from '@material-ui/core/IconButton';
import AccountCircle from '@material-ui/icons/AccountCircle';
import MenuItem from '@material-ui/core/MenuItem';
import Menu from '@material-ui/core/Menu';
export const SignOutButton = () => {
const { instance } = useMsal();
const [anchorEl, setAnchorEl] = useState(null);
const open = Boolean(anchorEl);
const handleLogout = () => {
setAnchorEl(null);
instance.logout();
}
return (
<div>
<IconButton
onClick={(event) => setAnchorEl(event.currentTarget)}
color="inherit"
>
<AccountCircle />
</IconButton>
<Menu
id="menu-appbar"
anchorEl={anchorEl}
anchorOrigin={{
vertical: 'top',
horizontal: 'right',
}}
keepMounted
transformOrigin={{
vertical: 'top',
horizontal: 'right',
}}
open={open}
onClose={() => setAnchorEl(null)}
>
<MenuItem onClick={handleLogout}>Logout</MenuItem>
</Menu>
</div>
)
}; | import { useState } from "react";
import { useMsal } from "@azure/msal-react";
import IconButton from '@material-ui/core/IconButton';
import AccountCircle from '@material-ui/icons/AccountCircle';
import MenuItem from '@material-ui/core/MenuItem';
import Menu from '@material-ui/core/Menu';
export const SignOutButton = () => {
const { instance } = useMsal();
const [anchorEl, setAnchorEl] = useState(null);
const open = Boolean(anchorEl);
const handleLogout = (logoutType) => {
setAnchorEl(null);
if (logoutType === "popup") {
instance.logoutPopup();
} else if (logoutType === "redirect") {
instance.logoutRedirect();
}
}
return (
<div>
<IconButton
onClick={(event) => setAnchorEl(event.currentTarget)}
color="inherit"
>
<AccountCircle />
</IconButton>
<Menu
id="menu-appbar"
anchorEl={anchorEl}
anchorOrigin={{
vertical: 'top',
horizontal: 'right',
}}
keepMounted
transformOrigin={{
vertical: 'top',
horizontal: 'right',
}}
open={open}
onClose={() => setAnchorEl(null)}
>
<MenuItem onClick={() => handleLogout("popup")} key="logoutPopup">Logout using Popup</MenuItem>
<MenuItem onClick={() => handleLogout("redirect")} key="logoutRedirect">Logout using Redirect</MenuItem>
</Menu>
</div>
)
}; | Add logoutPopup to react sample | Add logoutPopup to react sample
| JSX | mit | AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js | ---
+++
@@ -11,9 +11,14 @@
const [anchorEl, setAnchorEl] = useState(null);
const open = Boolean(anchorEl);
- const handleLogout = () => {
+ const handleLogout = (logoutType) => {
setAnchorEl(null);
- instance.logout();
+
+ if (logoutType === "popup") {
+ instance.logoutPopup();
+ } else if (logoutType === "redirect") {
+ instance.logoutRedirect();
+ }
}
return (
@@ -39,7 +44,8 @@
open={open}
onClose={() => setAnchorEl(null)}
>
- <MenuItem onClick={handleLogout}>Logout</MenuItem>
+ <MenuItem onClick={() => handleLogout("popup")} key="logoutPopup">Logout using Popup</MenuItem>
+ <MenuItem onClick={() => handleLogout("redirect")} key="logoutRedirect">Logout using Redirect</MenuItem>
</Menu>
</div>
) |
6fab0279a11a0a7d8e584a4d364625880df3d644 | src/components/chart.jsx | src/components/chart.jsx | // should it be a functional or class-based component?
// --> FUNCTIONAL - because it takes props from its parent
// and is not connected to state.
import React from 'react';
import { Sparklines, SparklinesLine, SparklinesReferenceLine } from 'react-sparklines';
export default (props) => {
return (
<td>
<Sparklines data={props.data}>
<SparklinesLine color={props.color} />
<SparklinesReferenceLine type="avg" />
</Sparklines>
</td>
);
} | // should it be a functional or class-based component?
// --> FUNCTIONAL - because it takes props from its parent
// and is not connected to state.
import React from 'react';
import { Sparklines, SparklinesLine, SparklinesReferenceLine } from 'react-sparklines';
export default (props) => {
const length = props.data.length;
const total = props.data.reduce(function(acc, i) {
return acc + i;
}, 0);
const average = (total/length).toFixed(2);
return (
<td>
<Sparklines data={props.data}>
<SparklinesLine color={props.color} />
<SparklinesReferenceLine type="avg" />
</Sparklines>
<div>Average: {average}</div>
</td>
);
} | Add average nums to graphs (JS, no lodash) | Add average nums to graphs (JS, no lodash)
| JSX | mit | Alex-Windle/redux_weather_API,Alex-Windle/redux_weather_API | ---
+++
@@ -5,12 +5,19 @@
import { Sparklines, SparklinesLine, SparklinesReferenceLine } from 'react-sparklines';
export default (props) => {
+ const length = props.data.length;
+ const total = props.data.reduce(function(acc, i) {
+ return acc + i;
+ }, 0);
+ const average = (total/length).toFixed(2);
+
return (
<td>
<Sparklines data={props.data}>
<SparklinesLine color={props.color} />
<SparklinesReferenceLine type="avg" />
</Sparklines>
+ <div>Average: {average}</div>
</td>
);
} |
18ce2c8c39b8dbf0e4125d2bdbf0eb878f6b68bb | client/app/main.jsx | client/app/main.jsx | import React from 'react';
import ReactDom from 'react-dom';
import Form from './components/form.jsx';
let appContainer = document.querySelector('#app');
ReactDom.render(<Form title='My Cool Form' />, appContainer);
| import React from 'react';
import ReactDom from 'react-dom';
import Form from './components/form.jsx';
import Cypher from './utils/cypher';
let appContainer = document.querySelector('#app');
let formTitle = Cypher.cypher('My Cool Form');
ReactDom.render(<Form title={formTitle} />, appContainer);
| Use util module on the form's title | Use util module on the form's title
| JSX | mit | santiaro90/javascript-builds,santiaro90/javascript-builds | ---
+++
@@ -3,5 +3,9 @@
import Form from './components/form.jsx';
+import Cypher from './utils/cypher';
+
let appContainer = document.querySelector('#app');
-ReactDom.render(<Form title='My Cool Form' />, appContainer);
+
+let formTitle = Cypher.cypher('My Cool Form');
+ReactDom.render(<Form title={formTitle} />, appContainer); |
2ffe8dcafd3b0c47ccf2da25bff27f9913fc678a | ui/src/test_auth_container.jsx | ui/src/test_auth_container.jsx | /* @flow weak */
import React from 'react';
import AuthContainer from './auth_container.jsx';
import sinon from 'sinon';
// Testing only, used to inject an auth context.
export default React.createClass({
displayName: 'TestAuthContainer',
childContextTypes: AuthContainer.childContextTypes,
getChildContext() {
return {
auth: {
userProfile: {
email: '[email protected]'
},
doLogout: sinon.spy()
}
};
},
render() {
return this.props.children || null;
}
}); | /* @flow weak */
import React from 'react';
import AuthContainer from './auth_container.jsx';
import sinon from 'sinon';
// Testing only, used to inject an auth context.
export default React.createClass({
displayName: 'TestAuthContainer',
propTypes: {
children: React.PropTypes.element
},
childContextTypes: AuthContainer.childContextTypes,
getChildContext() {
return {
auth: {
userProfile: {
email: '[email protected]'
},
doLogout: sinon.spy()
}
};
},
render() {
return this.props.children;
}
}); | Allow children to be optional in TestAuthContainer, working around Flow warning | Allow children to be optional in TestAuthContainer, working around Flow warning
| JSX | mit | mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows,kesiena115/threeflows,kesiena115/threeflows,kesiena115/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows | ---
+++
@@ -7,6 +7,10 @@
// Testing only, used to inject an auth context.
export default React.createClass({
displayName: 'TestAuthContainer',
+
+ propTypes: {
+ children: React.PropTypes.element
+ },
childContextTypes: AuthContainer.childContextTypes,
@@ -22,6 +26,6 @@
},
render() {
- return this.props.children || null;
+ return this.props.children;
}
}); |
2093c8c17fb58d6e3476540f10385e7e3f4c986a | src/client/index.jsx | src/client/index.jsx | import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import App from './containers/App';
import configureStore from './store';
import { loadState, saveState } from './store/localStorage';
const preloadedState = loadState();
const store = configureStore(preloadedState);
// Saves changes to localstorage
store.subscribe( () => {
saveState(store.getState());
})
// Enable checking the store start at any point
window.storeState = store.getState();
console.info('Initial store:', store.getState());
ReactDOM.render(
<Provider store={store}>
<App/>
</Provider>,
document.querySelector('#App')
); | import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import App from './containers/App';
import configureStore from './store';
import { loadState, saveState } from './store/localStorage';
const isProd = process.env.NODE_ENV !== "production"
const preloadedState = isProd ? loadState() : undefined;
const store = configureStore(preloadedState);
// Saves changes to localstorage
store.subscribe( () => {
saveState(store.getState());
})
// Enable checking the store start at any point
window.storeState = store.getState();
console.info('Initial store:', store.getState());
ReactDOM.render(
<Provider store={store}>
<App/>
</Provider>,
document.querySelector('#App')
); | Disable loading state if not in production env | Disable loading state if not in production env
| JSX | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -7,7 +7,8 @@
import configureStore from './store';
import { loadState, saveState } from './store/localStorage';
-const preloadedState = loadState();
+const isProd = process.env.NODE_ENV !== "production"
+const preloadedState = isProd ? loadState() : undefined;
const store = configureStore(preloadedState);
// Saves changes to localstorage |
e9192d11186bf68c2f1813542e126dd308c95abb | imports/ui/containers/SearchEventsResultsContainer.jsx | imports/ui/containers/SearchEventsResultsContainer.jsx | import { Meteor } from 'meteor/meteor';
import { createContainer } from 'meteor/react-meteor-data';
import { _ } from 'meteor/underscore';
import { Events } from '../../api/events/events.js';
import SearchEventsResults from '../components/SearchEventsResults.jsx';
export default SearchEventsResultsContainer = createContainer((props) => {
const { query } = props;
let loading = false;
let results = [];
if (!_.isEmpty(query)) {
const eventsSubscribe = Meteor.subscribe('events.search', query);
loading = !eventsSubscribe.ready();
results = Events.find(query, { sort: { startDate: 1 } }).fetch();
}
return {
results: results,
loading: loading,
};
}, SearchEventsResults);
| import { Meteor } from 'meteor/meteor';
import { createContainer } from 'meteor/react-meteor-data';
import { _ } from 'meteor/underscore';
import { Events } from '../../api/events/events.js';
import SearchEventsResults from '../components/SearchEventsResults.jsx';
export default SearchEventsResultsContainer = createContainer((props) => {
const { query } = props;
let loading = false;
let results = [];
if (!_.isEmpty(query)) {
// Use an internal query so nothing strange gets passed straight through
let privateQuery = {};
if (query.locality && query.locality instanceof Array) {
privateQuery.locality = {
$in: query.locality
};
}
const eventsSubscribe = Meteor.subscribe('events.search', privateQuery);
loading = !eventsSubscribe.ready();
results = Events.find(privateQuery, { sort: { startDate: 1 } }).fetch();
}
return {
results: results,
loading: loading,
};
}, SearchEventsResults);
| Fix events locality filters that broke with react-router array tweaks. | Fix events locality filters that broke with react-router array tweaks.
| JSX | mit | howlround/worldtheatremap,howlround/worldtheatremap | ---
+++
@@ -10,9 +10,18 @@
let results = [];
if (!_.isEmpty(query)) {
- const eventsSubscribe = Meteor.subscribe('events.search', query);
+ // Use an internal query so nothing strange gets passed straight through
+ let privateQuery = {};
+
+ if (query.locality && query.locality instanceof Array) {
+ privateQuery.locality = {
+ $in: query.locality
+ };
+ }
+
+ const eventsSubscribe = Meteor.subscribe('events.search', privateQuery);
loading = !eventsSubscribe.ready();
- results = Events.find(query, { sort: { startDate: 1 } }).fetch();
+ results = Events.find(privateQuery, { sort: { startDate: 1 } }).fetch();
}
return { |
e0b490c0c6b38a1802491dc894d14c71953155f7 | js/ui/TreeView.jsx | js/ui/TreeView.jsx | import React, {PropTypes} from 'react';
export const TreeView = React.createClass({
propTypes: {
collapsed: PropTypes.bool,
defaultCollapsed: PropTypes.bool,
nodeLabel: PropTypes.node.isRequired,
className: PropTypes.string,
itemClassName: PropTypes.string,
},
getInitialState() {
return {collapsed: this.props.defaultCollapsed};
},
handleClick(...args) {
this.setState({collapsed: !this.state.collapsed});
if (this.props.onClick) {
this.props.onClick(...args);
}
},
render() {
const {
collapsed = this.state.collapsed,
className = '',
itemClassName = '',
nodeLabel,
children,
defaultCollapsed,
...rest,
} = this.props;
let arrowClassName = 'tree-view_arrow';
let containerClassName = 'tree-view_children';
if (collapsed) {
arrowClassName += ' tree-view_arrow-collapsed';
containerClassName += ' tree-view_children-collapsed';
}
const arrow =
<div
{...rest}
className={className + ' ' + arrowClassName}
onClick={this.handleClick}/>;
return (
<div className="tree-view">
<div className={'tree-view_item ' + itemClassName}>
{children ? arrow : <span> </span>}
{nodeLabel}
</div>
<div className={containerClassName}>
{children}
</div>
</div>
);
},
});
export default TreeView; | import React, {PropTypes} from 'react';
export const TreeView = React.createClass({
propTypes: {
collapsed: PropTypes.bool,
defaultCollapsed: PropTypes.bool,
nodeLabel: PropTypes.node.isRequired,
className: PropTypes.string,
itemClassName: PropTypes.string,
},
getInitialState() {
return {collapsed: this.props.defaultCollapsed};
},
handleClick(...args) {
this.setState({collapsed: !this.state.collapsed});
if (this.props.onClick) {
this.props.onClick(...args);
}
},
render() {
const {
collapsed = this.state.collapsed,
className = '',
itemClassName = '',
nodeLabel,
children,
defaultCollapsed,
...rest
} = this.props;
let arrowClassName = 'tree-view_arrow';
let containerClassName = 'tree-view_children';
if (collapsed) {
arrowClassName += ' tree-view_arrow-collapsed';
containerClassName += ' tree-view_children-collapsed';
}
const arrow =
<div
{...rest}
className={className + ' ' + arrowClassName}
onClick={this.handleClick}/>;
return (
<div className="tree-view">
<div className={'tree-view_item ' + itemClassName}>
{children ? arrow : <span> </span>}
{nodeLabel}
</div>
<div className={containerClassName}>
{children}
</div>
</div>
);
},
});
export default TreeView; | Make all working again. Meteor version updated | Make all working again.
Meteor version updated
| JSX | mit | krizka/tools,krizka/tools | ---
+++
@@ -28,7 +28,7 @@
nodeLabel,
children,
defaultCollapsed,
- ...rest,
+ ...rest
} = this.props;
let arrowClassName = 'tree-view_arrow'; |
8f8394d1a3f729f251d926c450426083e811a546 | src/app/components/Post/ContentHtml.jsx | src/app/components/Post/ContentHtml.jsx | /* eslint-disable react/no-danger, no-undef */
import React from 'react';
import cheerio from 'cheerio';
import CaptureLinks from './CaptureLinks';
import * as libs from '../../libs';
const ContentHtml = ({ html, linksColor }) => {
const $ = cheerio.load(html);
$('a').attr('style', `color: ${libs.darkenColor(linksColor)};`).attr('target', '_blank');
$('img').each((i, e) => {
const src = $(e).attr('src');
if (src.startsWith('http://') && window.location.protocol === 'https:')
$(e).attr('src', `https://cors.worona.io/${src}`);
});
return (
<CaptureLinks>
<div
style={{ overflow: 'hidden' }}
className="content is-medium"
dangerouslySetInnerHTML={{ __html: $.html() }}
/>
</CaptureLinks>
);
};
ContentHtml.propTypes = {
html: React.PropTypes.string,
linksColor: React.PropTypes.string,
};
export default ContentHtml;
| /* eslint-disable react/no-danger, no-undef */
import React from 'react';
import cheerio from 'cheerio';
import CaptureLinks from './CaptureLinks';
import * as libs from '../../libs';
const ContentHtml = ({ html, linksColor }) => {
const $ = cheerio.load(html);
$('a').attr('style', `color: ${libs.darkenColor(linksColor)};`).attr('target', '_blank');
$('img').each((i, e) => {
const src = $(e).attr('src');
const srcset = $(e).attr('srcset');
if (src.startsWith('http://') && window.location.protocol === 'https:') {
$(e).attr('src', `https://cors.worona.io/${src}`);
$(e).attr('srcset', srcset.replace(/http:\/\//g, 'https://cors.worona.io/http://'));
}
});
return (
<CaptureLinks>
<div
style={{ overflow: 'hidden' }}
className="content is-medium"
dangerouslySetInnerHTML={{ __html: $.html() }}
/>
</CaptureLinks>
);
};
ContentHtml.propTypes = {
html: React.PropTypes.string,
linksColor: React.PropTypes.string,
};
export default ContentHtml;
| Change srcset (responsive) as well. | Change srcset (responsive) as well.
| JSX | mit | worona/starter-app-theme-worona | ---
+++
@@ -9,8 +9,11 @@
$('a').attr('style', `color: ${libs.darkenColor(linksColor)};`).attr('target', '_blank');
$('img').each((i, e) => {
const src = $(e).attr('src');
- if (src.startsWith('http://') && window.location.protocol === 'https:')
+ const srcset = $(e).attr('srcset');
+ if (src.startsWith('http://') && window.location.protocol === 'https:') {
$(e).attr('src', `https://cors.worona.io/${src}`);
+ $(e).attr('srcset', srcset.replace(/http:\/\//g, 'https://cors.worona.io/http://'));
+ }
});
return (
<CaptureLinks> |
a4e3d0a09df2b3aa4e4d7166ac07d1f3505ddcc0 | js/containers/App.jsx | js/containers/App.jsx | import React, { Component } from 'react';
import { provide } from 'react-redux';
import Router, { Redirect, Route } from 'react-router';
import { history } from 'react-router/lib/BrowserHistory';
import { applyMiddleware, combineReducers, createStore } from 'redux';
import thunk from 'redux-thunk';
import { TodoApp } from '../components';
import * as reducers from '../reducers';
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore);
const reducer = combineReducers(reducers);
const store = createStoreWithMiddleware(reducer);
@provide(store)
export default class App extends Component {
render() {
return (
<Router history={history}>
<Route path="todos" component={TodoApp}>
<Route path="all" />
<Route path="active" />
<Route path="completed" />
</Route>
<Redirect from="/" to="/todos/all" />
</Router>
);
}
}
| import React, { Component } from 'react';
import { provide } from 'react-redux';
import Router, { Redirect, Route } from 'react-router';
import { history } from 'react-router/lib/BrowserHistory';
import { applyMiddleware, combineReducers, compose, createStore } from 'redux';
import thunk from 'redux-thunk';
import { TodoApp } from '../components';
import * as reducers from '../reducers';
const composedCreateStore = compose(
applyMiddleware(thunk),
createStore
);
const reducer = combineReducers(reducers);
const store = composedCreateStore(reducer);
@provide(store)
export default class App extends Component {
render() {
return (
<Router history={history}>
<Route path="todos" component={TodoApp}>
<Route path="all" />
<Route path="active" />
<Route path="completed" />
</Route>
<Redirect from="/" to="/todos/all" />
</Router>
);
}
}
| Use composition when defining 'custom' createStore method | Use composition when defining 'custom' createStore method
| JSX | mit | tough-griff/redux-react-router-todomvc,tough-griff/redux-react-router-todomvc | ---
+++
@@ -2,15 +2,18 @@
import { provide } from 'react-redux';
import Router, { Redirect, Route } from 'react-router';
import { history } from 'react-router/lib/BrowserHistory';
-import { applyMiddleware, combineReducers, createStore } from 'redux';
+import { applyMiddleware, combineReducers, compose, createStore } from 'redux';
import thunk from 'redux-thunk';
import { TodoApp } from '../components';
import * as reducers from '../reducers';
-const createStoreWithMiddleware = applyMiddleware(thunk)(createStore);
+const composedCreateStore = compose(
+ applyMiddleware(thunk),
+ createStore
+);
const reducer = combineReducers(reducers);
-const store = createStoreWithMiddleware(reducer);
+const store = composedCreateStore(reducer);
@provide(store)
export default class App extends Component { |
d2cc908db51a5494e019e8d9ac6d7d0045caff0c | src/components/Breadcrumb.jsx | src/components/Breadcrumb.jsx | import styles from '../styles/breadcrumb'
import React from 'react'
import { translate } from '../plugins/preact-polyglot'
import { withRouter } from 'react-router'
const Breadcrumb = ({ t, router }) => {
// extract elements from the pathNames
let path = router.location.pathname.match(/\/([^/]*)(.*)/)
// rootName is the first element before file path
const rootName = path[1]
// the remainder is the file path
const filePath = path[2]
const filePathElements = path[2].replace(/\/([^/]*)/, '$1').split('/')
return (
<h2 class={styles['fil-content-title']}>
{ t(`breadcrumb.title_${rootName}`) }
</h2>
)
}
export default translate()(withRouter(Breadcrumb))
| import styles from '../styles/breadcrumb'
import React from 'react'
import { translate } from '../plugins/preact-polyglot'
import { withRouter } from 'react-router'
const Breadcrumb = ({ t, router }) => {
// extract elements from the pathNames
let path = router.location.pathname.match(/\/([^/]*)(.*)/)
// rootName is the first element before file path
const rootName = path[1]
// the remainder is the file path
// const filePath = path[2]
// const filePathElements = path[2].replace(/\/([^/]*)/, '$1').split('/')
return (
<h2 class={styles['fil-content-title']}>
{ t(`breadcrumb.title_${rootName}`) }
</h2>
)
}
export default translate()(withRouter(Breadcrumb))
| Comment breadcrumb elements not used yet | [lint] Comment breadcrumb elements not used yet
| JSX | agpl-3.0 | enguerran/cozy-files-v3,enguerran/cozy-drive,cozy/cozy-files-v3,y-lohse/cozy-drive,goldoraf/cozy-drive,enguerran/cozy-drive,y-lohse/cozy-drive,enguerran/cozy-files-v3,y-lohse/cozy-files-v3,cozy/cozy-files-v3,y-lohse/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3,y-lohse/cozy-drive,y-lohse/cozy-files-v3,nono/cozy-files-v3,y-lohse/cozy-drive,enguerran/cozy-files-v3,goldoraf/cozy-drive,enguerran/cozy-files-v3,enguerran/cozy-drive,cozy/cozy-files-v3,goldoraf/cozy-drive,goldoraf/cozy-drive,nono/cozy-files-v3,cozy/cozy-files-v3,enguerran/cozy-drive | ---
+++
@@ -12,8 +12,8 @@
const rootName = path[1]
// the remainder is the file path
- const filePath = path[2]
- const filePathElements = path[2].replace(/\/([^/]*)/, '$1').split('/')
+ // const filePath = path[2]
+ // const filePathElements = path[2].replace(/\/([^/]*)/, '$1').split('/')
return (
<h2 class={styles['fil-content-title']}> |
0dc3bf7134a54f6cc9d50864b331ed24273ac81b | src/components/Manage/index.jsx | src/components/Manage/index.jsx | /* @flow */
import React from 'react';
import Relay, {createContainer} from 'react-relay';
type Friend = {
id: number,
name: string,
email: string,
wish: string,
};
type Props = {
app: {
group: {
title: string,
description: string,
friends: Array<Friend>,
},
},
};
const Manage = ({app: {group: {title, description, friends}}}: Props) =>
<main>
<h1>Manage</h1>
<dl>
<dt>Title</dt>
<dd>{title}</dd>
<dt>Description</dt>
<dd>{description}</dd>
<dt>Friends</dt>
<dd>
<ul>
{friends.map(({name, email, wish}: Friend, index) => (
<li key={index}>
Name: {name}<br />
Email: {email}<br />
Wish: {wish}
</li>
))}
</ul>
</dd>
<dt>Response</dt>
<dd>Didnt answer yet 👈 dont hardcode this</dd>
</dl>
</main>;
export default createContainer(Manage, {
initialVariables: {
groupId: null,
},
fragments: {
app: () => Relay.QL`
fragment on App {
group(id: $groupId) {
title,
description,
friends {
id,
name,
email,
wish,
},
}
}
`,
},
});
| /* @flow */
import React from 'react';
import Relay, {createContainer} from 'react-relay';
type Friend = {
id: number,
name: string,
email: string,
wish: string,
hash: string,
};
type Props = {
app: {
group: {
title: string,
description: string,
friends: Array<Friend>,
},
},
};
const Manage = ({app: {group: {title, description, friends}}}: Props) =>
<main>
<h1>Manage</h1>
<dl>
<dt>Title</dt>
<dd>{title}</dd>
<dt>Description</dt>
<dd>{description}</dd>
<dt>Friends</dt>
<dd>
<ul>
{friends.map(({name, email, wish, hash}: Friend, index) => (
<li key={index}>
Name: {name}<br />
Email: {email}<br />
Wish: {wish}<br />
Hash: {hash}
</li>
))}
</ul>
</dd>
<dt>Response</dt>
<dd>Didnt answer yet 👈 dont hardcode this</dd>
</dl>
</main>;
export default createContainer(Manage, {
initialVariables: {
groupId: null,
},
fragments: {
app: () => Relay.QL`
fragment on App {
group(id: $groupId) {
title,
description,
friends {
id,
name,
email,
wish,
hash,
},
}
}
`,
},
});
| Add hash to manage component | Add hash to manage component
| JSX | mit | WhosMySanta/app,WhosMySanta/whosmysanta,WhosMySanta/app | ---
+++
@@ -8,6 +8,7 @@
name: string,
email: string,
wish: string,
+ hash: string,
};
type Props = {
@@ -31,11 +32,12 @@
<dt>Friends</dt>
<dd>
<ul>
- {friends.map(({name, email, wish}: Friend, index) => (
+ {friends.map(({name, email, wish, hash}: Friend, index) => (
<li key={index}>
Name: {name}<br />
Email: {email}<br />
- Wish: {wish}
+ Wish: {wish}<br />
+ Hash: {hash}
</li>
))}
</ul>
@@ -61,6 +63,7 @@
name,
email,
wish,
+ hash,
},
}
} |
8eaf97932d3c3201555776907f8e711d8ecd8b63 | beavy/jsbeavy/views/HomeView.jsx | beavy/jsbeavy/views/HomeView.jsx | import React from 'react'
import { FormattedMessage, FormattedHTMLMessage } from 'react-intl'
export class HomeView extends React.Component {
render () {
return (
<div className='container text-center'>
<img src='http://beavy.xyz/logos/logo.svg' alt='beavy logo' width='150' />
<h1>
<FormattedMessage
id='hello-world-title'
description='Hello World Title'
defaultMessage='Wecome to Beavy!'
/>
</h1>
<FormattedHTMLMessage
tagname='p'
id='hello-world-docs-link'
defaultMessage={'Please take a look at the <a href="{link} target="_blank">documentation</a>.'}
link='https://beavyhq.gitbooks.io/beavy-documentation/content/'
/>
</div>
)
}
}
export default HomeView
| import React from 'react'
import { FormattedMessage, FormattedHTMLMessage } from 'react-intl'
export class HomeView extends React.Component {
render () {
return (
<div className='container text-center'>
<img src='http://beavy.xyz/logos/logo.svg' alt='beavy logo' width='150' />
<h1>
<FormattedMessage
id='hello-world-title'
description='Hello World Title'
defaultMessage='Wecome to Beavy!'
/>
</h1>
<FormattedHTMLMessage
tagname='p'
id='hello-world-docs-link'
defaultMessage={'Please take a look at the <a href="{link} target="_blank">documentation</a>.'}
values={{link: 'https://beavyhq.gitbooks.io/beavy-documentation/content/'}}
/>
</div>
)
}
}
export default HomeView
| Fix method of supplying i18n value in react-intl | Fix method of supplying i18n value in react-intl
| JSX | mpl-2.0 | beavyHQ/beavy,beavyHQ/beavy,beavyHQ/beavy,beavyHQ/beavy | ---
+++
@@ -17,7 +17,7 @@
tagname='p'
id='hello-world-docs-link'
defaultMessage={'Please take a look at the <a href="{link} target="_blank">documentation</a>.'}
- link='https://beavyhq.gitbooks.io/beavy-documentation/content/'
+ values={{link: 'https://beavyhq.gitbooks.io/beavy-documentation/content/'}}
/>
</div>
) |
57ba33cdb75746baa04f8accae85bf5b997bfd4d | src/CodeEditor.jsx | src/CodeEditor.jsx | import React from "react/addons"
var brace = require('brace');
var AceEditor = require('react-ace');
require('brace/mode/javascript')
require('brace/theme/github')
var $ = require('jquery') // needed for ajax
const RaisedButton = require('material-ui/lib/raised-button');
export default React.createClass({
getInitialState: function() {
return { source : 'alert("cats!");', changed : false };
},
code: function( text ) {
this.setState( { source : text, changed: true } );
return false;
},
script: function() {
var source = this.state.source;
console.log( source );
eval( source );
this.setState( { changed : false } )
},
submit: function() {
$.post( '/save', { 'source' : this.state.source }, function( res ) {
console.log( res );
} )
},
render: function() {
return <div>
<AceEditor mode="javascript" value={this.state.source} onChange={this.code} theme="github" editorProps={{$blockScrolling: true}} />
<RaisedButton onClick={this.script} primary={true} label="Test" />
<RaisedButton onClick={this.submit} disabled={this.state.changed} label="Ready" />
</div>
}
});
| import React from "react/addons"
var brace = require('brace');
var AceEditor = require('react-ace');
require('brace/mode/javascript')
require('brace/theme/github')
var $ = require('jquery') // needed for ajax
const RaisedButton = require('material-ui/lib/raised-button');
export default React.createClass({
getInitialState: function() {
return { source : 'alert("cats!");', changed : false };
},
code: function( text ) {
this.setState( { source : text, changed: true } );
return false;
},
script: function() {
var source = this.state.source;
console.log( source );
eval( source );
this.setState( { changed : false } )
},
submit: function() {
$.post( '/save', { 'source' : this.state.source }, function( res ) {
console.log( res );
} )
},
render: function() {
return <div>
<div>
<AceEditor mode="javascript" value={this.state.source} onChange={this.code} theme="github" editorProps={{$blockScrolling: true}} />
</div>
<div style={{'margin-top': '10px'}}>
<RaisedButton onClick={this.script} primary={true} label="Test" />
<RaisedButton onClick={this.submit} disabled={this.state.changed} label="Ready" />
</div>
</div>
}
});
| Add space between code, test and ready | Add space between code, test and ready
| JSX | mit | MuSiika/euhack-2015,MuSiika/euhack-2015 | ---
+++
@@ -37,9 +37,13 @@
render: function() {
return <div>
- <AceEditor mode="javascript" value={this.state.source} onChange={this.code} theme="github" editorProps={{$blockScrolling: true}} />
- <RaisedButton onClick={this.script} primary={true} label="Test" />
- <RaisedButton onClick={this.submit} disabled={this.state.changed} label="Ready" />
+ <div>
+ <AceEditor mode="javascript" value={this.state.source} onChange={this.code} theme="github" editorProps={{$blockScrolling: true}} />
+ </div>
+ <div style={{'margin-top': '10px'}}>
+ <RaisedButton onClick={this.script} primary={true} label="Test" />
+ <RaisedButton onClick={this.submit} disabled={this.state.changed} label="Ready" />
+ </div>
</div>
}
}); |
e8a8ed5d41283f875247e35423da80cebb219bfb | src/components/HistoryItem.jsx | src/components/HistoryItem.jsx | import React, {PropTypes} from "react";
import Moment from "moment";
class HistoryItem extends React.Component {
constructor(props) {
super(props);
}
render() {
const info = this.props.info;
const dateTime = Moment(info.lastVisitTime);
let formattedTime = dateTime.format("hh:mm:ss A");
if (this.props.stale) {
formattedTime = (<small className="text-muted history__date--stale" title="Last visited time">{dateTime.format("hh:mm A DD-MM-YYYY")}</small>);
}
const favicon = {
background: "url(chrome://favicon/" + info.url + ") no-repeat 1.25rem",
};
return (
<a href={info.url} className="list-group-item history__item" target="_blank">
<div className="history__url" style={favicon}>{info.title || info.url}</div>
<div className="history__date">{formattedTime}</div>
<div className="history__visits">
<span className="label label-default label-history" title="Total visits">
{info.visitCount}
</span>
</div>
</a>
);
}
}
export default HistoryItem; | import React, {PropTypes} from "react";
import Moment from "moment";
class HistoryItem extends React.Component {
constructor(props) {
super(props);
}
render() {
const info = this.props.info;
const dateTime = Moment(info.lastVisitTime);
let formattedTime = dateTime.format("hh:mm:ss A");
if (this.props.stale) {
formattedTime = (
<small className="text-muted history__date--stale" title="Last visited time">
{dateTime.format("hh:mm A, DD-MM-YYYY")}
</small>
);
}
const favicon = {
background: "url(chrome://favicon/" + info.url + ") no-repeat 1.25rem",
};
return (
<a href={info.url} className="list-group-item history__item" target="_blank">
<div className="history__url" style={favicon}>{info.title || info.url}</div>
<div className="history__date">{formattedTime}</div>
<div className="history__visits">
<span className="label label-default label-history" title="Total visits">
{info.visitCount}
</span>
</div>
</a>
);
}
}
export default HistoryItem; | Add a comma to separate time, and date | Add a comma to separate time, and date
| JSX | mit | MrSaints/historyx,MrSaints/historyx | ---
+++
@@ -12,7 +12,11 @@
const dateTime = Moment(info.lastVisitTime);
let formattedTime = dateTime.format("hh:mm:ss A");
if (this.props.stale) {
- formattedTime = (<small className="text-muted history__date--stale" title="Last visited time">{dateTime.format("hh:mm A DD-MM-YYYY")}</small>);
+ formattedTime = (
+ <small className="text-muted history__date--stale" title="Last visited time">
+ {dateTime.format("hh:mm A, DD-MM-YYYY")}
+ </small>
+ );
}
const favicon = { |
a3b8a917aad284a5c34ad0c5ed64cdb373d050e3 | 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}\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;
| 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.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;
| Remove the redundant error line | Remove the redundant error line
The error message is included in the first line of the stack
| JSX | bsd-3-clause | LLK/scratch-gui,LLK/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui | ---
+++
@@ -17,7 +17,7 @@
componentDidCatch (error, info) {
// Display fallback UI
this.setState({hasError: true});
- log.error(`Unhandled Error: ${error}\n${error.stack}\nComponent stack: ${info.componentStack}`);
+ log.error(`Unhandled Error: ${error.stack}\nComponent stack: ${info.componentStack}`);
analytics.event({
category: 'error',
action: 'Fatal Error', |
2467c019345daf0fd6e1a46659729d27718ca75b | app/Resources/client/jsx/organism/details/appendTraits.jsx | app/Resources/client/jsx/organism/details/appendTraits.jsx | /**
* Created by s216121 on 14.03.17.
*/
function appendTraitEntries(domElement, traitEntries, traitFormat){
$.ajax({
url: Routing.generate('api_details_trait_entries', {'dbversion': dbversion}),
data: {
"trait_entry_ids": traitEntries,
"trait_format": traitFormat
},
method: "GET",
success: function(result){
$.each(result, function (key, value) {
var realValue = value.valueName;
if(value.valueName === null){
realValue = value.valueDefinition;
}
let unitString = ""
if(value.unit != null){
unitString = " $"+ value.unit +"$"
}
let traitCitationDiv = $('<div class="trait-citation">').text(value.citation).css({'font-size': '11px'})
let originUrl = $(`<a href="${value.originUrl}">`).text(" origin")
if(value.originUrl != ""){
traitCitationDiv.append(originUrl)
}
domElement.append($('<div>').text(realValue+unitString).append(traitCitationDiv));
});
}
});
}
// export function globally
global.appendTraitEntries = appendTraitEntries; | /**
* Created by s216121 on 14.03.17.
*/
function appendTraitEntries(domElement, traitEntries, traitFormat){
$.ajax({
url: Routing.generate('api_details_trait_entries', {'dbversion': dbversion}),
data: {
"trait_entry_ids": traitEntries,
"trait_format": traitFormat
},
method: "POST",
success: function(result){
$.each(result, function (key, value) {
var realValue = value.valueName;
if(value.valueName === null){
realValue = value.valueDefinition;
}
let unitString = ""
if(value.unit != null){
unitString = " $"+ value.unit +"$"
}
let traitCitationDiv = $('<div class="trait-citation">').text(value.citation).css({'font-size': '11px'})
let originUrl = $(`<a href="${value.originUrl}">`).text(" origin")
if(value.originUrl != ""){
traitCitationDiv.append(originUrl)
}
domElement.append($('<div>').text(realValue+unitString).append(traitCitationDiv));
});
}
});
}
// export function globally
global.appendTraitEntries = appendTraitEntries; | Change GET to POST in ajax call | Change GET to POST in ajax call
| JSX | mit | molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec | ---
+++
@@ -9,7 +9,7 @@
"trait_entry_ids": traitEntries,
"trait_format": traitFormat
},
- method: "GET",
+ method: "POST",
success: function(result){
$.each(result, function (key, value) {
var realValue = value.valueName; |
2f35c71bbf6108bfad984c78b0a29b4b3d1aee53 | src/components/Footer.jsx | src/components/Footer.jsx | import React from 'react';
import { Link } from 'react-router';
import Icon from './Icons';
import iconPaths from '../data/iconPaths';
export default function Footer() {
return (
<div className="block footer">
<div className="wrap">
<div className="footer-nav">
<Link to="/">Home</Link>
<Link to="/portfolio">Portfolio</Link>
<Link to="/contact">Contact</Link>
</nav>
<div className="social">
{/* <a href="https://www.linkedin.com/in/andrew-wang-02573868">
<Icon className="icon" icon={iconPaths.linkedin} />
</a> */}
<a href="https://github.com/emyarod">
<Icon className="icon" icon={iconPaths.github} />
</a>
<a href="http://codepen.io/emyarod/">
<Icon className="icon" icon={iconPaths.codepen} />
</a>
</div>
<small className="text-center">
© {new Date().getFullYear()}, Andrew Wang
</small>
</div>
</div>
);
}
| import React from 'react';
import { Link } from 'react-router';
import Icon from './Icons';
import iconPaths from '../data/iconPaths';
export default function Footer() {
return (
<div className="block footer">
<div className="wrap">
<nav className="nav">
<Link to="/">Home</Link>
<Link to="/portfolio">Portfolio</Link>
<Link to="/contact">Contact</Link>
</nav>
<div className="social">
{/* <a href="https://www.linkedin.com/in/andrew-wang-02573868">
<Icon className="icon" icon={iconPaths.linkedin} />
</a> */}
<a href="https://github.com/emyarod">
<Icon className="icon" icon={iconPaths.github} />
</a>
<a href="http://codepen.io/emyarod/">
<Icon className="icon" icon={iconPaths.codepen} />
</a>
</div>
<small className="text-center">
© {new Date().getFullYear()}, Andrew Wang
</small>
</div>
</div>
);
}
| Add nav class to footer nav | Add nav class to footer nav
| JSX | mit | emyarod/afw,emyarod/afw | ---
+++
@@ -7,7 +7,7 @@
return (
<div className="block footer">
<div className="wrap">
- <div className="footer-nav">
+ <nav className="nav">
<Link to="/">Home</Link>
<Link to="/portfolio">Portfolio</Link>
<Link to="/contact">Contact</Link> |
b573aaa76533bb83f8a5aee90c0c8b897913ebc3 | src/containers/TrashToolbar.jsx | src/containers/TrashToolbar.jsx | import styles from '../styles/toolbar'
import React from 'react'
import { connect } from 'react-redux'
import { translate } from '../lib/I18n'
import Menu, { MenuButton, Item } from 'react-bosonic/lib/Menu'
import { showSelectionBar } from '../actions'
import { mustShowSelectionBar } from '../reducers'
const TrashToolbar = ({ t, error, isSelectionBarVisible, showSelectionBar }) => (
<div className={styles['fil-toolbar']} role='toolbar'>
<MenuButton>
<button
role='button'
className='coz-btn coz-btn--secondary coz-btn--more'
disabled={!!error || isSelectionBarVisible}
>
<span className='coz-hidden'>{ t('toolbar.item_more') }</span>
</button>
<Menu className={styles['fil-toolbar-menu']}>
<Item>
<a
className={styles['fil-action-delete']}
>
{t('toolbar.delete_all')}
</a>
</Item>
<hr />
<Item>
<a className={styles['fil-action-select']} onClick={showSelectionBar}>
{t('toolbar.menu_select')}
</a>
</Item>
</Menu>
</MenuButton>
</div>
)
const mapStateToProps = (state, ownProps) => ({
error: state.ui.error,
isSelectionBarVisible: mustShowSelectionBar(state)
})
const mapDispatchToProps = (dispatch, ownProps) => ({
showSelectionBar: () => {
dispatch(showSelectionBar())
}
})
export default connect(
mapStateToProps,
mapDispatchToProps
)(translate()(TrashToolbar))
| import styles from '../styles/toolbar'
import React from 'react'
import { connect } from 'react-redux'
import { translate } from '../lib/I18n'
import Menu, { MenuButton, Item } from 'react-bosonic/lib/Menu'
import { showSelectionBar } from '../actions'
import { mustShowSelectionBar } from '../reducers'
const TrashToolbar = ({ t, error, isSelectionBarVisible, showSelectionBar }) => (
<div className={styles['fil-toolbar']} role='toolbar'>
<MenuButton>
<button
role='button'
className='coz-btn coz-btn--secondary coz-btn--more'
disabled={!!error || isSelectionBarVisible}
>
<span className='coz-hidden'>{ t('toolbar.item_more') }</span>
</button>
<Menu className={styles['fil-toolbar-menu']}>
<Item>
<a className={styles['fil-action-select']} onClick={showSelectionBar}>
{t('toolbar.menu_select')}
</a>
</Item>
</Menu>
</MenuButton>
</div>
)
const mapStateToProps = (state, ownProps) => ({
error: state.ui.error,
isSelectionBarVisible: mustShowSelectionBar(state)
})
const mapDispatchToProps = (dispatch, ownProps) => ({
showSelectionBar: () => {
dispatch(showSelectionBar())
}
})
export default connect(
mapStateToProps,
mapDispatchToProps
)(translate()(TrashToolbar))
| Remove unused delete all button from trash view | [fix] Remove unused delete all button from trash view
| JSX | agpl-3.0 | y-lohse/cozy-drive,enguerran/cozy-files-v3,nono/cozy-files-v3,enguerran/cozy-files-v3,goldoraf/cozy-drive,enguerran/cozy-drive,y-lohse/cozy-files-v3,y-lohse/cozy-drive,y-lohse/cozy-files-v3,y-lohse/cozy-files-v3,goldoraf/cozy-drive,goldoraf/cozy-drive,enguerran/cozy-drive,nono/cozy-files-v3,enguerran/cozy-files-v3,goldoraf/cozy-drive,y-lohse/cozy-drive,cozy/cozy-files-v3,cozy/cozy-files-v3,enguerran/cozy-drive,cozy/cozy-files-v3,y-lohse/cozy-drive,nono/cozy-files-v3,enguerran/cozy-files-v3,enguerran/cozy-drive,cozy/cozy-files-v3,nono/cozy-files-v3 | ---
+++
@@ -20,14 +20,6 @@
<span className='coz-hidden'>{ t('toolbar.item_more') }</span>
</button>
<Menu className={styles['fil-toolbar-menu']}>
- <Item>
- <a
- className={styles['fil-action-delete']}
- >
- {t('toolbar.delete_all')}
- </a>
- </Item>
- <hr />
<Item>
<a className={styles['fil-action-select']} onClick={showSelectionBar}>
{t('toolbar.menu_select')} |
6df3ddeee82b58ea89b773c513dcdc9b75a41f02 | app/js/routes.jsx | app/js/routes.jsx | 'use strict';
import React from 'react';
import createHashHistory from 'history/lib/createHashHistory';
import {Router, Route, IndexRoute} from 'react-router';
import Layout from '../components/ui/lfb-main-layout/index.jsx';
import Home from '../components/pages/home.jsx';
import About from '../components/pages/about.jsx';
const history = createHashHistory({
queryKey: false
});
export default (
<Router history={history}>
<Route component={Layout} path="/">
<IndexRoute component={Home} />
<Route component={About} path="/about" />
</Route>
</Router>
);
| 'use strict';
import React from 'react';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import {Router, Route, IndexRoute} from 'react-router';
import Layout from '../components/ui/lfb-main-layout/index.jsx';
import Home from '../components/pages/home.jsx';
import About from '../components/pages/about.jsx';
export default (
<Router history={createBrowserHistory()}>
<Route component={Layout} path="/">
<IndexRoute component={Home} />
<Route component={About} path="/about" />
</Route>
</Router>
);
| Change router to use cleaner URLs | Change router to use cleaner URLs
| JSX | apache-2.0 | LittleFurryBastards/report-it,LittleFurryBastards/report-it | ---
+++
@@ -1,19 +1,15 @@
'use strict';
import React from 'react';
-import createHashHistory from 'history/lib/createHashHistory';
+import createBrowserHistory from 'history/lib/createBrowserHistory';
import {Router, Route, IndexRoute} from 'react-router';
import Layout from '../components/ui/lfb-main-layout/index.jsx';
import Home from '../components/pages/home.jsx';
import About from '../components/pages/about.jsx';
-const history = createHashHistory({
- queryKey: false
-});
-
export default (
- <Router history={history}>
+ <Router history={createBrowserHistory()}>
<Route component={Layout} path="/">
<IndexRoute component={Home} />
<Route component={About} path="/about" /> |
6d485f951f941e59666cc4f22aea27fcbcc4b7e7 | src/index.jsx | src/index.jsx | import React from 'react';
import ReactDOM from 'react-dom';
import appFactory from './components/app.jsx';
import todoListFactory from './components/todo-list.jsx';
const TodoList = todoListFactory();
const App = appFactory(TodoList);
ReactDOM.render(<App />, document.getElementById('root'));
| import React from 'react';
import ReactDOM from 'react-dom';
import App from '../tests/acceptance/app.setup.js';
ReactDOM.render(<App />, document.getElementById('root'));
| Remove app setup duplication between tests and demo | Remove app setup duplication between tests and demo
| JSX | mit | NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet | ---
+++
@@ -1,10 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
-import appFactory from './components/app.jsx';
-import todoListFactory from './components/todo-list.jsx';
-
-const TodoList = todoListFactory();
-const App = appFactory(TodoList);
+import App from '../tests/acceptance/app.setup.js';
ReactDOM.render(<App />, document.getElementById('root')); |
76af7dbb69ae958ac5ce6743f0a83c893ee3190b | src/mb/components/AppHeader.jsx | src/mb/components/AppHeader.jsx | import React from 'react';
export default class AppHeader extends React.Component {
constructor(props) {
super(props);
this.state = {
translucent: false
};
}
componentDidMount() {
$(window).on('scroll', () => {
this.setState({
translucent: document.body.scrollTop > 5
});
});
}
render() {
return (
<header className={`mb-app-header${this.state.translucent ? ' translucent' : ''}`}>
<div className="mb-logo" />
</header>
);
}
}
|
import cn from 'classnames';
import React from 'react';
export default class AppHeader extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
translucent: false
};
}
componentDidMount() {
$(window).on('scroll', () => {
const translucent = document.body.scrollTop > 5;
if (this.state.translucent !== translucent) {
this.setState({
translucent
});
}
});
}
render() {
const className = cn('mb-app-header', { translucent: this.state.translucent });
return (
<header className={className}>
<div className="mb-logo" />
</header>
);
}
}
| Use classnames to modify classname | Use classnames to modify classname
| JSX | mit | NJU-SAP/movie-board,MagicCube/movie-board,MagicCube/movie-board,NJU-SAP/movie-board,MagicCube/movie-board | ---
+++
@@ -1,6 +1,8 @@
+
+import cn from 'classnames';
import React from 'react';
-export default class AppHeader extends React.Component {
+export default class AppHeader extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
@@ -10,15 +12,19 @@
componentDidMount() {
$(window).on('scroll', () => {
- this.setState({
- translucent: document.body.scrollTop > 5
- });
+ const translucent = document.body.scrollTop > 5;
+ if (this.state.translucent !== translucent) {
+ this.setState({
+ translucent
+ });
+ }
});
}
render() {
+ const className = cn('mb-app-header', { translucent: this.state.translucent });
return (
- <header className={`mb-app-header${this.state.translucent ? ' translucent' : ''}`}>
+ <header className={className}>
<div className="mb-logo" />
</header>
); |
e992c9c5f12f2375221144cfa000c891ce6732b8 | lib/src/_shared/WithUtils.jsx | lib/src/_shared/WithUtils.jsx | import React from 'react';
import PropTypes from 'prop-types';
import { MuiPickersContextConsumer } from '../utils/MuiPickersUtilsProvider';
const WithUtils = () => (Component) => {
const withUtils = ({ pickerRef, ...props }) => (
<MuiPickersContextConsumer>
{utils => <Component ref={pickerRef} utils={utils} {...props} />}
</MuiPickersContextConsumer>
);
withUtils.displayName = `WithUtils(${Component.displayName || Component.name})`;
withUtils.propTypes = {
pickerRef: PropTypes.func,
};
withUtils.defaultProps = {
pickerRef: undefined,
};
return withUtils;
};
export default WithUtils;
| import React from 'react';
import PropTypes from 'prop-types';
import { MuiPickersContextConsumer } from '../utils/MuiPickersUtilsProvider';
const WithUtils = () => (Component) => {
const withUtils = props => (
<MuiPickersContextConsumer>
{utils => <Component utils={utils} {...props} />}
</MuiPickersContextConsumer>
);
withUtils.displayName = `WithUtils(${Component.displayName || Component.name})`;
withUtils.propTypes = {
pickerRef: PropTypes.func,
};
withUtils.defaultProps = {
pickerRef: undefined,
};
return withUtils;
};
export default WithUtils;
| Remove unused pickerRef prop forwarding | Remove unused pickerRef prop forwarding
| JSX | mit | oliviertassinari/material-ui,mui-org/material-ui,mui-org/material-ui,dmtrKovalenko/material-ui-pickers,mbrookes/material-ui,rscnt/material-ui,mui-org/material-ui,callemall/material-ui,callemall/material-ui,mbrookes/material-ui,rscnt/material-ui,oliviertassinari/material-ui,dmtrKovalenko/material-ui-pickers,oliviertassinari/material-ui,callemall/material-ui,callemall/material-ui,mbrookes/material-ui,rscnt/material-ui | ---
+++
@@ -3,9 +3,9 @@
import { MuiPickersContextConsumer } from '../utils/MuiPickersUtilsProvider';
const WithUtils = () => (Component) => {
- const withUtils = ({ pickerRef, ...props }) => (
+ const withUtils = props => (
<MuiPickersContextConsumer>
- {utils => <Component ref={pickerRef} utils={utils} {...props} />}
+ {utils => <Component utils={utils} {...props} />}
</MuiPickersContextConsumer>
);
|
0431d3b975bb863adb0ae3832c6d7f8da13136be | client/src/HouseInventoryList.jsx | client/src/HouseInventoryList.jsx | import HouseInventoryListItem from './HouseInventoryListItem.jsx';
var HouseInventoryList = (props) => {
return (
<div>
{props.items.map((item, index) =>
<HouseInventoryListItem
item = {item}
key = {index}
/>
)}
</div>
);
};
export default HouseInventoryList;
| import React from 'react';
import HouseInventoryListItem from './HouseInventoryListItem.jsx';
var HouseInventoryList = (props) => {
return (
<div>
{props.items.map((item, index) =>
<HouseInventoryListItem
item = {item}
key = {index}
/>
)}
</div>
);
};
export default HouseInventoryList;
| Fix syntax error in this.state | Fix syntax error in this.state
| JSX | mit | SentinelsOfMagic/SentinelsOfMagic | ---
+++
@@ -1,3 +1,4 @@
+import React from 'react';
import HouseInventoryListItem from './HouseInventoryListItem.jsx';
var HouseInventoryList = (props) => { |
5227da921abee2fc913ff87968d6738b1f139d0c | client/modules/core/components/header.jsx | client/modules/core/components/header.jsx | import React, { PropTypes } from 'react';
import {
Arrow,
Dropdown,
DropdownMenu,
Fixed,
NavItem,
Space,
Toolbar
} from 'rebass';
const Header = () => (
<Fixed top left right zIndex={1}>
<Toolbar>
<NavItem href="/" children="Home" />
<Space auto />
<NavItem href="/polls" children="Polls" />
<NavItem href="/polls/new" children="New Poll" />
<NavItem href="/polls/1" children="First Poll" />
</Toolbar>
</Fixed>
);
Header.propTypes = {};
export default Header;
| import React, { PropTypes } from 'react';
import {
Arrow,
Dropdown,
DropdownMenu,
Fixed,
NavItem,
Space,
Toolbar
} from 'rebass';
const Header = () => (
<Fixed top left right zIndex={1}>
<Toolbar>
<NavItem href="/" children="Home" />
<Space auto />
<NavItem href="/polls" children="Polls" />
<NavItem href="/polls/new" children="New Poll" />
</Toolbar>
</Fixed>
);
Header.propTypes = {};
export default Header;
| Remove First Poll link from Header | Remove First Poll link from Header
| JSX | mit | thancock20/voting-app,thancock20/voting-app | ---
+++
@@ -16,7 +16,6 @@
<Space auto />
<NavItem href="/polls" children="Polls" />
<NavItem href="/polls/new" children="New Poll" />
- <NavItem href="/polls/1" children="First Poll" />
</Toolbar>
</Fixed>
); |
ce5f39fa6f71486827ed6a83011694bec80c505f | src/components/Item.jsx | src/components/Item.jsx | import React from 'react'
const Item = React.createClass({
propTypes: {
onClick: React.PropTypes.func.isRequired,
name: React.PropTypes.string.isRequired,
price: React.PropTypes.number.isRequired,
stock: React.PropTypes.number.isRequired,
image: React.PropTypes.string
},
render: function () {
const { onClick, name, price, image } = this.props
return (
<div className='item-card waves-effect waves-green z-depth-1 hoverable' onClick={onClick}>
<img src={image} />
<div className='name-truncate'>{name}</div>
<div className='price grey-text'>{price} Kr.</div>
</div>
)
}
})
export default Item
| import React from 'react'
const Item = React.createClass({
propTypes: {
onClick: React.PropTypes.func.isRequired,
name: React.PropTypes.string.isRequired,
price: React.PropTypes.number.isRequired,
stock: React.PropTypes.number.isRequired,
image: React.PropTypes.string
},
render: function () {
const { onClick, name, price, image } = this.props
return (
<div className='item-card waves-effect z-depth-1 hoverable' onClick={onClick}>
<img src={image} />
<div className='name-truncate'>{name}</div>
<div className='price grey-text'>{price} Kr.</div>
</div>
)
}
})
export default Item
| Change wave-effect color on item card | Change wave-effect color on item card
| JSX | mit | nuxis/p0sX-client,nuxis/p0sX-client | ---
+++
@@ -11,7 +11,7 @@
render: function () {
const { onClick, name, price, image } = this.props
return (
- <div className='item-card waves-effect waves-green z-depth-1 hoverable' onClick={onClick}>
+ <div className='item-card waves-effect z-depth-1 hoverable' onClick={onClick}>
<img src={image} />
<div className='name-truncate'>{name}</div>
<div className='price grey-text'>{price} Kr.</div> |
6470b44d5a4969655b1c6459ecfac80022cfe027 | components/snackbar/Snackbar.jsx | components/snackbar/Snackbar.jsx | import React from 'react';
import ClassNames from 'classnames';
import Button from '../button';
import FontIcon from '../font_icon';
import Overlay from '../overlay';
import style from './style';
class Snackbar extends React.Component {
static propTypes = {
action: React.PropTypes.string,
active: React.PropTypes.bool,
className: React.PropTypes.string,
icon: React.PropTypes.any,
label: React.PropTypes.string.isRequired,
onClick: React.PropTypes.func,
onTimeout: React.PropTypes.func,
timeout: React.PropTypes.number,
type: React.PropTypes.string
};
componentDidUpdate () {
if (this.props.active && this.props.timeout) {
setTimeout(() => {
this.props.onTimeout();
}, this.props.timeout);
}
}
render () {
const {action, active, icon, label, onClick, type } = this.props;
const className = ClassNames([style.root, style[type]], {
[style.active]: active
}, this.props.className);
return (
<Overlay invisible>
<div data-react-toolbox='snackbar' className={className}>
{icon ? <FontIcon value={icon} className={style.icon} /> : null}
<span className={style.label}>{label}</span>
{action ? <Button className={style.button} label={action} onClick={onClick}/> : null}
</div>
</Overlay>
);
}
}
export default Snackbar;
| import React from 'react';
import ClassNames from 'classnames';
import Button from '../button';
import FontIcon from '../font_icon';
import Overlay from '../overlay';
import style from './style';
class Snackbar extends React.Component {
static propTypes = {
action: React.PropTypes.string,
active: React.PropTypes.bool,
className: React.PropTypes.string,
icon: React.PropTypes.any,
label: React.PropTypes.string.isRequired,
onClick: React.PropTypes.func,
onTimeout: React.PropTypes.func,
timeout: React.PropTypes.number,
type: React.PropTypes.string
};
state = {
curTimeout: null
};
componentWillReceiveProps (nextProps) {
if (nextProps.active && nextProps.timeout) {
if(this.state.curTimeout) clearTimeout(this.state.curTimeout);
let curTimeout = setTimeout(() => {
nextProps.onTimeout();
this.setState({
curTimeout: null
});
}, nextProps.timeout);
this.setState({
curTimeout
});
}
}
render () {
const {action, active, icon, label, onClick, type } = this.props;
const className = ClassNames([style.root, style[type]], {
[style.active]: active
}, this.props.className);
return (
<Overlay invisible>
<div data-react-toolbox='snackbar' className={className}>
{icon ? <FontIcon value={icon} className={style.icon} /> : null}
<span className={style.label}>{label}</span>
{action ? <Button className={style.button} label={action} onClick={onClick}/> : null}
</div>
</Overlay>
);
}
}
export default Snackbar;
| Change snackbar to fix issue where lingering timeouts would effect new activations | Change snackbar to fix issue where lingering timeouts would effect new activations
| JSX | mit | jasonleibowitz/react-toolbox,rubenmoya/react-toolbox,rubenmoya/react-toolbox,react-toolbox/react-toolbox,showings/react-toolbox,react-toolbox/react-toolbox,soyjavi/react-toolbox,showings/react-toolbox,soyjavi/react-toolbox,KerenChandran/react-toolbox,rubenmoya/react-toolbox,jasonleibowitz/react-toolbox,KerenChandran/react-toolbox,react-toolbox/react-toolbox | ---
+++
@@ -18,11 +18,24 @@
type: React.PropTypes.string
};
- componentDidUpdate () {
- if (this.props.active && this.props.timeout) {
- setTimeout(() => {
- this.props.onTimeout();
- }, this.props.timeout);
+ state = {
+ curTimeout: null
+ };
+
+ componentWillReceiveProps (nextProps) {
+ if (nextProps.active && nextProps.timeout) {
+ if(this.state.curTimeout) clearTimeout(this.state.curTimeout);
+
+ let curTimeout = setTimeout(() => {
+ nextProps.onTimeout();
+ this.setState({
+ curTimeout: null
+ });
+ }, nextProps.timeout);
+
+ this.setState({
+ curTimeout
+ });
}
}
|
3359b9c0ae3b31752ea3de3237e6b611bf0d26ae | src/components/recent-groups.jsx | src/components/recent-groups.jsx | import React from 'react'
import UserName from './user-name'
import {Link} from 'react-router'
import {fromNowOrNow} from '../utils'
const renderRecentGroup = recentGroup => {
const updatedAgo = fromNowOrNow(parseInt(recentGroup.updatedAt))
return (
<li className="p-my-groups-link">
<Link to={`/${recentGroup.username}`}>{recentGroup.screenName}</Link>
<div className="updated-ago">{updatedAgo}</div>
</li>
)
}
export default props => {
const recentGroups = props.recentGroups.map(renderRecentGroup)
return (
<ul className="p-my-groups">
{recentGroups}
</ul>
)
}
| import React from 'react'
import UserName from './user-name'
import {Link} from 'react-router'
import {fromNowOrNow} from '../utils'
const renderRecentGroup = recentGroup => {
const updatedAgo = fromNowOrNow(parseInt(recentGroup.updatedAt))
return (
<li className="p-my-groups-link" key={recentGroup.id}>
<Link to={`/${recentGroup.username}`}>{recentGroup.screenName}</Link>
<div className="updated-ago">{updatedAgo}</div>
</li>
)
}
export default props => {
const recentGroups = props.recentGroups.map(renderRecentGroup)
return (
<ul className="p-my-groups">
{recentGroups}
</ul>
)
}
| Add key prop to recent groups list | Add key prop to recent groups list
| JSX | mit | FreeFeed/freefeed-react-client,davidmz/freefeed-react-client,clbn/freefeed-gamma,ujenjt/freefeed-react-client,FreeFeed/freefeed-react-client,davidmz/freefeed-react-client,davidmz/freefeed-react-client,ujenjt/freefeed-react-client,clbn/freefeed-gamma,FreeFeed/freefeed-html-react,kadmil/freefeed-react-client,ujenjt/freefeed-react-client,FreeFeed/freefeed-html-react,kadmil/freefeed-react-client,FreeFeed/freefeed-react-client,clbn/freefeed-gamma,kadmil/freefeed-react-client,FreeFeed/freefeed-html-react | ---
+++
@@ -6,7 +6,7 @@
const renderRecentGroup = recentGroup => {
const updatedAgo = fromNowOrNow(parseInt(recentGroup.updatedAt))
return (
- <li className="p-my-groups-link">
+ <li className="p-my-groups-link" key={recentGroup.id}>
<Link to={`/${recentGroup.username}`}>{recentGroup.screenName}</Link>
<div className="updated-ago">{updatedAgo}</div>
</li> |
53c845bc02b0a177eb18332db3cb6684c5321e14 | src/modules/Navigation/index.jsx | src/modules/Navigation/index.jsx | import React, {Component, PropTypes} from "react"
import cx from "classnames"
import Icon from "../Icon"
export default class Navigation extends Component {
static displayName = "Navigation"
static contextTypes = {
file: PropTypes.object,
i18n: PropTypes.object,
}
static items = [
{
url: "posts",
name: "Articles",
icon: "icons/bookmark.svg",
},
{
url: "c-est-quoi-putaindecode",
name: "Readme",
icon: "icons/text-file.svg",
},
{
url: "posts/comment-contribuer",
name: "Participer",
icon: "icons/pencil.svg",
},
{
url: "https://github.com/putaindecode/",
title: "GitHub",
icon: "icons/github.svg",
},
{
url: "https://twitter.com/putaindecode/",
title: "Twitter",
icon: "icons/twitter.svg",
},
]
render() {
const currentPage = this.context.file._filename
return (
<nav className="putainde-Nav">
{
Navigation.items.map((item) => {
const isActivePage = currentPage === item.url || currentPage === item.url + "/index.html"
return (
<a
key={item.url}
className={cx({
"putainde-Nav-item": true,
"putainde-Nav-item--current": isActivePage,
"putainde-Nav-item--icon r-Tooltip r-Tooltip--bottom": item.title,
})}
href={`/${item.url}`}
data-r-tooltip={item.title ? item.title : ""}
>
{/* @todo handle item.icon */}
{
item.icon &&
<Icon src={`/${item.icon}`} />
}
{item.name}
</a>
)
})
}
</nav>
)
}
}
| import React, {Component, PropTypes} from "react"
import cx from "classnames"
import Icon from "../Icon"
export default class Navigation extends Component {
static displayName = "Navigation"
static contextTypes = {
file: PropTypes.object,
i18n: PropTypes.object,
}
render() {
const currentPage = this.context.file._filename
return (
<nav className="putainde-Nav">
{
this.context.i18n.navigation.map((item) => {
const isActivePage = currentPage === item.url || currentPage === item.url + "/index.html"
return (
<a
key={item.url}
className={cx({
"putainde-Nav-item": true,
"putainde-Nav-item--current": isActivePage,
"putainde-Nav-item--icon r-Tooltip r-Tooltip--bottom": item.title,
})}
href={`/${item.url}`}
data-r-tooltip={item.title ? item.title : ""}
>
{/* @todo handle item.icon */}
{
item.icon &&
<Icon src={`${item.icon}`} />
}
{item.name}
</a>
)
})
}
</nav>
)
}
}
| Use navigation from i18n file | Use navigation from i18n file
| JSX | mit | skinnyfoetusboy/putaindecode.fr,pdoreau/putaindecode.fr,pdoreau/putaindecode.fr,neemzy/putaindecode.fr,neemzy/putaindecode.fr,pdoreau/putaindecode.fr,skinnyfoetusboy/putaindecode.fr,neemzy/putaindecode.fr,skinnyfoetusboy/putaindecode.fr | ---
+++
@@ -12,41 +12,13 @@
i18n: PropTypes.object,
}
- static items = [
- {
- url: "posts",
- name: "Articles",
- icon: "icons/bookmark.svg",
- },
- {
- url: "c-est-quoi-putaindecode",
- name: "Readme",
- icon: "icons/text-file.svg",
- },
- {
- url: "posts/comment-contribuer",
- name: "Participer",
- icon: "icons/pencil.svg",
- },
- {
- url: "https://github.com/putaindecode/",
- title: "GitHub",
- icon: "icons/github.svg",
- },
- {
- url: "https://twitter.com/putaindecode/",
- title: "Twitter",
- icon: "icons/twitter.svg",
- },
- ]
-
render() {
const currentPage = this.context.file._filename
return (
<nav className="putainde-Nav">
{
- Navigation.items.map((item) => {
+ this.context.i18n.navigation.map((item) => {
const isActivePage = currentPage === item.url || currentPage === item.url + "/index.html"
return (
@@ -63,7 +35,7 @@
{/* @todo handle item.icon */}
{
item.icon &&
- <Icon src={`/${item.icon}`} />
+ <Icon src={`${item.icon}`} />
}
{item.name}
</a> |
35f994c81d45d16229395d5b07792726fbf769e2 | client/components/dashboard/forms/addTask.jsx | client/components/dashboard/forms/addTask.jsx | import React, { Component } from 'react';
import { FormControl, FormGroup, ControlLabel, Button } from 'react-bootstrap'
export default class AddTask extends Component {
constructor(props) {
super(props);
}
handleSubmit(e) {
e.preventDefault();
//console.log(this.input.value)
this.props.taskData(this.input.value)
}
render() {
return (
<div>
<form onSubmit={this.handleSubmit.bind(this)}>
<FormGroup>
<FormControl type="text" placeholder="Add a new Task" inputRef={ref => this.input = ref}/>
<Button type="submit">
Add a task
</Button>
</FormGroup>
</form>
</div>
)
}
} | import React, { Component } from 'react';
import { FormControl, FormGroup, ControlLabel, Button } from 'react-bootstrap'
export default class AddTask extends Component {
constructor(props) {
super(props);
}
handleSubmit(e) {
e.preventDefault();
//console.log(this.input.value)
this.props.taskData(this.input.value)
}
render() {
return (
<div>
<form onSubmit={this.handleSubmit.bind(this)}>
<FormGroup>
<FormControl type="text" placeholder="Add a new Task" inputRef={ref => this.input = ref}/><br/>
<FormControl componentClass="textarea" placeholder="description" inputRef={ref => this.description = ref}/><br/>
<FormControl componentClass="select" placeholder="select">
<option value="one">1</option>
<option value="two">2</option>
</FormControl>
<Button type="submit">
Add a task
</Button>
</FormGroup>
</form>
</div>
)
}
} | Add new fields in form | Add new fields in form
| JSX | mit | CrewBuilder/crew-builder,CrewBuilder/crew-builder | ---
+++
@@ -17,7 +17,12 @@
<div>
<form onSubmit={this.handleSubmit.bind(this)}>
<FormGroup>
- <FormControl type="text" placeholder="Add a new Task" inputRef={ref => this.input = ref}/>
+ <FormControl type="text" placeholder="Add a new Task" inputRef={ref => this.input = ref}/><br/>
+ <FormControl componentClass="textarea" placeholder="description" inputRef={ref => this.description = ref}/><br/>
+ <FormControl componentClass="select" placeholder="select">
+ <option value="one">1</option>
+ <option value="two">2</option>
+ </FormControl>
<Button type="submit">
Add a task
</Button> |
2dc3369584fdcf40b2594fe05f0f38d8a8614e90 | src/jsx/components/ProjectTile.jsx | src/jsx/components/ProjectTile.jsx | import React, { PropTypes } from 'react';
import { Link } from 'react-router';
export default function ProjectTile(props) {
return (
<Link to={`/projects/${props.slug}`} className="project-tile grid__col grid__col--1-of-2">
<h1 className="project-tile__title">{props.name}</h1>
<img className="project-tile__image" src={props.images[0]} />
</Link>
);
}
ProjectTile.propTypes = {
name: PropTypes.string.isRequired,
slug: PropTypes.string.isRequired,
images: PropTypes.array
};
| import React, { PropTypes } from 'react';
import { Link } from 'react-router';
export default function ProjectTile(props) {
return (
<div className="project-tile grid__col grid__col--1-of-2">
<Link to={`/projects/${props.slug}`}>
<h1 className="project__title">{props.name}</h1>
<img className="project__image" src={props.images[0]} />
</Link>
<div className="project__meta">
<p>{props.released} – {props.tags.join(', ')}</p>
</div>
</div>
);
}
ProjectTile.propTypes = {
name: PropTypes.string.isRequired,
slug: PropTypes.string.isRequired,
images: PropTypes.array
};
| Add year and tags below project tiles | Add year and tags below project tiles
| JSX | mit | vocksel/my-website,vocksel/my-website,VoxelDavid/voxeldavid-website,VoxelDavid/voxeldavid-website | ---
+++
@@ -3,10 +3,16 @@
export default function ProjectTile(props) {
return (
- <Link to={`/projects/${props.slug}`} className="project-tile grid__col grid__col--1-of-2">
- <h1 className="project-tile__title">{props.name}</h1>
- <img className="project-tile__image" src={props.images[0]} />
- </Link>
+ <div className="project-tile grid__col grid__col--1-of-2">
+ <Link to={`/projects/${props.slug}`}>
+ <h1 className="project__title">{props.name}</h1>
+ <img className="project__image" src={props.images[0]} />
+ </Link>
+
+ <div className="project__meta">
+ <p>{props.released} – {props.tags.join(', ')}</p>
+ </div>
+ </div>
);
}
|
f4fd6dfd9031ff720ccb8f9309747ef10db4c1cd | src/components/number-input.jsx | src/components/number-input.jsx | // @flow
import {h, Component} from 'preact'
import Input from 'react-toolbox/components/input'
export class NumberInput extends Component {
ref: ?any
props: any
setRef = (ref: ?any) => {
this.ref = ref
}
onChange = (value: string) => {
if (this.props.onChange) {
if (this.ref) {
const inputNode = this.ref.refs.wrappedInstance.inputNode
this.props.onChange(value, !inputNode.validity.badInput)
} else {
this.props.onChange(value, true)
}
}
// No onChange handler
}
render() {
return <Input {...this.props} type="number" ref={this.setRef} onChange={this.onChange} />
}
}
| // @flow
import {h, Component} from 'preact'
import Textfield from 'preact-material-components/Textfield/Textfield'
export class NumberInput extends Component {
ref: ?any
props: any
setRef = (ref: ?any) => {
this.ref = ref
}
onChange = (value: string) => {
if (this.props.onChange) {
if (this.ref) {
const inputNode = this.ref.refs.wrappedInstance.inputNode
this.props.onChange(value, !inputNode.validity.badInput)
} else {
this.props.onChange(value, true)
}
}
// No onChange handler
}
render() {
return <Textfield {...this.props} type="number" ref={this.setRef} onChange={this.onChange} />
}
}
| Implement number input in MDC | Implement number input in MDC
| JSX | mit | Holi0317/bridge-calc,Holi0317/bridge-calc,Holi0317/bridge-calc | ---
+++
@@ -1,6 +1,6 @@
// @flow
import {h, Component} from 'preact'
-import Input from 'react-toolbox/components/input'
+import Textfield from 'preact-material-components/Textfield/Textfield'
export class NumberInput extends Component {
ref: ?any
@@ -23,6 +23,6 @@
}
render() {
- return <Input {...this.props} type="number" ref={this.setRef} onChange={this.onChange} />
+ return <Textfield {...this.props} type="number" ref={this.setRef} onChange={this.onChange} />
}
} |
e5eab8d080f738074d1e89b295c93c4bccbc3c05 | src/read/component/progressbar.jsx | src/read/component/progressbar.jsx | console.log( "==== simpread read component: ProcessBar ====" )
import Progress from 'progress';
const options = {
strokeWidth: 4,
easing : "easeInOut",
duration : 1000,
trailColor : "#fff",
trailWidth : 0,
svgStyle : {
width : "100%",
height : "100%",
display: "block",
top : "0",
},
from : { color: "#64B5F6" },
to : { color: "#304FFE" },
step : ( state, bar ) => {
bar.path.setAttribute( "stroke", state.color );
},
};
export default class ProcessBar extends React.Component {
static defaultProps = {
offset : document.body.scrollTop / ( document.body.scrollHeight - document.documentElement.clientHeight )
}
state = {
progress: this.props.offset
}
componentDidMount() {
setTimeout( ()=>{
$( document ).on( "scroll", ()=>this.scrollEventHandle() );
}, 1000 );
}
componentWillUnmount() {
$( document ).off( "scroll", ()=>this.scrollEventHandle() );
}
scrollEventHandle() {
const offset = document.body.scrollTop / ( document.body.scrollHeight - document.documentElement.clientHeight );
this.setState({ progress: offset });
}
render() {
return (
<Progress type="line" progress={ this.state.progress } options={ options }>
<read-process></read-process>
</Progress>
)
}
}
| console.log( "==== simpread read component: ProcessBar ====" )
import Progress from 'progress';
const options = {
strokeWidth: 4,
easing : "easeInOut",
duration : 1000,
trailColor : "#fff",
trailWidth : 0,
svgStyle : {
width : "100%",
height : "100%",
display: "block",
top : "0",
},
from : { color: "#64B5F6" },
to : { color: "#304FFE" },
step : ( state, bar ) => {
bar.path.setAttribute( "stroke", state.color );
},
};
export default class ProcessBar extends React.Component {
static defaultProps = {
offset : document.body.scrollTop / ( document.body.scrollHeight - document.documentElement.clientHeight )
}
state = {
progress: this.props.offset
}
componentDidMount() {
setTimeout( ()=>{
$( document ).on( "scroll", ()=>this.scrollEventHandle() );
}, 1000 );
}
componentWillUnmount() {
$( document ).off( "scroll", this.scrollEventHandle() );
}
scrollEventHandle() {
const offset = document.body.scrollTop / ( document.body.scrollHeight - document.documentElement.clientHeight );
this.setState({ progress: offset });
}
render() {
return (
<Progress type="line" progress={ this.state.progress } options={ options }>
<read-process></read-process>
</Progress>
)
}
}
| Fix document scroll off not working bug. | Fix document scroll off not working bug.
| JSX | mit | ksky521/simpread,ksky521/simpread | ---
+++
@@ -33,12 +33,12 @@
componentDidMount() {
setTimeout( ()=>{
- $( document ).on( "scroll", ()=>this.scrollEventHandle() );
+ $( document ).on( "scroll", ()=>this.scrollEventHandle() );
}, 1000 );
}
componentWillUnmount() {
- $( document ).off( "scroll", ()=>this.scrollEventHandle() );
+ $( document ).off( "scroll", this.scrollEventHandle() );
}
scrollEventHandle() { |
42ce4afe7299e57330dfebe531729358c62c61bb | client/app/Components/Main.jsx | client/app/Components/Main.jsx | import React from 'react';
import Menu from './Menu.jsx';
import Session from './Session.jsx'
const Main = (props) => {
// console.log(props);
return (
<div>
<h2>I am the Main component!</h2>
{/* <button className="add-comment" onClick={() => props.addComment('123', '345', '678', 'first comment', 'yassssss')}>Add Comment</button> */}
<Session showDetail={props.showDetail}
hideDetail={props.hideDetail}
detailViewVisible={props.detailViewVisible}
comments={props.comments}
nodes={props.nodes}
links={props.links}
showMenu={props.showMenu}
hideMenu={props.hideMenu}
menuVisible={props.menuVisible}
addComment={props.addComment}
/>
</div>
)
}
export default Main;
// {/* <Menu className="menu-button" menuVisible={props.menuVisible} onClick={() => props.menuVisible ? props.hideMenu() : props.showMenu()}/> */}
//
| import React from 'react';
import Menu from './Menu.jsx';
import Session from './Session.jsx'
const Main = (props) => {
// console.log(props);
return (
<div>
<h2>I am the Main component!</h2>
<Session showDetail={props.showDetail}
hideDetail={props.hideDetail}
detailViewVisible={props.detailViewVisible}
comments={props.comments}
nodes={props.nodes}
links={props.links}
showMenu={props.showMenu}
hideMenu={props.hideMenu}
menuVisible={props.menuVisible}
addComment={props.addComment}
/>
</div>
)
}
export default Main;
// {/* <Menu className="menu-button" menuVisible={props.menuVisible} onClick={() => props.menuVisible ? props.hideMenu() : props.showMenu()}/> */}
//
| Move add comment button to modal part 2 | Move add comment button to modal part 2
| JSX | mit | Ada323/brainstorm,conundrum-inc/brainstorm,Ada323/brainstorm,conundrum-inc/brainstorm | ---
+++
@@ -8,7 +8,6 @@
return (
<div>
<h2>I am the Main component!</h2>
- {/* <button className="add-comment" onClick={() => props.addComment('123', '345', '678', 'first comment', 'yassssss')}>Add Comment</button> */}
<Session showDetail={props.showDetail}
hideDetail={props.hideDetail}
detailViewVisible={props.detailViewVisible} |
db1370ede889afd6ca7fd3a7dec5710a237483cf | src/app/components/map-container.jsx | src/app/components/map-container.jsx | 'use strict';
import React from 'react';
import LocationMap from './location-map.jsx';
import MapStore from '../../stores/map-store.jsx';
export default class MapContainer extends React.Component {
constructor(props) {
super(props);
this.state = { locationMap: MapStore.getMap(this.props.params.mapId) };
}
componentDidMount () {
let self = this;
MapStore.onChange(function (data) {
self.setState({ locationMap: MapStore.getMap(self.props.params.mapId) });
});
}
render () {
return (
<LocationMap locationMap={this.state.locationMap} />
);
}
}
| 'use strict';
import React from 'react';
import LocationMap from './location-map.jsx';
import MapStore from '../../stores/map-store.jsx';
export default class MapContainer extends React.Component {
constructor(props) {
super(props);
this.state = { locationMap: MapStore.getMap(this.props.params.mapId) };
}
componentDidMount () {
let self = this;
MapStore.onChange(function (data) {
self.setState({ locationMap: MapStore.getMap(self.props.params.mapId) });
});
}
render () {
return (
<LocationMap
locationMap={this.state.locationMap}
mapId={this.props.params.mapId}
/>
);
}
}
| Add mapId to LocationMap props | Add mapId to LocationMap props
| JSX | mit | jkrayer/poc-map-points,jkrayer/poc-map-points | ---
+++
@@ -17,7 +17,10 @@
}
render () {
return (
- <LocationMap locationMap={this.state.locationMap} />
+ <LocationMap
+ locationMap={this.state.locationMap}
+ mapId={this.props.params.mapId}
+ />
);
}
} |
b9cce67d827b99f176737b3dd203da4cb970d816 | client/components/ArticleEdge.jsx | client/components/ArticleEdge.jsx | import React from 'react';
export default class ArticleEdge extends React.Component {
constructor(props){
super(props);
}
render() {
return (
<line x1={this.props.fromX} y1={this.props.fromY} x2={this.props.toX} y2={this.props.toY}
style={{strokeWidth: 2, stroke: 'rgb(0,0,0)'}}
/>
)
}
} | import React from 'react';
export default function ArticleEdge({ fromX, fromY, toX, toY }) {
return (
<line x1={fromX} y1={fromY} x2={toX} y2={toY} style={{ strokeWidth: 2, stroke: 'rgb(0,0,0)' }} />
);
}
ArticleEdge.propTypes = {
fromX: React.PropTypes.number.isRequired,
fromY: React.PropTypes.number.isRequired,
toX: React.PropTypes.number.isRequired,
toY: React.PropTypes.number.isRequired,
};
| Add react proptypes to article edge | Add react proptypes to article edge
| JSX | mit | j-oliver/react-example,j-oliver/react-example | ---
+++
@@ -1,15 +1,14 @@
import React from 'react';
-export default class ArticleEdge extends React.Component {
- constructor(props){
- super(props);
- }
+export default function ArticleEdge({ fromX, fromY, toX, toY }) {
+ return (
+ <line x1={fromX} y1={fromY} x2={toX} y2={toY} style={{ strokeWidth: 2, stroke: 'rgb(0,0,0)' }} />
+ );
+}
- render() {
- return (
- <line x1={this.props.fromX} y1={this.props.fromY} x2={this.props.toX} y2={this.props.toY}
- style={{strokeWidth: 2, stroke: 'rgb(0,0,0)'}}
- />
- )
- }
-}
+ArticleEdge.propTypes = {
+ fromX: React.PropTypes.number.isRequired,
+ fromY: React.PropTypes.number.isRequired,
+ toX: React.PropTypes.number.isRequired,
+ toY: React.PropTypes.number.isRequired,
+}; |
11b7ef4f43db895310124cac660f4198e60d7005 | src/features/contextMenus/ContextMenuManager.jsx | src/features/contextMenus/ContextMenuManager.jsx | import React, {Component} from "react";
import {connect} from "react-redux";
import Portal from 'react-portal';
import ContextMenu from "./ContextMenu";
import TestContextMenu from "./TestContextMenu";
import PilotsListItemMenu from "features/pilots/PilotsList/PilotsListItemMenu";
import {selectContextMenu} from "./contextMenuSelectors";
const menuTypes = {
TestContextMenu,
PilotsListItemMenu
};
export function contextMenuManagerMapState(state) {
return {
contextMenu : selectContextMenu(state)
};
}
export class ContextMenuManager extends Component {
render() {
const {contextMenu} = this.props;
const {show, location, type, menuArgs = {}} = contextMenu;
let menu = null;
if(show) {
let MenuComponent = menuTypes[type];
if(MenuComponent) {
menu = (
<Portal isOpened={true}>
<ContextMenu location={location}>
<MenuComponent {...menuArgs} />
</ContextMenu>
</Portal>
)
}
}
return menu;
}
}
export default connect(contextMenuManagerMapState)(ContextMenuManager); | import React, {Component} from "react";
import {connect} from "react-redux";
import {Portal} from 'react-portal';
import ContextMenu from "./ContextMenu";
import TestContextMenu from "./TestContextMenu";
import PilotsListItemMenu from "features/pilots/PilotsList/PilotsListItemMenu";
import {selectContextMenu} from "./contextMenuSelectors";
const menuTypes = {
TestContextMenu,
PilotsListItemMenu
};
export function contextMenuManagerMapState(state) {
return {
contextMenu : selectContextMenu(state)
};
}
export class ContextMenuManager extends Component {
render() {
const {contextMenu} = this.props;
const {show, location, type, menuArgs = {}} = contextMenu;
let menu = null;
if(show) {
let MenuComponent = menuTypes[type];
if(MenuComponent) {
menu = (
<Portal isOpened={true}>
<ContextMenu location={location}>
<MenuComponent {...menuArgs} />
</ContextMenu>
</Portal>
)
}
}
return menu;
}
}
export default connect(contextMenuManagerMapState)(ContextMenuManager); | Update React-Portal usage to match version 4.x | Update React-Portal usage to match version 4.x
| JSX | mit | markerikson/project-minimek,markerikson/project-minimek | ---
+++
@@ -1,6 +1,6 @@
import React, {Component} from "react";
import {connect} from "react-redux";
-import Portal from 'react-portal';
+import {Portal} from 'react-portal';
import ContextMenu from "./ContextMenu";
|
c9e5de356cb55e064b51bafd54105a5dfecc2d4d | client/src/components/CustomizationWidget/index.jsx | client/src/components/CustomizationWidget/index.jsx | import React, { Component } from 'react';
import StickerListContainer from '../../containers/StickerListContainer';
import ProductContainer from '../../containers/ProductContainer';
import PaginationContainer from '../../containers/PaginationContainer';
import './CustomizationWidget.scss';
const defaultProps = {
};
class CustomizationWidget extends Component {
render() {
const { onChangeFilter } = this.props;
return (
<div className="container container-product">
<ProductContainer />
<div className="content stickers">
<div className="stickers-search">
<input placeholder="Search stickers" onChange={onChangeFilter}/>
</div>
<StickerListContainer />
<PaginationContainer />
</div>
</div>
);
}
}
CustomizationWidget.defaultProps = defaultProps;
export default CustomizationWidget;
| import React, { Component, PropTypes } from 'react';
import StickerListContainer from '../../containers/StickerListContainer';
import ProductContainer from '../../containers/ProductContainer';
import PaginationContainer from '../../containers/PaginationContainer';
import './CustomizationWidget.scss';
class CustomizationWidget extends Component {
render() {
const { onChangeFilter } = this.props;
return (
<div className="container container-product">
<ProductContainer />
<div className="content stickers">
<div className="stickers-search">
<input placeholder="Search stickers" onChange={onChangeFilter}/>
</div>
<StickerListContainer />
<PaginationContainer />
</div>
</div>
);
}
}
CustomizationWidget.propTypes = {
onChangeFilter: PropTypes.onChangeFilter.func,
};
export default CustomizationWidget;
| Document PropTypes for <CustomizationWidget /> | Document PropTypes for <CustomizationWidget />
| JSX | mit | marlonbernardes/coding-stickers,marlonbernardes/coding-stickers | ---
+++
@@ -1,11 +1,8 @@
-import React, { Component } from 'react';
+import React, { Component, PropTypes } from 'react';
import StickerListContainer from '../../containers/StickerListContainer';
import ProductContainer from '../../containers/ProductContainer';
import PaginationContainer from '../../containers/PaginationContainer';
import './CustomizationWidget.scss';
-
-const defaultProps = {
-};
class CustomizationWidget extends Component {
@@ -27,5 +24,8 @@
}
}
-CustomizationWidget.defaultProps = defaultProps;
+CustomizationWidget.propTypes = {
+ onChangeFilter: PropTypes.onChangeFilter.func,
+};
+
export default CustomizationWidget; |
c58044f46cd5cf309b78f1fca3d41a769de36328 | src/mb/components/MoDetailRow.jsx | src/mb/components/MoDetailRow.jsx | import React from 'react';
import '../res/mo-detail-row.less';
const TYPES = {
casts: '演员',
directors: '导演',
genres: '类型'
};
/**
* Represent a inline list in a detail row of MoJumbotron.
*/
export default recompose.pure(({
data,
type
}) => {
let items = null;
if (type === 'genres') {
items = data.map(genre => <li key={genre}>{genre}</li>);
} else {
items = data.map(people => <li key={people.get('id')}>{people.get('name')}</li>);
}
return (
<dl className={`mb-mo-detail-row ${type}`}>
<dt>{TYPES[type]}</dt>
<dd>
<ul>
{items}
</ul>
</dd>
</dl>
);
});
| import Immutable from 'immutable';
import React from 'react';
import '../res/mo-detail-row.less';
const TYPES = {
casts: '演员',
directors: '导演',
genres: '类型'
};
/**
* Represent a inline list in a detail row of MoJumbotron.
*/
export default class MoDetailRow extends React.Component {
static propTypes = {
data: React.PropTypes.objectOf(Immutable.List).isRequired,
type: React.PropTypes.string.isRequired
}
shouldComponentUpdate(nextProps) {
return nextProps.type !== this.props.type || !nextProps.data.equals(this.props.data);
}
render() {
const { data, type } = this.props;
let items = null;
if (type === 'genres') {
items = data.map(genre => <li key={genre}>{genre}</li>);
} else {
items = data.map(people => <li key={people.get('id')}>{people.get('name')}</li>);
}
return (
<dl className={`mb-mo-detail-row ${type}`}>
<dt>{TYPES[type]}</dt>
<dd>
<ul>
{items}
</ul>
</dd>
</dl>
);
}
}
| Change to Component with customized shouldComponentUpdate() | Change to Component with customized shouldComponentUpdate()
| JSX | mit | MagicCube/movie-board,MagicCube/movie-board,MagicCube/movie-board | ---
+++
@@ -1,3 +1,4 @@
+import Immutable from 'immutable';
import React from 'react';
import '../res/mo-detail-row.less';
@@ -11,25 +12,34 @@
/**
* Represent a inline list in a detail row of MoJumbotron.
*/
-export default recompose.pure(({
- data,
- type
-}) => {
- let items = null;
- if (type === 'genres') {
- items = data.map(genre => <li key={genre}>{genre}</li>);
- } else {
- items = data.map(people => <li key={people.get('id')}>{people.get('name')}</li>);
+export default class MoDetailRow extends React.Component {
+ static propTypes = {
+ data: React.PropTypes.objectOf(Immutable.List).isRequired,
+ type: React.PropTypes.string.isRequired
}
- return (
- <dl className={`mb-mo-detail-row ${type}`}>
- <dt>{TYPES[type]}</dt>
- <dd>
- <ul>
- {items}
- </ul>
- </dd>
- </dl>
- );
-});
+ shouldComponentUpdate(nextProps) {
+ return nextProps.type !== this.props.type || !nextProps.data.equals(this.props.data);
+ }
+
+ render() {
+ const { data, type } = this.props;
+ let items = null;
+ if (type === 'genres') {
+ items = data.map(genre => <li key={genre}>{genre}</li>);
+ } else {
+ items = data.map(people => <li key={people.get('id')}>{people.get('name')}</li>);
+ }
+
+ return (
+ <dl className={`mb-mo-detail-row ${type}`}>
+ <dt>{TYPES[type]}</dt>
+ <dd>
+ <ul>
+ {items}
+ </ul>
+ </dd>
+ </dl>
+ );
+ }
+} |
d196bdb00c2280cccb0d01366b1871d3809df8c5 | src/react-chayns-list/component/ListItem/ExpandableListHeader.jsx | src/react-chayns-list/component/ListItem/ExpandableListHeader.jsx | import React from 'react';
import PropTypes from 'prop-types';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faChevronRight } from '@fortawesome/free-solid-svg-icons/faChevronRight';
import ListItemHeader from './ListItemHeader';
const ExpandableListHeader = ({
title,
subtitle,
image,
onClick,
hideIndicator,
right,
}) => {
return (
<ListItemHeader
title={title}
subtitle={subtitle}
onClick={onClick}
image={image}
right={right}
left={!hideIndicator && (
<div className="list-item__indicator">
<FontAwesomeIcon icon={faChevronRight} />
</div>
)}
/>
);
};
ExpandableListHeader.propTypes = {
title: PropTypes.string.isRequired,
subtitle: PropTypes.string,
image: PropTypes.string,
onClick: PropTypes.func,
hideIndicator: PropTypes.bool,
right: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]),
};
ExpandableListHeader.defaultProps = {
image: null,
subtitle: null,
onClick: null,
hideIndicator: false,
right: null,
};
export default ExpandableListHeader;
| import React from 'react';
import PropTypes from 'prop-types';
import ListItemHeader from './ListItemHeader';
const ExpandableListHeader = ({
title,
subtitle,
image,
onClick,
hideIndicator,
right,
}) => {
return (
<ListItemHeader
title={title}
subtitle={subtitle}
onClick={onClick}
image={image}
right={right}
left={!hideIndicator && (
<div className="list-item__indicator">
<div className="icon-wrapper">
<i className="ts-icon ts-angle-right" />
</div>
</div>
)}
/>
);
};
ExpandableListHeader.propTypes = {
title: PropTypes.string.isRequired,
subtitle: PropTypes.string,
image: PropTypes.string,
onClick: PropTypes.func,
hideIndicator: PropTypes.bool,
right: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]),
};
ExpandableListHeader.defaultProps = {
image: null,
subtitle: null,
onClick: null,
hideIndicator: false,
right: null,
};
export default ExpandableListHeader;
| Remove FA and use FontTS | :lipstick: Remove FA and use FontTS
| JSX | mit | TobitSoftware/chayns-components,TobitSoftware/chayns-components,TobitSoftware/chayns-components | ---
+++
@@ -1,8 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { faChevronRight } from '@fortawesome/free-solid-svg-icons/faChevronRight';
import ListItemHeader from './ListItemHeader';
const ExpandableListHeader = ({
@@ -22,7 +20,9 @@
right={right}
left={!hideIndicator && (
<div className="list-item__indicator">
- <FontAwesomeIcon icon={faChevronRight} />
+ <div className="icon-wrapper">
+ <i className="ts-icon ts-angle-right" />
+ </div>
</div>
)}
/> |
40aa6f4401426c09b7b59a3a3261d4ac9e38a28e | imports/ui/components/StudyPlan.jsx | imports/ui/components/StudyPlan.jsx | import React from 'react';
import SignIn from './SignIn'
import TabbedContainer from './common/TabbedContainer';
import BasicTable from './common/BasicTable';
/*export default function StudyPlan() {
return (
<div className="page-content">
<div className="container-fluid">
<div className="col-xxl-3 col-md-6">
Study Plan
</div>
</div>
</div>
);
}*/
export default class StudyPlan extends React.Component {
render() {
var contentPanelsList = [<BasicTable />, <BasicTable />];
return (
<TabbedContainer tabTitleList={["Plan A", "Plan B"]}
contentPanelsList={contentPanelsList}/>
);
}
}
| import React from 'react';
import SignIn from './SignIn2'
import TabbedContainer from './common/TabbedContainer';
import BasicTable from './common/BasicTable';
/*export default function StudyPlan() {
return (
<div className="page-content">
<div className="container-fluid">
<div className="col-xxl-3 col-md-6">
Study Plan
</div>
</div>
</div>
);
}*/
export default class StudyPlan extends React.Component {
render() {
// in here, will need to call list of planner ids from accounts
// from list of planner ids, loop and call getPlanner to get an array of planner objects
// for each planner object, create a 'basic table' tab that will input the necessay inputs (such as semesters) into the table
// do loop and for each do a push <BasicTable /> component into the array
var contentPanelsList = [<BasicTable />]; // basic table will need input of basic information using props
return (
<TabbedContainer tabTitleList={["Plan A", "Plan B", "Plan C"]}
contentPanelsList={contentPanelsList}/>
);
}
}
| ADD basic instructions on how to integrate logic with ui | ADD basic instructions on how to integrate logic with ui
| JSX | mit | nus-mtp/nus-oracle,nus-mtp/nus-oracle | ---
+++
@@ -1,5 +1,5 @@
import React from 'react';
-import SignIn from './SignIn'
+import SignIn from './SignIn2'
import TabbedContainer from './common/TabbedContainer';
import BasicTable from './common/BasicTable';
@@ -17,10 +17,18 @@
export default class StudyPlan extends React.Component {
render() {
- var contentPanelsList = [<BasicTable />, <BasicTable />];
+ // in here, will need to call list of planner ids from accounts
+
+ // from list of planner ids, loop and call getPlanner to get an array of planner objects
+
+ // for each planner object, create a 'basic table' tab that will input the necessay inputs (such as semesters) into the table
+ // do loop and for each do a push <BasicTable /> component into the array
+
+
+ var contentPanelsList = [<BasicTable />]; // basic table will need input of basic information using props
return (
- <TabbedContainer tabTitleList={["Plan A", "Plan B"]}
+ <TabbedContainer tabTitleList={["Plan A", "Plan B", "Plan C"]}
contentPanelsList={contentPanelsList}/>
);
} |
424c337377128d9769e902119b7d4a7d977aa696 | frontend/src/containers/Lobby.jsx | frontend/src/containers/Lobby.jsx | import React from 'react'
import { connect } from 'react-redux'
import * as lobby from '../actions/lobby'
const Lobby = React.createClass({
logout(e) {
e.preventDefault()
this.props.dispatch(lobby.logoutQuery())
},
componentDidMount() {
this.props.dispatch(lobby.gamesQuery())
},
render() {
const { username, games } = this.props
const renderGames = games => {
return games.map((x, i) => {
return (<div key={i}>{x.name}</div>)
})
}
return (<div>
<p>Welcome {username} !</p>
<a href="#" onClick={this.logout}>logout</a>
<div>
{renderGames(games)}
</div>
</div>)
}
})
function select (state) {
return {
username: state.unrestricted_area.user.username,
games: state.lobby.games,
joinRequest: state.lobby.joinRequest,
createRequest: state.lobby.createRequest
}
}
export default connect(select)(Lobby)
| import React from 'react'
import { connect } from 'react-redux'
import NavigationBar from '../components/NavigationBar'
import NavigationItem from '../components/NavigationItem'
import * as lobby from '../actions/lobby'
const Lobby = React.createClass({
logout(e) {
e.preventDefault()
this.props.dispatch(lobby.logoutQuery())
},
componentDidMount() {
this.props.dispatch(lobby.gamesQuery())
},
render() {
const { username, games } = this.props
const renderGames = games => {
return games.map((x, i) => {
return (<div key={i}>{x.name}</div>)
})
}
return (<div>
<NavigationBar username={username}>
<NavigationItem name="logout" onClick={this.logout} />
</NavigationBar>
<div>
{renderGames(games)}
</div>
</div>)
}
})
function select (state) {
return {
username: state.unrestricted_area.user.username,
games: state.lobby.games,
joinRequest: state.lobby.joinRequest,
createRequest: state.lobby.createRequest
}
}
export default connect(select)(Lobby)
| Refactor lobby container with newly created components | Refactor lobby container with newly created components
| JSX | mit | 14Plumes/Hexode,KtorZ/Hexode,KtorZ/Hexode,14Plumes/Hexode,14Plumes/Hexode,KtorZ/Hexode | ---
+++
@@ -1,6 +1,8 @@
import React from 'react'
import { connect } from 'react-redux'
+import NavigationBar from '../components/NavigationBar'
+import NavigationItem from '../components/NavigationItem'
import * as lobby from '../actions/lobby'
const Lobby = React.createClass({
@@ -23,8 +25,9 @@
}
return (<div>
- <p>Welcome {username} !</p>
- <a href="#" onClick={this.logout}>logout</a>
+ <NavigationBar username={username}>
+ <NavigationItem name="logout" onClick={this.logout} />
+ </NavigationBar>
<div>
{renderGames(games)}
</div> |
7e9129c9c729d546de8cfb5af2c0541ff557d7d5 | src/components/UserProfile/SightingList.jsx | src/components/UserProfile/SightingList.jsx | import React, { Component } from "react";
const SightingList = (props) => {
console.log(props)
return(
<div>
<h1>Sighting List</h1>
{props.sightings.map(s=>
<ul>
<li>
{s.scientificName}
</li>
<li>
{s.count}
</li>
<li>
{s.sex}
</li>
</ul>
)}
</div>
)
}
export default SightingList; | import React, { Component } from 'react';
const SightingList = props => {
console.log(props);
return (
<div>
<h1>Sighting List</h1>
{props.sightings.map(s => (
<ul>
<li>{s.scientificName}</li>
<li>
Count:
{s.count}
</li>
<li>
Sex:
{s.sex}
</li>
<li>
Lat:
{s.lat}
</li>
<li>
Long:
{s.lon}
</li>
</ul>
))}
</div>
);
};
export default SightingList;
| Add lat, long labels to profile Sighting List for readability | Add lat, long labels to profile Sighting List for readability
| JSX | mit | omarcodex/butterfly-pinner,omarcodex/butterfly-pinner | ---
+++
@@ -1,25 +1,33 @@
-import React, { Component } from "react";
+import React, { Component } from 'react';
-const SightingList = (props) => {
- console.log(props)
- return(
+const SightingList = props => {
+ console.log(props);
+ return (
<div>
<h1>Sighting List</h1>
- {props.sightings.map(s=>
+ {props.sightings.map(s => (
<ul>
+ <li>{s.scientificName}</li>
<li>
- {s.scientificName}
- </li>
- <li>
+ Count:
{s.count}
</li>
<li>
+ Sex:
{s.sex}
</li>
+ <li>
+ Lat:
+ {s.lat}
+ </li>
+ <li>
+ Long:
+ {s.lon}
+ </li>
</ul>
- )}
+ ))}
</div>
- )
-}
+ );
+};
export default SightingList; |
a5d8c73d91bc3866c6cec659ef5995ac9c1aff5b | src/app/views/collections/CollectionsController.jsx | src/app/views/collections/CollectionsController.jsx | import React, { Component } from 'react';
import { connect } from 'react-redux'
import CollectionCreate from './create/CollectionCreate';
class Collections extends Component {
constructor(props) {
super(props);
}
render () {
return (
<div>
<div className="grid grid--justify-space-around">
<div className="grid__col-4">
<h1>Select a collection</h1>
</div>
<div className="grid__col-4">
<h1>Create a team</h1>
</div>
</div>
</div>
)
}
}
export default connect()(Collections); | import React, { Component } from 'react';
import { connect } from 'react-redux'
import CollectionCreate from './create/CollectionCreate';
class Collections extends Component {
constructor(props) {
super(props);
}
handleCollectionCreateSuccess() {
// route to collection details pane for new collection
// update list of collections
}
render () {
return (
<div>
<div className="grid grid--justify-space-around">
<div className="grid__col-4">
<h1>Select a collection</h1>
</div>
<div className="grid__col-4">
<h1>Create a collection</h1>
<CollectionCreate onSuccess={this.handleCollectionCreateSuccess}/>
</div>
</div>
</div>
)
}
}
export default connect()(Collections); | Add temporary handle create success fucntions and corect heading text | Add temporary handle create success fucntions and corect heading text
Former-commit-id: e142ba88d116a2a174ccbc018eeff6c8d2dc402c
Former-commit-id: 4f6b7c7ee33d201adf4fc89ad4f5f3a0faf7948f
Former-commit-id: 070edd6f65b587b2bd8d08edfdec67d99fb2eb8e | JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -6,6 +6,11 @@
class Collections extends Component {
constructor(props) {
super(props);
+ }
+
+ handleCollectionCreateSuccess() {
+ // route to collection details pane for new collection
+ // update list of collections
}
render () {
@@ -17,8 +22,8 @@
</div>
<div className="grid__col-4">
- <h1>Create a team</h1>
-
+ <h1>Create a collection</h1>
+ <CollectionCreate onSuccess={this.handleCollectionCreateSuccess}/>
</div>
</div> |
ce052c0cbab845df658d676f32e76869ee22159e | web/static/js/components/stage_change_info_voting.jsx | web/static/js/components/stage_change_info_voting.jsx | import React from "react"
export default () => (
<div>
The skinny on voting:
<div className="ui basic segment">
<ul className="ui list">
<li>You have <strong>3</strong> votes</li>
<li>You can apply multiple votes to a given idea</li>
<li>Voting is blind. Totals will be revealed when the facilitator advances the retro.</li>
<li>Once a vote has been cast, there's no taking it back, so vote carefully!</li>
</ul>
</div>
</div>
)
| import React from "react"
export default () => (
<div>
The skinny on voting:
<div className="ui basic segment">
<ul className="ui list">
<li>You have <strong>3</strong> votes.</li>
<li>You can apply <strong>multiple</strong> votes to a single idea.</li>
<li>Voting is <strong>blind</strong>. Totals will be revealed when the facilitator advances the retro.</li>
<li>Once a vote has been cast, there's no taking it back, so vote carefully!</li>
</ul>
</div>
</div>
)
| Update Voting stage intro copy | Update Voting stage intro copy
| JSX | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | ---
+++
@@ -5,9 +5,9 @@
The skinny on voting:
<div className="ui basic segment">
<ul className="ui list">
- <li>You have <strong>3</strong> votes</li>
- <li>You can apply multiple votes to a given idea</li>
- <li>Voting is blind. Totals will be revealed when the facilitator advances the retro.</li>
+ <li>You have <strong>3</strong> votes.</li>
+ <li>You can apply <strong>multiple</strong> votes to a single idea.</li>
+ <li>Voting is <strong>blind</strong>. Totals will be revealed when the facilitator advances the retro.</li>
<li>Once a vote has been cast, there's no taking it back, so vote carefully!</li>
</ul>
</div> |
41bd2bd39527d3592bd5fe75aba7513af50ee40c | src/components/todo.jsx | src/components/todo.jsx | import React, { Component, PropTypes } from 'react';
import classnames from 'classnames';
export default function todoFactory() {
return class Todo extends Component {
static propTypes = {
title: PropTypes.string.isRequired,
completed: PropTypes.bool.isRequired,
toggleTodo: PropTypes.func.isRequired
};
render() {
const { completed, title, toggleTodo } = this.props;
return <div className={classnames('todo', { completed })}>
<div className="view">
<input className="toggle" type="checkbox"
checked={completed}
onChange={toggleTodo}
/>
<label>{title}</label>
</div>
</div>;
}
};
}
| import React, { Component, PropTypes } from 'react';
import classnames from 'classnames';
// TODO: fix completed strikethrough styles
export default function todoFactory() {
return class Todo extends Component {
static propTypes = {
title: PropTypes.string.isRequired,
completed: PropTypes.bool.isRequired,
toggleTodo: PropTypes.func.isRequired
};
render() {
const { completed, title, toggleTodo } = this.props;
return <div className={classnames('todo', { completed })}>
<div className="view">
<input className="toggle" type="checkbox"
checked={completed}
onChange={toggleTodo}
/>
<label>{title}</label>
</div>
</div>;
}
};
}
| Add TODO to fix styles | Add TODO to fix styles
| JSX | mit | NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet | ---
+++
@@ -1,6 +1,8 @@
import React, { Component, PropTypes } from 'react';
import classnames from 'classnames';
+
+// TODO: fix completed strikethrough styles
export default function todoFactory() {
return class Todo extends Component { |
de655679900540a914b34158cb8bd51c8b6f89cb | client/plato/components/index.jsx | client/plato/components/index.jsx | import React from 'react';
import { convertFromRaw } from 'draft-js';
import { Editor, createEditorState } from 'medium-draft';
import request from 'superagent';
import { Row, Col, Navbar, NavItem } from 'react-materialize';
import Login from './Login.jsx';
import NoteList from './NoteList.jsx';
import SearchBar from './SearchBar.jsx';
import SpeechToTextEditor from './SpeechToTextEditor.jsx';
import MediumEditor from './MediumDraft.jsx';
// <SearchBar onTermChange={this.searchNotes} />
const PlatoApp = (props) => {
console.log(props);
const {
username,
savedNotes
} = props;
return (
<div>
<h1>This is Plato Note Taker!</h1>
<Login
dispatcher={props.dispatcher}
/>
<h2>Your Notes:</h2>
<NoteList
notes={savedNotes.notes}
/>
</div>
);
};
export default PlatoApp;
PlatoApp.propTypes= {
dispatcher: React.PropTypes.func
};
| import React from 'react';
import { convertFromRaw } from 'draft-js';
import { Editor, createEditorState } from 'medium-draft';
import request from 'superagent';
import { Row, Col, Navbar, NavItem } from 'react-materialize';
import Login from './Login.jsx';
import NoteList from './NoteList.jsx';
import SearchBar from './SearchBar.jsx';
import SpeechToTextEditor from './SpeechToTextEditor.jsx';
import MediumEditor from './MediumDraft.jsx';
// <SearchBar onTermChange={this.searchNotes} />
const PlatoApp = (props) => {
console.log(props);
const {
username,
savedNotes
} = props;
return (
<div>
<h1>This is Plato Note Taker!</h1>
<Login
dispatcher={props.dispatcher}
/>
<NoteList
notes={savedNotes.notes}
/>
</div>
);
};
export default PlatoApp;
PlatoApp.propTypes= {
dispatcher: React.PropTypes.func
};
| Remove doubled up components from bad comp nesting | Remove doubled up components from bad comp nesting
| JSX | mit | enchanted-spotlight/Plato,enchanted-spotlight/Plato | ---
+++
@@ -23,7 +23,6 @@
<Login
dispatcher={props.dispatcher}
/>
- <h2>Your Notes:</h2>
<NoteList
notes={savedNotes.notes}
/> |
19ec6960df31a10794cd26dd242915308c07fe30 | client-src/js/ui/game/items/Bomb.jsx | client-src/js/ui/game/items/Bomb.jsx | var React = require('react');
var ItemsActions = require('../../../app/game/ItemsActions');
var PlayerActions = require('../../../app/game/PlayerActions');
var Bomb = React.createClass({
propTypes: {
item: React.PropTypes.object.isRequired
},
gameOver: function(){
ItemsActions.revealAllItems();
PlayerActions.gameOver();
},
flagItem: function(event){
event.preventDefault();
event.stopPropagation();
event.returnValue = false;
if(!this.props.item.isRevealed && ItemsStore.getFlags().length < ItemsStore.getOptions().totalBombs){
ItemsActions.toggleFlag(this.props.item);
}
},
render: function() {
var item = this.props.item;
var revealedClass = item.isRevealed? ' revealed' : '';
var icon = item.isRevealed? (<i className="fa fa-bomb"/>) : (<i className="fa fa-bomb"/>);
return (
<td className={'item bomb' + revealedClass} onContextMenu={this.flagItem} onClick={this.gameOver}>{icon}</td>
);
}
});
module.exports = Bomb; | var React = require('react');
var ItemsActions = require('../../../app/game/ItemsActions');
var PlayerActions = require('../../../app/game/PlayerActions');
var ItemsStore = require('../../../app/game/ItemsStore');
var Bomb = React.createClass({
propTypes: {
item: React.PropTypes.object.isRequired
},
gameOver: function(){
ItemsActions.revealAllItems();
PlayerActions.gameOver();
},
flagItem: function(event){
event.preventDefault();
event.stopPropagation();
event.returnValue = false;
if(!this.props.item.isRevealed && ItemsStore.getFlags().length < ItemsStore.getOptions().totalBombs){
ItemsActions.toggleFlag(this.props.item);
}
},
render: function() {
var item = this.props.item;
var revealedClass = item.isRevealed? ' bomb revealed' : '';
var icon = item.isRevealed? (<i className="fa fa-bomb"/>) : null;
return (
<td className={'item ' + revealedClass} onContextMenu={this.flagItem} onClick={this.gameOver}>{icon}</td>
);
}
});
module.exports = Bomb; | Fix right clicking on bomb - Hide bombs | Fix right clicking on bomb
- Hide bombs
| JSX | mit | EnzoMartin/Minesweeper-React,EnzoMartin/Minesweeper-React | ---
+++
@@ -1,6 +1,7 @@
var React = require('react');
var ItemsActions = require('../../../app/game/ItemsActions');
var PlayerActions = require('../../../app/game/PlayerActions');
+var ItemsStore = require('../../../app/game/ItemsStore');
var Bomb = React.createClass({
propTypes: {
@@ -20,11 +21,11 @@
},
render: function() {
var item = this.props.item;
- var revealedClass = item.isRevealed? ' revealed' : '';
- var icon = item.isRevealed? (<i className="fa fa-bomb"/>) : (<i className="fa fa-bomb"/>);
+ var revealedClass = item.isRevealed? ' bomb revealed' : '';
+ var icon = item.isRevealed? (<i className="fa fa-bomb"/>) : null;
return (
- <td className={'item bomb' + revealedClass} onContextMenu={this.flagItem} onClick={this.gameOver}>{icon}</td>
+ <td className={'item ' + revealedClass} onContextMenu={this.flagItem} onClick={this.gameOver}>{icon}</td>
);
}
}); |
bd37635462a0e0ccc8a1e240ec427ea5244acf18 | client/components/Main/Loading.jsx | client/components/Main/Loading.jsx | var React = require('react');
var Loading = React.createClass({
render: function() {
return(
<div className="text-center loading"><img src="https://3.bp.blogspot.com/-FjddXJJsIv8/VeaoXmv8HQI/AAAAAAAAGww/PlCl0uSR_9g/s1600/loading.gif"></img></div>
);
}
});
module.exports = Loading;
| var React = require('react');
// Please fix this link ASAP...
var Loading = React.createClass({
render: function() {
return(
<div className="text-center loading"><img src="https://3.bp.blogspot.com/-FjddXJJsIv8/VeaoXmv8HQI/AAAAAAAAGww/PlCl0uSR_9g/s1600/loading.gif"></img></div>
);
}
});
module.exports = Loading;
| Add a comment about replacing a link. | Add a comment about replacing a link.
| JSX | mit | Zanibas/Last-Stop,Zanibas/Last-Stop,Zanibas/Last-Stop | ---
+++
@@ -1,5 +1,7 @@
var React = require('react');
+
+// Please fix this link ASAP...
var Loading = React.createClass({
render: function() {
return( |
0a0f1b72730e4369db87ae555f643ffcefe57bca | common/routing/index.jsx | common/routing/index.jsx | import React from "react";
import {browserHistory, Route} from "react-router";
import {useBasename} from "history";
import {App, Views} from "containers";
import BlockComponent from "containers/Views/BlockDetail/BlockComponent";
import TransactionDetailComponent from "containers/Views/TransactionDetail/TransactionDetailComponent";
export const history = getHistory()
const PageNotFound = () => (
<section className="row" style={{marginTop: "125px"}}>
<h1>Nothing here!</h1>
</section>
);
export const Routing = () => (
<Route name="App" path='' component={App}>
<Route name="Views" path="/" component={Views}/>
<Route name="Block" path="/block/:height" component={BlockComponent}/>
<Route name="Transaction" path="/tx/:hash" component={TransactionDetailComponent}/>
<Route name="404" path="/*" component={PageNotFound}/>
</Route>
)
function getHistory() {
return useBasename(() => browserHistory)()
}
| import React from "react";
import {browserHistory, Route} from "react-router";
import {useBasename} from "history";
import {App, Views} from "containers";
import BlockComponent from "containers/Views/BlockDetail/BlockComponent";
import TransactionDetailComponent from "containers/Views/TransactionDetail/TransactionDetailComponent";
export const history = getHistory()
const PageNotFound = () => (
<section className="row" style={{marginBottom: '400px'}}>
<h1>Nothing here!</h1>
</section>
);
export const Routing = () => (
<Route name="App" path='' component={App}>
<Route name="Views" path="/" component={Views}/>
<Route name="Block" path="/block/:height" component={BlockComponent}/>
<Route name="Transaction" path="/tx/:hash" component={TransactionDetailComponent}/>
<Route name="404" path="/*" component={PageNotFound}/>
</Route>
)
function getHistory() {
return useBasename(() => browserHistory)()
}
| Improve "Nothing Here" route styling. | Improve "Nothing Here" route styling.
| JSX | mit | dternyak/monerochain,dternyak/monerochain | ---
+++
@@ -9,7 +9,7 @@
const PageNotFound = () => (
- <section className="row" style={{marginTop: "125px"}}>
+ <section className="row" style={{marginBottom: '400px'}}>
<h1>Nothing here!</h1>
</section>
); |
fc147e8d2634f01fe9ca55ef18399d3cd1d58526 | client/ui/Balance.jsx | client/ui/Balance.jsx | import React from 'react'
import {connect} from 'react-redux'
import _ from 'lodash'
import sb from 'satoshi-bitcoin'
const Balance = ({balance}) => {
return <span> Bitcoins: {_.isNumber(balance) ? sb.toBitcoin(balance) : '?'} </span>
}
export default connect(s => s)(Balance)
| import React from 'react'
import {connect} from 'react-redux'
import _ from 'lodash'
import sb from 'satoshi-bitcoin'
const Balance = ({balance}) => {
return <span> Bitcoins: {_.isNumber(balance) ? sb.toBitcoin(balance) : <i className='fa fa-spinner fa-spin' aria-hidden="true"></i>} </span>
}
export default connect(s => s)(Balance)
| Add spinning icon to the balance button | Add spinning icon to the balance button
| JSX | mit | SpidChain/spidchain-btcr,SpidChain/spidchain-btcr | ---
+++
@@ -4,7 +4,7 @@
import sb from 'satoshi-bitcoin'
const Balance = ({balance}) => {
- return <span> Bitcoins: {_.isNumber(balance) ? sb.toBitcoin(balance) : '?'} </span>
+ return <span> Bitcoins: {_.isNumber(balance) ? sb.toBitcoin(balance) : <i className='fa fa-spinner fa-spin' aria-hidden="true"></i>} </span>
}
export default connect(s => s)(Balance) |
d891cd0e7ecc756dc6064dcabde1748138a1823b | src/components/invisibe-select.jsx | src/components/invisibe-select.jsx | import React, { Children, useMemo } from 'react';
import classNames from 'classnames';
import '../../styles/shared/invisible-select.scss';
import { faCaretDown } from '@fortawesome/free-solid-svg-icons';
import { Icon } from './fontawesome-icons';
export function InvisibleSelect({ children, value, className, withCaret = false, ...rest }) {
const selectedLabel = useMemo(() => {
const optProps = Children.toArray(children)
.filter((c) => c.type === 'option')
.map((c) => c.props);
for (const o of optProps) {
if (value === o.value) {
return o.children;
}
}
return optProps[0].children;
}, [children, value]);
return (
<div
className={classNames(
'invisibleSelect',
className,
withCaret && 'invisibleSelect--withCaret',
)}
>
<div className="invisibleSelect__label">
{selectedLabel}
{withCaret && <Icon icon={faCaretDown} className="invisibleSelect__caret" />}
</div>
<select {...rest} className="invisibleSelect__select">
{children}
</select>
</div>
);
}
| import React, { Children, useMemo } from 'react';
import classNames from 'classnames';
import '../../styles/shared/invisible-select.scss';
import { faCaretDown } from '@fortawesome/free-solid-svg-icons';
import { Icon } from './fontawesome-icons';
export function InvisibleSelect({ children, value, className, withCaret = false, ...rest }) {
const selectedLabel = useMemo(() => {
const optProps = Children.toArray(children)
.filter((c) => c.type === 'option')
.map((c) => c.props);
for (const o of optProps) {
if (value === o.value) {
return o.children;
}
}
return optProps[0].children;
}, [children, value]);
return (
<div
className={classNames(
'invisibleSelect',
className,
withCaret && 'invisibleSelect--withCaret',
)}
>
<div className="invisibleSelect__label">
{selectedLabel}
{withCaret && <Icon icon={faCaretDown} className="invisibleSelect__caret" />}
</div>
<select value={value} className="invisibleSelect__select" {...rest}>
{children}
</select>
</div>
);
}
| Fix current item selection in InvisibleSelect component | Fix current item selection in InvisibleSelect component | JSX | mit | FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client | ---
+++
@@ -31,7 +31,7 @@
{selectedLabel}
{withCaret && <Icon icon={faCaretDown} className="invisibleSelect__caret" />}
</div>
- <select {...rest} className="invisibleSelect__select">
+ <select value={value} className="invisibleSelect__select" {...rest}>
{children}
</select>
</div> |
8e0a6b1d01f38b1ddf85b33a54ec411174a69085 | src/layouts/index.jsx | src/layouts/index.jsx | import React from "react";
import Helmet from "react-helmet";
import "font-awesome/scss/font-awesome.scss";
import "prismjs"
import "prismjs/components/prism-bash";
import "prismjs/themes/prism.css"
import Navigation from "../components/Navigation/Navigation";
import config from "../../data/SiteConfig";
import "./index.scss";
import "./global.scss";
import "./prism-verve";
export default class MainLayout extends React.Component {
render() {
const { children } = this.props;
return (
<Navigation config={config}>
<div>
<Helmet>
<meta name="description" content={config.siteDescription} />
</Helmet>
{children()}
</div>
</Navigation>
);
}
}
| import React from "react";
import Helmet from "react-helmet";
import "font-awesome/scss/font-awesome.scss";
import "prismjs"
import "prismjs/components/prism-bash";
import "prismjs/themes/prism.css"
import Navigation from "../components/Navigation/Navigation";
import config from "../../data/SiteConfig";
import "./index.scss";
import "./global.scss";
import "./prism-verve";
export default class MainLayout extends React.Component {
componentDidUpdate() {
Prism.highlightAll();
}
render() {
const { children } = this.props;
return (
<Navigation config={config}>
<div>
<Helmet>
<meta name="description" content={config.siteDescription} />
</Helmet>
{children()}
</div>
</Navigation>
);
}
}
| Refresh Prism highlight on compDidUpdate | Refresh Prism highlight on compDidUpdate
| JSX | mit | tadeuzagallo/verve-website | ---
+++
@@ -12,6 +12,10 @@
import "./prism-verve";
export default class MainLayout extends React.Component {
+ componentDidUpdate() {
+ Prism.highlightAll();
+ }
+
render() {
const { children } = this.props;
return ( |
d43e8579b0611f047bf5f8512fb2bc152a60b3aa | app/assets/javascripts/components/news_feed/news_feed_item_bounty_review_ready.js.jsx | app/assets/javascripts/components/news_feed/news_feed_item_bounty_review_ready.js.jsx | var NewsFeedItemEvent = require('./news_feed_item_event.js.jsx');
module.exports = React.createClass({
displayName: 'NewsFeedItemBountyReviewReady',
propTypes: {
actor: React.PropTypes.object.isRequired,
award_url: React.PropTypes.string,
id: React.PropTypes.string.isRequired
},
render: function() {
var actor = this.props.actor;
return (
<NewsFeedItemEvent>
{this.renderAwardButtons()}
<div>
<a href={actor.url}>{actor.username}</a>
{' '} submitted work for review
</div>
</NewsFeedItemEvent>
);
},
renderAwardButtons: function() {
var actor = this.props.actor;
var awardUrl = this.props.award_url;
var id = this.props.id;
if (awardUrl) {
return (
<div className="btn-group right">
<a className="btn btn-default btn-xs"
href={awardUrl + '?event_id=' + id}
data-method="patch"
data-confirm={'Are you sure you want to award this task to @' + actor.username + '?'}>
Award
</a>
<a className="btn btn-primary btn-xs"
href={awardUrl + '?event_id=' + id + '&close=true'}
data-method="patch"
data-confirm={'Are you sure you want to award this task to @' + actor.username + '?'}>
Award and close
</a>
</div>
);
}
}
});
| 'use strict'
import NewsFeedItemEvent from './news_feed_item_event.js.jsx';
import List from '../ui/list.js.jsx';
const NewsFeedItemBountyReviewReady = React.createClass({
propTypes: {
actor: React.PropTypes.object.isRequired,
award_url: React.PropTypes.string,
id: React.PropTypes.string.isRequired
},
render: function() {
const {actor, id} = this.props
const awardUrl = this.props.award_url
return (
<NewsFeedItemEvent>
<div className="mb1">
<a className="bold black" href={actor.url}>
{actor.username}
</a> submitted work to be reviewed by the core team
</div>
<List type="piped">
<List.Item>
<a className="gray-2 black-hover"
href={awardUrl + '?event_id=' + id}
data-method="patch"
data-confirm={'Are you sure you want to award this task to @' + actor.username + '?'}>
Award
</a>
</List.Item>
<List.Item>
<a className="gray-2 black-hover"
href={awardUrl + '?event_id=' + id + '&close=true'}
data-method="patch"
data-confirm={'Are you sure you want to award this task to @' + actor.username + '?'}>
Award and close
</a>
</List.Item>
</List>
</NewsFeedItemEvent>
)
},
})
export default NewsFeedItemBountyReviewReady
| Bring award and close buttons in line with the other style. | Bring award and close buttons in line with the other style.
| JSX | agpl-3.0 | assemblymade/meta,lachlanjc/meta,lachlanjc/meta,assemblymade/meta,assemblymade/meta,assemblymade/meta,lachlanjc/meta,lachlanjc/meta | ---
+++
@@ -1,7 +1,9 @@
-var NewsFeedItemEvent = require('./news_feed_item_event.js.jsx');
+'use strict'
-module.exports = React.createClass({
- displayName: 'NewsFeedItemBountyReviewReady',
+import NewsFeedItemEvent from './news_feed_item_event.js.jsx';
+import List from '../ui/list.js.jsx';
+
+const NewsFeedItemBountyReviewReady = React.createClass({
propTypes: {
actor: React.PropTypes.object.isRequired,
award_url: React.PropTypes.string,
@@ -9,42 +11,37 @@
},
render: function() {
- var actor = this.props.actor;
+ const {actor, id} = this.props
+ const awardUrl = this.props.award_url
return (
<NewsFeedItemEvent>
- {this.renderAwardButtons()}
+ <div className="mb1">
+ <a className="bold black" href={actor.url}>
+ {actor.username}
+ </a> submitted work to be reviewed by the core team
+ </div>
+ <List type="piped">
+ <List.Item>
+ <a className="gray-2 black-hover"
+ href={awardUrl + '?event_id=' + id}
+ data-method="patch"
+ data-confirm={'Are you sure you want to award this task to @' + actor.username + '?'}>
+ Award
+ </a>
+ </List.Item>
+ <List.Item>
+ <a className="gray-2 black-hover"
+ href={awardUrl + '?event_id=' + id + '&close=true'}
+ data-method="patch"
+ data-confirm={'Are you sure you want to award this task to @' + actor.username + '?'}>
+ Award and close
+ </a>
+ </List.Item>
+ </List>
+ </NewsFeedItemEvent>
+ )
+ },
+})
- <div>
- <a href={actor.url}>{actor.username}</a>
- {' '} submitted work for review
- </div>
- </NewsFeedItemEvent>
- );
- },
-
- renderAwardButtons: function() {
- var actor = this.props.actor;
- var awardUrl = this.props.award_url;
- var id = this.props.id;
-
- if (awardUrl) {
- return (
- <div className="btn-group right">
- <a className="btn btn-default btn-xs"
- href={awardUrl + '?event_id=' + id}
- data-method="patch"
- data-confirm={'Are you sure you want to award this task to @' + actor.username + '?'}>
- Award
- </a>
- <a className="btn btn-primary btn-xs"
- href={awardUrl + '?event_id=' + id + '&close=true'}
- data-method="patch"
- data-confirm={'Are you sure you want to award this task to @' + actor.username + '?'}>
- Award and close
- </a>
- </div>
- );
- }
- }
-});
+export default NewsFeedItemBountyReviewReady |
6370c80868784ad357040462d2a1d8bd80aa552f | client/views/pages/NotFoundPage.jsx | client/views/pages/NotFoundPage.jsx | import React from 'react'
import { Link } from 'react-router-dom'
import Icon from '../components/Icon'
export default function NotFoundPage() {
return (
<div className="NotFoundPage">
<h1>
I couldn't find that page <Icon i="error" s="xxl" />
</h1>
<p>
<Icon i="error" /> 404 Not Found <Icon i="error" />{' '}
</p>
<p>
<Link to="/">
Go back <Icon i="home" /> home
</Link>
</p>
</div>
)
}
| import React from 'react'
import { Link } from 'react-router-dom'
import Icon from '../components/Icon'
export default function NotFoundPage() {
return (
<div className="NotFoundPage">
<section>
<h1>
I couldn't find that page <Icon i="error" s="xxl" />
</h1>
<p>
<Icon i="error" /> 404 Not Found <Icon i="error" />{' '}
</p>
<p>
<Link to="/">
Go back <Icon i="home" /> home
</Link>
</p>
</section>
</div>
)
}
| Update spacing on Not Found page | Update spacing on Not Found page
| JSX | apache-2.0 | heiskr/sagefy,heiskr/sagefy,heiskr/sagefy,heiskr/sagefy | ---
+++
@@ -5,17 +5,19 @@
export default function NotFoundPage() {
return (
<div className="NotFoundPage">
- <h1>
- I couldn't find that page <Icon i="error" s="xxl" />
- </h1>
- <p>
- <Icon i="error" /> 404 Not Found <Icon i="error" />{' '}
- </p>
- <p>
- <Link to="/">
- Go back <Icon i="home" /> home
- </Link>
- </p>
+ <section>
+ <h1>
+ I couldn't find that page <Icon i="error" s="xxl" />
+ </h1>
+ <p>
+ <Icon i="error" /> 404 Not Found <Icon i="error" />{' '}
+ </p>
+ <p>
+ <Link to="/">
+ Go back <Icon i="home" /> home
+ </Link>
+ </p>
+ </section>
</div>
)
} |
7e76f4e946ccdf90c8d80c63416cb44702e47522 | web/static/js/components/alert.jsx | web/static/js/components/alert.jsx | import React from "react"
import PropTypes from "prop-types"
import Modal from "react-modal"
import { bindActionCreators } from "redux"
import { connect } from "react-redux"
import { actions as actionCreators } from "../redux"
Modal.defaultStyles.content.zIndex = 2
Modal.defaultStyles.overlay.zIndex = 2
Modal.setAppElement("body")
export const Alert = props => {
const { actions, config } = props
if (!config) return null
const { headerText, BodyComponent } = config
return (
<Modal
className="ui tiny modal visible transition fade in active"
contentLabel="Alert"
isOpen
>
<div className="ui basic padded clearing segment">
<p className="ui dividing header">
{headerText}
</p>
<div className="ui content">
<BodyComponent />
</div>
<br />
<button
autoFocus /* eslint-disable-line jsx-a11y/no-autofocus */
type="button"
className="ui blue right floated button"
onClick={actions.clearAlert}
>
Got it!
</button>
</div>
</Modal>
)
}
Alert.propTypes = {
actions: PropTypes.object,
config: PropTypes.object,
}
Alert.defaultProps = {
actions: {},
config: null,
}
const mapStateToProps = state => ({
alert: state.alert,
})
const mapDispatchToProps = dispatch => ({
actions: bindActionCreators(actionCreators, dispatch),
})
export default connect(
mapStateToProps,
mapDispatchToProps
)(Alert)
| import React from "react"
import PropTypes from "prop-types"
import Modal from "react-modal"
import { bindActionCreators } from "redux"
import { connect } from "react-redux"
import { actions as actionCreators } from "../redux"
Modal.defaultStyles.content.zIndex = 2
Modal.defaultStyles.overlay.zIndex = 2
Modal.setAppElement("body")
export const Alert = props => {
const { actions, config } = props
if (!config) return null
const { headerText, BodyComponent } = config
return (
<Modal
className="ui basic small modal visible transition fade in active"
contentLabel="Alert"
isOpen
>
<div className="ui basic padded clearing segment">
<p className="ui dividing large header">
{headerText}
</p>
<div className="ui content">
<BodyComponent />
</div>
<br />
<button
autoFocus /* eslint-disable-line jsx-a11y/no-autofocus */
type="button"
className="ui blue right floated button"
onClick={actions.clearAlert}
>
Got it!
</button>
</div>
</Modal>
)
}
Alert.propTypes = {
actions: PropTypes.object,
config: PropTypes.object,
}
Alert.defaultProps = {
actions: {},
config: null,
}
const mapStateToProps = state => ({
alert: state.alert,
})
const mapDispatchToProps = dispatch => ({
actions: bindActionCreators(actionCreators, dispatch),
})
export default connect(
mapStateToProps,
mapDispatchToProps
)(Alert)
| Increase size of stage change content | Increase size of stage change content
| JSX | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | ---
+++
@@ -19,12 +19,12 @@
return (
<Modal
- className="ui tiny modal visible transition fade in active"
+ className="ui basic small modal visible transition fade in active"
contentLabel="Alert"
isOpen
>
<div className="ui basic padded clearing segment">
- <p className="ui dividing header">
+ <p className="ui dividing large header">
{headerText}
</p>
<div className="ui content"> |
9e2edef13599c4fbd48f2a48ef8b4b63a3b0d89c | src/components/Sidebar/InfoTab.jsx | src/components/Sidebar/InfoTab.jsx | import React from 'react';
import './Sidebar.scss';
import baseTab from './BaseTab';
function InfoTab() {
return (
<div>
<section>
<p className="info-paragraph">
Freesound Explorer is a visual interface for exploring Freesound content
in a 2-dimensional space and create music at the same time :)
</p>
</section>
<section>
<p className="info-paragraph">
Please, <a href="https://github.com/ffont/freesound-explorer#tutorialhow-to-use" target="_blank">
check this tutorial</a> to learn how Freesound Explorer works.
</p>
</section>
<section>
<p className="info-paragraph">
Freesound Explorer has been developed (so far) by Frederic Font and Giuseppe Bandiera at the
Music Technology Group, Universitat Pompeu Fabra. You can find the <a href="https://github.com/ffont/freesound-explorer" target="_blank">
source code here</a>.
</p>
</section>
</div>
);
}
export default baseTab('About...', InfoTab);
| import React from 'react';
import './Sidebar.scss';
import baseTab from './BaseTab';
function InfoTab() {
return (
<div>
<section>
<p className="info-paragraph">
Freesound Explorer is a visual interface for exploring Freesound content
in a 2-dimensional space and create music at the same time :)
</p>
</section>
<section>
<p className="info-paragraph">
Please, <a href="https://github.com/ffont/freesound-explorer#tutorialhow-to-use" target="_blank">
check this tutorial</a> to learn how Freesound Explorer works.
</p>
</section>
<section>
<p className="info-paragraph">
Freesound Explorer has been developed (so far) by Frederic Font and Giuseppe Bandiera at the
Music Technology Group (Universitat Pompeu Fabra), and by Eric Lehmann at Filmuniversität Babelsberg.
You can find the <a href="https://github.com/ffont/freesound-explorer" target="_blank"> source code here</a>.
</p>
</section>
</div>
);
}
export default baseTab('About...', InfoTab);
| Update authors in info tab | Update authors in info tab
| JSX | mit | ffont/freesound-explorer,ffont/freesound-explorer,ffont/freesound-explorer | ---
+++
@@ -20,8 +20,8 @@
<section>
<p className="info-paragraph">
Freesound Explorer has been developed (so far) by Frederic Font and Giuseppe Bandiera at the
- Music Technology Group, Universitat Pompeu Fabra. You can find the <a href="https://github.com/ffont/freesound-explorer" target="_blank">
- source code here</a>.
+ Music Technology Group (Universitat Pompeu Fabra), and by Eric Lehmann at Filmuniversität Babelsberg.
+ You can find the <a href="https://github.com/ffont/freesound-explorer" target="_blank"> source code here</a>.
</p>
</section>
</div> |
9c453c9755db9006efbde59532e557c54ea04eb9 | src/VerticalTimeline.jsx | src/VerticalTimeline.jsx | import React, { Component } from 'react';
import PropTypes from 'prop-types';
class VerticalTimeline extends Component {
render() {
const { animate, children } = this.props;
let { className } = this.props;
className += ' vertical-timeline';
if (animate) {
className += ' vertical-timeline--animate';
}
return (
<div className={className.trim()}>
{children}
</div>
);
}
}
VerticalTimeline.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
]).isRequired,
className: PropTypes.string,
animate: PropTypes.bool
};
VerticalTimeline.defaultProps = {
animate: true,
className: ''
};
export default VerticalTimeline;
| import React, { Component } from 'react';
import PropTypes from 'prop-types';
class VerticalTimeline extends Component {
render() {
const { animate, children } = this.props;
let { className } = this.props;
className += ' vertical-timeline';
if (animate) {
className += ' vertical-timeline--animate';
}
return (
<div className={className.trim()}>
{children}
</div>
);
}
}
VerticalTimeline.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
]),
className: PropTypes.string,
animate: PropTypes.bool
};
VerticalTimeline.defaultProps = {
animate: true,
className: ''
};
export default VerticalTimeline;
| Remove isRequired for children prop | Remove isRequired for children prop
| JSX | mit | stephane-monnot/react-vertical-timeline | ---
+++
@@ -24,7 +24,7 @@
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
- ]).isRequired,
+ ]),
className: PropTypes.string,
animate: PropTypes.bool
}; |
b3a235b3231e813938969af51dea85a82c6d877f | app/components/app.jsx | app/components/app.jsx | import React, { Component, PropTypes } from 'react'
import MonthList from './month-list'
import { buildMonthsRange } from '../utils/date'
export default class App extends Component {
static propTypes = {
actions: PropTypes.object.isRequired,
events: PropTypes.object.isRequired,
ui: PropTypes.object.isRequired
}
constructor () {
super()
this.state = {
count: 0
}
}
onClick() {
this.setState({count: this.state.count + 1})
}
componentDidMount () {
this.props.actions.fetchEvents()
}
render () {
const {startMonth, endMonth, fetching} = this.props.ui
if (fetching) {
return <strong>Fetching…</strong>
}
const range = buildMonthsRange(startMonth, endMonth)
return <div>
<span onClick={::this.onClick}>Count = {this.state.count}</span>
<MonthList events={this.props.events.events} range={range} />
</div>
}
}
| import React, { Component, PropTypes } from 'react'
import MonthList from './month-list'
import { buildMonthsRange } from '../utils/date'
export default class App extends Component {
static propTypes = {
actions: PropTypes.object.isRequired,
events: PropTypes.object.isRequired,
ui: PropTypes.object.isRequired
}
componentDidMount () {
this.props.actions.fetchEvents()
}
render () {
const {startMonth, endMonth, fetching} = this.props.ui
if (fetching) {
return <strong>Fetching…</strong>
}
const range = buildMonthsRange(startMonth, endMonth)
return <MonthList events={this.props.events.events} range={range} />
}
}
| Remove the 'count' test (not needed but let's remember the decision) | Remove the 'count' test (not needed but let's remember the decision)
| JSX | mit | byteclubfr/bc-planner,lmtm/bc-planner,byteclubfr/bc-planner,lmtm/bc-planner | ---
+++
@@ -8,17 +8,6 @@
actions: PropTypes.object.isRequired,
events: PropTypes.object.isRequired,
ui: PropTypes.object.isRequired
- }
-
- constructor () {
- super()
- this.state = {
- count: 0
- }
- }
-
- onClick() {
- this.setState({count: this.state.count + 1})
}
componentDidMount () {
@@ -34,10 +23,7 @@
const range = buildMonthsRange(startMonth, endMonth)
- return <div>
- <span onClick={::this.onClick}>Count = {this.state.count}</span>
- <MonthList events={this.props.events.events} range={range} />
- </div>
+ return <MonthList events={this.props.events.events} range={range} />
}
} |
1b47c3b7ad49ce70ef48bee161cf79f42c509b76 | index.jsx | index.jsx | require("./node_modules/bootstrap/dist/css/bootstrap.min.css");
import React from 'react';
import ReactDOM from 'react-dom';
import {Grid} from './Ardagryd';
import data from './testData'
import 'react-select/dist/react-select.css';
export class App extends React.Component {
render() {
let externalData = {getThis: "External data"};
var config = {showToolbar: true, paging: 10};
var columns = {
name: {
sort: true,
displayValueGetter: ({value, object, columns}) => <span>{value}</span>
},
edit: {
label: "Edit",
hideTools: true,
displayValueGetter: ({value, object, columns}) => <a href={"#"}> EDIT ROW</a>
},
id: {show: false}
};
return (
<div>
<Grid objects={data} columns={columns} config={config} />
</div>
);
}
}
ReactDOM.render(<App/>, document.querySelector("#myApp"));
| require("./node_modules/bootstrap/dist/css/bootstrap.min.css");
import React from 'react';
import ReactDOM from 'react-dom';
import {Grid} from './Ardagryd';
import data from './testData'
import 'react-select/dist/react-select.css';
export class App extends React.Component {
render() {
let externalData = {getThis: "External data"};
var config = {showToolbar: true, paging: 10};
var columns = {
name: {
sort: true,
displayValueGetter: ({value, object, columns}) => <span>{value}</span>
},
edit: {
label: "Edit",
hideTools: true,
sortable: false,
displayValueGetter: ({value, object, columns}) => <a href={"#"}> EDIT ROW</a>
},
id: {show: false}
};
return (
<div>
<Grid objects={data} columns={columns} config={config} />
</div>
);
}
}
ReactDOM.render(<App/>, document.querySelector("#myApp"));
| Mark edit column as unsortable | Mark edit column as unsortable | JSX | mit | eddyson-de/react-grid,eddyson-de/react-grid | ---
+++
@@ -24,6 +24,7 @@
edit: {
label: "Edit",
hideTools: true,
+ sortable: false,
displayValueGetter: ({value, object, columns}) => <a href={"#"}> EDIT ROW</a>
},
id: {show: false} |
ded2ba6ffdaf0f4cc8cdfe2113b57cb77c472872 | src/js/components/session/index.jsx | src/js/components/session/index.jsx | import debug from "debug";
import React, { Component, PropTypes } from "react";
import moment from "moment";
import Presenter from "../presenter";
const log = debug("schedule:components:session");
export class Session extends Component {
render() {
const { session } = this.props;
return (
<div className="session">
<h4><a href="{session.link}">{session.title}</a></h4>
<div className="session__time">
<span className="session__start">{moment(session.start).calendar()}</span>
{" "}
<span className="session__duration">({session.hasOwnProperty("duration") ? `${session.duration} min` : `o.e.`})</span>
{
session.presenter &&
<Presenter presenter={session.presenter} />
}
</div>
</div>
);
}
}
Session.propTypes = {
session: PropTypes.shape({
title: PropTypes.string.isRequired,
start: PropTypes.instanceOf(Date).isRequired
})
};
export default Session;
| import debug from "debug";
import React, { Component, PropTypes } from "react";
import moment from "moment";
import Presenter from "../presenter";
const log = debug("schedule:components:session");
export class Session extends Component {
render() {
const { session } = this.props;
return (
<div className="session">
<h4><a href={session.link}>{session.title}</a></h4>
<div className="session__time">
<span className="session__start">{moment(session.start).calendar()}</span>
{" "}
<span className="session__duration">({session.hasOwnProperty("duration") ? `${session.duration} min` : `o.e.`})</span>
{
session.presenter &&
<Presenter presenter={session.presenter} />
}
</div>
</div>
);
}
}
Session.propTypes = {
session: PropTypes.shape({
title: PropTypes.string.isRequired,
start: PropTypes.instanceOf(Date).isRequired
})
};
export default Session;
| Fix link to session info | Fix link to session info
| JSX | mit | orangecms/schedule,orangecms/schedule,nikcorg/schedule,orangecms/schedule,nikcorg/schedule,nikcorg/schedule | ---
+++
@@ -10,7 +10,7 @@
const { session } = this.props;
return (
<div className="session">
- <h4><a href="{session.link}">{session.title}</a></h4>
+ <h4><a href={session.link}>{session.title}</a></h4>
<div className="session__time">
<span className="session__start">{moment(session.start).calendar()}</span>
{" "} |
7ffd45956d2902f9e3c68a3994de4ffce5ee5dfe | src/js/components/App.jsx | src/js/components/App.jsx | import React from 'react';
import Header from './Header.jsx';
import DateHeader from './DateHeader.jsx';
import Diary from './Diary.jsx';
import TasksContainer from '../containers/TasksContainer.jsx';
import Utils from '../utils.js';
export default class App extends React.Component {
constructor(props) {
super(props);
const today = new Date();
this.state = {
date: today,
};
}
render() {
return (
<div>
<Header />
<DateHeader />
<div className="section">
<div className="columns">
<TasksContainer date={Utils.formatDate(this.state.date)} />
<Diary date={Utils.formatDate(this.state.date)} />
</div>
</div>
</div>
);
}
}
| import React from 'react';
import Header from './Header.jsx';
import DateHeader from './DateHeader.jsx';
import Diary from './Diary.jsx';
import TasksContainer from '../containers/TasksContainer.jsx';
import Utils from '../utils.js';
export default class App extends React.Component {
constructor(props) {
super(props);
const today = new Date();
this.state = {
date: today,
};
this.prevDate = this.prevDate.bind(this);
this.nextDate = this.nextDate.bind(this);
}
prevDate() {
const date = new Date(this.state.date.setDate(this.state.date.getDate() - 1));
this.setState({
date,
});
}
nextDate() {
const date = new Date(this.state.date.setDate(this.state.date.getDate() + 1));
this.setState({
date,
});
}
render() {
return (
<div>
<Header />
<DateHeader
date={Utils.formatDate(this.state.date)}
prevDate={this.prevDate}
nextDate={this.nextDate}
/>
<div className="section">
<div className="columns">
<TasksContainer date={Utils.formatDate(this.state.date)} />
<Diary date={Utils.formatDate(this.state.date)} />
</div>
</div>
</div>
);
}
}
| Implement prev/next Date on click in parent component | Implement prev/next Date on click in parent component
| JSX | mit | tanaka0325/nippo-web,tanaka0325/nippo-web | ---
+++
@@ -15,13 +15,34 @@
this.state = {
date: today,
};
+
+ this.prevDate = this.prevDate.bind(this);
+ this.nextDate = this.nextDate.bind(this);
+ }
+
+ prevDate() {
+ const date = new Date(this.state.date.setDate(this.state.date.getDate() - 1));
+ this.setState({
+ date,
+ });
+ }
+
+ nextDate() {
+ const date = new Date(this.state.date.setDate(this.state.date.getDate() + 1));
+ this.setState({
+ date,
+ });
}
render() {
return (
<div>
<Header />
- <DateHeader />
+ <DateHeader
+ date={Utils.formatDate(this.state.date)}
+ prevDate={this.prevDate}
+ nextDate={this.nextDate}
+ />
<div className="section">
<div className="columns">
<TasksContainer date={Utils.formatDate(this.state.date)} /> |
eccf53d0106764be093f2baebd03f9dd2896165f | normandy/control/static/control/js/components/DeleteRecipe.jsx | normandy/control/static/control/js/components/DeleteRecipe.jsx | import React from 'react'
import { push } from 'react-router-redux'
import { makeApiRequest, recipeDeleted } from '../actions/ControlActions.js'
import composeRecipeContainer from './RecipeContainer.jsx'
class DeleteRecipe extends React.Component {
render() {
const { recipe, recipeId, dispatch } = this.props;
if (recipe) {
return (
<div className="fluid-7">
<form action="" className="crud-form">
<p>Are you sure you want to delete "{recipe.name}"?</p>
<div className="form-action-buttons">
<div className="fluid-2 float-right">
<input type="submit" value="Confirm" class="delete" onClick={(e) => {
e.preventDefault();
dispatch(makeApiRequest('deleteRecipe', { recipeId }))
.then(response => {
dispatch(recipeDeleted(recipeId));
dispatch(push('/control/'));
});
}} />
</div>
</div>
</form>
</div>
)
} else {
return null
}
}
}
export default composeRecipeContainer(DeleteRecipe);
| import React from 'react'
import { push } from 'react-router-redux'
import { makeApiRequest, recipeDeleted } from '../actions/ControlActions.js'
import composeRecipeContainer from './RecipeContainer.jsx'
class DeleteRecipe extends React.Component {
deleteRecipe(event) {
const { dispatch, recipeId } = this.props;
event.preventDefault();
dispatch(makeApiRequest('deleteRecipe', { recipeId }))
.then(response => {
dispatch(recipeDeleted(recipeId));
dispatch(push('/control/'));
});
}
render() {
const { recipe, recipeId } = this.props;
if (recipe) {
return (
<div className="fluid-7">
<form action="" className="crud-form">
<p>Are you sure you want to delete "{recipe.name}"?</p>
<div className="form-action-buttons">
<div className="fluid-2 float-right">
<input type="submit" value="Confirm" class="delete" onClick={::this.deleteRecipe} />
</div>
</div>
</form>
</div>
)
} else {
return null
}
}
}
export default composeRecipeContainer(DeleteRecipe);
| Move deleteRecipe into separate method | Move deleteRecipe into separate method
| JSX | mpl-2.0 | mozilla/normandy,Osmose/normandy,mozilla/normandy,Osmose/normandy,mozilla/normandy,mozilla/normandy,Osmose/normandy,Osmose/normandy | ---
+++
@@ -4,8 +4,19 @@
import composeRecipeContainer from './RecipeContainer.jsx'
class DeleteRecipe extends React.Component {
+ deleteRecipe(event) {
+ const { dispatch, recipeId } = this.props;
+
+ event.preventDefault();
+ dispatch(makeApiRequest('deleteRecipe', { recipeId }))
+ .then(response => {
+ dispatch(recipeDeleted(recipeId));
+ dispatch(push('/control/'));
+ });
+ }
+
render() {
- const { recipe, recipeId, dispatch } = this.props;
+ const { recipe, recipeId } = this.props;
if (recipe) {
return (
<div className="fluid-7">
@@ -13,14 +24,7 @@
<p>Are you sure you want to delete "{recipe.name}"?</p>
<div className="form-action-buttons">
<div className="fluid-2 float-right">
- <input type="submit" value="Confirm" class="delete" onClick={(e) => {
- e.preventDefault();
- dispatch(makeApiRequest('deleteRecipe', { recipeId }))
- .then(response => {
- dispatch(recipeDeleted(recipeId));
- dispatch(push('/control/'));
- });
- }} />
+ <input type="submit" value="Confirm" class="delete" onClick={::this.deleteRecipe} />
</div>
</div>
</form> |
d3a44d020dcfb731ca05ccce6312d842c0785b1b | app/scenes/Root/App.jsx | app/scenes/Root/App.jsx | import React from 'react';
import { Link } from 'react-router-dom';
import Routes from './Routes';
import './styles.scss';
export default function App() {
return (
<div>
<nav className="main-menu">
<Link className="logo" to="/">
<img src="images/logo.svg" alt="React Fission" />
<h1>React Fission</h1>
</Link>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="github">API Example</Link>
</li>
<li>
<a href="https://github.com/matheusmariano/react-fission" target="_blank" rel="noopener noreferrer">GitHub</a>
</li>
</ul>
</nav>
<Routes />
</div>
);
}
| import React from 'react';
import { Link } from 'react-router-dom';
import Routes from './Routes';
import './styles.scss';
export default function App() {
return (
<div>
<nav className="main-menu">
<Link
className="logo"
to="/"
>
<img
src="images/logo.svg"
alt="React Fission"
/>
<h1>React Fission</h1>
</Link>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="github">API Example</Link>
</li>
<li>
<a
href="https://github.com/matheusmariano/react-fission"
target="_blank"
rel="noopener noreferrer"
>
<span>GitHub</span>
</a>
</li>
</ul>
</nav>
<Routes />
</div>
);
}
| Break in lines elements with many parameters | Break in lines elements with many parameters
| JSX | mit | matheusmariano/react-fission,matheusmariano/react-fission | ---
+++
@@ -7,8 +7,14 @@
return (
<div>
<nav className="main-menu">
- <Link className="logo" to="/">
- <img src="images/logo.svg" alt="React Fission" />
+ <Link
+ className="logo"
+ to="/"
+ >
+ <img
+ src="images/logo.svg"
+ alt="React Fission"
+ />
<h1>React Fission</h1>
</Link>
<ul>
@@ -19,7 +25,13 @@
<Link to="github">API Example</Link>
</li>
<li>
- <a href="https://github.com/matheusmariano/react-fission" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <a
+ href="https://github.com/matheusmariano/react-fission"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <span>GitHub</span>
+ </a>
</li>
</ul>
</nav> |
9bdfba619eb46d6eb225e807ff7afee26aa8664f | app/components/App.jsx | app/components/App.jsx | import React, { Component } from 'react'
import PropTypes from '../lib/PropTypes'
import Webchat from './Webchat'
export default class App extends Component {
static propTypes = {
type: PropTypes.oneOf(['client', 'client-overlay', 'agent']).isRequired
}
render () {
return <div className="f4 h-100">
<Webchat type={this.props.type} />
</div>
}
}
| import React, { Component } from 'react'
import PropTypes from '../lib/PropTypes'
import Webchat from './Webchat'
export default class App extends Component {
static propTypes = {
type: PropTypes.oneOf(['client', 'client-overlay', 'agent']).isRequired
}
render () {
return <div role="application" className="f4 h-100">
<Webchat type={this.props.type} />
</div>
}
}
| Add aria role application to webchat | Add aria role application to webchat
| JSX | mit | quis/notify-public-research-prototype,quis/notify-public-research-prototype,quis/notify-public-research-prototype | ---
+++
@@ -8,7 +8,7 @@
}
render () {
- return <div className="f4 h-100">
+ return <div role="application" className="f4 h-100">
<Webchat type={this.props.type} />
</div>
} |
e552525f8196087a21496805c1411e6d27d18876 | src/readme_page.jsx | src/readme_page.jsx | /**
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// MODULES //
import React from 'react';
import HTML_FRAGMENT_CACHE from './html_fragment_cache.js';
// MAIN //
const ReadmePage = ( props ) => {
const html = HTML_FRAGMENT_CACHE[ props.path ] || '{{ FRAGMENT }}';
return ( <div
id="readme-container"
className="readme"
suppressHydrationWarning
dangerouslySetInnerHTML={{ __html: html }}
/> );
};
// EXPORTS //
export default ReadmePage;
| /**
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// MODULES //
import React from 'react';
import HTML_FRAGMENT_CACHE from './html_fragment_cache.js';
// MAIN //
/**
* Returns a React component for rendering a README.
*
* @private
* @param {Object} props - component properties
* @returns {ReactComponent} React component
*/
function ReadmePage( props ) {
const html = HTML_FRAGMENT_CACHE[ props.path ] || '{{ FRAGMENT }}';
return (
<div
id="readme-container"
className="readme"
suppressHydrationWarning
dangerouslySetInnerHTML={{ __html: html }}
/>
);
};
// EXPORTS //
export default ReadmePage;
| Add JSDoc and convert function type | Add JSDoc and convert function type
| JSX | apache-2.0 | stdlib-js/www,stdlib-js/www,stdlib-js/www | ---
+++
@@ -24,14 +24,23 @@
// MAIN //
-const ReadmePage = ( props ) => {
+/**
+* Returns a React component for rendering a README.
+*
+* @private
+* @param {Object} props - component properties
+* @returns {ReactComponent} React component
+*/
+function ReadmePage( props ) {
const html = HTML_FRAGMENT_CACHE[ props.path ] || '{{ FRAGMENT }}';
- return ( <div
- id="readme-container"
- className="readme"
- suppressHydrationWarning
- dangerouslySetInnerHTML={{ __html: html }}
- /> );
+ return (
+ <div
+ id="readme-container"
+ className="readme"
+ suppressHydrationWarning
+ dangerouslySetInnerHTML={{ __html: html }}
+ />
+ );
};
|
f2ac75fff8e112bd14bc391c2b40a565a14c65f5 | src/settings/index.jsx | src/settings/index.jsx | import { h, render } from 'preact';
import SettingsComponent from './components';
import reducer from 'settings/reducers/setting';
import Provider from 'shared/store/provider';
import { createStore } from 'shared/store';
const store = createStore(reducer);
document.addEventListener('DOMContentLoaded', () => {
let wrapper = document.getElementById('vimvixen-settings');
render(
<Provider store={store}>
<SettingsComponent />
</Provider>,
wrapper
);
});
| import { h, render } from 'preact';
import SettingsComponent from './components';
import reducer from './reducers/setting';
import { Provider } from 'preact-redux';
import promise from 'redux-promise';
import { createStore, applyMiddleware } from 'redux';
const store = createStore(
reducer,
applyMiddleware(promise),
);
document.addEventListener('DOMContentLoaded', () => {
let wrapper = document.getElementById('vimvixen-settings');
render(
<Provider store={store}>
<SettingsComponent />
</Provider>,
wrapper
);
});
| Use official redux on settings | Use official redux on settings
| JSX | mit | ueokande/vim-vixen,ueokande/vim-vixen,ueokande/vim-vixen | ---
+++
@@ -1,10 +1,14 @@
import { h, render } from 'preact';
import SettingsComponent from './components';
-import reducer from 'settings/reducers/setting';
-import Provider from 'shared/store/provider';
-import { createStore } from 'shared/store';
+import reducer from './reducers/setting';
+import { Provider } from 'preact-redux';
+import promise from 'redux-promise';
+import { createStore, applyMiddleware } from 'redux';
-const store = createStore(reducer);
+const store = createStore(
+ reducer,
+ applyMiddleware(promise),
+);
document.addEventListener('DOMContentLoaded', () => {
let wrapper = document.getElementById('vimvixen-settings'); |
878b90b65d3e8e10955a9b15abbe1a20ba8e1001 | src/components/memory/MemoryNav.jsx | src/components/memory/MemoryNav.jsx | import React, {Component} from 'react';
import {Button, ButtonGroup, ButtonToolbar, OverlayTrigger, Popover, Glyphicon} from 'react-bootstrap';
import MemorySearch from './MemorySearch';
export default class MemoryNav extends Component {
render() {
const scrollDelta = 1;
const groupStyle = { float: "none" };
return <ButtonToolbar className="center-block">
<ButtonGroup style={groupStyle}>
<Button onClick={() => this.props.onScrollBy(-scrollDelta)}>
<Glyphicon glyph="chevron-up" alt="Scroll memory up" />
</Button>
<Button onClick={() => this.props.onScrollBy(scrollDelta)}>
<Glyphicon glyph="chevron-down" alt="Scroll memory down" />
</Button>
<Button onClick={this.props.onScrollToPC}>
Jump to PC
</Button>
<OverlayTrigger
placement="bottom"
trigger="click"
rootClose
overlay={
<Popover id="memory-search">
<MemorySearch
symbolTable={this.props.symbolTable}
onScrollTo={this.props.onScrollTo}
ref="search"
/>
</Popover>
}
onEntering={() => this.refs.search.focus()}
>
<Button>Jump to…</Button>
</OverlayTrigger>
</ButtonGroup>
</ButtonToolbar>;
}
}
| import React, {Component} from 'react';
import {Button, ButtonGroup, ButtonToolbar, OverlayTrigger, Popover, Glyphicon} from 'react-bootstrap';
import MemorySearch from './MemorySearch';
export default class MemoryNav extends Component {
render() {
const scrollDelta = 1;
const groupStyle = { float: "none" };
return <ButtonToolbar className="center-block">
<ButtonGroup style={groupStyle}>
<Button onClick={() => this.props.onScrollBy(-scrollDelta)}>
<Glyphicon glyph="chevron-up" alt="Scroll memory up" />
</Button>
<Button onClick={() => this.props.onScrollBy(scrollDelta)}>
<Glyphicon glyph="chevron-down" alt="Scroll memory down" />
</Button>
<Button onClick={this.props.onScrollToPC}>
Jump to PC
</Button>
<OverlayTrigger
placement="right"
trigger="click"
rootClose
overlay={
<Popover id="memory-search">
<MemorySearch
symbolTable={this.props.symbolTable}
onScrollTo={this.props.onScrollTo}
ref="search"
/>
</Popover>
}
onEntering={() => this.refs.search.focus()}
>
<Button>Jump to…</Button>
</OverlayTrigger>
</ButtonGroup>
</ButtonToolbar>;
}
}
| Move "Jump to…" to right instead of bottom | Move "Jump to…" to right instead of bottom
This way it doesn't obscure the memory view.
| JSX | mit | WChargin/lc3,WChargin/lc3 | ---
+++
@@ -19,7 +19,7 @@
Jump to PC
</Button>
<OverlayTrigger
- placement="bottom"
+ placement="right"
trigger="click"
rootClose
overlay={ |
26aa68fb1fcfe0bb9995035f66d51eb740329a35 | src/passwordless-email/ask_email.jsx | src/passwordless-email/ask_email.jsx | import React from 'react';
import EmailInput from '../credentials/email_input';
import { email, visiblyInvalidEmail } from '../credentials/index';
import { changeEmail } from './actions';
import { ui } from '../lock/index';
export default class AskEmail extends React.Component {
render() {
const { lock } = this.props;
return (
<div>
<div className="auth0-lock-instructions">
Enter your email address to sign in or create an account
</div>
<EmailInput value={email(lock)}
isValid={!visiblyInvalidEmail(lock)}
disabled={lock.get("submitting")}
onChange={::this.handleEmailChange}
gravatar={ui.gravatar(lock)}
autoFocus={ui.focusInput(lock)} />
</div>
);
}
handleEmailChange(e) {
const lockID = this.props.lock.get('id');
const email = e.target.value;
changeEmail(lockID, email);
}
}
| import React from 'react';
import EmailInput from '../credentials/email_input';
import { email, visiblyInvalidEmail } from '../credentials/index';
import { changeEmail } from './actions';
import { ui } from '../lock/index';
export default class AskEmail extends React.Component {
render() {
const { lock } = this.props;
return (
<div className="auth0-lock-passwordless auth0-lock-mode">
<div className="auth0-lock-form auth0-lock-passwordless">
<p>Enter your email address to sign in or create an account.</p>
<div className="auth0-lock-input-block-email auth0-lock-input-block">
<EmailInput value={email(lock)}
isValid={!visiblyInvalidEmail(lock)}
disabled={lock.get("submitting")}
onChange={::this.handleEmailChange}
gravatar={ui.gravatar(lock)}
autoFocus={ui.focusInput(lock)} />
</div>
</div>
</div>
);
}
handleEmailChange(e) {
const lockID = this.props.lock.get('id');
const email = e.target.value;
changeEmail(lockID, email);
}
}
| Update ask email component markup | Update ask email component markup
| JSX | mit | auth0/lock-passwordless,mike-casas/lock,mike-casas/lock,mike-casas/lock,auth0/lock-passwordless,auth0/lock-passwordless | ---
+++
@@ -7,17 +7,20 @@
export default class AskEmail extends React.Component {
render() {
const { lock } = this.props;
+
return (
- <div>
- <div className="auth0-lock-instructions">
- Enter your email address to sign in or create an account
+ <div className="auth0-lock-passwordless auth0-lock-mode">
+ <div className="auth0-lock-form auth0-lock-passwordless">
+ <p>Enter your email address to sign in or create an account.</p>
+ <div className="auth0-lock-input-block-email auth0-lock-input-block">
+ <EmailInput value={email(lock)}
+ isValid={!visiblyInvalidEmail(lock)}
+ disabled={lock.get("submitting")}
+ onChange={::this.handleEmailChange}
+ gravatar={ui.gravatar(lock)}
+ autoFocus={ui.focusInput(lock)} />
+ </div>
</div>
- <EmailInput value={email(lock)}
- isValid={!visiblyInvalidEmail(lock)}
- disabled={lock.get("submitting")}
- onChange={::this.handleEmailChange}
- gravatar={ui.gravatar(lock)}
- autoFocus={ui.focusInput(lock)} />
</div>
);
} |
6b419e145d335e679772c90f9f05d8caf8a76c5f | webapp/pages/RepositoryTestChart.jsx | webapp/pages/RepositoryTestChart.jsx | import React from 'react';
import PropTypes from 'prop-types';
import AsyncPage from '../components/AsyncPage';
import Paginator from '../components/Paginator';
import Section from '../components/Section';
import TestChart from '../components/TestChart';
export default class RepositoryTestChart extends AsyncPage {
static contextTypes = {
...AsyncPage.contextTypes,
repo: PropTypes.object.isRequired
};
getEndpoints() {
let {repo} = this.context;
return [['testList', `/repos/${repo.full_name}/tests-by-build`]];
}
renderBody() {
return (
<Section>
<TestChart testList={this.state.testList} />
<Paginator links={this.state.testList.links} {...this.props} />
</Section>
);
}
}
| import React from 'react';
import PropTypes from 'prop-types';
import AsyncPage from '../components/AsyncPage';
import Paginator from '../components/Paginator';
import Section from '../components/Section';
import TestChart from '../components/TestChart';
export default class RepositoryTestChart extends AsyncPage {
static contextTypes = {
...AsyncPage.contextTypes,
repo: PropTypes.object.isRequired
};
getEndpoints() {
let {repo} = this.context;
return [
[
'testList',
`/repos/${repo.full_name}/tests-by-build`,
{query: this.props.location.query}
]
];
}
renderBody() {
return (
<Section>
<TestChart testList={this.state.testList} />
<Paginator links={this.state.testList.links} {...this.props} />
</Section>
);
}
}
| Fix pagination query parameters in Test Over Time | fix(ui): Fix pagination query parameters in Test Over Time
| JSX | apache-2.0 | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | ---
+++
@@ -14,7 +14,13 @@
getEndpoints() {
let {repo} = this.context;
- return [['testList', `/repos/${repo.full_name}/tests-by-build`]];
+ return [
+ [
+ 'testList',
+ `/repos/${repo.full_name}/tests-by-build`,
+ {query: this.props.location.query}
+ ]
+ ];
}
renderBody() { |
ec2c149510dd94980bd8a77385576c9edec46ee3 | src/components/TaskList/TaskList.jsx | src/components/TaskList/TaskList.jsx | const React = require('react')
const GitHub = require('../../models/github')
const TaskListItem = require('../TaskListItem')
class TaskList extends React.Component {
constructor(props, context) {
super(props, context)
this.state = { notifications: [] }
}
componentDidMount() {
const github = new GitHub()
github.getNotifications().
then(this.onNotificationsLoaded.bind(this)).
catch(this.onNotificationsError.bind(this))
}
onNotificationsLoaded(notifications) {
this.setState({ notifications })
}
onNotificationsError(response) {
console.error('failed to load notifications', response)
}
render() {
return (
<div>
<nav className="controls-container">
<button type="button" className="control">snooze</button>
<button type="button" className="control">ignore</button>
<button type="button" className="control">archive</button>
</nav>
<ol className="issues-list">
{this.state.notifications.map(notification => {
return <TaskListItem {...notification} key={notification.id} />
})}
</ol>
</div>
)
}
}
module.exports = TaskList
| const React = require('react')
const GitHub = require('../../models/github')
const TaskListItem = require('../TaskListItem')
class TaskList extends React.Component {
constructor(props, context) {
super(props, context)
this.state = { notifications: [] }
}
componentDidMount() {
const github = new GitHub()
github.getNotifications().
then(this.onNotificationsLoaded.bind(this)).
catch(this.onNotificationsError.bind(this))
}
onNotificationsLoaded(notifications) {
this.setState({ notifications })
}
onNotificationsError(response) {
console.error('failed to load notifications', response)
}
render() {
return (
<div>
<nav className="controls-container">
<button type="button" className="control">snooze</button>
<button type="button" className="control">ignore</button>
<button type="button" className="control">archive</button>
</nav>
<ol className="issues-list">
{this.state.notifications.map(notification =>
<TaskListItem {...notification} key={notification.id} />
)}
</ol>
</div>
)
}
}
module.exports = TaskList
| Fix linter complaint about arrow body | Fix linter complaint about arrow body
| JSX | mit | cheshire137/gh-notifications-snoozer,cheshire137/gh-notifications-snoozer | ---
+++
@@ -32,9 +32,9 @@
<button type="button" className="control">archive</button>
</nav>
<ol className="issues-list">
- {this.state.notifications.map(notification => {
- return <TaskListItem {...notification} key={notification.id} />
- })}
+ {this.state.notifications.map(notification =>
+ <TaskListItem {...notification} key={notification.id} />
+ )}
</ol>
</div>
) |
bb1829f7b6f45c9d8411cce3159cb4008379bb16 | client/app/bundles/course/lesson_plan/components/LessonPlanGroup.jsx | client/app/bundles/course/lesson_plan/components/LessonPlanGroup.jsx | import React, { PropTypes } from 'react';
import Immutable from 'immutable';
import { Element } from 'react-scroll';
import Paper from 'material-ui/Paper';
import LessonPlanItem from '../components/LessonPlanItem';
import LessonPlanMilestone from '../components/LessonPlanMilestone';
const propTypes = {
milestone: PropTypes.instanceOf(Immutable.Map).isRequired,
items: PropTypes.instanceOf(Immutable.List).isRequired,
};
const MilestoneGroup = ({ milestone, items }) => {
const componentKey = node => node.get('lesson_plan_element_class') + node.get('id');
return (
<Element name={`milestone-group-${milestone.get('id')}`}>
<LessonPlanMilestone key={componentKey(milestone)} {...{ milestone }} />
<Paper>
{
items.map(item =>
<LessonPlanItem
key={componentKey(item)}
{...{ item }}
/>
)
}
</Paper>
</Element>
);
};
MilestoneGroup.propTypes = propTypes;
export default MilestoneGroup;
| import React, { PropTypes } from 'react';
import Immutable from 'immutable';
import { Element } from 'react-scroll';
import Paper from 'material-ui/Paper';
import LessonPlanItem from '../components/LessonPlanItem';
import LessonPlanMilestone from '../components/LessonPlanMilestone';
const LessonPlanGroup = ({ milestone, items }) => {
const componentKey = node => node.get('lesson_plan_element_class') + node.get('id');
return (
<Element name={`milestone-group-${milestone.get('id')}`}>
<LessonPlanMilestone key={componentKey(milestone)} {...{ milestone }} />
<Paper>
{
items.map(item =>
<LessonPlanItem
key={componentKey(item)}
{...{ item }}
/>
)
}
</Paper>
</Element>
);
};
LessonPlanGroup.propTypes = {
milestone: PropTypes.instanceOf(Immutable.Map).isRequired,
items: PropTypes.arrayOf(
React.PropTypes.instanceOf(Immutable.Map).isRequired
).isRequired,
};
export default LessonPlanGroup;
| Fix lesson plan group items proptype | Fix lesson plan group items proptype
| JSX | mit | Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,cysjonathan/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2 | ---
+++
@@ -5,12 +5,7 @@
import LessonPlanItem from '../components/LessonPlanItem';
import LessonPlanMilestone from '../components/LessonPlanMilestone';
-const propTypes = {
- milestone: PropTypes.instanceOf(Immutable.Map).isRequired,
- items: PropTypes.instanceOf(Immutable.List).isRequired,
-};
-
-const MilestoneGroup = ({ milestone, items }) => {
+const LessonPlanGroup = ({ milestone, items }) => {
const componentKey = node => node.get('lesson_plan_element_class') + node.get('id');
return (
<Element name={`milestone-group-${milestone.get('id')}`}>
@@ -29,6 +24,11 @@
);
};
-MilestoneGroup.propTypes = propTypes;
+LessonPlanGroup.propTypes = {
+ milestone: PropTypes.instanceOf(Immutable.Map).isRequired,
+ items: PropTypes.arrayOf(
+ React.PropTypes.instanceOf(Immutable.Map).isRequired
+ ).isRequired,
+};
-export default MilestoneGroup;
+export default LessonPlanGroup; |
a668afcc69f0dc1d66346b2a3d4eed50b811d17d | app/app.jsx | app/app.jsx | import React from 'react';
import api from './api';
import ReportsTable from './reports_table.jsx';
export default class App extends React.Component {
render() {
const headers = [
{
name: 'Date',
data: 'timestamp'
},
{
name: 'Size',
data: 'size'
},
{
name: 'Hit total',
data: 'hit'
},
{
name: 'Cache hit',
data: 'cacheHit'
},
{
name: 'Cache missed',
data: 'noncacheHit'
}
];
return (
<div className='pure-g'>
<header className='pure-u-1'>
<h1>Reports application</h1>
<div className='description'>
The most awesome reporting application ever
</div>
</header>
<article className='pure-u-1'>
<section className='app'>
<ReportsTable
headerClicked={this.headerClicked}
headers={headers}
reports={api.getReports()} />
</section>
</article>
</div>
);
}
headerClicked(data) {
console.log('header clicked', data);
}
};
| import React from 'react';
import api from './api';
import ReportsTable from './reports_table.jsx';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
headers: [
{
name: 'Date',
data: 'timestamp'
},
{
name: 'Size',
data: 'size'
},
{
name: 'Hit total',
data: 'hit'
},
{
name: 'Cache hit',
data: 'cacheHit'
},
{
name: 'Cache missed',
data: 'noncacheHit'
}
],
reports: api.getReports()
};
this.headerClicked = this.headerClicked.bind(this);
}
render() {
const headers = this.state.headers;
const reports = this.state.reports;
return (
<div className='pure-g'>
<header className='pure-u-1'>
<h1>Reports application</h1>
<div className='description'>
The most awesome reporting application ever
</div>
</header>
<article className='pure-u-1'>
<section className='app'>
<ReportsTable
headerClicked={this.headerClicked}
headers={headers}
reports={reports} />
</section>
</article>
</div>
);
}
headerClicked(data) {
const reports = this.state.reports;
reports.sort(function(a, b) {
return a[data] < b[data] ? 1 : -1;
});
this.setState({
reports: reports
});
}
};
| Allow table columns to be sorted | Allow table columns to be sorted
| JSX | mit | survivejs/reports-app | ---
+++
@@ -3,29 +3,40 @@
import ReportsTable from './reports_table.jsx';
export default class App extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ headers: [
+ {
+ name: 'Date',
+ data: 'timestamp'
+ },
+ {
+ name: 'Size',
+ data: 'size'
+ },
+ {
+ name: 'Hit total',
+ data: 'hit'
+ },
+ {
+ name: 'Cache hit',
+ data: 'cacheHit'
+ },
+ {
+ name: 'Cache missed',
+ data: 'noncacheHit'
+ }
+ ],
+ reports: api.getReports()
+ };
+
+ this.headerClicked = this.headerClicked.bind(this);
+ }
render() {
- const headers = [
- {
- name: 'Date',
- data: 'timestamp'
- },
- {
- name: 'Size',
- data: 'size'
- },
- {
- name: 'Hit total',
- data: 'hit'
- },
- {
- name: 'Cache hit',
- data: 'cacheHit'
- },
- {
- name: 'Cache missed',
- data: 'noncacheHit'
- }
- ];
+ const headers = this.state.headers;
+ const reports = this.state.reports;
return (
<div className='pure-g'>
@@ -41,13 +52,21 @@
<ReportsTable
headerClicked={this.headerClicked}
headers={headers}
- reports={api.getReports()} />
+ reports={reports} />
</section>
</article>
</div>
);
}
headerClicked(data) {
- console.log('header clicked', data);
+ const reports = this.state.reports;
+
+ reports.sort(function(a, b) {
+ return a[data] < b[data] ? 1 : -1;
+ });
+
+ this.setState({
+ reports: reports
+ });
}
}; |
ff27ca1764151e7d79bbedf6ab3327aefb984dcc | app/components/VideoDebate/VideoDebatePlayer.jsx | app/components/VideoDebate/VideoDebatePlayer.jsx | import React from 'react'
import { connect } from 'react-redux'
import ReactPlayer from 'react-player'
import { setPosition, setPlaying } from '../../state/video_debate/video/reducer'
/**
* A player connected to VideoDebate state. Update position in it when playing
* and seekTo position when requested in state.
*/
@connect(
state => ({
position: state.VideoDebate.video.playback.position,
forcedPosition: state.VideoDebate.video.playback.forcedPosition,
isPlaying: state.VideoDebate.video.playback.isPlaying
}),
{ setPosition, setPlaying }
)
export default class VideoDebatePlayer extends React.Component {
shouldComponentUpdate(newProps) {
return (
this.props.url !== newProps.url || this.props.isPlaying !== newProps.isPlaying
)
}
componentWillReceiveProps(newProps) {
const { forcedPosition } = newProps
if (
forcedPosition.requestId !== null
&& forcedPosition.requestId !== this.props.forcedPosition.requestId
) {
this.refs.player.seekTo(forcedPosition.time)
this.props.setPlaying(true)
}
}
render() {
const { setPosition, url, isPlaying, setPlaying } = this.props
return (
<ReactPlayer
ref="player"
className="video"
url={url}
playing={isPlaying}
onPlay={() => setPlaying(true)}
onPause={() => setPlaying(false)}
onProgress={({ playedSeconds }) => setPosition(playedSeconds)}
width=""
height=""
controls
/>
)
}
}
| import React from 'react'
import { connect } from 'react-redux'
import ReactPlayer from 'react-player'
import { setPosition, setPlaying } from '../../state/video_debate/video/reducer'
/**
* A player connected to VideoDebate state. Update position in it when playing
* and seekTo position when requested in state.
*/
@connect(
state => ({
position: state.VideoDebate.video.playback.position,
forcedPosition: state.VideoDebate.video.playback.forcedPosition,
isPlaying: state.VideoDebate.video.playback.isPlaying
}),
{ setPosition, setPlaying }
)
export default class VideoDebatePlayer extends React.Component {
shouldComponentUpdate(newProps) {
return (
this.props.url !== newProps.url || this.props.isPlaying !== newProps.isPlaying
)
}
componentWillReceiveProps(newProps) {
const { forcedPosition } = newProps
if (
forcedPosition.requestId !== null
&& forcedPosition.requestId !== this.props.forcedPosition.requestId
) {
this.props.setPlaying(true)
this.refs.player.seekTo(forcedPosition.time)
}
}
render() {
const { setPosition, url, isPlaying, setPlaying } = this.props
return (
<ReactPlayer
ref="player"
className="video"
url={url}
playing={isPlaying}
onPlay={() => setPlaying(true)}
onPause={() => setPlaying(false)}
onProgress={({ playedSeconds }) => setPosition(playedSeconds)}
width=""
height=""
controls
/>
)
}
}
| Improve first timecode click (when video isn't playing yet) | Improve first timecode click (when video isn't playing yet) | JSX | agpl-3.0 | CaptainFact/captain-fact-frontend,CaptainFact/captain-fact-frontend,CaptainFact/captain-fact-frontend | ---
+++
@@ -29,8 +29,8 @@
forcedPosition.requestId !== null
&& forcedPosition.requestId !== this.props.forcedPosition.requestId
) {
+ this.props.setPlaying(true)
this.refs.player.seekTo(forcedPosition.time)
- this.props.setPlaying(true)
}
}
|
390f5f45f1afdd144b72b3de7c2d0c75dda12e09 | src/components/main.jsx | src/components/main.jsx | 'use strict';
import ClocketteApp from './ClocketteApp';
import React from 'react';
import Router from 'react-router';
import HomeScreen from './HomeScreen';
import AddTimezoneScreen from './AddTimezoneScreen';
const Route = Router.Route;
const Routes = (
<Route handler={ClocketteApp}>
<Route name="/" handler={HomeScreen}/>
<Route name="/timezones" handler={AddTimezoneScreen}/>
</Route>
);
Router.run(Routes, function(Handler) {
React.render(<Handler/>, document.getElementById('ClocketteApp'));
});
| 'use strict';
import ClocketteApp from './ClocketteApp';
import React from 'react';
import Router from 'react-router';
import HomeScreen from './home/HomeScreen';
import AddTimezoneScreen from './add-timezone/AddTimezoneScreen';
const Route = Router.Route;
const Routes = (
<Route handler={ClocketteApp}>
<Route name="/" handler={HomeScreen}/>
<Route name="/timezones" handler={AddTimezoneScreen}/>
</Route>
);
Router.run(Routes, function(Handler) {
React.render(<Handler/>, document.getElementById('ClocketteApp'));
});
| Update screen paths to match new architecture | Update screen paths to match new architecture
| JSX | mit | rhumlover/clockette,rhumlover/clockette | ---
+++
@@ -3,8 +3,8 @@
import ClocketteApp from './ClocketteApp';
import React from 'react';
import Router from 'react-router';
-import HomeScreen from './HomeScreen';
-import AddTimezoneScreen from './AddTimezoneScreen';
+import HomeScreen from './home/HomeScreen';
+import AddTimezoneScreen from './add-timezone/AddTimezoneScreen';
const Route = Router.Route;
|
92285452d42f6064bffe9cfb4f2b0cd0e310fadf | src/javascript/app.jsx | src/javascript/app.jsx | import React from 'react';
import ReactDom from 'react-dom';
import NetKANs from './components/NetKANs.jsx';
import datatableStyles from
'../../node_modules/fixed-data-table/dist/fixed-data-table.min.css';
var sheet = document.createElement('style');
sheet.type = 'text/css';
sheet.innerHTML = 'html,body{background-color:#f0f0f0;} input::-webkit-input-placeholder{font-style:italic;} a:link,a:visited{text-decoration:none;color:#009;} a:hover,a:active{text-decoration:underline;}';
document.body.appendChild(sheet);
document.body.innerHTML += '<div id="content"></div>';
ReactDom.render(
<NetKANs
url="http://status.ksp-ckan.org/status/netkan.json"
pollInterval={300000} />,
document.getElementById('content')
);
| import React from 'react';
import ReactDom from 'react-dom';
import NetKANs from './components/NetKANs.jsx';
import datatableStyles from
'../../node_modules/fixed-data-table/dist/fixed-data-table.min.css';
var sheet = document.createElement('style');
sheet.type = 'text/css';
sheet.innerHTML = 'html,body{background-color:#f0f0f0;} input::-webkit-input-placeholder{font-style:italic;} a:link,a:visited{text-decoration:none;color:#009;} a:hover,a:active{text-decoration:underline;}';
document.body.appendChild(sheet);
document.body.innerHTML += '<div id="content"></div>';
ReactDom.render(
<NetKANs
url="http://status.ksp-ckan.space/status/netkan.json"
pollInterval={300000} />,
document.getElementById('content')
);
| Update url of json file | Update url of json file
| JSX | mit | techman83/NetKAN-status | ---
+++
@@ -13,7 +13,7 @@
ReactDom.render(
<NetKANs
- url="http://status.ksp-ckan.org/status/netkan.json"
+ url="http://status.ksp-ckan.space/status/netkan.json"
pollInterval={300000} />,
document.getElementById('content')
); |
e5b92367960df217e0dcd39e1c7cca5668d4ea85 | src/apps/ChannelHistory/ChannelHistoryMessages.jsx | src/apps/ChannelHistory/ChannelHistoryMessages.jsx | import React from 'react';
import { withRouter } from 'react-router';
import Reflux from 'reflux';
import Store from './ChannelHistoryStore';
import ChannelHistory from './ChannelHistory';
const ChannelHistoryMessages = React.createClass({
mixins: [Reflux.connect(Store)],
render() {
const { channelName } = this.props;
return <ChannelHistory channelName={channelName} />;
}
});
export default withRouter(ChannelHistoryMessages);
| import React from 'react';
import { withRouter } from 'react-router';
import Reflux from 'reflux';
import Store from './ChannelHistoryStore';
import ChannelHistory from './ChannelHistory';
const ChannelHistoryMessages = React.createClass({
mixins: [Reflux.connect(Store)],
render() {
const { channelName } = this.props.params;
return <ChannelHistory channelName={channelName} />;
}
});
export default withRouter(ChannelHistoryMessages);
| Fix fetching channel history messages | [DASH-2187] Fix fetching channel history messages
| JSX | mit | Syncano/syncano-dashboard,Syncano/syncano-dashboard,Syncano/syncano-dashboard | ---
+++
@@ -10,7 +10,7 @@
mixins: [Reflux.connect(Store)],
render() {
- const { channelName } = this.props;
+ const { channelName } = this.props.params;
return <ChannelHistory channelName={channelName} />;
} |
429783790c34a60f4ab44eda44150106ac42860b | imports/ui/components/inplace-edit.jsx | imports/ui/components/inplace-edit.jsx | import React from 'react';
export default class InplaceEdit extends React.Component {
constructor(props) {
super(props);
this.state = {
editing: false,
};
this.view = this.view.bind(this);
this.edit = this.edit.bind(this);
}
view() {
this.props.onChange(this.refs.input.value);
this.setState({ editing: false });
}
edit() {
this.setState({ editing: true }, () => {
this.refs.input.focus();
});
}
render() {
if (this.state.editing) {
return (
<input
style={{ marginLeft: '5px' }}
type="text"
defaultValue={this.props.text}
ref="input"
onBlur={this.view}
/>
);
}
return (
<div
style={{ display: 'inline-block',
paddingLeft: '7px',
paddingTop: '3px',
paddingBottom: '3px' }}
onClick={this.edit}
>
{this.props.text}
</div>
);
}
}
InplaceEdit.propTypes = {
text: React.PropTypes.string.isRequired,
onChange: React.PropTypes.func.isRequired,
};
| import React from 'react';
export default class InplaceEdit extends React.Component {
constructor(props) {
super(props);
this.state = {
editing: false,
};
this.view = this.view.bind(this);
this.edit = this.edit.bind(this);
}
view() {
this.props.onChange(this.refs.input.value);
this.setState({ editing: false });
}
edit() {
this.setState({ editing: true }, () => {
this.refs.input.focus();
});
}
editIcon() {
if (!this.props.text) {
return (
<span className="glyphicon glyphicon-pencil"></span>
);
}
}
render() {
if (this.state.editing) {
return (
<input
style={{ marginTop: '-3px', marginBottom: '-3px' }}
type="text"
defaultValue={this.props.text}
ref="input"
onBlur={this.view}
size={this.props.text.length}
/>
);
}
return (
<div
style={{ display: 'inline-block' }}
onClick={this.edit}
>
{this.editIcon()}
{this.props.text}
</div>
);
}
}
InplaceEdit.propTypes = {
text: React.PropTypes.string,
onChange: React.PropTypes.func.isRequired,
};
| Change css styling and add placeholder if text is empty | Change css styling and add placeholder if text is empty
| JSX | mit | minden/data-furnace,minden/data-furnace | ---
+++
@@ -21,27 +21,34 @@
});
}
+ editIcon() {
+ if (!this.props.text) {
+ return (
+ <span className="glyphicon glyphicon-pencil"></span>
+ );
+ }
+ }
+
render() {
if (this.state.editing) {
return (
<input
- style={{ marginLeft: '5px' }}
+ style={{ marginTop: '-3px', marginBottom: '-3px' }}
type="text"
defaultValue={this.props.text}
ref="input"
onBlur={this.view}
+ size={this.props.text.length}
/>
);
}
return (
<div
- style={{ display: 'inline-block',
- paddingLeft: '7px',
- paddingTop: '3px',
- paddingBottom: '3px' }}
+ style={{ display: 'inline-block' }}
onClick={this.edit}
>
+ {this.editIcon()}
{this.props.text}
</div>
);
@@ -49,6 +56,6 @@
}
InplaceEdit.propTypes = {
- text: React.PropTypes.string.isRequired,
+ text: React.PropTypes.string,
onChange: React.PropTypes.func.isRequired,
}; |
0b2f0553c0ce7b2fc7cc03f2d457a89deedee0d4 | src/option/unrdist.jsx | src/option/unrdist.jsx | console.log( "===== simpread option unread list load =====" )
import List from 'list';
const actionItems = [
{
id: "pocket",
title: "发送到 Pocket",
icon: "",
disable: false,
hr: true,
},
{
id: "remove",
title: "删除",
icon: "",
disable: false,
hr: false,
}
];
export default class Unrdist extends React.Component {
onAction( event, ...rests ) {
console.log( event, rests )
}
render() {
return (
<List items={ this.props.list } title={ "未读列表:100 条" } actionItems={ actionItems } onAction={ (e,i,t,d)=>this.onAction(e,i,t,d) } />
)
}
} | console.log( "===== simpread option unread list load =====" )
import List from 'list';
import {storage} from 'storage';
const actionItems = [
{
id: "pocket",
title: "发送到 Pocket",
icon: "",
disable: false,
hr: true,
},
{
id: "remove",
title: "删除",
icon: "",
disable: false,
hr: false,
}
];
export default class Unrdist extends React.Component {
state = {
item: this.props.list,
}
onAction( event, ...rests ) {
const [ id, title, data ] = rests;
console.log( id, title, data )
if ( id == "remove" ) {
storage.UnRead( id, data.idx, success => {
success && new Notify().Render( 0, "删除成功" );
success && this.setState({
item: storage.unrdist
});
});
}
}
render() {
return (
<List items={ this.state.item } title={ "未读列表:100 条" } actionItems={ actionItems } onAction={ (e,i,t,d)=>this.onAction(e,i,t,d) } />
)
}
} | Add remove unread list logic. | Add remove unread list logic.
| JSX | mit | ksky521/simpread,ksky521/simpread | ---
+++
@@ -1,6 +1,8 @@
console.log( "===== simpread option unread list load =====" )
import List from 'list';
+
+import {storage} from 'storage';
const actionItems = [
{
@@ -21,13 +23,26 @@
export default class Unrdist extends React.Component {
+ state = {
+ item: this.props.list,
+ }
+
onAction( event, ...rests ) {
- console.log( event, rests )
+ const [ id, title, data ] = rests;
+ console.log( id, title, data )
+ if ( id == "remove" ) {
+ storage.UnRead( id, data.idx, success => {
+ success && new Notify().Render( 0, "删除成功" );
+ success && this.setState({
+ item: storage.unrdist
+ });
+ });
+ }
}
render() {
return (
- <List items={ this.props.list } title={ "未读列表:100 条" } actionItems={ actionItems } onAction={ (e,i,t,d)=>this.onAction(e,i,t,d) } />
+ <List items={ this.state.item } title={ "未读列表:100 条" } actionItems={ actionItems } onAction={ (e,i,t,d)=>this.onAction(e,i,t,d) } />
)
}
} |
b7d7aebadb804ee77d3ef0ed53b2e80dd2637c99 | web/static/js/components/idea_list_item.jsx | web/static/js/components/idea_list_item.jsx | import React, { PropTypes } from "react"
import * as AppPropTypes from "../prop_types"
import styles from "./css_modules/idea_list_item.css"
function IdeaListItem(props) {
const { idea, currentPresence } = props
return (
<li className={styles.index} title={idea.body} key={idea.id}>
{ currentPresence.user.is_facilitator ?
<i
id={idea.id}
title="Delete Idea"
className={styles.actionIcon + ` remove circle icon`}
onClick={props.handleDelete}
/>
: null
}
{ currentPresence.user.is_facilitator ?
<i
title="Edit Idea"
className={styles.actionIcon + ` edit icon`}
>
</i> : null
}
<span className={styles.authorAttribution}>{idea.author}:</span> {idea.body}
</li>
)
}
IdeaListItem.propTypes = {
idea: AppPropTypes.idea.isRequired,
currentPresence: AppPropTypes.presence.isRequired,
handleDelete: PropTypes.func,
}
export default IdeaListItem
| import React, { Component } from "react"
import * as AppPropTypes from "../prop_types"
import styles from "./css_modules/idea_list_item.css"
class IdeaListItem extends Component {
render() {
let { idea, currentPresence, handleDelete } = this.props
return (
<li className={styles.index} title={idea.body} key={idea.id}>
{ currentPresence.user.is_facilitator ?
<i
id={idea.id}
title="Delete Idea"
className={styles.actionIcon + ` remove circle icon`}
onClick={props.handleDelete}
>
</i> : null
}
{ currentPresence.user.is_facilitator ?
<i
title="Edit Idea"
className={styles.actionIcon + ` edit icon`}
>
</i> : null
}
<span className={styles.authorAttribution}>{idea.author}:</span> {idea.body}
</li>
)
}
}
IdeaListItem.propTypes = {
idea: AppPropTypes.idea.isRequired,
currentPresence: AppPropTypes.presence.isRequired,
handleDelete: PropTypes.func,
}
export default IdeaListItem
| Convert IdeaListItem to Component definition in preparation for setChanges | Convert IdeaListItem to Component definition in preparation for setChanges
| JSX | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,samdec11/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,tnewell5/remote_retro | ---
+++
@@ -1,31 +1,33 @@
-import React, { PropTypes } from "react"
+import React, { Component } from "react"
import * as AppPropTypes from "../prop_types"
import styles from "./css_modules/idea_list_item.css"
-function IdeaListItem(props) {
- const { idea, currentPresence } = props
+class IdeaListItem extends Component {
+ render() {
+ let { idea, currentPresence, handleDelete } = this.props
- return (
- <li className={styles.index} title={idea.body} key={idea.id}>
- { currentPresence.user.is_facilitator ?
- <i
- id={idea.id}
- title="Delete Idea"
- className={styles.actionIcon + ` remove circle icon`}
- onClick={props.handleDelete}
- />
- : null
- }
- { currentPresence.user.is_facilitator ?
- <i
- title="Edit Idea"
- className={styles.actionIcon + ` edit icon`}
- >
- </i> : null
- }
- <span className={styles.authorAttribution}>{idea.author}:</span> {idea.body}
- </li>
- )
+ return (
+ <li className={styles.index} title={idea.body} key={idea.id}>
+ { currentPresence.user.is_facilitator ?
+ <i
+ id={idea.id}
+ title="Delete Idea"
+ className={styles.actionIcon + ` remove circle icon`}
+ onClick={props.handleDelete}
+ >
+ </i> : null
+ }
+ { currentPresence.user.is_facilitator ?
+ <i
+ title="Edit Idea"
+ className={styles.actionIcon + ` edit icon`}
+ >
+ </i> : null
+ }
+ <span className={styles.authorAttribution}>{idea.author}:</span> {idea.body}
+ </li>
+ )
+ }
}
IdeaListItem.propTypes = { |
273c271c6322748dd170fc19e8f9e5271bfb4fa7 | public/components/BeerPair.jsx | public/components/BeerPair.jsx | import React from 'react';
import beerPair from './../../pairList.js';
class BeerPair extends React.Component {
constructor(props){
super(props);
}
render(){
return(
<div>
{
this.props.currentBeer.name ? `${this.props.currentBeer.name} is a ${this.props.currentBeer.type} and should be drank in a ${beerPair[this.props.currentBeer.type][0]}` : ''
}
</div>
)
}
}
export default BeerPair; | import React from 'react';
import beerPair from './../../pairList.js';
import glassShopList from './../../glassShopList.js';
class BeerPair extends React.Component {
constructor(props){
super(props);
}
render(){
return(
<div>
{
this.props.currentBeer.name ?
<div>{this.props.currentBeer.name} is a {this.props.currentBeer.type} and should be drank in a {beerPair[this.props.currentBeer.type][0]}.
<br/>
You can get one <a target='_blank' href={glassShopList[beerPair[this.props.currentBeer.type][0]]}>here!</a>
</div>
: ''
}
</div>
)
}
}
export default BeerPair; | Add link to buy glass in beerPair component | Add link to buy glass in beerPair component
| JSX | mit | joeylaguna/tankard.io,joeylaguna/tankard.io | ---
+++
@@ -1,5 +1,6 @@
import React from 'react';
import beerPair from './../../pairList.js';
+import glassShopList from './../../glassShopList.js';
class BeerPair extends React.Component {
constructor(props){
@@ -10,7 +11,12 @@
return(
<div>
{
- this.props.currentBeer.name ? `${this.props.currentBeer.name} is a ${this.props.currentBeer.type} and should be drank in a ${beerPair[this.props.currentBeer.type][0]}` : ''
+ this.props.currentBeer.name ?
+ <div>{this.props.currentBeer.name} is a {this.props.currentBeer.type} and should be drank in a {beerPair[this.props.currentBeer.type][0]}.
+ <br/>
+ You can get one <a target='_blank' href={glassShopList[beerPair[this.props.currentBeer.type][0]]}>here!</a>
+ </div>
+ : ''
}
</div>
) |
ead1bac02ca8f004b4ddd6024ce2e66f8e35905f | src/components/semver-explain-constraint-warning.jsx | src/components/semver-explain-constraint-warning.jsx | var React = require('react'),
SemverConstraint = require('../libs/semver-constraint.js'),
If = require('./semver-if.jsx');
var SemverExplainConstraintWarning = React.createClass({
render: function() {
if (!this.props.constraint) {
return false;
}
this.props.constraint = new SemverConstraint(this.props.constraint);
return (
<div>
<If test={ !this.props.constraint.upper() && ['version', 'range (advanced)'].indexOf(this.props.constraint.type()) === -1 && ['<', '<='].indexOf(this.props.constraint.operator()) === -1 }>
<p>This constraint <a href="#why-using-loose-constraint-is-bad">does not provide an upper bound</a> which means you will probably get <strong>unexpected BC break</strong>.</p>
</If>
<If test={ this.props.constraint.type() == 'version' }>
<p>This constraint <a href="#why-using-strict-constraint-is-bad">is too strict</a> which means <strong>you won't even get bug fixes</strong>.</p>
</If>
</div>
);
}
});
module.exports = SemverExplainConstraintWarning;
| var React = require('react'),
SemverConstraint = require('../libs/semver-constraint.js'),
If = require('./semver-if.jsx');
var SemverExplainConstraintWarning = React.createClass({
render: function() {
if (!this.props.constraint) {
return false;
}
this.props.constraint = new SemverConstraint(this.props.constraint);
return (
<div>
<If test={ this.props.constraint.type() == 'range (caret)' }>
<p>
If you are using composer, you won't be able to use caret-range constraint. You should
use something like <code>{ this.props.constraint.lower().toString() } { this.props.constraint.upper().toString() }</code>.
</p>
</If>
<If test={ !this.props.constraint.upper() && ['version', 'range (advanced)'].indexOf(this.props.constraint.type()) === -1 && ['<', '<='].indexOf(this.props.constraint.operator()) === -1 }>
<p>This constraint <a href="#why-using-loose-constraint-is-bad">does not provide an upper bound</a> which means you will probably get <strong>unexpected BC break</strong>.</p>
</If>
<If test={ this.props.constraint.type() == 'version' }>
<p>This constraint <a href="#why-using-strict-constraint-is-bad">is too strict</a> which means <strong>you won't even get bug fixes</strong>.</p>
</If>
</div>
);
}
});
module.exports = SemverExplainConstraintWarning;
| Add composer warning for caret-range | Add composer warning for caret-range
| JSX | mit | jubianchi/semver-check,jubianchi/semver-check | ---
+++
@@ -12,6 +12,13 @@
return (
<div>
+ <If test={ this.props.constraint.type() == 'range (caret)' }>
+ <p>
+ If you are using composer, you won't be able to use caret-range constraint. You should
+ use something like <code>{ this.props.constraint.lower().toString() } { this.props.constraint.upper().toString() }</code>.
+ </p>
+ </If>
+
<If test={ !this.props.constraint.upper() && ['version', 'range (advanced)'].indexOf(this.props.constraint.type()) === -1 && ['<', '<='].indexOf(this.props.constraint.operator()) === -1 }>
<p>This constraint <a href="#why-using-loose-constraint-is-bad">does not provide an upper bound</a> which means you will probably get <strong>unexpected BC break</strong>.</p>
</If> |
b748ab029c9c788c31b6e0013236ef5cb813d05a | src/js/components/SectionComponent.jsx | src/js/components/SectionComponent.jsx | import React from "react/addons";
import Util from "../helpers/Util";
var SectionComponent = React.createClass({
"displayName": "SectionComponent",
propTypes: {
active: React.PropTypes.bool,
children: React.PropTypes.node,
id: React.PropTypes.string.isRequired,
onActive: React.PropTypes.func
},
getDefaultProps: function () {
return {
active: false,
onActive: Util.noop
};
},
componentDidMount: function () {
this.triggerCallbacks();
},
componentDidUpdate: function () {
this.triggerCallbacks();
},
triggerCallbacks: function () {
var {active, onActive} = this.props;
if (active) {
onActive();
}
},
render: function () {
var {children, active} = this.props;
if (!active) {
return null;
}
return (
<section>
{children}
</section>
);
}
});
export default SectionComponent;
| import React from "react/addons";
import Util from "../helpers/Util";
var SectionComponent = React.createClass({
"displayName": "SectionComponent",
propTypes: {
active: React.PropTypes.bool,
children: React.PropTypes.node,
id: React.PropTypes.string.isRequired,
onActive: React.PropTypes.func
},
getDefaultProps: function () {
return {
active: false,
onActive: Util.noop
};
},
getInitialState: function () {
return {
activeStateChanged: true
};
},
componentWillReceiveProps: function (nextProps) {
this.setState({
activeStateChanged: nextProps.active !== this.props.active
});
},
componentDidMount: function () {
this.triggerCallbacks();
},
componentDidUpdate: function () {
this.triggerCallbacks();
},
triggerCallbacks: function () {
var {activeStateChanged} = this.state;
var {active, onActive} = this.props;
if (activeStateChanged && active) {
onActive();
}
},
render: function () {
var {children, active} = this.props;
if (!active) {
return null;
}
return (
<section>
{children}
</section>
);
}
});
export default SectionComponent;
| Fix section component callback handling | Fix section component callback handling
Adjust the handling to only trigger section `onActive` callbacks on
active state changes.
| JSX | apache-2.0 | mesosphere/marathon-ui,mesosphere/marathon-ui,cribalik/marathon-ui,cribalik/marathon-ui | ---
+++
@@ -18,6 +18,18 @@
};
},
+ getInitialState: function () {
+ return {
+ activeStateChanged: true
+ };
+ },
+
+ componentWillReceiveProps: function (nextProps) {
+ this.setState({
+ activeStateChanged: nextProps.active !== this.props.active
+ });
+ },
+
componentDidMount: function () {
this.triggerCallbacks();
},
@@ -27,9 +39,10 @@
},
triggerCallbacks: function () {
+ var {activeStateChanged} = this.state;
var {active, onActive} = this.props;
- if (active) {
+ if (activeStateChanged && active) {
onActive();
}
}, |
7d73d460041e8c5c68a2c23c629250b574298a10 | src/lib/tooltip/ToolTipTSpanLabel.jsx | src/lib/tooltip/ToolTipTSpanLabel.jsx | "use strict";
import React from "react";
import PropTypes from "prop-types";
function ToolTipTSpanLabel(props) {
return <tspan className="react-stockcharts-tooltip-label" fill="#4682B4" {...props}>{props.children}</tspan>;
}
ToolTipTSpanLabel.propTypes = {
children: PropTypes.node.isRequired,
};
export default ToolTipTSpanLabel;
| "use strict";
import React from "react";
import PropTypes from "prop-types";
function ToolTipTSpanLabel(props) {
return <tspan className="react-stockcharts-tooltip-label" {...props}>{props.children}</tspan>;
}
ToolTipTSpanLabel.propTypes = {
children: PropTypes.node.isRequired,
fill: PropTypes.string.isRequired,
};
ToolTipTSpanLabel.defaultProps = {
fill: "#4682B4"
};
export default ToolTipTSpanLabel;
| Add default color for tooltip label | Add default color for tooltip label
| JSX | mit | rrag/react-stockcharts | ---
+++
@@ -4,11 +4,16 @@
import PropTypes from "prop-types";
function ToolTipTSpanLabel(props) {
- return <tspan className="react-stockcharts-tooltip-label" fill="#4682B4" {...props}>{props.children}</tspan>;
+ return <tspan className="react-stockcharts-tooltip-label" {...props}>{props.children}</tspan>;
}
ToolTipTSpanLabel.propTypes = {
children: PropTypes.node.isRequired,
+ fill: PropTypes.string.isRequired,
+};
+
+ToolTipTSpanLabel.defaultProps = {
+ fill: "#4682B4"
};
export default ToolTipTSpanLabel; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.