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
b1b87af469f2495571400d1467cc5770952ef334
assets-server/components/index.jsx
assets-server/components/index.jsx
'use strict'; import React from 'react/addons'; import App from './app.jsx'; const loadApp = () => { React.renderComponent(<App />, document.body); }; document.addEventListener('DOMContentLoaded', loadApp);
'use strict'; import React from 'react/addons'; import App from './app.jsx'; document.addEventListener('DOMContentLoaded', e => { React.render(<App />, document.body); });
Attach callback inside the app class loader
Attach callback inside the app class loader
JSX
mit
renemonroy/es6-scaffold,renemonroy/es6-scaffold
--- +++ @@ -3,8 +3,6 @@ import React from 'react/addons'; import App from './app.jsx'; -const loadApp = () => { - React.renderComponent(<App />, document.body); -}; - -document.addEventListener('DOMContentLoaded', loadApp); +document.addEventListener('DOMContentLoaded', e => { + React.render(<App />, document.body); +});
b69ec0044b9e3f68d00bd670c51c071d073d237d
client/src/components/UserList.jsx
client/src/components/UserList.jsx
import React from 'react'; import { Link } from 'react-router-dom'; const UserList = (props) => { return ( <div> {props.addUser.map((user)=>(<div key={user} onClick={props.passInCooks}><Link to="/inventory"><div className="changeColorForUserList">{user}</div></Link></div>))} </div> ); }; export default UserList;
import React from 'react'; import { Link } from 'react-router-dom'; const UserList = (props) => { return ( <div> {props.addUser.map((user)=>(<div className="user" key={user} onClick={props.passInCooks}>Continue as <Link to="/inventory">{user}</Link></div>))} <div>or <Link to="/users">go back</Link> and select a different user.</div> </div> ); }; export default UserList;
Add option to go back and select a different user
Add option to go back and select a different user
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -4,7 +4,8 @@ const UserList = (props) => { return ( <div> - {props.addUser.map((user)=>(<div key={user} onClick={props.passInCooks}><Link to="/inventory"><div className="changeColorForUserList">{user}</div></Link></div>))} + {props.addUser.map((user)=>(<div className="user" key={user} onClick={props.passInCooks}>Continue as <Link to="/inventory">{user}</Link></div>))} + <div>or <Link to="/users">go back</Link> and select a different user.</div> </div> ); };
5c6b48b48aa13f13e91606cb9a8fdee6bc6b91e3
webapp/components/BuildCoverage.jsx
webapp/components/BuildCoverage.jsx
import React, {Component} from 'react'; import PropTypes from 'prop-types'; export default class BuildCoverage extends Component { static propTypes = { build: PropTypes.object.isRequired }; getCoverage() { let {build} = this.props; if (build.status !== 'finished') return ''; if (!build.stats.coverage) return ''; if (build.stats.coverage.diff_lines_covered === 0) return '0%'; let totalDiffLines = build.stats.coverage.diff_lines_uncovered + build.stats.coverage.diff_lines_covered; if (!totalDiffLines) return ''; return `${parseInt( build.stats.coverage.diff_lines_covered / totalDiffLines * 100, 10 )}%`; } render() { return ( <span> {this.getCoverage()} </span> ); } }
import React, {Component} from 'react'; import PropTypes from 'prop-types'; export default class BuildCoverage extends Component { static propTypes = { build: PropTypes.object.isRequired }; getCoverage() { let {build} = this.props; if (build.status !== 'finished') return ''; if (!build.stats.coverage) return ''; let totalDiffLines = build.stats.coverage.diff_lines_uncovered + build.stats.coverage.diff_lines_covered; if (totalDiffLines === 0) return ''; if (build.stats.coverage.diff_lines_covered === 0) return '0%'; return `${parseInt( build.stats.coverage.diff_lines_covered / totalDiffLines * 100, 10 )}%`; } render() { return ( <span> {this.getCoverage()} </span> ); } }
Hide coverage information when zero diff coverage
Hide coverage information when zero diff coverage
JSX
apache-2.0
getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus
--- +++ @@ -10,10 +10,10 @@ let {build} = this.props; if (build.status !== 'finished') return ''; if (!build.stats.coverage) return ''; - if (build.stats.coverage.diff_lines_covered === 0) return '0%'; let totalDiffLines = build.stats.coverage.diff_lines_uncovered + build.stats.coverage.diff_lines_covered; - if (!totalDiffLines) return ''; + if (totalDiffLines === 0) return ''; + if (build.stats.coverage.diff_lines_covered === 0) return '0%'; return `${parseInt( build.stats.coverage.diff_lines_covered / totalDiffLines * 100, 10
7c62918b5479d8b2d9e66c0d4b7995f11291709e
app/assets/javascripts/components/news_feed/news_feed_item_bounty_win.js.jsx
app/assets/javascripts/components/news_feed/news_feed_item_bounty_win.js.jsx
var NewsFeedItemEvent = require('./news_feed_item_event.js.jsx'); module.exports = React.createClass({ displayName: 'NewsFeedItemBountyWin', propTypes: { actor: React.PropTypes.object.isRequired, target: React.PropTypes.object.isRequired }, render: function() { var actor = this.props.actor; var target = this.props.target; return ( <NewsFeedItemEvent> <a href={target.url}>{target.username}</a> {' '} was awarded this by {' '} <a href={actor.url}>{actor.username}</a> </NewsFeedItemEvent> ); } });
var NewsFeedItemEvent = require('./news_feed_item_event.js.jsx'); module.exports = React.createClass({ displayName: 'NewsFeedItemBountyWin', propTypes: { actor: React.PropTypes.object.isRequired, target: React.PropTypes.object.isRequired }, render: function() { var actor = this.props.actor; var target = this.props.target; return ( <NewsFeedItemEvent> <a href={target.url} className="black bold">{target.username}</a> {' '} was awarded this by {' '} <a href={actor.url} className="black bold">{actor.username}</a> </NewsFeedItemEvent> ); } });
Fix styling of usernames in win event
Fix styling of usernames in win event
JSX
agpl-3.0
lachlanjc/meta,assemblymade/meta,lachlanjc/meta,assemblymade/meta,lachlanjc/meta,lachlanjc/meta,assemblymade/meta,assemblymade/meta
--- +++ @@ -13,10 +13,10 @@ return ( <NewsFeedItemEvent> - <a href={target.url}>{target.username}</a> + <a href={target.url} className="black bold">{target.username}</a> {' '} was awarded this by {' '} - <a href={actor.url}>{actor.username}</a> + <a href={actor.url} className="black bold">{actor.username}</a> </NewsFeedItemEvent> ); }
da3189d073ea293a236ccf6001052aa3dbaebdfb
src/apps/draw.jsx
src/apps/draw.jsx
import React from 'react'; import { Link } from 'react-router'; import Grid from '../components/grid.jsx'; import { drawColumn } from '../utils/grid_helper'; import { rows, columns } from '../utils/configuration'; class Draw extends React.Component { constructor() { super(); this.state = { board: this.createEmptyBoard() }; } createEmptyBoard() { const board = [[]]; for (let i = 0; i < rows; i++) { board[0][i] = []; for (let k = 0; k < columns; k++) { board[0][i][k] = { width: 40, height: 40, backgroundColor: '#f5f5f5', margin: 2, }; } } return board; } render() { const { board } = this.state; return ( <div> <h2>Draw as you like!</h2> <Grid>{board.map((character, index) => drawColumn(character, index))}</Grid> <Link to="/">Back</Link> </div> ); } } export default Draw;
import React from 'react'; import { Link } from 'react-router'; import Grid from '../components/grid.jsx'; import Column from '../components/column.jsx'; import Row from '../components/row.jsx'; import Led from '../components/led.jsx'; import { rows, columns } from '../utils/configuration'; class Draw extends React.Component { constructor() { super(); this.state = { board: this.createEmptyBoard() }; } toggleLed(col, row, led) { const board = Object.assign([], this.state.board); const isOn = board[col][row][led].isActive; board[col][row][led].isActive = !isOn; this.setState({ board }); } createEmptyBoard() { const board = [[]]; for (let i = 0; i < rows; i++) { board[0][i] = []; for (let k = 0; k < columns; k++) { board[0][i][k] = { width: 40, height: 40, backgroundColor: '#f5f5f5', color: '0, 143, 0', margin: 2, }; } } return board; } render() { const { board } = this.state; return ( <div> <h2>Draw as you like!</h2> <Grid>{board.map((column, columnIndex) => { return (<Column key={`column_${columnIndex}`}> {column.map((row, rowIndex) => { return (<Row key={`row_${rowIndex}`}>{row.map((led, ledIndex) => { return <div key={`led_${ledIndex}`} onClick={() => { this.toggleLed(columnIndex, rowIndex, ledIndex); }}><Led key={`led_${ledIndex}`} {...led} /></div>; })}</Row>); })} </Column>); })}</Grid> <Link to="/">Back</Link> </div> ); } } export default Draw;
Add onClick handler to toggle LEDs
Add onClick handler to toggle LEDs
JSX
mit
jonathanweiss/pixelboard,jonathanweiss/pixelboard
--- +++ @@ -2,7 +2,10 @@ import { Link } from 'react-router'; import Grid from '../components/grid.jsx'; -import { drawColumn } from '../utils/grid_helper'; +import Column from '../components/column.jsx'; +import Row from '../components/row.jsx'; +import Led from '../components/led.jsx'; + import { rows, columns } from '../utils/configuration'; class Draw extends React.Component { @@ -10,6 +13,14 @@ constructor() { super(); this.state = { board: this.createEmptyBoard() }; + } + + toggleLed(col, row, led) { + const board = Object.assign([], this.state.board); + const isOn = board[col][row][led].isActive; + board[col][row][led].isActive = !isOn; + + this.setState({ board }); } createEmptyBoard() { @@ -21,6 +32,7 @@ width: 40, height: 40, backgroundColor: '#f5f5f5', + color: '0, 143, 0', margin: 2, }; } @@ -34,7 +46,15 @@ return ( <div> <h2>Draw as you like!</h2> - <Grid>{board.map((character, index) => drawColumn(character, index))}</Grid> + <Grid>{board.map((column, columnIndex) => { + return (<Column key={`column_${columnIndex}`}> + {column.map((row, rowIndex) => { + return (<Row key={`row_${rowIndex}`}>{row.map((led, ledIndex) => { + return <div key={`led_${ledIndex}`} onClick={() => { this.toggleLed(columnIndex, rowIndex, ledIndex); }}><Led key={`led_${ledIndex}`} {...led} /></div>; + })}</Row>); + })} + </Column>); + })}</Grid> <Link to="/">Back</Link> </div>
f0eff0daa10eef5c93708fa43c0b5099dd02dc3e
frontend/components/topic-input.jsx
frontend/components/topic-input.jsx
import React, { Component } from 'react' import {default as ReactSelect} from 'react-select' //import css from 'react-select/dist/react-select.css' export default class TopicInput extends Component { constructor(props){ super(props); let topics = []; if (props.value){ topics = props.value.split(',').map(e => { return {label: e, value: e};}); } this.state = {topics: topics} this.handleSelect = this.handleSelect.bind(this); } handleSelect(selected){ const newTopicList = selected.map(option => option.value) this.setState({ topics: selected }); } render(props) { const topicOptions = Array.from(this.props.topics); topicOptions.sort(); // TODO probably need to do more to upgrade this package return( <span> <input type="hidden" value={this.state.topics.map(t=>t.value).join(',')} name="topics" /> <ReactSelect name="topics_input" multi={true} value={this.state.topics} onChange={this.handleSelect} options={topicOptions.map(topic => { return { value: topic, label: topic, }; })} /> </span> ) } }
import React, { Component } from 'react' import CreatableSelect from 'react-select/creatable'; export default class TopicInput extends Component { constructor(props){ super(props); let topics = []; if (props.value){ topics = props.value.split(',').map(e => { return {label: e, value: e};}); } this.state = {topics: topics} this.handleSelect = this.handleSelect.bind(this); } handleSelect(selected){ const newTopicList = selected.map(option => option.value) this.setState({ topics: selected }); } render(props) { const topicOptions = Array.from(this.props.topics); topicOptions.sort(); return( <span> <input type="hidden" value={this.state.topics.map(t=>t.value).join(',')} name="topics" /> <CreatableSelect name="topics_input" isMulti={true} value={this.state.topics} onChange={this.handleSelect} options={topicOptions.map(topic => { return { value: topic, label: topic, }; })} /> </span> ) } }
Update topic input for react-select version upgrade
Update topic input for react-select version upgrade
JSX
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
--- +++ @@ -1,6 +1,5 @@ import React, { Component } from 'react' -import {default as ReactSelect} from 'react-select' -//import css from 'react-select/dist/react-select.css' +import CreatableSelect from 'react-select/creatable'; export default class TopicInput extends Component { constructor(props){ @@ -23,14 +22,12 @@ const topicOptions = Array.from(this.props.topics); topicOptions.sort(); - // TODO probably need to do more to upgrade this package - return( <span> <input type="hidden" value={this.state.topics.map(t=>t.value).join(',')} name="topics" /> - <ReactSelect + <CreatableSelect name="topics_input" - multi={true} + isMulti={true} value={this.state.topics} onChange={this.handleSelect} options={topicOptions.map(topic => {
04df1dc897abfce7f2f9772a8e5c3c5c6695f95e
src/apps/investments/client/opportunities/UnfilteredLargeCapitalOpportunityCollection.jsx
src/apps/investments/client/opportunities/UnfilteredLargeCapitalOpportunityCollection.jsx
import React from 'react' import { connect } from 'react-redux' import { CollectionList } from '../../../../client/components/' import { TASK_GET_OPPORTUNITIES_LIST, ID, state2props } from './state' import { INVESTMENTS__OPPORTUNITIES_LOADED, INVESTMENTS__OPPORTUNITIES_SELECT_PAGE, } from '../../../../client/actions' const LargeCapitalOpportunityCollection = ({ page, count, results, onPageClick, isComplete, }) => { const collectionListTask = { name: TASK_GET_OPPORTUNITIES_LIST, id: ID, progressMessage: 'loading opportunities...', startOnRender: { payload: { page }, onSuccessDispatch: INVESTMENTS__OPPORTUNITIES_LOADED, }, } return ( <CollectionList taskProps={collectionListTask} collectionName="Opportunity" items={results} count={count} onPageClick={onPageClick} activePage={page} isComplete={isComplete} baseDownloadLink="/investments/opportunities/export" entityName="opportunitie" addItemUrl="/investments/opportunities/create" /> ) } export default connect(state2props, (dispatch) => ({ onPageClick: (page) => { dispatch({ type: INVESTMENTS__OPPORTUNITIES_SELECT_PAGE, page, }) }, }))(LargeCapitalOpportunityCollection)
import React from 'react' import { connect } from 'react-redux' import { CollectionList } from '../../../../client/components/' import { TASK_GET_OPPORTUNITIES_LIST, ID, state2props } from './state' import { INVESTMENTS__OPPORTUNITIES_LOADED, INVESTMENTS__OPPORTUNITIES_SELECT_PAGE, } from '../../../../client/actions' const LargeCapitalOpportunityCollection = ({ page, count, results, onPageClick, isComplete, }) => { return ( <CollectionList taskProps={{ name: TASK_GET_OPPORTUNITIES_LIST, id: ID, progressMessage: 'loading opportunities...', startOnRender: { payload: { page }, onSuccessDispatch: INVESTMENTS__OPPORTUNITIES_LOADED, }, }} collectionName="Opportunity" items={results} count={count} onPageClick={onPageClick} activePage={page} isComplete={isComplete} baseDownloadLink="/investments/opportunities/export" entityName="opportunitie" addItemUrl="/investments/opportunities/create" /> ) } export default connect(state2props, (dispatch) => ({ onPageClick: (page) => { dispatch({ type: INVESTMENTS__OPPORTUNITIES_SELECT_PAGE, page, }) }, }))(LargeCapitalOpportunityCollection)
Make task props an inline
C1: Make task props an inline
JSX
mit
uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2
--- +++ @@ -15,19 +15,17 @@ onPageClick, isComplete, }) => { - const collectionListTask = { - name: TASK_GET_OPPORTUNITIES_LIST, - id: ID, - progressMessage: 'loading opportunities...', - startOnRender: { - payload: { page }, - onSuccessDispatch: INVESTMENTS__OPPORTUNITIES_LOADED, - }, - } - return ( <CollectionList - taskProps={collectionListTask} + taskProps={{ + name: TASK_GET_OPPORTUNITIES_LIST, + id: ID, + progressMessage: 'loading opportunities...', + startOnRender: { + payload: { page }, + onSuccessDispatch: INVESTMENTS__OPPORTUNITIES_LOADED, + }, + }} collectionName="Opportunity" items={results} count={count}
5a330e95ae4239c6f4a6da0b2e6a38b508309b01
frontend/components/tab-selector.jsx
frontend/components/tab-selector.jsx
import React from 'react' export default class TabSelector extends React.Component { constructor(props){ super(props); this.state = { activeTab: 0 }; this._handleTabSwitch = this._handleTabSwitch.bind(this); } _handleTabSwitch(tabIndex, e){ e.preventDefault(); this.setState({activeTab: tabIndex}); } render() { const {header, children} = this.props; const {activeTab} = this.state; var tabs = header.map((heading,i) => <li role="presentation" key={i} className={i==activeTab&&'active'}> <a href="#" onClick={this._handleTabSwitch.bind(this,i)}>{heading}</a> </li> ); var activeChild = React.Children.toArray(children)[activeTab]; return ( <div> <ul className="nav nav-pills nav-justified">{tabs}</ul> {activeChild} </div> ); } }
import React from 'react' export default class TabSelector extends React.Component { constructor(props){ super(props); this.state = { activeTab: 0 }; this._handleTabSwitch = this._handleTabSwitch.bind(this); } _handleTabSwitch(tabIndex, e){ e.preventDefault(); this.setState({activeTab: tabIndex}); } render() { const {header, children} = this.props; const {activeTab} = this.state; var tabs = header.map((heading,i) => <li role="presentation" key={i} className={'nav-item'}> <a className={'nav-link' + (i==activeTab?' active':'')} href="#" onClick={this._handleTabSwitch.bind(this,i)}>{heading}</a> </li> ); var activeChild = React.Children.toArray(children)[activeTab]; return ( <div> <ul className="nav nav-pills nav-justified">{tabs}</ul> {activeChild} </div> ); } }
Fix nav pills on team organizer dash
Fix nav pills on team organizer dash
JSX
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
--- +++ @@ -18,8 +18,8 @@ const {header, children} = this.props; const {activeTab} = this.state; var tabs = header.map((heading,i) => - <li role="presentation" key={i} className={i==activeTab&&'active'}> - <a href="#" onClick={this._handleTabSwitch.bind(this,i)}>{heading}</a> + <li role="presentation" key={i} className={'nav-item'}> + <a className={'nav-link' + (i==activeTab?' active':'')} href="#" onClick={this._handleTabSwitch.bind(this,i)}>{heading}</a> </li> ); var activeChild = React.Children.toArray(children)[activeTab];
977012daf781a1eaea6a49b8b62281ee120eea67
imports/ui/containers/main/index.jsx
imports/ui/containers/main/index.jsx
import { connect } from 'react-redux' import { withRouter } from 'react-router-dom' import Main from '../../components/main/index' const mapStateToProps = state => ({ events: state.events, hideCountry: state.hideValues.hideCountry, hideSport: state.hideValues.hideSport }) export default withRouter(connect(mapStateToProps)(Main))
import { connect } from 'react-redux' import { withRouter } from 'react-router-dom' import Main from '../../components/main/index' import { updateBetsSelected } from '../../../api/redux/actions/betsSelected' const mapStateToProps = state => ({ events: state.events, hideCountry: state.hideValues.hideCountry, hideSport: state.hideValues.hideSport }) const mapDispatchToProps = dispatch => ({ onEventClick: onEventClick.bind(null, dispatch) }) export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Main)) function onEventClick (dispatch, syntheticEvent, event) { if (syntheticEvent.target.dataset.betname) { const { betname, oddName, oddValue } = syntheticEvent.target.dataset return dispatch(updateBetsSelected(event, betname, oddName, oddValue)) } return syntheticEvent }
Create a event click handler in the main container that tells Redux to update bets selected.
Create a event click handler in the main container that tells Redux to update bets selected.
JSX
mit
LuisLoureiro/placard-wrapper
--- +++ @@ -2,6 +2,7 @@ import { withRouter } from 'react-router-dom' import Main from '../../components/main/index' +import { updateBetsSelected } from '../../../api/redux/actions/betsSelected' const mapStateToProps = state => ({ events: state.events, @@ -9,4 +10,21 @@ hideSport: state.hideValues.hideSport }) -export default withRouter(connect(mapStateToProps)(Main)) +const mapDispatchToProps = dispatch => ({ + onEventClick: onEventClick.bind(null, dispatch) +}) + +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Main)) + +function onEventClick (dispatch, syntheticEvent, event) { + if (syntheticEvent.target.dataset.betname) { + const { + betname, + oddName, + oddValue + } = syntheticEvent.target.dataset + return dispatch(updateBetsSelected(event, betname, oddName, oddValue)) + } + + return syntheticEvent +}
7bf66a48f39d6a9dee450bcff2d5f32a765a06d9
src/authentication/MobileRouter.jsx
src/authentication/MobileRouter.jsx
import React from 'react' import { Router, withRouter } from 'react-router' import Authentication from './src/Authentication' import Revoked from './src/Revoked' import { logException } from 'drive/lib/reporter' const MobileRouter = ({ history, appRoutes, isAuthenticated, isRevoked, onAuthenticated, onLogout }) => { if (!isAuthenticated) { return ( <Authentication router={history} onComplete={onAuthenticated} onException={logException} /> ) } else if (isRevoked) { return ( <Revoked router={history} onLogBackIn={onAuthenticated} onLogout={onLogout} /> ) } else { return <Router history={history}>{appRoutes}</Router> } } export default withRouter(MobileRouter)
import React from 'react' import { Router, withRouter } from 'react-router' import { Authentication, Revoked } from 'cozy-authentication' import { logException } from 'drive/lib/reporter' const MobileRouter = ({ history, appRoutes, isAuthenticated, isRevoked, onAuthenticated, onLogout }) => { if (!isAuthenticated) { return ( <Authentication router={history} onComplete={onAuthenticated} onException={logException} /> ) } else if (isRevoked) { return ( <Revoked router={history} onLogBackIn={onAuthenticated} onLogout={onLogout} /> ) } else { return <Router history={history}>{appRoutes}</Router> } } export default withRouter(MobileRouter)
Use class from npm module
refacto: Use class from npm module
JSX
agpl-3.0
nono/cozy-files-v3,cozy/cozy-files-v3,y-lohse/cozy-drive,nono/cozy-files-v3,y-lohse/cozy-drive,y-lohse/cozy-files-v3,cozy/cozy-files-v3,y-lohse/cozy-files-v3,cozy/cozy-files-v3,y-lohse/cozy-files-v3,cozy/cozy-files-v3,y-lohse/cozy-drive,nono/cozy-files-v3,nono/cozy-files-v3,y-lohse/cozy-drive
--- +++ @@ -1,8 +1,8 @@ import React from 'react' import { Router, withRouter } from 'react-router' -import Authentication from './src/Authentication' -import Revoked from './src/Revoked' +import { Authentication, Revoked } from 'cozy-authentication' + import { logException } from 'drive/lib/reporter' const MobileRouter = ({
be17ca15146a6c4204c05e2147c669e94dc7652c
src/js/components/context_menu.jsx
src/js/components/context_menu.jsx
import Fluxxor from "fluxxor"; import React from "react"; import ContextMenuItem from "./context_menu_item.jsx"; export default React.createClass({ mixins: [ Fluxxor.FluxMixin(React), Fluxxor.StoreWatchMixin('contextmenu') ], getStateFromFlux: function() { var flux = this.getFlux(); var ctx = flux.store("contextmenu").getState(); return { style: { display: (ctx.display ? "block" : "none"), position: "absolute", top: ctx.pos.top, left: ctx.pos.left }, items: ctx.items }; }, render() { return <ul className="contextmenu" style={this.state.style}> {this.state.items.map((item) => { return <ContextMenuItem item={item} />; })} </ul>; }, });
import Fluxxor from "fluxxor"; import React from "react"; import ContextMenuItem from "./context_menu_item.jsx"; export default React.createClass({ mixins: [ Fluxxor.FluxMixin(React), Fluxxor.StoreWatchMixin('contextmenu') ], getStateFromFlux: function() { var flux = this.getFlux(); var ctx = flux.store("contextmenu").getState(); return { style: { display: (ctx.display ? "block" : "none"), position: "absolute", top: ctx.pos.top, left: ctx.pos.left }, items: ctx.items.filter((item) => item) }; }, render() { return <ul className="contextmenu" style={this.state.style}> {this.state.items.map((item) => { return <ContextMenuItem item={item} />; })} </ul>; }, });
Fix context menu when not RT
Fix context menu when not RT
JSX
mit
uu59/atom-twitter-client,uu59/atom-twitter-client
--- +++ @@ -18,7 +18,7 @@ top: ctx.pos.top, left: ctx.pos.left }, - items: ctx.items + items: ctx.items.filter((item) => item) }; },
39c779a6a2f5c9f34f135faff99a9656653a543d
src/client/components/Sea/Fish.jsx
src/client/components/Sea/Fish.jsx
import React, { Component } from 'react'; import Radium from 'radium'; export const Type = { Small1: 'Small1', Small2: 'Small2', Small3: 'Small3', Small4: 'Small4', Medium1: 'Medium1', Medium2: 'Medium2', Medium3: 'Medium3', Medium4: 'Medium4', Large1: 'Large1', Large2: 'Large2', Large3: 'Large3', Large4: 'Large4', }; @Radium export default class Fish extends Component { render() { const fishImg = `images/fish${this.props.type}.png`; return ( <li className='Fish' style={{ position: 'absolute', left: this.props.left, top: this.props.top, transition: 'ease-in-out 200ms', transform: `scaleX(${this.props.direction})`, }}> <img ref='img' style={{ width: '100%', }} src={fishImg}/> </li> ); } } Fish.propTypes = { direction: React.PropTypes.number, type: React.PropTypes.string.isRequired, left: React.PropTypes.string, top: React.PropTypes.string, }; Fish.defaultProps = { direction: 1, type: '???', };
import React, { Component } from 'react'; import Radium from 'radium'; export const Type = { Small1: 'Small1', Small2: 'Small2', Small3: 'Small3', Small4: 'Small4', Medium1: 'Medium1', Medium2: 'Medium2', Medium3: 'Medium3', Medium4: 'Medium4', Large1: 'Large1', Large2: 'Large2', Large3: 'Large3', Large4: 'Large4', }; @Radium export default class Fish extends Component { render() { const fishImg = `images/fish${this.props.type}.png`; return ( <li className='Fish' style={{ position: 'absolute', width: '120px', left: this.props.left, top: this.props.top, transform: `scaleX(${this.props.direction})`, }}> <img ref='img' style={{ width: '100%', }} src={fishImg}/> </li> ); } } Fish.propTypes = { direction: React.PropTypes.number, type: React.PropTypes.string.isRequired, left: React.PropTypes.string, top: React.PropTypes.string, }; Fish.defaultProps = { direction: 1, type: '???', };
Remove transition and add static width to fish
Remove transition and add static width to fish
JSX
mit
grant/sharkhacks5000,grant/sharkhacks5000
--- +++ @@ -23,9 +23,9 @@ return ( <li className='Fish' style={{ position: 'absolute', + width: '120px', left: this.props.left, top: this.props.top, - transition: 'ease-in-out 200ms', transform: `scaleX(${this.props.direction})`, }}> <img ref='img' style={{
e32697ab5b98b49bf6b9c03f15a4ba0ebc8204fc
web-server/app/assets/javascripts/components/show-package-component.jsx
web-server/app/assets/javascripts/components/show-package-component.jsx
define(['underscore', 'react', '../mixins/show-model', 'components/create-update', './package-filters/add-package-filters'], function(_, React, showModel, CreateUpdate, AddPackageFilters) { var ShowPackageComponent = React.createClass({ contextTypes: { router: React.PropTypes.func }, mixins: [showModel], whereClause: function() { return this.context.router.getCurrentParams(); }, showView: function() { var listItems = _.map(this.state.Model.attributes, function(value, key) { return ( <li> {key}: {value} </li> ) }); return ( <div> <h1> {this.state.Model.get('name') + " - " + this.state.Model.get('version')} </h1> <p> {this.state.Model.get('description')} </p> <ul> {listItems} </ul> <AddPackageFilters Package={this.state.Model}/> <CreateUpdate packageName={this.state.Model.get('name')} packageVersion={this.state.Model.get('version')}/> </div> ); } }); return ShowPackageComponent; });
define(['underscore', 'react', '../mixins/show-model', 'components/create-update', './package-filters/add-package-filters'], function(_, React, showModel, CreateUpdate, AddPackageFilters) { var ShowPackageComponent = React.createClass({ contextTypes: { router: React.PropTypes.func }, mixins: [showModel], whereClause: function() { return this.context.router.getCurrentParams(); }, showView: function() { var rows = _.map(this.state.Model.attributes, function(value, key) { return ( <tr> <td> {key} </td> <td> {value} </td> </tr> ); }); return ( <div> <h1> Package Details </h1> <p> {this.state.Model.get('description')} </p> <table className="table table-striped table-bordered"> <thead> <tr> <td> {this.state.Model.get('name')} </td> <td> </td> </tr> </thead> <tbody> { rows } </tbody> </table> <AddPackageFilters Package={this.state.Model}/> <CreateUpdate packageName={this.state.Model.get('name')} packageVersion={this.state.Model.get('version')}/> </div> ); } }); return ShowPackageComponent; });
Refactor show package from list to table
Refactor show package from list to table
JSX
mpl-2.0
PDXostc/rvi_sota_server,PDXostc/rvi_sota_server,PDXostc/rvi_sota_server
--- +++ @@ -9,24 +9,40 @@ return this.context.router.getCurrentParams(); }, showView: function() { - var listItems = _.map(this.state.Model.attributes, function(value, key) { + var rows = _.map(this.state.Model.attributes, function(value, key) { return ( - <li> - {key}: {value} - </li> - ) + <tr> + <td> + {key} + </td> + <td> + {value} + </td> + </tr> + ); }); return ( <div> <h1> - {this.state.Model.get('name') + " - " + this.state.Model.get('version')} + Package Details </h1> <p> {this.state.Model.get('description')} </p> - <ul> - {listItems} - </ul> + <table className="table table-striped table-bordered"> + <thead> + <tr> + <td> + {this.state.Model.get('name')} + </td> + <td> + </td> + </tr> + </thead> + <tbody> + { rows } + </tbody> + </table> <AddPackageFilters Package={this.state.Model}/> <CreateUpdate packageName={this.state.Model.get('name')} packageVersion={this.state.Model.get('version')}/> </div>
88b1da70ae3c6eb520ca13a3a01564d75a6b8182
client/app/bundles/course/assessment/submission/components/ScribingView/SavingIndicator.jsx
client/app/bundles/course/assessment/submission/components/ScribingView/SavingIndicator.jsx
import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, intlShape } from 'react-intl'; import { scribingTranslations as translations } from '../../translations'; const propTypes = { intl: intlShape.isRequired, clearSavingStatus: PropTypes.func.isRequired, isSaving: PropTypes.bool, isSaved: PropTypes.bool, hasError: PropTypes.bool, }; const style = { savingStatus: { width: '50px', }, saving_status_label: { fontSize: '14px', fontWeight: '500', letterSpacing: '0px', textTransform: 'uppercase', fontFamily: 'Roboto, sans-serif', }, }; const SavingIndicator = (props) => { const { intl, clearSavingStatus, isSaving, isSaved, hasError } = props; let status = ''; if (isSaving) { status = intl.formatMessage(translations.saving); } else if (isSaved) { status = intl.formatMessage(translations.saved); setTimeout(clearSavingStatus, 3000); } else if (hasError) { status = intl.formatMessage(translations.saveError); } return ( <div style={style.savingStatus}> <label htmlFor="saving" style={{ ...style.saving_status_label, color: hasError ? '#e74c3c' : '#bdc3c7', }} > {status} </label> </div> ); }; SavingIndicator.propTypes = propTypes; export default injectIntl(SavingIndicator);
import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, intlShape } from 'react-intl'; import { scribingTranslations as translations } from '../../translations'; const propTypes = { intl: intlShape.isRequired, clearSavingStatus: PropTypes.func.isRequired, isSaving: PropTypes.bool, isSaved: PropTypes.bool, hasError: PropTypes.bool, }; const style = { savingStatus: { width: '50px', }, savingStatusLabel: { fontSize: '14px', fontWeight: '500', letterSpacing: '0px', textTransform: 'uppercase', fontFamily: 'Roboto, sans-serif', }, }; const SavingIndicator = (props) => { const { intl, clearSavingStatus, isSaving, isSaved, hasError } = props; let status = ''; if (isSaving) { status = intl.formatMessage(translations.saving); } else if (isSaved) { status = intl.formatMessage(translations.saved); setTimeout(clearSavingStatus, 3000); } else if (hasError) { status = intl.formatMessage(translations.saveError); } return ( <div style={style.savingStatus}> <label htmlFor="saving" style={{ ...style.savingStatusLabel, color: hasError ? '#e74c3c' : '#bdc3c7', }} > {status} </label> </div> ); }; SavingIndicator.propTypes = propTypes; export default injectIntl(SavingIndicator);
Use camelCase for inline style names
Use camelCase for inline style names
JSX
mit
Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2
--- +++ @@ -15,7 +15,7 @@ savingStatus: { width: '50px', }, - saving_status_label: { + savingStatusLabel: { fontSize: '14px', fontWeight: '500', letterSpacing: '0px', @@ -43,7 +43,7 @@ <label htmlFor="saving" style={{ - ...style.saving_status_label, + ...style.savingStatusLabel, color: hasError ? '#e74c3c' : '#bdc3c7', }} >
603843f37a8ad69baaf729b1b41f8b05a95a77fb
src/main/webapp/resources/js/pages/projects/linelist/components/Templates/TemplateSelect.jsx
src/main/webapp/resources/js/pages/projects/linelist/components/Templates/TemplateSelect.jsx
import React from "react"; import { Select } from "antd"; const { Option } = Select; const { i18n } = window.PAGE; export function TemplateSelect(props) { const templates = props.templates.toJS(); if (templates.length) { return ( <Select defaultValue={"" + props.current} style={{ width: 250 }} onSelect={id => props.fetchTemplate(id)} > <Option value="-1">{i18n.linelist.Select.none}</Option> {templates.map(t => ( <Option key={t.id} value={t.id}> {t.label} </Option> ))} </Select> ); } else { return <span />; } }
import React from "react"; import { Select } from "antd"; const { Option } = Select; const { i18n } = window.PAGE; export function TemplateSelect(props) { const templates = props.templates.toJS(); return ( <Select disabled={templates.length === 0} defaultValue={"" + props.current} style={{ width: 250 }} onSelect={id => props.fetchTemplate(id)} > <Option value="-1">{i18n.linelist.Select.none}</Option> {templates.map(t => ( <Option key={t.id} value={t.id}> {t.label} </Option> ))} </Select> ); }
Disable template selection if none are available.
Disable template selection if none are available.
JSX
apache-2.0
phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida
--- +++ @@ -5,22 +5,19 @@ const { i18n } = window.PAGE; export function TemplateSelect(props) { const templates = props.templates.toJS(); - if (templates.length) { - return ( - <Select - defaultValue={"" + props.current} - style={{ width: 250 }} - onSelect={id => props.fetchTemplate(id)} - > - <Option value="-1">{i18n.linelist.Select.none}</Option> - {templates.map(t => ( - <Option key={t.id} value={t.id}> - {t.label} - </Option> - ))} - </Select> - ); - } else { - return <span />; - } + return ( + <Select + disabled={templates.length === 0} + defaultValue={"" + props.current} + style={{ width: 250 }} + onSelect={id => props.fetchTemplate(id)} + > + <Option value="-1">{i18n.linelist.Select.none}</Option> + {templates.map(t => ( + <Option key={t.id} value={t.id}> + {t.label} + </Option> + ))} + </Select> + ); }
7378b74ae9278c2ffe55587920f3bdc509de3dc8
app/components/wrapped-markdown.jsx
app/components/wrapped-markdown.jsx
import React from 'react'; import markdownz from 'markdownz'; import { browserHistory } from 'react-router'; const Markdown = markdownz.Markdown; const WrappedMarkdown = React.createClass({ propTypes: { content: React.PropTypes.string, project: React.PropTypes.object, header: React.PropTypes.string, }, onClick(e) { const rightButtonPressed = (!!e.button && e.button > 0); if (e.target.origin === window.location.origin && e.target.pathname !== window.location.pathname && !rightButtonPressed) { const newURL = e.target.pathname + e.target.search + e.target.hash; browserHistory.push(newURL); e.preventDefault(); } }, render() { return ( <div onClick={this.onClick}> <Markdown content={this.props.content} project={this.props.project} header={this.props.header} /> </div> ); }, }); export default WrappedMarkdown;
import React from 'react'; import markdownz from 'markdownz'; import { browserHistory } from 'react-router'; const Markdown = markdownz.Markdown; const WrappedMarkdown = React.createClass({ propTypes: { content: React.PropTypes.string, project: React.PropTypes.object, header: React.PropTypes.string, }, onClick(e) { const rightButtonPressed = (!!e.button && e.button > 0); const modifierKey = (e.ctrlKey || e.metaKey); if (e.target.origin === window.location.origin && e.target.pathname !== window.location.pathname && !rightButtonPressed && !modifierKey) { const newURL = e.target.pathname + e.target.search + e.target.hash; browserHistory.push(newURL); e.preventDefault(); } }, render() { return ( <div onClick={this.onClick}> <Markdown content={this.props.content} project={this.props.project} header={this.props.header} /> </div> ); }, }); export default WrappedMarkdown;
Check for ctrl or cmd before overriding Talk links
Check for ctrl or cmd before overriding Talk links
JSX
apache-2.0
amyrebecca/Panoptes-Front-End,parrish/Panoptes-Front-End,parrish/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,zooniverse/Panoptes-Front-End,parrish/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,amyrebecca/Panoptes-Front-End
--- +++ @@ -13,9 +13,11 @@ onClick(e) { const rightButtonPressed = (!!e.button && e.button > 0); + const modifierKey = (e.ctrlKey || e.metaKey); if (e.target.origin === window.location.origin && e.target.pathname !== window.location.pathname && - !rightButtonPressed) { + !rightButtonPressed && + !modifierKey) { const newURL = e.target.pathname + e.target.search + e.target.hash; browserHistory.push(newURL); e.preventDefault();
ed12cc4461f51db08187b6dc72644e6cbe2319e6
app/views/LeftDrawer/LeftDrawer.jsx
app/views/LeftDrawer/LeftDrawer.jsx
/* Left drawer navigation component */ import React from 'react'; import Drawer from 'material-ui/Drawer' import MenuItem from 'material-ui/MenuItem'; import IconButton from 'material-ui/IconButton'; import NavigationMenu from 'material-ui/svg-icons/navigation/menu'; export default class LeftDrawer extends React.Component { constructor(props) { super(props); this.state = { open: false, }; } handleToggle = () => { this.setState({ open: !this.state.open, }); } render() { return ( <div><IconButton onTouchTap={this.handleToggle} targetOrigin={ {horizontal: 'right', vertical: 'top'} } anchorOrigin={ {horizontal: 'right', vertical: 'top'} }> <NavigationMenu /> </IconButton> <Drawer open={this.state.open} docked={false} onRequestChange={this.handleToggle.bind(this)}> <MenuItem>Menu Item</MenuItem> <MenuItem>Menu Item</MenuItem> </Drawer> </div> ); } }
/* Left drawer navigation component */ import React from 'react'; import Drawer from 'material-ui/Drawer' import MenuItem from 'material-ui/MenuItem'; import IconButton from 'material-ui/IconButton'; import NavigationMenu from 'material-ui/svg-icons/navigation/menu'; export default class LeftDrawer extends React.Component { constructor(props) { super(props); this.state = { open: false, }; } handleToggle = () => { this.setState({ open: !this.state.open, }); } render() { return ( <div><IconButton onTouchTap={this.handleToggle}> <NavigationMenu /> </IconButton> <Drawer open={this.state.open} docked={false} onRequestChange={this.handleToggle.bind(this)}> <MenuItem>Menu Item</MenuItem> <MenuItem>Menu Item</MenuItem> </Drawer> </div> ); } }
Remove unneeded props in drawer
Remove unneeded props in drawer
JSX
mit
AlbertoALopez/polling,AlbertoALopez/polling
--- +++ @@ -20,9 +20,7 @@ render() { return ( <div><IconButton - onTouchTap={this.handleToggle} - targetOrigin={ {horizontal: 'right', vertical: 'top'} } - anchorOrigin={ {horizontal: 'right', vertical: 'top'} }> + onTouchTap={this.handleToggle}> <NavigationMenu /> </IconButton> <Drawer
8cd552c86e5334e6a8f6253c137af8a54ac13c23
client/components/TextAnalytics.jsx
client/components/TextAnalytics.jsx
import React from 'react'; import { getDefsAndSyns, analyzeText } from '../../server/utils/customTextAnalytics.js'; export default class TextAnalytics extends React.Component { renderAnalytics = (string) => { const analyticsObj = analyzeText(string); let countEachWordResult = analyticsObj.allTotals; let topThreeWordsResult = analyticsObj.topThree; let results = []; for (let key in topThreeWordsResult) { results.push([key, ": " + topThreeWordsResult[key] + " times"]); } return results; } getWordInfo = (word) => { return getDefsAndSyns(word); } render() { // hold reference of 'this' const temp = this; let topThree = this.renderAnalytics(this.props.text).map((word) => { return ( <div id={word[0]}>{word} <div id="partOfSpeech">Part of Speech: {temp.getWordInfo(word[0]).pos}</div> <div id="definition">Definition: {temp.getWordInfo(word[0]).def}</div> { temp.getWordInfo(word[0]).syns.map((syn) => { return ( <li>{syn.word}</li> ) }) } <hr></hr> </div> ) }); return ( <div> <p>Here are your results:</p> <p>Top Three Most Used Words: </p> {topThree} </div> ); } }
import React from 'react'; import { getDefsAndSyns, analyzeText } from '../../server/utils/customTextAnalytics.js'; export default class TextAnalytics extends React.Component { renderAnalytics = (string) => { const analyticsObj = analyzeText(string); let countEachWordResult = analyticsObj.allTotals; let topThreeWordsResult = analyticsObj.topThree; let results = []; for (let key in topThreeWordsResult) { results.push([key, ": " + topThreeWordsResult[key] + " times"]); } return results; } getWordInfo = (word) => { return getDefsAndSyns(word); } render() { const temp = this; if (this.props.text) { let topThree = this.renderAnalytics(this.props.text).map((word) => { return ( <div id={word[0]}>{word} <div id="partOfSpeech">Part of Speech: {temp.getWordInfo(word[0]).pos}</div> <div id="definition">Definition: {temp.getWordInfo(word[0]).def}</div> { temp.getWordInfo(word[0]).syns.map((syn) => { return ( <li>{syn.word}</li> ) }) } <hr></hr> </div> ) }); return ( <div> <p>Here are your results:</p> <p>Top Three Most Used Words: </p> {topThree} </div> ); } else { return ( <div>Enter some text to analyze</div> ); } } }
Fix error (application breaking) when user backspaces to get rid of text
Fix error (application breaking) when user backspaces to get rid of text
JSX
mit
alexxisroxxanne/SpeechDoctor,nonchalantkettle/SpeechDoctor,alexxisroxxanne/SpeechDoctor,nonchalantkettle/SpeechDoctor
--- +++ @@ -18,32 +18,35 @@ } render() { - // hold reference of 'this' const temp = this; - - let topThree = this.renderAnalytics(this.props.text).map((word) => { + if (this.props.text) { + let topThree = this.renderAnalytics(this.props.text).map((word) => { + return ( + <div id={word[0]}>{word} + <div id="partOfSpeech">Part of Speech: {temp.getWordInfo(word[0]).pos}</div> + <div id="definition">Definition: {temp.getWordInfo(word[0]).def}</div> + { + temp.getWordInfo(word[0]).syns.map((syn) => { + return ( + <li>{syn.word}</li> + ) + }) + } + <hr></hr> + </div> + ) + }); return ( - <div id={word[0]}>{word} - <div id="partOfSpeech">Part of Speech: {temp.getWordInfo(word[0]).pos}</div> - <div id="definition">Definition: {temp.getWordInfo(word[0]).def}</div> - { - temp.getWordInfo(word[0]).syns.map((syn) => { - return ( - <li>{syn.word}</li> - ) - }) - } - <hr></hr> + <div> + <p>Here are your results:</p> + <p>Top Three Most Used Words: </p> + {topThree} </div> - ) - }); - - return ( - <div> - <p>Here are your results:</p> - <p>Top Three Most Used Words: </p> - {topThree} - </div> - ); + ); + } else { + return ( + <div>Enter some text to analyze</div> + ); + } } }
49ac5574826369f4aa86aa69c113e4d4720050d6
src/ui/tracking.jsx
src/ui/tracking.jsx
/* @flow */ /** @jsx node */ import { node, Fragment, type ChildType } from 'jsx-pragmatic/src'; export function TrackingBeacon({ url, nonce } : { url : string, nonce : ?string }) : ChildType { return ( <Fragment> <style innerHTML={ ` .tracking-beacon: { visibility: hidden; position: absolute; height: 1px; width: 1px; } ` } /> <img class='tracking-beacon' src={ url } nonce={ nonce } /> </Fragment> ); }
/* @flow */ /** @jsx node */ import { node, Fragment, type ChildType } from 'jsx-pragmatic/src'; export function TrackingBeacon({ url, nonce } : { url : string, nonce : ?string }) : ChildType { return ( <Fragment> <style nonce={ nonce } innerHTML={ ` .tracking-beacon: { visibility: hidden; position: absolute; height: 1px; width: 1px; } ` } /> <img class='tracking-beacon' src={ url } /> </Fragment> ); }
Add nonce to style tag
Add nonce to style tag
JSX
apache-2.0
paypal/paypal-checkout,paypal/paypal-checkout,paypal/paypal-checkout
--- +++ @@ -6,7 +6,9 @@ export function TrackingBeacon({ url, nonce } : { url : string, nonce : ?string }) : ChildType { return ( <Fragment> - <style innerHTML={ ` + <style + nonce={ nonce } + innerHTML={ ` .tracking-beacon: { visibility: hidden; position: absolute; @@ -14,7 +16,7 @@ width: 1px; } ` } /> - <img class='tracking-beacon' src={ url } nonce={ nonce } /> + <img class='tracking-beacon' src={ url } /> </Fragment> ); }
8358a8440fd354b4208c627dacc37c52056dffba
app/components/organisms/Header.jsx
app/components/organisms/Header.jsx
import React from 'react'; import { translate } from 'react-i18next'; import {Navbar, Nav} from 'react-bootstrap'; import {Link} from 'react-router'; import ExternalLink from '../atoms/ExternalLink'; import HeaderLanguageSelector from '../molecules/HeaderLanguageSelector'; import './Header.css'; const Header = React.createClass({ propTypes: { t: React.PropTypes.func.isRequired, }, render() { const { t } = this.props; return ( <div> <Navbar style={{ fontSize: '115%' }}> <Navbar.Header> <Navbar.Brand> <Link to="/" style={{ fontSize: '150%' }}>Szeremi</Link> </Navbar.Brand> <HeaderLanguageSelector /> </Navbar.Header> <Nav pullRight style={{ fontSize: '120%' }}> <li><Link to="/"><span className="fa fa-home" /> {t('home')}</Link></li> <li><Link to="/resume"><span className="fa fa-briefcase" /> {t('resumé')}</Link></li> <li><ExternalLink href="http://blog.szeremi.org/">{t('blog')}</ExternalLink></li> </Nav> </Navbar> </div> ); }, }); export default translate(['translation'])(Header);
import React from 'react'; import { translate } from 'react-i18next'; import {Navbar, Nav} from 'react-bootstrap'; import {Link} from 'react-router'; import ExternalLink from '../atoms/ExternalLink'; import HeaderLanguageSelector from '../molecules/HeaderLanguageSelector'; import './Header.css'; const Header = React.createClass({ propTypes: { t: React.PropTypes.func.isRequired, }, render() { const { t } = this.props; return ( <div> <Navbar style={{ fontSize: '115%' }}> <Navbar.Header> <Navbar.Brand> <Link to="/" style={{ fontSize: '150%' }}>Szeremi</Link> </Navbar.Brand> <HeaderLanguageSelector /> </Navbar.Header> <Nav pullRight style={{ textShadow: '1px 1px 2px rgba(0, 0, 0, .5)', fontSize: '120%', }} > <li><Link to="/"><span className="fa fa-home" /> {t('home')}</Link></li> <li><Link to="/resume"><span className="fa fa-briefcase" /> {t('resumé')}</Link></li> <li><ExternalLink href="http://blog.szeremi.org/">{t('blog')}</ExternalLink></li> </Nav> </Navbar> </div> ); }, }); export default translate(['translation'])(Header);
Use ImmutableJS for webpack config and overrides
Use ImmutableJS for webpack config and overrides
JSX
mit
amcsi/szeremi,amcsi/szeremi
--- +++ @@ -26,7 +26,13 @@ </Navbar.Brand> <HeaderLanguageSelector /> </Navbar.Header> - <Nav pullRight style={{ fontSize: '120%' }}> + <Nav + pullRight + style={{ + textShadow: '1px 1px 2px rgba(0, 0, 0, .5)', + fontSize: '120%', + }} + > <li><Link to="/"><span className="fa fa-home" /> {t('home')}</Link></li> <li><Link to="/resume"><span className="fa fa-briefcase" /> {t('resumé')}</Link></li> <li><ExternalLink href="http://blog.szeremi.org/">{t('blog')}</ExternalLink></li>
901f169324a07bf4ef89a6f9195c8bf4b6c97078
src/pages/race-calendar.jsx
src/pages/race-calendar.jsx
import moment from 'moment'; import React from 'react'; import BigCalendar from 'react-big-calendar'; import 'react-big-calendar/lib/css/react-big-calendar.css'; BigCalendar.momentLocalizer(moment); const RaceCalendar = () => <BigCalendar events={[]} />; export default RaceCalendar;
import moment from 'moment'; import React from 'react'; import BigCalendar from 'react-big-calendar'; import 'react-big-calendar/lib/css/react-big-calendar.css'; import Helmet from 'react-helmet'; import ArticleContainer from '../components/article-container'; import CoverImage from '../components/cover-image'; BigCalendar.momentLocalizer(moment); const RaceCalendar = () => { const title = 'Versenynaptár'; return ( <div> <Helmet> <title>{title}</title> </Helmet> <CoverImage /> <ArticleContainer title={title}> <BigCalendar events={[]} /> </ArticleContainer> </div> ); }; export default RaceCalendar;
Fix appearance of the race calendar page
Fix appearance of the race calendar page
JSX
mit
simonyiszk/mvk-web,simonyiszk/mvk-web
--- +++ @@ -2,9 +2,28 @@ import React from 'react'; import BigCalendar from 'react-big-calendar'; import 'react-big-calendar/lib/css/react-big-calendar.css'; +import Helmet from 'react-helmet'; +import ArticleContainer from '../components/article-container'; +import CoverImage from '../components/cover-image'; BigCalendar.momentLocalizer(moment); -const RaceCalendar = () => <BigCalendar events={[]} />; +const RaceCalendar = () => { + const title = 'Versenynaptár'; + + return ( + <div> + <Helmet> + <title>{title}</title> + </Helmet> + + <CoverImage /> + + <ArticleContainer title={title}> + <BigCalendar events={[]} /> + </ArticleContainer> + </div> + ); +}; export default RaceCalendar;
a1f01542669010ac9d0265d1202465f2398c511b
src/templates/landing_pages/_common/outdated_browser_message.jsx
src/templates/landing_pages/_common/outdated_browser_message.jsx
import React from 'react'; const OutdatedBrowserMessage = () => ( <div id='outdated_browser_message' className='invisible'> {it.L('Your web browser ([_1]) is out of date and may affect your trading experience. Proceed at your own risk. [_2]Update browser[_3]', '{brow_name}', '<a href="https://www.whatbrowser.org/" target="_blank">', '</a>')} </div> ); export default OutdatedBrowserMessage;
import React from 'react'; const OutdatedBrowserMessage = () => ( <div id='outdated_browser_message' className='invisible' style={{ display: 'none' }}> {it.L('Your web browser ([_1]) is out of date and may affect your trading experience. Proceed at your own risk. [_2]Update browser[_3]', '{brow_name}', '<a href="https://www.whatbrowser.org/" target="_blank">', '</a>')} </div> ); export default OutdatedBrowserMessage;
Hide when binary-style is not available
Hide when binary-style is not available
JSX
apache-2.0
4p00rv/binary-static,raunakkathuria/binary-static,ashkanx/binary-static,binary-static-deployed/binary-static,raunakkathuria/binary-static,4p00rv/binary-static,4p00rv/binary-static,raunakkathuria/binary-static,binary-com/binary-static,binary-com/binary-static,kellybinary/binary-static,kellybinary/binary-static,binary-static-deployed/binary-static,ashkanx/binary-static,binary-static-deployed/binary-static,negar-binary/binary-static,ashkanx/binary-static,kellybinary/binary-static,binary-com/binary-static,negar-binary/binary-static,negar-binary/binary-static
--- +++ @@ -1,7 +1,7 @@ import React from 'react'; const OutdatedBrowserMessage = () => ( - <div id='outdated_browser_message' className='invisible'> + <div id='outdated_browser_message' className='invisible' style={{ display: 'none' }}> {it.L('Your web browser ([_1]) is out of date and may affect your trading experience. Proceed at your own risk. [_2]Update browser[_3]', '{brow_name}', '<a href="https://www.whatbrowser.org/" target="_blank">', '</a>')} </div> );
b5edc21996dc084dd3326e4f9505ce1f9250a041
src/hooks/withAppsInMaintenance.jsx
src/hooks/withAppsInMaintenance.jsx
import { useState, useEffect } from 'react' import { Registry } from 'cozy-client' const useAppsInMaintenance = client => { const [appsInMaintenance, setAppsInMaintenance] = useState([]) const registry = new Registry({ client }) useEffect(() => { const fetchData = async () => { const newAppsInMaintenance = await registry.fetchAppsInMaintenance() if (newAppsInMaintenance.length !== appsInMaintenance.length) setAppsInMaintenance(newAppsInMaintenance) } fetchData() }) return appsInMaintenance } export default useAppsInMaintenance
import { useState, useEffect } from 'react' import { Registry } from 'cozy-client' const useAppsInMaintenance = client => { const [appsInMaintenance, setAppsInMaintenance] = useState([]) const registry = new Registry({ client }) useEffect(() => { const fetchData = async () => { const newAppsInMaintenance = await registry.fetchAppsInMaintenance() setAppsInMaintenance(newAppsInMaintenance) } fetchData() }, []) return appsInMaintenance } export default useAppsInMaintenance
Set maintenance hook dependencies to avoid re-renders and re-queries
fix: Set maintenance hook dependencies to avoid re-renders and re-queries
JSX
agpl-3.0
cozy/cozy-home,cozy/cozy-home,cozy/cozy-home
--- +++ @@ -10,11 +10,10 @@ useEffect(() => { const fetchData = async () => { const newAppsInMaintenance = await registry.fetchAppsInMaintenance() - if (newAppsInMaintenance.length !== appsInMaintenance.length) - setAppsInMaintenance(newAppsInMaintenance) + setAppsInMaintenance(newAppsInMaintenance) } fetchData() - }) + }, []) return appsInMaintenance }
2b3368f8955dcb63b97b4920cdfbcf0832f9ef33
src/widgets/likert-scale-editor.jsx
src/widgets/likert-scale-editor.jsx
import * as React from "react"; import PropTypes from "prop-types"; import { StyleSheet, css } from "aphrodite"; import { LikertFaces } from './likert-scale.jsx'; const styles = StyleSheet.create({ face: { display: 'inline-block', width: 30, height: 30, margin: 5, verticalAlign: 'middle', }, }); class LikertScaleEditor extends React.Component { static propTypes = { labels: PropTypes.arrayOf(PropTypes.string), onChange: PropTypes.func.isRequired, }; static defaultProps = { labels: ["", "", "", "", ""], }; constructor(props) { super(props) } render() { return <div> Choice Labels: {this.props.labels.map((label, i) => ( <div> <img className={css(styles.face)} src={LikertFaces[i]} alt="" /> <input type="text" className={css(styles.labelInput)} value={label} onChange={(e) => this._changeLabel(i, e.target.value)} /> </div> ))} </div> } _changeLabel = (index, newLabel) => { this.props.onChange({ labels: this.props.labels.map((label, i) => i === index ? newLabel : label), }); }; serialize() { return { labels: this.props.labels, }; } } export default LikertScaleEditor;
import * as React from "react"; import PropTypes from "prop-types"; import { StyleSheet, css } from "aphrodite"; import { LikertFaces } from './likert-scale.jsx'; const styles = StyleSheet.create({ face: { display: 'inline-block', width: 30, height: 30, margin: 5, verticalAlign: 'middle', }, }); class LikertScaleEditor extends React.Component { static propTypes = { labels: PropTypes.arrayOf(PropTypes.string), onChange: PropTypes.func.isRequired, }; static defaultProps = { labels: ["", "", "", ""], }; constructor(props) { super(props) } render() { return <div> Choice Labels: {this.props.labels.map((label, i) => ( <div> <img className={css(styles.face)} src={LikertFaces[i]} alt="" /> <input type="text" className={css(styles.labelInput)} value={label} onChange={(e) => this._changeLabel(i, e.target.value)} /> </div> ))} </div> } _changeLabel = (index, newLabel) => { this.props.onChange({ labels: this.props.labels.map((label, i) => i === index ? newLabel : label), }); }; serialize() { return { labels: this.props.labels, }; } } export default LikertScaleEditor;
Remove default value for middle option
Remove default value for middle option
JSX
mit
ariabuckles/perseus,ariabuckles/perseus,ariabuckles/perseus,ariabuckles/perseus
--- +++ @@ -20,7 +20,7 @@ }; static defaultProps = { - labels: ["", "", "", "", ""], + labels: ["", "", "", ""], }; constructor(props) {
04d750f1128673f8d7fd0bc22dd9192e1aaf865a
woodstock/src/containers/App.jsx
woodstock/src/containers/App.jsx
import React from 'react'; import PropTypes from 'prop-types'; import {bindActionCreators} from 'redux'; import {connect} from 'react-redux'; import AppBarHeader from '../components/AppBarHeader'; import UnitList from '../components/UnitList'; import * as UnitActions from '../actions/UnitActions'; const App = ({actions, units}) => ( <div> <AppBarHeader/> <UnitList units={units}/> </div> ); App.propTypes = { actions: PropTypes.object.isRequired, units: PropTypes.array.isRequired }; const mapStateToProps = state => ({ units: state.units }); const mapDispatchToProps = dispatch => ({ actions: bindActionCreators(UnitActions, dispatch) }); export default connect(mapStateToProps, mapDispatchToProps())(App)
import React from 'react'; import PropTypes from 'prop-types'; import {connect} from 'react-redux'; import AppBarHeader from '../components/AppBarHeader'; import UnitList from '../components/UnitList'; const App = ({units}) => ( <div> <AppBarHeader/> <UnitList units={units}/> </div> ); App.propTypes = { units: PropTypes.array.isRequired }; const mapStateToProps = state => ({ units: state.units }); export default connect(mapStateToProps)(App)
Delete bind action that will be necessary in future
Delete bind action that will be necessary in future
JSX
apache-2.0
solairerove/woodstock,solairerove/woodstock,solairerove/woodstock
--- +++ @@ -1,12 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; -import {bindActionCreators} from 'redux'; import {connect} from 'react-redux'; import AppBarHeader from '../components/AppBarHeader'; import UnitList from '../components/UnitList'; -import * as UnitActions from '../actions/UnitActions'; -const App = ({actions, units}) => ( +const App = ({units}) => ( <div> <AppBarHeader/> <UnitList units={units}/> @@ -14,7 +12,6 @@ ); App.propTypes = { - actions: PropTypes.object.isRequired, units: PropTypes.array.isRequired }; @@ -22,8 +19,4 @@ units: state.units }); -const mapDispatchToProps = dispatch => ({ - actions: bindActionCreators(UnitActions, dispatch) -}); - -export default connect(mapStateToProps, mapDispatchToProps())(App) +export default connect(mapStateToProps)(App)
d866946ce4d92f1cf4841d8199dbc671f2e63338
client/components/LandingButton.jsx
client/components/LandingButton.jsx
// import React from 'react'; // // class LandingView extends React.Component { // constructor(props) { // super(props); // this.state = { // showText: false, // }; // } // // handleClick() { // this.setState({ // showText: true, // }); // } // render() { // return ( // <h1>LandingView</h1> // ); // } // }
import React from 'react'; export default class LandingButton extends React.Component { constructor(props) { super(props); this.state = { showText: false, }; } render() { return ( <button onClick={this.props.handleLandingBtnClick}>LandingButton</button> ); } }
Apply onClick to change state in App to render correct views
Apply onClick to change state in App to render correct views
JSX
mit
alexxisroxxanne/SpeechDoctor,nonchalantkettle/SpeechDoctor,nonchalantkettle/SpeechDoctor,alexxisroxxanne/SpeechDoctor
--- +++ @@ -1,21 +1,16 @@ -// import React from 'react'; -// -// class LandingView extends React.Component { -// constructor(props) { -// super(props); -// this.state = { -// showText: false, -// }; -// } -// -// handleClick() { -// this.setState({ -// showText: true, -// }); -// } -// render() { -// return ( -// <h1>LandingView</h1> -// ); -// } -// } +import React from 'react'; + +export default class LandingButton extends React.Component { + constructor(props) { + super(props); + this.state = { + showText: false, + }; + } + + render() { + return ( + <button onClick={this.props.handleLandingBtnClick}>LandingButton</button> + ); + } +}
4f42eeb2099791c4d4a6ff305fa0726bff27a929
tutor/specs/components/app.spec.jsx
tutor/specs/components/app.spec.jsx
import { Wrapper, SnapShot } from './helpers/component-testing'; import App from '../../src/components/app'; import User from '../../src/models/user'; jest.mock('../../src/models/user', () => ({ recordSessionStart: jest.fn(), logEvent: jest.fn(), verifiedRoleForCourse() { return 'teacher'; }, isConfirmedFaculty: true, })); jest.mock('../../src/models/chat'); describe('main Tutor App', () => { let props; beforeEach(() => { props = { location: { pathname: '/' }, }; }); it('renders and matches snapshot', () => { expect(SnapShot.create( <Wrapper _wrapped_component={App} {...props} />).toJSON() ).toMatchSnapshot(); }); it('records user session', () => { shallow(<App {...props} />); expect(User.recordSessionStart).toHaveBeenCalled(); }); });
import { Wrapper, SnapShot } from './helpers/component-testing'; import EnzymeContext from './helpers/enzyme-context'; import App from '../../src/components/app'; import User from '../../src/models/user'; jest.mock('../../src/models/user', () => ({ recordSessionStart: jest.fn(), logEvent: jest.fn(), verifiedRoleForCourse() { return 'teacher'; }, isConfirmedFaculty: true, })); jest.mock('../../src/models/chat'); describe('main Tutor App', () => { let props; beforeEach(() => { props = { location: { pathname: '/' }, }; }); it('renders and matches snapshot', () => { expect(SnapShot.create( <Wrapper _wrapped_component={App} {...props} />).toJSON() ).toMatchSnapshot(); }); it('records user session', () => { shallow(<App {...props} />); expect(User.recordSessionStart).toHaveBeenCalled(); }); it('renders even if course that doesn\'t exist', () => { const pathname = '/course/123'; props.location.pathname = pathname; const app = mount(<App {...props} />, EnzymeContext.build({ pathname })); expect(app).toHaveRendered('WarningModal'); expect(app.find('WarningModal').props().title).toContain('can’t access this cours'); app.unmount(); }); });
Test accessing a non-existant course shows message
Test accessing a non-existant course shows message
JSX
agpl-3.0
openstax/tutor-js,openstax/tutor-js,openstax/tutor-js,openstax/tutor-js,openstax/tutor-js
--- +++ @@ -1,5 +1,5 @@ import { Wrapper, SnapShot } from './helpers/component-testing'; - +import EnzymeContext from './helpers/enzyme-context'; import App from '../../src/components/app'; import User from '../../src/models/user'; jest.mock('../../src/models/user', () => ({ @@ -34,4 +34,14 @@ shallow(<App {...props} />); expect(User.recordSessionStart).toHaveBeenCalled(); }); + + it('renders even if course that doesn\'t exist', () => { + const pathname = '/course/123'; + props.location.pathname = pathname; + const app = mount(<App {...props} />, EnzymeContext.build({ pathname })); + expect(app).toHaveRendered('WarningModal'); + expect(app.find('WarningModal').props().title).toContain('can’t access this cours'); + app.unmount(); + }); + });
b091c7de782a73a4e95f16257f6241b928661d26
src/js/clearfix.jsx
src/js/clearfix.jsx
var React = require('react'); var BeforeAfterWrapper = require('./before-after-wrapper.jsx'); var ClearFix = React.createClass({ render: function() { var { style, ...other } = this.props; var before = function() { return { content: "' '", display: 'table' } } var after = before(); after.clear = 'both'; return ( <BeforeAfterWrapper {...other} beforeStyle={before()} afterStyle={after} style={this.props.style}> {this.props.children} </BeforeAfterWrapper> ); } }); module.exports = ClearFix;
var React = require('react'); var BeforeAfterWrapper = require('./before-after-wrapper'); var ClearFix = React.createClass({ render: function() { var { style, ...other } = this.props; var before = function() { return { content: "' '", display: 'table' } } var after = before(); after.clear = 'both'; return ( <BeforeAfterWrapper {...other} beforeStyle={before()} afterStyle={after} style={this.props.style}> {this.props.children} </BeforeAfterWrapper> ); } }); module.exports = ClearFix;
Remove .jsx extension from require
Remove .jsx extension from require
JSX
mit
arkxu/material-ui,gaowenbin/material-ui,tomgco/material-ui,igorbt/material-ui,mikedklein/material-ui,lucy-orbach/material-ui,VirtueMe/material-ui,wustxing/material-ui,demoalex/material-ui,cjhveal/material-ui,Qix-/material-ui,lawrence-yu/material-ui,mulesoft/material-ui,w01fgang/material-ui,esleducation/material-ui,inoc603/material-ui,DenisPostu/material-ui,frnk94/material-ui,jeroencoumans/material-ui,Hamstr/material-ui,glabcn/material-ui,callemall/material-ui,mogii/material-ui,manchesergit/material-ui,sanemat/material-ui,hesling/material-ui,pancho111203/material-ui,tan-jerene/material-ui,ProductiveMobile/material-ui,zulfatilyasov/material-ui-yearpicker,ruifortes/material-ui,CumpsD/material-ui,ask-izzy/material-ui,chrismcv/material-ui,creatorkuang/mui-react,wunderlink/material-ui,tirams/material-ui,matthewoates/material-ui,whatupdave/material-ui,XiaonuoGantan/material-ui,ddebowczyk/material-ui,b4456609/pet-new,mtsandeep/material-ui,checkraiser/material-ui,AndriusBil/material-ui,KevinMcIntyre/material-ui,agnivade/material-ui,kittyjumbalaya/material-components-web,yongxu/material-ui,nevir/material-ui,pomerantsev/material-ui,lgollut/material-ui,rodolfo2488/material-ui,matthewoates/material-ui,b4456609/pet-new,spiermar/material-ui,mobilelife/material-ui,Yepstr/material-ui,pradel/material-ui,vmaudgalya/material-ui,deerawan/material-ui,chirilo/material-ui,hwo411/material-ui,bdsabian/material-ui-old,rhaedes/material-ui,milworm/material-ui,Videri/material-ui,mikey2XU/material-ui,mbrookes/material-ui,grovelabs/material-ui,bORm/material-ui,kybarg/material-ui,subjectix/material-ui,tan-jerene/material-ui,oliviertassinari/material-ui,2947721120/material-ui,ichiohta/material-ui,tingi/material-ui,trendchaser4u/material-ui,rolandpoulter/material-ui,Zadielerick/material-ui,mui-org/material-ui,ashfaqueahmadbari/material-ui,marcelmokos/material-ui,buttercloud/material-ui,hellokitty111/material-ui,udhayam/material-ui,ichiohta/material-ui,zhengjunwei/material-ui,und3fined/material-ui,mbrookes/material-ui,JAStanton/material-ui-io,oliviertassinari/material-ui,bratva/material-ui,mui-org/material-ui,jacobrosenthal/material-ui,cherniavskii/material-ui,NatalieT/material-ui,ahmedshuhel/material-ui,checkraiser/material-ui,kebot/material-ui,hjmoss/material-ui,pomerantsev/material-ui,azazdeaz/material-ui,bratva/material-ui,und3fined/material-ui,ArcanisCz/material-ui,Jandersolutions/material-ui,oliverfencott/material-ui,bgribben/material-ui,callemall/material-ui,skarnecki/material-ui,safareli/material-ui,allanalexandre/material-ui,Tionx/material-ui,AllenSH12/material-ui,mmrtnz/material-ui,hwo411/material-ui,Cerebri/material-ui,juhaelee/material-ui,gsklee/material-ui,freedomson/material-ui,freedomson/material-ui,pancho111203/material-ui,CyberSpace7/material-ui,tungmv7/material-ui,rscnt/material-ui,mayblue9/material-ui,tungmv7/material-ui,mmrtnz/material-ui,timuric/material-ui,MrOrz/material-ui,kasra-co/material-ui,hiddentao/material-ui,kittyjumbalaya/material-components-web,MrOrz/material-ui,yulric/material-ui,vaiRk/material-ui,w01fgang/material-ui,JAStanton/material-ui,ProductiveMobile/material-ui,jtollerene/material-ui,freeslugs/material-ui,verdan/material-ui,juhaelee/material-ui-io,ruifortes/material-ui,cherniavskii/material-ui,nevir/material-ui,mgibeau/material-ui,chirilo/material-ui,Tionx/material-ui,mjhasbach/material-ui,juhaelee/material-ui,ButuzGOL/material-ui,Kagami/material-ui,grovelabs/material-ui,btmills/material-ui,hai-cea/material-ui,inoc603/material-ui,JsonChiu/material-ui,mit-cml/iot-website-source,mtnk/material-ui,owencm/material-ui,frnk94/material-ui,xiaoking/material-ui,ababol/material-ui,unageanu/material-ui,b4456609/pet-new,igorbt/material-ui,gsls1817/material-ui,EcutDavid/material-ui,Unforgiven-wanda/learning-react,hybrisCole/material-ui,jmknoll/material-ui,alitaheri/material-ui,ahmedshuhel/material-ui,RickyDan/material-ui,louy/material-ui,lastjune/material-ui,kybarg/material-ui,lionkeng/material-ui,mit-cml/iot-website-source,alex-dixon/material-ui,ronlobo/material-ui,ianwcarlson/material-ui,nik4152/material-ui,lawrence-yu/material-ui,meimz/material-ui,JAStanton/material-ui-io,ludiculous/material-ui,woanversace/material-ui,nahue/material-ui,hiddentao/material-ui,kabaka/material-ui,Jonekee/material-ui,jeroencoumans/material-ui,owencm/material-ui,christopherL91/material-ui,trendchaser4u/material-ui,mit-cml/iot-website-source,hophacker/material-ui,VirtueMe/material-ui,whatupdave/material-ui,roderickwang/material-ui,CumpsD/material-ui,zulfatilyasov/material-ui-yearpicker,andrejunges/material-ui,AndriusBil/material-ui,ArcanisCz/material-ui,cherniavskii/material-ui,2390183798/material-ui,Qix-/material-ui,ababol/material-ui,ashfaqueahmadbari/material-ui,felipeptcho/material-ui,Saworieza/material-ui,mtsandeep/material-ui,kybarg/material-ui,maoziliang/material-ui,cpojer/material-ui,enriqueojedalara/material-ui,und3fined/material-ui,CalebEverett/material-ui,bright-sparks/material-ui,lionkeng/material-ui,oliviertassinari/material-ui,Dolmio/material-ui,gobadiah/material-ui,gitmithy/material-ui,EllieAdam/material-ui,gaowenbin/material-ui,adamlee/material-ui,shadowhunter2/material-ui,WolfspiritM/material-ui,suvjunmd/material-ui,janmarsicek/material-ui,insionng/material-ui,jarno-steeman/material-ui,AndriusBil/material-ui,ilovezy/material-ui,staticinstance/material-ui,freeslugs/material-ui,bjfletcher/material-ui,cgestes/material-ui,xiaoking/material-ui,kasra-co/material-ui,Lottid/material-ui,nathanmarks/material-ui,cjhveal/material-ui,rodolfo2488/material-ui,myfintech/material-ui,Zeboch/material-ui,gsls1817/material-ui,dsslimshaddy/material-ui,yinickzhou/material-ui,ziad-saab/material-ui,developer-prosenjit/material-ui,mogii/material-ui,developer-prosenjit/material-ui,2390183798/material-ui,yh453926638/material-ui,mbrookes/material-ui,zuren/material-ui,skyflux/material-ui,jkruder/material-ui,glabcn/material-ui,arkxu/material-ui,drojas/material-ui,Josh-a-e/material-ui,yinickzhou/material-ui,suvjunmd/material-ui,conundrumer/material-ui,safareli/material-ui,Saworieza/material-ui,WolfspiritM/material-ui,hellokitty111/material-ui,buttercloud/material-ui,janmarsicek/material-ui,MrLeebo/material-ui,rscnt/material-ui,mui-org/material-ui,tyfoo/material-ui,bright-sparks/material-ui,callemall/material-ui,felipethome/material-ui,dsslimshaddy/material-ui,mjhasbach/material-ui,ludiculous/material-ui,hai-cea/material-ui,lightning18/material-ui,garth/material-ui,nik4152/material-ui,agnivade/material-ui,tingi/material-ui,loaf/material-ui,AndriusBil/material-ui,Kagami/material-ui,juhaelee/material-ui-io,ahlee2326/material-ui,xmityaz/material-ui,hybrisCole/material-ui,zuren/material-ui,verdan/material-ui,marwein/material-ui,JsonChiu/material-ui,shaurya947/material-ui,maoziliang/material-ui,rscnt/material-ui,andrejunges/material-ui,ngbrown/material-ui,JohnnyRockenstein/material-ui,NogsMPLS/material-ui,dsslimshaddy/material-ui,bdsabian/material-ui-old,domagojk/material-ui,Kagami/material-ui,izziaraffaele/material-ui,kybarg/material-ui,ziad-saab/material-ui,marwein/material-ui,bokzor/material-ui,ilovezy/material-ui,cloudseven/material-ui,ahlee2326/material-ui,haf/material-ui,manchesergit/material-ui,lunohq/material-ui,callemall/material-ui,janmarsicek/material-ui,JonatanGarciaClavo/material-ui,barakmitz/material-ui,gsklee/material-ui,Kagami/material-ui,cherniavskii/material-ui,ghondar/material-ui,domagojk/material-ui,insionng/material-ui,Syncano/material-ui,milworm/material-ui,ilear/material-ui,tomrosier/material-ui,dsslimshaddy/material-ui,wunderlink/material-ui,chrxn/material-ui,Jandersolutions/material-ui,janmarsicek/material-ui,ButuzGOL/material-ui,Josh-a-e/material-ui,JAStanton/material-ui,oliverfencott/material-ui,ddebowczyk/material-ui,keokilee/material-ui,mulesoft-labs/material-ui,oToUC/material-ui,zenlambda/material-ui,ntgn81/material-ui,RickyDan/material-ui,marnusw/material-ui,jkruder/material-ui
--- +++ @@ -1,5 +1,5 @@ var React = require('react'); -var BeforeAfterWrapper = require('./before-after-wrapper.jsx'); +var BeforeAfterWrapper = require('./before-after-wrapper'); var ClearFix = React.createClass({
c2f69a0dc21f86a058f0b4e428969f2f8194cdd5
js/BarCode.jsx
js/BarCode.jsx
var React = require('react'), ioBarcode = require("io-barcode"); module.exports = React.createClass({ propTypes: { code: React.PropTypes.string.isRequired }, componentDidMount() { var placeholder = React.findDOMNode(this.refs.placeholder); try { var canvas = ioBarcode.CODE128B( this.props.code, { displayValue: true, height: 50, fontSize: 18 } ); placeholder.appendChild(canvas); } catch (e) { console.error(e); placeholder.innerText = "您輸入的字無法編成條碼"; } }, render() { return ( <div ref="placeholder" /> ) } });
var React = require('react'), ioBarcode = require("io-barcode"); module.exports = React.createClass({ propTypes: { code: React.PropTypes.string.isRequired }, componentDidMount() { var img = React.findDOMNode(this.refs.img); try { var canvas = ioBarcode.CODE128B( this.props.code, { displayValue: true, height: 50, fontSize: 18 } ); img.src = canvas.toDataURL(); } catch (e) { console.error(e); img.alt = "您輸入的字無法編成條碼"; } }, render() { // Canvases are not printable, but images are. // return ( <img ref="img" /> ) } });
Use img instead of canvas to make barcodes printable
Use img instead of canvas to make barcodes printable
JSX
mit
MrOrz/cdc-barcode,MrOrz/cdc-barcode
--- +++ @@ -6,7 +6,7 @@ code: React.PropTypes.string.isRequired }, componentDidMount() { - var placeholder = React.findDOMNode(this.refs.placeholder); + var img = React.findDOMNode(this.refs.img); try { var canvas = ioBarcode.CODE128B( this.props.code, @@ -16,16 +16,18 @@ fontSize: 18 } ); - placeholder.appendChild(canvas); + img.src = canvas.toDataURL(); } catch (e) { console.error(e); - placeholder.innerText = "您輸入的字無法編成條碼"; + img.alt = "您輸入的字無法編成條碼"; } }, render() { + // Canvases are not printable, but images are. + // return ( - <div ref="placeholder" /> + <img ref="img" /> ) } });
492884a4248830757eccb8779cdb75cc72dbb22b
examples/components/computed-well.jsx
examples/components/computed-well.jsx
var React = require('react'); var Radium = require('../../modules/index'); var { StyleResolverMixin } = Radium; var ComputedWell = React.createClass({ mixins: [ StyleResolverMixin ], getInitialState: function () { return { dynamicBg: null } }, getStyles: function () { return { padding: "1em", borderRadius: 5, background: "#000" }; }, buildComputedStyles: function (baseStyles) { var computedStyles = {}; computedStyles.backgroundColor = this.state.dynamicBg; return computedStyles; }, handleSubmit: function (ev) { ev.preventDefault(); this.setState({ dynamicBg: this.refs.input.getDOMNode().value }); }, render: function () { var styles = this.buildStyles(this.getStyles(), this.buildComputedStyles); return ( <form style={styles} onSubmit={this.handleSubmit}> <input ref='input' type='text' placeholder="black" /> <button>Change Background Color</button> </form> ); } }); module.exports = ComputedWell;
var React = require('react'); var Radium = require('../../modules/index'); var { StyleResolverMixin } = Radium; var ComputedWell = React.createClass({ mixins: [ StyleResolverMixin ], getInitialState: function () { return { dynamicBg: '#000' } }, getStyles: function () { return { padding: "1em", borderRadius: 5, background: this.state.dynamicBg }; }, handleSubmit: function (ev) { ev.preventDefault(); this.setState({ dynamicBg: this.refs.input.getDOMNode().value }); }, render: function () { var styles = this.buildStyles(this.getStyles()); return ( <form style={styles} onSubmit={this.handleSubmit}> <input ref='input' type='text' placeholder="black" /> <button>Change Background Color</button> </form> ); } }); module.exports = ComputedWell;
Fix broken computed well example
Fix broken computed well example
JSX
mit
KenPowers/radium,richardfickling/radium,KenPowers/radium,FormidableLabs/radium,WillJHaggard/radium,rolandpoulter/radium,basarat/radium,kof/radium,yetone/radium,bobbyrenwick/radium,namuol/radium-insert-rule,clessg/radium,lexical-labs/radium,nfl/radium,haridusenadeera/radium,bencao/radium,azazdeaz/radium,MicheleBertoli/radium,yetone/radium,clessg/radium,Cottin/radium,andyhite/radium,AnSavvides/radium,bencao/radium,azazdeaz/radium,rolandpoulter/radium,jurgob/radium,haridusenadeera/radium,moret/radium,almost/radium,Cottin/radium,andyhite/radium,dabbott/radium
--- +++ @@ -7,7 +7,7 @@ getInitialState: function () { return { - dynamicBg: null + dynamicBg: '#000' } }, @@ -15,16 +15,8 @@ return { padding: "1em", borderRadius: 5, - background: "#000" + background: this.state.dynamicBg }; - }, - - buildComputedStyles: function (baseStyles) { - var computedStyles = {}; - - computedStyles.backgroundColor = this.state.dynamicBg; - - return computedStyles; }, handleSubmit: function (ev) { @@ -36,7 +28,7 @@ }, render: function () { - var styles = this.buildStyles(this.getStyles(), this.buildComputedStyles); + var styles = this.buildStyles(this.getStyles()); return ( <form style={styles} onSubmit={this.handleSubmit}>
5d0bcf231a22c936f497daf1734851f403614037
src/jsx/components/Intro.jsx
src/jsx/components/Intro.jsx
import React, { Component } from 'react'; export default class Intro extends Component { render() { return ( <section className="Intro Grid"> <div className="Grid-fullColumn"> <h1 className="Intro-title">Hi! I'm David Minnerly</h1> <p className="Intro-text">I'm a programmer, 3D modeler, and I also make websites on occasion. I frequently post about what I'm doing on <a target="_blank" href="https://twitter.com/voxeldavid" className="Link--twitter">Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a target="_blank" href="https://github.com/vocksel" className="Link--github">Github <i className="fa fa-github" /></a>.</p> </div> </section> ); } }
import React, { Component } from 'react'; export default class Intro extends Component { render() { return ( <section className="Intro Grid"> <div className="Grid-fullColumn"> <h1 className="Intro-title">Hi! I'm David Minnerly</h1> <p className="Intro-text">I'm a programmer, 3D modeler, and I also make websites on occasion. I frequently post about what I'm doing on <a href="https://twitter.com/voxeldavid" className="Link--twitter">Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a href="https://github.com/vocksel" className="Link--github">Github <i className="fa fa-github" /></a>.</p> </div> </section> ); } }
Remove _blank target from Twitter and GitHub links
Remove _blank target from Twitter and GitHub links These were added under the assumption that it would be expected behavior for these two links to open in a new tab. Going against default behavior isn't really a good thing, so we've opted to just make them behave normally.
JSX
mit
VoxelDavid/voxeldavid-website,vocksel/my-website,vocksel/my-website,VoxelDavid/voxeldavid-website
--- +++ @@ -7,7 +7,7 @@ <div className="Grid-fullColumn"> <h1 className="Intro-title">Hi! I'm David Minnerly</h1> - <p className="Intro-text">I'm a programmer, 3D modeler, and I also make websites on occasion. I frequently post about what I'm doing on <a target="_blank" href="https://twitter.com/voxeldavid" className="Link--twitter">Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a target="_blank" href="https://github.com/vocksel" className="Link--github">Github <i className="fa fa-github" /></a>.</p> + <p className="Intro-text">I'm a programmer, 3D modeler, and I also make websites on occasion. I frequently post about what I'm doing on <a href="https://twitter.com/voxeldavid" className="Link--twitter">Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a href="https://github.com/vocksel" className="Link--github">Github <i className="fa fa-github" /></a>.</p> </div> </section> );
97334c9474dcd1ea01ff0365249f78d72ed84f45
src/components/TabGroupListItem.jsx
src/components/TabGroupListItem.jsx
import React, { PropTypes } from 'react'; const TabGroupListItem = ({ name }) => <div>{ name }</div>; TabGroupListItem.propTypes = { name: PropTypes.string, }; export default TabGroupListItem;
import React, { PropTypes } from 'react'; const TabGroupListItem = ({ name }) => <div> { name } <button>Open</button> <button>Remove</button> </div>; TabGroupListItem.propTypes = { name: PropTypes.string, }; export default TabGroupListItem;
Add open and remove buttons
Add open and remove buttons
JSX
mit
hharnisc/tabbie,hharnisc/tabbie
--- +++ @@ -1,7 +1,11 @@ import React, { PropTypes } from 'react'; const TabGroupListItem = ({ name }) => - <div>{ name }</div>; + <div> + { name } + <button>Open</button> + <button>Remove</button> + </div>; TabGroupListItem.propTypes = { name: PropTypes.string,
ab06f67978e0d5be3db278689256eaba1462256c
components/ExamplePluginComponent.jsx
components/ExamplePluginComponent.jsx
import React from "react/addons"; import ExamplePluginStore from "../stores/ExamplePluginStore"; import ExamplePluginEvents from "../events/ExamplePluginEvents"; var {PluginActions, PluginHelper} = global.MarathonUIPluginAPI; var ExamplePluginComponent = React.createClass({ getInitialState: function () { return { appsCount: 0 }; }, componentDidMount: function () { ExamplePluginStore.on(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, componentWillUnmount: function () { ExamplePluginStore.removeListener(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, onAppsChange: function () { this.setState({ appsCount: ExamplePluginStore.apps.length }); }, handleClick: function (e) { e.stopPropagation(); PluginHelper.callAction(PluginActions.DIALOG_ALERT, { title: "Hello world", message: "Hi, Plugin speaking here." }); }, render: function () { return ( <div> <div className="flex-row"> <h3 className="small-caps">Example Plugin</h3> </div> <ul className="list-group filters"> <li>{this.state.appsCount} applications in total</li> <li><hr /></li> <li className="clickable" onClick={this.handleClick}> <a>Click me</a> </li> </ul> </div> ); } }); export default ExamplePluginComponent;
import React from "react/addons"; import ExamplePluginStore from "../stores/ExamplePluginStore"; import ExamplePluginEvents from "../events/ExamplePluginEvents"; var {PluginActions, PluginHelper} = global.MarathonUIPluginAPI; var ExamplePluginComponent = React.createClass({ getInitialState: function () { return { appsCount: ExamplePluginStore.apps.length }; }, componentDidMount: function () { ExamplePluginStore.on(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, componentWillUnmount: function () { ExamplePluginStore.removeListener(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, onAppsChange: function () { this.setState({ appsCount: ExamplePluginStore.apps.length }); }, handleClick: function (e) { e.stopPropagation(); PluginHelper.callAction(PluginActions.DIALOG_ALERT, { title: "Hello world", message: "Hi, Plugin speaking here." }); }, render: function () { return ( <div> <div className="flex-row"> <h3 className="small-caps">Example Plugin</h3> </div> <ul className="list-group filters"> <li>{this.state.appsCount} applications in total</li> <li><hr /></li> <li className="clickable" onClick={this.handleClick}> <a>Click me</a> </li> </ul> </div> ); } }); export default ExamplePluginComponent;
Fix small bug in examplePlugin :D
Fix small bug in examplePlugin :D
JSX
apache-2.0
mesosphere/marathon-ui-example-plugin
--- +++ @@ -10,7 +10,7 @@ getInitialState: function () { return { - appsCount: 0 + appsCount: ExamplePluginStore.apps.length }; },
4c79a52a6decfb1b3fa35d36992ef0caa0aec7e1
src/containers/ComicListContainer.jsx
src/containers/ComicListContainer.jsx
import React, { PropTypes } from 'react' import { connect } from 'react-redux' import ComicList from '../components/ComicList' import * as Actions from '../actions' class ComicListContainer extends React.Component { static propTypes = { filter: PropTypes.object.isRequired, comics: PropTypes.array.isRequired } componentDidMount() { this.props.dispatch(Actions.fetchComicsIfNeeded()) } filterComics = () => { let { filter, comics } = this.props switch (filter.category) { case 'SHOW_FAVORITE': comics = comics.filter(comic => comic.favorite) break } let reg try { reg = new RegExp(filter.query || /.+/, 'i') } catch (err) { return [] } return comics.filter(comic => reg.test(comic.title) ) } render() { return ( <ComicList comics={ this.filterComics() } /> ) } } const mapStateToProps = (state) => { return { filter: state.filter, comics: state.comic.comics } } export default connect( mapStateToProps )(ComicListContainer)
import React, { PropTypes } from 'react' import { connect } from 'react-redux' import ComicList from '../components/ComicList' import * as Actions from '../actions' class ComicListContainer extends React.Component { static propTypes = { filter: PropTypes.object.isRequired, comics: PropTypes.array.isRequired } componentDidMount() { this.props.dispatch(Actions.fetchComicsIfNeeded()) } filterComics = () => { let { filter, comics } = this.props switch (filter.category) { case 'SHOW_FAVORITE': comics = comics.filter(comic => comic.favorite) break } let reg try { reg = new RegExp(filter.query || '.+', 'i') } catch (err) { return [] } return comics.filter(comic => reg.test(comic.title) ) } render() { return ( <ComicList comics={ this.filterComics() } /> ) } } const mapStateToProps = (state) => { return { filter: state.filter, comics: state.comic.comics } } export default connect( mapStateToProps )(ComicListContainer)
Fix safair throw unsupport construct regex from another regex
Fix safair throw unsupport construct regex from another regex
JSX
mit
rickychien/comiz,rickychien/comiz
--- +++ @@ -27,7 +27,7 @@ let reg try { - reg = new RegExp(filter.query || /.+/, 'i') + reg = new RegExp(filter.query || '.+', 'i') } catch (err) { return [] }
db7862ab0ccf62339760700ceb94eaf5b6aa8931
src/book/heading.jsx
src/book/heading.jsx
var React = require( 'react' ); export default React.createClass({ render() { return ( <h1>Foo</h1> ) } });
var React = require( 'react' ); export default class extends React.Component { render() { return ( <h1>Foo</h1> ) } }
Use ES6 for React class declaration
Use ES6 for React class declaration
JSX
mit
whichdigital/webpack-react-workflow,whichdigital/webpack-react-workflow
--- +++ @@ -1,9 +1,9 @@ var React = require( 'react' ); -export default React.createClass({ +export default class extends React.Component { render() { return ( <h1>Foo</h1> ) } -}); +}
a55706275bcfc1484003183710bbd113ac333335
src/containers/Posts.jsx
src/containers/Posts.jsx
import React from 'react' import { asyncConnect } from 'redux-connect' import classNames from 'classnames' import { fetchPosts } from '../actions/PostsActions' import { Pagination, Summary } from '../components' export const Posts = ({ data, entities, isFetching, itemsPerPage, links, meta: { totalItems }, page, }) => { return ( <div> <div className="posts"> { (isFetching || ! data[page] ? <div className="spinner"> <div className="bounce1"></div> <div className="bounce2"></div> <div className="bounce3"></div> </div> : data[page]. map((item) => { return entities.posts[item] }). map((item, key) => { return ( <Summary data={ item } key={ key } /> ) })) } </div> <Pagination itemsPerPage={ itemsPerPage } links={ links } page={ page } totalItems={ totalItems } /> </div> ) } export default asyncConnect([{ promise: ({ store: { dispatch, getState } }) => { if (getState().posts.data[getState().posts.page]) { return Promise.resolve() } return dispatch(fetchPosts( getState().posts.page, getState().posts.itemsPerPage )) } }], (state) => ({ ...state.posts, entities: state.entities }))(Posts)
import React from 'react' import { asyncConnect } from 'redux-connect' import classNames from 'classnames' import { fetchPosts } from '../actions/PostsActions' import { Loading, NotFound, Pagination, Summary } from '../components' export const Posts = ({ data, entities, isFetching, itemsPerPage, links, meta: { totalItems }, page, }) => { return ( <div className="posts"> { (isFetching ? <Loading /> : (data[page] ? data[page]. map((item) => { return entities.posts[item] }). map((item, key) => { return ( <Summary data={ item } key={ key } /> ) }) : <NotFound />)) } <Pagination itemsPerPage={ itemsPerPage } links={ links } page={ page } totalItems={ totalItems } /> </div> ) } export default asyncConnect([{ promise: ({ store: { dispatch, getState } }) => { if (getState().posts.data[getState().posts.page]) { return Promise.resolve() } return dispatch(fetchPosts( getState().posts.page, getState().posts.itemsPerPage )) } }], (state) => ({ ...state.posts, entities: state.entities }))(Posts)
Split loading spinner to self component
Split loading spinner to self component
JSX
mit
nomkhonwaan/nomkhonwaan.github.io
--- +++ @@ -3,7 +3,7 @@ import classNames from 'classnames' import { fetchPosts } from '../actions/PostsActions' -import { Pagination, Summary } from '../components' +import { Loading, NotFound, Pagination, Summary } from '../components' export const Posts = ({ data, @@ -15,26 +15,22 @@ page, }) => { return ( - <div> - <div className="posts"> - { - (isFetching || ! data[page] - ? <div className="spinner"> - <div className="bounce1"></div> - <div className="bounce2"></div> - <div className="bounce3"></div> - </div> - : data[page]. - map((item) => { - return entities.posts[item] - }). - map((item, key) => { - return ( - <Summary data={ item } key={ key } /> - ) - })) - } - </div> + <div className="posts"> + { + (isFetching + ? <Loading /> + : (data[page] + ? data[page]. + map((item) => { + return entities.posts[item] + }). + map((item, key) => { + return ( + <Summary data={ item } key={ key } /> + ) + }) + : <NotFound />)) + } <Pagination itemsPerPage={ itemsPerPage }
e3a2434f8dd10b114aa8abd1ee8efbbb8db753a8
src/App.jsx
src/App.jsx
import React from 'react'; // import PropTypes from 'prop-types'; import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; import { ThemeProvider } from '../lib'; import Home from './Home'; import Installation from './Installation'; import Components from './Components'; import FourOhFour from './FourOhFour'; // Componentry configuration defaults can be updated using the ThemeProvider // component and passing a theme configuration object // TODO: Docs const theme = { visibilityTransitionLength: 350, svgDefinitionsFilePath: '/assets/icons.svg' }; export default function App() { return ( <Router> <ThemeProvider theme={theme}> <div className="container"> <Switch> <Route path="/" exact component={Home} /> <Route path="/getting-started" component={Installation} /> <Route path="/components/:component?" component={Components} /> <Route component={FourOhFour} /> </Switch> </div> </ThemeProvider> </Router> ); }
import React from 'react'; import { BrowserRouter, Switch, Route } from 'react-router-dom'; import { ThemeProvider } from '../lib'; import Home from './Home'; import Installation from './Installation'; import Components from './Components'; import FourOhFour from './FourOhFour'; const urlBase = process.env.NODE_ENV === true ? '/componentry/' : '/'; // Componentry configuration defaults can be updated using the ThemeProvider // component and passing a theme configuration object // TODO: Docs const theme = { visibilityTransitionLength: 350, svgDefinitionsFilePath: `${urlBase}assets/icons.svg` }; export default function App() { return ( <BrowserRouter basename={urlBase}> <ThemeProvider theme={theme}> <div className="container"> <Switch> <Route path="/" exact component={Home} /> <Route path="/getting-started" component={Installation} /> <Route path="/components/:component?" component={Components} /> <Route component={FourOhFour} /> </Switch> </div> </ThemeProvider> </BrowserRouter> ); }
Handle gh-pages serving from sub-directory
Handle gh-pages serving from sub-directory
JSX
mit
crystal-ball/componentry,crystal-ball/componentry,crystal-ball/componentry
--- +++ @@ -1,6 +1,5 @@ import React from 'react'; -// import PropTypes from 'prop-types'; -import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; +import { BrowserRouter, Switch, Route } from 'react-router-dom'; import { ThemeProvider } from '../lib'; import Home from './Home'; @@ -8,17 +7,19 @@ import Components from './Components'; import FourOhFour from './FourOhFour'; +const urlBase = process.env.NODE_ENV === true ? '/componentry/' : '/'; + // Componentry configuration defaults can be updated using the ThemeProvider // component and passing a theme configuration object // TODO: Docs const theme = { visibilityTransitionLength: 350, - svgDefinitionsFilePath: '/assets/icons.svg' + svgDefinitionsFilePath: `${urlBase}assets/icons.svg` }; export default function App() { return ( - <Router> + <BrowserRouter basename={urlBase}> <ThemeProvider theme={theme}> <div className="container"> <Switch> @@ -29,6 +30,6 @@ </Switch> </div> </ThemeProvider> - </Router> + </BrowserRouter> ); }
b0db28d819c5b26f337aef7cb9504360216306d5
src/Footer.jsx
src/Footer.jsx
import React from 'react'; export default class Footer extends React.Component { render() { return ( <footer className="android-footer mdl-mega-footer"> <div className="mdl-mega-footer--top-section"> <div className="mdl-mega-footer--left-section"> </div> <div className="mdl-mega-footer--right-section"> <a className="mdl-typography--font-light" href="#top"> Back to Top <i className="material-icons">expand_less</i> </a> </div> </div> <div className="mdl-mega-footer--middle-section"> <p className="mdl-typography--font-light"></p> </div> <div className="mdl-mega-footer--bottom-section"> </div> </footer> ) } }
import React from 'react'; export default class Footer extends React.Component { render() { return ( <footer className="android-footer mdl-mega-footer"> <div className="mdl-mega-footer--top-section"> <div className="mdl-mega-footer--left-section"> </div> <div className="mdl-mega-footer--right-section"> <a className="mdl-typography--font-light" href="#top"> Back to Top <i className="material-icons">expand_less</i> </a> </div> </div> <div className="mdl-mega-footer--middle-section"> <p className="mdl-typography--font-light"> <a href="https://github.com/y-takey/qiitaros">VIEW SOURCE</a> </p> </div> <div className="mdl-mega-footer--bottom-section"> </div> </footer> ) } }
Add link to github on footer
Add link to github on footer
JSX
mit
y-takey/qiitaros,y-takey/qiitaros,y-takey/qiitaros
--- +++ @@ -16,7 +16,9 @@ </div> <div className="mdl-mega-footer--middle-section"> - <p className="mdl-typography--font-light"></p> + <p className="mdl-typography--font-light"> + <a href="https://github.com/y-takey/qiitaros">VIEW SOURCE</a> + </p> </div> <div className="mdl-mega-footer--bottom-section">
4d8db170292c436ed692330cdd1610282c24bde9
templates/javascript.jsx
templates/javascript.jsx
import React, { PropTypes } from "react" /* const ThisClass = ( props ) => ( <ThisClass key={ props.foo } /> ) // or: */ export default class extends React.Component { constructor(props) { super(props) //this.bindInstanceMethods( "methodName1", "methodName2" ) //this.state = {} } bindInstanceMethods( ...methods ) { methods.forEach( ( method ) => this[ method ] = this[ method ].bind( this ) ) } /* // https://facebook.github.io/react/docs/component-specs.html componentWillMount() { } componentDidMount() { } componentWillReceiveProps( nextProps ) { } shouldComponentUpdate( nextProps, nextState ) { return false } componentWillUpdate( nextProps, nextState ) { } componentDidUpdate( prevProps, prevState ) { } componentWillUnmount() { } */ // Consider hitting m-r in Vim to set bookmark render() { return ( <div> </div> ) } } /* ThisClass.propTypes = { initialValue: PropTypes.number, type: PropTypes.oneOf( ['enum1', 'enum2'] ) } */ // ThisClass.defaultProps = { initialValue: 0 }
import React, { PropTypes } from 'react' /* const ThisClass = ( props ) => ( <ThisClass key={ props.foo } /> ) // or: */ export default class ThisClass extends React.Component { constructor(props) { super(props) //this.bindInstanceMethods( 'methodName1', 'methodName2' ) //this.state = {} } bindInstanceMethods( ...methods ) { methods.forEach( ( method ) => this[ method ] = this[ method ].bind( this ) ) } /* // https://facebook.github.io/react/docs/component-specs.html componentWillMount() { } componentDidMount() { } componentWillReceiveProps( nextProps ) { } shouldComponentUpdate( nextProps, nextState ) { return false } componentWillUpdate( nextProps, nextState ) { } componentDidUpdate( prevProps, prevState ) { } componentWillUnmount() { } */ // Consider hitting m-r in Vim to set bookmark render() { return ( <div> </div> ) } } /* ThisClass.propTypes = { initialValue: PropTypes.number, type: PropTypes.oneOf( ['enum1', 'enum2'] ) } */ // ThisClass.defaultProps = { initialValue: 0 }
Replace double with single quotes in React template
Replace double with single quotes in React template
JSX
unlicense
chris-kobrzak/js-dev-vim-setup
--- +++ @@ -1,4 +1,4 @@ -import React, { PropTypes } from "react" +import React, { PropTypes } from 'react' /* const ThisClass = ( props ) => ( @@ -7,11 +7,11 @@ // or: */ -export default class extends React.Component { +export default class ThisClass extends React.Component { constructor(props) { super(props) - //this.bindInstanceMethods( "methodName1", "methodName2" ) + //this.bindInstanceMethods( 'methodName1', 'methodName2' ) //this.state = {} }
ccba6373b396e80f18b1ab171ca758de3eeb74c2
src/app/containers/ScriptViewContainer.jsx
src/app/containers/ScriptViewContainer.jsx
import { ScriptView } from '../components/'; import { connect } from 'react-redux'; import { scripts } from '../actions/' const mapStateToProps = (state) => { let error = state.activeScript.error; console.log("dispatching props"); console.log(state); return { src: state.activeScript.src || 'No active script src', content: state.activeScript.content || 'No active script code', status: state.activeScript.status || 'No active script', name: state.activeScript.name || 'No name', error } } const mapDispatchToProps = (dispatch) => { console.log(scripts); return { onRunClick: (src) => { dispatch(scripts.runScript(src)) }, onRefreshClick: (src) => { dispatch(scripts.refreshScript(src)) } } } const VisibleScriptView = connect( mapStateToProps, mapDispatchToProps )(ScriptView); export default VisibleScriptView;
import { ScriptView } from '../components/'; import { connect } from 'react-redux'; import { scripts } from '../actions/' const mapStateToProps = (state) => { let error = state.activeScript.error; return { src: state.activeScript.src || 'No active script src', content: state.activeScript.content || 'No active script code', status: state.activeScript.status || 'No active script', name: state.activeScript.name || 'No name', code: state.activeScript.code || '', logs: state.activeScript.logs || [], error } } const mapDispatchToProps = (dispatch) => { return { onRunClick: (src) => { dispatch(scripts.runScript(src)) }, onRefreshClick: (src) => { dispatch(scripts.refreshScript(src)) }, onScriptLog: (src) => scripts.log(dispatch, src), onRemoveScript: (src) => { dispatch(scripts.removeScript(src)); } } } const VisibleScriptView = connect( mapStateToProps, mapDispatchToProps )(ScriptView); export default VisibleScriptView;
Add additional props to scriptview
Add additional props to scriptview
JSX
mit
simonlovesyou/AutoRobot
--- +++ @@ -5,25 +5,28 @@ const mapStateToProps = (state) => { let error = state.activeScript.error; - console.log("dispatching props"); - console.log(state); return { src: state.activeScript.src || 'No active script src', content: state.activeScript.content || 'No active script code', status: state.activeScript.status || 'No active script', name: state.activeScript.name || 'No name', + code: state.activeScript.code || '', + logs: state.activeScript.logs || [], error } } const mapDispatchToProps = (dispatch) => { - console.log(scripts); return { onRunClick: (src) => { dispatch(scripts.runScript(src)) }, onRefreshClick: (src) => { dispatch(scripts.refreshScript(src)) + }, + onScriptLog: (src) => scripts.log(dispatch, src), + onRemoveScript: (src) => { + dispatch(scripts.removeScript(src)); } } }
2fc02c06a044a4ba649ca020f0a43ab950ab40fa
woodstock/src/actions/UnitActions.jsx
woodstock/src/actions/UnitActions.jsx
import * as types from '../constants/ActionTypes'; import FetchUnits from '../http/FetchUnits'; export const fetchUnitsSuccess = (units) => { return { type: types.FETCH_UNITS_SUCCESS, units } }; export const fetchUnits = () => { return (dispatch) => { return FetchUnits.fetchUnits().then(units => { dispatch(fetchUnitsSuccess(units)); }).catch(error => console.log(error)); } };
import * as types from '../constants/ActionTypes'; import FetchUnits from '../http/FetchUnits'; export const fetchUnitsSuccess = (units) => { return { type: types.FETCH_UNITS_SUCCESS, units } }; export const fetchUnits = () => { return (dispatch) => { return FetchUnits.fetchUnits() .then(units => dispatch(fetchUnitsSuccess(units))) .catch(error => console.log(error)); } };
Reduce action method style size
Reduce action method style size
JSX
apache-2.0
solairerove/woodstock,solairerove/woodstock,solairerove/woodstock
--- +++ @@ -10,8 +10,8 @@ export const fetchUnits = () => { return (dispatch) => { - return FetchUnits.fetchUnits().then(units => { - dispatch(fetchUnitsSuccess(units)); - }).catch(error => console.log(error)); + return FetchUnits.fetchUnits() + .then(units => dispatch(fetchUnitsSuccess(units))) + .catch(error => console.log(error)); } };
1040447ede5ffb8156284cc3f4da016ff2c8fd9e
client/src/components/QuestButton.jsx
client/src/components/QuestButton.jsx
import React from 'react'; class QuestButton extends React.Component { constructor(props) { super(props); } render() { return ( <button type="button" onClick={() => this.props.questOnClick('quest_page')}>Quest!</button> ); } } export default QuestButton;
import React from 'react'; class QuestButton extends React.Component { constructor(props) { super(props); } render() { return ( <button className='btn btn-sm btn-danger' type="button" onClick={() => this.props.questOnClick('quest_page')}>Quest!</button> ); } } export default QuestButton;
Edit button to add className btn btn-sm btn-danger
Edit button to add className btn btn-sm btn-danger
JSX
mit
Sibilant-Siblings/sibilant-siblings,Sibilant-Siblings/sibilant-siblings
--- +++ @@ -6,7 +6,7 @@ } render() { return ( - <button type="button" onClick={() => this.props.questOnClick('quest_page')}>Quest!</button> + <button className='btn btn-sm btn-danger' type="button" onClick={() => this.props.questOnClick('quest_page')}>Quest!</button> ); } }
a92264e0eef195b1431ec7fb2a08262a086ed7cb
js/experiments-widget.jsx
js/experiments-widget.jsx
/** * @jsx React.DOM */ var React = require('react'); var WidgetContainer = require('./widget-container.jsx'); var Experiments = React.createClass({ getInitialState: function() { return { experiments: [], idx: null, }; }, displayRandomExperiment: function() { var nextIdx = Math.floor(Math.random() * this.state.experiments.length); this.setState({idx: nextIdx}); }, componentDidMount: function() { $.get('http://localhost:3000/recent_experiments', function(result) { this.setState({experiments: result}); this.displayRandomExperiment(); this.interval = setInterval(this.displayRandomExperiment, 10000); }.bind(this) ); }, render: function() { if (this.state.experiments.length == 0) { return <div> <WidgetContainer> <LoadingMessage /> </WidgetContainer> </div>; } var exp = this.state.experiments[this.state.idx]; return (<div> <WidgetContainer> {exp} </WidgetContainer> </div> ); } }); module.exports = Experiments;
/** * @jsx React.DOM */ var React = require('react'); var WidgetContainer = require('./widget-container.jsx'); var Experiments = React.createClass({ getInitialState: function() { return { experiments: [], idx: null, }; }, displayRandomExperiment: function() { var nextIdx = Math.floor(Math.random() * this.state.experiments.length); this.setState({idx: nextIdx}); }, componentDidMount: function() { $.get('http://localhost:3000/recent_experiments', function(result) { this.setState({experiments: result}); this.displayRandomExperiment(); this.interval = setInterval(this.displayRandomExperiment, 10000); }.bind(this) ); }, render: function() { if (this.state.experiments.length == 0) { return <WidgetContainer> <LoadingMessage /> </WidgetContainer>; } var exp = this.state.experiments[this.state.idx]; return <WidgetContainer> {exp} </WidgetContainer>; } }); module.exports = Experiments;
Remove surrounding div of experiments widget.
Remove surrounding div of experiments widget.
JSX
mit
cjfuller/KAshboard
--- +++ @@ -31,20 +31,15 @@ render: function() { if (this.state.experiments.length == 0) { - return <div> - <WidgetContainer> - <LoadingMessage /> - </WidgetContainer> - </div>; + return <WidgetContainer> + <LoadingMessage /> + </WidgetContainer>; } var exp = this.state.experiments[this.state.idx]; - return (<div> - <WidgetContainer> - {exp} - </WidgetContainer> - </div> - ); + return <WidgetContainer> + {exp} + </WidgetContainer>; } });
496b938e2007870299b60c75283423f5c7f1da3a
src/ReactComponents/ThreeRenderer.jsx
src/ReactComponents/ThreeRenderer.jsx
import React from 'react'; import ReactDOM from 'react-dom'; import THREE from 'three'; /* A component that renders whatever camera and scene using a THREE.WebGLRenderer. */ class ThreeRenderer extends React.PureComponent { componentDidMount() { const canvas = ReactDOM.findDOMNode(this.refs["canvas"]); const renderer = new THREE.WebGLRenderer({ canvas: canvas, antialias: true, alpha: true }); this._renderer = renderer; this._draw(); } componentWillUmmount() { this._renderer = null; } componentDidUpdate() { const {width, height} = this.props; this._renderer.setViewport(0, 0, width, height); this._draw(); } _draw() { this._renderer.render(this.props.scene, this.props.camera); } render() { return ( <canvas ref="canvas" width={this.props.width} height={this.props.height} style={styles.canvas} /> ); } } const styles = { canvas: { width: "100%", height: "100%" } }; export default ThreeRenderer;
import React from 'react'; import ReactDOM from 'react-dom'; import THREE from 'three'; /* A component that renders whatever camera and scene using a THREE.WebGLRenderer. */ class ThreeRenderer extends React.PureComponent { componentDidMount() { const canvas = ReactDOM.findDOMNode(this.refs["canvas"]); const renderer = new THREE.WebGLRenderer({ canvas: canvas, antialias: true, alpha: true }); this._renderer = renderer; this._draw(); } componentWillUmmount() { this._renderer = null; } componentDidUpdate() { const {width, height} = this.props; this._renderer.setViewport(0, 0, width, height); this._draw(); } _draw() { this._renderer.render(this.props.scene, this.props.camera); } render() { return ( <canvas ref="canvas" width={this.props.width} height={this.props.height} style={styles.canvas} /> ); } renderToImage() { this._draw(); let img = new Image(); img.src = this._renderer.domElement.toDataURL("image/png"); return img; } } const styles = { canvas: { width: "100%", height: "100%" } }; export default ThreeRenderer;
Implement rendering 3D view to an img element
Implement rendering 3D view to an img element
JSX
mit
pafalium/gd-web-env,pafalium/gd-web-env
--- +++ @@ -41,6 +41,13 @@ /> ); } + + renderToImage() { + this._draw(); + let img = new Image(); + img.src = this._renderer.domElement.toDataURL("image/png"); + return img; + } } const styles = {
5ef4393b224ca4c6318a2a14343f2d969b329f41
src/TextArea.jsx
src/TextArea.jsx
import React from 'react' import PropTypes from 'prop-types' import classNames from 'classnames' import FormField from './FormField' class TextArea extends FormField { onFocus (e) { this.setState({ focus: true, touched: true }) // TODO still needed? if (document.documentField.dataset.browser === 'IE11') { // make text area behave like input in IE (input fires both // focus and input when focusing input elements, but not textareas) this.setValue(e.target.value) } } render () { const { disabled, name, placeholder } = this.props const state = this.state const classes = { 'field-container': true, cell: true, empty: !state.value, filled: !!state.value, dirty: state.dirty, focus: state.focus, invalid: !!state.error, touched: state.touched, valid: !state.error } return ( <div className={classNames(classes)}> <label className='placeholder'>{placeholder}</label> <textarea name={name} disabled={disabled} onFocus={this.onFocus} onBlur={this.onBlur} onChange={this.onChange} placeholder={placeholder} ref={(input) => (this.input = input)} value={state.value} /> <label className='icon' /> {state.error && <label className='error'>{state.error}</label>} </div> ) } } TextArea.propTypes = { disabled: PropTypes.bool, name: PropTypes.string, placeholder: PropTypes.string } export default TextArea
import React from 'react' import PropTypes from 'prop-types' import classNames from 'classnames' import FormField from './FormField' class TextArea extends FormField { onFocus (e) { this.setState({ focus: true, touched: true }) } render () { const { disabled, name, placeholder } = this.props const state = this.state const classes = { 'field-container': true, cell: true, empty: !state.value, filled: !!state.value, dirty: state.dirty, focus: state.focus, invalid: !!state.error, touched: state.touched, valid: !state.error } return ( <div className={classNames(classes)}> <label className='placeholder'>{placeholder}</label> <textarea name={name} disabled={disabled} onFocus={this.onFocus} onBlur={this.onBlur} onChange={this.onChange} placeholder={placeholder} ref={(input) => (this.input = input)} value={state.value} /> <label className='icon' /> {state.error && <label className='error'>{state.error}</label>} </div> ) } } TextArea.propTypes = { disabled: PropTypes.bool, name: PropTypes.string, placeholder: PropTypes.string } export default TextArea
Remove IE fix (should not be needed)
Remove IE fix (should not be needed)
JSX
mit
lohfu/comkit
--- +++ @@ -11,13 +11,6 @@ focus: true, touched: true }) - - // TODO still needed? - if (document.documentField.dataset.browser === 'IE11') { - // make text area behave like input in IE (input fires both - // focus and input when focusing input elements, but not textareas) - this.setValue(e.target.value) - } } render () {
2ac65382ec935dd5ebb2ed3cba36bef918f97376
src/components/SubmissionPanel.jsx
src/components/SubmissionPanel.jsx
import React from 'react'; export default class SubmissionPanel extends React.Component { submitCode() { this.props.onCodeSubmitted(); let problemId = $('.btn.active').attr('id'); let editor = ace.edit("editor"); let sourceCode = editor.getValue(); $.ajax({ type: "POST", data: sourceCode, processData: false, contentType: 'text/plain', url: `${this.props.serverUrl}/problems/${problemId}/submit`, crossDomain: true }).done(this.props.onResultReceived); } render() { return <div> <a href="#end-of-output" type="button" className="btn btn-success btn-lg pull-right" id="submit-code" onClick={this.submitCode.bind(this)}> <span className="glyphicon glyphicon-flash" aria-hidden={true}> </span> Submit</a> <span>Time Limit is <span className="text-success" id="problem-example-time-limit">{this.props.timeLimit}</span> seconds.</span><br /> <span>Memory Limit is <span className="text-success" id="problem-example-memory-limit">{this.props.memoryLimit}</span> kilobytes.</span> </div>; } }
import React from 'react'; export default class SubmissionPanel extends React.Component { submitCode() { this.props.onCodeSubmitted(); let editor = ace.edit("editor"); let sourceCode = editor.getValue(); $.ajax({ type: "POST", data: sourceCode, processData: false, contentType: 'text/plain', url: `${this.props.serverUrl}/problems/${this.props.problemId}/submit`, crossDomain: true }).done(this.props.onResultReceived); } render() { return <div> <a href="#end-of-output" type="button" className="btn btn-success btn-lg pull-right" id="submit-code" onClick={this.submitCode.bind(this)}> <span className="glyphicon glyphicon-flash" aria-hidden={true}> </span> Submit</a> <span>Time Limit is <span className="text-success" id="problem-example-time-limit">{this.props.timeLimit}</span> seconds.</span><br /> <span>Memory Limit is <span className="text-success" id="problem-example-memory-limit">{this.props.memoryLimit}</span> kilobytes.</span> </div>; } }
Use current problem id instead of jQuery
Use current problem id instead of jQuery
JSX
apache-2.0
spolnik/JAlgoArena-UI,spolnik/JAlgoArena-UI,spolnik/JAlgoArena-UI
--- +++ @@ -4,7 +4,6 @@ submitCode() { this.props.onCodeSubmitted(); - let problemId = $('.btn.active').attr('id'); let editor = ace.edit("editor"); let sourceCode = editor.getValue(); @@ -13,7 +12,7 @@ data: sourceCode, processData: false, contentType: 'text/plain', - url: `${this.props.serverUrl}/problems/${problemId}/submit`, + url: `${this.props.serverUrl}/problems/${this.props.problemId}/submit`, crossDomain: true }).done(this.props.onResultReceived); }
60ef06f016f5a9cc20eb8f46fe984437132cb739
src/js/source/view.jsx
src/js/source/view.jsx
import React from "react"; import SourceCode from "./code.jsx"; let SourceView = React.createClass({ scrollIntoView: function() { var element = null; if (element = document.getElementById('l' + (this.props.start - 5))) { element.scrollIntoView(); } }, componentDidMount: function() { this.scrollIntoView(); }, componentDidUpdate: function() { this.scrollIntoView(); }, render: function() { var file = this.props.file, start = this.props.start || 0, end = this.props.end || 0; return (<div> <h2>{file.name}</h2> <h3>{file.file.name}</h3> <SourceCode code={file.file.asText()} coverage={file.lines} start={start} end={end} /> </div>); } }); export default SourceView;
import React from "react"; import jQuery from "jquery"; import SourceCode from "./code.jsx"; let SourceView = React.createClass({ scrollIntoView: function() { var element = null; if (element = document.getElementById('l' + (this.props.start - 5))) { jQuery("html, body").animate({ scrollTop: jQuery(element).offset().top }, 500); } }, componentDidMount: function() { this.scrollIntoView(); }, componentDidUpdate: function() { this.scrollIntoView(); }, render: function() { var file = this.props.file, start = this.props.start || 0, end = this.props.end || 0; return (<div> <h2>{file.name}</h2> <h3>{file.file.name}</h3> <SourceCode code={file.file.asText()} coverage={file.lines} start={start} end={end} /> </div>); } }); export default SourceView;
Use jQuery for more consistent scrolling behaviour
Use jQuery for more consistent scrolling behaviour
JSX
agpl-3.0
Qafoo/QualityAnalyzer,Qafoo/QualityAnalyzer,Qafoo/QualityAnalyzer,Qafoo/QualityAnalyzer
--- +++ @@ -1,4 +1,5 @@ import React from "react"; +import jQuery from "jquery"; import SourceCode from "./code.jsx"; @@ -8,7 +9,9 @@ var element = null; if (element = document.getElementById('l' + (this.props.start - 5))) { - element.scrollIntoView(); + jQuery("html, body").animate({ + scrollTop: jQuery(element).offset().top + }, 500); } },
f1573f5b91a55d576fbf03e9e2643c7f3f1453da
src/react-autolink.jsx
src/react-autolink.jsx
import React from 'react'; import assign from 'object-assign'; function ReactAutolinkMixin() { let delimiter = /((?:https?:\/\/)?(?:(?:[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.)+[a-z\.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})(?::\d{1,5})*[a-z0-9.,_\/~#&=;%+?-]*)/ig; return { autolink(text, options = {}, bufs = []) { if (!text) return null; return text.split(delimiter).map(word => { let match = word.match(delimiter); if (match) { let url = match[0]; return React.createElement( 'a', assign({href: url.startsWith('http') ? url : `http://${url}`}, options), url ); } else { return word; } }); } }; } export default ReactAutolinkMixin();
import React from 'react'; import assign from 'object-assign'; function ReactAutolinkMixin() { const delimiter = /((?:https?:\/\/)?(?:(?:[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.)+[a-z\.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})(?::\d{1,5})*[a-z0-9.,_\/~#&=;%+?-]*)/ig; let strStartsWith = (str, prefix) => { return str.slice(0, prefix.length) === prefix; }; return { autolink(text, options = {}, bufs = []) { if (!text) return null; return text.split(delimiter).map(word => { let match = word.match(delimiter); if (match) { let url = match[0]; return React.createElement( 'a', assign({href: strStartsWith(url, 'http') ? url : `http://${url}`}, options), url ); } else { return word; } }); } }; } export default ReactAutolinkMixin();
Use const and self implement String.prototype.startsWith for compat
Use const and self implement String.prototype.startsWith for compat
JSX
mit
banyan/react-autolink,banyan/react-autolink,banyan/react-autolink
--- +++ @@ -2,7 +2,11 @@ import assign from 'object-assign'; function ReactAutolinkMixin() { - let delimiter = /((?:https?:\/\/)?(?:(?:[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.)+[a-z\.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})(?::\d{1,5})*[a-z0-9.,_\/~#&=;%+?-]*)/ig; + const delimiter = /((?:https?:\/\/)?(?:(?:[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.)+[a-z\.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})(?::\d{1,5})*[a-z0-9.,_\/~#&=;%+?-]*)/ig; + + let strStartsWith = (str, prefix) => { + return str.slice(0, prefix.length) === prefix; + }; return { autolink(text, options = {}, bufs = []) { @@ -14,7 +18,7 @@ let url = match[0]; return React.createElement( 'a', - assign({href: url.startsWith('http') ? url : `http://${url}`}, options), + assign({href: strStartsWith(url, 'http') ? url : `http://${url}`}, options), url ); } else {
73262bcfbc0049b90cb6d638768e5299db42234c
client/app/bundles/HelloWorld/components/lesson_planner/category_labels/category_label.jsx
client/app/bundles/HelloWorld/components/lesson_planner/category_labels/category_label.jsx
'use strict' import React from 'react' import {Link} from 'react-router' export default React.createClass({ propTypes: { data: React.PropTypes.object.isRequired, extraClassName: React.PropTypes.string, isLink: React.PropTypes.bool }, generateClassName: function () { return `category-label img-rounded ${this.props.extraClassName}` }, getLink: function () { return this.props.nonAuthenticated ? `/activities/packs/category/${this.props.data.name.toLowerCase()}` : `/teachers/classrooms/activity_planner/featured-activity-packs/category/${this.props.data.name.toLowerCase()}` }, render: function () { const label = <div className={this.generateClassName()}>{this.props.data.name.toUpperCase()}</div> if (this.props.isLink) { return ( <Link href={this.getLink()}>{label}</Link> ) } else { return label } } });
'use strict' import React from 'react' import {Link} from 'react-router' export default React.createClass({ propTypes: { data: React.PropTypes.object.isRequired, extraClassName: React.PropTypes.string, isLink: React.PropTypes.bool }, generateClassName: function () { return `category-label img-rounded ${this.props.extraClassName}` }, getLink: function () { return this.props.nonAuthenticated ? `/activities/packs/category/${this.props.data.name.toLowerCase()}` : `/teachers/classrooms/activity_planner/featured-activity-packs/category/${this.props.data.name.toLowerCase()}` }, render: function () { const label = <div className={this.generateClassName()}>{this.props.data.name.toUpperCase()}</div> if (this.props.isLink) { return ( <Link to={this.getLink()}>{label}</Link> ) } else { return label } } });
Fix route on activity pack hearder
Fix route on activity pack hearder
JSX
agpl-3.0
empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core
--- +++ @@ -25,7 +25,7 @@ const label = <div className={this.generateClassName()}>{this.props.data.name.toUpperCase()}</div> if (this.props.isLink) { return ( - <Link href={this.getLink()}>{label}</Link> + <Link to={this.getLink()}>{label}</Link> ) } else { return label
ae56203cc51e3668ba10a1b7c50eb9fbd870a90b
src/components/side-panel/SidePanel.jsx
src/components/side-panel/SidePanel.jsx
// @flow import React from 'react'; import Tabs from './tabs/Tabs'; import AddSwatchesPanel from './add-swatches/AddSwatchesPanel'; import AboutPanel from './about/AboutPanel'; import type { PaletteType } from '../../../types'; type Props = { addNewSwatch: Function, tabs: Array<string>, activeTab: string, switchActiveTab: Function, palettes: Array<PaletteType>, deleteSwatches: Function } const SidePanel = (props: Props): React$Element<any> => ( <div className="sidepanel panel"> <header className="bg-secondary panel-header"> <div className="panel-title">Palette Picker</div> <div className="panel-subtitle">Enter a color to add a swatch or choose from some pre made palettes</div> </header> <nav className="panel-nav mb-10"> <Tabs tabs={props.tabs} activeTab={props.activeTab} switchActiveTab={props.switchActiveTab} /> </nav> <main className="panel-body"> {props.activeTab === 'add swatches' && <AddSwatchesPanel addNewSwatch={props.addNewSwatch} deleteSwatches={props.deleteSwatches} palettes={props.palettes} />} {props.activeTab === 'about' && <AboutPanel />} </main> <div className="panel-footer"> Edd Yerburgh </div> </div> ); export default SidePanel;
// @flow import React from 'react'; import Tabs from './tabs/Tabs'; import AddSwatchesPanel from './add-swatches/AddSwatchesPanel'; import AboutPanel from './about/AboutPanel'; import type { PaletteType } from '../../../types'; type Props = { addNewSwatch: Function, tabs: Array<string>, activeTab: string, switchActiveTab: Function, palettes: Array<PaletteType>, deleteSwatches: Function } const SidePanel = (props: Props): React$Element<any> => ( <div className="sidepanel panel"> <header className="bg-secondary panel-header"> <div className="panel-title">Palette Picker</div> <div className="panel-subtitle">Enter a color to add a swatch or choose from some pre made palettes</div> </header> <nav className="panel-nav mb-10"> <Tabs tabs={props.tabs} activeTab={props.activeTab} switchActiveTab={props.switchActiveTab} /> </nav> <main className="panel-body"> {props.activeTab === 'add swatches' && <AddSwatchesPanel addNewSwatch={props.addNewSwatch} deleteSwatches={props.deleteSwatches} palettes={props.palettes} />} {props.activeTab === 'about' && <AboutPanel />} </main> <div className="panel-footer"> Made by <a rel="noopener noreferrer" href="https://github.com/eddyerburgh" target="_blank">Edd Yerburgh</a> </div> </div> ); export default SidePanel;
Add link to my github profile
[New] Add link to my github profile
JSX
isc
eddyerburgh/palette-picker,eddyerburgh/palette-picker
--- +++ @@ -38,8 +38,8 @@ {props.activeTab === 'about' && <AboutPanel />} </main> <div className="panel-footer"> - Edd Yerburgh - </div> + Made by <a rel="noopener noreferrer" href="https://github.com/eddyerburgh" target="_blank">Edd Yerburgh</a> + </div> </div> );
455865960bbee3486322fe764bae527cc3c48a49
test/index.jsx
test/index.jsx
import React from 'react'; import { render } from 'react-dom'; import Test from './Test'; render(<Test />, document.getElementById('react-root'));
import React, { StrictMode } from 'react'; import { render } from 'react-dom'; import Test from './Test'; render( <StrictMode> <Test /> </StrictMode>, document.getElementById('react-root'), );
Enable StrictMode in test suite
Enable StrictMode in test suite
JSX
mit
wojtekmaj/react-pdf,wojtekmaj/react-pdf,wojtekmaj/react-pdf
--- +++ @@ -1,6 +1,10 @@ -import React from 'react'; +import React, { StrictMode } from 'react'; import { render } from 'react-dom'; - import Test from './Test'; -render(<Test />, document.getElementById('react-root')); +render( + <StrictMode> + <Test /> + </StrictMode>, + document.getElementById('react-root'), +);
e6fe952b4b2fad474b268e003413781feb8f5e30
src/request/components/request-entry-item-view.jsx
src/request/components/request-entry-item-view.jsx
var React = require('react'), Timeago = require('../../lib/components/timeago.jsx'); module.exports = React.createClass({ render: function() { var entry = this.props.entry; return ( <div className="request-entry-item-holder"> <table className="table table-bordered"> <tr> <td>{entry.duration}ms</td> <td colSpan="6"> {entry.uri} &nbsp; {entry.method} &nbsp; {entry.statusCode} ({entry.statusText}) - {entry.contentType} </td> <td><Timeago time={entry.dateTime} /></td> </tr> <tr> <td>{entry.user.name}</td> <td>{entry.summary.networkTime}ms</td> <td>{entry.summary.serverTime}ms</td> <td>{entry.summary.clientTime}ms</td> <td>{entry.summary.controller}.{entry.summary.action}(...)</td> <td>{entry.summary.actionTime}ms</td> <td>{entry.summary.viewTime}ms</td> <td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td> </tr> </table> </div> ); } });
var React = require('react'), Timeago = require('../../lib/components/timeago.jsx'); module.exports = React.createClass({ render: function() { var entry = this.props.entry; return ( <div className="request-entry-item-holder"> <table className="table table-bordered"> <tr> <td width="90">{entry.duration}ms</td> <td colSpan="6"> {entry.uri} &nbsp; {entry.method} &nbsp; {entry.statusCode} ({entry.statusText}) - {entry.contentType} </td> <td><Timeago time={entry.dateTime} /></td> </tr> <tr> <td>{entry.user.name}</td> <td>{entry.summary.networkTime}ms</td> <td>{entry.summary.serverTime}ms</td> <td>{entry.summary.clientTime}ms</td> <td>{entry.summary.controller}.{entry.summary.action}(...)</td> <td>{entry.summary.actionTime}ms</td> <td>{entry.summary.viewTime}ms</td> <td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td> </tr> </table> </div> ); } });
Fix width of total request time in request view
Fix width of total request time in request view
JSX
unknown
avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype
--- +++ @@ -8,7 +8,7 @@ <div className="request-entry-item-holder"> <table className="table table-bordered"> <tr> - <td>{entry.duration}ms</td> + <td width="90">{entry.duration}ms</td> <td colSpan="6"> {entry.uri} &nbsp; {entry.method} &nbsp; {entry.statusCode} ({entry.statusText}) - {entry.contentType} </td>
c4e33d6b6426dba0961c13350cb0f1bd69d8753c
client/modules/core/components/poll_list_screen.jsx
client/modules/core/components/poll_list_screen.jsx
import React, { PropTypes } from 'react'; import PollList from '../containers/poll_list.js'; import { Button } from 'rebass'; const PollListScreen = ({newPoll}) => ( <div style={{paddingTop: 48}}> <PollList /> <Button pill={true} theme='primary' onClick={newPoll} > New Poll </Button> </div> ); PollListScreen.propTypes = { newPoll: PropTypes.func }; export default PollListScreen;
import React, { PropTypes } from 'react'; import PollList from '../containers/poll_list.js'; const PollListScreen = ({newPoll}) => ( <div style={{paddingTop: 48}}> <PollList /> </div> ); PollListScreen.propTypes = { newPoll: PropTypes.func }; export default PollListScreen;
Remove New Poll button from PollListScreen
Remove New Poll button from PollListScreen
JSX
mit
thancock20/voting-app,thancock20/voting-app
--- +++ @@ -1,17 +1,9 @@ import React, { PropTypes } from 'react'; import PollList from '../containers/poll_list.js'; -import { Button } from 'rebass'; const PollListScreen = ({newPoll}) => ( <div style={{paddingTop: 48}}> <PollList /> - <Button - pill={true} - theme='primary' - onClick={newPoll} - > - New Poll - </Button> </div> ); PollListScreen.propTypes = {
fdbf0e88170c50d34f161ffd80928d1a6b6917e1
example/components.jsx
example/components.jsx
import React from 'react'; import ReorderAnimator from '../src'; export const Item = React.createClass({ render() { return ( <div className="item"> Some item: {this.props.text} : lots of text aeiou aeiou aeiou aeiou aeiou aeiou aeiouaeiouaeiouaeiouaeiouaeiouaeiou aeiou aeiouaeiouaeiou aeiou </div> ); } }); export const List = React.createClass({ render() { const list = this.props.items.map(item => <Item text={item.text} key={item.key} /> ); return ( <div className="list"> Hello, this is list!<br/> <button onClick={this.props.shuffle}>Shuffle</button> <button onClick={this.props.add}>Add</button> <button onClick={this.props.remove}>Remove</button> <br/> <ReorderAnimator> {list} </ReorderAnimator> </div> ); } });
import React from 'react'; import ReorderAnimator from '../src'; export const Item = React.createClass({ render() { return ( <div className="item"> Some item: {this.props.text} : lots of text aeiou aeiou aeiou aeiou aeiou aeiou aeiouaeiouaeiouaeiouaeiouaeiouaeiou aeiou aeiouaeiouaeiou aeiou {' '} {this.props.children} </div> ); } }); export const List = React.createClass({ render() { const list = this.props.items.map(item => <Item text={item.text} key={item.key}>Test <i>Text</i></Item> ); return ( <div className="list"> Hello, this is list!<br/> <button onClick={this.props.shuffle}>Shuffle</button> <button onClick={this.props.add}>Add</button> <button onClick={this.props.remove}>Remove</button> <br/> <ReorderAnimator> {list} </ReorderAnimator> </div> ); } });
Make sure elements in list can have children.
Make sure elements in list can have children.
JSX
mit
AgentME/react-animate-reorder,AgentME/react-animate-reorder
--- +++ @@ -7,6 +7,8 @@ <div className="item"> Some item: {this.props.text} : lots of text aeiou aeiou aeiou aeiou aeiou aeiou aeiouaeiouaeiouaeiouaeiouaeiouaeiou aeiou aeiouaeiouaeiou aeiou + {' '} + {this.props.children} </div> ); } @@ -15,7 +17,7 @@ export const List = React.createClass({ render() { const list = this.props.items.map(item => - <Item text={item.text} key={item.key} /> + <Item text={item.text} key={item.key}>Test <i>Text</i></Item> ); return ( <div className="list">
5c60e726754f9085d499eff9802ac9d95ef32a0e
lib/components/App.jsx
lib/components/App.jsx
import React, { Component } from 'react/addons'; export default class App extends Component { constructor(props) { super(props); } render() { return ( <div>App</div> ); } }; App.displayName = 'App';
import React, { Component } from 'react/addons'; import Rx from 'rx-dom'; export default class App extends Component { constructor(props) { super(props); this.state = { delta: 0, time: Date.now(), uncontext: [] }; let uncontext = Rx.DOM.fromWebSocket('ws://duel.uncontext.com:80') .map(message => JSON.parse(message.data)) .subscribe(this.onData.bind(this)); } onData(data) { let { delta, time, uncontext } = this.state; let t = Date.now(); let d = t - time; uncontext.push(data); this.setState({ delta: d, time: t, uncontext }); } render() { let { delta, time, uncontext } = this.state; console.log(delta, time); console.log(JSON.stringify(uncontext[uncontext.length - 1], null, 2)); return ( <div>App</div> ); } }; App.displayName = 'App';
Add a data source, log it to the console.
Add a data source, log it to the console.
JSX
mit
mysterycommand/rx-uncontext,mysterycommand/rx-uncontext
--- +++ @@ -1,11 +1,39 @@ import React, { Component } from 'react/addons'; +import Rx from 'rx-dom'; export default class App extends Component { constructor(props) { super(props); + + this.state = { + delta: 0, + time: Date.now(), + uncontext: [] + }; + + let uncontext = Rx.DOM.fromWebSocket('ws://duel.uncontext.com:80') + .map(message => JSON.parse(message.data)) + .subscribe(this.onData.bind(this)); + } + + onData(data) { + let { delta, time, uncontext } = this.state; + let t = Date.now(); + let d = t - time; + + uncontext.push(data); + + this.setState({ + delta: d, + time: t, + uncontext + }); } render() { + let { delta, time, uncontext } = this.state; + console.log(delta, time); + console.log(JSON.stringify(uncontext[uncontext.length - 1], null, 2)); return ( <div>App</div> );
8dc632322a7142027a15fe32393de4cbe0d0966d
components/Layout.jsx
components/Layout.jsx
'use strict'; var React = require('react'), ApplicationStore = require('../stores/ApplicationStore'), Layout; Layout = React.createClass({ render: function () { this.props.markup = 'Yeah!'; return ( <html> <head> <meta charSet="utf-8" /> <title>{ this.props.context.getStore(ApplicationStore).getPageTitle() }</title> <link href="public/img/favicon.ico" rel="icon" /> <link href="public/css/bootstrap.css" rel="stylesheet" /> </head> <body> <div id="communityApp" dangerouslySetInnerHTML={{ __html: this.props.content }}></div> </body> <script src="public/js/bundle.js"></script> <script dangerouslySetInnerHTML={{ __html: "window.app.run(" + this.props.serializedState + ");" }} /> </html> ); } }); module.exports = Layout;
'use strict'; var React = require('react'), DocumentTitle = require('react-document-title'), ApplicationStore = require('../stores/ApplicationStore'), Layout; Layout = React.createClass({ render: function () { var currentPageTitle = DocumentTitle.rewind(); return ( <html> <head> <meta charSet="utf-8" /> <title>{ currentPageTitle }</title> <link href="public/img/favicon.ico" rel="icon" /> <link href="public/css/bootstrap.css" rel="stylesheet" /> </head> <body> <div id="communityApp" dangerouslySetInnerHTML={{ __html: this.props.content }}></div> </body> <script src="public/js/bundle.js"></script> <script dangerouslySetInnerHTML={{ __html: "window.app.run(" + this.props.serializedState + ");" }} /> </html> ); } }); module.exports = Layout;
Use innermost document title on the server side
Use innermost document title on the server side Note: The Layout component is only used on the server / the initial server side rendering
JSX
mit
lxanders/community
--- +++ @@ -1,18 +1,19 @@ 'use strict'; var React = require('react'), + DocumentTitle = require('react-document-title'), ApplicationStore = require('../stores/ApplicationStore'), Layout; Layout = React.createClass({ render: function () { - this.props.markup = 'Yeah!'; + var currentPageTitle = DocumentTitle.rewind(); return ( <html> <head> <meta charSet="utf-8" /> - <title>{ this.props.context.getStore(ApplicationStore).getPageTitle() }</title> + <title>{ currentPageTitle }</title> <link href="public/img/favicon.ico" rel="icon" /> <link href="public/css/bootstrap.css" rel="stylesheet" /> </head>
978d400530cb4d92c94c8a08b7fbd6ff3e6e30e7
installer/frontend/components/tooltip.jsx
installer/frontend/components/tooltip.jsx
import React from 'react'; import _ from 'lodash'; export const Tooltip = ({children}) => <span className="tooltip">{children}</span>; /** * Component for injecting tooltips into anything. Can be used in two ways: * * 1: * <WithTooltip> * <button> * Click me? * <Tooltip> * Click the button! * </Tooltip> * </button> * </WithTooltip> * * and 2: * <WithTooltip text="Click the button!"> * <button> * Click me? * </button> * </WithTooltip> * * Both of these examples will produce the same effect. The first method is * more generic and allows us to separate the hover area from the tooltip * location. */ export const WithTooltip = props => { const {children, shouldShow = true, generateText} = props; const text = generateText ? generateText(props) : props.text; const onlyChild = React.Children.only(children); const nextProps = _.assign({}, _.omit(props, 'children', 'shouldShow', 'generateText', 'text'), onlyChild.props); const newChild = React.cloneElement(onlyChild, nextProps); // If there is no text, then assume the tooltip is already nested. const tooltip = typeof text === 'string' && shouldShow && <Tooltip>{text}</Tooltip>; // Use a wrapping div so that the tooltip will work even if the child // element's pointer-events property is "none". return <div className="withtooltip" style={{display: 'inline-block'}}> {newChild} {tooltip} </div>; };
import React from 'react'; export const Tooltip = ({children}) => <span className="tooltip">{children}</span>; /** * Component for injecting tooltips into anything. Can be used in two ways: * * 1: * <WithTooltip> * <button> * Click me? * <Tooltip> * Click the button! * </Tooltip> * </button> * </WithTooltip> * * and 2: * <WithTooltip text="Click the button!"> * <button> * Click me? * </button> * </WithTooltip> * * Both of these examples will produce the same effect. The first method is * more generic and allows us to separate the hover area from the tooltip * location. */ export const WithTooltip = props => { const {children, shouldShow = true, generateText} = props; const text = generateText ? generateText(props) : props.text; // If there is no text, then assume the tooltip is already nested. const tooltip = typeof text === 'string' && shouldShow && <Tooltip>{text}</Tooltip>; // Use a wrapping div so that the tooltip will work even if a child element's // pointer-events property is "none". return <div className="withtooltip" style={{display: 'inline-block'}}> {children} {tooltip} </div>; };
Allow WithTooltip to have multiple children
frontend: Allow WithTooltip to have multiple children
JSX
apache-2.0
squat/tectonic-installer,lander2k2/tectonic-installer,hhoover/tectonic-installer,hhoover/tectonic-installer,squat/tectonic-installer,zbwright/tectonic-installer,AduroIdeja/tectonic-installer,s-urbaniak/tectonic-installer,coreos/tectonic-installer,erjohnso/tectonic-installer,bsiegel/tectonic-installer,joshrosso/tectonic-installer,rithujohn191/tectonic-installer,lander2k2/tectonic-installer,mxinden/tectonic-installer,yifan-gu/tectonic-installer,joshix/tectonic-installer,aknuds1/tectonic-installer,bsiegel/tectonic-installer,mrwacky42/tectonic-installer,everett-toews/tectonic-installer,colemickens/tectonic-installer,bsiegel/tectonic-installer,zbwright/tectonic-installer,derekhiggins/installer,hhoover/tectonic-installer,rithujohn191/tectonic-installer,coreos/tectonic-installer,yifan-gu/tectonic-installer,erjohnso/tectonic-installer,AduroIdeja/tectonic-installer,aknuds1/tectonic-installer,s-urbaniak/tectonic-installer,metral/tectonic-installer,mxinden/tectonic-installer,AduroIdeja/tectonic-installer,kyoto/tectonic-installer,mxinden/tectonic-installer,enxebre/tectonic-installer,yifan-gu/tectonic-installer,cpanato/tectonic-installer,justaugustus/tectonic-installer,metral/tectonic-installer,mrwacky42/tectonic-installer,bsiegel/tectonic-installer,colemickens/tectonic-installer,joshix/tectonic-installer,AduroIdeja/tectonic-installer,aknuds1/tectonic-installer,alexsomesan/tectonic-installer,joshix/tectonic-installer,yifan-gu/tectonic-installer,everett-toews/tectonic-installer,mxinden/tectonic-installer,zbwright/tectonic-installer,alexsomesan/tectonic-installer,rithujohn191/tectonic-installer,kyoto/tectonic-installer,metral/tectonic-installer,lander2k2/tectonic-installer,rithujohn191/tectonic-installer,alexsomesan/tectonic-installer,radhikapc/tectonic-installer,AduroIdeja/tectonic-installer,erjohnso/tectonic-installer,radhikapc/tectonic-installer,kalmog/tectonic-installer,enxebre/tectonic-installer,mrwacky42/tectonic-installer,zbwright/tectonic-installer,s-urbaniak/tectonic-installer,alexsomesan/tectonic-installer,everett-toews/tectonic-installer,s-urbaniak/tectonic-installer,justaugustus/tectonic-installer,justaugustus/tectonic-installer,metral/tectonic-installer,cpanato/tectonic-installer,hhoover/tectonic-installer,aknuds1/tectonic-installer,kyoto/tectonic-installer,mrwacky42/tectonic-installer,cpanato/tectonic-installer,zbwright/tectonic-installer,coreos/tectonic-installer,hhoover/tectonic-installer,alexsomesan/tectonic-installer,rithujohn191/tectonic-installer,enxebre/tectonic-installer,derekhiggins/installer,cpanato/tectonic-installer,mrwacky42/tectonic-installer,kalmog/tectonic-installer,kalmog/tectonic-installer,lander2k2/tectonic-installer,enxebre/tectonic-installer,joshrosso/tectonic-installer,kyoto/tectonic-installer,coreos/tectonic-installer,squat/tectonic-installer,joshix/tectonic-installer,joshix/tectonic-installer,enxebre/tectonic-installer,everett-toews/tectonic-installer,erjohnso/tectonic-installer,everett-toews/tectonic-installer,colemickens/tectonic-installer,coreos/tectonic-installer,kyoto/tectonic-installer,joshrosso/tectonic-installer,justaugustus/tectonic-installer,joshrosso/tectonic-installer,colemickens/tectonic-installer,radhikapc/tectonic-installer,squat/tectonic-installer,s-urbaniak/tectonic-installer,radhikapc/tectonic-installer,yifan-gu/tectonic-installer,metral/tectonic-installer,aknuds1/tectonic-installer,bsiegel/tectonic-installer,colemickens/tectonic-installer,joshrosso/tectonic-installer,justaugustus/tectonic-installer
--- +++ @@ -1,6 +1,4 @@ import React from 'react'; - -import _ from 'lodash'; export const Tooltip = ({children}) => <span className="tooltip">{children}</span>; @@ -31,17 +29,14 @@ export const WithTooltip = props => { const {children, shouldShow = true, generateText} = props; const text = generateText ? generateText(props) : props.text; - const onlyChild = React.Children.only(children); - const nextProps = _.assign({}, _.omit(props, 'children', 'shouldShow', 'generateText', 'text'), onlyChild.props); - const newChild = React.cloneElement(onlyChild, nextProps); // If there is no text, then assume the tooltip is already nested. const tooltip = typeof text === 'string' && shouldShow && <Tooltip>{text}</Tooltip>; - // Use a wrapping div so that the tooltip will work even if the child - // element's pointer-events property is "none". + // Use a wrapping div so that the tooltip will work even if a child element's + // pointer-events property is "none". return <div className="withtooltip" style={{display: 'inline-block'}}> - {newChild} + {children} {tooltip} </div>; };
53ef6fd54e0bb57774c606deceeca6ed46b3443c
app/app/components/tasks/CreateTask.jsx
app/app/components/tasks/CreateTask.jsx
import React from 'react'; export default class CreateTask extends React.Component { render(){ return( <p>New Task</p> ) } }
import React from 'react'; import GoogleMapsLoader from 'google-maps' import axios from 'axios' import {hashHistory} from 'react-router' export default class CreateTask extends React.Component { componentWillMount() { GoogleMapsLoader.KEY = process.env.GOOGLE_MAPS_API_KEY GoogleMapsLoader.load((google) => { new google.maps.Map(document.getElementById('map'), { center: { lat: 40.7413549, lng: -73.9980244 }, zoom: 13 }); }) } handleClick(){ let data = { name: this.refs.name.value, price: this.refs.price.value, description: this.refs.description.value } axios.post('users/' + this.props.params.id + '/tasks', data).then(() => { hashHistory.push('/') }) } render(){ return( <div> <h3>New Task</h3> <div id="map" /><br /> <div className="form-group"> <label for="exampleInputName2">Task Name</label> <input type="text" className="form-control" ref="name" placeholder="Pick up my laundry"/> </div> <div className="form-group"> <label for="exampleInputEmail2">Description</label> <textarea className="form-control" ref="description" placeholder="Description" /> </div> <div className="form-group"> <label for="exampleInputEmail2">Price</label> <input type="number" className="form-control col-sm-2" ref="price" placeholder="Price($)" /> </div> <button onClick={this.handleClick.bind(this)} className="btn btn-primary">Call A Serf</button><br /><br /> </div> ) } }
Add google maps initial map and task form
Add google maps initial map and task form
JSX
mit
taodav/MicroSerfs,taodav/MicroSerfs
--- +++ @@ -1,9 +1,51 @@ import React from 'react'; +import GoogleMapsLoader from 'google-maps' +import axios from 'axios' +import {hashHistory} from 'react-router' export default class CreateTask extends React.Component { + componentWillMount() { + GoogleMapsLoader.KEY = process.env.GOOGLE_MAPS_API_KEY + GoogleMapsLoader.load((google) => { + new google.maps.Map(document.getElementById('map'), { + center: { + lat: 40.7413549, + lng: -73.9980244 + }, + zoom: 13 + }); + }) + } + + handleClick(){ + let data = { + name: this.refs.name.value, + price: this.refs.price.value, + description: this.refs.description.value + } + axios.post('users/' + this.props.params.id + '/tasks', data).then(() => { + hashHistory.push('/') + }) + } render(){ return( - <p>New Task</p> + <div> + <h3>New Task</h3> + <div id="map" /><br /> + <div className="form-group"> + <label for="exampleInputName2">Task Name</label> + <input type="text" className="form-control" ref="name" placeholder="Pick up my laundry"/> + </div> + <div className="form-group"> + <label for="exampleInputEmail2">Description</label> + <textarea className="form-control" ref="description" placeholder="Description" /> + </div> + <div className="form-group"> + <label for="exampleInputEmail2">Price</label> + <input type="number" className="form-control col-sm-2" ref="price" placeholder="Price($)" /> + </div> + <button onClick={this.handleClick.bind(this)} className="btn btn-primary">Call A Serf</button><br /><br /> + </div> ) } }
0925cc0d096093ba5c0342c9f79731f1a5674496
lib/javascripts/views/task-panes.js.jsx
lib/javascripts/views/task-panes.js.jsx
/** @jsx React.DOM */ //= require ./tasks-pane (function () { "use strict"; Nike.Views.TaskPanes = React.createClass({ displayName: "Nike.Views.TaskPanes", render: function () { return ( <section className="tasks-panes"> {this.props.taskPaneTasks.map(function (tasks, paneIndex) { return ( <Nike.Views.TasksPane key={paneIndex} index={paneIndex} parentTaskId={this.props.taskIds[paneIndex-1]} selectedTaskId={this.props.taskIds[paneIndex]} tasks={tasks} /> ); }, this)} <section className="h-spacer">&nbsp;</section> </section> ); }, componentDidMount: function () { var el = this.getDOMNode(); var width = el.scrollWidth; this.__minWidth = width; el.style.minWidth = width + "px"; }, componentDidUpdate: function () { var el = this.getDOMNode(); var scrollX = window.scrollX; var scrollY = window.scrollY; el.style.minWidth = null; var width = el.scrollWidth + scrollX; el.style.minWidth = width + "px"; window.scrollTo(scrollX, scrollY); } }); })();
/** @jsx React.DOM */ //= require ./tasks-pane (function () { "use strict"; Nike.Views.TaskPanes = React.createClass({ displayName: "Nike.Views.TaskPanes", render: function () { return ( <section className="tasks-panes"> {this.props.taskPaneTasks.map(function (tasks, paneIndex) { return ( <Nike.Views.TasksPane key={paneIndex} index={paneIndex} parentTaskId={this.props.taskIds[paneIndex-1]} selectedTaskId={this.props.taskIds[paneIndex]} tasks={tasks} /> ); }, this)} <section className="h-spacer">&nbsp;</section> </section> ); }, componentDidMount: function () { var el = this.getDOMNode(); var width = el.scrollWidth; this.__minWidth = width; el.style.minWidth = width + "px"; }, componentDidUpdate: function () { var el = this.getDOMNode(); var scrollX = window.scrollX; var scrollY = window.scrollY; el.style.minWidth = null; var scrollWidth = el.scrollWidth; var width; if (scrollWidth < this.__minWidth) { width = scrollWidth + scrollX; } else { width = scrollWidth; } this.__minWidth = width; el.style.minWidth = width + "px"; window.scrollTo(scrollX, scrollY); } }); })();
Fix infinite adding of scroll area
Fix infinite adding of scroll area
JSX
bsd-3-clause
cupcake/nike,cupcake/nike
--- +++ @@ -38,7 +38,14 @@ var scrollX = window.scrollX; var scrollY = window.scrollY; el.style.minWidth = null; - var width = el.scrollWidth + scrollX; + var scrollWidth = el.scrollWidth; + var width; + if (scrollWidth < this.__minWidth) { + width = scrollWidth + scrollX; + } else { + width = scrollWidth; + } + this.__minWidth = width; el.style.minWidth = width + "px"; window.scrollTo(scrollX, scrollY); }
3d2da2a6c1e17895c8e0b8e484a767932dc8ae71
app/scripts/components/App.jsx
app/scripts/components/App.jsx
import React from 'react'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; class App extends React.Component { render() { return ( <MuiThemeProvider muiTheme={getMuiTheme()}> {this.props.children} </MuiThemeProvider> ); } } export default App;
import React from 'react'; import { green900, green700, yellow200 } from 'material-ui/styles/colors'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; const theme = getMuiTheme({ palette: { primary1Color: green700, primary2Color: green900, accent1Color: yellow200 } }) class App extends React.Component { render() { return ( <MuiThemeProvider muiTheme={theme}> {this.props.children} </MuiThemeProvider> ); } } export default App;
Change the theme to be more green.
Change the theme to be more green.
JSX
apache-2.0
rgee/Game-Editor,rgee/Game-Editor
--- +++ @@ -1,11 +1,20 @@ import React from 'react'; +import { green900, green700, yellow200 } from 'material-ui/styles/colors'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; + +const theme = getMuiTheme({ + palette: { + primary1Color: green700, + primary2Color: green900, + accent1Color: yellow200 + } +}) class App extends React.Component { render() { return ( - <MuiThemeProvider muiTheme={getMuiTheme()}> + <MuiThemeProvider muiTheme={theme}> {this.props.children} </MuiThemeProvider> );
d0b10caa4ba2225bea20fe8fa0ab5a00173d4ca2
src/components/dev.jsx
src/components/dev.jsx
import React from 'react'; import {Link} from 'react-router'; export default (props) => ( <div className="box"> <div className="box-header-timeline"></div> <div className="box-body"> <h3>Help us build FreeFeed</h3> <p>We are looking for volunteers to help us build FreeFeed, an open-source social network, replacement of FriendFeed.com.</p> <p>We need help with both development and testing.</p> <p>FreeFeed is open-source: <a href="https://github.com/FreeFeed/" target="_blank">https://github.com/FreeFeed/</a></p> <p>The <a href="https://github.com/FreeFeed/freefeed-server" target="_blank">backend</a> is built with Node.js and Redis. It is now being re-written to use PostgreSQL instead of Redis.</p> <p>The <a href="https://github.com/FreeFeed/freefeed-react-client" target="_blank">frontend</a> is built with React.</p> <h3>Roadmap</h3> <p>[x] v 0.6 React frontend<br/> [x] v 0.7 Add real-time updates to the frontend<br/> [x] v 0.8 Add support for private groups<br/> [ &nbsp;] v 0.9 Migrate to Postgres<br/> [ &nbsp;] v 1.0 Support for search and #hashtags</p> <p><a href="https://dev.freefeed.net" target="_blank">Join</a> our team of volunteers!</p> <p>P.S. We welcome contributions of features outside of the core ones outlined above, however we feel that the core has higher priority (especially switching the primary data store).</p> </div> </div> );
import React from 'react'; export default (props) => ( <div className="box"> <div className="box-header-timeline"></div> <div className="box-body"> <h3>Help us build FreeFeed</h3> <p>We are looking for volunteers to help us build FreeFeed, an open-source social network, replacement of FriendFeed.com.</p> <p>We <a href="https://dev.freefeed.net" target="_blank">need help</a> with both development and testing.</p> <p>FreeFeed is open-source: <a href="https://github.com/FreeFeed/" target="_blank">https://github.com/FreeFeed/</a></p> <p>The <a href="https://github.com/FreeFeed/freefeed-server" target="_blank">backend</a> is built with Node.js and PostgreSQL.</p> <p>The <a href="https://github.com/FreeFeed/freefeed-react-client" target="_blank">frontend</a> is built with React.</p> <p><b><a href="https://dev.freefeed.net" target="_blank">Join</a></b> our team of volunteers!</p> </div> </div> );
Update Dev page (FreeFeed v1 released)
Update Dev page (FreeFeed v1 released)
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -1,5 +1,4 @@ import React from 'react'; -import {Link} from 'react-router'; export default (props) => ( <div className="box"> @@ -10,29 +9,17 @@ <p>We are looking for volunteers to help us build FreeFeed, an open-source social network, replacement of FriendFeed.com.</p> - <p>We need help with both development and testing.</p> + <p>We <a href="https://dev.freefeed.net" target="_blank">need help</a> with both development and testing.</p> <p>FreeFeed is open-source: <a href="https://github.com/FreeFeed/" target="_blank">https://github.com/FreeFeed/</a></p> <p>The <a href="https://github.com/FreeFeed/freefeed-server" target="_blank">backend</a> is - built with Node.js and Redis. It is now being re-written to use PostgreSQL instead of Redis.</p> + built with Node.js and PostgreSQL.</p> <p>The <a href="https://github.com/FreeFeed/freefeed-react-client" target="_blank">frontend</a> is built with React.</p> - <h3>Roadmap</h3> - - <p>[x] v 0.6 React frontend<br/> - [x] v 0.7 Add real-time updates to the frontend<br/> - [x] v 0.8 Add support for private groups<br/> - [ &nbsp;] v 0.9 Migrate to Postgres<br/> - [ &nbsp;] v 1.0 Support for search and #hashtags</p> - - <p><a href="https://dev.freefeed.net" target="_blank">Join</a> our team of volunteers!</p> - - <p>P.S. We welcome contributions of features outside of the core ones - outlined above, however we feel that the core has higher priority - (especially switching the primary data store).</p> + <p><b><a href="https://dev.freefeed.net" target="_blank">Join</a></b> our team of volunteers!</p> </div> </div> );
d7af66e34de575c21813963be6abe9e6cd04ffe0
src/jsx/main.jsx
src/jsx/main.jsx
"use strict"; import React from "react" import ReactDOM from "react-dom"; import MetronomeApp from "./MetronomeApp.jsx"; window.addEventListener("load", function () { ReactDOM.render( <MetronomeApp />, document.getElementsByClassName("container")[0] ); }, false);
"use strict"; import React from "react" import ReactDOM from "react-dom"; import MetronomeApp from "./MetronomeApp.jsx"; window.addEventListener("DOMContentLoaded", function () { ReactDOM.render( <MetronomeApp />, document.getElementsByClassName("container")[0] ); }, false);
Change event trigger to init
Change event trigger to init
JSX
mit
seckie/jsmetronome,seckie/jsmetronome
--- +++ @@ -4,7 +4,7 @@ import ReactDOM from "react-dom"; import MetronomeApp from "./MetronomeApp.jsx"; -window.addEventListener("load", function () { +window.addEventListener("DOMContentLoaded", function () { ReactDOM.render( <MetronomeApp />, document.getElementsByClassName("container")[0]
529675bf2479c0c815c34bbeacae859b37aa21b6
src/connection/database/reset_password.jsx
src/connection/database/reset_password.jsx
import React from 'react'; import Screen from '../../core/screen'; import ResetPasswordPane from './reset_password_pane'; import { authWithUsername, hasScreen } from './index'; import { cancelResetPassword, resetPassword } from './actions'; import { renderPasswordResetConfirmation } from './password_reset_confirmation'; const Component = ({model, t}) => { const headerText = t("forgotPasswordInstructions") || null; const header = headerText && <p>{headerText}</p>; return ( <ResetPasswordPane emailInputPlaceholder={t("emailInputPlaceholder", {__textOnly: true})} header={header} lock={model} /> ); }; export default class ResetPassword extends Screen { constructor() { super("forgotPassword"); } backHandler(m) { return hasScreen(m, "login") ? cancelResetPassword : undefined; } submitHandler() { return resetPassword; } renderAuxiliaryPane(m) { return renderPasswordResetConfirmation(m); } render() { return Component; } }
import React from 'react'; import Screen from '../../core/screen'; import ResetPasswordPane from './reset_password_pane'; import { authWithUsername, hasScreen } from './index'; import { cancelResetPassword, resetPassword } from './actions'; import { renderPasswordResetConfirmation } from './password_reset_confirmation'; const Component = ({i18n, model}) => { const headerText = i18n.html("forgotPasswordInstructions") || null; const header = headerText && <p>{headerText}</p>; return ( <ResetPasswordPane emailInputPlaceholder={i18n.str("emailInputPlaceholder")} header={header} lock={model} /> ); }; export default class ResetPassword extends Screen { constructor() { super("forgotPassword"); } backHandler(m) { return hasScreen(m, "login") ? cancelResetPassword : undefined; } submitHandler() { return resetPassword; } renderAuxiliaryPane(m) { return renderPasswordResetConfirmation(m); } render() { return Component; } }
Use i18n prop instead of t in ResetPassword screen
Use i18n prop instead of t in ResetPassword screen
JSX
mit
mike-casas/lock,mike-casas/lock,mike-casas/lock
--- +++ @@ -5,13 +5,13 @@ import { cancelResetPassword, resetPassword } from './actions'; import { renderPasswordResetConfirmation } from './password_reset_confirmation'; -const Component = ({model, t}) => { - const headerText = t("forgotPasswordInstructions") || null; +const Component = ({i18n, model}) => { + const headerText = i18n.html("forgotPasswordInstructions") || null; const header = headerText && <p>{headerText}</p>; return ( <ResetPasswordPane - emailInputPlaceholder={t("emailInputPlaceholder", {__textOnly: true})} + emailInputPlaceholder={i18n.str("emailInputPlaceholder")} header={header} lock={model} />
3b7fb7ae75c88f22bd0489a00d6fd5261618ebee
src/components/inputs/CheckboxInput.jsx
src/components/inputs/CheckboxInput.jsx
import React from 'react' class CheckboxInput extends React.Component { static propTypes = { value: React.PropTypes.bool.isRequired, style: React.PropTypes.object, onChange: React.PropTypes.func, } render() { return <label className="maputnik-checkbox-wrapper"> <input className="maputnik-checkbox" type="checkbox" style={this.props.style} onChange={e => this.props.onChange(!this.props.value)} checked={this.props.value} /> <div className="maputnik-checkbox-box"> <svg className="maputnik-checkbox-icon" viewBox='0 0 32 32'> <path d='M1 14 L5 10 L13 18 L27 4 L31 8 L13 26 z' /> </svg> </div> </label> } } export default CheckboxInput
import React from 'react' class CheckboxInput extends React.Component { static propTypes = { value: React.PropTypes.bool.isRequired, style: React.PropTypes.object, onChange: React.PropTypes.func, } render() { return <label className="maputnik-checkbox-wrapper"> <input className="maputnik-checkbox" type="checkbox" style={this.props.style} onChange={e => this.props.onChange(!this.props.value)} checked={this.props.value} /> <div className="maputnik-checkbox-box"> <svg style={{ display: this.props.value ? 'inline' : 'none' }} className="maputnik-checkbox-icon" viewBox='0 0 32 32'> <path d='M1 14 L5 10 L13 18 L27 4 L31 8 L13 26 z' /> </svg> </div> </label> } } export default CheckboxInput
Fix checkbox not showing status
Fix checkbox not showing status
JSX
mit
maputnik/editor,maputnik/editor
--- +++ @@ -17,7 +17,9 @@ checked={this.props.value} /> <div className="maputnik-checkbox-box"> - <svg className="maputnik-checkbox-icon" viewBox='0 0 32 32'> + <svg style={{ + display: this.props.value ? 'inline' : 'none' + }} className="maputnik-checkbox-icon" viewBox='0 0 32 32'> <path d='M1 14 L5 10 L13 18 L27 4 L31 8 L13 26 z' /> </svg> </div>
b087def0791da2320b782b59b73da1378f1bfe7d
app/components/StatusButtons.jsx
app/components/StatusButtons.jsx
import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; const StatusButtons = React.createClass({ render() { const flexContainer = { display: 'flex', flexDirection: 'column', flexWrap: 'wrap', justifyContent: 'center', alignContent: 'center', alignItems: 'center', height: '70vh' } const styleButton = { display: 'flex', width: '235px', marginBottom: '10px', fontFamily: 'Mallanna', fontWeight: '200' }; return <div style={flexContainer}> <RaisedButton label="I want a cigarette" primary={true} style={styleButton} /> <RaisedButton label="I have cigarettes to give" primary={true} style={styleButton} /> </div> } }); export default StatusButtons;
import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; const StatusButtons = React.createClass({ render() { const flexContainer = { display: 'flex', flexDirection: 'column', flexWrap: 'wrap', justifyContent: 'center', alignContent: 'center', alignItems: 'center', height: '70vh' } const styleButton = { display: 'flex', width: '235px', marginBottom: '10px', fontFamily: 'Mallanna', fontWeight: '200' } const styleLabel = { fontWeight: '200' } return <div style={flexContainer}> <RaisedButton label="I want a cigarette" primary={true} style={styleButton} labelStyle={styleLabel} /> <RaisedButton label="I have cigarettes to give" primary={true} style={styleButton} labelStyle={styleLabel} /> </div> } }); export default StatusButtons;
Change font weight of status buttons labels
Change font weight of status buttons labels
JSX
mit
spanningtime/smokator,spanningtime/smokator
--- +++ @@ -22,12 +22,15 @@ marginBottom: '10px', fontFamily: 'Mallanna', fontWeight: '200' + } - }; + const styleLabel = { + fontWeight: '200' + } return <div style={flexContainer}> - <RaisedButton label="I want a cigarette" primary={true} style={styleButton} /> - <RaisedButton label="I have cigarettes to give" primary={true} style={styleButton} /> + <RaisedButton label="I want a cigarette" primary={true} style={styleButton} labelStyle={styleLabel} /> + <RaisedButton label="I have cigarettes to give" primary={true} style={styleButton} labelStyle={styleLabel} /> </div> } });
e335329ca6f588631961857ca3b7c9559359a0ba
src/components/History.jsx
src/components/History.jsx
import React, {PropTypes} from "react"; import Moment from "moment"; import HistoryItem from "./HistoryItem.jsx"; import HistoryHead from "./HistoryHead.jsx"; class History extends React.Component { constructor(props) { super(props); } getItems() { if (parseInt(this.props.paginate.limit) === 0) { return this.props.items; } const cursor = this.props.paginate.page * this.props.paginate.limit; return this.props.items.slice(cursor, parseInt(cursor)+parseInt(this.props.paginate.limit)); } render() { const items = this.getItems(); const selectedDay = Moment(this.props.date); let formattedTitle = ""; if (this.props.query !== "") { formattedTitle += "Searching: \"" + this.props.query + "\" on "; } formattedTitle += selectedDay.format("dddd, MMM Do YY'"); return ( <div className="history list-group"> <HistoryHead title={formattedTitle} /> {items.map(obj => { return <HistoryItem key={obj.id} info={obj} stale={obj.lastVisitTime > selectedDay.endOf("day").valueOf() ? true : false} /> })} </div> ); } } export default History;
import React, {PropTypes} from "react"; import Moment from "moment"; import HistoryItem from "./HistoryItem.jsx"; import HistoryHead from "./HistoryHead.jsx"; class History extends React.Component { constructor(props) { super(props); } getItems() { if (parseInt(this.props.paginate.limit) === 0) { return this.props.items; } const cursor = this.props.paginate.page * this.props.paginate.limit; return this.props.items.slice(cursor, parseInt(cursor)+parseInt(this.props.paginate.limit)); } render() { const items = this.getItems(); const selectedDay = Moment(this.props.date); let formattedTitle = ""; if (this.props.query !== "") { formattedTitle += "Searching: \"" + this.props.query + "\""; if (this.props.date) { formattedTitle += " on "; } } if (this.props.date) { formattedTitle += selectedDay.format("dddd, MMM Do YY'"); } return ( <div className="history list-group"> <HistoryHead title={formattedTitle || "All visits"} /> {items.map(obj => { return <HistoryItem key={obj.id} info={obj} stale={obj.lastVisitTime > selectedDay.endOf("day").valueOf() ? true : false} /> })} </div> ); } } export default History;
Change results header title depending on search type
Change results header title depending on search type There are currently 3 search types: - With a query - With a query, and date - With neither This commit will modify the title formatting "handler" to account for the above scenarios. A title will be set accordingly. The changes in this commit should be optimised in the near future (WIP).
JSX
mit
MrSaints/historyx,MrSaints/historyx
--- +++ @@ -22,13 +22,18 @@ let formattedTitle = ""; if (this.props.query !== "") { - formattedTitle += "Searching: \"" + this.props.query + "\" on "; + formattedTitle += "Searching: \"" + this.props.query + "\""; + if (this.props.date) { + formattedTitle += " on "; + } } - formattedTitle += selectedDay.format("dddd, MMM Do YY'"); + if (this.props.date) { + formattedTitle += selectedDay.format("dddd, MMM Do YY'"); + } return ( <div className="history list-group"> - <HistoryHead title={formattedTitle} /> + <HistoryHead title={formattedTitle || "All visits"} /> {items.map(obj => { return <HistoryItem key={obj.id}
7834fd87c080af5d2af9b745662bc0bcb3175843
web/static/js/components/stage_change_info_action_items.jsx
web/static/js/components/stage_change_info_action_items.jsx
import React from "react" export default () => ( <div> The skinny on Action-Item Generation: <div className="ui basic segment"> <ul className="ui list"> <li>Discuss the highest-voted items on the board. <ul> <li> <small> <strong>Protip: </strong> let discussions breathe, conducting root cause analyses where appropriate. </small> </li> </ul> </li> <li>Generate action-items aimed at obliterating the team's bottlenecks.</li> <li>Generate action-items that will bolster the team's successes.</li> <li>Give every action-item an assignee.</li> </ul> </div> </div> )
import React from "react" export default () => ( <div> The skinny on Action-Item Generation: <div className="ui basic segment"> <ul className="ui list"> <li>Discuss the highest-voted items on the board. <ul> <li> <small> <strong>Protip: </strong> let discussions breathe, conducting root cause analyses where appropriate. </small> </li> </ul> </li> <li>Generate action-items aimed at: <ul> <li>exploding the team's bottlenecks</li> <li>bolstering the team's successes</li> </ul> </li> </ul> </div> </div> )
Update Action Item Generation intro copy
Update Action Item Generation intro copy
JSX
mit
stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro
--- +++ @@ -15,9 +15,12 @@ </li> </ul> </li> - <li>Generate action-items aimed at obliterating the team's bottlenecks.</li> - <li>Generate action-items that will bolster the team's successes.</li> - <li>Give every action-item an assignee.</li> + <li>Generate action-items aimed at: + <ul> + <li>exploding the team's bottlenecks</li> + <li>bolstering the team's successes</li> + </ul> + </li> </ul> </div> </div>
8f6688f997cef738119df25334b6af5332ab8ae2
src/stores/UserStore.jsx
src/stores/UserStore.jsx
'use strict'; import Immutable from 'immutable'; import Reflux from 'reflux'; import UserActions from 'actions/UserActionCreators'; import TimezoneStore from 'stores/TimezoneStore'; const UserStore = Reflux.createStore({ listenables: UserActions, init() { let storage; try { let fromLocalStorage = localStorage.getItem('clockette'); if (fromLocalStorage) { let arr = JSON.parse(fromLocalStorage); if (Array.isArray(arr)) { storage = arr; } else { throw new Error('localStorage data wasn\'t readable'); } } else { throw new Error('No localStorage found'); } } catch (e) { storage = []; } this.data = Immutable.Set(storage).map((zone) => { return TimezoneStore.data.find((tszone) => tszone.name === zone.name); }); }, save() { localStorage.setItem('clockette', JSON.stringify(this.data.toArray())); this.trigger(this.data); }, onAdd(zone) { this.data = this.data.add(zone); this.save(); }, onRemove(zone) { this.data = this.data.delete(this.data.indexOf(zone)); this.save(); }, }); export default UserStore;
'use strict'; import Immutable from 'immutable'; import Reflux from 'reflux'; import UserActions from 'actions/UserActionCreators'; import TimezoneStore from 'stores/TimezoneStore'; const UserStore = Reflux.createStore({ listenables: UserActions, init() { let storage; try { let fromLocalStorage = localStorage.getItem('clockette'); if (fromLocalStorage) { let arr = JSON.parse(fromLocalStorage); if (Array.isArray(arr)) { storage = arr; } else { throw new Error('localStorage data wasn\'t readable'); } } else { throw new Error('No localStorage found'); } } catch (e) { storage = []; } this.data = Immutable.List( storage.map((tz) => { return TimezoneStore.getBy('zone', tz.zone).first(); }) ); }, save() { localStorage.setItem('clockette', JSON.stringify(this.data.toArray())); this.trigger(this.data); }, onAdd(zone) { this.data = this.data.add(zone); this.save(); }, onRemove(zone) { this.data = this.data.delete(this.data.indexOf(zone)); this.save(); }, }); export default UserStore;
Use TimezoneStore.getBy with lazy/seq optimisation to improve performance
Use TimezoneStore.getBy with lazy/seq optimisation to improve performance
JSX
mit
rhumlover/clockette,rhumlover/clockette
--- +++ @@ -33,9 +33,11 @@ storage = []; } - this.data = Immutable.Set(storage).map((zone) => { - return TimezoneStore.data.find((tszone) => tszone.name === zone.name); - }); + this.data = Immutable.List( + storage.map((tz) => { + return TimezoneStore.getBy('zone', tz.zone).first(); + }) + ); }, save() {
d076d27393b648802efe54573e731bba2a93998d
src/App.jsx
src/App.jsx
import * as React from 'react'; import {Component} from 'react'; import './App.css'; import Item from './item'; class App extends Component { constructor(props) { super(props); this.state = { items: [] }; this.handleEnterPress = this.handleEnterPress.bind(this); this.handlerDeleteItem = this.handlerDeleteItem.bind(this); } handleEnterPress(e) { if (e.key === 'Enter') { const item = { name: e.target.value }; this.state.items.push(item); this.setState({ items: this.state.items }); } } handlerDeleteItem(name) { let items = this.state.items, data; data = items.filter(el => { return el.name != name; }) this.setState({items: data}); } render() { return ( <div> <div> <input type="text" placeholder="请输入待办事项" onKeyPress={this.handleEnterPress} /> </div> <Item delete={this.handlerDeleteItem} items={this.state.items}/> </div> ); } } export default App;
import * as React from 'react'; import {Component} from 'react'; import './App.css'; import Item from './item'; class App extends Component { constructor(props) { super(props); this.state = { items: [] }; this.handleEnterPress = this.handleEnterPress.bind(this); this.handlerDeleteItem = this.handlerDeleteItem.bind(this); } handleEnterPress(e) { if (e.key === 'Enter') { const item = { name: e.target.value }; this.state.items.push(item); this.setState({ items: this.state.items }); e.target.value = ''; } } handlerDeleteItem(name) { let items = this.state.items, data; data = items.filter(el => { return el.name != name; }) this.setState({items: data}); } render() { return ( <div> <div> <input type="text" placeholder="请输入待办事项" onKeyPress={this.handleEnterPress} /> </div> <Item delete={this.handlerDeleteItem} items={this.state.items}/> </div> ); } } export default App;
Clear input value after add item successfully
Clear input value after add item successfully
JSX
mit
Todolab/frontend,Todolab/frontend
--- +++ @@ -24,6 +24,8 @@ this.setState({ items: this.state.items }); + + e.target.value = ''; } }
d95d82eea11dc66022b32eca7d000201dc85da9f
client/src/components/houseInventory.jsx
client/src/components/houseInventory.jsx
import React from 'react'; import ReactDOM from 'react-dom'; import axios from 'axios'; import HouseInventoryList from './HouseInventoryList.jsx'; import Nav from './Nav.jsx'; class HouseInventory extends React.Component { constructor(props) { super(props); this.state = { items: this.props.dummyData }; } componentDidMount() { this.getItems(this.updateItems.bind(this)); } getItems(callback) { // will need to send the house id with this request axios.get('/inventory') .then(data => { console.log(data); console.log('Successful GET request - house inventory items retrieved'); callback(data); }) .catch(err => console.log('Unable to GET house inventory items: ', err)); } updateItems(data) { this.setState({ items: data }); } render() { return ( <div> <h1>House Inventory</h1> <Nav /> <HouseInventoryList items={this.state.items}/> </div> ); } } export default HouseInventory; // ReactDOM.render(<HouseInventory dummyData={dummyData} />, document.getElementById('inventory'));
import React from 'react'; import ReactDOM from 'react-dom'; import axios from 'axios'; import HouseInventoryList from './HouseInventoryList.jsx'; import Nav from './Nav.jsx'; class HouseInventory extends React.Component { constructor(props) { super(props); this.state = { items: [], houseId: 1 // dummy value for now, will get from superclass props eventually }; } componentDidMount() { this.getItems(this.updateItems.bind(this)); } getItems(callback) { axios.post('/inventory', { houseId: this.state.houseId }) .then(res => { console.log('Successful GET request - house inventory items retrieved: ', res.data); callback(res.data); }) .catch(err => console.log('Unable to GET house inventory items: ', err)); } updateItems(data) { this.setState({ items: data }); } render() { return ( <div> <h1>House Inventory</h1> <Nav /> <HouseInventoryList items={this.state.items}/> </div> ); } } export default HouseInventory;
Change GET to POST request, change to using fridgr database data instead of dummy data
Change GET to POST request, change to using fridgr database data instead of dummy data
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -9,7 +9,8 @@ super(props); this.state = { - items: this.props.dummyData + items: [], + houseId: 1 // dummy value for now, will get from superclass props eventually }; } @@ -18,12 +19,10 @@ } getItems(callback) { - // will need to send the house id with this request - axios.get('/inventory') - .then(data => { - console.log(data); - console.log('Successful GET request - house inventory items retrieved'); - callback(data); + axios.post('/inventory', { houseId: this.state.houseId }) + .then(res => { + console.log('Successful GET request - house inventory items retrieved: ', res.data); + callback(res.data); }) .catch(err => console.log('Unable to GET house inventory items: ', err)); } @@ -46,4 +45,3 @@ } export default HouseInventory; -// ReactDOM.render(<HouseInventory dummyData={dummyData} />, document.getElementById('inventory'));
6075965c50e52c12724295db78dbc9436db1642d
src/app/components/MainSection/index.jsx
src/app/components/MainSection/index.jsx
import React, {Component} from 'react' import muiThemeable from 'material-ui/styles/muiThemeable' import BaseSection from 'app/components/BaseSection' import styled from 'styled-components' const MainSectionWrapper = styled(BaseSection(styled.main))` background-color: ${props => props.theme.palette.canvasColor} width: 100%; `; @muiThemeable() class MainSection extends Component { render() { return ( <MainSectionWrapper theme={this.props.muiTheme}> {this.props.children} </MainSectionWrapper> ) } } export default MainSection
import React, {Component} from 'react' import muiThemeable from 'material-ui/styles/muiThemeable' import BaseSection from 'app/components/BaseSection' import styled from 'styled-components' const MainSectionWrapper = styled(BaseSection(styled.main))` background-color: ${props => props.theme.palette.canvasColor} width: 100%; overflow: hidden; `; @muiThemeable() class MainSection extends Component { render() { return ( <MainSectionWrapper theme={this.props.muiTheme}> {this.props.children} </MainSectionWrapper> ) } } export default MainSection
Fix for short messages list height
Fix for short messages list height
JSX
mit
wasd171/chatinder,wasd171/chatinder,wasd171/chatinder
--- +++ @@ -7,6 +7,7 @@ const MainSectionWrapper = styled(BaseSection(styled.main))` background-color: ${props => props.theme.palette.canvasColor} width: 100%; + overflow: hidden; `; @muiThemeable()
8d782154e7ce9570f689a76b947b71957ec15a36
src/FieldsBinding.jsx
src/FieldsBinding.jsx
import React from 'react'; import PropTypes from 'prop-types'; import * as lib from './helpers'; export default class FieldsBinding extends React.Component { validate(target) { const { schema, formStatus, update } = this.props; lib.startValidating( target, schema, formStatus, update ) } handleOnChange = e => { return this.validate(e.target); }; render() { const names = Object.keys(this.props.schema); const child = React.Children.map(this.props.children, child => { const childName = child.props.name; if (names.includes(childName)) { const { fields } = this.props.formStatus; return React.cloneElement(child, { status: fields[childName].status, hint: fields[childName].errorText, value: fields[childName].value }); } return child; }); return <section onChange={this.handleOnChange}>{child}</section>; } } FieldsBinding.propTypes = { schema: PropTypes.object.isRequired, formStatus: PropTypes.object.isRequired, update: PropTypes.func.isRequired };
import React from 'react'; import PropTypes from 'prop-types'; import * as lib from './helpers'; export default class FieldsBinding extends React.Component { validate(target) { const { schema, formStatus, update } = this.props; lib.startValidating( target, schema, formStatus, update ) } handleOnChange = e => (this.validate(e.target)); render() { const names = Object.keys(this.props.schema); const { fields } = this.props.formStatus; const newChild = React.Children.map(this.props.children, child => { const childName = child.props.name; if (names.includes(childName)) { return React.cloneElement(child, { status: fields[childName].status, hint: fields[childName].errorText, value: fields[childName].value }); } return child; }); return <section onChange={this.handleOnChange}>{newChild}</section>; } } FieldsBinding.propTypes = { schema: PropTypes.object.isRequired, formStatus: PropTypes.object.isRequired, update: PropTypes.func.isRequired, children: PropTypes.any.isRequired };
Update the variable name collision
Update the variable name collision
JSX
mit
Albert-Gao/veasy
--- +++ @@ -8,16 +8,14 @@ lib.startValidating( target, schema, formStatus, update ) } - handleOnChange = e => { - return this.validate(e.target); - }; + handleOnChange = e => (this.validate(e.target)); render() { const names = Object.keys(this.props.schema); - const child = React.Children.map(this.props.children, child => { + const { fields } = this.props.formStatus; + const newChild = React.Children.map(this.props.children, child => { const childName = child.props.name; if (names.includes(childName)) { - const { fields } = this.props.formStatus; return React.cloneElement(child, { status: fields[childName].status, hint: fields[childName].errorText, @@ -26,12 +24,13 @@ } return child; }); - return <section onChange={this.handleOnChange}>{child}</section>; + return <section onChange={this.handleOnChange}>{newChild}</section>; } } FieldsBinding.propTypes = { schema: PropTypes.object.isRequired, formStatus: PropTypes.object.isRequired, - update: PropTypes.func.isRequired + update: PropTypes.func.isRequired, + children: PropTypes.any.isRequired };
ab9ef4583966d08a2ca0b8aa2fea46b6b9f5813b
src/templates/app/resources/asset_index.jsx
src/templates/app/resources/asset_index.jsx
import React from 'react'; const AssetIndex = () => ( <div id='asset_index_wrapper' className='gr-centered gr-12-p gr-12-m'> <h1>{it.L('Asset Index')}</h1> <div className='gr-padding-10'> <p id='errorMsg' className='error-msg invisible' /> <div id='asset-index' className='has-tabs gr-parent' /> <p className='notice-msg center-text invisible' id='empty-asset-index'> {it.L('Asset index is unavailable at this time.')} </p> </div> </div> ); export default AssetIndex;
import React from 'react'; const AssetIndex = () => ( <div id='asset_index_wrapper' className='gr-centered gr-12-p gr-12-m'> <h1>{it.L('Asset Index')}</h1> <div className='gr-padding-10'> <p id='errorMsg' className='error-msg invisible' /> <div id='asset-index' className='has-tabs gr-parent' /> <p className='notice-msg center-text invisible' id='empty-asset-index'> {it.L('Asset index is unavailable in this country. If you have an active [_1] account, please log in for full access.', it.website_name)} </p> </div> </div> ); export default AssetIndex;
Change text for empty asset index table
Change text for empty asset index table
JSX
apache-2.0
4p00rv/binary-static,binary-static-deployed/binary-static,binary-com/binary-static,binary-com/binary-static,binary-static-deployed/binary-static,ashkanx/binary-static,kellybinary/binary-static,ashkanx/binary-static,4p00rv/binary-static,kellybinary/binary-static,kellybinary/binary-static,binary-static-deployed/binary-static,binary-com/binary-static,ashkanx/binary-static,4p00rv/binary-static
--- +++ @@ -7,7 +7,7 @@ <p id='errorMsg' className='error-msg invisible' /> <div id='asset-index' className='has-tabs gr-parent' /> <p className='notice-msg center-text invisible' id='empty-asset-index'> - {it.L('Asset index is unavailable at this time.')} + {it.L('Asset index is unavailable in this country. If you have an active [_1] account, please log in for full access.', it.website_name)} </p> </div> </div>
eea24cec3b357d0ef93a18eb3edcf62e5a83b922
src/app/components/Post/ContentHtml.jsx
src/app/components/Post/ContentHtml.jsx
/* eslint-disable react/no-danger */ 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'); 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'); 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;
Use cors for images if protocol is SSL
Use cors for images if protocol is SSL
JSX
mit
worona/starter-app-theme-worona
--- +++ @@ -1,4 +1,4 @@ -/* eslint-disable react/no-danger */ +/* eslint-disable react/no-danger, no-undef */ import React from 'react'; import cheerio from 'cheerio'; import CaptureLinks from './CaptureLinks'; @@ -7,6 +7,11 @@ 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
f11389d8217ff24ba6b354a28edf013523d63e9d
web/static/js/components/user_list_item.jsx
web/static/js/components/user_list_item.jsx
import React from "react" import * as AppPropTypes from "../prop_types" import styles from "./css_modules/user_list_item.css" const UserListItem = props => { let userName = props.user.given_name const imgSrc = props.user.picture.replace("sz=50", "sz=200") if (props.user.is_facilitator) userName += " (Facilitator)" return ( <li className={`item ${styles.wrapper}`}> <div className="ui center aligned grid"> <img className={styles.picture} src={imgSrc} alt={props.user.given_name} /> <div className="ui row"> <p className={styles.name}>{ userName }</p> <p className={`${styles.ellipsisAnim} ui row`}> { props.user.is_typing && <span> <i className="circle icon" /> <i className="circle icon" /> <i className="circle icon" /> </span> } </p> </div> </div> </li> ) } UserListItem.propTypes = { user: AppPropTypes.user.isRequired, } export default UserListItem
import React from "react" import * as AppPropTypes from "../prop_types" import styles from "./css_modules/user_list_item.css" const UserListItem = ({ user }) => { let givenName = user.given_name const imgSrc = user.picture.replace("sz=50", "sz=200") if (user.is_facilitator) givenName += " (Facilitator)" return ( <li className={`item ${styles.wrapper}`}> <div className="ui center aligned grid"> <img className={styles.picture} src={imgSrc} alt={givenName} /> <div className="ui row"> <p className={styles.name}>{ givenName }</p> <p className={`${styles.ellipsisAnim} ui row`}> { user.is_typing && <span> <i className="circle icon" /> <i className="circle icon" /> <i className="circle icon" /> </span> } </p> </div> </div> </li> ) } UserListItem.propTypes = { user: AppPropTypes.user.isRequired, } export default UserListItem
Refactor UserListItem, leveraging destructuring of arguments to avoid duplication
Refactor UserListItem, leveraging destructuring of arguments to avoid duplication
JSX
mit
stride-nyc/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,samdec11/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro
--- +++ @@ -2,19 +2,19 @@ import * as AppPropTypes from "../prop_types" import styles from "./css_modules/user_list_item.css" -const UserListItem = props => { - let userName = props.user.given_name - const imgSrc = props.user.picture.replace("sz=50", "sz=200") +const UserListItem = ({ user }) => { + let givenName = user.given_name + const imgSrc = user.picture.replace("sz=50", "sz=200") - if (props.user.is_facilitator) userName += " (Facilitator)" + if (user.is_facilitator) givenName += " (Facilitator)" return ( <li className={`item ${styles.wrapper}`}> <div className="ui center aligned grid"> - <img className={styles.picture} src={imgSrc} alt={props.user.given_name} /> + <img className={styles.picture} src={imgSrc} alt={givenName} /> <div className="ui row"> - <p className={styles.name}>{ userName }</p> + <p className={styles.name}>{ givenName }</p> <p className={`${styles.ellipsisAnim} ui row`}> - { props.user.is_typing && + { user.is_typing && <span> <i className="circle icon" /> <i className="circle icon" />
d7814dfec89ab4034300bdd7577d8af835f5fbd5
src/components/shared/breadcrumb/component.jsx
src/components/shared/breadcrumb/component.jsx
"use strict"; var React = require('react') , Immutable = require('immutable') module.exports = React.createClass({ displayName: 'Breadcrumb', propTypes: { crumbs: React.PropTypes.instanceOf(Immutable.List).isRequired }, render: function () { var truncatise = require('truncatise') , lastLabel = this.props.crumbs.last().get('label') if (typeof lastLabel === 'string') { lastLabel = truncatise(lastLabel, { TruncateBy: 'characters', StripHTML: true, Strict: false }); lastLabel = lastLabel.replace(/&#?\d*\.{3}$/, '...'); } return ( <ul className="breadcrumb-top"> { this.props.crumbs.pop().map(crumb => <li key={crumb.hashCode()}> <a href={crumb.get('href')}> {crumb.get('label')} </a> <span className="divider"> {' > '} </span> </li> ) } { typeof lastLabel === 'string' ? <li className="active" dangerouslySetInnerHTML={{ __html: lastLabel }} /> : <li className="active">{ lastLabel }</li> } </ul> ) } });
"use strict"; var React = require('react') , Immutable = require('immutable') module.exports = React.createClass({ displayName: 'Breadcrumb', propTypes: { crumbs: React.PropTypes.instanceOf(Immutable.List).isRequired }, render: function () { var truncatise = require('truncatise') , lastLabel = this.props.crumbs.last().get('label') if (typeof lastLabel === 'string') { lastLabel = truncatise(lastLabel, { TruncateBy: 'characters', StripHTML: true, Strict: false }); lastLabel = lastLabel.replace(/&#?\d*\.{3}$/, '...'); } return ( <ul className="breadcrumb-top"> { this.props.crumbs.pop().map((crumb, i) => <li key={i}> <a href={crumb.get('href')}> {crumb.get('label')} </a> <span className="divider"> {' > '} </span> </li> ) } { typeof lastLabel === 'string' ? <li className="active" dangerouslySetInnerHTML={{ __html: lastLabel }} /> : <li className="active">{ lastLabel }</li> } </ul> ) } });
Fix bug with breadcrumb keys
Fix bug with breadcrumb keys Something was causing server and client rendering of localized breadcrumbs to turn out strangely because of differing keys.
JSX
agpl-3.0
editorsnotes/editorsnotes-renderer
--- +++ @@ -27,8 +27,8 @@ return ( <ul className="breadcrumb-top"> { - this.props.crumbs.pop().map(crumb => - <li key={crumb.hashCode()}> + this.props.crumbs.pop().map((crumb, i) => + <li key={i}> <a href={crumb.get('href')}> {crumb.get('label')} </a>
bc7b47f1e6e43a57bc17d3309f184184d2f89be2
src/app/components/home.jsx
src/app/components/home.jsx
'use strict'; import React from 'react'; import { Link } from 'react-router' import Input from './input.jsx'; import { objectifyForm } from '../helpers/forms'; import { urlSafeString } from '../helpers/strings'; export default class Home extends React.Component { constructor(props) { super(props); this.handleSubmit = this.handleSubmit.bind(this); } handleSubmit (event) { event.preventDefault(); let data = objectifyForm(event.target); data.urlSafeName = urlSafeString(data.mapName); //pass to server //optimistic updates } render () { let lis = this.props.maps.map( (m) => { return ( <li key={m._id}> <Link to={'/maps/' + m.urlSafeName}>{m.mapName}</Link> </li> ); }); return ( <div> <ul> {lis} </ul> <form onSubmit={this.handleSubmit}> <Input name={'mapName'} label={'Map Name:'} /> <Input name={'imagePath'} label={'Image Path:'} /> <button type="submit">Submit</button> </form> </div> ); } } Home.propTypes = { maps: React.PropTypes.arrayOf( React.PropTypes.shape({}) ) };
'use strict'; import React from 'react'; import { Link } from 'react-router' import Input from './input.jsx'; import { objectifyForm } from '../helpers/forms'; import { urlSafeString } from '../helpers/strings'; import MapStore from '../../stores/map-store.jsx'; export default class Home extends React.Component { constructor(props) { super(props); this.handleSubmit = this.handleSubmit.bind(this); } handleSubmit (event) { event.preventDefault(); let map = objectifyForm(event.target); map.urlSafeName = urlSafeString(map.mapName); MapStore.addMap(map); } render () { let lis = this.props.maps.map( (m) => { return ( <li key={m._id}> <Link to={'/maps/' + m.urlSafeName}>{m.mapName}</Link> </li> ); }); return ( <div> <ul> {lis} </ul> <form onSubmit={this.handleSubmit}> <Input name={'mapName'} label={'Map Name:'} /> <Input name={'imagePath'} label={'Image Path:'} /> <button type="submit">Submit</button> </form> </div> ); } } Home.propTypes = { maps: React.PropTypes.arrayOf( React.PropTypes.shape({}) ) };
Add new map to mapstore
Add new map to mapstore
JSX
mit
jkrayer/poc-map-points,jkrayer/poc-map-points
--- +++ @@ -5,6 +5,7 @@ import Input from './input.jsx'; import { objectifyForm } from '../helpers/forms'; import { urlSafeString } from '../helpers/strings'; +import MapStore from '../../stores/map-store.jsx'; export default class Home extends React.Component { constructor(props) { @@ -13,10 +14,9 @@ } handleSubmit (event) { event.preventDefault(); - let data = objectifyForm(event.target); - data.urlSafeName = urlSafeString(data.mapName); - //pass to server - //optimistic updates + let map = objectifyForm(event.target); + map.urlSafeName = urlSafeString(map.mapName); + MapStore.addMap(map); } render () { let lis = this.props.maps.map( (m) => {
9bd3b61f6633878eced588147b2b008593c1e616
js/menu-nested-item.jsx
js/menu-nested-item.jsx
/** * @jsx React.DOM */ var React = require('react'), Classable = require('./mixins/classable.js'), Icon = require('./icon.jsx'), Menu = require('./menu.jsx'); var MenuNestedItem = React.createClass({ mixins: [Classable], propTypes: { key: React.PropTypes.number.isRequired, menuItems: React.PropTypes.array.isRequired, onClick: React.PropTypes.func.isRequired, selected: React.PropTypes.bool }, getDefaultProps: function() { return { Mark: sux }; }, render: function() { var classes = this.getClasses('mui-nested', { //'mui-icon': this.props.icon != null }); return ( <div key={this.props.key} className={classes} onClick={this._onClick}> {this.props.children} <Menu menuItems={this.props.menuItems} zDepth={1} /> </div> ); }, _onClick: function(e) { if (this.props.onClick) this.props.onClick(e, this.props.key); }, }); module.exports = MenuNestedItem;
/** * @jsx React.DOM */ var React = require('react'), Classable = require('./mixins/classable.js'), Icon = require('./icon.jsx'), Menu = require('./menu.jsx'); var MenuNestedItem = React.createClass({ mixins: [Classable], propTypes: { key: React.PropTypes.number.isRequired, menuItems: React.PropTypes.array.isRequired, onClick: React.PropTypes.func.isRequired, selected: React.PropTypes.bool }, getDefaultProps: function() { return { }; }, render: function() { var classes = this.getClasses('mui-nested', { //'mui-icon': this.props.icon != null }); return ( <div key={this.props.key} className={classes} onClick={this._onClick}> {this.props.children} <Menu menuItems={this.props.menuItems} zDepth={1} /> </div> ); }, _onClick: function(e) { if (this.props.onClick) this.props.onClick(e, this.props.key); }, }); module.exports = MenuNestedItem;
Remove test code from nested menu item
Remove test code from nested menu item
JSX
mit
manchesergit/material-ui,mubassirhayat/material-ui,zuren/material-ui,skarnecki/material-ui,whatupdave/material-ui,whatupdave/material-ui,tan-jerene/material-ui,glabcn/material-ui,hesling/material-ui,jeroencoumans/material-ui,demoalex/material-ui,mmrtnz/material-ui,vaiRk/material-ui,tribecube/material-ui,tomgco/material-ui,ashfaqueahmadbari/material-ui,Syncano/material-ui,janmarsicek/material-ui,lawrence-yu/material-ui,jkruder/material-ui,2390183798/material-ui,dsslimshaddy/material-ui,bdsabian/material-ui-old,cloudseven/material-ui,cherniavskii/material-ui,deerawan/material-ui,janmarsicek/material-ui,developer-prosenjit/material-ui,woanversace/material-ui,yh453926638/material-ui,Videri/material-ui,tingi/material-ui,domagojk/material-ui,shaurya947/material-ui,loaf/material-ui,garth/material-ui,bratva/material-ui,pomerantsev/material-ui,owencm/material-ui,zuren/material-ui,tastyeggs/material-ui,JonatanGarciaClavo/material-ui,121nexus/material-ui,zulfatilyasov/material-ui-yearpicker,wdamron/material-ui,freedomson/material-ui,safareli/material-ui,zhengjunwei/material-ui,AllenSH12/material-ui,vmaudgalya/material-ui,matthewoates/material-ui,kabaka/material-ui,barakmitz/material-ui,nevir/material-ui,pradel/material-ui,btmills/material-ui,alitaheri/material-ui,ahlee2326/material-ui,yongxu/material-ui,kasra-co/material-ui,rodolfo2488/material-ui,Unforgiven-wanda/learning-react,frnk94/material-ui,Jonekee/material-ui,wunderlink/material-ui,wustxing/material-ui,zulfatilyasov/material-ui-yearpicker,ddebowczyk/material-ui,oliviertassinari/material-ui,freeslugs/material-ui,pancho111203/material-ui,RickyDan/material-ui,ichiohta/material-ui,kybarg/material-ui,juhaelee/material-ui-io,yulric/material-ui,CumpsD/material-ui,creatorkuang/mui-react,myfintech/material-ui,subjectix/material-ui,Josh-a-e/material-ui,maoziliang/material-ui,zenlambda/material-ui,glabcn/material-ui,19hz/material-ui,Iamronan/material-ui,pomerantsev/material-ui,loki315zx/material-ui,kittyjumbalaya/material-components-web,ashfaqueahmadbari/material-ui,mbrookes/material-ui,manchesergit/material-ui,lightning18/material-ui,oToUC/material-ui,shadowhunter2/material-ui,yinickzhou/material-ui,DenisPostu/material-ui,felipethome/material-ui,VirtueMe/material-ui,mui-org/material-ui,cmpereirasi/material-ui,inoc603/material-ui,freeslugs/material-ui,igorbt/material-ui,patelh18/material-ui,br0r/material-ui,nik4152/material-ui,rscnt/material-ui,MrLeebo/material-ui,oliviertassinari/material-ui,ababol/material-ui,b4456609/pet-new,EcutDavid/material-ui,hybrisCole/material-ui,grovelabs/material-ui,mtsandeep/material-ui,lionkeng/material-ui,XiaonuoGantan/material-ui,pschlette/material-ui-with-sass,alex-dixon/material-ui,tungmv7/material-ui,marnusw/material-ui,allanalexandre/material-ui,gsls1817/material-ui,tirams/material-ui,isakib/material-ui,mui-org/material-ui,ButuzGOL/material-ui,conundrumer/material-ui,AndriusBil/material-ui,cjhveal/material-ui,developer-prosenjit/material-ui,JAStanton/material-ui,JAStanton/material-ui-io,ziad-saab/material-ui,agnivade/material-ui,lionkeng/material-ui,tomrosier/material-ui,chirilo/material-ui,pospisil1/material-ui,ddebowczyk/material-ui,ArcanisCz/material-ui,hiddentao/material-ui,udhayam/material-ui,mit-cml/iot-website-source,pschlette/material-ui-with-sass,insionng/material-ui,Jandersolutions/material-ui,felipeptcho/material-ui,nathanmarks/material-ui,chrxn/material-ui,CumpsD/material-ui,mbrookes/material-ui,andrejunges/material-ui,NogsMPLS/material-ui,hai-cea/material-ui,bdsabian/material-ui-old,mogii/material-ui,meimz/material-ui,AndriusBil/material-ui,lucy-orbach/material-ui,motiz88/material-ui,sarink/material-ui-with-sass,Shiiir/learning-reactjs-first-demo,mjhasbach/material-ui,verdan/material-ui,b4456609/pet-new,oliverfencott/material-ui,mtnk/material-ui,yhikishima/material-ui,callemall/material-ui,ProductiveMobile/material-ui,trendchaser4u/material-ui,tingi/material-ui,juhaelee/material-ui-io,ahlee2326/material-ui,adamlee/material-ui,nahue/material-ui,bright-sparks/material-ui,mui-org/material-ui,wunderlink/material-ui,dsslimshaddy/material-ui,haf/material-ui,MrOrz/material-ui,tastyeggs/material-ui,rscnt/material-ui,NatalieT/material-ui,JsonChiu/material-ui,isakib/material-ui,mjhasbach/material-ui,insionng/material-ui,xiaoking/material-ui,hwo411/material-ui,kebot/material-ui,mobilelife/material-ui,jarno-steeman/material-ui,Qix-/material-ui,drojas/material-ui,callemall/material-ui,WolfspiritM/material-ui,und3fined/material-ui,chrismcv/material-ui,enriqueojedalara/material-ui,arkxu/material-ui,mbrookes/material-ui,ArcanisCz/material-ui,maoziliang/material-ui,Cerebri/material-ui,keokilee/material-ui,JsonChiu/material-ui,nevir/material-ui,ramsey-darling1/material-ui,gaowenbin/material-ui,2947721120/material-ui,mulesoft-labs/material-ui,matthewoates/material-ui,CalebEverett/material-ui,ngbrown/material-ui,rhaedes/material-ui,tyfoo/material-ui,louy/material-ui,arkxu/material-ui,staticinstance/material-ui,Iamronan/material-ui,Saworieza/material-ui,hybrisCole/material-ui,ababol/material-ui,bratva/material-ui,mikedklein/material-ui,rolandpoulter/material-ui,salamer/material-ui,cherniavskii/material-ui,skyflux/material-ui,Yepstr/material-ui,ziad-saab/material-ui,buttercloud/material-ui,hophacker/material-ui,ButuzGOL/material-ui,bgribben/material-ui,callemall/material-ui,w01fgang/material-ui,ludiculous/material-ui,safareli/material-ui,lgollut/material-ui,bright-sparks/material-ui,gobadiah/material-ui,hai-cea/material-ui,w01fgang/material-ui,christopherL91/material-ui,gaowenbin/material-ui,trendchaser4u/material-ui,hellokitty111/material-ui,jacobrosenthal/material-ui,jkruder/material-ui,cjhveal/material-ui,gsklee/material-ui,motiz88/material-ui,mulesoft/material-ui,roderickwang/material-ui,sanemat/material-ui,lastjune/material-ui,Tionx/material-ui,Kagami/material-ui,ilear/material-ui,Saworieza/material-ui,Shiiir/learning-reactjs-first-demo,ghondar/material-ui,br0r/material-ui,yhikishima/material-ui,ntgn81/material-ui,ahmedshuhel/material-ui,JAStanton/material-ui,ichiohta/material-ui,suvjunmd/material-ui,buttercloud/material-ui,mogii/material-ui,tungmv7/material-ui,esleducation/material-ui,verdan/material-ui,mit-cml/iot-website-source,nik4152/material-ui,domagojk/material-ui,AndriusBil/material-ui,mayblue9/material-ui,salamer/material-ui,mmrtnz/material-ui,pospisil1/material-ui,2390183798/material-ui,hiddentao/material-ui,jmknoll/material-ui,Zadielerick/material-ui,izziaraffaele/material-ui,callemall/material-ui,frnk94/material-ui,und3fined/material-ui,ludiculous/material-ui,JAStanton/material-ui-io,elwebdeveloper/material-ui,ilovezy/material-ui,lunohq/material-ui,mit-cml/iot-website-source,igorbt/material-ui,sarink/material-ui-with-sass,ruifortes/material-ui,baiyanghese/material-ui,cpojer/material-ui,inoc603/material-ui,juhaelee/material-ui,Hamstr/material-ui,ahmedshuhel/material-ui,timuric/material-ui,WolfspiritM/material-ui,kwangkim/course-react,AndriusBil/material-ui,Jandersolutions/material-ui,dsslimshaddy/material-ui,freedomson/material-ui,Chuck8080/materialdesign-react,agnivade/material-ui,gsklee/material-ui,mtsandeep/material-ui,marcelmokos/material-ui,bokzor/material-ui,oliviertassinari/material-ui,RickyDan/material-ui,kybarg/material-ui,marwein/material-ui,b4456609/pet-new,checkraiser/material-ui,checkraiser/material-ui,bjfletcher/material-ui,suvjunmd/material-ui,Kagami/material-ui,Kagami/material-ui,spiermar/material-ui,azazdeaz/material-ui,Zeboch/material-ui,kittyjumbalaya/material-components-web,ronlobo/material-ui,owencm/material-ui,Joker666/material-ui,milworm/material-ui,ask-izzy/material-ui,mgibeau/material-ui,grovelabs/material-ui,hwo411/material-ui,janmarsicek/material-ui,rodolfo2488/material-ui,kybarg/material-ui,gitmithy/material-ui,kasra-co/material-ui,ianwcarlson/material-ui,VirtueMe/material-ui,Kagami/material-ui,kybarg/material-ui,lawrence-yu/material-ui,ProductiveMobile/material-ui,mikey2XU/material-ui,cherniavskii/material-ui,cgestes/material-ui,Tionx/material-ui,oliverfencott/material-ui,EllieAdam/material-ui,Qix-/material-ui,unageanu/material-ui,cherniavskii/material-ui,jeroencoumans/material-ui,Lottid/material-ui,chirilo/material-ui,rscnt/material-ui,yinickzhou/material-ui,dsslimshaddy/material-ui,hjmoss/material-ui,milworm/material-ui,MrOrz/material-ui,und3fined/material-ui,juhaelee/material-ui,hellokitty111/material-ui,xiaoking/material-ui,bORm/material-ui,janmarsicek/material-ui,andrejunges/material-ui,wdamron/material-ui,Joker666/material-ui,marwein/material-ui,patelh18/material-ui,Dolmio/material-ui,ilovezy/material-ui,gsls1817/material-ui,pancho111203/material-ui,KevinMcIntyre/material-ui,xmityaz/material-ui,jtollerene/material-ui,tan-jerene/material-ui,JohnnyRockenstein/material-ui,CyberSpace7/material-ui,Josh-a-e/material-ui,ruifortes/material-ui
--- +++ @@ -20,7 +20,6 @@ getDefaultProps: function() { return { - Mark: sux }; },
9300066e4327a27fd4cbf9fab829ca5c3026aa3c
frontend/src/admin/datamodel/components/revisions/TextDiff.jsx
frontend/src/admin/datamodel/components/revisions/TextDiff.jsx
/*eslint-env node */ import React, { Component, PropTypes } from "react"; import { diffWords } from 'diff'; export default class TextDiff extends Component { static propTypes = { diff: PropTypes.object.isRequired }; render() { let { diff: { before, after }} = this.props; return ( <div> " {before != null && after != null ? diffWords(before, after).map((section, index) => section.added ? <strong key={index}>{section.value}</strong> : section.removed ? <span key={index} style={{ textDecoration: "line-through"}}>{section.value}</span> : <span key={index}>{section.value}</span> ) : before != null ? <span style={{ textDecoration: "line-through"}}>{before}</span> : <strong>{after}</strong> } " </div> ); } }
/*eslint-env node */ import React, { Component, PropTypes } from "react"; import { diffWords } from 'diff'; export default class TextDiff extends Component { static propTypes = { diff: PropTypes.object.isRequired }; render() { let { diff: { before, after }} = this.props; return ( <div> " {before != null && after != null ? diffWords(before, after).map((section, index) => <span> {section.added ? <strong key={index}>{section.value}</strong> : section.removed ? <span key={index} style={{ textDecoration: "line-through"}}>{section.value}</span> : <span key={index}>{section.value}</span> }{" "} </span> ) : before != null ? <span style={{ textDecoration: "line-through"}}>{before}</span> : <strong>{after}</strong> } " </div> ); } }
Add spaces in text diffs
Add spaces in text diffs
JSX
agpl-3.0
Endika/metabase,dashkb/metabase,dashkb/metabase,blueoceanideas/metabase,dashkb/metabase,dashkb/metabase,dashkb/metabase,blueoceanideas/metabase,Endika/metabase,Endika/metabase,blueoceanideas/metabase,blueoceanideas/metabase,Endika/metabase,Endika/metabase,blueoceanideas/metabase
--- +++ @@ -16,12 +16,15 @@ " {before != null && after != null ? diffWords(before, after).map((section, index) => - section.added ? + <span> + {section.added ? <strong key={index}>{section.value}</strong> : section.removed ? <span key={index} style={{ textDecoration: "line-through"}}>{section.value}</span> : <span key={index}>{section.value}</span> + }{" "} + </span> ) : before != null ? <span style={{ textDecoration: "line-through"}}>{before}</span>
37adedc040bc28f07c533429894a2c3517f8dfb4
client/src/index.jsx
client/src/index.jsx
import 'aframe'; import 'babel-polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import { Router, Route, browserHistory } from 'react-router'; import App from './components/App.js'; import Home from './components/Home.js'; import Main from './components/Main.js'; ReactDOM.render(( <Router history={browserHistory}> <Route path="/" component={App} > </Route> <Route path="/main" component={Main} > </Route> </Router> ), document.querySelector('.scene-container'));
import 'aframe'; import 'babel-polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import { Router, Route, browserHistory } from 'react-router'; import App from './components/App.js'; import Home from './components/Home.js'; import Main from './components/Main.js'; import Portfolio from './components/Portfolio.js'; import Skills from './components/Skills.js'; import Contact from './components/Contact.js'; import HackerWords from './components/HackerWords.js'; import Immerse from './components/Immerse.js'; import Goolp from './components/Goolp.js'; ReactDOM.render(( <Router history={browserHistory}> <Route path="/" component={App} > <Route path="/portfolio" component={Portfolio} /> <Route path="/skills" component={Skills} /> <Route path="/contact" component={Contact} /> <Route path="/hackerwords" component={HackerWords} /> <Route path="/immerse" component={Immerse} /> <Route path="/goolp" component={Goolp} /> </Route> </Router> ), document.querySelector('.scene-container'));
Modify and add new component routes
Modify and add new component routes
JSX
mit
francoabaroa/happi,francoabaroa/happi
--- +++ @@ -7,12 +7,22 @@ import App from './components/App.js'; import Home from './components/Home.js'; import Main from './components/Main.js'; +import Portfolio from './components/Portfolio.js'; +import Skills from './components/Skills.js'; +import Contact from './components/Contact.js'; +import HackerWords from './components/HackerWords.js'; +import Immerse from './components/Immerse.js'; +import Goolp from './components/Goolp.js'; ReactDOM.render(( <Router history={browserHistory}> <Route path="/" component={App} > - </Route> - <Route path="/main" component={Main} > + <Route path="/portfolio" component={Portfolio} /> + <Route path="/skills" component={Skills} /> + <Route path="/contact" component={Contact} /> + <Route path="/hackerwords" component={HackerWords} /> + <Route path="/immerse" component={Immerse} /> + <Route path="/goolp" component={Goolp} /> </Route> </Router> ), document.querySelector('.scene-container'));
577971256111161885a2b97bf69d97aa2884c58e
src/ObjectivesList.jsx
src/ObjectivesList.jsx
/** * Created by Alvaro on 19/03/2017. */ import React from 'react'; import ReactDOM from 'react-dom'; class ObjectivesList extends React.Component{ constructor(props) { super(props); this.state = { objectives: [] }; // Get a reference to the database service var database = firebase.database(); database.ref('objectives').once('value').then(snapshot => { this.state = { objectives: snapshot.val() }; } ); } getObjectives() { return this.state.objectives.map((objective) => <li className="objectivesList-objectiveEntry">{objective}</li> ); } render() { return ( <ul className="objectivesList"> {this.getObjectives()} </ul> ); } } ReactDOM.render( <ObjectivesList />, document.getElementById('objectivesContainer') );
/** * Created by Alvaro on 19/03/2017. */ import React from 'react'; import ReactDOM from 'react-dom'; var database = firebase.database(); class ObjectivesList extends React.Component{ constructor(props) { super(props); this.state = { objectives: [] }; } componentDidMount() { database.ref('objectives').once('value').then(snapshot => { this.setState({ objectives: snapshot.val() }); } ); } getObjectives() { return this.state.objectives.map((objective) => <li className="objectivesList-objectiveEntry">{objective}</li> ); } render() { return ( <ul className="objectivesList"> {this.getObjectives()} </ul> ); } } ReactDOM.render( <ObjectivesList />, document.getElementById('objectivesContainer') );
Load data fron database when the component is mounted.
Load data fron database when the component is mounted.
JSX
apache-2.0
varomorf/gallu,varomorf/gallu
--- +++ @@ -5,8 +5,9 @@ import React from 'react'; import ReactDOM from 'react-dom'; +var database = firebase.database(); + class ObjectivesList extends React.Component{ - constructor(props) { super(props); @@ -14,23 +15,23 @@ this.state = { objectives: [] }; + } - // Get a reference to the database service - var database = firebase.database(); - + componentDidMount() { database.ref('objectives').once('value').then(snapshot => { - this.state = { + this.setState({ objectives: snapshot.val() - }; + }); } ); + } - } getObjectives() { return this.state.objectives.map((objective) => <li className="objectivesList-objectiveEntry">{objective}</li> ); } + render() { return ( <ul className="objectivesList"> @@ -38,6 +39,7 @@ </ul> ); } + } ReactDOM.render(
0e2d542526c7ca935b535c81748508125ecf1fca
src/components/list.jsx
src/components/list.jsx
import React, { Component, PropTypes } from 'react'; export default class List extends Component { static propTypes = { Item: PropTypes.func.isRequired, items: PropTypes.array.isRequired, onSelect: PropTypes.func.isRequired }; render() { const { Item, items, onSelect } = this.props; return <ul> {items.map((item, index) => <li key={item.id}> <Item {...item} onSelect={() => { onSelect({ index }); }} /> </li> )} </ul>; } }
import React, { Component, PropTypes } from 'react'; export default class List extends Component { static propTypes = { Item: PropTypes.func.isRequired, items: PropTypes.array.isRequired, onSelect: PropTypes.func.isRequired }; render() { const { Item, items, onSelect } = this.props; return <ul> {items.map((item, index) => <li key={index}> <Item {...item} onSelect={() => { onSelect({ index }); }} /> </li> )} </ul>; } }
Use the item index as the React key
Use the item index as the React key This removes the need for the items to have an ID.
JSX
mit
NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet
--- +++ @@ -13,7 +13,7 @@ return <ul> {items.map((item, index) => - <li key={item.id}> + <li key={index}> <Item {...item} onSelect={() => { onSelect({ index }); }} /> </li> )}
b7f2aa4134964e408228ef909ede796941d4d23a
src/components/api_component.jsx
src/components/api_component.jsx
const F = require('fkit') const React = require('react') const createClass = require('create-react-class') const ClassComponent = React.createFactory(require('./class_component')) const ModuleComponent = React.createFactory(require('./module_component')) /** * Represents a HTML page. * * @class PageComponent */ module.exports = createClass({ displayName: 'PageComponent', render: function() { return ( /* jshint ignore:start */ <section className="api"> <section className="index"> <h1>{this.props.title}</h1> <ul>{this.renderIndex()}</ul> </section> {this.renderModules(this.props.modules)} {this.renderClasses(this.props.classes)} </section> /* jshint ignore:end */ ); }, renderIndex: function() { return F.map(this.renderAnchor, F.concat(this.props.modules, this.props.classes)); }, renderAnchor: function(item) { return ( /* jshint ignore:start */ <li key={item.key}><a href={'#' + item.name}>{item.name}</a></li> /* jshint ignore:end */ ); }, renderClasses: F.map(ClassComponent), renderModules: F.map(ModuleComponent), });
const F = require('fkit') const React = require('react') const createClass = require('create-react-class') const ClassComponent = React.createFactory(require('./class_component')) const ModuleComponent = React.createFactory(require('./module_component')) /** * Represents a HTML page. * * @class PageComponent */ module.exports = createClass({ displayName: 'PageComponent', render: function() { return ( /* jshint ignore:start */ <section className="api"> <section className="index"> <h1>{this.props.title}</h1> <ul>{this.renderIndex()}</ul> </section> {this.renderModules(this.props.modules)} {this.renderClasses(this.props.classes)} </section> /* jshint ignore:end */ ); }, renderIndex: function() { return F.map(this.renderAnchor, F.concat(this.props.modules, this.props.classes)); }, renderAnchor: function(item) { return ( /* jshint ignore:start */ <li key={item.key}><a href={'#' + item.name}>{item.name} &mdash; {item.summary}</a></li> /* jshint ignore:end */ ); }, renderClasses: F.map(ClassComponent), renderModules: F.map(ModuleComponent), });
Add summaries back to the API index
Add summaries back to the API index
JSX
mit
nullobject/jsdoc-react
--- +++ @@ -35,7 +35,7 @@ renderAnchor: function(item) { return ( /* jshint ignore:start */ - <li key={item.key}><a href={'#' + item.name}>{item.name}</a></li> + <li key={item.key}><a href={'#' + item.name}>{item.name} &mdash; {item.summary}</a></li> /* jshint ignore:end */ ); },
24e71f9901746de0c1c512b7078747578661caed
src/components/chat_message/message_list.jsx
src/components/chat_message/message_list.jsx
import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import MessageListItem from './message_list_item'; import {mapObject} from '../../utils' import {ListGroup} from 'react-bootstrap'; export default class MessageList extends Component { constructor(props) { super(props); } scrollToBottom() { this.refs.msgList.scrollTop = 99999; } componentDidUpdate(prevProps) { if (prevProps.messages.length !== this.props.messages.length || prevProps.thread != this.props.thread || new Date(_.last(prevProps.messages).time) !== new Date(_.last(this.props.messages).time)) { this.scrollToBottom(); } } componentDidMount() { this.scrollToBottom(); } renderChatListItem(index, message) { return ( <MessageListItem key={index} text={message.msg} user={message.user} picture={message.picture} uid={message.playerId} event_type={message.event_type} time={message.time} /> ); } render() { const { messages } = this.props; return ( <div ref="msgList" className="chatbox-message-list"> <ListGroup> {mapObject(messages, this.renderChatListItem)} </ListGroup> </div> ); } }
import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import MessageListItem from './message_list_item'; import {mapObject} from '../../utils' import {ListGroup} from 'react-bootstrap'; export default class MessageList extends Component { constructor(props) { super(props); } scrollToBottom() { this.refs.msgList.scrollTop = 99999; } componentDidUpdate(prevProps) { function lastMessageTime(props) { return (new Date(_.last(props.messages).time)).getTime(); } if (prevProps.messages.length !== this.props.messages.length || prevProps.thread != this.props.thread || lastMessageTime(prevProps) !== lastMessageTime(this.props)) { this.scrollToBottom(); } } componentDidMount() { this.scrollToBottom(); } renderChatListItem(index, message) { return ( <MessageListItem key={index} text={message.msg} user={message.user} picture={message.picture} uid={message.playerId} event_type={message.event_type} time={message.time} /> ); } render() { const { messages } = this.props; return ( <div ref="msgList" className="chatbox-message-list"> <ListGroup> {mapObject(messages, this.renderChatListItem)} </ListGroup> </div> ); } }
Fix comparing times for chat scrolling
Fix comparing times for chat scrolling
JSX
mit
johnnyvf24/hellochess-v2,johnnyvf24/hellochess-v2,johnnyvf24/hellochess-v2
--- +++ @@ -15,9 +15,12 @@ } componentDidUpdate(prevProps) { + function lastMessageTime(props) { + return (new Date(_.last(props.messages).time)).getTime(); + } if (prevProps.messages.length !== this.props.messages.length || prevProps.thread != this.props.thread || - new Date(_.last(prevProps.messages).time) !== new Date(_.last(this.props.messages).time)) { + lastMessageTime(prevProps) !== lastMessageTime(this.props)) { this.scrollToBottom(); } }
323a43761a7c27f46a2e1805c455f7cebf01b2a7
src/components/Navbar.jsx
src/components/Navbar.jsx
import React from 'react'; import AppBar from 'material-ui/AppBar'; import FlatButton from 'material-ui/FlatButton'; const navButtonsContainerStyles = { 'marginTop': 0, 'display': 'flex', 'justifyContent': 'center', 'alignItems': 'center' }; const navButtonsStyles = { 'color': "#fff", }; const NavButtons = () => { return ( <div> <FlatButton label="Home" style={ navButtonsStyles }/> <FlatButton label="Weather" style={ navButtonsStyles }/> <FlatButton label="About" style={ navButtonsStyles }/> </div> ); } class Navbar extends React.Component { render () { return ( <AppBar title="React Weather App" showMenuIconButton={false} iconElementRight={ <NavButtons /> } iconStyleRight={ navButtonsContainerStyles }/> ); } } export default Navbar;
import React from 'react'; import { Link, IndexLink } from 'react-router'; import AppBar from 'material-ui/AppBar'; import FlatButton from 'material-ui/FlatButton'; const navButtonsContainerStyles = { 'marginTop': 0, 'display': 'flex', 'justifyContent': 'center', 'alignItems': 'center' }; const navButtonsStyles = { 'color': "#fff", }; const NavButtons = () => { return ( <div> <FlatButton label="Get Weather" style={ navButtonsStyles } activeClassName="active" containerElement={ <IndexLink to="/" /> }/> <FlatButton label="About" style={ navButtonsStyles } activeClassName="active" containerElement={ <Link to="/about" /> }/> <FlatButton label="Examples" style={ navButtonsStyles } activeClassName="active" containerElement={ <Link to="/examples" /> }/> </div> ); } class Navbar extends React.Component { render () { return ( <AppBar title="React Weather App" showMenuIconButton={false} iconElementRight={ <NavButtons /> } iconStyleRight={ navButtonsContainerStyles }/> ); } } export default Navbar;
Integrate Link routes with the current nav buttons
Integrate Link routes with the current nav buttons
JSX
mit
juanhenriquez/react-weather-app,juanhenriquez/react-weather-app
--- +++ @@ -1,4 +1,5 @@ import React from 'react'; +import { Link, IndexLink } from 'react-router'; import AppBar from 'material-ui/AppBar'; import FlatButton from 'material-ui/FlatButton'; @@ -17,9 +18,23 @@ const NavButtons = () => { return ( <div> - <FlatButton label="Home" style={ navButtonsStyles }/> - <FlatButton label="Weather" style={ navButtonsStyles }/> - <FlatButton label="About" style={ navButtonsStyles }/> + <FlatButton + label="Get Weather" + style={ navButtonsStyles } + activeClassName="active" + containerElement={ <IndexLink to="/" /> }/> + + <FlatButton + label="About" + style={ navButtonsStyles } + activeClassName="active" + containerElement={ <Link to="/about" /> }/> + + <FlatButton + label="Examples" + style={ navButtonsStyles } + activeClassName="active" + containerElement={ <Link to="/examples" /> }/> </div> ); }
99d57e6363f2c62963611fb115f7277fca0cda90
packages/_demo/src/ButtonDemo.jsx
packages/_demo/src/ButtonDemo.jsx
import Button from '@react-material/button'; import React from 'react'; const ButtonDemo = () => <div> <h1>Button</h1> {Object.entries({ light: '', dark: 'mdc-theme--dark', }).map(([themeName, themeStyleClassName]) => <div key={themeName}> <h2>{themeName} theme</h2> <section className={themeStyleClassName}> {[true, false].map(isEnabled => <fieldset key={isEnabled} disabled={!isEnabled}> <legend>{isEnabled ? 'Enabled' : 'Disabled'}</legend> <Button>Default</Button> <Button raised>Raised</Button> <Button dense>Dense Default</Button> <Button dense raised>Dense Raised</Button> <Button compact>Compact</Button> <Button compact raised>Compact Raised</Button> <Button primary>Default with Primary</Button> <Button raised primary>Raised with Primary</Button> <Button accent>Default with Accent</Button> <Button raised accent>Raised with Accent</Button> </fieldset>, )} </section> </div>, )} </div> ; export default ButtonDemo;
import Button from '@react-material/button'; import React from 'react'; const ButtonDemo = () => <div> <h1>Button</h1> {[ ['light', ''], ['dark', 'mdc-theme--dark'], ].map(([themeName, themeStyleClassName]) => <div key={themeName}> <h2>{themeName} theme</h2> <section className={themeStyleClassName}> {[true, false].map(isEnabled => <fieldset key={isEnabled} disabled={!isEnabled}> <legend>{isEnabled ? 'Enabled' : 'Disabled'}</legend> <Button>Default</Button> <Button raised>Raised</Button> <Button dense>Dense Default</Button> <Button dense raised>Dense Raised</Button> <Button compact>Compact</Button> <Button compact raised>Compact Raised</Button> <Button primary>Default with Primary</Button> <Button raised primary>Raised with Primary</Button> <Button accent>Default with Accent</Button> <Button raised accent>Raised with Accent</Button> </fieldset>, )} </section> </div>, )} </div> ; export default ButtonDemo;
Fix CI support for older Node versions
ci(fix): Fix CI support for older Node versions
JSX
mit
kripod/material-components-react,kripod/material-components-react
--- +++ @@ -5,10 +5,10 @@ <div> <h1>Button</h1> - {Object.entries({ - light: '', - dark: 'mdc-theme--dark', - }).map(([themeName, themeStyleClassName]) => + {[ + ['light', ''], + ['dark', 'mdc-theme--dark'], + ].map(([themeName, themeStyleClassName]) => <div key={themeName}> <h2>{themeName} theme</h2> <section className={themeStyleClassName}>
a13a2e448ff40f16dbcf2f1d9f3f3f30a432be21
src/app/containers/ScriptListContainer.jsx
src/app/containers/ScriptListContainer.jsx
import { ScriptList } from '../components/'; import { connect } from 'react-redux'; import { scripts, app } from '../actions/' const mapStateToProps = (state) => { return { scripts: state.scripts.scripts, show: !state.app.showAddDialog } } const mapDispatchToProps = (dispatch) => { return { onScriptClick: (src) => { dispatch(scripts.toggleScript(src)) } } } const VisibleScriptList = connect ( mapStateToProps, mapDispatchToProps )( ScriptList ); export default VisibleScriptList;
import { ScriptList } from '../components/'; import { connect } from 'react-redux'; import { scripts, app } from '../actions/' const mapStateToProps = (state) => { return { scripts: state.scripts.scripts, show: !state.app.showAddDialog } } const mapDispatchToProps = (dispatch) => { return { onScriptClick: (src) => { dispatch(scripts.toggleScript(src)) }, onAddScriptClick: () => { dispatch(app.toggleAddDialog()); } } } const VisibleScriptList = connect ( mapStateToProps, mapDispatchToProps )( ScriptList ); export default VisibleScriptList;
Add dispatch function to view the add script view to scriptlist
Add dispatch function to view the add script view to scriptlist
JSX
mit
simonlovesyou/AutoRobot
--- +++ @@ -13,6 +13,9 @@ return { onScriptClick: (src) => { dispatch(scripts.toggleScript(src)) + }, + onAddScriptClick: () => { + dispatch(app.toggleAddDialog()); } } }
e5b1717a91faee78ff42f792c6df048938a45c6d
src/js/components/refugee-main-content.jsx
src/js/components/refugee-main-content.jsx
var React = require('react'); var Decorator = require('./refugee-context-decorator.jsx'); var RefugeeMapSegment = require('./refugee-map/refugee-map-segment.jsx'); var RefugeeSankeySegment = require('./refugee-sankey/refugee-sankey-segment.jsx'); var RefugeeMainContent = React.createClass({ render: function() { window.pp = this.props; return ( <div className="refugee-main-content"> <RefugeeSankeySegment {...this.props} /> </div> ); } }); /* <RefugeeMapSegment {...this.props} /> */ module.exports = Decorator(RefugeeMainContent);
var React = require('react'); var Decorator = require('./refugee-context-decorator.jsx'); var RefugeeMapSegment = require('./refugee-map/refugee-map-segment.jsx'); var RefugeeSankeySegment = require('./refugee-sankey/refugee-sankey-segment.jsx'); var RefugeeMainContent = React.createClass({ render: function() { window.pp = this.props; return ( <div className="refugee-main-content"> <RefugeeMapSegment {...this.props} /> <RefugeeSankeySegment {...this.props} /> </div> ); } }); /* */ module.exports = Decorator(RefugeeMainContent);
Add refugee map segment that was accidently removed
Add refugee map segment that was accidently removed
JSX
mit
lucified/lucify-refugees,lucified/lucify-refugees,lucified/lucify-refugees,lucified/lucify-refugees
--- +++ @@ -16,8 +16,8 @@ <div className="refugee-main-content"> - - + <RefugeeMapSegment {...this.props} /> + <RefugeeSankeySegment {...this.props} /> </div> @@ -29,7 +29,7 @@ }); /* - <RefugeeMapSegment {...this.props} /> + */ module.exports = Decorator(RefugeeMainContent);
26a69481b0653e294645b76e8fe4bbb63d295683
application/welcome.jsx
application/welcome.jsx
import React from "react"; export default class Welcome extends React.Component { render () { return <div className="primary-app"> <h2>Welcome!</h2> <p> Use this site to manage your usage of GitHub repositories for W3C projects. </p> </div> ; } }
import React from "react"; export default class Welcome extends React.Component { render () { return <div className="primary-app"> <h2>Welcome!</h2> <p> Use this site to <a href="https://w3c.github.io/repo-management.html">manage IPR of contributions made to GitHub repositories for W3C specifications</a> . </p> </div> ; } }
Clarify goal of tool and link to documentation
Clarify goal of tool and link to documentation close #86
JSX
mit
w3c/ash-nazg,w3c/ash-nazg
--- +++ @@ -6,8 +6,8 @@ return <div className="primary-app"> <h2>Welcome!</h2> <p> - Use this site to manage your usage of GitHub repositories for W3C - projects. + Use this site to <a href="https://w3c.github.io/repo-management.html">manage IPR of contributions made to GitHub repositories for W3C specifications</a> + . </p> </div> ;
e8030c8b2400100e77bd7214e286c4a111105441
dashboards/api.jsx
dashboards/api.jsx
var React = require('react'); var Dashboard = require('tiler').Dashboard; var ListTile = require('../../node-tiler-contrib-list-tile/components/ListTile.jsx'); var breakpoints = {lg: 1200, md: 996, sm: 768, xs: 480}; var cols = {lg: 12, md: 10, sm: 8, xs: 4}; React.render( <Dashboard breakpoints={breakpoints} cols={cols} rowHeight={30}> <ListTile key={2} _grid={{x: 0, y: 0, w: 8, h: 26}} title={'Metrics'} ordered={false} query={{ metric: {label: 'name'}, point: {label: 'time', value: 'value'}, from: 'examples.api' }} /> </Dashboard>, document.getElementById('content') );
var React = require('react'); var Dashboard = require('tiler').Dashboard; var ListTile = require('tiler-contrib-list-tile'); var breakpoints = {lg: 1200, md: 996, sm: 768, xs: 480}; var cols = {lg: 12, md: 10, sm: 8, xs: 4}; React.render( <Dashboard breakpoints={breakpoints} cols={cols} rowHeight={30}> <ListTile key={2} _grid={{x: 0, y: 0, w: 8, h: 26}} title={'Metrics'} ordered={false} query={{ metric: {label: 'name'}, point: {label: 'time', value: 'value'}, from: 'examples.api' }} /> </Dashboard>, document.getElementById('content') );
Correct path to list tile
Correct path to list tile
JSX
mit
simondean/squarely-vertx-spike,simondean/squarely-vertx-spike,simondean/squarely-vertx-spike,simondean/squarely-vertx-spike
--- +++ @@ -1,6 +1,6 @@ var React = require('react'); var Dashboard = require('tiler').Dashboard; -var ListTile = require('../../node-tiler-contrib-list-tile/components/ListTile.jsx'); +var ListTile = require('tiler-contrib-list-tile'); var breakpoints = {lg: 1200, md: 996, sm: 768, xs: 480}; var cols = {lg: 12, md: 10, sm: 8, xs: 4};
2182d465cbeeedd5225487b1c5ba1bec1e9b2713
examples/react-chayns-signature/Example.jsx
examples/react-chayns-signature/Example.jsx
import React from 'react'; import Signature from '../../src/react-chayns-signature/component/Signature'; const SignatureExample = () => ( <Signature onSubscribe={() => chayns.dialog.toast({ description: 'Unterschrieben', duration: 3000, }) } /> ); export default SignatureExample;
import React from 'react'; import Signature from '../../src/react-chayns-signature/component/Signature'; const SignatureExample = () => ( <Signature onSubscribe={() => chayns.dialog.toast({ description: 'Unterschrieben', duration: 3000, }) } onEdit={(e) => console.log('edit', e)} /> ); export default SignatureExample;
Add onEdit to signature example
Add onEdit to signature example
JSX
mit
TobitSoftware/chayns-components,TobitSoftware/chayns-components,TobitSoftware/chayns-components
--- +++ @@ -9,6 +9,7 @@ duration: 3000, }) } + onEdit={(e) => console.log('edit', e)} /> );
058384ecca96911d3bb351fcf189d7fe0335fd47
test/AvailableTimes-test.jsx
test/AvailableTimes-test.jsx
import { mount } from 'enzyme'; import React from 'react'; import AvailableTimes from '../src/AvailableTimes'; import CalendarSelector from '../src/CalendarSelector'; it('works with no props', () => { expect(() => mount(<AvailableTimes />)).not.toThrowError(); }); it('does not render a calendar selector', () => { expect(mount(<AvailableTimes />).find(CalendarSelector).length).toBe(0); }); describe('with calendars', () => { it('does not render a calendar selector', () => { expect(mount(<AvailableTimes calendars={[{ id: '1' }]} />) .find(CalendarSelector).length).toBe(1); }); });
import { mount } from 'enzyme'; import React from 'react'; import AvailableTimes from '../src/AvailableTimes'; import CalendarSelector from '../src/CalendarSelector'; import Week from '../src/Week'; describe('without props', () => { it('works with no props', () => { expect(() => mount(<AvailableTimes />)).not.toThrowError(); }); it('does not render a calendar selector', () => { expect(mount(<AvailableTimes />).find(CalendarSelector).length).toBe(0); }); it('has days from sunday-saturday', () => { expect(mount(<AvailableTimes />).find(Week).first().text()).toMatch(/Sun.*Mon.*Tue/) expect(mount(<AvailableTimes />).find(Week).first().text()).not.toMatch(/Sat.*Sun/) }); }); describe('with weekStartsOn=monday', () => { const week = mount(<AvailableTimes weekStartsOn='monday' />).find(Week).first(); expect(week.text()).not.toMatch(/Sun.*Mon.*Tue/) expect(week.text()).toMatch(/Sat.*Sun/) }); describe('with calendars', () => { it('renders a calendar selector', () => { expect(mount(<AvailableTimes calendars={[{ id: '1' }]} />) .find(CalendarSelector).length).toBe(1); }); });
Add test for weekStartsOn prop
Add test for weekStartsOn prop
JSX
mit
trotzig/react-available-times,trotzig/react-available-times
--- +++ @@ -3,17 +3,31 @@ import AvailableTimes from '../src/AvailableTimes'; import CalendarSelector from '../src/CalendarSelector'; +import Week from '../src/Week'; -it('works with no props', () => { - expect(() => mount(<AvailableTimes />)).not.toThrowError(); +describe('without props', () => { + it('works with no props', () => { + expect(() => mount(<AvailableTimes />)).not.toThrowError(); + }); + + it('does not render a calendar selector', () => { + expect(mount(<AvailableTimes />).find(CalendarSelector).length).toBe(0); + }); + + it('has days from sunday-saturday', () => { + expect(mount(<AvailableTimes />).find(Week).first().text()).toMatch(/Sun.*Mon.*Tue/) + expect(mount(<AvailableTimes />).find(Week).first().text()).not.toMatch(/Sat.*Sun/) + }); }); -it('does not render a calendar selector', () => { - expect(mount(<AvailableTimes />).find(CalendarSelector).length).toBe(0); +describe('with weekStartsOn=monday', () => { + const week = mount(<AvailableTimes weekStartsOn='monday' />).find(Week).first(); + expect(week.text()).not.toMatch(/Sun.*Mon.*Tue/) + expect(week.text()).toMatch(/Sat.*Sun/) }); describe('with calendars', () => { - it('does not render a calendar selector', () => { + it('renders a calendar selector', () => { expect(mount(<AvailableTimes calendars={[{ id: '1' }]} />) .find(CalendarSelector).length).toBe(1); });
023b7a708c5efc438aadb33b5bc5f7e2a6e0feb6
src/components/CircuitCanvas.jsx
src/components/CircuitCanvas.jsx
import React from 'react'; import ReactArt from 'react-art'; import Colors from '../styles/Colors.js'; var Surface = ReactArt.Surface; export default class CircuitCanvas extends React.Component { constructor(props) { super(props); } render() { const elements = this.props.elements.map(function(element) { const props = Object.assign({key: element.id}, element.props); return React.createElement(element.component, props); }); return ( <div style={{padding: 0, margin: 0, border: 0}} onClick={this.props.clickHandler}> <Surface width={this.props.width} height={this.props.height} style={{display: 'block', backgroundColor: Colors.background}} > {elements} </Surface> </div> ); } } CircuitCanvas.defaultProps = { width: 700, height: 700, elements: [] }; CircuitCanvas.propTypes = { width: React.PropTypes.number, height: React.PropTypes.number, elements: React.PropTypes.arrayOf( React.PropTypes.shape({ id: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.number ]).isRequired, component: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.func // ReactClass is a function (could do better checking here) ]).isRequired, props: React.PropTypes.object })) };
import React from 'react'; import ReactArt from 'react-art'; import Colors from '../styles/Colors.js'; var Surface = ReactArt.Surface; export default class CircuitCanvas extends React.Component { constructor(props) { super(props); } render() { const elements = this.props.elements.map(function(element) { // https://facebook.github.io/react/docs/multiple-components.html#dynamic-children const props = Object.assign({key: element.id}, element.props); return React.createElement(element.component, props); }); return ( <div style={{padding: 0, margin: 0, border: 0}} onClick={this.props.clickHandler}> <Surface width={this.props.width} height={this.props.height} style={{display: 'block', backgroundColor: Colors.background}} > {elements} </Surface> </div> ); } } CircuitCanvas.defaultProps = { width: 700, height: 700, elements: [] }; CircuitCanvas.propTypes = { width: React.PropTypes.number, height: React.PropTypes.number, elements: React.PropTypes.arrayOf( React.PropTypes.shape({ id: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.number ]).isRequired, component: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.func // ReactClass is a function (could do better checking here) ]).isRequired, props: React.PropTypes.object })) };
Add comment linking to React doc on child keys
Add comment linking to React doc on child keys
JSX
epl-1.0
circuitsim/circuit-simulator,circuitsim/circuit-simulator,circuitsim/circuit-simulator
--- +++ @@ -13,6 +13,7 @@ render() { const elements = this.props.elements.map(function(element) { + // https://facebook.github.io/react/docs/multiple-components.html#dynamic-children const props = Object.assign({key: element.id}, element.props); return React.createElement(element.component, props); });
4f23ec1778397ad5b4c1e9c6143101dec1351012
src/components/FilenameInput.jsx
src/components/FilenameInput.jsx
import React, { Component } from 'react' const ENTER_KEY = 'Enter' export default class FilenameInput extends Component { constructor (props) { super(props) this.state = { value: props.name || '' } } componentDidMount () { this.textInput.focus() } handleKeyPress (e) { if (e.key === ENTER_KEY) { this.submit() this.setState({ value: '' }) } } handleChange (e) { this.setState({ value: e.target.value }) } submit () { this.props.onSubmit(this.state.value) } render ({ isUpdating }, { value }) { return ( <input type='text' value={value} ref={(input) => { this.textInput = input }} disabled={isUpdating} onChange={e => this.handleChange(e)} onKeyPress={e => this.handleKeyPress(e)} /> ) } }
import React, { Component } from 'react' const ENTER_KEY = 13 export default class FilenameInput extends Component { constructor (props) { super(props) this.state = { value: props.name || '' } } componentDidMount () { this.textInput.focus() } handleKeyPress (e) { if (e.keyCode === ENTER_KEY) { this.submit() this.setState({ value: '' }) } } handleChange (e) { this.setState({ value: e.target.value }) } submit () { this.props.onSubmit(this.state.value) } render ({ isUpdating }, { value }) { return ( <input type='text' value={value} ref={(input) => { this.textInput = input }} disabled={isUpdating} onChange={e => this.handleChange(e)} onKeyPress={e => this.handleKeyPress(e)} /> ) } }
Fix enter key on safari :bug:
Fix enter key on safari :bug: KeyboardEvent.key is not supported on safari: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
JSX
agpl-3.0
y-lohse/cozy-drive,goldoraf/cozy-drive,enguerran/cozy-drive,nono/cozy-files-v3,enguerran/cozy-files-v3,cozy/cozy-files-v3,goldoraf/cozy-drive,cozy/cozy-files-v3,nono/cozy-files-v3,y-lohse/cozy-files-v3,y-lohse/cozy-drive,y-lohse/cozy-drive,nono/cozy-files-v3,cozy/cozy-files-v3,goldoraf/cozy-drive,cozy/cozy-files-v3,y-lohse/cozy-drive,enguerran/cozy-files-v3,goldoraf/cozy-drive,y-lohse/cozy-files-v3,enguerran/cozy-files-v3,y-lohse/cozy-files-v3,nono/cozy-files-v3,enguerran/cozy-drive,enguerran/cozy-files-v3,enguerran/cozy-drive,enguerran/cozy-drive
--- +++ @@ -1,6 +1,6 @@ import React, { Component } from 'react' -const ENTER_KEY = 'Enter' +const ENTER_KEY = 13 export default class FilenameInput extends Component { constructor (props) { @@ -15,7 +15,7 @@ } handleKeyPress (e) { - if (e.key === ENTER_KEY) { + if (e.keyCode === ENTER_KEY) { this.submit() this.setState({ value: '' }) }
9e5a74bfa1c676dca4994238ae224e8fe3a203fd
src/component/strategies/list-component.jsx
src/component/strategies/list-component.jsx
import React, { Component } from 'react'; import { List, ListItem, ListItemContent, Icon, IconButton, Chip } from 'react-mdl'; import style from './strategies.scss'; class StrategiesListComponent extends Component { static contextTypes = { router: React.PropTypes.object, } componentDidMount () { this.props.fetchStrategies(); } getParameterMap ({ parametersTemplate }) { return Object.keys(parametersTemplate || {}).map(k => ( <Chip key={k}><small>{k}</small></Chip> )); } render () { const { strategies, removeStrategy } = this.props; return ( <div> <h5>Strategies</h5> <IconButton name="add" onClick={() => this.context.router.push('/strategies/create')} title="Add new strategy"/> <hr /> <List> {strategies.length > 0 ? strategies.map((strategy, i) => { return ( <ListItem key={i}> <ListItemContent><strong>{strategy.name}</strong> {strategy.description}</ListItemContent> <IconButton name="delete" onClick={() => removeStrategy(strategy)} /> </ListItem> ); }) : <ListItem>No entries</ListItem>} </List> </div> ); } } export default StrategiesListComponent;
import React, { Component } from 'react'; import { Link } from 'react-router'; import { List, ListItem, ListItemContent, IconButton, Chip } from 'react-mdl'; class StrategiesListComponent extends Component { static contextTypes = { router: React.PropTypes.object, } componentDidMount () { this.props.fetchStrategies(); } getParameterMap ({ parametersTemplate }) { return Object.keys(parametersTemplate || {}).map(k => ( <Chip key={k}><small>{k}</small></Chip> )); } render () { const { strategies, removeStrategy } = this.props; return ( <div> <h5>Strategies</h5> <IconButton name="add" onClick={() => this.context.router.push('/strategies/create')} title="Add new strategy"/> <hr /> <List> {strategies.length > 0 ? strategies.map((strategy, i) => { return ( <ListItem key={i}> <ListItemContent> <Link to={`/strategies/view/${strategy.name}`}> <strong>{strategy.name}</strong> </Link> <span> {strategy.description}</span></ListItemContent> <IconButton name="delete" onClick={() => removeStrategy(strategy)} /> </ListItem> ); }) : <ListItem>No entries</ListItem>} </List> </div> ); } } export default StrategiesListComponent;
Make strategy list as links
Make strategy list as links
JSX
apache-2.0
Unleash/unleash-frontend,Unleash/unleash-frontend,Unleash/unleash-frontend,Unleash/unleash-frontend
--- +++ @@ -1,8 +1,7 @@ import React, { Component } from 'react'; +import { Link } from 'react-router'; -import { List, ListItem, ListItemContent, Icon, IconButton, Chip } from 'react-mdl'; - -import style from './strategies.scss'; +import { List, ListItem, ListItemContent, IconButton, Chip } from 'react-mdl'; class StrategiesListComponent extends Component { @@ -33,7 +32,11 @@ {strategies.length > 0 ? strategies.map((strategy, i) => { return ( <ListItem key={i}> - <ListItemContent><strong>{strategy.name}</strong> {strategy.description}</ListItemContent> + <ListItemContent> + <Link to={`/strategies/view/${strategy.name}`}> + <strong>{strategy.name}</strong> + </Link> + <span> {strategy.description}</span></ListItemContent> <IconButton name="delete" onClick={() => removeStrategy(strategy)} /> </ListItem> );
f105b7d52dfcde81397d3e23b2eba462a6aa03fe
demos/index.jsx
demos/index.jsx
'use strict' import React from 'react' import {Route, IndexRedirect, IndexRoute, Link} from 'react-router' import Scratchpad from './scratchpad' import Whiteboard from './whiteboard' import Chat from './chat' const Index = ({children}) => <div> <h1>Demos!</h1> <h2><Link to='demos/scratchpad/welcome'>Scratchpad</Link></h2> <p> The scratchpad is the very simplest React/Firebase demo—a text area whose content is synced with Firebase. </p> <h2><Link to='demos/chat/welcome'>Chat</Link></h2> <p> A chat room — the canonical Firebase example. </p> <h2><Link to='demos/whiteboard/welcome'>Whiteboard</Link></h2> <p> The whiteboard demonstrates the <i>journal</i> pattern, a way to use Firebase to synchronize the state of Redux stores on all collaborators machines. </p> </div> export default <Route path="/demos" component={({children}) => children}> <IndexRoute component={Index}/> <Route path='scratchpad/:title' component={Scratchpad}/> <Route path='whiteboard/:title' component={Whiteboard}/> <Route path='chat/:room' component={Chat}/> </Route>
'use strict' import React from 'react' import {Route, IndexRedirect, IndexRoute, Link} from 'react-router' import Scratchpad from './scratchpad' import Whiteboard from './whiteboard' import Chat from './chat' const Index = ({children}) => <div> <h1>Demos!</h1> <h2><Link to='/demos/scratchpad/welcome'>Scratchpad</Link></h2> <p> The scratchpad is the very simplest React/Firebase demo—a text area whose content is synced with Firebase. </p> <h2><Link to='/demos/chat/welcome'>Chat</Link></h2> <p> A chat room — the canonical Firebase example. </p> <h2><Link to='/demos/whiteboard/welcome'>Whiteboard</Link></h2> <p> The whiteboard demonstrates the <i>journal</i> pattern, a way to use Firebase to synchronize the state of Redux stores on all collaborators machines. </p> </div> export default <Route path="/demos" component={({children}) => children}> <IndexRoute component={Index}/> <Route path='scratchpad/:title' component={Scratchpad}/> <Route path='whiteboard/:title' component={Whiteboard}/> <Route path='chat/:room' component={Chat}/> </Route>
Make links on demo page absolute paths to end the madness.
Make links on demo page absolute paths to end the madness.
JSX
mit
pandemic-1707/pandemic-1707,Attune-GH/attune,pandemic-1707/pandemic-1707,pandemic-1707/pandemic-1707,Myach-FSA/Capstone,Myach-FSA/Capstone,Attune-GH/attune,Myach-FSA/Capstone,Attune-GH/attune
--- +++ @@ -8,18 +8,18 @@ const Index = ({children}) => <div> <h1>Demos!</h1> - <h2><Link to='demos/scratchpad/welcome'>Scratchpad</Link></h2> + <h2><Link to='/demos/scratchpad/welcome'>Scratchpad</Link></h2> <p> The scratchpad is the very simplest React/Firebase demo—a text area whose content is synced with Firebase. </p> - <h2><Link to='demos/chat/welcome'>Chat</Link></h2> + <h2><Link to='/demos/chat/welcome'>Chat</Link></h2> <p> A chat room — the canonical Firebase example. </p> - <h2><Link to='demos/whiteboard/welcome'>Whiteboard</Link></h2> + <h2><Link to='/demos/whiteboard/welcome'>Whiteboard</Link></h2> <p> The whiteboard demonstrates the <i>journal</i> pattern, a way to use Firebase to synchronize the state of Redux stores on all collaborators machines.
a6f1a304d1367428dc1fa5a84709986d66284cb7
src/components/elements/recent-groups.jsx
src/components/elements/recent-groups.jsx
import React from 'react'; import { Link } from 'react-router'; import { connect } from 'react-redux'; import { fromNowOrNow } from '../../utils'; const GROUPS_SIDEBAR_LIST_LENGTH = 4; 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} <div className="updated-ago">{updatedAgo}</div> </Link> </li> ); }; const RecentGroups = (props) => { const recentGroups = props.recentGroups.map(renderRecentGroup); return ( <ul className="p-my-groups"> {recentGroups} </ul> ); }; const mapStateToProps = (state) => { const recentGroups = (state.user.subscriptions || []) .map((id) => state.users[id] || {}) .filter((u) => u.type === 'group') .sort((a, b) => parseInt(b.updatedAt) - parseInt(a.updatedAt)) .slice(0, GROUPS_SIDEBAR_LIST_LENGTH); return { recentGroups }; }; export default connect(mapStateToProps)(RecentGroups);
import React from 'react'; import { Link } from 'react-router'; import { connect } from 'react-redux'; import { fromNowOrNow } from '../../utils'; const GROUPS_SIDEBAR_LIST_LENGTH = 4; const renderRecentGroup = recentGroup => { const updatedAgo = fromNowOrNow(parseInt(recentGroup.updatedAt)); return ( <li key={recentGroup.id}> <Link to={`/${recentGroup.username}`}> {recentGroup.screenName} <div className="updated-ago">{updatedAgo}</div> </Link> </li> ); }; const RecentGroups = (props) => { const recentGroups = props.recentGroups.map(renderRecentGroup); return ( <ul> {recentGroups} </ul> ); }; const mapStateToProps = (state) => { const recentGroups = (state.user.subscriptions || []) .map((id) => state.users[id] || {}) .filter((u) => u.type === 'group') .sort((a, b) => parseInt(b.updatedAt) - parseInt(a.updatedAt)) .slice(0, GROUPS_SIDEBAR_LIST_LENGTH); return { recentGroups }; }; export default connect(mapStateToProps)(RecentGroups);
Remove unused CSS classnames from RecentGroups
Remove unused CSS classnames from RecentGroups
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -9,7 +9,7 @@ const renderRecentGroup = recentGroup => { const updatedAgo = fromNowOrNow(parseInt(recentGroup.updatedAt)); return ( - <li className="p-my-groups-link" key={recentGroup.id}> + <li key={recentGroup.id}> <Link to={`/${recentGroup.username}`}> {recentGroup.screenName} <div className="updated-ago">{updatedAgo}</div> @@ -22,7 +22,7 @@ const recentGroups = props.recentGroups.map(renderRecentGroup); return ( - <ul className="p-my-groups"> + <ul> {recentGroups} </ul> );
7066813ef8c46749f047184f0320917584c60acf
src/containers/App.jsx
src/containers/App.jsx
import React from 'react' import USMap from '../components/USMap' import { StyleSheet } from 'react-look' import { connect } from 'react-redux' const styles = StyleSheet.create({ map: { height: '80vh', width: 'auto' } }) function mapStateToProps(state) { return { events: state.events } } const App = ({ events }) => ( <div className={styles.map}> <USMap events={events} /> </div> ) App.propTypes = { events: React.PropTypes.array } export default connect(mapStateToProps)(App)
import React from 'react' import USMap from '../components/USMap' import { StyleSheet } from 'react-look' import { connect } from 'react-redux' const styles = StyleSheet.create({ map: { height: '70vmin' } }) function mapStateToProps(state) { return { events: state.events } } const App = ({ events }) => ( <div className={styles.map}> <USMap events={events} /> </div> ) App.propTypes = { events: React.PropTypes.array } export default connect(mapStateToProps)(App)
Use vmin to do better map size
Use vmin to do better map size
JSX
agpl-3.0
ryankopf/bnc-website,ryankopf/bnc-website,itstriz/website
--- +++ @@ -5,8 +5,7 @@ const styles = StyleSheet.create({ map: { - height: '80vh', - width: 'auto' + height: '70vmin' } })
b2b933c153bea5ee84aa62007f4b633dde5ebdac
common/app/routes/Hikes/components/Hike.jsx
common/app/routes/Hikes/components/Hike.jsx
import React, { PropTypes } from 'react'; import { Col, Panel, Row } from 'react-bootstrap'; import Lecture from './Lecture.jsx'; import Questions from './Questions.jsx'; export default React.createClass({ displayName: 'Hike', propTypes: { currentHike: PropTypes.object, showQuestions: PropTypes.bool }, renderBody(showQuestions) { if (showQuestions) { return <Questions />; } return <Lecture />; }, render() { const { currentHike: { title } = {}, showQuestions } = this.props; const videoTitle = <h2>{ title }</h2>; return ( <Col xs={ 12 }> <Row> <Panel className={ 'text-center' } title={ videoTitle }> { this.renderBody(showQuestions) } </Panel> </Row> </Col> ); } });
import React, { PropTypes } from 'react'; import { Col, Panel, Row } from 'react-bootstrap'; import Lecture from './Lecture.jsx'; import Questions from './Questions.jsx'; export default React.createClass({ displayName: 'Hike', propTypes: { currentHike: PropTypes.object, showQuestions: PropTypes.bool }, renderBody(showQuestions) { if (showQuestions) { return <Questions />; } return <Lecture />; }, render() { const { currentHike: { title } = {}, showQuestions } = this.props; const videoTitle = <h4>{ title }</h4>; return ( <Col xs={ 12 }> <Row> <Panel className={ 'text-center' } header={ videoTitle } title={ title }> { this.renderBody(showQuestions) } </Panel> </Row> </Col> ); } });
Fix title for panel This fixes hover object Object issue
Fix title for panel This fixes hover object Object issue
JSX
bsd-3-clause
pahosler/freecodecamp,matthew-t-smith/freeCodeCamp,BhaveshSGupta/FreeCodeCamp,BerkeleyTrue/FreeCodeCamp,raisedadead/FreeCodeCamp,BhaveshSGupta/FreeCodeCamp,BrendanSweeny/FreeCodeCamp,matthew-t-smith/freeCodeCamp,jonathanihm/freeCodeCamp,1111113j8Pussy420/https-github.com-raisedadead-freeCodeCamp,otavioarc/freeCodeCamp,FreeCodeCampQuito/FreeCodeCamp,BhaveshSGupta/FreeCodeCamp,tmashuang/FreeCodeCamp,codeman869/FreeCodeCamp,DusanSacha/FreeCodeCamp,systimotic/FreeCodeCamp,pahosler/freecodecamp,FreeCodeCampQuito/FreeCodeCamp,BrendanSweeny/FreeCodeCamp,no-stack-dub-sack/freeCodeCamp,DusanSacha/FreeCodeCamp,1111113j8Pussy420/https-github.com-raisedadead-freeCodeCamp,no-stack-dub-sack/freeCodeCamp,BerkeleyTrue/FreeCodeCamp,MiloATH/FreeCodeCamp,sakthik26/FreeCodeCamp,FreeCodeCamp/FreeCodeCamp,techstonia/FreeCodeCamp,systimotic/FreeCodeCamp,FreeCodeCamp/FreeCodeCamp,raisedadead/FreeCodeCamp,Munsterberg/freecodecamp,MiloATH/FreeCodeCamp,techstonia/FreeCodeCamp,Munsterberg/freecodecamp,HKuz/FreeCodeCamp,tmashuang/FreeCodeCamp,otavioarc/freeCodeCamp,sakthik26/FreeCodeCamp,HKuz/FreeCodeCamp,TheeMattOliver/FreeCodeCamp,codeman869/FreeCodeCamp,jonathanihm/freeCodeCamp,TheeMattOliver/FreeCodeCamp
--- +++ @@ -29,14 +29,15 @@ showQuestions } = this.props; - const videoTitle = <h2>{ title }</h2>; + const videoTitle = <h4>{ title }</h4>; return ( <Col xs={ 12 }> <Row> <Panel className={ 'text-center' } - title={ videoTitle }> + header={ videoTitle } + title={ title }> { this.renderBody(showQuestions) } </Panel> </Row>
e768254b017d1099224dba6ded6d4bfd4f1d60f8
client/components/AddGame.jsx
client/components/AddGame.jsx
import React from 'react' import {connect} from 'react-redux' import {addGameVisibleToggle} from '../actions/' class AddGame extends React.Component { // Need to create an add visible toggle off and on // Then some checking on whether a user has a game or not already // Then some glue back to the API to post some datas addGameToggle(e) { this.props.dispatch(addGameVisibleToggle(this.props.addGame)) } render() { return ( <div className='addGame'> <h2 onClick={(e) => this.addGameToggle(e)}>Add Game</h2> </div> ) } } const mapStateToProps = (state) => { console.log(state); return {addGame: state.addGame} } export default connect(mapStateToProps)(AddGame)
import React from 'react' import {connect} from 'react-redux' import {addGameVisibleToggle} from '../actions/' class AddGame extends React.Component { // Then some checking on whether a user has a game or not already // Then some glue back to the API to post some datas addGameToggle(e) { this.props.dispatch(addGameVisibleToggle(this.props.addGame)) } render() { return ( <div className='addGame'> {this.props.addGame ? <div> <p>Blahs</p> <h2 onClick={(e) => this.addGameToggle(e)}>cancel</h2> </div> : <h2 onClick={(e) => this.addGameToggle(e)}>Add Game</h2> } </div> ) } } const mapStateToProps = (state) => { return {addGame: state.addGame} } export default connect(mapStateToProps)(AddGame)
Add game toggle working on add game page
Add game toggle working on add game page
JSX
mit
alan-jordan/gamr-v2,alan-jordan/gamr-v2
--- +++ @@ -4,7 +4,6 @@ class AddGame extends React.Component { - // Need to create an add visible toggle off and on // Then some checking on whether a user has a game or not already // Then some glue back to the API to post some datas @@ -15,14 +14,19 @@ render() { return ( <div className='addGame'> - <h2 onClick={(e) => this.addGameToggle(e)}>Add Game</h2> + {this.props.addGame ? + <div> + <p>Blahs</p> + <h2 onClick={(e) => this.addGameToggle(e)}>cancel</h2> + </div> + : <h2 onClick={(e) => this.addGameToggle(e)}>Add Game</h2> + } </div> ) } } const mapStateToProps = (state) => { - console.log(state); return {addGame: state.addGame} }