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
5223a0322ba79417568e8bbb19bc1f023e813453
src/index.jsx
src/index.jsx
import React from 'react'; import {render} from 'react-dom'; import {Provider} from 'react-redux'; import {createStore, applyMiddleware} from 'redux' import thunk from 'redux-thunk'; import dtApp from './reducers/evolve' import App from './components/App/index'; import {setImageSrc} from './actions' import ReactGA from 'react-ga'; ReactGA.initialize('UA-25289674-1'); // See https://github.com/react-ga/react-ga#usage if adding react-router ReactGA.set({page: '/'}); ReactGA.pageview('/'); const store = createStore( dtApp, applyMiddleware(thunk) ); render( <Provider store={store}> <App/> </Provider>, document.getElementById('react-app') ); store.dispatch(setImageSrc('/img/marilyn.jpg'));
import React from 'react'; import {render} from 'react-dom'; import {Provider} from 'react-redux'; import {createStore, applyMiddleware} from 'redux' import thunk from 'redux-thunk'; import dtApp from './reducers/evolve' import App from './components/App/index'; import {setImageSrc} from './actions' import ReactGA from 'react-ga'; ReactGA.initialize('UA-25289674-1'); // See https://github.com/react-ga/react-ga#usage if adding react-router ReactGA.set({page: '/'}); ReactGA.pageview('/'); const store = createStore( dtApp, applyMiddleware(thunk) ); render( <Provider store={store}> <App/> </Provider>, document.getElementById('react-app') ); store.dispatch(setImageSrc('/img/marilyn.jpg')); setTimeout(function () { window.onbeforeunload = function (e) { var msg = 'Are you sure you want to leave this page?'; e.returnValue = msg; // most browsers return msg; // safari }; }, 1800000);
Add onbeforeunload prompt if user has been on page for half an hour.
Add onbeforeunload prompt if user has been on page for half an hour.
JSX
isc
jacksonp/dirtytriangles,jacksonp/dirtytriangles
--- +++ @@ -27,3 +27,11 @@ ); store.dispatch(setImageSrc('/img/marilyn.jpg')); + +setTimeout(function () { + window.onbeforeunload = function (e) { + var msg = 'Are you sure you want to leave this page?'; + e.returnValue = msg; // most browsers + return msg; // safari + }; +}, 1800000);
302398feff0415147cd82dabc12c9a50f75097b2
client/src/components/Logout.jsx
client/src/components/Logout.jsx
import React from 'react'; import axios from 'axios'; import { Redirect } from 'react-router-dom'; import {parse} from 'cookie'; class Logout extends React.Component { constructor(props) { super(props); this.state = { redirect: false }; } componentWillMount() { let cookies = parse(document.cookie); let fridgrSesh = JSON.parse(cookies.fridgrSesh.slice(2)); if (cookies.fridgrSesh && fridgrSesh.userId && fridgrSesh.houseId) { var context = this; axios.post('/auth/logout') .then((response) => { // reset localStorage localStorage.removeItem('loggedIn'); // set logout success message localStorage.setItem('successMessage', response.data.message); context.setState({ redirect: true }); console.log('Logout successful!'); }) .catch((err) => { console.log('Error occurred during logout:', err); }); } else { this.setState({ redirect: true }); } } render() { return ( <div> {this.state.redirect ? <Redirect to='/login' /> : null } </div> ); } } export default Logout;
import React from 'react'; import axios from 'axios'; import { Redirect } from 'react-router-dom'; import {parse} from 'cookie'; class Logout extends React.Component { constructor(props) { super(props); this.state = { redirect: false }; } componentWillMount() { let cookies = parse(document.cookie); let fridgrSesh = JSON.parse(cookies.fridgrSesh.slice(2)); if (cookies.fridgrSesh && (fridgrSesh.userId || fridgrSesh.houseId)) { var context = this; axios.post('/auth/logout') .then((response) => { // reset localStorage localStorage.removeItem('loggedIn'); // set logout success message localStorage.setItem('successMessage', response.data.message); context.setState({ redirect: true }); console.log('Logout successful!'); }) .catch((err) => { console.log('Error occurred during logout:', err); }); } else { this.setState({ redirect: true }); } } render() { return ( <div> {this.state.redirect ? <Redirect to='/login' /> : null } </div> ); } } export default Logout;
Fix bug: logout before userId is given
Fix bug: logout before userId is given
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -16,7 +16,7 @@ let cookies = parse(document.cookie); let fridgrSesh = JSON.parse(cookies.fridgrSesh.slice(2)); - if (cookies.fridgrSesh && fridgrSesh.userId && fridgrSesh.houseId) { + if (cookies.fridgrSesh && (fridgrSesh.userId || fridgrSesh.houseId)) { var context = this; axios.post('/auth/logout')
995b971bf065f3218de697448d8b8f209fdd6d0c
components/elements/RegionChildrenList.jsx
components/elements/RegionChildrenList.jsx
import React, {Component, PropTypes} from 'react' export default class RegionChildrenList extends Component { static propTypes = { children: PropTypes.array } render() { return ( <nav role="navigation" className="navigation"> <ul className="t-no-list-styles"> {this.props.children.map(region => { return <li key={region.code} className="col--third col--flow col--right-padding"><a className="navigation__link" href="#">{region.name}</a></li> })} </ul> </nav> ) } }
import React, {Component, PropTypes} from 'react' import {prefixify} from '../../lib/regionUtil' export default class RegionChildrenList extends Component { static propTypes = { children: PropTypes.array } static contextTypes = { linkTo: PropTypes.func } render() { return ( <nav role="navigation" className="navigation"> <ul className="t-no-list-styles"> {this.props.children.map(region => { return ( <li key={region.code} className="col--third col--flow col--right-padding"> <a className="navigation__link" href={this.context.linkTo('/steder/:region', {region: prefixify(region)})}>{region.name}</a> </li> ) })} </ul> </nav> ) } }
Make the links to child regions work
Make the links to child regions work
JSX
mit
bengler/imdikator,bengler/imdikator
--- +++ @@ -1,8 +1,14 @@ import React, {Component, PropTypes} from 'react' +import {prefixify} from '../../lib/regionUtil' export default class RegionChildrenList extends Component { + static propTypes = { children: PropTypes.array + } + + static contextTypes = { + linkTo: PropTypes.func } render() { @@ -10,7 +16,11 @@ <nav role="navigation" className="navigation"> <ul className="t-no-list-styles"> {this.props.children.map(region => { - return <li key={region.code} className="col--third col--flow col--right-padding"><a className="navigation__link" href="#">{region.name}</a></li> + return ( + <li key={region.code} className="col--third col--flow col--right-padding"> + <a className="navigation__link" href={this.context.linkTo('/steder/:region', {region: prefixify(region)})}>{region.name}</a> + </li> + ) })} </ul> </nav>
5e4e4ec08fdb3e6e3443ca925ec1e795080b2f62
js/components/GameBoy.jsx
js/components/GameBoy.jsx
/** * The main gameboy display */ import React, { Component } from 'react'; import MenuPanel from './MenuPanel.jsx'; import RomLoader from './RomLoader.jsx'; import Screen from './Screen.jsx'; import EmuStore from '../stores/EmuStore.js'; const buildState = () => ({ loaded: EmuStore.isRomLoaded(), }); export default function GameBoy(props) { Component.call(this, props); Object.assign(this, { state: buildState(), _onChange: () => this.setState(buildState()), }); } Object.assign(GameBoy.prototype, Component.prototype, { componentWillMount() { EmuStore.addChangeListener(this._onChange); }, componentWillUnmount() { EmuStore.removeChangeListener(this._onChange); }, render() { let screen; if (this.state.loaded) { screen = <Screen key="screen" />; } else { screen = <RomLoader key="romloader" />; } return ( <section id="gameboy"> {screen} <MenuPanel /> </section> ); }, });
/** * The main gameboy display */ import React, { Component } from 'react'; import MenuPanel from './MenuPanel.jsx'; import RomLoader from './RomLoader.jsx'; import Screen from './Screen.jsx'; import EmuStore from '../stores/EmuStore.js'; const buildState = () => ({ loaded: EmuStore.isRomLoaded(), }); export default function GameBoy(props) { Component.call(this, props); Object.assign(this, { state: buildState(), _onChange: () => this.setState(buildState()), }); } GameBoy.prototype = Object.assign(Object.create(Component.prototype), { componentWillMount() { EmuStore.addChangeListener(this._onChange); }, componentWillUnmount() { EmuStore.removeChangeListener(this._onChange); }, render() { let screen; if (this.state.loaded) { screen = <Screen key="screen" />; } else { screen = <RomLoader key="romloader" />; } return ( <section id="gameboy"> {screen} <MenuPanel /> </section> ); }, });
Extend via prototype chain (like classes), not pure assign
Extend via prototype chain (like classes), not pure assign
JSX
mit
jkoudys/remu,jkoudys/remu
--- +++ @@ -22,7 +22,7 @@ _onChange: () => this.setState(buildState()), }); } -Object.assign(GameBoy.prototype, Component.prototype, { +GameBoy.prototype = Object.assign(Object.create(Component.prototype), { componentWillMount() { EmuStore.addChangeListener(this._onChange); },
5e14f2867a59c4cd6c989306d176d9cfc0329b81
src/Responsive.jsx
src/Responsive.jsx
import {Component, Children, PropTypes} from 'react' import {defaultBreakpoints} from './utils.js'; class Responsive extends Component { getChildContext() { return { breakpoint: this.state.breakpoint }; } constructor(props, context) { super(props, context); this.state = { breakpoints: Object.assign({}, defaultBreakpoints, this.props.breakpoints), breakpoint: null }; } componentWillMount() { this.windowResizeHandler(); window.addEventListener('resize', this.windowResizeHandler.bind(this)); } componentWillUnmount() { window.removeEventListener(this.windowResizeHandler); } matchMediaQuery() { return Object.keys(this.state.breakpoints).filter((breakpoint)=>{ return (window.matchMedia(this.state.breakpoints[breakpoint]).matches); }); } windowResizeHandler() { let breakpoint = this.matchMediaQuery().slice(-1)[0]; if(breakpoint !== this.state.breakpoint){ this.setState({ breakpoint: breakpoint }); } } render() { const { children } = this.props; return Children.only(children); } } Responsive.propTypes = { children: PropTypes.element.isRequired, breakpoints: PropTypes.shape({ mobile: PropTypes.number, tablet: PropTypes.number, laptop: PropTypes.number, desktop: PropTypes.number }) } Responsive.childContextTypes = { breakpoint: PropTypes.string } export default Responsive;
import {Component, Children, PropTypes} from 'react' import {defaultBreakpoints} from './utils.js'; class Responsive extends Component { getChildContext() { return { breakpoint: this.state.breakpoint }; } constructor(props, context) { super(props, context); this.state = { breakpoints: Object.assign({}, defaultBreakpoints, this.props.breakpoints), breakpoint: null }; } componentWillMount() { this.mounted = true; this.windowResizeHandler(); window.addEventListener('resize', this.windowResizeHandler.bind(this)); } componentWillUnmount() { this.mounted = false; } matchMediaQuery() { return Object.keys(this.state.breakpoints).filter((breakpoint)=>{ return (window.matchMedia(this.state.breakpoints[breakpoint]).matches); }); } windowResizeHandler() { if(this.mounted === true){ let breakpoint = this.matchMediaQuery().slice(-1)[0]; if(breakpoint !== this.state.breakpoint){ this.setState({ breakpoint: breakpoint }); } } } render() { const { children } = this.props; return Children.only(children); } } Responsive.propTypes = { children: PropTypes.element.isRequired, breakpoints: PropTypes.shape({ mobile: PropTypes.number, tablet: PropTypes.number, laptop: PropTypes.number, desktop: PropTypes.number }) } Responsive.childContextTypes = { breakpoint: PropTypes.string } export default Responsive;
Fix issue preventing first breakpoint trigger
Fix issue preventing first breakpoint trigger
JSX
mit
111StudioKK/react-plan,111StudioKK/react-plan
--- +++ @@ -15,12 +15,13 @@ } componentWillMount() { + this.mounted = true; this.windowResizeHandler(); window.addEventListener('resize', this.windowResizeHandler.bind(this)); } componentWillUnmount() { - window.removeEventListener(this.windowResizeHandler); + this.mounted = false; } matchMediaQuery() { @@ -30,11 +31,13 @@ } windowResizeHandler() { + if(this.mounted === true){ let breakpoint = this.matchMediaQuery().slice(-1)[0]; if(breakpoint !== this.state.breakpoint){ this.setState({ breakpoint: breakpoint }); + } } }
82e892b6ebf94d813c88d7d24c7be6c4bb96d68c
examples/simple-svg/components/Viget.jsx
examples/simple-svg/components/Viget.jsx
import React from 'react' export default React.createClass({ getDefaultProps() { return { title: 'Microcosm SVG Chart Example', height: 250, width: 250 } }, render() { var { title, width, height } = this.props var { cx, cy, r } = this.props.circle return ( <svg height={ height } width={ width } version="1.1"> <title>{ title }</title> <g transform={ `translate(${ width * 0.5}, ${ height * 0.5 })` }> <circle key="earth" r="25" fill="#1496bb" /> <circle key="moon" cx={ cx } cy={ cy } r={ r } fill="#f26d21" /> </g> </svg> ) } })
import React from 'react' export default React.createClass({ getDefaultProps() { return { title: 'Microcosm SVG Chart Example', height: 300, width: 250 } }, render() { var { title, width, height } = this.props var { cx, cy, r } = this.props.circle return ( <svg height={ height } width={ width } version="1.1"> <title>{ title }</title> <g transform={ `translate(${ width * 0.5}, ${ height * 0.5 })` }> <circle key="earth" r="25" fill="#1496bb" /> <circle key="moon" cx={ cx } cy={ cy } r={ r } fill="#f26d21" /> </g> </svg> ) } })
Remove clipping in svg example
Remove clipping in svg example
JSX
mit
vigetlabs/microcosm,vigetlabs/microcosm,despairblue/microcosm,leobauza/microcosm,despairblue/microcosm,leobauza/microcosm,leobauza/microcosm,vigetlabs/microcosm
--- +++ @@ -4,7 +4,7 @@ getDefaultProps() { return { title: 'Microcosm SVG Chart Example', - height: 250, + height: 300, width: 250 } },
f9890897009116ad36b6d2579a70cf1deeffca8c
src/renderer/components/update-checker.jsx
src/renderer/components/update-checker.jsx
import { ipcRenderer } from 'electron'; import shell from 'shell'; import React, {Component} from 'react'; const EVENT_KEY = 'sqlectron:update-available'; export default class UpdateChecker extends Component { componentDidMount() { ipcRenderer.on(EVENT_KEY, ::this.onUpdateAvailable); } componentWillUnmount() { ipcRenderer.removeListener(EVENT_KEY, ::this.onUpdateAvailable); } onUpdateAvailable() { this.setState({ isVisible: true }); } onUpdateClick(event) { event.preventDefault(); shell.openExternal('https://github.com/sqlectron/sqlectron-gui-test-auto-update/releases/latest'); } render() { const isVisible = this.state && this.state.isVisible; if (!isVisible) { return null; } return ( <a className="ui green label" onClick={this.onUpdateClick}> <i className="cloud download icon" /> Update available <div className="detail">v1.1.1</div> </a> ); } }
import { ipcRenderer } from 'electron'; import shell from 'shell'; import React, {Component} from 'react'; const EVENT_KEY = 'sqlectron:update-available'; const PACKAGE_JSON = require('remote').require('../../package.json'); const repo = PACKAGE_JSON.repository.url.replace('https://github.com/', ''); const LATEST_RELEASE_URL = `https://github.com/${repo}/releases/latest`; export default class UpdateChecker extends Component { componentDidMount() { ipcRenderer.on(EVENT_KEY, ::this.onUpdateAvailable); } componentWillUnmount() { ipcRenderer.removeListener(EVENT_KEY, ::this.onUpdateAvailable); } onUpdateAvailable() { this.setState({ isVisible: true }); } onUpdateClick(event) { event.preventDefault(); shell.openExternal(LATEST_RELEASE_URL); } render() { const isVisible = this.state && this.state.isVisible; if (!isVisible) { return null; } // TODO: show the latest avaible version // const currentVersion = `v${PACKAGE_JSON.version}`; // const availableVersion = '...'; return ( <a className="ui green label" onClick={this.onUpdateClick}> <i className="cloud download icon" /> Update available {/* <div className="detail">{APP_VERSION}</div> */} </a> ); } }
Fix update checker linking to the right URL
Fix update checker linking to the right URL Is missing show the latest available version.
JSX
mit
sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui
--- +++ @@ -4,6 +4,9 @@ const EVENT_KEY = 'sqlectron:update-available'; +const PACKAGE_JSON = require('remote').require('../../package.json'); +const repo = PACKAGE_JSON.repository.url.replace('https://github.com/', ''); +const LATEST_RELEASE_URL = `https://github.com/${repo}/releases/latest`; export default class UpdateChecker extends Component { @@ -21,18 +24,22 @@ onUpdateClick(event) { event.preventDefault(); - shell.openExternal('https://github.com/sqlectron/sqlectron-gui-test-auto-update/releases/latest'); + shell.openExternal(LATEST_RELEASE_URL); } render() { const isVisible = this.state && this.state.isVisible; if (!isVisible) { return null; } + // TODO: show the latest avaible version + // const currentVersion = `v${PACKAGE_JSON.version}`; + // const availableVersion = '...'; + return ( <a className="ui green label" onClick={this.onUpdateClick}> <i className="cloud download icon" /> Update available - <div className="detail">v1.1.1</div> + {/* <div className="detail">{APP_VERSION}</div> */} </a> ); }
1d89684053cc5b7481cd968c441c2e6fe1a1bb54
src/cred/email/ask_email.jsx
src/cred/email/ask_email.jsx
import React from 'react'; import Screen from '../../lock/screen'; import EmailPane from './email_pane'; export default class AskEmail extends Screen { constructor(lock, submitHandler, renderAuxilaryPane) { super("email", lock); this._submitHandler = submitHandler; this._renderAuxiliaryPane = renderAuxilaryPane; } submitHandler() { return this._submitHandler; } renderAuxiliaryPane() { return this._renderAuxiliaryPane; } render({lock}) { return ( <EmailPane lock={lock} placeholder={this.t(["emailInputPlaceholder"], {__textOnly: true})} /> ); } }
import React from 'react'; import Screen from '../../lock/screen'; import EmailPane from './email_pane'; export default class AskEmail extends Screen { constructor(lock) { super("email", lock); } render({lock}) { return ( <EmailPane lock={lock} placeholder={this.t(["emailInputPlaceholder"], {__textOnly: true})} /> ); } }
Remove no longer used stuff from AskEmail
Remove no longer used stuff from AskEmail
JSX
mit
mike-casas/lock,mike-casas/lock,auth0/lock-passwordless,mike-casas/lock,auth0/lock-passwordless,auth0/lock-passwordless
--- +++ @@ -5,18 +5,8 @@ export default class AskEmail extends Screen { - constructor(lock, submitHandler, renderAuxilaryPane) { + constructor(lock) { super("email", lock); - this._submitHandler = submitHandler; - this._renderAuxiliaryPane = renderAuxilaryPane; - } - - submitHandler() { - return this._submitHandler; - } - - renderAuxiliaryPane() { - return this._renderAuxiliaryPane; } render({lock}) {
78673b734de857d99a58e03a52f68ae219b682f3
src/components/app.jsx
src/components/app.jsx
import React, { Component } from 'react'; export default function appFactory() { return class App extends Component { render() { return <div className="todo-app"> <input type="text" className="new-todo" autoFocus placeholder="What needs to be done?" /> </div>; } }; }
import React, { Component } from 'react'; export default function appFactory() { return class App extends Component { render() { return <div className="todoapp"> <header className="header"> <h1>todos</h1> <input type="text" className="new-todo" autoFocus placeholder="What needs to be done?" /> </header> <div className="main"> </div> <footer className="footer"> </footer> </div>; } }; }
Add a little bit more HTML
Add a little bit more HTML
JSX
mit
NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet
--- +++ @@ -4,10 +4,17 @@ export default function appFactory() { return class App extends Component { render() { - return <div className="todo-app"> - <input type="text" className="new-todo" autoFocus - placeholder="What needs to be done?" - /> + return <div className="todoapp"> + <header className="header"> + <h1>todos</h1> + <input type="text" className="new-todo" autoFocus + placeholder="What needs to be done?" + /> + </header> + <div className="main"> + </div> + <footer className="footer"> + </footer> </div>; } };
d1b77dd193b338c907813be530d833318601b858
src/js/components/TabPaneComponent.jsx
src/js/components/TabPaneComponent.jsx
var classNames = require("classnames"); var React = require("react/addons"); var TabPaneComponent = React.createClass({ displayName: "TabPaneComponent", propTypes: { children: React.PropTypes.node, isActive: React.PropTypes.bool, onActivate: React.PropTypes.func }, componentDidUpdate: function (prevProps) { if (!prevProps.isActive && this.props.isActive) { this.props.onActivate(); } }, getDefaultProps: function () { return { isActive: false, onActivate: function () {} }; }, render: function () { var classSet = classNames({ "active": this.props.isActive, "tab-pane": true }); return ( <div className={classSet}> {this.props.children} </div> ); } }); module.exports = TabPaneComponent;
var classNames = require("classnames"); var React = require("react/addons"); var TabPaneComponent = React.createClass({ displayName: "TabPaneComponent", propTypes: { children: React.PropTypes.node, className: React.PropTypes.string, isActive: React.PropTypes.bool, onActivate: React.PropTypes.func }, componentDidUpdate: function (prevProps) { if (!prevProps.isActive && this.props.isActive) { this.props.onActivate(); } }, getDefaultProps: function () { return { isActive: false, onActivate: function () {} }; }, render: function () { var classSet = classNames({ "active": this.props.isActive, "tab-pane": true }, this.props.className); return ( <div className={classSet}> {this.props.children} </div> ); } }); module.exports = TabPaneComponent;
Allow passing className as prop
Allow passing className as prop
JSX
apache-2.0
cribalik/marathon-ui,mesosphere/marathon-ui,cribalik/marathon-ui,mesosphere/marathon-ui
--- +++ @@ -6,6 +6,7 @@ propTypes: { children: React.PropTypes.node, + className: React.PropTypes.string, isActive: React.PropTypes.bool, onActivate: React.PropTypes.func }, @@ -27,7 +28,7 @@ var classSet = classNames({ "active": this.props.isActive, "tab-pane": true - }); + }, this.props.className); return ( <div className={classSet}>
7467b9348c89e7474b4ef7553f6b8b14cfb2aee2
app/components/WebchatEnd.jsx
app/components/WebchatEnd.jsx
import React, { Component } from 'react' import PropTypes from '../lib/PropTypes' import Button from './Button' import Label from './Label' export default class WebchatIntroClient extends Component { static propTypes = { handleWindowClose: PropTypes.func.isRequired } render () { return <div className="mt3"> <p>Thank you for using the chat.</p> <p>Did we answer your question today?</p> <div className="cf"> <label className="block-label" htmlFor="radio-1"> <input id="radio-1" type="radio" name="radio-group" value="Yes" /> Yes </label> <label className="block-label" htmlFor="radio-2"> <input id="radio-2" type="radio" name="radio-group" value="No" /> No </label> </div> <div className="w-75 mt3"> <Label htmlFor="webchat-other-thoughts">Any other thoughts?</Label> <textarea id="webchat-other-thoughts" className="ba2 b--govuk-gray-1 outline w-100 input-reset" /> </div> <div className="w-50 mt4"> <Button onClick={this.props.handleWindowClose}>Close the window</Button> </div> </div> } }
import React, { Component } from 'react' import PropTypes from '../lib/PropTypes' import Button from './Button' import Label from './Label' export default class WebchatIntroClient extends Component { static propTypes = { handleWindowClose: PropTypes.func.isRequired } render () { return <div className="mt3"> <p>Thank you for using the chat.</p> <p>Did we answer your question today?</p> <div className="cf"> <label className="block-label" htmlFor="radio-1"> <input id="radio-1" type="radio" name="radio-group" value="Yes" /> Yes </label> <label className="block-label" htmlFor="radio-2"> <input id="radio-2" type="radio" name="radio-group" value="No" /> No </label> </div> <div className="w-75 mt3"> <Label htmlFor="webchat-other-thoughts">Any other thoughts?</Label> <textarea id="webchat-other-thoughts" className="ba2 b--govuk-gray-1 outline w-100 input-reset" /> </div> <div className="w-50-ns mt4-ns mt3"> <Button onClick={this.props.handleWindowClose}>Close the window</Button> </div> </div> } }
Change close window styling in end chat view
Change close window styling in end chat view
JSX
mit
quis/notify-public-research-prototype,quis/notify-public-research-prototype,quis/notify-public-research-prototype
--- +++ @@ -26,7 +26,7 @@ <Label htmlFor="webchat-other-thoughts">Any other thoughts?</Label> <textarea id="webchat-other-thoughts" className="ba2 b--govuk-gray-1 outline w-100 input-reset" /> </div> - <div className="w-50 mt4"> + <div className="w-50-ns mt4-ns mt3"> <Button onClick={this.props.handleWindowClose}>Close the window</Button> </div> </div>
a214d4ecaa804ca76c217ddbcaa3ada281653004
app/components/WebchatEnd.jsx
app/components/WebchatEnd.jsx
import React, { Component } from 'react' import PropTypes from '../lib/PropTypes' import Button from './Button' export default class WebchatIntroClient extends Component { static propTypes = { handleWindowClose: PropTypes.func.isRequired } render () { return <div className="mt3"> <p>Thank you for using the chat.</p> <p>Did we answer your question today?</p> <div className="cf"> <label className="block-label" htmlFor="radio-1"> <input id="radio-1" type="radio" name="radio-group" value="Yes" /> Yes </label> <label className="block-label" htmlFor="radio-2"> <input id="radio-2" type="radio" name="radio-group" value="No" /> No </label> </div> <div className="w-50 mt4"> <Button onClick={this.props.handleWindowClose}>Close the window</Button> </div> </div> } }
import React, { Component } from 'react' import PropTypes from '../lib/PropTypes' import Button from './Button' import Label from './Label' export default class WebchatIntroClient extends Component { static propTypes = { handleWindowClose: PropTypes.func.isRequired } render () { return <div className="mt3"> <p>Thank you for using the chat.</p> <p>Did we answer your question today?</p> <div className="cf"> <label className="block-label" htmlFor="radio-1"> <input id="radio-1" type="radio" name="radio-group" value="Yes" /> Yes </label> <label className="block-label" htmlFor="radio-2"> <input id="radio-2" type="radio" name="radio-group" value="No" /> No </label> </div> <div className="w-75 mt3"> <Label htmlFor="webchat-other-thoughts">Any other thoughts?</Label> <textarea id="webchat-other-thoughts" className="ba2 b--govuk-gray-1 outline w-100 input-reset" /> </div> <div className="w-50 mt4"> <Button onClick={this.props.handleWindowClose}>Close the window</Button> </div> </div> } }
Add post-chat other thoughts field to custom chat
Add post-chat other thoughts field to custom chat
JSX
mit
quis/notify-public-research-prototype,quis/notify-public-research-prototype,quis/notify-public-research-prototype
--- +++ @@ -1,6 +1,7 @@ import React, { Component } from 'react' import PropTypes from '../lib/PropTypes' import Button from './Button' +import Label from './Label' export default class WebchatIntroClient extends Component { static propTypes = { @@ -21,6 +22,10 @@ No </label> </div> + <div className="w-75 mt3"> + <Label htmlFor="webchat-other-thoughts">Any other thoughts?</Label> + <textarea id="webchat-other-thoughts" className="ba2 b--govuk-gray-1 outline w-100 input-reset" /> + </div> <div className="w-50 mt4"> <Button onClick={this.props.handleWindowClose}>Close the window</Button> </div>
5843b0538108281df88b9309ee95a32f2ed805c4
app/components/counter.jsx
app/components/counter.jsx
import React, {Component} from 'react'; class Counter extends Component { constructor(props) { super(props); this.state = { secondsElapsed: 0 }; this.rerender = 0; } componentDidMount() { setInterval(() => { this.setState({secondsElapsed: ++this.state.secondsElapsed}); }, 1000); } render() { this.rerender++; return ( <div> <p id="seconds"> Seconds since the component loaded: {this.state.secondsElapsed} </p> <p id="rerender"> Component has been rerender due to user changes: {this.rerender} </p> </div> ); } } export default Counter;
import React, {Component} from 'react'; class Counter extends Component { constructor(props) { super(props); this.state = { secondsElapsed: 0 }; this.rerender = 0; } componentDidMount() { setInterval(() => { this.setState({secondsElapsed: ++this.state.secondsElapsed}); }, 1000); } render() { this.rerender++; return ( <div> <p id="seconds"> Seconds since the component loaded: {this.state.secondsElapsed} </p> <p id="rerender"> Component has been rerender : {this.rerender} times </p> </div> ); } } export default Counter;
Change the message of rerender to make more sense
Change the message of rerender to make more sense
JSX
mit
xabikos/aspnet5-react-webpack-boilerplate,xabikos/aspnet5-react-webpack-boilerplate
--- +++ @@ -25,7 +25,7 @@ Seconds since the component loaded: {this.state.secondsElapsed} </p> <p id="rerender"> - Component has been rerender due to user changes: {this.rerender} + Component has been rerender : {this.rerender} times </p> </div> );
13da93573ae48e83c844a4bf44976bcba0ef493e
imports/App.jsx
imports/App.jsx
import React, { Component } from 'react'; import Configuration from './Configuration'; export default class App extends Component { constructor( props ) { super( props ); this.state = { configuration : {} }; this.configurationUpdated = this.configurationUpdated.bind( this ); } configurationUpdated( state ) { console.log( state ); this.setState({ configuration : state }); } render() { return ( <div className="app"> <Configuration updateCalculator={ this.configurationUpdated } /> </div> ); } };
import React, { Component } from 'react'; import Configuration from './Configuration'; const Character = { modifier : { baseAttackBonus : 9, strength : 0, dexterity : 6, size : 0 } }; export default class App extends Component { constructor( props ) { super( props ); this.state = { configuration : {} }; this.configurationUpdated = this.configurationUpdated.bind( this ); } configurationUpdated( state ) { console.log( state ); this.setState({ configuration : state }); } attackSequence() { const numberOfAttacks = 'fullAttack' === ( this.state.configuration.actionType || 'fullAttack' ) ? 1 + Math.floor( ( Character.modifier.baseAttackBonus - 1 ) / 5 ) : 1; let attackSequence = []; for( let count = 0; count < numberOfAttacks; ++count ) { const attack = { key : count, attackBonus : Character.modifier.baseAttackBonus + Character.modifier.dexterity - 5 * count }; attackSequence.push( attack ); } return attackSequence; } render() { const attackSequence = this.attackSequence(); return ( <div className="app"> <Configuration updateCalculator={ this.configurationUpdated } /> <ul className="attackSequence"> { attackSequence.map( ( attack ) => <li key={ attack.key }>attackBonus: { attack.attackBonus }</li> ) } </ul> </div> ); } };
Build an attack sequence from state configuration
Build an attack sequence from state configuration
JSX
mit
mdingena/Pathfinder-Attack-Calculator,mdingena/Pathfinder-Attack-Calculator
--- +++ @@ -1,5 +1,14 @@ import React, { Component } from 'react'; import Configuration from './Configuration'; + +const Character = { + modifier : { + baseAttackBonus : 9, + strength : 0, + dexterity : 6, + size : 0 + } +}; export default class App extends Component { constructor( props ) { @@ -17,10 +26,32 @@ }); } + attackSequence() { + const numberOfAttacks = 'fullAttack' === ( this.state.configuration.actionType || 'fullAttack' ) ? 1 + Math.floor( ( Character.modifier.baseAttackBonus - 1 ) / 5 ) : 1; + let attackSequence = []; + for( let count = 0; count < numberOfAttacks; ++count ) { + const attack = { + key : count, + attackBonus : Character.modifier.baseAttackBonus + + Character.modifier.dexterity + - 5 * count + }; + attackSequence.push( attack ); + } + return attackSequence; + } + render() { + const attackSequence = this.attackSequence(); return ( <div className="app"> <Configuration updateCalculator={ this.configurationUpdated } /> + <ul className="attackSequence"> + { attackSequence.map( + ( attack ) => + <li key={ attack.key }>attackBonus: { attack.attackBonus }</li> + ) } + </ul> </div> ); }
453060c31b6c14139850d3dde4d1d9502c62ef42
views/head.jsx
views/head.jsx
'use strict'; var React = require('react'); module.exports = React.createClass({ render: function() { return ( <head> <meta charSet="utf-8" /> <meta httpEquiv="X-UA-Compatible" content="IE=edge" /> <title>Match Audio</title> <meta name="description" content="" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:site" content="@MatchAudio" /> <meta name="twitter:title" property="og:title" content="" /> <meta name="twitter:description" property="og:description" content="We've matched this music on Rdio, Spotify, Deezer, Beats Music, Google Music and iTunes so you can open it in the service you use." /> <meta name="twitter:image:src" property="og:image" content="" /> <meta property="og:url" content="" /> <link rel="shortcut icon" href="/images/favicon.png" /> <link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css' /> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" /> <link rel="stylesheet" href="/stylesheets/style.css" /> </head> ); } });
'use strict'; var React = require('react'); module.exports = React.createClass({ render: function() { return ( <head> <meta charSet="utf-8" /> <meta httpEquiv="X-UA-Compatible" content="IE=edge" /> <title>Match Audio</title> <meta name="description" content="" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#FE4365" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:site" content="@MatchAudio" /> <meta name="twitter:title" property="og:title" content="" /> <meta name="twitter:description" property="og:description" content="We've matched this music on Rdio, Spotify, Deezer, Beats Music, Google Music and iTunes so you can open it in the service you use." /> <meta name="twitter:image:src" property="og:image" content="" /> <meta property="og:url" content="" /> <link rel="shortcut icon" href="/images/favicon.png" /> <link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css' /> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" /> <link rel="stylesheet" href="/stylesheets/style.css" /> </head> ); } });
Use theme colour for Chrome on Lollipop
Use theme colour for Chrome on Lollipop
JSX
mit
kudos/match.audio,kudos/match.audio
--- +++ @@ -12,6 +12,7 @@ <title>Match Audio</title> <meta name="description" content="" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta name="theme-color" content="#FE4365" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:site" content="@MatchAudio" /> <meta name="twitter:title" property="og:title" content="" />
a7c4bdc94c2ee0b9b65d34d872cf1cf753dd851d
app/assets/javascripts/components/features/compose/components/live_preview.jsx
app/assets/javascripts/components/features/compose/components/live_preview.jsx
import PropTypes from 'prop-types'; const loadScriptOnce = require('load-script-once'); class LivePreview extends React.PureComponent { componentDidUpdate() { const node = ReactDOM.findDOMNode(this); if (MathJax != undefined) { MathJax.Hub.Queue(["Typeset", MathJax.Hub, node]); } } render () { const text = this.props.text; return <div>{text}</div> } } LivePreview.propTypes = { text: PropTypes.string.isRequired, } export default LivePreview;
import PropTypes from 'prop-types'; import emojify from '../../../emoji'; const loadScriptOnce = require('load-script-once'); class LivePreview extends React.PureComponent { componentDidUpdate() { const node = ReactDOM.findDOMNode(this); if (MathJax != undefined) { MathJax.Hub.Queue(["Typeset", MathJax.Hub, node]); } } render () { const text = this.props.text.replace(/\n/, '<br>'); return <div dangerouslySetInnerHTML={{ __html: emojify(text)}} /> } } LivePreview.propTypes = { text: PropTypes.string.isRequired, } export default LivePreview;
Replace the new line code to the br tag in live preview and emojify
Replace the new line code to the br tag in live preview and emojify
JSX
agpl-3.0
Nyoho/mastodon,koteitan/googoldon,koteitan/googoldon,Nyoho/mastodon,koteitan/googoldon,koteitan/googoldon,Nyoho/mastodon,Nyoho/mastodon
--- +++ @@ -1,4 +1,5 @@ import PropTypes from 'prop-types'; +import emojify from '../../../emoji'; const loadScriptOnce = require('load-script-once'); class LivePreview extends React.PureComponent { @@ -11,8 +12,8 @@ } render () { - const text = this.props.text; - return <div>{text}</div> + const text = this.props.text.replace(/\n/, '<br>'); + return <div dangerouslySetInnerHTML={{ __html: emojify(text)}} /> } }
4d56e64759ac9d061ae3e8fe6ad9556d9ae88c87
client/tab.jsx
client/tab.jsx
let React = require('react') , { Link, State } = require('react-router') // TODO(tec27): write a tabs component because the material-ui one is kinda bad let Tab = React.createClass({ mixins: [ State ], render() { let isActive = this.isActive(this.props.route) return ( <li className={isActive ? 'tab-active' : ''}> <Link to={this.props.route}>{this.props.label}</Link> </li> ) }, }) module.exports = Tab
let React = require('react') , { Link, State } = require('react-router') // TODO(tec27): write a tabs component because the material-ui one is kinda bad class Tab extends React.Component { render() { let isActive = this.context.router.isActive(this.props.route) return ( <li className={isActive ? 'tab-active' : ''}> <Link to={this.props.route}>{this.props.label}</Link> </li> ) } } Tab.contextTypes = { router: React.PropTypes.func } module.exports = Tab
Remove deprecated mixin usage, move Tab to being an ES6 class.
Remove deprecated mixin usage, move Tab to being an ES6 class.
JSX
mit
ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery
--- +++ @@ -2,18 +2,20 @@ , { Link, State } = require('react-router') // TODO(tec27): write a tabs component because the material-ui one is kinda bad -let Tab = React.createClass({ - mixins: [ State ], - +class Tab extends React.Component { render() { - let isActive = this.isActive(this.props.route) + let isActive = this.context.router.isActive(this.props.route) return ( <li className={isActive ? 'tab-active' : ''}> <Link to={this.props.route}>{this.props.label}</Link> </li> ) - }, -}) + } +} + +Tab.contextTypes = { + router: React.PropTypes.func +} module.exports = Tab
ced0383de2f8c13b1f42515620ff04291b6b194a
src/js/AnimalWrapper.jsx
src/js/AnimalWrapper.jsx
'use strict'; var AnimalImage = require('./AnimalImage.jsx'); var AnimalWrapper = React.createClass({ handleClick: function () { this.props.onClick(this); }, render: function() { var listItemClassList = this.props.active + " block Animal-wrapper p1 col col-12 mt1 mb1"; var src = "http://www.chloechen.io/images/Animals/thumbnail/" + this.props.data.id + ".jpg"; return ( <li onClick={this.handleClick} className={listItemClassList} > </li> ); } }); module.exports = AnimalWrapper;
'use strict'; var AnimalImage = require('./AnimalImage.jsx'); var AnimalWrapper = React.createClass({ handleClick: function () { this.props.onClick(this); }, render: function() { var listItemClassList = this.props.active + " block Animal-wrapper p1 col col-12 mt1 mb1"; var src = "http://www.chloechen.io/images/Animals/thumbnail/" + this.props.data.id + ".jpg"; return ( <li onClick={this.handleClick} className={listItemClassList} > <figure> <AnimalImage src={src} alt={this.props.data.commonName} /> </figure> <h3 className="figcaption">{this.props.data.commonName}</h3> </li> ); } }); module.exports = AnimalWrapper;
Return for render complete, render successful
Return for render complete, render successful
JSX
isc
Yangani/maasai-mara,Yangani/maasai-mara
--- +++ @@ -12,6 +12,10 @@ var src = "http://www.chloechen.io/images/Animals/thumbnail/" + this.props.data.id + ".jpg"; return ( <li onClick={this.handleClick} className={listItemClassList} > + <figure> + <AnimalImage src={src} alt={this.props.data.commonName} /> + </figure> + <h3 className="figcaption">{this.props.data.commonName}</h3> </li> ); }
d9b3e9a9e714ff32c7061845453c121201bded65
src/components/counter.jsx
src/components/counter.jsx
import React, { PropTypes } from 'react' const Counter = ({ counter, decrement, increment }) => ( <div> <h1><strong>{counter}</strong></h1> <button onClick={decrement}>-</button> <button onClick={increment}>+</button> </div> ) Counter.defaultProps = { decrement: () => undefined, increment: () => undefined } Counter.propTypes = { counter: PropTypes.number.isRequired, decrement: PropTypes.func, increment: PropTypes.func } export default Counter
import React, { PropTypes, Component } from 'react' class Counter extends Component { render() { const { counter, decrement, increment } = this.props return ( <div> <h1><strong>{counter}</strong></h1> <button onClick={decrement}>-</button> <button onClick={increment}>+</button> </div> ) } } Counter.defaultProps = { decrement: () => undefined, increment: () => undefined } Counter.propTypes = { counter: PropTypes.number.isRequired, decrement: PropTypes.func, increment: PropTypes.func } export default Counter
Refactor to use class instead of functional components because of HMR
Refactor to use class instead of functional components because of HMR
JSX
mit
rwillrich/life-goals-tracker
--- +++ @@ -1,12 +1,18 @@ -import React, { PropTypes } from 'react' +import React, { PropTypes, Component } from 'react' -const Counter = ({ counter, decrement, increment }) => ( - <div> - <h1><strong>{counter}</strong></h1> - <button onClick={decrement}>-</button> - <button onClick={increment}>+</button> - </div> -) +class Counter extends Component { + render() { + const { counter, decrement, increment } = this.props + + return ( + <div> + <h1><strong>{counter}</strong></h1> + <button onClick={decrement}>-</button> + <button onClick={increment}>+</button> + </div> + ) + } +} Counter.defaultProps = { decrement: () => undefined,
70c178a62b34b6575dd1cb9bbf96af4404fdd759
src/components/NavBar/index.jsx
src/components/NavBar/index.jsx
import React from 'react'; import styles from './index.scss'; import { Link } from 'react-router'; import { actions as currentUserActions } from 'redux/modules/currentUser'; import { connect } from 'react-redux'; const mapStateToProps = (state) => ({ currentUser: state.currentUser, }); export default class NavBar extends React.Component { static propTypes = { currentUser: React.PropTypes.object, } render() { const { currentUser, } = this.props; return ( <div className={styles.component}> <Link to={currentUser ? '/home' : '/'}> Gift Thing </Link> <div> {currentUser && <div> {currentUser.name}{' '} <a href="/auth/logout">Log out</a> </div> } {!currentUser && <Link to="/auth/login/facebook">Log in</Link> } </div> </div> ); } } export default connect(mapStateToProps, currentUserActions)(NavBar);
import React from 'react'; import styles from './index.scss'; import { Link } from 'react-router'; import { actions as currentUserActions } from 'redux/modules/currentUser'; import { connect } from 'react-redux'; const mapStateToProps = (state) => ({ currentUser: state.currentUser, }); export default class NavBar extends React.Component { static propTypes = { currentUser: React.PropTypes.object, } render() { const { currentUser, } = this.props; return ( <div className={styles.component}> <Link to={currentUser ? '/home' : '/'}> Gift Thing </Link> <div> {currentUser && <div> {currentUser.name}{' '} <a href="/auth/logout">Log out</a> </div> } {!currentUser && <a href="/auth/login/facebook">Log in</a> } </div> </div> ); } } export default connect(mapStateToProps, currentUserActions)(NavBar);
Use <a> for log in link in <NavBar>
Use <a> for log in link in <NavBar> This needs to be a regular link, not one handled by the router. I'm not sure if there is a better way to do this, but this works for now so I'm rolling with it.
JSX
mit
lencioni/gift-thing,lencioni/gift-thing
--- +++ @@ -32,7 +32,7 @@ </div> } {!currentUser && - <Link to="/auth/login/facebook">Log in</Link> + <a href="/auth/login/facebook">Log in</a> } </div> </div>
17ffea8e3d9c10a3997f491d1143d66c0e629d09
src/modules/App/Routes.jsx
src/modules/App/Routes.jsx
import React, { Component } from "react"; export default Routes
import React, { Component } from "react"; import { Router, Route, IndexRoute, hashHistory } from "react-router"; import HomeView from '~/views/HomeView'; import ContentView from '~/views/ContentView'; import SettingsView from '~/views/SettingsView'; const Routes = () => { return ( <Provider store={store}> <Router history={hashHistory}> <Route exact path="/" component={HomeView} /> <Route path='content' component={ContentView}/> <Route path='settings' component={SettingsView}></Route> </Router> </Provider> ) } export default Routes
Add routes incase future switch
feat: Add routes incase future switch
JSX
mit
AdamSalma/Lurka,AdamSalma/Lurka
--- +++ @@ -1,4 +1,26 @@ import React, { Component } from "react"; +import { + Router, + Route, + IndexRoute, + hashHistory +} from "react-router"; + +import HomeView from '~/views/HomeView'; +import ContentView from '~/views/ContentView'; +import SettingsView from '~/views/SettingsView'; + +const Routes = () => { + return ( + <Provider store={store}> + <Router history={hashHistory}> + <Route exact path="/" component={HomeView} /> + <Route path='content' component={ContentView}/> + <Route path='settings' component={SettingsView}></Route> + </Router> + </Provider> + ) +} export default Routes
4bbb8cc72eb2f4ff2a7003ad918eb75b8876a950
js/ShowCard.jsx
js/ShowCard.jsx
const React = require('react') const ShowCard = (props) => ( <div className='show-card'> <img src={`public/img/posters/${props.poster}`} className='show-card-img' /> <div className='show-card-text'> <h3 className='show-card-title'>{props.title}</h3> <h4 className='show-card-year'>({props.year})</h4> <h4 className='show-card-description'>({props.description})</h4> </div> </div> ) const { string } = React.PropTypes ShowCard.propTypes = { title: string.isRequired, description: string.isRequired, year: string.isRequired, poster: string.isRequired } module.exports = ShowCard
const React = require('react') const { Link } = require('react-router') const ShowCard = (props) => ( <Link to={`/details/${props.imdbID}`}> <div className='show-card'> <img src={`public/img/posters/${props.poster}`} className='show-card-img' /> <div className='show-card-text'> <h3 className='show-card-title'>{props.title}</h3> <h4 className='show-card-year'>({props.year})</h4> <h4 className='show-card-description'>({props.description})</h4> </div> </div> </Link> ) const { string } = React.PropTypes ShowCard.propTypes = { title: string.isRequired, description: string.isRequired, year: string.isRequired, poster: string.isRequired, imdbID: string.isRequired } module.exports = ShowCard
Set showcards to link details page
Set showcards to link details page
JSX
mit
michaeldumalag/ReactSelfLearning,michaeldumalag/ReactSelfLearning
--- +++ @@ -1,14 +1,17 @@ const React = require('react') +const { Link } = require('react-router') const ShowCard = (props) => ( - <div className='show-card'> - <img src={`public/img/posters/${props.poster}`} className='show-card-img' /> - <div className='show-card-text'> - <h3 className='show-card-title'>{props.title}</h3> - <h4 className='show-card-year'>({props.year})</h4> - <h4 className='show-card-description'>({props.description})</h4> + <Link to={`/details/${props.imdbID}`}> + <div className='show-card'> + <img src={`public/img/posters/${props.poster}`} className='show-card-img' /> + <div className='show-card-text'> + <h3 className='show-card-title'>{props.title}</h3> + <h4 className='show-card-year'>({props.year})</h4> + <h4 className='show-card-description'>({props.description})</h4> + </div> </div> - </div> + </Link> ) const { string } = React.PropTypes @@ -17,8 +20,8 @@ title: string.isRequired, description: string.isRequired, year: string.isRequired, - poster: string.isRequired - + poster: string.isRequired, + imdbID: string.isRequired } module.exports = ShowCard
c4c978850d438cb538252a85cfcaa1a904661a57
src/components/user-name.jsx
src/components/user-name.jsx
import React from 'react' import {Link} from 'react-router' import {connect} from 'react-redux' import {preventDefault} from '../utils' import * as FrontendPrefsOptions from '../utils/frontend-preferences-options' const DisplayOption = ({user, me, preferences}) => { if (user.username === me && preferences.useYou) { return <span>You</span> } if (user.screenName === user.username) { return <span>{user.screenName}</span> } switch (preferences.displayOption) { case FrontendPrefsOptions.DISPLAYNAMES_DISPLAYNAME: { return <span>{user.screenName}</span> } case FrontendPrefsOptions.DISPLAYNAMES_BOTH: { return <span>{user.screenName} ({user.username})</span> } case FrontendPrefsOptions.DISPLAYNAMES_USERNAME: { return <span>{user.username}</span> } } return <span>{user.screenName}</span> } const UserName = (props) => ( <Link to={`/${props.user.username}`} className={`user-name-info ${props.className}`}> {props.display ? ( <span>{props.display}</span> ) : ( <DisplayOption user={props.user} me={props.me} preferences={props.frontendPreferences.displayNames}/> )} </Link> ) const mapStateToProps = (state) => { return { me: state.user.username, frontendPreferences: state.user.frontendPreferences } } export default connect(mapStateToProps)(UserName)
import React from 'react' import {Link} from 'react-router' import {connect} from 'react-redux' import * as FrontendPrefsOptions from '../utils/frontend-preferences-options' const DisplayOption = ({user, me, preferences}) => { if (user.username === me && preferences.useYou) { return <span>You</span> } if (user.screenName === user.username) { return <span>{user.screenName}</span> } switch (preferences.displayOption) { case FrontendPrefsOptions.DISPLAYNAMES_DISPLAYNAME: { return <span>{user.screenName}</span> } case FrontendPrefsOptions.DISPLAYNAMES_BOTH: { return <span>{user.screenName} ({user.username})</span> } case FrontendPrefsOptions.DISPLAYNAMES_USERNAME: { return <span>{user.username}</span> } } return <span>{user.screenName}</span> } class UserName extends React.Component { render() { return ( <Link to={`/${this.props.user.username}`} className={`user-name-info ${this.props.className}`}> {this.props.display ? ( <span>{this.props.display}</span> ) : ( <DisplayOption user={this.props.user} me={this.props.me} preferences={this.props.frontendPreferences.displayNames}/> )} </Link> ) } } const mapStateToProps = (state) => { return { me: state.user.username, frontendPreferences: state.user.frontendPreferences } } export default connect(mapStateToProps)(UserName)
Refactor <UserName> into non-simplified component
Refactor <UserName> into non-simplified component And remove an import of unused preventDefault.
JSX
mit
clbn/freefeed-gamma,FreeFeed/freefeed-react-client,davidmz/freefeed-react-client,ujenjt/freefeed-react-client,davidmz/freefeed-react-client,kadmil/freefeed-react-client,clbn/freefeed-gamma,ujenjt/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client,ujenjt/freefeed-react-client,FreeFeed/freefeed-react-client,clbn/freefeed-gamma,kadmil/freefeed-react-client
--- +++ @@ -2,7 +2,6 @@ import {Link} from 'react-router' import {connect} from 'react-redux' -import {preventDefault} from '../utils' import * as FrontendPrefsOptions from '../utils/frontend-preferences-options' const DisplayOption = ({user, me, preferences}) => { @@ -29,18 +28,22 @@ return <span>{user.screenName}</span> } -const UserName = (props) => ( - <Link to={`/${props.user.username}`} className={`user-name-info ${props.className}`}> - {props.display ? ( - <span>{props.display}</span> - ) : ( - <DisplayOption - user={props.user} - me={props.me} - preferences={props.frontendPreferences.displayNames}/> - )} - </Link> -) +class UserName extends React.Component { + render() { + return ( + <Link to={`/${this.props.user.username}`} className={`user-name-info ${this.props.className}`}> + {this.props.display ? ( + <span>{this.props.display}</span> + ) : ( + <DisplayOption + user={this.props.user} + me={this.props.me} + preferences={this.props.frontendPreferences.displayNames}/> + )} + </Link> + ) + } +} const mapStateToProps = (state) => { return {
1f087e530508f612f97275eaff82a8cfad77479a
src/renderer/components/server-list.jsx
src/renderer/components/server-list.jsx
import React, { Component, PropTypes } from 'react'; import ServerListItem from './server-list-item.jsx'; import Message from './message.jsx'; export default class ServerList extends Component { static propTypes = { servers: PropTypes.array.isRequired, onEditClick: PropTypes.func.isRequired, onConnectClick: PropTypes.func.isRequired, } constructor(props, context) { super(props, context); } groupItemsInRows(items) { const itemsPerRow = 4; return items.reduce((rows, item, index) => { const position = Math.floor(index / itemsPerRow); if (!rows[position]) { rows[position] = []; } rows[position].push(item); return rows; }, []); } render() { const { servers, onEditClick, onConnectClick } = this.props; if (!servers.length) { return <Message message="No results" type="info" />; } return ( <div className="ui grid"> {this.groupItemsInRows(servers).map((row, rowIdx) => <div key={rowIdx} className="doubling four column row"> {row.map(server => <div key={server.name} className="wide column"> <div className="ui"> <ServerListItem onConnectClick={() => onConnectClick(server) } onEditClick={() => onEditClick(server) } server={server} /> </div> </div> )} </div> )} </div> ); } }
import React, { Component, PropTypes } from 'react'; import ServerListItem from './server-list-item.jsx'; import Message from './message.jsx'; export default class ServerList extends Component { static propTypes = { servers: PropTypes.array.isRequired, onEditClick: PropTypes.func.isRequired, onConnectClick: PropTypes.func.isRequired, } constructor(props, context) { super(props, context); } groupItemsInRows(items) { const itemsPerRow = 4; return items.reduce((rows, item, index) => { const position = Math.floor(index / itemsPerRow); if (!rows[position]) { rows[position] = []; } rows[position].push(item); return rows; }, []); } render() { const { servers, onEditClick, onConnectClick } = this.props; if (!servers.length) { return <Message message="No results" type="info" />; } return ( <div className="ui grid"> {this.groupItemsInRows(servers).map((row, rowIdx) => <div key={rowIdx} className="doubling four column row"> {row.map(server => <div key={`${server.name}_${server.client}`} className="wide column"> <div className="ui"> <ServerListItem onConnectClick={() => onConnectClick(server) } onEditClick={() => onEditClick(server) } server={server} /> </div> </div> )} </div> )} </div> ); } }
Fix problem rendering server item with same name
Fix problem rendering server item with same name
JSX
mit
sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui
--- +++ @@ -39,7 +39,7 @@ {this.groupItemsInRows(servers).map((row, rowIdx) => <div key={rowIdx} className="doubling four column row"> {row.map(server => - <div key={server.name} className="wide column"> + <div key={`${server.name}_${server.client}`} className="wide column"> <div className="ui"> <ServerListItem onConnectClick={() => onConnectClick(server) }
e4ec81f0f35904fb3908567e36ac6c6c7012dcd5
src/sentry/static/sentry/app/components/events/sdk.jsx
src/sentry/static/sentry/app/components/events/sdk.jsx
import React from 'react'; import PropTypes from '../../proptypes'; import GroupEventDataSection from './eventDataSection'; import {t} from '../../locale'; const EventSdk = React.createClass({ propTypes: { group: PropTypes.Group.isRequired, event: PropTypes.Event.isRequired, }, render() { let {group, event} = this.props; let data = event.sdk; return ( <GroupEventDataSection group={group} event={event} type="sdk" title={t('SDK')} wrapTitle={false}> <table className="table key-value"> <tbody> <tr key="name"> <td className="key">Name</td> <td className="value"><pre>{data.name}</pre></td> </tr> <tr key="version"> <td className="key">Version</td> <td className="value"><pre>{data.version}</pre></td> </tr> </tbody> </table> </GroupEventDataSection> ); } }); export default EventSdk;
import React from 'react'; import PropTypes from '../../proptypes'; import GroupEventDataSection from './eventDataSection'; import {t} from '../../locale'; const EventSdk = React.createClass({ propTypes: { group: PropTypes.Group.isRequired, event: PropTypes.Event.isRequired, }, render() { let {group, event} = this.props; let data = event.sdk; return ( <GroupEventDataSection group={group} event={event} type="sdk" title={t('SDK')} wrapTitle={true}> <table className="table key-value"> <tbody> <tr key="name"> <td className="key">Name</td> <td className="value"><pre>{data.name}</pre></td> </tr> <tr key="version"> <td className="key">Version</td> <td className="value"><pre>{data.version}</pre></td> </tr> </tbody> </table> </GroupEventDataSection> ); } }); export default EventSdk;
Fix SDK interface header font
Fix SDK interface header font /cc @getsentry/ui
JSX
bsd-3-clause
mitsuhiko/sentry,ifduyue/sentry,ifduyue/sentry,looker/sentry,BuildingLink/sentry,fotinakis/sentry,gencer/sentry,ifduyue/sentry,looker/sentry,mvaled/sentry,mvaled/sentry,alexm92/sentry,JackDanger/sentry,ifduyue/sentry,beeftornado/sentry,alexm92/sentry,JamesMura/sentry,gencer/sentry,JamesMura/sentry,alexm92/sentry,mitsuhiko/sentry,mvaled/sentry,JackDanger/sentry,BuildingLink/sentry,JamesMura/sentry,looker/sentry,jean/sentry,beeftornado/sentry,jean/sentry,BuildingLink/sentry,BuildingLink/sentry,gencer/sentry,BuildingLink/sentry,looker/sentry,zenefits/sentry,JamesMura/sentry,looker/sentry,gencer/sentry,jean/sentry,JamesMura/sentry,fotinakis/sentry,beeftornado/sentry,mvaled/sentry,gencer/sentry,zenefits/sentry,mvaled/sentry,mvaled/sentry,ifduyue/sentry,zenefits/sentry,fotinakis/sentry,zenefits/sentry,jean/sentry,jean/sentry,JackDanger/sentry,fotinakis/sentry,zenefits/sentry
--- +++ @@ -13,13 +13,14 @@ render() { let {group, event} = this.props; let data = event.sdk; + return ( <GroupEventDataSection group={group} event={event} type="sdk" title={t('SDK')} - wrapTitle={false}> + wrapTitle={true}> <table className="table key-value"> <tbody> <tr key="name">
9b2d1b9960076949e373c59180c2a569838e2660
src/ext/twitter/components/ListTweet.jsx
src/ext/twitter/components/ListTweet.jsx
var React = require('react'); var moment = require('moment'); var ListTweet = React.createClass({ render() { var cssClasses = 'list__item'; return ( <div className={cssClasses}> {this.props.tweet.text} </div> ); } }); module.exports = ListTweet;
var React = require('react'); var moment = require('moment'); var ListTweet = React.createClass({ render() { var cssClasses = 'list__item'; return ( <div className={cssClasses}> {this.props.tweet.text} <div> <i className="fa fa-retweet" /> {this.props.tweet.retweet_count}&nbsp; <i className="fa fa-star" /> {this.props.tweet.favorite_count} </div> </div> ); } }); module.exports = ListTweet;
Add fav and retweet count for twitter list tweet
Add fav and retweet count for twitter list tweet
JSX
mit
beni55/mozaik,michaelchiche/mozaik,juhamust/mozaik,beni55/mozaik,tlenclos/mozaik,plouc/mozaik,tlenclos/mozaik,codeaudit/mozaik,plouc/mozaik,backjo/mozaikdummyfork,juhamust/mozaik,danielw92/mozaik,backjo/mozaikdummyfork,michaelchiche/mozaik,codeaudit/mozaik,danielw92/mozaik
--- +++ @@ -8,6 +8,10 @@ return ( <div className={cssClasses}> {this.props.tweet.text} + <div> + <i className="fa fa-retweet" /> {this.props.tweet.retweet_count}&nbsp; + <i className="fa fa-star" /> {this.props.tweet.favorite_count} + </div> </div> ); }
f6210e882abe1ec880be40dc18dc2b91061cb61e
app/react/components/footer/icon.jsx
app/react/components/footer/icon.jsx
import React from "react"; export default React.createClass({ propTypes: { children: React.PropTypes.string.isRequired, href: React.PropTypes.string.isRequired, src: React.PropTypes.string.isRequired, target: React.PropTypes.string }, render: function() { return ( <div className="icon-container"> <div className="icon"> <img className="footer-icon" src={this.props.src}></img> <a target={this.props.target} href={this.props.href}>{this.props.children}</a> </div> </div> ); } });
import React from "react"; export default class Icon extends React.Component { render() { return ( <div className="icon-container"> <div className="icon"> <img className="footer-icon" src={this.props.src}></img> <a target={this.props.target} href={this.props.href}>{this.props.children}</a> </div> </div> ); } } Icon.propTypes = { children: React.PropTypes.string.isRequired, href: React.PropTypes.string.isRequired, src: React.PropTypes.string.isRequired, target: React.PropTypes.string };
Make changes for es6 migrations
Icon: Make changes for es6 migrations See #613
JSX
mpl-2.0
mozilla/science.mozilla.org,mozilla/science.mozilla.org
--- +++ @@ -1,13 +1,9 @@ import React from "react"; -export default React.createClass({ - propTypes: { - children: React.PropTypes.string.isRequired, - href: React.PropTypes.string.isRequired, - src: React.PropTypes.string.isRequired, - target: React.PropTypes.string - }, - render: function() { +export default class Icon extends React.Component { + + render() { + return ( <div className="icon-container"> <div className="icon"> @@ -17,4 +13,11 @@ </div> ); } -}); +} + +Icon.propTypes = { + children: React.PropTypes.string.isRequired, + href: React.PropTypes.string.isRequired, + src: React.PropTypes.string.isRequired, + target: React.PropTypes.string +};
6e350fd545a3a10ee3979de8956713bc29ec9d2b
src/components/Header.jsx
src/components/Header.jsx
import React from 'react' class Header extends React.Component { render() { const headerStyle = { color: "#FFFFFF" } return ( <h1 style={headerStyle}> mattcodes. </h1> ) } } export default Header
import React from 'react' class Header extends React.Component { render() { const headerStyle = { color: "#FFFFFF", borderBottom: "1px solid #FFFFFF" } return ( <h1 style={headerStyle}> mattcodes. </h1> ) } } export default Header
Add white bottom border to header
Add white bottom border to header
JSX
mit
mattszabo/mattcodes,mattszabo/mattcodes
--- +++ @@ -3,7 +3,8 @@ class Header extends React.Component { render() { const headerStyle = { - color: "#FFFFFF" + color: "#FFFFFF", + borderBottom: "1px solid #FFFFFF" } return ( <h1 style={headerStyle}>
e5c3925d7e740272c89be8262fe5494835b6254d
src/components/post-likes.jsx
src/components/post-likes.jsx
import React from 'react'; import UserName from './user-name'; import {preventDefault} from '../utils'; const renderLike = (item, i, items) => ( <li key={item.id}> {item.id !== 'more-likes' ? ( <UserName user={item}/> ) : ( <a onClick={preventDefault(item.showMoreLikes)}>{item.omittedLikes} other people</a> )} {i < items.length - 2 ? ( <span>, </span> ) : i === items.length - 2 ? ( <span> and </span> ) : ( <span> liked this</span> )} </li> ); export default (props) => { if (!props.likes.length) { return <div/>; } const likeList = [...props.likes]; if (props.post.omittedLikes) { likeList.push({ id: 'more-likes', omittedLikes: props.post.omittedLikes, showMoreLikes: () => props.showMoreLikes(props.post.id) }); } const renderedLikes = likeList.map(renderLike); return ( <div className="likes"> <i className="fa fa-heart icon"></i> <ul>{renderedLikes}</ul> </div> ); };
import React from 'react'; import {connect} from 'react-redux'; import UserName from './user-name'; import {preventDefault} from '../utils'; const renderLike = (item, i, items) => ( <li key={item.id}> {item.id !== 'more-likes' ? ( <UserName user={item}/> ) : ( <a onClick={preventDefault(item.showMoreLikes)}>{item.omittedLikes} other people</a> )} {i < items.length - 2 ? ( <span>, </span> ) : i === items.length - 2 ? ( <span> and </span> ) : ( <span> liked this</span> )} </li> ); const PostLikes = (props) => { if (!props.likes.length) { return <div/>; } const likeList = [...props.likes]; likeList.sort((a, b) => { if (a.id == props.me.id) { return -1; } if (b.id == props.me.id) { return 1; } }); if (props.post.omittedLikes) { likeList.push({ id: 'more-likes', omittedLikes: props.post.omittedLikes, showMoreLikes: () => props.showMoreLikes(props.post.id) }); } const renderedLikes = likeList.map(renderLike); return ( <div className="likes"> <i className="fa fa-heart icon"></i> <ul>{renderedLikes}</ul> </div> ); }; const mapStateToProps = (state) => { return { me: state.user }; }; export default connect(mapStateToProps)(PostLikes);
Sort likes so "You" is always the first one
Sort likes so "You" is always the first one This fixes the issue with incoming realtime likes.
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -1,4 +1,5 @@ import React from 'react'; +import {connect} from 'react-redux'; import UserName from './user-name'; import {preventDefault} from '../utils'; @@ -21,12 +22,17 @@ </li> ); -export default (props) => { +const PostLikes = (props) => { if (!props.likes.length) { return <div/>; } const likeList = [...props.likes]; + + likeList.sort((a, b) => { + if (a.id == props.me.id) { return -1; } + if (b.id == props.me.id) { return 1; } + }); if (props.post.omittedLikes) { likeList.push({ @@ -45,3 +51,11 @@ </div> ); }; + +const mapStateToProps = (state) => { + return { + me: state.user + }; +}; + +export default connect(mapStateToProps)(PostLikes);
01d29d89b8a51d1fb5cbf5715e43aae7e6248261
ui/src/home/demos_page_test.jsx
ui/src/home/demos_page_test.jsx
/* @flow weak */ import React from 'react'; import {shallow} from 'enzyme'; import {expect} from 'chai'; import DemosPage from './demos_page.jsx'; import {List, ListItem} from 'material-ui/List'; describe('<DemosPage />', () => { it('renders', () => { const wrapper = shallow(<DemosPage />); expect(wrapper.find(List).length).to.equal(2); expect(wrapper.find(ListItem).length).to.equal(11); }); });
/* @flow weak */ import React from 'react'; import {shallow} from 'enzyme'; import {expect} from 'chai'; import DemosPage from './demos_page.jsx'; import {List, ListItem} from 'material-ui/List'; describe('<DemosPage />', () => { it('renders', () => { const wrapper = shallow(<DemosPage />); expect(wrapper.find(List).length).to.equal(2); expect(wrapper.find(ListItem).length).to.equal(12); }); });
Add demos link to test
Add demos link to test
JSX
mit
kesiena115/threeflows,kesiena115/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows,kesiena115/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows
--- +++ @@ -11,6 +11,6 @@ it('renders', () => { const wrapper = shallow(<DemosPage />); expect(wrapper.find(List).length).to.equal(2); - expect(wrapper.find(ListItem).length).to.equal(11); + expect(wrapper.find(ListItem).length).to.equal(12); }); });
5d5c99b93cbd4cb7020139a365a82be891a44edd
src/components/TimelineEvent.jsx
src/components/TimelineEvent.jsx
'use strict'; import React, { Component } from 'react'; import TimelineEventToolbar from './TimelineEventToolbar'; import StaticGMap from './StaticMapEventLocation'; const handleToggle = function(evt) { const $target = $(evt.currentTarget), $mapWrapper = $target.find('.static-map-wrapper'), $toggleArrow = $target.find('.map-toggle'); $toggleArrow.hasClass('glyphicon-menu-right') ? $toggleArrow.removeClass('glyphicon-menu-right').addClass('glyphicon-menu-down') : $toggleArrow.removeClass('glyphicon-menu-down').addClass('glyphicon-menu-right'); $mapWrapper.toggleClass('active'); }; const TimelineEvent = ({ evt, evtName, evtLocation, evtAlign, evtDescription, evtNote, logModalData, toggleModal }) => ( <li className={ `tl-event${evtAlign}` }> <div className="tl-marker"> <i className="glyphicon glyphicon-record" /> </div> <div className="tl-event-panel"> <TimelineEventToolbar evt={ evt } logModalData={ logModalData } toggleModal={ toggleModal } /> <div className="panel-header"> <h3>{ evtName }</h3> </div> <div className="panel-body"> { evtDescription } <div className="tl-location" onClick={ handleToggle }> <i className="glyphicon glyphicon-map-marker" /> <em key={ `Location_${evtLocation}` }>{ evtLocation }</em> <i className="map-toggle glyphicon glyphicon-menu-right" /> <StaticGMap evtLocation={ evtLocation } /> </div> </div> <div className="panel-footer">{ evtNote }</div> </div> </li> ); export default TimelineEvent;
'use strict'; import React, { Component } from 'react'; import TimelineEventToolbar from './TimelineEventToolbar'; import StaticGMap from './StaticMapEventLocation'; import { debounce, toggleAccordionSection } from '../Utilities'; const debounceToggle = (evt) => debounce(toggleAccordionSection(evt), 2000, true); const TimelineEvent = ({ evt, evtName, evtLocation, evtAlign, evtDescription, evtNote, logModalData, toggleModal }) => ( <li className={ `tl-event${evtAlign}` }> <div className="tl-marker"> <i className="glyphicon glyphicon-record" /> </div> <div className="tl-event-panel"> <TimelineEventToolbar evt={ evt } logModalData={ logModalData } toggleModal={ toggleModal } /> <div className="panel-header"> <h3>{ evtName }</h3> </div> <div className="panel-body"> { evtDescription } <div className="tl-location" onClick={ debounceToggle }> <i className="glyphicon glyphicon-map-marker" /> <em key={ `Location_${evtLocation}` }>{ evtLocation }</em> <i className="map-toggle glyphicon glyphicon-menu-right" /> <StaticGMap evtLocation={ evtLocation } /> </div> </div> <div className="panel-footer">{ evtNote }</div> </div> </li> ); export default TimelineEvent;
Add named imports from Utilities file
refactor: Add named imports from Utilities file
JSX
mit
IsenrichO/react-timeline,IsenrichO/react-timeline
--- +++ @@ -3,18 +3,11 @@ import TimelineEventToolbar from './TimelineEventToolbar'; import StaticGMap from './StaticMapEventLocation'; +import { debounce, toggleAccordionSection } from '../Utilities'; -const handleToggle = function(evt) { - const $target = $(evt.currentTarget), - $mapWrapper = $target.find('.static-map-wrapper'), - $toggleArrow = $target.find('.map-toggle'); +const debounceToggle = (evt) => debounce(toggleAccordionSection(evt), 2000, true); - $toggleArrow.hasClass('glyphicon-menu-right') - ? $toggleArrow.removeClass('glyphicon-menu-right').addClass('glyphicon-menu-down') - : $toggleArrow.removeClass('glyphicon-menu-down').addClass('glyphicon-menu-right'); - $mapWrapper.toggleClass('active'); -}; const TimelineEvent = ({ evt, evtName, evtLocation, evtAlign, evtDescription, evtNote, logModalData, toggleModal }) => ( <li className={ `tl-event${evtAlign}` }> @@ -33,7 +26,7 @@ { evtDescription } <div className="tl-location" - onClick={ handleToggle }> + onClick={ debounceToggle }> <i className="glyphicon glyphicon-map-marker" /> <em key={ `Location_${evtLocation}` }>{ evtLocation }</em> <i className="map-toggle glyphicon glyphicon-menu-right" />
22c3ec44f208f4fb61a6d5dc4dc0908c1fb49ac3
frontend/course-page.jsx
frontend/course-page.jsx
import React from 'react' import ReactDOM from 'react-dom' import CourseLearningCircles from './components/course-learning-circles' const dataEl = document.getElementById('course-learning-circles-data'); const learningCircles = JSON.parse(dataEl.textContent); const reactRoot = document.getElementById('course-learning-circles'); ReactDOM.render( <CourseLearningCircles learningCircles={learningCircles} defaultImageUrl={reactRoot.dataset.defaultImageUrl} />, reactRoot );
import React from 'react' import ReactDOM from 'react-dom' import CourseLearningCircles from './components/course-learning-circles' /* * Add react component to page to display learning circles associated with the course */ const dataEl = document.getElementById('course-learning-circles-data'); const learningCircles = JSON.parse(dataEl.textContent); const reactRoot = document.getElementById('course-learning-circles'); ReactDOM.render( <CourseLearningCircles learningCircles={learningCircles} defaultImageUrl={reactRoot.dataset.defaultImageUrl} />, reactRoot );
Add comment to explain purspose of react view for course page
Add comment to explain purspose of react view for course page
JSX
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
--- +++ @@ -1,6 +1,10 @@ import React from 'react' import ReactDOM from 'react-dom' import CourseLearningCircles from './components/course-learning-circles' + +/* + * Add react component to page to display learning circles associated with the course + */ const dataEl = document.getElementById('course-learning-circles-data'); const learningCircles = JSON.parse(dataEl.textContent);
027cf818a225d6b170d5d1db236d5713dc88e3d3
smoketest/layouts/ClickMe.jsx
smoketest/layouts/ClickMe.jsx
import React from "react"; const ClickMe = ({ sections, pages }) => <div onClick={() => console.log("clicked", sections, pages)}> Click me and see the console </div>; export default ClickMe;
import React from "react"; class ClickMe extends React.Component { constructor(props) { super(props); this.state = { showMessage: false }; } render() { const { showMessage } = this.state; console.log(this.props); return ( <div> <div onClick={() => this.setState(() => ({ showMessage: true }))}> Click me! </div> {showMessage && <div>You clicked!</div>} </div> ); } } export default ClickMe;
Make smoketest a little nicer
chore: Make smoketest a little nicer
JSX
mit
antwarjs/antwar
--- +++ @@ -1,8 +1,27 @@ import React from "react"; -const ClickMe = ({ sections, pages }) => - <div onClick={() => console.log("clicked", sections, pages)}> - Click me and see the console - </div>; +class ClickMe extends React.Component { + constructor(props) { + super(props); + + this.state = { + showMessage: false + }; + } + render() { + const { showMessage } = this.state; + + console.log(this.props); + + return ( + <div> + <div onClick={() => this.setState(() => ({ showMessage: true }))}> + Click me! + </div> + {showMessage && <div>You clicked!</div>} + </div> + ); + } +} export default ClickMe;
4731e9f537e2f38bdabf086d9cd3fe4abec35b6d
client/app/bundles/HelloWorld/components/admin_dashboard/admin_dashboard_top.jsx
client/app/bundles/HelloWorld/components/admin_dashboard/admin_dashboard_top.jsx
import React from 'react' export default React.createClass({ render: function () { return ( <div className="admin-dashboard-top"> <div className="row"> <div className="col-xs-12 col-md-7"> <a href="mailto:[email protected]?subject=Bulk Upload Teachers via CSV&body=Please attach your CSV file to this email."> <button className="button-green">Bulk Upload Teachers via CSV</button> </a> </div> <div className="col-xs-12 col-md-5 representative"> <div className='row'> <div className='col-xs-12'> <h4 className='representative-header'>Your Personal Quill Premium Representative</h4> </div> </div> <div className="row"> <div className="col-xs-3"> <div className='thumb-elliot' /> </div> <div className="col-xs-9"> <h3>Elliot Mandel</h3> <p>{"As your Quill Representative, I'm here to help!"}</p> <div className='representative-contact'> <p>646-820-7136</p> <p> <a className='green-link' href="mailto:[email protected]">[email protected]</a> </p> </div> </div> </div> </div> </div> </div> ) } })
import React from 'react' export default React.createClass({ render: function () { return ( <div className="admin-dashboard-top"> <div className="row"> <div className="col-xs-12 col-md-7"> <a href="mailto:[email protected]?subject=Bulk Upload Teachers via CSV&body=Please attach your CSV file to this email."> <button className="button-green">Bulk Upload Teachers via CSV</button> </a> </div> <div className="col-xs-12 col-md-5 representative"> <div className='row'> <div className='col-xs-12'> <h4 className='representative-header'>Your Personal Quill Premium Representative</h4> </div> </div> <div className="row"> <div className="col-xs-3"> <div className='thumb-hannah' /> </div> <div className="col-xs-9"> <h3>Hannah Monk</h3> <p>{"As your Quill representative, I'm here to help!"}</p> <div className='representative-contact'> <p>646-442-1095</p> <p> <a className='green-link' href="mailto:[email protected]">[email protected]</a> </p> </div> </div> </div> </div> </div> </div> ) } })
Update admin dashboard with Hannah
Update admin dashboard with Hannah Replaced elliot with hannah
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
--- +++ @@ -19,15 +19,15 @@ </div> <div className="row"> <div className="col-xs-3"> - <div className='thumb-elliot' /> + <div className='thumb-hannah' /> </div> <div className="col-xs-9"> - <h3>Elliot Mandel</h3> - <p>{"As your Quill Representative, I'm here to help!"}</p> + <h3>Hannah Monk</h3> + <p>{"As your Quill representative, I'm here to help!"}</p> <div className='representative-contact'> - <p>646-820-7136</p> + <p>646-442-1095</p> <p> - <a className='green-link' href="mailto:[email protected]">[email protected]</a> + <a className='green-link' href="mailto:[email protected]">[email protected]</a> </p> </div> </div>
045527116b56b9f3f4976ed596b7e9920492924d
src/components/group-create.jsx
src/components/group-create.jsx
import React from 'react'; import {Link} from 'react-router'; import {connect} from 'react-redux'; import _ from 'lodash'; import {createGroup, resetGroupCreateForm} from '../redux/action-creators'; import GroupCreateForm from './group-create-form'; import throbber100 from 'assets/images/throbber.gif'; const GroupCreate = (props) => ( <div className="box"> <div className="box-header-timeline"> Create a group </div> <div className="box-body"> <GroupCreateForm createGroup={props.createGroup} resetGroupCreateForm={props.resetGroupCreateForm} {...props.groupCreateForm}/> </div> </div> ); function mapStateToProps(state) { return { groupCreateForm: state.groupCreateForm }; } function mapDispatchToProps(dispatch) { return { createGroup: (...args) => dispatch(createGroup(...args)), resetGroupCreateForm: (...args) => dispatch(resetGroupCreateForm(...args)) }; } export default connect(mapStateToProps, mapDispatchToProps)(GroupCreate);
import React from 'react'; import {connect} from 'react-redux'; import {createGroup, resetGroupCreateForm} from '../redux/action-creators'; import GroupCreateForm from './group-create-form'; const GroupCreate = (props) => ( <div className="box"> <div className="box-header-timeline"> Create a group </div> <div className="box-body"> <GroupCreateForm createGroup={props.createGroup} resetGroupCreateForm={props.resetGroupCreateForm} {...props.groupCreateForm}/> </div> </div> ); function mapStateToProps(state) { return { groupCreateForm: state.groupCreateForm }; } function mapDispatchToProps(dispatch) { return { createGroup: (...args) => dispatch(createGroup(...args)), resetGroupCreateForm: (...args) => dispatch(resetGroupCreateForm(...args)) }; } export default connect(mapStateToProps, mapDispatchToProps)(GroupCreate);
Remove unused imports in GroupCreate
Remove unused imports in GroupCreate
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -1,11 +1,8 @@ import React from 'react'; -import {Link} from 'react-router'; import {connect} from 'react-redux'; -import _ from 'lodash'; import {createGroup, resetGroupCreateForm} from '../redux/action-creators'; import GroupCreateForm from './group-create-form'; -import throbber100 from 'assets/images/throbber.gif'; const GroupCreate = (props) => ( <div className="box">
642f7ccb4f9bbd2e6e8901f0774d210f3e00d87a
examples/undo-tree/index.jsx
examples/undo-tree/index.jsx
import Microcosm from 'Microcosm' import React from 'react' import Drawing from './components/drawing' class UndoTree extends Microcosm { shouldHistoryKeep(transaction) { return false } undo() { this.history.back() this.rollforward() } goto(node) { this.history.setFocus(node) this.rollforward() } } let app = new UndoTree() function report(x, y) { return { x, y } } app.addStore('pixels', { getInitialState() { return Array(15).join().split(',').map(_ => Array(15).join().split(',')) }, register() { return { [report](pixels, { x, y }) { pixels[y][x] = pixels[y][x] ? 0 : 1 return pixels } } } }) let el = document.getElementById('app') function render () { React.render(<Drawing app={ app } { ...app.state } onClick={ app.prepare(report) }/>, el) } app.listen(render) app.start(render)
import Microcosm from 'Microcosm' import React from 'react' import Drawing from './components/drawing' class UndoTree extends Microcosm { shouldHistoryKeep(transaction) { return true } undo() { this.history.back() this.rollforward() } goto(node) { this.history.setFocus(node) this.rollforward() } } let app = new UndoTree() function report(x, y) { return { x, y } } app.addStore('pixels', { getInitialState() { return Array(15).join().split(',').map(_ => Array(15).join().split(',')) }, register() { return { [report](pixels, { x, y }) { pixels[y][x] = pixels[y][x] ? 0 : 1 return pixels } } } }) let el = document.getElementById('app') function render () { React.render(<Drawing app={ app } { ...app.state } onClick={ app.prepare(report) }/>, el) } app.listen(render) app.start(render)
Undo history should return true in undo-tree
Undo history should return true in undo-tree
JSX
mit
vigetlabs/microcosm,leobauza/microcosm,leobauza/microcosm,vigetlabs/microcosm,vigetlabs/microcosm,leobauza/microcosm
--- +++ @@ -5,7 +5,7 @@ class UndoTree extends Microcosm { shouldHistoryKeep(transaction) { - return false + return true } undo() {
cecc21188c994938ecdef57063df6d99054ed08f
js/views/nav.jsx
js/views/nav.jsx
var React = require('react') var Link = require('react-router').Link module.exports = React.createClass({ render: function() { return ( <ul className="nav nav-tabs" style={{"margin-bottom": "60px"}}> <li><Link to="home"><i className="fa fa-desktop"></i> Home</Link></li> <li><Link to="connections"><i className="fa fa-share-alt"></i> Connections</Link></li> <li><Link to="files"><i className="fa fa-copy"></i> Files</Link></li> <li><Link to="objects"><i className="fa fa-cubes"></i> Objects</Link></li> <li><Link to="bitswap"><i className="fa fa-exchange"></i> Bitswap</Link></li> <li><Link to="routing"><i className="fa fa-cloud"></i> Routing</Link></li> <li><Link to="config"><i className="fa fa-gear"></i> Config</Link></li> <li><Link to="logs"><i className="fa fa-list"></i> Logs</Link></li> </ul> ) } })
var React = require('react') var Link = require('react-router').Link module.exports = React.createClass({ render: function() { return ( <ul className="nav nav-tabs" style={{"margin-bottom": "60px"}}> <li><Link to="home"><i className="fa fa-desktop"></i> Home</Link></li> <li><Link to="connections"><i className="fa fa-share-alt"></i> Connections</Link></li> <li><Link to="files"><i className="fa fa-copy"></i> Files</Link></li> <li><Link to="objects"><i className="fa fa-cubes"></i> Objects</Link></li> <li className="hidden"><Link to="bitswap"><i className="fa fa-exchange"></i> Bitswap</Link></li> <li className="hidden"><Link to="routing"><i className="fa fa-cloud"></i> Routing</Link></li> <li><Link to="config"><i className="fa fa-gear"></i> Config</Link></li> <li><Link to="logs"><i className="fa fa-list"></i> Logs</Link></li> </ul> ) } })
Hide tabs for incomplete pages
Hide tabs for incomplete pages
JSX
mit
manlea/ipfs,masylum/webui,ipfs/webui,manlea/ipfs,masylum/webui,ipfs/webui,ipfs/webui
--- +++ @@ -10,8 +10,8 @@ <li><Link to="connections"><i className="fa fa-share-alt"></i> Connections</Link></li> <li><Link to="files"><i className="fa fa-copy"></i> Files</Link></li> <li><Link to="objects"><i className="fa fa-cubes"></i> Objects</Link></li> - <li><Link to="bitswap"><i className="fa fa-exchange"></i> Bitswap</Link></li> - <li><Link to="routing"><i className="fa fa-cloud"></i> Routing</Link></li> + <li className="hidden"><Link to="bitswap"><i className="fa fa-exchange"></i> Bitswap</Link></li> + <li className="hidden"><Link to="routing"><i className="fa fa-cloud"></i> Routing</Link></li> <li><Link to="config"><i className="fa fa-gear"></i> Config</Link></li> <li><Link to="logs"><i className="fa fa-list"></i> Logs</Link></li> </ul>
2c5dfec348ae663b76ea1072ea24be12e09d062b
src/sentry/static/sentry/app/views/projectDetailsLayout.jsx
src/sentry/static/sentry/app/views/projectDetailsLayout.jsx
import React from 'react'; import ProjectHeader from '../components/projectHeader'; import ProjectState from '../mixins/projectState'; const ProjectDetailsLayout = React.createClass({ mixins: [ ProjectState ], getInitialState() { return { projectNavSection: null }; }, /** * This callback can be invoked by the child component * to update the active nav section (which is then passed * to the ProjectHeader */ setProjectNavSection(section) { this.setState({ projectNavSection: section }); }, getTitle() { return 'TODO FIX THIS TITLE'; }, render() { if (!this.context.project) return null; return ( <div> <ProjectHeader activeSection={this.state.projectNavSection} project={this.context.project} organization={this.getOrganization()} /> <div className="container"> <div className="content"> {React.cloneElement(this.props.children, { setProjectNavSection: this.setProjectNavSection, memberList: this.state.memberList })} </div> </div> </div> ); } }); export default ProjectDetailsLayout;
import React from 'react'; import ProjectHeader from '../components/projectHeader'; import ProjectState from '../mixins/projectState'; const ProjectDetailsLayout = React.createClass({ mixins: [ ProjectState ], getInitialState() { return { projectNavSection: null }; }, /** * This callback can be invoked by the child component * to update the active nav section (which is then passed * to the ProjectHeader */ setProjectNavSection(section) { this.setState({ projectNavSection: section }); }, render() { if (!this.context.project) return null; return ( <div> <ProjectHeader activeSection={this.state.projectNavSection} project={this.context.project} organization={this.getOrganization()} /> <div className="container"> <div className="content"> {React.cloneElement(this.props.children, { setProjectNavSection: this.setProjectNavSection, memberList: this.state.memberList })} </div> </div> </div> ); } }); export default ProjectDetailsLayout;
Remove unused getTitle proto method
Remove unused getTitle proto method
JSX
bsd-3-clause
looker/sentry,gencer/sentry,beeftornado/sentry,zenefits/sentry,BuildingLink/sentry,BuildingLink/sentry,BuildingLink/sentry,JamesMura/sentry,jean/sentry,ifduyue/sentry,jean/sentry,ifduyue/sentry,looker/sentry,jean/sentry,mvaled/sentry,JamesMura/sentry,BuildingLink/sentry,JamesMura/sentry,gencer/sentry,zenefits/sentry,mvaled/sentry,BuildingLink/sentry,JackDanger/sentry,ifduyue/sentry,zenefits/sentry,beeftornado/sentry,mvaled/sentry,looker/sentry,gencer/sentry,gencer/sentry,gencer/sentry,jean/sentry,ifduyue/sentry,beeftornado/sentry,JackDanger/sentry,mvaled/sentry,jean/sentry,ifduyue/sentry,JackDanger/sentry,JamesMura/sentry,zenefits/sentry,zenefits/sentry,JamesMura/sentry,mvaled/sentry,looker/sentry,looker/sentry,mvaled/sentry
--- +++ @@ -25,10 +25,6 @@ }); }, - getTitle() { - return 'TODO FIX THIS TITLE'; - }, - render() { if (!this.context.project) return null;
a34fe41c8c828853b9371e8c6a4320cc3654c6ac
src/app/main.jsx
src/app/main.jsx
import React from 'react'; import ReactDOM from 'react-dom'; import AppContainer from './components/app-container.jsx'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import summonerApp from './redux/reducers'; import InitialState from './redux/initial-state'; // initialData = localstorage.get(dataID) || {}; // let store = createStore(summonerApp, initialData, middleware()); // function middleware() { // on each event localstorage.save() // } // might be the proper place to set initial data, rather than app-container let store = createStore(summonerApp, InitialState); ReactDOM.render( <Provider store={store}> <AppContainer /> </Provider>, document.getElementById('mountpoint') );
import React from 'react'; import ReactDOM from 'react-dom'; import AppContainer from './components/app-container.jsx'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import summonerApp from './redux/reducers'; import InitialState from './redux/initial-state'; function LocalStorageInterface(defaultState, storeName) { this.defaultState = defaultState; this.storeName = storeName; } LocalStorageInterface.prototype.getSavedState = function() { return JSON.parse(localStorage.getItem(this.storeName)) || this.defaultState; }; LocalStorageInterface.prototype.setSavedState = function(state) { localStorage.setItem(this.storeName, JSON.stringify(state)); }; const LS = new LocalStorageInterface(InitialState, 'summonerApp'); let store = createStore(summonerApp, LS.getSavedState()); store.subscribe(function() { LS.setSavedState(store.getState()) }); ReactDOM.render( <Provider store={store}> <AppContainer /> </Provider>, document.getElementById('mountpoint') );
Add basic interface with localStorage
Add basic interface with localStorage
JSX
mit
jkrayer/summoner,jkrayer/summoner
--- +++ @@ -6,14 +6,26 @@ import summonerApp from './redux/reducers'; import InitialState from './redux/initial-state'; -// initialData = localstorage.get(dataID) || {}; -// let store = createStore(summonerApp, initialData, middleware()); -// function middleware() { -// on each event localstorage.save() -// } +function LocalStorageInterface(defaultState, storeName) { + this.defaultState = defaultState; + this.storeName = storeName; +} -// might be the proper place to set initial data, rather than app-container -let store = createStore(summonerApp, InitialState); +LocalStorageInterface.prototype.getSavedState = function() { + return JSON.parse(localStorage.getItem(this.storeName)) || this.defaultState; +}; + +LocalStorageInterface.prototype.setSavedState = function(state) { + localStorage.setItem(this.storeName, JSON.stringify(state)); +}; + +const LS = new LocalStorageInterface(InitialState, 'summonerApp'); + +let store = createStore(summonerApp, LS.getSavedState()); + +store.subscribe(function() { + LS.setSavedState(store.getState()) +}); ReactDOM.render( <Provider store={store}>
5ba07cb1741968a19763d186afeb135e2e9540ea
src/sentry/static/sentry/app/views/groupGrouping/mergedList.jsx
src/sentry/static/sentry/app/views/groupGrouping/mergedList.jsx
import React, {PropTypes} from 'react'; import {t} from '../../locale'; import {Event} from '../../proptypes'; import Pagination from '../../components/pagination'; import MergedItem from './MergedItem'; import MergedToolbar from './MergedToolbar'; const MergedList = React.createClass({ propTypes: { onUnmerge: PropTypes.func.isRequired, items: PropTypes.arrayOf(Event), pageLinks: PropTypes.string }, renderEmpty() { return ( <div className="box empty-stream"> <span className="icon icon-exclamation" /> <p>{t("There don't seem to be any hashes for this issue.")}</p> </div> ); }, render() { let {items, pageLinks, onUnmerge, ...otherProps} = this.props; let hasResults = items.length > 0; if (hasResults) { return ( <div className="grouping-list-container grouping-merged-list-container"> <h2>{t('Merged with this Issue')}</h2> <MergedToolbar onUnmerge={onUnmerge} /> <div className="grouping-list"> {items.map(({id, latestEvent}) => ( <MergedItem key={id} {...otherProps} event={latestEvent} fingerprint={id} itemCount={items.length} /> ))} </div> <Pagination pageLinks={pageLinks} /> </div> ); } return this.renderEmpty(); } }); export default MergedList;
import React, {PropTypes} from 'react'; import {t} from '../../locale'; import {Event} from '../../proptypes'; import Pagination from '../../components/pagination'; import MergedItem from './mergedItem'; import MergedToolbar from './mergedToolbar'; const MergedList = React.createClass({ propTypes: { onUnmerge: PropTypes.func.isRequired, items: PropTypes.arrayOf(Event), pageLinks: PropTypes.string }, renderEmpty() { return ( <div className="box empty-stream"> <span className="icon icon-exclamation" /> <p>{t("There don't seem to be any hashes for this issue.")}</p> </div> ); }, render() { let {items, pageLinks, onUnmerge, ...otherProps} = this.props; let hasResults = items.length > 0; if (hasResults) { return ( <div className="grouping-list-container grouping-merged-list-container"> <h2>{t('Merged with this Issue')}</h2> <MergedToolbar onUnmerge={onUnmerge} /> <div className="grouping-list"> {items.map(({id, latestEvent}) => ( <MergedItem key={id} {...otherProps} event={latestEvent} fingerprint={id} itemCount={items.length} /> ))} </div> <Pagination pageLinks={pageLinks} /> </div> ); } return this.renderEmpty(); } }); export default MergedList;
Fix case sens in import
Fix case sens in import
JSX
bsd-3-clause
beeftornado/sentry,ifduyue/sentry,ifduyue/sentry,gencer/sentry,looker/sentry,mvaled/sentry,gencer/sentry,looker/sentry,mvaled/sentry,mvaled/sentry,beeftornado/sentry,gencer/sentry,mvaled/sentry,looker/sentry,mvaled/sentry,gencer/sentry,looker/sentry,ifduyue/sentry,ifduyue/sentry,gencer/sentry,looker/sentry,beeftornado/sentry,ifduyue/sentry,mvaled/sentry
--- +++ @@ -4,8 +4,8 @@ import {Event} from '../../proptypes'; import Pagination from '../../components/pagination'; -import MergedItem from './MergedItem'; -import MergedToolbar from './MergedToolbar'; +import MergedItem from './mergedItem'; +import MergedToolbar from './mergedToolbar'; const MergedList = React.createClass({ propTypes: {
5ec2489e9029ad14cb43cd85b89844ba8c46918b
js/components/Shade.jsx
js/components/Shade.jsx
import React from 'react'; import {connect} from 'react-redux'; import {TOGGLE_SHADE_MODE} from '../actionTypes'; const Shade = (props) => <div id='shade' onClick={props.handleClick} />; const mapDispatchToProps = (dispatch) => ({ handleClick: dispatch({type: TOGGLE_SHADE_MODE}) }); module.exports = connect(() => {}, mapDispatchToProps)(Shade);
import React from 'react'; import {connect} from 'react-redux'; import {TOGGLE_SHADE_MODE} from '../actionTypes'; const Shade = (props) => <div id='shade' onClick={props.handleClick} />; const mapDispatchToProps = (dispatch) => ({ handleClick: () => dispatch({type: TOGGLE_SHADE_MODE}) }); module.exports = connect(() => ({}), mapDispatchToProps)(Shade);
Fix shade button click handler
Fix shade button click handler
JSX
mit
captbaritone/winamp2-js,captbaritone/winamp2-js,captbaritone/winamp2-js
--- +++ @@ -6,7 +6,7 @@ const Shade = (props) => <div id='shade' onClick={props.handleClick} />; const mapDispatchToProps = (dispatch) => ({ - handleClick: dispatch({type: TOGGLE_SHADE_MODE}) + handleClick: () => dispatch({type: TOGGLE_SHADE_MODE}) }); -module.exports = connect(() => {}, mapDispatchToProps)(Shade); +module.exports = connect(() => ({}), mapDispatchToProps)(Shade);
ead45eae0fbfd9cba47888610376656686a50da6
src/IssueAdd.jsx
src/IssueAdd.jsx
import React from 'react'; import PropTypes from 'prop-types'; export default class IssueAdd extends React.Component { constructor() { super(); this.handleSubmit = this.handleSubmit.bind(this); } handleSubmit(e) { e.preventDefault(); const form = document.forms.issueAdd; this.props.createIssue({ owner: form.owner.value, title: form.title.value, status: 'New', created: new Date(), }); form.owner.value = ''; form.title.value = ''; } render() { return ( <div> <form name="issueAdd" onSubmit={this.handleSubmit}> <input type="text" name="owner" placeholder="Owner" /> <input type="text" name="title" placeholder="Title" /> <button>Add</button> </form> </div> ); } } IssueAdd.propTypes = { createIssue: PropTypes.func.isRequired, };
import React from 'react'; import { Form, FormControl, Button } from 'react-bootstrap'; import PropTypes from 'prop-types'; export default class IssueAdd extends React.Component { constructor() { super(); this.handleSubmit = this.handleSubmit.bind(this); } handleSubmit(e) { e.preventDefault(); const form = document.forms.issueAdd; this.props.createIssue({ owner: form.owner.value, title: form.title.value, status: 'New', created: new Date(), }); form.owner.value = ''; form.title.value = ''; } render() { return ( <div> <Form inline name="issueAdd" onSubmit={this.handleSubmit}> <FormControl name="owner" placeholder="Owner" /> {' '} <FormControl name="title" placeholder="Title" /> {' '} <Button type="submit" bsStyle="primary">Add</Button> </Form> </div> ); } } IssueAdd.propTypes = { createIssue: PropTypes.func.isRequired, };
Add issue form change to inline boostrap form
Add issue form change to inline boostrap form
JSX
mit
seanlinxs/issue-tracker,seanlinxs/issue-tracker
--- +++ @@ -1,4 +1,5 @@ import React from 'react'; +import { Form, FormControl, Button } from 'react-bootstrap'; import PropTypes from 'prop-types'; export default class IssueAdd extends React.Component { @@ -25,11 +26,13 @@ render() { return ( <div> - <form name="issueAdd" onSubmit={this.handleSubmit}> - <input type="text" name="owner" placeholder="Owner" /> - <input type="text" name="title" placeholder="Title" /> - <button>Add</button> - </form> + <Form inline name="issueAdd" onSubmit={this.handleSubmit}> + <FormControl name="owner" placeholder="Owner" /> + {' '} + <FormControl name="title" placeholder="Title" /> + {' '} + <Button type="submit" bsStyle="primary">Add</Button> + </Form> </div> ); }
a054d36ee3b0fcb279bf9f0e808eb0123c7fe8f3
app/Application/index.jsx
app/Application/index.jsx
'use strict'; var React = require('react'); var ReactRouter = require('react-router'); var RouteHandler = ReactRouter.RouteHandler; var Menu = require('react-pure-menu'); var MenuLink = require('lib/common.jsx').MenuLink; require('purecss/build/pure.css'); require('reactabular/style.css'); require('react-pagify/style.css'); require('./skylight.css'); require('./side-menu.css'); require('./style.css'); module.exports = React.createClass({ displayName: 'Application', render() { return ( <div id='layout'> <a href='#menu' id='menuLink' className='menu-link'><span /></a> <div id='menu'> <Menu> <Menu.Heading>Koodilehto</Menu.Heading> <Menu.List> <Menu.Item> <MenuLink to='dashboard'>Dashboard</MenuLink> </Menu.Item> <Menu.Item> <MenuLink to='registers'>Registers</MenuLink> </Menu.Item> <Menu.Item> <MenuLink to='contracts'>Contracts</MenuLink> </Menu.Item> </Menu.List> </Menu> </div> <div id='main'> <RouteHandler /> </div> </div> ); } });
'use strict'; var classNames = require('classnames'); var React = require('react'); var ReactRouter = require('react-router'); var RouteHandler = ReactRouter.RouteHandler; var Menu = require('react-pure-menu'); var MenuLink = require('lib/common.jsx').MenuLink; require('purecss/build/pure.css'); require('reactabular/style.css'); require('react-pagify/style.css'); require('./skylight.css'); require('./side-menu.css'); require('./style.css'); module.exports = React.createClass({ displayName: 'Application', getInitialState() { return { menuActive: false, }; }, render() { var menuActive = this.state.menuActive; return ( <div id='layout' className={classNames({active: menuActive})}> <a href='#menu' id='menuLink' className={classNames({active: menuActive, 'menu-link': true})} onClick={this.menuLinkClicked}><span /></a> <div id='menu' className={classNames({active: menuActive})}> <Menu> <Menu.Heading>Koodilehto</Menu.Heading> <Menu.List> <Menu.Item> <MenuLink to='dashboard'>Dashboard</MenuLink> </Menu.Item> <Menu.Item> <MenuLink to='registers'>Registers</MenuLink> </Menu.Item> <Menu.Item> <MenuLink to='contracts'>Contracts</MenuLink> </Menu.Item> </Menu.List> </Menu> </div> <div id='main'> <RouteHandler /> </div> </div> ); }, menuLinkClicked(e) { e.preventDefault(); this.setState({ menuActive: !this.state.menuActive, }); } });
Allow menu to be activated on low resolution
Allow menu to be activated on low resolution Closes #1.
JSX
mit
koodilehto/koodilehto-crm-frontend,bebraw/react-crm-frontend,bebraw/react-crm-frontend,koodilehto/koodilehto-crm-frontend
--- +++ @@ -1,4 +1,5 @@ 'use strict'; +var classNames = require('classnames'); var React = require('react'); var ReactRouter = require('react-router'); var RouteHandler = ReactRouter.RouteHandler; @@ -17,12 +18,22 @@ module.exports = React.createClass({ displayName: 'Application', + getInitialState() { + return { + menuActive: false, + }; + }, + render() { + var menuActive = this.state.menuActive; + return ( - <div id='layout'> - <a href='#menu' id='menuLink' className='menu-link'><span /></a> + <div id='layout' className={classNames({active: menuActive})}> + <a href='#menu' id='menuLink' + className={classNames({active: menuActive, 'menu-link': true})} + onClick={this.menuLinkClicked}><span /></a> - <div id='menu'> + <div id='menu' className={classNames({active: menuActive})}> <Menu> <Menu.Heading>Koodilehto</Menu.Heading> @@ -45,5 +56,13 @@ </div> </div> ); + }, + + menuLinkClicked(e) { + e.preventDefault(); + + this.setState({ + menuActive: !this.state.menuActive, + }); } });
b3bae1240012798ec943f389b2fa37ee923ef7c5
index.jsx
index.jsx
'use strict'; let React = require('react'); function radio(name, selectedValue, onChange) { return React.createClass({ render: function() { return ( <input {...this.props} type="radio" name={name} checked={this.props.value === selectedValue} onChange={onChange.bind(null, this.props.value)} /> ); } }); } let RadioGroup = React.createClass({ render: function() { let {name, selectedValue, onChange} = this.props; return ( <div> {this.props.children(radio(name, selectedValue, onChange))} </div> ); } }); module.exports = RadioGroup;
'use strict'; let React = require('react'); let p = React.PropTypes; function radio(name, selectedValue, onChange) { return React.createClass({ render: function() { return ( <input {...this.props} type="radio" name={name} checked={this.props.value === selectedValue} onChange={onChange.bind(null, this.props.value)} /> ); } }); } let RadioGroup = React.createClass({ propTypes: { name: p.string, selectedValue: p.oneOfType([p.string, p.number]), onChange: p.func, children: p.func, }, render: function() { let {name, selectedValue, onChange} = this.props; return ( <div> {this.props.children && this.props.children(radio(name, selectedValue, onChange))} </div> ); } }); module.exports = RadioGroup;
Add proptypes; guard before calling children function
Add proptypes; guard before calling children function
JSX
mit
chenglou/react-radio-group,beni55/react-radio-group,chenglou/react-radio-group,beni55/react-radio-group
--- +++ @@ -1,6 +1,7 @@ 'use strict'; let React = require('react'); +let p = React.PropTypes; function radio(name, selectedValue, onChange) { return React.createClass({ @@ -18,11 +19,18 @@ } let RadioGroup = React.createClass({ + propTypes: { + name: p.string, + selectedValue: p.oneOfType([p.string, p.number]), + onChange: p.func, + children: p.func, + }, + render: function() { let {name, selectedValue, onChange} = this.props; return ( <div> - {this.props.children(radio(name, selectedValue, onChange))} + {this.props.children && this.props.children(radio(name, selectedValue, onChange))} </div> ); }
89d6523610ba3080bcc8eb1d3d543056f80fdecb
src/mb/containers/App.jsx
src/mb/containers/App.jsx
import { connect } from 'react-redux'; import Immutable from 'immutable'; import React from 'react'; import AppFooter from '../components/AppFooter'; import AppHeader from '../components/AppHeader'; import ProgressBar from '../components/ProgressBar'; import SearchBar from '../components/SearchBar'; import '../res/app.less'; /** * Application container. */ @connect( state => ({ status: state.get('status') }) ) export default class App extends React.PureComponent { static propTypes = { status: React.PropTypes.objectOf(Immutable.Map).isRequired, children: React.PropTypes.element } static defaultProps = { children: [] } render() { this.searchBar = <SearchBar onKeywordChange={e => console.log(e.keyword)} />; return ( <div className="mb-app"> <AppHeader navbars={this.searchBar} /> <ProgressBar isLoading={this.props.status.get('isLoading')} /> {this.props.children} <AppFooter /> </div> ); } }
import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { browserHistory } from 'react-router'; import Immutable from 'immutable'; import React from 'react'; import AppFooter from '../components/AppFooter'; import AppHeader from '../components/AppHeader'; import ProgressBar from '../components/ProgressBar'; import SearchBar from '../components/SearchBar'; import modelActionCreators from '../actions/model-action-creators'; import '../res/app.less'; /** * Application container. */ @connect( state => ({ status: state.get('status') }), dispatch => ({ actions: bindActionCreators(modelActionCreators, dispatch) }) ) export default class App extends React.PureComponent { static propTypes = { status: React.PropTypes.objectOf(Immutable.Map).isRequired, children: React.PropTypes.element, actions: React.PropTypes.shape({ search: React.PropTypes.func.isRequired }).isRequired } static defaultProps = { children: [] } handleQueryChange(e) { if (e.query !== null) { if (browserHistory.getCurrentLocation().pathname !== '/search') { browserHistory.push('/search'); } this.props.actions.search({ query: e.query }); } else if (browserHistory.getCurrentLocation().pathname !== '/') { browserHistory.push('/'); } } render() { this.searchBar = <SearchBar onQueryChange={e => this.handleQueryChange(e)} />; return ( <div className="mb-app"> <AppHeader navbars={this.searchBar} /> <ProgressBar isLoading={this.props.status.get('isLoading')} /> {this.props.children} <AppFooter /> </div> ); } }
Add query handler and dispatch mapping
Add query handler and dispatch mapping
JSX
mit
MagicCube/movie-board,MagicCube/movie-board,MagicCube/movie-board
--- +++ @@ -1,4 +1,6 @@ +import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; +import { browserHistory } from 'react-router'; import Immutable from 'immutable'; import React from 'react'; @@ -6,6 +8,7 @@ import AppHeader from '../components/AppHeader'; import ProgressBar from '../components/ProgressBar'; import SearchBar from '../components/SearchBar'; +import modelActionCreators from '../actions/model-action-creators'; import '../res/app.less'; @@ -15,20 +18,37 @@ @connect( state => ({ status: state.get('status') + }), + dispatch => ({ + actions: bindActionCreators(modelActionCreators, dispatch) }) ) export default class App extends React.PureComponent { static propTypes = { status: React.PropTypes.objectOf(Immutable.Map).isRequired, - children: React.PropTypes.element + children: React.PropTypes.element, + actions: React.PropTypes.shape({ + search: React.PropTypes.func.isRequired + }).isRequired } static defaultProps = { children: [] } + handleQueryChange(e) { + if (e.query !== null) { + if (browserHistory.getCurrentLocation().pathname !== '/search') { + browserHistory.push('/search'); + } + this.props.actions.search({ query: e.query }); + } else if (browserHistory.getCurrentLocation().pathname !== '/') { + browserHistory.push('/'); + } + } + render() { - this.searchBar = <SearchBar onKeywordChange={e => console.log(e.keyword)} />; + this.searchBar = <SearchBar onQueryChange={e => this.handleQueryChange(e)} />; return ( <div className="mb-app"> <AppHeader navbars={this.searchBar} />
eae20462a9863b19f9520904795f7de217c5bf9d
src/generate_html_boilerplate.jsx
src/generate_html_boilerplate.jsx
// VARIABLES // const IFRAME_RESIZER_CONTENT_SCRIPT_PATH = 'https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.2.1/iframeResizer.contentWindow.min.js'; // MAIN // /** * Generates a boilerplate HTML page which fetches a specified resource and overwrites its contents. * * @private * @param {string} resourcePath - URL of resource to fetch * @returns {string} boilerplate HTML page */ const generateHTMLBoilerplate = ( resourcePath ) => `<html> <body> <script type="text/javascript"> document.addEventListener( 'DOMContentLoaded', () => { var html = fetch( '${resourcePath}' ); html .then( response => response.text() ) .then( text => { var script = document.createElement( 'script' ); script.src = '${IFRAME_RESIZER_CONTENT_SCRIPT_PATH}'; document.open(); document.write( text ); document.head.appendChild( script ); document.close(); }); }); </script> </body> </html>`; // EXPORTS // export default generateHTMLBoilerplate;
/** * @license Apache-2.0 * * Copyright (c) 2019 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // VARIABLES // const IFRAME_RESIZER_CONTENT_SCRIPT_PATH = 'https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.2.1/iframeResizer.contentWindow.min.js'; // MAIN // /** * Generates a boilerplate HTML page which fetches a specified resource and overwrites its contents. * * @private * @param {string} resourcePath - URL of resource to fetch * @returns {string} boilerplate HTML page */ function generateHTMLBoilerplate( resourcePath ) { return `<html> <body> <script type="text/javascript"> document.addEventListener( 'DOMContentLoaded', () => { var html = fetch( '${resourcePath}' ); html .then( response => response.text() ) .then( text => { var script = document.createElement( 'script' ); script.src = '${IFRAME_RESIZER_CONTENT_SCRIPT_PATH}'; document.open(); document.write( text ); document.head.appendChild( script ); document.close(); }); }); </script> </body> </html>`; } // EXPORTS // export default generateHTMLBoilerplate;
Add missing license header and convert function type
Add missing license header and convert function type
JSX
apache-2.0
stdlib-js/www,stdlib-js/www,stdlib-js/www
--- +++ @@ -1,3 +1,21 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2019 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + // VARIABLES // const IFRAME_RESIZER_CONTENT_SCRIPT_PATH = 'https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.2.1/iframeResizer.contentWindow.min.js'; @@ -12,7 +30,8 @@ * @param {string} resourcePath - URL of resource to fetch * @returns {string} boilerplate HTML page */ -const generateHTMLBoilerplate = ( resourcePath ) => `<html> +function generateHTMLBoilerplate( resourcePath ) { + return `<html> <body> <script type="text/javascript"> document.addEventListener( 'DOMContentLoaded', () => { @@ -31,6 +50,7 @@ </script> </body> </html>`; +} // EXPORTS //
16ce417d4f7077b5db5b20cadfaf6d03919e450b
src/request/components/request-detail-panel-generic.jsx
src/request/components/request-detail-panel-generic.jsx
'use strict'; var React = require('react'); var glimpse = require('glimpse'); function process(data) { if (glimpse.util.isArray(data)) { return processArray(data); } else if (glimpse.util.isObject(data)) { return processObject(data); } else { return data; } } function processArray(data) { if (data.length > 0) { var header = []; for (var key in data[0]) { header.push(<th key={key}>{key}</th>); } var body = data.map(function (item) { var row = []; for (var key in item) { row.push(<td key={key}>{process(item[key])}</td>); } return <tr>{row}</tr>; }); return <table><thead>{header}</thead><tbody>{body}</tbody></table>; } } function processObject(item) { var body = []; for (var key in item) { body.push(<tr key={key}><th>{key}</th><td>{item[key]}</td></tr>); } return <table><thead><th>Key</th><th>Value</th></thead><tbody>{body}</tbody></table>; } module.exports = React.createClass({ render: function () { var payload = this.props.payload || this.props.data.payload; var result = null; if (payload) { result = process(payload); } return result || <div>No records found.</div>; } });
'use strict'; var React = require('react'); var glimpse = require('glimpse'); function process(data) { if (glimpse.util.isArray(data)) { return processArray(data); } else if (glimpse.util.isObject(data)) { return processObject(data); } else { return data; } } function processArray(data) { if (data.length > 0) { var header = []; for (var key in data[0]) { header.push(<th key={key}>{key}</th>); } var body = data.map(function (item) { var row = []; for (var key in item) { row.push(<td key={key}>{process(item[key])}</td>); } return <tr>{row}</tr>; }); return <table><thead>{header}</thead><tbody>{body}</tbody></table>; } } function processObject(item) { var body = []; for (var key in item) { body.push(<tr key={key}><th>{key}</th><td>{process(item[key])}</td></tr>); } return <table><thead><th>Key</th><th>Value</th></thead><tbody>{body}</tbody></table>; } module.exports = React.createClass({ render: function () { var payload = this.props.payload || this.props.data.payload; var result = null; if (payload) { result = process(payload); } return result || <div>No records found.</div>; } });
Make generic layout component work for recursive object graphs
Make generic layout component work for recursive object graphs
JSX
unknown
Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype
--- +++ @@ -38,7 +38,7 @@ function processObject(item) { var body = []; for (var key in item) { - body.push(<tr key={key}><th>{key}</th><td>{item[key]}</td></tr>); + body.push(<tr key={key}><th>{key}</th><td>{process(item[key])}</td></tr>); } return <table><thead><th>Key</th><th>Value</th></thead><tbody>{body}</tbody></table>;
233b8e4d204120f7554035541966bb657a3cb620
livedoc-ui/src/components/forms/InlineForm.jsx
livedoc-ui/src/components/forms/InlineForm.jsx
// @flow import RaisedButton from 'material-ui/RaisedButton'; import TextField from 'material-ui/TextField'; import * as React from 'react'; type Props = { initialValue: string, hintText: string, onSubmit: string => void, btnLabel: string } type State = { value: string } export class InlineForm extends React.Component<Props, State> { constructor(props: Props) { super(props); this.state = { value: props.initialValue, }; } setValue(value: string) { this.setState({value}); }; render() { return <div> <TextField type='text' value={this.state.value} hintText={this.props.hintText} onChange={(e, val) => this.setValue(val)}/> <RaisedButton label={this.props.btnLabel} primary onClick={() => this.props.onSubmit(this.state.value)}/> </div>; } }
// @flow import RaisedButton from 'material-ui/RaisedButton'; import TextField from 'material-ui/TextField'; import * as React from 'react'; type Props = { initialValue: string, hintText: string, onSubmit: string => void, btnLabel: string } type State = { value: string } export class InlineForm extends React.Component<Props, State> { constructor(props: Props) { super(props); this.state = { value: props.initialValue, }; } setValue(value: string) { this.setState({value}); }; render() { return <div> <TextField type='text' value={this.state.value} hintText={this.props.hintText} onChange={(e, val) => this.setValue(val)} style={{marginRight: '1em'}}/> <RaisedButton label={this.props.btnLabel} primary onClick={() => this.props.onSubmit(this.state.value)}/> </div>; } }
Add spacing in URL input
Add spacing in URL input
JSX
mit
joffrey-bion/livedoc,joffrey-bion/livedoc,joffrey-bion/livedoc,joffrey-bion/livedoc,joffrey-bion/livedoc
--- +++ @@ -4,10 +4,7 @@ import * as React from 'react'; type Props = { - initialValue: string, - hintText: string, - onSubmit: string => void, - btnLabel: string + initialValue: string, hintText: string, onSubmit: string => void, btnLabel: string } type State = { @@ -29,8 +26,11 @@ render() { return <div> - <TextField type='text' value={this.state.value} hintText={this.props.hintText} - onChange={(e, val) => this.setValue(val)}/> + <TextField type='text' + value={this.state.value} + hintText={this.props.hintText} + onChange={(e, val) => this.setValue(val)} + style={{marginRight: '1em'}}/> <RaisedButton label={this.props.btnLabel} primary onClick={() => this.props.onSubmit(this.state.value)}/> </div>; }
a91cd638362b8022be2665a49eed331894f165d1
src/components/memory/MemoryTable.jsx
src/components/memory/MemoryTable.jsx
import React, {Component, PropTypes} from 'react'; import LC3 from '../../core/lc3'; import { Table } from 'react-bootstrap'; import {MemoryRow, MemoryHeaderRow} from './MemoryRow'; export default class MemoryTable extends Component { render() { const {lc3, topRow: nominalTopRow} = this.props; const {memory, symbolTable} = lc3; const rowsToShow = 16; const topRow = Math.min(nominalTopRow, memory.size - rowsToShow); const memoryInView = memory.skip(topRow).take(rowsToShow); const activeRow = lc3.registers.pc; const memoryRows = memoryInView.map((value, index) => { const address = topRow + index; return <MemoryRow address={address} value={value} label={symbolTable.keyOf(address)} active={address === activeRow} instruction={lc3.formatInstructionAtAddress(address)} onSetPC={() => this.props.onSetPC(address)} onSetValue={(value) => this.props.onSetMemory(address, value)} key={index} />; }); return <Table hover> <thead> <MemoryHeaderRow /> </thead> <tbody> {memoryRows} </tbody> </Table>; } } MemoryTable.propTypes = { lc3: PropTypes.instanceOf(LC3).isRequired, topRow: PropTypes.number.isRequired, onSetPC: PropTypes.func.isRequired, onSetMemory: PropTypes.func.isRequired, };
import React, {Component, PropTypes} from 'react'; import LC3 from '../../core/lc3'; import { Table } from 'react-bootstrap'; import {MemoryRow, MemoryHeaderRow} from './MemoryRow'; export default class MemoryTable extends Component { render() { const {lc3, topRow: nominalTopRow} = this.props; const {memory, symbolTable} = lc3; const rowsToShow = 16; const topRow = Math.min(nominalTopRow, memory.size - rowsToShow); let addressesToShow = Array(rowsToShow); for (let i = 0; i < rowsToShow; i++) { addressesToShow[i] = topRow + i; } const activeRow = lc3.registers.pc; const memoryRows = addressesToShow.map((address, index) => { return <MemoryRow address={address} value={memory.get(address)} label={symbolTable.keyOf(address)} active={address === activeRow} instruction={lc3.formatInstructionAtAddress(address)} onSetPC={() => this.props.onSetPC(address)} onSetValue={(value) => this.props.onSetMemory(address, value)} key={index} />; }); return <Table hover> <thead> <MemoryHeaderRow /> </thead> <tbody> {memoryRows} </tbody> </Table>; } } MemoryTable.propTypes = { lc3: PropTypes.instanceOf(LC3).isRequired, topRow: PropTypes.number.isRequired, onSetPC: PropTypes.func.isRequired, onSetMemory: PropTypes.func.isRequired, };
Make memory slicing a bit more robust
Make memory slicing a bit more robust This should no longer rely on insertion-order preservation.
JSX
mit
WChargin/lc3,WChargin/lc3
--- +++ @@ -13,15 +13,17 @@ const rowsToShow = 16; const topRow = Math.min(nominalTopRow, memory.size - rowsToShow); - const memoryInView = memory.skip(topRow).take(rowsToShow); + + let addressesToShow = Array(rowsToShow); + for (let i = 0; i < rowsToShow; i++) { + addressesToShow[i] = topRow + i; + } const activeRow = lc3.registers.pc; - - const memoryRows = memoryInView.map((value, index) => { - const address = topRow + index; + const memoryRows = addressesToShow.map((address, index) => { return <MemoryRow address={address} - value={value} + value={memory.get(address)} label={symbolTable.keyOf(address)} active={address === activeRow} instruction={lc3.formatInstructionAtAddress(address)}
bc5c0158e32403013c13d98004d891bc818239d0
web/static/js/components/voting_lower_third_content.jsx
web/static/js/components/voting_lower_third_content.jsx
import React from "react" import VotesLeft from "./votes_left" import StageProgressionButton from "./stage_progression_button" import * as AppPropTypes from "../prop_types" const VotingLowerThirdContent = props => ( <div className="ui stackable grid basic attached secondary center aligned segment"> {props.currentUser.is_facilitator && <div className="three wide column" />} <div className="ten wide column"> <VotesLeft currentUser={props.currentUser} /> </div> {props.currentUser.is_facilitator && <div className="three wide column"> <StageProgressionButton {...props} /> </div> } </div> ) VotingLowerThirdContent.propTypes = { currentUser: AppPropTypes.presence.isRequired, } export default VotingLowerThirdContent
import React from "react" import VotesLeft from "./votes_left" import StageProgressionButton from "./stage_progression_button" import * as AppPropTypes from "../prop_types" const VotingLowerThirdContent = props => ( <div className="ui stackable grid basic attached secondary center aligned segment"> {props.currentUser.is_facilitator && <div className="three wide column ui computer tablet only" />} <div className="ten wide column"> <VotesLeft currentUser={props.currentUser} /> </div> {props.currentUser.is_facilitator && <div className="three wide column"> <StageProgressionButton {...props} /> </div> } </div> ) VotingLowerThirdContent.propTypes = { currentUser: AppPropTypes.presence.isRequired, } export default VotingLowerThirdContent
Remove extraneous whitespace in voting lower third on mobile
Remove extraneous whitespace in voting lower third on mobile
JSX
mit
stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro
--- +++ @@ -7,7 +7,7 @@ const VotingLowerThirdContent = props => ( <div className="ui stackable grid basic attached secondary center aligned segment"> - {props.currentUser.is_facilitator && <div className="three wide column" />} + {props.currentUser.is_facilitator && <div className="three wide column ui computer tablet only" />} <div className="ten wide column"> <VotesLeft currentUser={props.currentUser} /> </div>
805f8be27bc341758b523b41ab7bf5fe523a4290
src/components/AppTile.jsx
src/components/AppTile.jsx
import React, { Component } from 'react' import PropTypes from 'prop-types' import { translate } from 'cozy-ui/react/I18n' import AppIcon from 'cozy-ui/react/AppIcon' import AppLinker from 'cozy-ui/react/AppLinker' export class AppTile extends Component { render() { const { app, t } = this.props const { domain, secure } = this.context const displayName = app.name_prefix ? `${app.name_prefix} ${app.name}` : app.name const appHref = app.links && app.links.related return ( <AppLinker slug={app.slug} href={appHref}> {({ onClick, href }) => ( <a onClick={onClick} href={href} className="item-wrapper"> <div className="item-icon"> <AppIcon alt={t('app.logo.alt', { name: displayName })} app={app} domain={domain} secure={secure} /> </div> <h3 className="item-title">{displayName}</h3> </a> )} </AppLinker> ) } } AppTile.contextTypes = { domain: PropTypes.string.isRequired, secure: PropTypes.bool } export default translate()(AppTile)
import React, { Component } from 'react' import PropTypes from 'prop-types' import { translate } from 'cozy-ui/react/I18n' import AppIcon from 'cozy-ui/react/AppIcon' import AppLinker from 'cozy-ui/react/AppLinker' export class AppTile extends Component { render() { const { app, t } = this.props const { domain, secure } = this.context const displayName = app.name_prefix && app.name_prefix.toLowerCase() !== 'cozy' ? `${app.name_prefix} ${app.name}` : app.name const appHref = app.links && app.links.related return ( <AppLinker slug={app.slug} href={appHref}> {({ onClick, href }) => ( <a onClick={onClick} href={href} className="item-wrapper"> <div className="item-icon"> <AppIcon alt={t('app.logo.alt', { name: displayName })} app={app} domain={domain} secure={secure} /> </div> <h3 className="item-title">{displayName}</h3> </a> )} </AppLinker> ) } } AppTile.contextTypes = { domain: PropTypes.string.isRequired, secure: PropTypes.bool } export default translate()(AppTile)
Hide "cozy" from app names
feat: Hide "cozy" from app names
JSX
agpl-3.0
cozy/cozy-home,cozy/cozy-home,cozy/cozy-home
--- +++ @@ -9,9 +9,10 @@ render() { const { app, t } = this.props const { domain, secure } = this.context - const displayName = app.name_prefix - ? `${app.name_prefix} ${app.name}` - : app.name + const displayName = + app.name_prefix && app.name_prefix.toLowerCase() !== 'cozy' + ? `${app.name_prefix} ${app.name}` + : app.name const appHref = app.links && app.links.related return ( <AppLinker slug={app.slug} href={appHref}>
de944fe8ba58dd202ca8a16d093a6bf4c4f3262e
src/components/Sources.jsx
src/components/Sources.jsx
// @flow import React from 'react'; import type { PlaceInfoRelated } from '../model/PlaceInfo'; type Props = { apiBaseUrl: string, title: string, related: PlaceInfoRelated }; export default function Sources(props: Props) { return ( <footer className="ac-licenses"> <header>{props.title}</header> <ul> {Object.keys(props.related.sources).map((sourceId) => { const source = props.related.sources[sourceId]; const license = props.related.licenses[source.licenseId]; const licenseURL = `${props.apiBaseUrl}/licenses/${license._id}`; const sourceURL = source.originWebsiteURL || `${props.apiBaseUrl}/sources/${source._id}`; return (<li className="ac-source"> <a className="ac-source-name" href={sourceURL}>{source.shortName || source.name}</a>&nbsp; (<a className="ac-source-license" href={licenseURL}>{license.shortName || license.name}</a>) </li>); })} </ul> </footer>); }
// @flow import React from 'react'; import type { PlaceInfoRelated } from '../model/PlaceInfo'; type Props = { apiBaseUrl: string, title: string, related: PlaceInfoRelated }; export default function Sources(props: Props) { return ( <footer className="ac-licenses"> <header>{props.title}</header> <ul> {Object.keys(props.related.sources).map((sourceId) => { const source = props.related.sources[sourceId]; const license = props.related.licenses[source.licenseId]; const licenseURL = `${props.apiBaseUrl}/licenses/${license._id}`; const sourceURL = source.originWebsiteURL || `${props.apiBaseUrl}/sources/${source._id}`; return (<li className="ac-source" key={source._id}> <a className="ac-source-name" href={sourceURL}>{source.shortName || source.name}</a>&nbsp; (<a className="ac-source-license" href={licenseURL}>{license.shortName || license.name}</a>) </li>); })} </ul> </footer>); }
Fix missing key attribute in source list
Fix missing key attribute in source list
JSX
mit
sozialhelden/accessibility-cloud-js,sozialhelden/accessibility-cloud-js
--- +++ @@ -20,7 +20,7 @@ const licenseURL = `${props.apiBaseUrl}/licenses/${license._id}`; const sourceURL = source.originWebsiteURL || `${props.apiBaseUrl}/sources/${source._id}`; - return (<li className="ac-source"> + return (<li className="ac-source" key={source._id}> <a className="ac-source-name" href={sourceURL}>{source.shortName || source.name}</a>&nbsp; (<a className="ac-source-license" href={licenseURL}>{license.shortName || license.name}</a>) </li>);
f2772154d9ef91fe9c043cd66cf41a5a5c94a6dd
examples/pseudo/Input.jsx
examples/pseudo/Input.jsx
import React, {Component} from 'react' import Look, {StyleSheet} from '../../lib/dom' @Look export default class Input extends Component { render() { return ( <div> <input key="i1" look={[styles.input, styles.inputFocus]} placeholder="focus me"/> <input look={styles.input} placeholder="i am required" required/> <input look={[styles.input, styles.inputOptional]} placeholder="i am optional"/> <input look={[styles.input, styles.readOnly]} placeholder="i am read only" readOnly/> <input disabled look={[styles.input, styles.inputDisabled]} placeholder="i am disabled"/> </div> ) } } const styles = StyleSheet.create(Input, { input: { appearance: 'none', outline: 'none', width: '100%', padding: 3, fontSize: 18, border: '1px solid gray', borderRadius: 5, marginBottom: 5, userSelect: 'text', ':required': { border: '2px solid black' } }, inputFocus: { ':focus': { borderColor: 'red', backgroundColor: 'lightblue' } }, inputOptional: { ':optional': { border: '1px dotted lightgray' } }, inputDisabled: { ':disabled': { backgroundColor: 'gray' } }, readOnly: { ':read-only': { backgroundColor: 'lightgray' } }})
import React, {Component} from 'react' import Look, {StyleSheet} from '../../lib/dom' @Look export default class Input extends Component { render() { return ( <div> <input key="i1" look={[styles.input, styles.inputFocus]} placeholder="focus me"/> <input look={styles.input} placeholder="i am required" required/> <input look={styles.input} placeholder="i have pattern" pattern="[A-Z]" ref="valid"/> <input look={[styles.input, styles.inputOptional]} placeholder="i am optional"/> <input look={[styles.input, styles.readOnly]} placeholder="i am read only" readOnly/> <input disabled look={[styles.input, styles.inputDisabled]} placeholder="i am disabled"/> </div> ) } } const styles = StyleSheet.create(Input, { input: { appearance: 'none', outline: 'none', width: '100%', padding: 3, fontSize: 18, border: '1px solid gray', borderRadius: 5, marginBottom: 5, userSelect: 'text', ':required': { border: '2px solid black' } }, inputFocus: { ':focus': { borderColor: 'red', backgroundColor: 'lightblue' } }, inputOptional: { ':optional': { border: '1px dotted lightgray' } }, inputDisabled: { ':disabled': { backgroundColor: 'gray' } }, readOnly: { ':read-only': { backgroundColor: 'lightgray' } }})
Update format of examples and add pattern input
Update format of examples and add pattern input
JSX
mit
rofrischmann/react-look,obscene/Obscene-Stylesheet,rofrischmann/react-look,dustin-H/react-look,obscene/Obscene-Stylesheet,obscene/Obscene-Stylesheet,rofrischmann/react-look,dustin-H/react-look
--- +++ @@ -8,10 +8,11 @@ return ( <div> <input key="i1" look={[styles.input, styles.inputFocus]} placeholder="focus me"/> - <input look={styles.input} placeholder="i am required" required/> - <input look={[styles.input, styles.inputOptional]} placeholder="i am optional"/> - <input look={[styles.input, styles.readOnly]} placeholder="i am read only" readOnly/> -<input disabled look={[styles.input, styles.inputDisabled]} placeholder="i am disabled"/> + <input look={styles.input} placeholder="i am required" required/> + <input look={styles.input} placeholder="i have pattern" pattern="[A-Z]" ref="valid"/> + <input look={[styles.input, styles.inputOptional]} placeholder="i am optional"/> + <input look={[styles.input, styles.readOnly]} placeholder="i am read only" readOnly/> + <input disabled look={[styles.input, styles.inputDisabled]} placeholder="i am disabled"/> </div> ) }
88c0de9c37383d5f923da60612bdc9a6d7106489
webapp/utils/fileSize.jsx
webapp/utils/fileSize.jsx
export const getSize = value => { if (value === 0) return '0 B'; if (!value) return null; let i = Math.floor(Math.log(value) / Math.log(1024)); return ( (value / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i] ); };
export const getSize = value => { if (value === 0) return '0 B'; if (!value) return null; let i = Math.max(Math.floor(Math.log(Math.abs(value)) / Math.log(1024)), 0); return ( (value / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i] ); };
Handle various outliers in filesize
fix: Handle various outliers in filesize
JSX
apache-2.0
getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus
--- +++ @@ -2,7 +2,7 @@ if (value === 0) return '0 B'; if (!value) return null; - let i = Math.floor(Math.log(value) / Math.log(1024)); + let i = Math.max(Math.floor(Math.log(Math.abs(value)) / Math.log(1024)), 0); return ( (value / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i] );
b22f409186d0a6a9311d1a8d91c696592d43efac
examples/components/example-itemSelector.jsx
examples/components/example-itemSelector.jsx
import * as React from 'react'; import { ItemSelector } from '../../src/main'; import itemSelectorData from '../data/itemSelector.json'; export default class ItemSelectorExample extends React.Component { static propTypes = { selected: React.PropTypes.object } constructor (props) { super(props); } render () { let data = { title: 'Select a canal:', items: itemSelectorData }; data.selectedItem = this.props.selected || data.items[21]; return ( <div style={ { height: '200px' } }> <ItemSelector { ...data }/> </div> ); } }
import * as React from 'react'; import { ItemSelector } from '../../src/main'; import itemSelectorData from '../data/itemSelector.json'; export default class ItemSelectorExample extends React.Component { static propTypes = { selected: React.PropTypes.object } constructor (props) { super(props); } render () { let data = { title: 'Select an item:', items: itemSelectorData }; data.selectedItem = this.props.selected || data.items[21]; return ( <div style={ { height: '200px' } }> <ItemSelector { ...data }/> </div> ); } }
Make example title more general
Make example title more general
JSX
isc
americanpanorama/panorama,americanpanorama/panorama
--- +++ @@ -17,7 +17,7 @@ render () { let data = { - title: 'Select a canal:', + title: 'Select an item:', items: itemSelectorData };
aabbd38b63088c7bb8c24503fb85c0c858fed245
src/layouts/Default.jsx
src/layouts/Default.jsx
/** * @jsx React.DOM */ 'use strict'; var React = require('react'); var {Link} = require('react-router'); var Navbar = require('../components/Navbar.jsx'); var DefaultLayout = React.createClass({ render() { return ( <div> <Navbar /> <div className="jumbotron"> <div className="container text-center"> <h1>React</h1> <p>Complex web apps made easy</p> </div> </div> <this.props.activeRouteHandler /> <div className="navbar-footer"> <div className="container"> <p className="text-muted"> &copy; KriaSoft • <Link to="home">Home</Link> • <Link to="privacy">Privacy</Link> </p> </div> </div> </div> ); } }); module.exports = DefaultLayout;
/** * @jsx React.DOM */ 'use strict'; var React = require('react'); var {Link} = require('react-router'); var Navbar = require('../components/Navbar.jsx'); var DefaultLayout = React.createClass({ render() { return ( <div> <Navbar /> <div className="jumbotron"> <div className="container text-center"> <h1>React</h1> <p>Complex web apps made easy</p> </div> </div> <this.props.activeRouteHandler /> <div className="navbar-footer"> <div className="container"> <p className="text-muted"> {' © KriaSoft • '} <Link to="home">Home</Link> {' • '} <Link to="privacy">Privacy</Link> </p> </div> </div> </div> ); } }); module.exports = DefaultLayout;
Fix footer on the default page layout
Fix footer on the default page layout
JSX
mit
eugeneross/react-starter-kit,dabrowski-adam/react-isomorphic,BenRichter/app2,taylorharwin/react-starter-kit,SOCLE15/carpoule,thesyllable/wom2,vbauerster/react-starter-kit,nithinpeter/nightpecker,Frenzzy/react-starter-kit,HoomanGriz/react-starter-kit,mlem8/dev-challenge,tlin108/chaf,MxMcG/tourlookup-react,Speak-Easy/web-app,vanbujm/react-css-animation-practice,eafelix/react-starter-kit,ubien/react-starter-kit,tinwaisi/take-home,dongtong/react-starter-kit,concerned3rdparty/react-starter-kit,RenRenTeam/react-starter-kit,yjzzcao/react-starter-kit,ubien/react-starter-kit,aaandrew/website,yjzzcao/react-starter-kit,johnrenko/React,servak/material-ui-sample,sallen450/react-starter-kit,hang-up/react-whatever,pvijeh/isomorphic-react-local-discovery,sdiaz/react-starter-kit,ademuk/react-starter-kit,ajhsu/react-starter-kit,goatslacker/react-starter-kit,DanielHabib/react-starter-kit,prathamtandon/portfolio,seanlin816/react-starter-kit,nicolascine/site,nithinpeter/nightpecker,nobesnickr/react-starter-kit,ben-miller/adddr.io,phoenixbox/vesty-fe,soniwgithub/react-starter-kit,pandoraui/react-starter,tholapz/react-starter-kit,jacyzon/react-starter-kit,waelio/react-starter-kit,mimiflynn/react-starter-kit,nagyistoce/react-starter-kit,nicolasmoise/QH-code-exercize,teosz/test-problem-reproduce,splashapp/starterkit,aos2006/tesDeploy,tarkanlar/eskimo,jurgob/jurgo.me,suttonj/topshelf-flux,cuitianze/demo,clickbuster/smite-calculator,ziedAb/PVMourakiboun,suttonj/topshelf-flux,pandoraui/react-starter,eugeneross/react-starter-kit,pvijeh/sull-isom2,como-quesito/react-starter-kit,akfreas/ReactTest,artemkaint/react-starter-kit,seanlin816/react-starter-kit,yinaw/travelBook,kevinob11/react-test,pvijeh/peter-vijeh-personal-site,4lbertoC/popularrepositories,p-a/react-starter-kit,buildbreakdo/react-starter-kit,alexmasselot/react-starter-kit,jeffreymoya/react-starter-kit,aos2006/tesDeploy,Creatrixino/react-starter-kit,sallen450/react-starter-kit,AntonyKwok/react-starter-kit,pppp22591558/pa_course_lobby,egut/react-docker-demo,takahashik/todo-app,vanessadyce/react-proto,mimiflynn/react-starter-kit,zhiyelee/react-starter-kit,FOUfashion/frontend,bbonny/movie-matching,erichardson30/react-starter,bogdosarov/link_share,arkeros/react-native-starter-kit,0xcdc/rfb-client-app,scele/coverigate,cabouffard/MusicServer-Frontend,prathamtandon/portfolio,rdanieldesign/MemoryApp-ReactStarter,leeleo26/react-starter-kit,ajhsu/react-starter-kit,miketamis/locationPositioning,aaron-goshine/react-starter-kit,Hawt-Lava/Flare,labzero/lunch,HoomanGriz/react-starter-kit,cineindustria/site,mlem8/dev-challenge,w01fgang/react-starter-kit,ronlobo/react-starter-kit,BlakeRxxk/react-starter-kit,nextinnovation-corp/gacha,soma06-2/soma06-2-web-client,nobesnickr/react-starter-kit,pawsong/react-starter-kit,nicolasmoise/QH-code-exercize,samdenicola/react-starter-kit,louisukiri/react-starter-kit,domenicosolazzo/react-starter-kit,mortenryum/loanCalculator,Malinin88/SaratovJS,pvijeh/stock-tracking-app-reactjs,vbdoug/ISOReStack,jessamynsmith/MintWebApp,vladikoff/react-starter-kit,nlipsyc/reactbot3,andmilj/vip-transfers,AlexKhymenko/ES6React,arolla/Arollydays,schnerd/react-starter-kit,aries-auto/ariesautomotive,Gabs00/react-starter-kit,amyalichkin/react-starter-kit,DanielHabib/HowManyBalloons,nicolasmoise/CMC-2,kutou/react-starter-kit,larsvinter/react-starter-kit,erichardson30/react-starter,SillyKnight/react-starter-kit,jesperh/tuho2.0-react,mattroid/turboiep,pppp22591558/ChinaPromotion,servak/material-ui-sample,cheapsteak/react-starter-kit,jbsouvestre/react-starter-kit,Nikhil22/trooper,chytanya/microcredentials-client,nlipsyc/reactbot3,eafelix/react-starter-kit,BrianGenisio/gobus,LukevdPalen/react-starter-kit,ronlobo/react-starter-kit,victoryancn/react-starter-kit,iteacat/cc_deals,zbrukas/wwf-store,trus-sangwarn/react-starter,BrettHoyer/fatwithfriends,DanielHabib/react-starter-kit,cheapsteak/react-starter-kit,patrickkillalea/React1,geoffreyfloyd/op,concerned3rdparty/react-starter-kit,loganfreeman/react-is-fun,bogdosarov/link_share,SFDevLabs/react-starter-kit,kaushik94/react-starter,vladikoff/react-starter-kit,quasicrial/quasicrial,allfix53/react-starter-kit,4lbertoC/popularrepositories,keshavnandan/react-starter-kit,BringJacket/www,prthrokz/portfolio,bez4pieci/React-Flux-Drag-n-Drop-Tree-structure,wseo88/react-starter-kit,kaushik94/react-starter,solome/react-starter-kit,maysale01/react-platform,vanbujm/react-css-animation-practice,epylinkn/monument,youprofit/react-starter-kit,jurgob/jurgo.me,geoffreyfloyd/op,agiron123/react-starter-kit-TDDOList,ryanherlihy/react-starter-kit,edgarallanglez/foxacademia_frontend,neozhangthe1/react-starter-kit,swhite24/react-starter-kit,benbs/Office-Player,allfix53/react-starter-kit,epylinkn/monument,skw/test-react-backbone,thesyllable/wom2,jerrysdesign/pac,ashlynbaum/react-test,seriflafont/react-starter-kit,devinschulz/react-starter-kit,juliocanares/react-starter-kit,nambawan/g-old,maximhoffman/beginnertuts,Creatrixino/react-starter-kit,solome/react-starter-kit,shaunstanislaus/react-starter-kit,tomesposito/blog,carlosCeron/react-starter-kit,TCotton/penny-books,loganfreeman/react-is-fun,sammccord/Rhetorizer,shaialon/react-starter-kit,zhiyelee/react-starter-kit,BlakeRxxk/react-starter-kit,uiruson/chorongi,sonbui00/react-starter-kit,DanielHabib/onboarding,zsu13579/whatsgoinontonight,frob/react-starter-kit-lite,BrianGenisio/gobus,seriallos/react-starter-kit-minimal,liangsenzhi/react-starter-kit,chentaixu/react-starter-kit,gdi2290/react-starter-kit,monotonique/react-starter-kit,jsivakumaran/map-app,akfreas/ReactTest,SindreSvendby/beach-ranking-web,N4N0/resume,devonzuegel/cosmocat,albperezbermejo/react-starter-kit,syarul/react-starter-kit,jifeon/react-starter-kit,benbs/Office-Player,carlosCeron/react-starter-kit,jsDotCr/memory,alexmasselot/medlineGeoWebFrontend,Shtian/hnmm,RenRenTeam/react-starter-kit,BrettHoyer/fatwithfriends,nagyistoce/react-starter-kit,pvijeh/sull-isom2,jsivakumaran/map-app,iamfrontender/resume,arkeros/react-native-starter-kit,patrickkillalea/React1,jbsouvestre/react-starter-kit,koistya/react-starter-kit,iamfrontender/resume,artemkaint/react-starter-kit,garposmack/react-starter-kit,tonikarttunen/tonikarttunen-com,danielxiaowxx/react-starter-kit,Lanciv/reporting-front,kuao775/mandragora,cmosguy/react-redux-auth0,grantgeorge/react-app,arolla/Arollydays,DanielHabib/HowManyBalloons,tholapz/react-starter-kit,keshavnandan/react-starter-kit,monotonique/react-starter-kit,dstirling/MyApp,vishwanatharondekar/resume,daviferreira/react-starter-kit,kinshuk-jain/TB-Dfront,luznlun/kkRoom,jhabdas/lumpenradio-com,Shtian/dashboard,SlexAxton/oddjobsf,mattroid/turboiep,jesperh/tuho2.0-react,DVLP/react-starter-kit,gokberkisik/react-starter-kit,nextinnovation-corp/gacha,avaneeshd/spotnote-web,tcrosen/react-vehicle-builder,grantgeorge/react-app,chen844033231/react-starter-kit,aalluri-navaratan/react-starter-kit,pppp22591558/ChinaPromotion,RomanovRoman/react-starter-kit,ZoeyYoung/react-starter-kit,emil-alexandrescu/react-starter-kit,garposmack/react-starter-kit,gokberkisik/react-starter-kit,theopak/alright,fsad/react-starter-kit,mikemunsie/react-starter-kit,mithundas79/react-starter-kit,youprofit/react-starter-kit,Mobiletainment/react-starter-kit,jshultz/secret_project,soma06-2/soma06-2-web-client,labreaks/ep-web-app,maysale01/react-starter-kit,Jose4gg/GSW-P2,f15gdsy/react-starter-kit,juliocanares/react-starter-kit,DanielHabib/onboarding,roskom/MyApp,vlad06/react-starter-kit,jerrysdesign/pac,bopeng87/reactfullstack,Malinin88/SaratovJS,vbdoug/ISOReStack,roskom/MyApp,royriojas/react-starter-kit,0xcdc/rfb-client-app,tonikarttunen/tonikarttunen-com,yinaw/travelBook,rameshrr/dicomviewer,srslafazan/react-profile-starter,bigwaterconsulting/to_dash_live,saadanerdetbare/react-starter-kit,0xcdc/rfb-client-app,ryanherlihy/react-starter-kit,murphysierra/VinnyStoryPage,Speak-Easy/web-app,bpeters/nafcweb,bpeters/nafcweb,trus-sangwarn/react-starter,Fedulab/FeduLab,cthorne66/react-cards,TribeMedia/react-starter-kit,fsad/react-starter-kit,petarslovic/bas-info,pppp22591558/pa_course_lobby,BringJacket/www,HildoBijl/DondersHackathonTR,petarslovic/bas-info,dongtong/react-starter-kit,frob/react-starter-kit-lite,dbkbali/react-starter-kit,liangsenzhi/react-starter-kit,vanessadyce/react-proto,jackinf/skynda.me,patrickkillalea/react-starter-kit,djfm/ps-translations-interface-mockup,TribeMedia/react-starter-kit,zerkz/react-portfolio,stinkyfingers/IsoTest,langpavel/react-starter-kit,Nexapp/react-starter-kit,emil-alexandrescu/react-starter-kit,fustic/here-hackaton,cabouffard/MusicServer-Frontend,vlad06/react-starter-kit,f15gdsy/react-starter-kit,alexmasselot/medlineGeoWebFrontend,danielxiaowxx/react-starter-kit,TCotton/penny-books,fkn/ndo,jsDotCr/memory,elyseko/wereperson,alexbonine/react-starter-kit,pawsong/react-starter-kit,wseo88/react-starter-kit,seriflafont/react-starter-kit,scele/coverigate,pvijeh/isomorphic-react-local-discovery,tcrosen/react-vehicle-builder,daviferreira/react-starter-kit,companyjuice/react-starter-kit,DaveyEdwards/myiworlds,srslafazan/react-profile-starter,Bogdaan/react-auth-kit,johnrenko/React,zerkz/react-portfolio,kevinchau321/TReactr,KantanGroup/zuzu-sites,ZoeyYoung/react-starter-kit,brian-kilpatrick/react-starter-kit,tcrosen/nhl-scores,mDinner/musicansAssistant,aaandrew/website,sjackson212/A6DotCom,maysale01/react-starter-kit,sonbui00/react-starter-kit,companyjuice/react-starter-kit,jeffreymoya/react-starter-kit,avaneeshd/spotnote-web,ynu/ecard-wxe,siddhant3s/crunchgraph,soniwgithub/react-starter-kit,vishwanatharondekar/resume,maximhoffman/beginnertuts,barretts/react-starter-kit,bez4pieci/React-Flux-Drag-n-Drop-Tree-structure,nicolasmoise/CMC-2,syarul/react-starter-kit,nambawan/g-old,SillyKnight/react-starter-kit,pvijeh/stock-tracking-app-reactjs,maysale01/react-platform,dervos/react-starter-kit,iteacat/cc_deals,taylorharwin/react-starter-kit,TodoWishlist/TodoWishlist,mDinner/musicansAssistant,jacyzon/react-starter-kit,kaynenh/ReactBudget,w01fgang/react-starter-kit,epicallan/akilihub,jackygrahamez/react-starter-kit,janusnic/react-starter-kit,dirkliu/react-starter-kit,teosz/test-problem-reproduce,mortenryum/loanCalculator,ACPK/react-starter-kit,shaialon/react-starter-kit,ademuk/react-starter-kit,sherlock221/react-starter-kit,emil-alexandrescu/react-starter-kit,lycandjava/react-starter-kit,rodolfo2488/react-starter-kit,Jose4gg/GSW-P2,chentaixu/react-starter-kit,jhlav/mpn-web-app,djfm/ps-translations-interface-mockup,tstangenberg/apitest-editor,schnerd/react-starter-kit,piscis/react-starter-kit,devinschulz/react-starter-kit,khankuan/asset-library-demo,Demesheo/react-starter-kit,janusnic/react-starter-kit,cuitianze/demo,aalluri-navaratan/react-starter-kit,arolla/Arollydays,zerubeus/voicifix,ashlynbaum/react-test,alexmasselot/react-starter-kit,domenicosolazzo/react-starter-kit,skw/test-react-backbone,Skoli-Code/DerangeonsLaChambre,jtiscione/redux-chess,uptive/react-starter-kit,zsu13579/pinterest-apollo,vbauerster/react-starter-kit,dirkliu/react-starter-kit,Mobiletainment/react-starter-kit,wanchopen/vida,shaunstanislaus/react-starter-kit,pitLancer/pbdorb,dbkbali/react-starter-kit,arkeros/react-native-starter-kit,DenisIzmaylov/react-starter-kit,barretts/react-starter-kit,sdiaz/react-starter-kit,hang-up/react-whatever,AlexKhymenko/ES6React,labreaks/ep-web-app,jessamynsmith/MintWebApp,dstirling/MyApp,larsvinter/react-starter-kit,fustic/here-hackaton,patrickkillalea/react-starter-kit,Demesheo/react-starter-kit,lycandjava/react-starter-kit,mzgnr/react-starter-kit,globalART19/OrderedOptions,sloppylopez/react-starter-kit,Shtian/dashboard,bopeng87/reactfullstack,binyuace/vote,zmj1316/InfomationVisualizationCourseWork,alexbonine/react-starter-kit,waelio/react-starter-kit,prthrokz/portfolio,neozhangthe1/react-starter-kit,rdanieldesign/MemoryApp-ReactStarter,theopak/alright,jifeon/react-starter-kit,splashapp/starterkit,p-a/react-starter-kit,rodolfo2488/react-starter-kit,Hawt-Lava/Flare,seriallos/react-starter-kit-minimal,sloppylopez/react-starter-kit,cthorne66/react-cards,mithundas79/react-starter-kit,DVLP/react-starter-kit,sammccord/Rhetorizer,miketamis/CaughtHere,ACPK/react-starter-kit,zbrukas/wwf-store,loganfreeman/react-is-fun,jshultz/secret_project,takahashik/todo-app,nlipsyc/reactbot3,jaruesink/ruesinkdds,DanielHabib/HowManyBalloons,SindreSvendby/beach-ranking-web,dervos/react-starter-kit,ynu/res-track-wxe,fkn/ndo,quyetvv/react-starter-kit,dkmin/react-starter-kit,bsy/react-starter-kit,swhite24/react-starter-kit,chytanya/microcredentials-client,tcrosen/nhl-scores,davidascher/needinfo,royriojas/react-starter-kit,mzgnr/react-starter-kit,tarkanlar/eskimo,jwhchambers/react-starter-kit,leeleo26/react-starter-kit,sherlock221/react-starter-kit,albperezbermejo/react-starter-kit,Fedulab/FeduLab,samkguerrero/samkguerrero_react,chen844033231/react-starter-kit,phoenixbox/vesty-fe,SFDevLabs/react-starter-kit,i3ringit/mdelc,victoryancn/react-starter-kit,uiruson/chorongi,miketamis/CaughtHere,dkmin/react-starter-kit,jhabdas/lumpenradio-com,mikemunsie/react-starter-kit,SlexAxton/oddjobsf,como-quesito/react-starter-kit,tomesposito/blog,DenisIzmaylov/react-starter-kit,piscis/react-starter-kit,aaron-goshine/react-starter-kit,andmilj/vip-transfers,bsy/react-starter-kit,Frenzzy/react-starter-kit,LukevdPalen/react-starter-kit,amyalichkin/react-starter-kit,tstangenberg/apitest-editor,miketamis/locationPositioning,poeschko/ask-refugeescode,epicallan/akilihub,stinkyfingers/IsoTest,clickbuster/smite-calculator,onelink-translations/react-localization,Gabs00/react-starter-kit,N4N0/resume,agiron123/react-starter-kit-TDDOList,pvijeh/peter-vijeh-personal-site,ADourgarian/Syscoin-Payroll,saadanerdetbare/react-starter-kit
--- +++ @@ -23,8 +23,8 @@ <div className="navbar-footer"> <div className="container"> <p className="text-muted"> - &copy; KriaSoft • - <Link to="home">Home</Link> • + {' © KriaSoft • '} + <Link to="home">Home</Link> {' • '} <Link to="privacy">Privacy</Link> </p> </div>
740c99e9eed71d71eec191bc4b6d8993e4ba59b4
app/containers/tabs/MinionsTab.jsx
app/containers/tabs/MinionsTab.jsx
var React = require('react'); var Fluxxor = require('fluxxor'); var FluxMixin = Fluxxor.FluxMixin(React); var StoreWatchMixin = Fluxxor.StoreWatchMixin; var Minion = require('components/minions/Minion'); var tabStyle = require('./Tab.less'); var MinionsTab = React.createClass({ mixins: [FluxMixin, StoreWatchMixin('MinionStore')], getStateFromFlux() { var flux = this.getFlux(); var minions = flux.stores.MinionStore.getMinions(); return { minions }; }, renderMinions() { return this.state.minions.map(minion => <Minion minion={minion}/>); }, render() { return ( <div className={tabStyle.this}> {this.renderMinions()} </div> ); } }); module.exports = MinionsTab;
var React = require('react'); var Fluxxor = require('fluxxor'); var FluxMixin = Fluxxor.FluxMixin(React); var StoreWatchMixin = Fluxxor.StoreWatchMixin; var Minion = require('components/minions/Minion'); var tabStyle = require('./Tab.less'); var MinionsTab = React.createClass({ mixins: [FluxMixin, StoreWatchMixin('MinionStore')], getStateFromFlux() { var flux = this.getFlux(); var minions = flux.stores.MinionStore.getMinions(); return { minions }; }, renderMinions() { return this.state.minions.map(minion => <Minion key={minion.id} minion={minion}/>); }, render() { return ( <div className={tabStyle.this}> {this.renderMinions()} </div> ); } }); module.exports = MinionsTab;
Add missing key to minion list
Add missing key to minion list
JSX
mit
martinhoefling/molten,martinhoefling/molten,martinhoefling/molten
--- +++ @@ -19,7 +19,7 @@ }, renderMinions() { - return this.state.minions.map(minion => <Minion minion={minion}/>); + return this.state.minions.map(minion => <Minion key={minion.id} minion={minion}/>); }, render() {
2ed18f28fbe16707e7b6e4d0a80b2e9df2a14643
client/src/js/components/Main/options/Jobs/Tasks.jsx
client/src/js/components/Main/options/Jobs/Tasks.jsx
/** * @license * The MIT License (MIT) * Copyright 2015 Government of Canada * * @author * Ian Boyes * * @exports Tasks */ 'use strict'; var _ = require('lodash'); var React = require('react'); var Row = require('react-bootstrap/lib/Row'); var Col = require('react-bootstrap/lib/Col'); var ListGroup = require('react-bootstrap/lib/ListGroup'); var ListGroupItem = require('react-bootstrap/lib/ListGroupItem'); var Task = require('./Task.jsx'); /** * A list of items that contain form fields for modifying resource limits on specific tasks. */ var Tasks = React.createClass({ render: function () { var taskComponents = ['import_reads', 'pathoscope', 'rebuild', 'add_host'].map(function (taskPrefix) { return <Task key={taskPrefix} taskPrefix={taskPrefix} {...this.props} />; }, this); var title = ( <ListGroupItem key='title'> <Row> <Col md={4}>CPU</Col> <Col md={4}>Memory (GB)</Col> <Col md={4}>Concurrent Jobs</Col> </Row> </ListGroupItem> ); return ( <ListGroup> {title} {taskComponents} </ListGroup> ); } }); module.exports = Tasks;
/** * @license * The MIT License (MIT) * Copyright 2015 Government of Canada * * @author * Ian Boyes * * @exports Tasks */ 'use strict'; var _ = require('lodash'); var React = require('react'); var Row = require('react-bootstrap/lib/Row'); var Col = require('react-bootstrap/lib/Col'); var ListGroup = require('react-bootstrap/lib/ListGroup'); var ListGroupItem = require('react-bootstrap/lib/ListGroupItem'); var Task = require('./Task.jsx'); /** * A list of items that contain form fields for modifying resource limits on specific tasks. */ var Tasks = React.createClass({ render: function () { var taskComponents = ['import_reads', 'pathoscope', 'nuvs', 'rebuild', 'add_host'].map(function (taskPrefix) { return <Task key={taskPrefix} taskPrefix={taskPrefix} {...this.props} />; }, this); var title = ( <ListGroupItem key='title'> <Row> <Col md={4}>CPU</Col> <Col md={4}>Memory (GB)</Col> <Col md={4}>Concurrent Jobs</Col> </Row> </ListGroupItem> ); return ( <ListGroup> {title} {taskComponents} </ListGroup> ); } }); module.exports = Tasks;
Add nuvs to task-specific limits form
Add nuvs to task-specific limits form
JSX
mit
virtool/virtool,virtool/virtool,igboyes/virtool,igboyes/virtool
--- +++ @@ -27,7 +27,7 @@ render: function () { - var taskComponents = ['import_reads', 'pathoscope', 'rebuild', 'add_host'].map(function (taskPrefix) { + var taskComponents = ['import_reads', 'pathoscope', 'nuvs', 'rebuild', 'add_host'].map(function (taskPrefix) { return <Task key={taskPrefix} taskPrefix={taskPrefix} {...this.props} />; }, this);
f9a8ed34f9e41345956eab6217f9291eaf96eb87
lib/views/Index.jsx
lib/views/Index.jsx
import React from "react"; export default function Index() { return ( <div> <div className="heading"> <div className="row"> <div className="col-xs-12 col-md-7 col-lg-6 offset-lg-1 logo" /> <div className="col-xs-12 col-md-5 col-lg-4 col-xl-3 blurb"> <p className="lead"> Are <strong>they</strong> calling back <strong>from beyond the cloud</strong>? </p> <a className="btn btn-primary btn-lg" href="/new">Let's find out!</a> </div> </div> </div> <div className="comics"> <div className="row"> <div className="col-sm-6 col-md-6 col-lg-4 comic comic-1" /> <div className="col-sm-6 col-md-6 col-lg-4 comic comic-2" /> <div className="col-sm-12 col-md-12 col-lg-4 comic comic-3" /> </div> </div> </div> ); }
import React from "react"; export default function Index() { return ( <div> <div className="heading"> <div className="row"> <div className="col-xs-12 col-md-7 col-lg-6 offset-lg-1 logo" /> <div className="col-xs-12 col-md-5 col-lg-4 col-xl-3 blurb"> <p className="lead"> Are <strong>they</strong> calling back <strong>from beyond the cloud</strong>? </p> <a className="btn btn-primary btn-lg" href="/new">Let's find out!</a> </div> </div> </div> <div className="comics"> <div className="row"> <div className="col-sm-6 col-md-6 col-lg-4 comic comic-1" title="Create a pair of URLs: a trap and a monitor" /> <div className="col-sm-6 col-md-6 col-lg-4 comic comic-2" title="Copy-paste the trap to your favorite chat app, URL shortener, ..." /> <div className="col-sm-12 col-md-12 col-lg-4 comic comic-3" title="The monitor page shows you who visited the trap" /> </div> </div> </div> ); }
Add title attributes to front page comic
Add title attributes to front page comic This should make comic "readable" for search engines. This might help also blind users, but this should be tested. Fixes #31
JSX
mit
HowNetWorks/uriteller
--- +++ @@ -19,9 +19,9 @@ <div className="comics"> <div className="row"> - <div className="col-sm-6 col-md-6 col-lg-4 comic comic-1" /> - <div className="col-sm-6 col-md-6 col-lg-4 comic comic-2" /> - <div className="col-sm-12 col-md-12 col-lg-4 comic comic-3" /> + <div className="col-sm-6 col-md-6 col-lg-4 comic comic-1" title="Create a pair of URLs: a trap and a monitor" /> + <div className="col-sm-6 col-md-6 col-lg-4 comic comic-2" title="Copy-paste the trap to your favorite chat app, URL shortener, ..." /> + <div className="col-sm-12 col-md-12 col-lg-4 comic comic-3" title="The monitor page shows you who visited the trap" /> </div> </div> </div>
a424f879f183d9cde61f360f1696890b4f40c350
components/application.jsx
components/application.jsx
import React from "react"; export default class Application extends React.Component { render () { return <main> <header><h1>{this.props.title}</h1></header> <div className="app-body">{this.props.children}</div> <footer></footer> </main> ; } }
import React from "react"; export default class Application extends React.Component { render () { return <main> <header><h1>{this.props.title}</h1></header> <div className="app-body">{this.props.children}</div> <footer>Questions or comments? Please let us know on the <a href="https://github.com/w3c/ash-nazg/">GitHub Repo for ash-nazg</a>.</footer> </main> ; } }
Add link to github repo in footer
Add link to github repo in footer close #19
JSX
mit
w3c/ash-nazg,w3c/ash-nazg
--- +++ @@ -6,7 +6,7 @@ return <main> <header><h1>{this.props.title}</h1></header> <div className="app-body">{this.props.children}</div> - <footer></footer> + <footer>Questions or comments? Please let us know on the <a href="https://github.com/w3c/ash-nazg/">GitHub Repo for ash-nazg</a>.</footer> </main> ; }
a0e2cc8075035f9cdc995f933710279d85838fc6
src/react-radar-chart.jsx
src/react-radar-chart.jsx
import React from 'react'; import ReactRadarChartLine from './react-radar-chart-line'; import './react-radar-chart.scss'; class ReactRadarChart extends React.Component { constructor(props) { super(props); this._defaultSize = '100%'; } getLineElems() { if (!this.props.values) { return <g></g>; } else { return this.props.values.map((d, i) => { return <ReactRadarChartLine key={ i } />; }); } } render() { return ( <svg className='react-radar-chart' width={ this.props.svgSize || this._defaultSize } height={ this.props.svgSize || this._defaultSize } > { this.getLineElems() } </svg> ); } } export default ReactRadarChart;
import React from 'react'; import d3_scale from 'd3-scale'; import ReactRadarChartLine from './react-radar-chart-line'; import './react-radar-chart.scss'; class ReactRadarChart extends React.Component { constructor(props) { super(props); this._defaultSize = '100%'; this._radiusScale = d3_scale.linear(); this._angleScale = d3_scale.linear() range([0, Math.PI * 2]); } componentWillUpdate(nextProps, nextState) { if (nextProps.keys && nextProps.keys.length && nextProps.keys.length !== this.props.keys.length) { this.setScaleDomain(this._angleScale, 0, nextProps.keys.length); } } dataUpdatedHandler() { if (this.props.outerRadius) { this._radiusScale .domain() } if (this.props.keys && this.props.keys.length) { this._angleScale.domain([0, this.props.keys.length]); } } getLineElems() { if (!this.props.values) { return ''; } return this.props.values.map((d, i) => { return <ReactRadarChartLine key={ i } />; }); } render() { return ( <svg className='react-radar-chart' width={ this.props.svgSize || this._defaultSize } height={ this.props.svgSize || this._defaultSize } > { this.getLineElems() } </svg> ); } } ReactRadarChart.propTypes = { svgSize: React.PropTypes.oneOfType([ React.PropTypes.number, React.PropTypes.string ]), keys: React.PropTypes.array, values: React.PropTypes.array, innerRadius: React.PropTypes.number, outerRadius: React.PropTypes.number }; export default ReactRadarChart;
Set scales and default proptypes
Set scales and default proptypes
JSX
mit
andy-law/react-radar-chart
--- +++ @@ -1,4 +1,5 @@ import React from 'react'; +import d3_scale from 'd3-scale'; import ReactRadarChartLine from './react-radar-chart-line'; @@ -9,16 +10,35 @@ constructor(props) { super(props); this._defaultSize = '100%'; + this._radiusScale = d3_scale.linear(); + this._angleScale = d3_scale.linear() + range([0, Math.PI * 2]); + } + + componentWillUpdate(nextProps, nextState) { + if (nextProps.keys && nextProps.keys.length && nextProps.keys.length !== this.props.keys.length) { + this.setScaleDomain(this._angleScale, 0, nextProps.keys.length); + } + } + + dataUpdatedHandler() { + if (this.props.outerRadius) { + this._radiusScale + .domain() + } + if (this.props.keys && this.props.keys.length) { + this._angleScale.domain([0, this.props.keys.length]); + } } getLineElems() { if (!this.props.values) { - return <g></g>; - } else { - return this.props.values.map((d, i) => { - return <ReactRadarChartLine key={ i } />; - }); + return ''; } + + return this.props.values.map((d, i) => { + return <ReactRadarChartLine key={ i } />; + }); } render() { @@ -34,4 +54,15 @@ } } +ReactRadarChart.propTypes = { + svgSize: React.PropTypes.oneOfType([ + React.PropTypes.number, + React.PropTypes.string + ]), + keys: React.PropTypes.array, + values: React.PropTypes.array, + innerRadius: React.PropTypes.number, + outerRadius: React.PropTypes.number +}; + export default ReactRadarChart;
22dcae2e78e8215f7b451beef6ab288734450843
ui/frontend/Editor.jsx
ui/frontend/Editor.jsx
import React, { PropTypes } from 'react'; import AceEditor from 'react-ace'; import brace from 'brace'; import 'brace/mode/rust'; import 'brace/theme/github'; import 'brace/keybinding/emacs'; // https://github.com/securingsincity/react-ace/issues/95 import 'brace/ext/language_tools'; export default class Editor extends React.Component { render() { const { editor } = this.props; return ( <div className="editor"> { editor === "simple" ? this.simpleEditor() : this.advancedEditor() } </div> ); } simpleEditor() { const { code, onEditCode } = this.props; return ( <textarea className="editor-simple" name="editor-simple" value={ code } onChange={ e => onEditCode(e.target.value) } /> ); } advancedEditor() { const { code, onEditCode } = this.props; return ( <AceEditor mode="rust" theme="github" keyboardHandler="emacs" value={ code } onChange={ onEditCode } name="editor" width="100%" height="100%" editorProps={ { $blockScrolling: true } } /> ); } }; Editor.propTypes = { editor: PropTypes.string.isRequired, onEditCode: PropTypes.func.isRequired, code: PropTypes.string.isRequired };
import React, { PropTypes } from 'react'; import AceEditor from 'react-ace'; import brace from 'brace'; import 'brace/mode/rust'; import 'brace/theme/github'; import 'brace/keybinding/emacs'; // https://github.com/securingsincity/react-ace/issues/95 import 'brace/ext/language_tools'; function SimpleEditor(props) { const { code, onEditCode } = props; return ( <textarea className="editor-simple" name="editor-simple" value={ code } onChange={ e => onEditCode(e.target.value) } /> ); } function AdvancedEditor(props) { const { code, onEditCode } = props; return ( <AceEditor mode="rust" theme="github" keyboardHandler="emacs" value={ code } onChange={ onEditCode } name="editor" width="100%" height="100%" editorProps={ { $blockScrolling: true } } /> ); } export default class Editor extends React.Component { render() { const { editor, code, onEditCode } = this.props; const simple = <SimpleEditor code={code} onEditCode={onEditCode} />; const advanced = <AdvancedEditor code={code} onEditCode={onEditCode} />; return ( <div className="editor"> { editor === "simple" ? simple : advanced } </div> ); } }; Editor.propTypes = { editor: PropTypes.string.isRequired, onEditCode: PropTypes.func.isRequired, code: PropTypes.string.isRequired };
Break out subcomponents for the editor
Break out subcomponents for the editor
JSX
apache-2.0
integer32llc/rust-playground,integer32llc/rust-playground,integer32llc/rust-playground,integer32llc/rust-playground,integer32llc/rust-playground
--- +++ @@ -8,42 +8,45 @@ // https://github.com/securingsincity/react-ace/issues/95 import 'brace/ext/language_tools'; +function SimpleEditor(props) { + const { code, onEditCode } = props; + + return ( + <textarea className="editor-simple" + name="editor-simple" + value={ code } + onChange={ e => onEditCode(e.target.value) } /> + ); +} + +function AdvancedEditor(props) { + const { code, onEditCode } = props; + + return ( + <AceEditor + mode="rust" + theme="github" + keyboardHandler="emacs" + value={ code } + onChange={ onEditCode } + name="editor" + width="100%" + height="100%" + editorProps={ { $blockScrolling: true } } /> + ); +} + export default class Editor extends React.Component { render() { - const { editor } = this.props; + const { editor, code, onEditCode } = this.props; + + const simple = <SimpleEditor code={code} onEditCode={onEditCode} />; + const advanced = <AdvancedEditor code={code} onEditCode={onEditCode} />; return ( <div className="editor"> - { editor === "simple" ? this.simpleEditor() : this.advancedEditor() } + { editor === "simple" ? simple : advanced } </div> - ); - } - - simpleEditor() { - const { code, onEditCode } = this.props; - - return ( - <textarea className="editor-simple" - name="editor-simple" - value={ code } - onChange={ e => onEditCode(e.target.value) } /> - ); - } - - advancedEditor() { - const { code, onEditCode } = this.props; - - return ( - <AceEditor - mode="rust" - theme="github" - keyboardHandler="emacs" - value={ code } - onChange={ onEditCode } - name="editor" - width="100%" - height="100%" - editorProps={ { $blockScrolling: true } } /> ); } };
ec3391126246ecb9209b1905c7c413aa29932f51
src/app/main.jsx
src/app/main.jsx
'use strict'; import React from 'react'; import ReactDOM from 'react-dom'; import App from './components/app.jsx' import ajax from './helpers/ajax' import { Router, hashHistory } from 'react-router'; import Routes from './routes/routes.jsx'; const MapStore = require('./../stores/map-store.jsx'); let initial = MapStore.getMaps(); function render () { ReactDOM.render( <Router routes={Routes} history={hashHistory} />, document.getElementById('app-mount-point')); } MapStore.onChange(function (data) { initial = data; render(); });
'use strict'; import React from 'react'; import ReactDOM from 'react-dom'; import { Router, hashHistory } from 'react-router'; import Routes from './routes/routes.jsx'; ReactDOM.render( <Router routes={Routes} history={hashHistory} />, document.getElementById('app-mount-point') );
Remove data find and onchange render
Remove data find and onchange render
JSX
mit
jkrayer/poc-map-points,jkrayer/poc-map-points
--- +++ @@ -2,21 +2,10 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import App from './components/app.jsx' -import ajax from './helpers/ajax' import { Router, hashHistory } from 'react-router'; import Routes from './routes/routes.jsx'; -const MapStore = require('./../stores/map-store.jsx'); -let initial = MapStore.getMaps(); - -function render () { - ReactDOM.render( - <Router routes={Routes} history={hashHistory} />, - document.getElementById('app-mount-point')); -} - -MapStore.onChange(function (data) { - initial = data; - render(); -}); +ReactDOM.render( + <Router routes={Routes} history={hashHistory} />, + document.getElementById('app-mount-point') +);
cf45ff6332571deab877375c359acfd02f4726f0
src/app.jsx
src/app.jsx
// Array.from polyfill import 'core-js/fn/array/from'; // Object.assign polyfill import 'core-js/es6/object'; // Symbol polyfill import 'core-js/es6/symbol'; // React import React from 'react'; import ReactRouter from 'react-router'; // App core import App from './app/index.js'; // User routes import routes from './routes.js'; // Helpers import basePath from './helpers/base-path.js'; import analytics from './helpers/analytics.js'; const appInstance = ( <ReactRouter.Route name="app" path={basePath} handler={App}> {routes} </ReactRouter.Route> ); const Bootstrapper = { start() { ReactRouter.run(appInstance, ReactRouter.HistoryLocation, function(Handler, state) { React.render(<Handler />, document.getElementById('mainContainer')); analytics.addEvent('pageviews', { path : state.path, action : state.action || 'pageload' }); }); }, }; export default Bootstrapper;
/*eslint camelcase: 0 */ // Array.from polyfill import 'core-js/fn/array/from'; // Object.assign polyfill import 'core-js/es6/object'; // Symbol polyfill import 'core-js/es6/symbol'; // React import React from 'react'; import ReactRouter from 'react-router'; // App core import App from './app/index.js'; // User routes import routes from './routes.js'; // Helpers import basePath from './helpers/base-path.js'; import analytics from './helpers/analytics.js'; const appInstance = ( <ReactRouter.Route name="app" path={basePath} handler={App}> {routes} </ReactRouter.Route> ); const Bootstrapper = { start() { ReactRouter.run(appInstance, ReactRouter.HistoryLocation, function(Handler, state) { React.render(<Handler />, document.getElementById('mainContainer')); analytics.addEvent('pageviews', { path : state.path, action : state.action || 'pageload', ip_address : '${keen.ip}', user_agent : '${keen.user_agent}' }); }); }, }; export default Bootstrapper;
Include more client info in analytics
:bar_chart: Include more client info in analytics
JSX
cc0-1.0
acusti/primal-multiplication,acusti/primal-multiplication
--- +++ @@ -1,3 +1,4 @@ +/*eslint camelcase: 0 */ // Array.from polyfill import 'core-js/fn/array/from'; // Object.assign polyfill @@ -27,7 +28,9 @@ React.render(<Handler />, document.getElementById('mainContainer')); analytics.addEvent('pageviews', { path : state.path, - action : state.action || 'pageload' + action : state.action || 'pageload', + ip_address : '${keen.ip}', + user_agent : '${keen.user_agent}' }); }); },
44ad47c05ff50da439ce2efb3029625cd47ad812
ui/js/component/router/view.jsx
ui/js/component/router/view.jsx
import React from 'react'; import SettingsPage from 'page/settings.js'; import HelpPage from 'page/help'; import ReportPage from 'page/report.js'; import StartPage from 'page/start.js'; import WalletPage from 'page/wallet'; import ShowPage from 'page/showPage'; import PublishPage from 'page/publish.js'; import DiscoverPage from 'page/discover'; import SplashScreen from 'component/splash.js'; import DeveloperPage from 'page/developer.js'; import FileListDownloaded from 'page/fileListDownloaded' import FileListPublished from 'page/fileListPublished' const route = (page, routesMap) => { const component = routesMap[page] return component }; const Router = (props) => { const { currentPage, } = props; return route(currentPage, { 'settings': <SettingsPage {...props} />, 'help': <HelpPage {...props} />, 'report': <ReportPage {...props} />, 'downloaded': <FileListDownloaded {...props} />, 'published': <FileListPublished {...props} />, 'start': <StartPage {...props} />, 'claim': <ClaimCodePage {...props} />, 'wallet': <WalletPage {...props} />, 'send': <WalletPage {...props} />, 'receive': <WalletPage {...props} />, 'show': <ShowPage {...props} />, 'publish': <PublishPage {...props} />, 'developer': <DeveloperPage {...props} />, 'discover': <DiscoverPage {...props} />, }) } export default Router
import React from 'react'; import SettingsPage from 'page/settings.js'; import HelpPage from 'page/help'; import ReportPage from 'page/report.js'; import StartPage from 'page/start.js'; import WalletPage from 'page/wallet'; import ShowPage from 'page/showPage'; import PublishPage from 'page/publish'; import DiscoverPage from 'page/discover'; import SplashScreen from 'component/splash.js'; import DeveloperPage from 'page/developer.js'; import FileListDownloaded from 'page/fileListDownloaded' import FileListPublished from 'page/fileListPublished' const route = (page, routesMap) => { const component = routesMap[page] return component }; const Router = (props) => { const { currentPage, } = props; return route(currentPage, { 'settings': <SettingsPage {...props} />, 'help': <HelpPage {...props} />, 'report': <ReportPage {...props} />, 'downloaded': <FileListDownloaded {...props} />, 'published': <FileListPublished {...props} />, 'start': <StartPage {...props} />, 'claim': <ClaimCodePage {...props} />, 'wallet': <WalletPage {...props} />, 'send': <WalletPage {...props} />, 'receive': <WalletPage {...props} />, 'show': <ShowPage {...props} />, 'publish': <PublishPage {...props} />, 'developer': <DeveloperPage {...props} />, 'discover': <DiscoverPage {...props} />, }) } export default Router
Fix publish page link in router
Fix publish page link in router
JSX
mit
MaxiBoether/lbry-app,lbryio/lbry-electron,lbryio/lbry-electron,lbryio/lbry-electron,MaxiBoether/lbry-app,akinwale/lbry-app,lbryio/lbry-app,MaxiBoether/lbry-app,akinwale/lbry-app,akinwale/lbry-app,akinwale/lbry-app,jsigwart/lbry-app,MaxiBoether/lbry-app,jsigwart/lbry-app,jsigwart/lbry-app,lbryio/lbry-app,jsigwart/lbry-app
--- +++ @@ -5,7 +5,7 @@ import StartPage from 'page/start.js'; import WalletPage from 'page/wallet'; import ShowPage from 'page/showPage'; -import PublishPage from 'page/publish.js'; +import PublishPage from 'page/publish'; import DiscoverPage from 'page/discover'; import SplashScreen from 'component/splash.js'; import DeveloperPage from 'page/developer.js';
fa79e0475ad64fb3013d1a0f7fc800f0181f4641
app/assets/javascripts/components/common/ArticleViewer/components/BadWorkAlertButton.jsx
app/assets/javascripts/components/common/ArticleViewer/components/BadWorkAlertButton.jsx
import React from 'react'; import PropTypes from 'prop-types'; export const BadWorkAlertButton = ({ showBadArticleAlert }) => ( <a className="button danger small pull-right article-viewer-button" onClick={showBadArticleAlert} > Report Unsatisfactory Work </a> ); BadWorkAlertButton.propTypes = { showBadArticleAlert: PropTypes.func.isRequired }; export default BadWorkAlertButton;
import React from 'react'; import PropTypes from 'prop-types'; export const BadWorkAlertButton = ({ showBadArticleAlert }) => ( <a className="button small pull-right article-viewer-button" onClick={showBadArticleAlert} > Quality Problems? </a> ); BadWorkAlertButton.propTypes = { showBadArticleAlert: PropTypes.func.isRequired }; export default BadWorkAlertButton;
Change label for BadWorkAlert button
Change label for BadWorkAlert button Instructors may be wary of clicking the danger-styled button because they don't know what it will do. This will hopefully make it more inviting for instructors to click to see the 'open' mode and learn about whether or not to submit an alert.
JSX
mit
WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard
--- +++ @@ -3,10 +3,10 @@ export const BadWorkAlertButton = ({ showBadArticleAlert }) => ( <a - className="button danger small pull-right article-viewer-button" + className="button small pull-right article-viewer-button" onClick={showBadArticleAlert} > - Report Unsatisfactory Work + Quality Problems? </a> );
e9635deadbe2388e67a34e97850a00bb9337c726
src/jsx/components/Copyright.jsx
src/jsx/components/Copyright.jsx
import React, { Component } from 'react'; const currentYear = new Date().getFullYear(); export default class Copyright extends Component { render() { return <span>&copy; {currentYear} David Minnerly</span>; } }
import React, { Component } from 'react'; export default class Copyright extends Component { getYear() { return new Date().getFullYear(); } render() { return <span>&copy; {this.getYear()} David Minnerly</span>; } }
Create a method for getting copyright year
Create a method for getting copyright year
JSX
mit
vocksel/my-website,VoxelDavid/voxeldavid-website,VoxelDavid/voxeldavid-website,vocksel/my-website
--- +++ @@ -1,9 +1,11 @@ import React, { Component } from 'react'; -const currentYear = new Date().getFullYear(); +export default class Copyright extends Component { + getYear() { + return new Date().getFullYear(); + } -export default class Copyright extends Component { render() { - return <span>&copy; {currentYear} David Minnerly</span>; + return <span>&copy; {this.getYear()} David Minnerly</span>; } }
edb6a3d5aa20f5f9f1b848f18d648361975766b4
app/components/component-link.jsx
app/components/component-link.jsx
/** @jsx React.DOM */ 'use strict'; var React = require('react'); var config = require('app/config'); var router = require('app/router'); module.exports = React.createClass({ displayName: 'ComponentLink', getUrl: function() { return '/component/' + encodeURIComponent(this.props.component.name); }, onClick: function(e) { // If trying to open a new window, fall back if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.button === 2) { return; } e.preventDefault(); var pageTitle = this.props.component.name + ' - ' + config['page-title']; history.pushState({}, pageTitle, e.target.href); router.locationChanged(); if (window.URL && window.ga) { var url = new URL(e.target.href); window.ga('send', { hitType: 'pageview', page: url.pathname, title: pageTitle }); } }, /* jshint quotmark:false, newcap:false */ render: function() { return ( <a className="component-name" href={this.getUrl()} onClick={this.onClick}> {this.props.children || this.props.component.name} </a> ); } });
/** @jsx React.DOM */ 'use strict'; var React = require('react'); var config = require('app/config'); var router = require('app/router'); module.exports = React.createClass({ displayName: 'ComponentLink', getUrl: function() { return '/component/' + encodeURIComponent(this.props.component.name); }, onClick: function(e) { // If trying to open a new window, fall back if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) { return; } e.preventDefault(); var pageTitle = this.props.component.name + ' - ' + config['page-title']; history.pushState({}, pageTitle, e.target.href); router.locationChanged(); if (window.URL && window.ga) { var url = new URL(e.target.href); window.ga('send', { hitType: 'pageview', page: url.pathname, title: pageTitle }); } }, /* jshint quotmark:false, newcap:false */ render: function() { return ( <a className="component-name" href={this.getUrl()} onClick={this.onClick}> {this.props.children || this.props.component.name} </a> ); } });
Check for mouse button not being left click in link component
Check for mouse button not being left click in link component Currently, middle clicking navigates in the same window. Checking for the mouse button not being a left click should fix this.
JSX
mit
vaffel/react-components,vizavi21/react-components,vizavi21/react-components,rogeliog/react-components,rexxars/react-components,rogeliog/react-components,rexxars/react-components,vaffel/react-components
--- +++ @@ -14,7 +14,7 @@ onClick: function(e) { // If trying to open a new window, fall back - if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.button === 2) { + if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) { return; }
df03bc09eef084b59cfdd52ede74752e7a179adf
client/js/app.jsx
client/js/app.jsx
/* eslint-env browser */ import React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; import qs from 'query-string'; // Loads all modules import 'morpheus'; // Then pull out the stuff we need import { actions as sceneActions } from 'morpheus/scene'; import { actions as gamestateActions } from 'morpheus/gamestate'; import { actions as gameActions } from 'morpheus/game'; import store from 'store'; import Game from 'react/Game'; const qp = qs.parse(location.search); function resizeToWindow() { store.dispatch(gameActions.resize({ width: window.innerWidth, height: window.innerHeight, })); } window.onload = () => { render( <Provider store={store}> <Game /> </Provider>, document.getElementById('root'), ); store.dispatch(gameActions.resize({ width: window.innerWidth, height: window.innerHeight, })) store.dispatch(gamestateActions.fetchInitial()) .then(() => store.dispatch(sceneActions.startAtScene(qp.scene || 8010))); window.addEventListener('resize', () => { resizeToWindow(); }); };
/* eslint-env browser */ import React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; import qs from 'query-string'; // Loads all modules import 'morpheus'; // Then pull out the stuff we need import { actions as sceneActions } from 'morpheus/scene'; import { actions as gamestateActions } from 'morpheus/gamestate'; import { actions as gameActions } from 'morpheus/game'; import store from 'store'; import Game from 'react/Game'; const qp = qs.parse(location.search); function resizeToWindow() { store.dispatch(gameActions.resize({ width: window.innerWidth, height: window.innerHeight, })); } window.onload = () => { render( <Provider store={store}> <Game /> </Provider>, document.getElementById('root'), ); store.dispatch(gameActions.resize({ width: window.innerWidth, height: window.innerHeight, })); store.dispatch(gamestateActions.fetchInitial()) .then(() => store.dispatch(sceneActions.startAtScene(qp.scene || 100000))); window.addEventListener('resize', () => { resizeToWindow(); }); };
Set default start location to intro
Set default start location to intro
JSX
mit
CaptEmulation/webgl-pano,CaptEmulation/webgl-pano,CaptEmulation/morpheus,CaptEmulation/morpheus
--- +++ @@ -33,9 +33,9 @@ store.dispatch(gameActions.resize({ width: window.innerWidth, height: window.innerHeight, - })) + })); store.dispatch(gamestateActions.fetchInitial()) - .then(() => store.dispatch(sceneActions.startAtScene(qp.scene || 8010))); + .then(() => store.dispatch(sceneActions.startAtScene(qp.scene || 100000))); window.addEventListener('resize', () => { resizeToWindow();
f650ce4d02c5c3a8d8793d28da65dffda42f6202
examples/index.jsx
examples/index.jsx
import React from 'react'; import ReactDOM from 'react-dom'; import Datamap from '../src'; const App = React.createClass({ displayName: 'App', getInitialState() { return { height: 300, scope: 'world', width: 500 }; }, update() { this.setState({ height: parseInt(this.refs.height.value, 10) || null, scope: this.refs.scope.value || null, width: parseInt(this.refs.width.value, 10) || null }); }, render() { return ( <div className="App"> <div className="App-options"> <label>Height <input ref="height" type="number" /></label> <label>Scope <input ref="scope" type="text" /></label> <label>Width <input ref="width" type="number" /></label> <button onClick={this.update}>Update</button> </div> <div className="App-map"> <Datamap {...this.state} /> </div> </div> ); } }); ReactDOM.render( <App />, document.getElementById('app') );
import React from 'react'; import ReactDOM from 'react-dom'; import Datamap from '../src'; const App = React.createClass({ displayName: 'App', getInitialState() { return { height: 300, scope: 'world', width: 500 }; }, update() { this.setState(Object.assign({}, { height: parseInt(this.refs.height.value, 10) || null, scope: this.refs.scope.value || null, width: parseInt(this.refs.width.value, 10) || null }, window.example)); }, render() { return ( <div className="App"> <div className="App-options"> <label>Height <input ref="height" type="number" /></label> <label>Scope <input ref="scope" type="text" /></label> <label>Width <input ref="width" type="number" /></label> <button onClick={this.update}>Update</button> </div> <div className="App-map"> <Datamap {...this.state} /> </div> </div> ); } }); ReactDOM.render( <App />, document.getElementById('app') );
Enable setting example options via window.example
Enable setting example options via window.example
JSX
mit
btmills/react-datamaps
--- +++ @@ -16,11 +16,11 @@ }, update() { - this.setState({ + this.setState(Object.assign({}, { height: parseInt(this.refs.height.value, 10) || null, scope: this.refs.scope.value || null, width: parseInt(this.refs.width.value, 10) || null - }); + }, window.example)); }, render() {
75f1fe2da1163640d9e3bbd661715e71ea1da5b8
src/components/post-attachments.jsx
src/components/post-attachments.jsx
import React from 'react'; import ImageAttachment from './post-attachment-image'; import AudioAttachment from './post-attachment-audio'; import GeneralAttachment from './post-attachment-general'; export default (props) => { const attachments = props.attachments || []; const imageAttachments = attachments .filter(attachment => attachment.mediaType === 'image') .map(attachment => ( <ImageAttachment key={attachment.id} isEditing={props.isEditing} removeAttachment={props.removeAttachment} {...attachment}/> )); const audioAttachments = attachments .filter(attachment => attachment.mediaType === 'audio') .map(attachment => ( <AudioAttachment key={attachment.id} isEditing={props.isEditing} removeAttachment={props.removeAttachment} {...attachment}/> )); const generalAttachments = attachments .filter(attachment => attachment.mediaType === 'general') .map(attachment => ( <GeneralAttachment key={attachment.id} isEditing={props.isEditing} removeAttachment={props.removeAttachment} {...attachment}/> )); return (attachments.length > 0 ? ( <div className="attachments"> <div className="image-attachments"> {imageAttachments} </div> <div className="audio-attachments"> {audioAttachments} </div> <div className="general-attachments"> {generalAttachments} </div> </div> ) : <div/>); };
import React from 'react'; import ImageAttachment from './post-attachment-image'; import AudioAttachment from './post-attachment-audio'; import GeneralAttachment from './post-attachment-general'; export default class PostAttachments extends React.Component { render() { const attachments = this.props.attachments || []; const imageAttachments = attachments .filter(attachment => attachment.mediaType === 'image') .map(attachment => ( <ImageAttachment key={attachment.id} isEditing={this.props.isEditing} removeAttachment={this.props.removeAttachment} {...attachment}/> )); const audioAttachments = attachments .filter(attachment => attachment.mediaType === 'audio') .map(attachment => ( <AudioAttachment key={attachment.id} isEditing={this.props.isEditing} removeAttachment={this.props.removeAttachment} {...attachment}/> )); const generalAttachments = attachments .filter(attachment => attachment.mediaType === 'general') .map(attachment => ( <GeneralAttachment key={attachment.id} isEditing={this.props.isEditing} removeAttachment={this.props.removeAttachment} {...attachment}/> )); return (attachments.length > 0 ? ( <div className="attachments"> <div className="image-attachments"> {imageAttachments} </div> <div className="audio-attachments"> {audioAttachments} </div> <div className="general-attachments"> {generalAttachments} </div> </div> ) : <div/>); } };
Refactor PostAttachments into non-simplified component
Refactor PostAttachments into non-simplified component
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -3,50 +3,52 @@ import AudioAttachment from './post-attachment-audio'; import GeneralAttachment from './post-attachment-general'; -export default (props) => { - const attachments = props.attachments || []; +export default class PostAttachments extends React.Component { + render() { + const attachments = this.props.attachments || []; - const imageAttachments = attachments - .filter(attachment => attachment.mediaType === 'image') - .map(attachment => ( - <ImageAttachment - key={attachment.id} - isEditing={props.isEditing} - removeAttachment={props.removeAttachment} - {...attachment}/> - )); + const imageAttachments = attachments + .filter(attachment => attachment.mediaType === 'image') + .map(attachment => ( + <ImageAttachment + key={attachment.id} + isEditing={this.props.isEditing} + removeAttachment={this.props.removeAttachment} + {...attachment}/> + )); - const audioAttachments = attachments - .filter(attachment => attachment.mediaType === 'audio') - .map(attachment => ( - <AudioAttachment - key={attachment.id} - isEditing={props.isEditing} - removeAttachment={props.removeAttachment} - {...attachment}/> - )); + const audioAttachments = attachments + .filter(attachment => attachment.mediaType === 'audio') + .map(attachment => ( + <AudioAttachment + key={attachment.id} + isEditing={this.props.isEditing} + removeAttachment={this.props.removeAttachment} + {...attachment}/> + )); - const generalAttachments = attachments - .filter(attachment => attachment.mediaType === 'general') - .map(attachment => ( - <GeneralAttachment - key={attachment.id} - isEditing={props.isEditing} - removeAttachment={props.removeAttachment} - {...attachment}/> - )); + const generalAttachments = attachments + .filter(attachment => attachment.mediaType === 'general') + .map(attachment => ( + <GeneralAttachment + key={attachment.id} + isEditing={this.props.isEditing} + removeAttachment={this.props.removeAttachment} + {...attachment}/> + )); - return (attachments.length > 0 ? ( - <div className="attachments"> - <div className="image-attachments"> - {imageAttachments} + return (attachments.length > 0 ? ( + <div className="attachments"> + <div className="image-attachments"> + {imageAttachments} + </div> + <div className="audio-attachments"> + {audioAttachments} + </div> + <div className="general-attachments"> + {generalAttachments} + </div> </div> - <div className="audio-attachments"> - {audioAttachments} - </div> - <div className="general-attachments"> - {generalAttachments} - </div> - </div> - ) : <div/>); + ) : <div/>); + } };
7678bf223d53da2407a1b8bbe5632d6c5bd7b04c
app/components/component-page.jsx
app/components/component-page.jsx
"use strict"; import React, {Component} from 'react'; import AppStore from './../stores/AppStore'; // Components import Main from '../main'; class ComponentPage extends Component { constructor(props) { super(props); this.state = AppStore.getData(this.props.params.componentId) || {}; } // Updating state componentWillReceiveProps(nextProps) { this.state = AppStore.getData(nextProps.params.componentId) || {}; } // If id is not the same than previous should update the component shouldComponentUpdate(nextProps, nextState) { return nextProps.params.componentId !== this.props.params.componentId; } componentDidUpdate() { this.state = AppStore.getData(this.props.params.componentId) || {}; } render() { return ( <Main> <h2>{this.state.title}</h2> {this.state.contents} </Main> ); } } export default ComponentPage;
"use strict"; import React, {Component} from 'react'; import AppStore from './../stores/AppStore'; // Components import Main from '../main'; class ComponentPage extends Component { constructor(props) { super(props); this.state = AppStore.getData(this.props.params.componentId) || {}; } // Updating state componentWillReceiveProps(nextProps) { this.state = AppStore.getData(nextProps.params.componentId) || {}; } // Updating state componentWillReceiveProps(nextProps) { this.state = AppStore.getData(nextProps.params.componentId) || {}; } // If id is not the same than previous should update the component shouldComponentUpdate(nextProps, nextState) { return nextProps.params.componentId !== this.props.params.componentId; } componentDidUpdate() { this.state = AppStore.getData(this.props.params.componentId) || {}; } render() { return ( <Main> <h2>{this.state.title}</h2> <div className="content" dangerouslySetInnerHTML={{__html: this.state.contents}}></div> </Main> ); } } export default ComponentPage;
Add parsed html on the react component
Add parsed html on the react component
JSX
mit
AzkabanCoders/markdown-docs,AzkabanCoders/markdown-docs
--- +++ @@ -10,6 +10,11 @@ constructor(props) { super(props); this.state = AppStore.getData(this.props.params.componentId) || {}; + } + + // Updating state + componentWillReceiveProps(nextProps) { + this.state = AppStore.getData(nextProps.params.componentId) || {}; } // Updating state @@ -31,7 +36,7 @@ <Main> <h2>{this.state.title}</h2> - {this.state.contents} + <div className="content" dangerouslySetInnerHTML={{__html: this.state.contents}}></div> </Main> ); }
286747f5bd83eedf4f0fffcb485fa17d384af1d2
wrappers/head/component.jsx
wrappers/head/component.jsx
import React from 'react'; import PropTypes from 'prop-types'; import NextHead from 'next/head'; import ReactHtmlParser from 'react-html-parser'; // if the metaTags prop is returned from getStaticProps or getServerSide props // we parse it and use in favour of page props const Head = ({ title, description, noIndex, metaTags }) => { return metaTags ? ( ReactHtmlParser(metaTags) ) : ( <NextHead> <title>{title}</title> <meta name="description" content={description} /> <meta name="author" content="Vizzuality" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:creator" content="@globalforests" /> <meta name="twitter:description" content={description} /> <meta property="og:title" content={title} /> <meta property="og:description" content={description} /> <meta property="og:type" content="website" /> <meta property="og:image" content="/preview.jpg" /> {noIndex && <meta name="robots" content="noindex,follow" />} <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5" /> </NextHead> )}; Head.propTypes = { title: PropTypes.string, description: PropTypes.string, noIndex: PropTypes.bool, metaTags: PropTypes.string, }; export default Head;
import React from 'react'; import PropTypes from 'prop-types'; import NextHead from 'next/head'; import ReactHtmlParser from 'react-html-parser'; // if the metaTags prop is returned from getStaticProps or getServerSide props // we parse it and use in favour of page props const Head = ({ title, description, noIndex, metaTags }) => { const isProduction = process.env.NEXT_PUBLIC_FEATURE_ENV === 'production'; return metaTags ? ( ReactHtmlParser(metaTags) ) : ( <NextHead> <title>{title}</title> <meta name="description" content={description} /> <meta name="author" content="Vizzuality" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:creator" content="@globalforests" /> <meta name="twitter:description" content={description} /> <meta property="og:title" content={title} /> <meta property="og:description" content={description} /> <meta property="og:type" content="website" /> <meta property="og:image" content="/preview.jpg" /> {(!isProduction || noIndex) && ( <meta name="robots" content="noindex,follow" /> )} <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5" /> </NextHead> ); }; Head.propTypes = { title: PropTypes.string, description: PropTypes.string, noIndex: PropTypes.bool, metaTags: PropTypes.string, }; export default Head;
Add a noindex metatag when not in production
Add a noindex metatag when not in production
JSX
mit
Vizzuality/gfw,Vizzuality/gfw
--- +++ @@ -6,6 +6,8 @@ // if the metaTags prop is returned from getStaticProps or getServerSide props // we parse it and use in favour of page props const Head = ({ title, description, noIndex, metaTags }) => { + const isProduction = process.env.NEXT_PUBLIC_FEATURE_ENV === 'production'; + return metaTags ? ( ReactHtmlParser(metaTags) ) : ( @@ -20,13 +22,16 @@ <meta property="og:description" content={description} /> <meta property="og:type" content="website" /> <meta property="og:image" content="/preview.jpg" /> - {noIndex && <meta name="robots" content="noindex,follow" />} + {(!isProduction || noIndex) && ( + <meta name="robots" content="noindex,follow" /> + )} <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5" /> </NextHead> - )}; + ); +}; Head.propTypes = { title: PropTypes.string,
e48f15ac33c5072fa0f498fd532ac50136d350ec
src/components/MuiWrapper.jsx
src/components/MuiWrapper.jsx
import React from 'react' import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider' import lightBaseTheme from 'material-ui/styles/baseThemes/lightBaseTheme' import darkBaseTheme from 'material-ui/styles/baseThemes/darkBaseTheme' import getMuiTheme from 'material-ui/styles/getMuiTheme' export default class MuiWrapper extends React.Component { constructor (props) { super(props) const { darkTheme = false, ...rest } = props this.state = {darkTheme, ...rest} } render () { const { children, darkTheme } = this.state return <MuiThemeProvider muiTheme={getMuiTheme(darkTheme ? darkBaseTheme : lightBaseTheme)} > {children} </MuiThemeProvider> } }
import React from 'react' import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider' import lightBaseTheme from 'material-ui/styles/baseThemes/lightBaseTheme' import darkBaseTheme from 'material-ui/styles/baseThemes/darkBaseTheme' import getMuiTheme from 'material-ui/styles/getMuiTheme' export default class MuiWrapper extends React.Component { render () { const { darkTheme, children, ...rest } = this.props return <MuiThemeProvider muiTheme={getMuiTheme(darkTheme ? darkBaseTheme : lightBaseTheme)} {...rest} > {children} </MuiThemeProvider> } }
Use props instead of state
Use props instead of state
JSX
mit
KSXGitHub/react-hello-world,KSXGitHub/react-hello-world,KSXGitHub/react-hello-world
--- +++ @@ -5,25 +5,16 @@ import getMuiTheme from 'material-ui/styles/getMuiTheme' export default class MuiWrapper extends React.Component { - constructor (props) { - super(props) - - const { - darkTheme = false, - ...rest - } = props - - this.state = {darkTheme, ...rest} - } - render () { const { + darkTheme, children, - darkTheme - } = this.state + ...rest + } = this.props return <MuiThemeProvider muiTheme={getMuiTheme(darkTheme ? darkBaseTheme : lightBaseTheme)} + {...rest} > {children} </MuiThemeProvider>
364c3a05f1a33693d46f044ae593ec237e2a44d6
app/src/components/Shared/Toggle.jsx
app/src/components/Shared/Toggle.jsx
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import ToggleStyles from 'styles/components/shared/toggle.scss'; import classnames from 'classnames'; import { hueToClosestColor } from 'util/colors'; import { COLORS } from 'config'; class Toggle extends Component { getColor() { if (this.props.hue !== undefined) { return hueToClosestColor(this.props.hue); } if (this.props.colorName !== undefined) { return COLORS[this.props.colorName]; } return this.props.color; } render() { return (<div className={classnames( ToggleStyles.toggle, { [ToggleStyles._active]: this.props.on }, { [ToggleStyles[this.getColor()]]: this.props.on } )} > <input type="checkbox" onChange={() => this.props.onToggled()} checked={this.props.on} readOnly /> <div className={ToggleStyles.toggleBall}> <span className={classnames( ToggleStyles.toggleInnerBall, { [ToggleStyles[this.getColor()]]: this.props.on } )} /> </div> </div>); } } Toggle.propTypes = { on: PropTypes.bool, hue: PropTypes.number, color: PropTypes.string, colorName: PropTypes.string, onToggled: PropTypes.func }; export default Toggle;
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import ToggleStyles from 'styles/components/shared/toggle.scss'; import classnames from 'classnames'; import { hueToClosestColor } from 'util/colors'; class Toggle extends Component { getColor() { if (this.props.hue !== undefined) { return hueToClosestColor(this.props.hue); } if (this.props.colorName !== undefined) { return this.props.colorName; } return this.props.color; } render() { return (<div className={classnames( ToggleStyles.toggle, { [ToggleStyles._active]: this.props.on }, { [ToggleStyles[this.getColor()]]: this.props.on } )} > <input type="checkbox" onChange={() => this.props.onToggled()} checked={this.props.on} readOnly /> <div className={ToggleStyles.toggleBall}> <span className={classnames( ToggleStyles.toggleInnerBall, { [ToggleStyles[this.getColor()]]: this.props.on } )} /> </div> </div>); } } Toggle.propTypes = { on: PropTypes.bool, hue: PropTypes.number, color: PropTypes.string, colorName: PropTypes.string, onToggled: PropTypes.func }; export default Toggle;
Fix color not showing in toggle
Fix color not showing in toggle
JSX
mit
Vizzuality/GlobalFishingWatch,Vizzuality/GlobalFishingWatch,Vizzuality/GlobalFishingWatch
--- +++ @@ -3,7 +3,6 @@ import ToggleStyles from 'styles/components/shared/toggle.scss'; import classnames from 'classnames'; import { hueToClosestColor } from 'util/colors'; -import { COLORS } from 'config'; class Toggle extends Component { getColor() { @@ -11,7 +10,7 @@ return hueToClosestColor(this.props.hue); } if (this.props.colorName !== undefined) { - return COLORS[this.props.colorName]; + return this.props.colorName; } return this.props.color; }
ee290c98ba75ecf3731205a4c2e5707959b38695
src/piechart/ArcContainer.jsx
src/piechart/ArcContainer.jsx
'use strict'; const React = require('react'); const shade = require('../utils').shade; const Arc = require('./Arc'); module.exports = React.createClass({ displayName: 'ArcContainer', propTypes: { fill: React.PropTypes.string, onMouseOver: React.PropTypes.func, onMouseLeave: React.PropTypes.func, dataPoint: React.PropTypes.any, // TODO prop type? }, getInitialState() { return { // fill is named as fill instead of initialFill to avoid // confusion when passing down props from top parent fill: this.props.fill, }; }, _animateArc() { const rect = this.getDOMNode().getBoundingClientRect(); this.props.onMouseOver.call(this, rect.right, rect.top, this.props.dataPoint); this.setState({ fill: shade(this.props.fill, 0.2), }); }, _restoreArc() { this.props.onMouseLeave.call(this); this.setState({ fill: this.props.fill, }); }, render() { const props = this.props; return ( <Arc {...this.props} fill={this.state.fill} handleMouseOver={props.hoverAnimation ? this._animateArc : null} handleMouseLeave={props.hoverAnimation ? this._restoreArc : null} /> ); }, });
'use strict'; const React = require('react'); const { findDOMNode } = require('react-dom'); const shade = require('../utils').shade; const Arc = require('./Arc'); module.exports = React.createClass({ displayName: 'ArcContainer', propTypes: { fill: React.PropTypes.string, onMouseOver: React.PropTypes.func, onMouseLeave: React.PropTypes.func, dataPoint: React.PropTypes.any, // TODO prop type? }, getInitialState() { return { // fill is named as fill instead of initialFill to avoid // confusion when passing down props from top parent fill: this.props.fill, }; }, _animateArc() { const rect = findDOMNode(this).getBoundingClientRect(); this.props.onMouseOver.call(this, rect.right, rect.top, this.props.dataPoint); this.setState({ fill: shade(this.props.fill, 0.2), }); }, _restoreArc() { this.props.onMouseLeave.call(this); this.setState({ fill: this.props.fill, }); }, render() { const props = this.props; return ( <Arc {...this.props} fill={this.state.fill} handleMouseOver={props.hoverAnimation ? this._animateArc : null} handleMouseLeave={props.hoverAnimation ? this._restoreArc : null} /> ); }, });
Make test pass by updating codebase
Make test pass by updating codebase
JSX
mit
yang-wei/rd3
--- +++ @@ -1,6 +1,7 @@ 'use strict'; const React = require('react'); +const { findDOMNode } = require('react-dom'); const shade = require('../utils').shade; const Arc = require('./Arc'); @@ -25,7 +26,7 @@ }, _animateArc() { - const rect = this.getDOMNode().getBoundingClientRect(); + const rect = findDOMNode(this).getBoundingClientRect(); this.props.onMouseOver.call(this, rect.right, rect.top, this.props.dataPoint); this.setState({ fill: shade(this.props.fill, 0.2),
f8d96e2a19377173cb251400583d626d189c7832
public/javascripts/components/login/LoginPage.jsx
public/javascripts/components/login/LoginPage.jsx
import React from 'react'; import LoginCard from './LoginCard'; export default class LoginPage extends React.Component { componentDidMount() { $('html').css({'background-image': 'url(/images/landing-background.jpg)'}) $('body').css({'background-image': 'url(/images/landing-background.jpg)'}) } render() { return ( <div className="login-wrapper"> <LoginCard /> </div> ) } }
import React from 'react'; import LoginCard from './LoginCard'; export default class LoginPage extends React.Component { componentDidMount() { $('html').css({'background-image': 'url(/images/landing-background.jpg)'}) $('body').css({'background-image': 'url(/images/landing-background.jpg)'}) } componentWillUnmount() { $('html').css({'background-image': 'none'}) $('body').css({'background-image': 'none'}) } render() { return ( <div className="login-wrapper"> <LoginCard /> </div> ) } }
Remove background image on login unmount
Remove background image on login unmount
JSX
unlicense
treyhuffine/gitcoders
--- +++ @@ -7,6 +7,10 @@ $('html').css({'background-image': 'url(/images/landing-background.jpg)'}) $('body').css({'background-image': 'url(/images/landing-background.jpg)'}) } + componentWillUnmount() { + $('html').css({'background-image': 'none'}) + $('body').css({'background-image': 'none'}) + } render() { return ( <div className="login-wrapper">
aead80f02d574f50e69ad242d5c0c02b5dc6e5e2
src/components/Welcome/index.jsx
src/components/Welcome/index.jsx
import React, { Component, Text, View, StyleSheet } from 'react-native'; export default class Welcome extends Component { /** * Render * * @return {jsx} */ render() { return ( <View style={ styles.container }> <Text style={ styles.welcome }> React Native Redux Starter Kit </Text> <Text style={ styles.instructions }> To get started, edit ./src/components/Foo.jsx </Text> <Text style={ styles.instructions }> Press Cmd+R to reload,{'\n'} Cmd+D or shake for dev menu </Text> </View> ); } } var styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF' }, welcome: { fontSize: 20, textAlign: 'center', margin: 10 }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5 }, });
import React, { Component, Text, View, StyleSheet } from 'react-native'; export default class Welcome extends Component { /** * Render * * @return {jsx} */ render() { return ( <View style={ styles.container }> <Text style={ styles.welcome }> React Native Redux Starter Kit </Text> <Text style={ styles.instructions }> Edit ./src/component/Welcome/index.jsx{'\n'} to get started. </Text> <Text style={ styles.instructions }> Press Cmd+R to reload,{'\n'} Cmd+D or shake for dev menu </Text> </View> ); } } var styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF' }, welcome: { fontSize: 20, textAlign: 'center', margin: 10 }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 10 }, });
Fix style on <Welcome /> component
Fix style on <Welcome /> component
JSX
mit
sashafklein/ballot-marker,sashafklein/ballot-marker,sashafklein/ballot-marker,LeoLeBras/react-native-redux-starter-kit,LeoLeBras/react-native-redux-starter-kit,LeoLeBras/react-native-redux-starter-kit,sashafklein/ballot-marker
--- +++ @@ -14,7 +14,8 @@ React Native Redux Starter Kit </Text> <Text style={ styles.instructions }> - To get started, edit ./src/components/Foo.jsx + Edit ./src/component/Welcome/index.jsx{'\n'} + to get started. </Text> <Text style={ styles.instructions }> Press Cmd+R to reload,{'\n'} @@ -41,6 +42,6 @@ instructions: { textAlign: 'center', color: '#333333', - marginBottom: 5 + marginBottom: 10 }, });
5fce4a70f2c9b1bd46b3fa61683030b1f24c224b
src/jsx/components/Intro.jsx
src/jsx/components/Intro.jsx
import React, { Component } from 'react'; import links from 'css/components/_links.scss'; import { Section, Content, Title } from './layout'; export default class Intro extends Component { render() { return ( <Section> <Content> <Title>About</Title> <p>Hey, nice to meet you, I'm David Minnerly. I'm a programmer, 3D modeler, and I also make websites on occasion.</p> <p>I'm 20 years old and I've been programming since I was 13. I'm fluent in Lua, and I can hold my ground in JavaScript and Python. I've also done a bit of 3D modeling in recent years, and I've made a few websites. I frequently post about what I'm up to on <a href="https://twitter.com/voxeldavid" className={links.twitter}>Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a href="https://github.com/vocksel" className={links.github}>GitHub <i className="fa fa-github" /></a>.</p> </Content> </Section> ); } }
import React, { Component } from 'react'; import links from 'css/components/_links.scss'; import { Section, Content, Title } from './layout'; export default class Intro extends Component { render() { return ( <Section> <Content> <Title>About</Title> <p>Hey, nice to meet you, I'm David Minnerly. I'm a programmer, 3D modeler, and I also make websites on occasion.</p> <p>I'm 20 years old and I've been programming since I was 13. I'm fluent in Lua, and I can hold my ground in JavaScript and Python. I frequently post about what I'm up to on <a href="https://twitter.com/voxeldavid" className={links.twitter}>Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a href="https://github.com/vocksel" className={links.github}>GitHub <i className="fa fa-github" /></a>.</p> </Content> </Section> ); } }
Remove a sentence about my recent work
Remove a sentence about my recent work It didn't really fit with the rest of the paragraph. Going from my selling points to social media flows a lot better
JSX
mit
VoxelDavid/voxeldavid-website,VoxelDavid/voxeldavid-website,vocksel/my-website,vocksel/my-website
--- +++ @@ -12,7 +12,7 @@ <p>Hey, nice to meet you, I'm David Minnerly. I'm a programmer, 3D modeler, and I also make websites on occasion.</p> - <p>I'm 20 years old and I've been programming since I was 13. I'm fluent in Lua, and I can hold my ground in JavaScript and Python. I've also done a bit of 3D modeling in recent years, and I've made a few websites. I frequently post about what I'm up to on <a href="https://twitter.com/voxeldavid" className={links.twitter}>Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a href="https://github.com/vocksel" className={links.github}>GitHub <i className="fa fa-github" /></a>.</p> + <p>I'm 20 years old and I've been programming since I was 13. I'm fluent in Lua, and I can hold my ground in JavaScript and Python. I frequently post about what I'm up to on <a href="https://twitter.com/voxeldavid" className={links.twitter}>Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a href="https://github.com/vocksel" className={links.github}>GitHub <i className="fa fa-github" /></a>.</p> </Content> </Section> );
a1fcfa04051fa638837aed9c3e00352bcbe38a72
src/components/dev-bookmarks.jsx
src/components/dev-bookmarks.jsx
import React from 'react'; const BOOKMARKS = require('json!../../assets/dev-bookmarks.json'); export const DevBookmarks = () => { const bookmarks = BOOKMARKS.map((bm, i) => { const isTag = bm.url.startsWith('/tag'); return (<li key={i}> <span style={{ color: '#bbb', paddingRight: 5 }} className={isTag ? 'octicon octicon-three-bars' : 'octicon octicon-link-external'} /> <a href={bm.url} style={{ color: '#00b7ff' }} target={ isTag ? '_self' : '_blank'}> {bm.title} </a> </li>); }); return (<ul className="list-unstyled">{bookmarks}</ul>); };
import React from 'react'; import { Link } from 'react-router'; const BOOKMARKS = require('json!../../assets/dev-bookmarks.json'); const STYLE = { color: '#00b7ff' }; export const DevBookmarks = () => { const bookmarks = BOOKMARKS.map((bm, i) => { const isTag = bm.url.startsWith('/tag'); const link = isTag ? <Link to={bm.url} style={STYLE}>{bm.title}</Link> : <a href={bm.url} style={STYLE} target="_blank">{bm.title}</a>; return (<li key={i}> <span style={{ color: '#bbb', paddingRight: 5 }} className={isTag ? 'octicon octicon-three-bars' : 'octicon octicon-link-external'} /> {link} </li>); }); return (<ul className="list-unstyled">{bookmarks}</ul>); };
Use router for internal links.
Use router for internal links.
JSX
mit
jhh/puka-react,jhh/puka-react,jhh/puka-react
--- +++ @@ -1,18 +1,21 @@ import React from 'react'; +import { Link } from 'react-router'; const BOOKMARKS = require('json!../../assets/dev-bookmarks.json'); +const STYLE = { color: '#00b7ff' }; export const DevBookmarks = () => { const bookmarks = BOOKMARKS.map((bm, i) => { const isTag = bm.url.startsWith('/tag'); + const link = isTag + ? <Link to={bm.url} style={STYLE}>{bm.title}</Link> + : <a href={bm.url} style={STYLE} target="_blank">{bm.title}</a>; return (<li key={i}> <span style={{ color: '#bbb', paddingRight: 5 }} className={isTag ? 'octicon octicon-three-bars' : 'octicon octicon-link-external'} /> - <a href={bm.url} style={{ color: '#00b7ff' }} target={ isTag ? '_self' : '_blank'}> - {bm.title} - </a> + {link} </li>); });
1cf3b41c8020ec2dde64045973e44b9754f682db
src/containers/Root/Root.prod.jsx
src/containers/Root/Root.prod.jsx
import React from 'react' import { Provider } from 'react-redux' import { browserHistory } from 'react-router' import { syncHistoryWithStore } from 'react-router-redux' import configureStore from 'store/configureStore' import Routes from './Routes' const store = configureStore() const history = syncHistoryWithStore(browserHistory, store) export default ( <Provider store={ store }> <Routes history={ history } /> </Provider> )
import React from 'react' import { Provider } from 'react-redux' import { browserHistory } from 'react-router' import { syncHistoryWithStore } from 'react-router-redux' import configureStore from 'store/configureStore' import Routes from './Routes' const initialState = window.__INITIAL_STATE__ const store = configureStore(initialState) const history = syncHistoryWithStore(browserHistory, store) export default ( <Provider store={ store }> <Routes history={ history } /> </Provider> )
Prepare redux store to handle server-side rendering.
Prepare redux store to handle server-side rendering.
JSX
mit
ADI-Labs/calendar-web,ADI-Labs/calendar-web
--- +++ @@ -5,7 +5,8 @@ import configureStore from 'store/configureStore' import Routes from './Routes' -const store = configureStore() +const initialState = window.__INITIAL_STATE__ +const store = configureStore(initialState) const history = syncHistoryWithStore(browserHistory, store) export default (
3518273e3b7fb391ed048419926cc96bf1554dfd
styleguide_new/src/App.jsx
styleguide_new/src/App.jsx
import React from 'react' import ReactDOM from 'react-dom' import '../stylesheets/app.scss' import SideBar from './components/Sidebar' import Content from './components/Content' import ButtonStuff from '../docs/Buttons.md' import RibbonStuff from '../docs/Ribbons.md' import PanelStuff from '../docs/Panels.md' const content = { '/buttons': ButtonStuff, '/ribbons': RibbonStuff, '/panels': PanelStuff, } const homepage = <div className="content"> Make a selection on the left </div> class App extends React.Component { constructor(props) { super(props) this.state = {content: false} } updateContent(event) { event.preventDefault() window.history.pushState({}, '', event.target.href) const path = window.location.pathname if(path === "/" || !content[path]) { this.setState({content: false}) } this.setState({content: content[path]}) } render() { return <div id="app"> <SideBar clickHandler={this.updateContent.bind(this)}/> {this.state.content ? <Content content={this.state.content}/> : homepage} </div> } } ReactDOM.render(<App />, document.getElementById('root'))
import React from 'react' import ReactDOM from 'react-dom' import '../stylesheets/app.scss' import SideBar from './components/Sidebar' import Content from './components/Content' import ButtonStuff from '../docs/Buttons.md' import RibbonStuff from '../docs/Ribbons.md' import PanelStuff from '../docs/Panels.md' const content = { '/buttons': ButtonStuff, '/ribbons': RibbonStuff, '/panels': PanelStuff, } const homepage = <div className="content"> Make a selection on the left </div> class App extends React.Component { constructor(props) { super(props) this.state = {content: App.currentContent()} } updateContent(event) { event.preventDefault() window.history.pushState({}, '', event.target.href) this.setState({content: App.currentContent()}) } static currentContent() { const path = window.location.pathname if(path === "/" || !content[path]) { return false } return content[path] } render() { return <div id="app"> <SideBar clickHandler={this.updateContent.bind(this)}/> {this.state.content ? <Content content={this.state.content}/> : homepage} </div> } } ReactDOM.render(<App />, document.getElementById('root'))
Fix routing on initial load
Fix routing on initial load
JSX
mit
pivotal-cf/pivotal-ui,sjolicoeur/pivotal-ui,sjolicoeur/pivotal-ui,pivotal-cf/pivotal-ui,pivotal-cf/pivotal-ui,sjolicoeur/pivotal-ui,sjolicoeur/pivotal-ui
--- +++ @@ -22,19 +22,23 @@ class App extends React.Component { constructor(props) { super(props) - this.state = {content: false} + this.state = {content: App.currentContent()} } updateContent(event) { event.preventDefault() window.history.pushState({}, '', event.target.href) + this.setState({content: App.currentContent()}) + } + + static currentContent() { const path = window.location.pathname if(path === "/" || !content[path]) { - this.setState({content: false}) + return false } - this.setState({content: content[path]}) + return content[path] } render() {
33f4e80eb76a0bdeb8a2e043db03c060c4fae387
todo-list/todoMain.jsx
todo-list/todoMain.jsx
import React from "react"; import { createTodoList } from "./todoList/main"; import { createTodoForm } from "./todoForm/main"; import meiosisTracer from "meiosis-tracer"; export default function(Meiosis) { const createComponent = Meiosis.createComponent; const TodoList = createTodoList(createComponent); const TodoForm = createTodoForm(createComponent); const TodoMain = createComponent({ view: model => ( <div> <div id="tracer"></div> <TodoForm {...model}/> <TodoList {...model}/> </div> ) }); const renderRoot = Meiosis.run(TodoMain); meiosisTracer(createComponent, renderRoot, "tracer"); }
import React from "react"; import { createTodoList } from "./todoList/main"; import { createTodoForm } from "./todoForm/main"; import meiosisTracer from "meiosis-tracer"; export default function(Meiosis) { const createComponent = Meiosis.createComponent; const TodoList = createTodoList(createComponent); const TodoForm = createTodoForm(createComponent); const TodoMain = createComponent({ view: model => ( <div> <div id="tracer"></div> <TodoForm {...model}/> <TodoList {...model}/> </div> ) }); const renderRoot = Meiosis.run(TodoMain); meiosisTracer(createComponent, renderRoot, "#tracer"); }
Use selector instead of id for meiosis-tracer.
Use selector instead of id for meiosis-tracer.
JSX
mit
foxdonut/meiosis-examples,foxdonut/meiosis-examples
--- +++ @@ -19,5 +19,5 @@ ) }); const renderRoot = Meiosis.run(TodoMain); - meiosisTracer(createComponent, renderRoot, "tracer"); + meiosisTracer(createComponent, renderRoot, "#tracer"); }
239fc296a53bafce25ce0050dac4055fa27d3e73
features/apimgt/org.wso2.carbon.apimgt.store.feature/src/main/resources/devportal/source/src/app/components/Apis/Details/ApiConsole/SwaggerUI.jsx
features/apimgt/org.wso2.carbon.apimgt.store.feature/src/main/resources/devportal/source/src/app/components/Apis/Details/ApiConsole/SwaggerUI.jsx
import React from 'react'; import PropTypes from 'prop-types'; import 'swagger-ui/dist/swagger-ui.css'; import SwaggerUILib from './PatchedSwaggerUIReact'; const disableAuthorizeAndInfoPlugin = function () { return { wrapComponents: { info: () => () => null, }, }; }; /** * * @class SwaggerUI * @extends {Component} */ const SwaggerUI = (props) => { const { spec, accessTokenProvider, authorizationHeader, api } = props; const componentProps = { spec, validatorUrl: null, docExpansion: 'list', defaultModelsExpandDepth: 0, requestInterceptor: (req) => { const { url } = req; const patternToCheck = api.context + '/*'; req.headers[authorizationHeader] = 'Bearer ' + accessTokenProvider(); if (url.endsWith(patternToCheck)) { req.url = url.substring(0, url.length - 2); } else if (url.includes('/*?')) { const splitTokens = url.split('/*?'); req.url = splitTokens.length > 1 ? splitTokens[0] + '?' + splitTokens[1] : splitTokens[0]; } return req; }, presets: [disableAuthorizeAndInfoPlugin], plugins: null, }; return <SwaggerUILib {...componentProps} />; }; SwaggerUI.propTypes = { spec: PropTypes.shape({}).isRequired, }; export default SwaggerUI;
import React from 'react'; import PropTypes from 'prop-types'; import 'swagger-ui/dist/swagger-ui.css'; import SwaggerUILib from './PatchedSwaggerUIReact'; const disableAuthorizeAndInfoPlugin = function () { return { wrapComponents: { info: () => () => null, }, }; }; /** * * @class SwaggerUI * @extends {Component} */ const SwaggerUI = (props) => { const { spec, accessTokenProvider, authorizationHeader, api } = props; const componentProps = { spec, validatorUrl: null, docExpansion: 'list', defaultModelsExpandDepth: 0, requestInterceptor: (req) => { const { url } = req; const patternToCheck = api.context + '/*'; req.headers[authorizationHeader] = 'Bearer ' + accessTokenProvider(); if (url.endsWith(patternToCheck)) { req.url = url.substring(0, url.length - 2); } else if (url.includes(patternToCheck + '?')) { // Check for query parameters. const splitTokens = url.split('/*?'); req.url = splitTokens.length > 1 ? splitTokens[0] + '?' + splitTokens[1] : splitTokens[0]; } return req; }, presets: [disableAuthorizeAndInfoPlugin], plugins: null, }; return <SwaggerUILib {...componentProps} />; }; SwaggerUI.propTypes = { spec: PropTypes.shape({}).isRequired, }; export default SwaggerUI;
Change query params in swagger console
Change query params in swagger console
JSX
apache-2.0
uvindra/carbon-apimgt,bhathiya/carbon-apimgt,harsha89/carbon-apimgt,chamindias/carbon-apimgt,praminda/carbon-apimgt,nuwand/carbon-apimgt,fazlan-nazeem/carbon-apimgt,nuwand/carbon-apimgt,praminda/carbon-apimgt,harsha89/carbon-apimgt,chamilaadhi/carbon-apimgt,isharac/carbon-apimgt,jaadds/carbon-apimgt,praminda/carbon-apimgt,tharikaGitHub/carbon-apimgt,nuwand/carbon-apimgt,jaadds/carbon-apimgt,harsha89/carbon-apimgt,malinthaprasan/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,Rajith90/carbon-apimgt,tharindu1st/carbon-apimgt,Rajith90/carbon-apimgt,tharindu1st/carbon-apimgt,bhathiya/carbon-apimgt,prasa7/carbon-apimgt,bhathiya/carbon-apimgt,bhathiya/carbon-apimgt,prasa7/carbon-apimgt,ruks/carbon-apimgt,jaadds/carbon-apimgt,harsha89/carbon-apimgt,prasa7/carbon-apimgt,tharindu1st/carbon-apimgt,chamilaadhi/carbon-apimgt,chamindias/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,ruks/carbon-apimgt,tharikaGitHub/carbon-apimgt,wso2/carbon-apimgt,fazlan-nazeem/carbon-apimgt,uvindra/carbon-apimgt,wso2/carbon-apimgt,uvindra/carbon-apimgt,isharac/carbon-apimgt,prasa7/carbon-apimgt,isharac/carbon-apimgt,chamilaadhi/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,fazlan-nazeem/carbon-apimgt,jaadds/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,nuwand/carbon-apimgt,malinthaprasan/carbon-apimgt,wso2/carbon-apimgt,malinthaprasan/carbon-apimgt,chamindias/carbon-apimgt,uvindra/carbon-apimgt,ruks/carbon-apimgt,malinthaprasan/carbon-apimgt,Rajith90/carbon-apimgt,fazlan-nazeem/carbon-apimgt,tharikaGitHub/carbon-apimgt,wso2/carbon-apimgt,chamilaadhi/carbon-apimgt,tharindu1st/carbon-apimgt,ruks/carbon-apimgt,tharikaGitHub/carbon-apimgt,chamindias/carbon-apimgt,Rajith90/carbon-apimgt,isharac/carbon-apimgt
--- +++ @@ -29,7 +29,7 @@ req.headers[authorizationHeader] = 'Bearer ' + accessTokenProvider(); if (url.endsWith(patternToCheck)) { req.url = url.substring(0, url.length - 2); - } else if (url.includes('/*?')) { + } else if (url.includes(patternToCheck + '?')) { // Check for query parameters. const splitTokens = url.split('/*?'); req.url = splitTokens.length > 1 ? splitTokens[0] + '?' + splitTokens[1] : splitTokens[0]; }
f5018c77bfaeae64d28797c948d24a052fbbe92b
components/button-stateful/__examples__/icon.jsx
components/button-stateful/__examples__/icon.jsx
import React from 'react'; import createReactClass from 'create-react-class'; import IconSettings from '~/components/icon-settings'; import ButtonStateful from '~/components/button-stateful'; // `~` is replaced with design-system-react at runtime const Example = createReactClass({ displayName: 'ButtonStatefulExample', render () { return ( <IconSettings iconPath="/assets/icons"> <ButtonStateful assistiveText="like" iconName="like" iconSize="large" variant="icon" /> </IconSettings> ); }, }); export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
import React from 'react'; import createReactClass from 'create-react-class'; import IconSettings from '~/components/icon-settings'; import ButtonStateful from '~/components/button-stateful'; // `~` is replaced with design-system-react at runtime const Example = createReactClass({ displayName: 'ButtonStatefulExample', getInitialState () { return { isActive: false }; }, handleOnclick () { this.setState({ isActive: !this.state.isActive }); }, render () { return ( <IconSettings iconPath="/assets/icons"> <ButtonStateful assistiveText={this.state.isActive ? 'liked' : 'not liked'} iconName="like" iconSize="large" variant="icon" /> </IconSettings> ); }, }); export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
Fix stateful button example asst text
Fix stateful button example asst text
JSX
bsd-3-clause
salesforce/design-system-react,salesforce/design-system-react,salesforce/design-system-react
--- +++ @@ -6,11 +6,23 @@ const Example = createReactClass({ displayName: 'ButtonStatefulExample', + getInitialState () { + return { + isActive: false + }; + }, + + handleOnclick () { + this.setState({ + isActive: !this.state.isActive + }); + }, + render () { return ( <IconSettings iconPath="/assets/icons"> <ButtonStateful - assistiveText="like" + assistiveText={this.state.isActive ? 'liked' : 'not liked'} iconName="like" iconSize="large" variant="icon"
6057b8e40a9a7b5f8d91bee4d45ce14492c21ce6
client/components/game/game.jsx
client/components/game/game.jsx
import React, { Component } from 'react'; import { Message } from 'semantic-ui-react'; import GamestateComp from '../imports/gamestate-comp'; Game = class Game extends Component { render() { if (this.props.gamestate.gameplay) { this._renderMain(); } else { return <Message info header='Game Not Running' content='Indication Gameplay is Currently Off' /> } } _renderMain() { return ( <GameAccess /> ); } } Game = GamestateComp(Game);
import React, { Component, PropTypes } from 'react'; import { Container, Message } from 'semantic-ui-react'; import GamestateComp from '../imports/gamestate-comp'; import moment from 'moment'; class GameInner extends Component { render() { return ( <Container> <PuzzlePageTitle title='The Game'/> { this._renderMain() } </Container> ); } _renderMain() { const { ready, gamestate } = this.props; const timeToStart = moment('2017-04-01T10:00:00-07:00').fromNow(); if (!ready) { return <Loading/> } else if (!gamestate.gameplay) { return <Message info header='The Hunt has not started yet!' content={`The Hunt will begin ${timeToStart}`} /> } return ( <div>Game ON!</div> ); } } GameInner.propTypes = { ready: PropTypes.bool.isRequired, gamestate: PropTypes.object, }; Game = GamestateComp(GameInner);
Add countdown to the hunt on Game page
Add countdown to the hunt on Game page
JSX
mit
kyle-rader/greatpuzzlehunt,kyle-rader/greatpuzzlehunt,kyle-rader/greatpuzzlehunt
--- +++ @@ -1,27 +1,40 @@ -import React, { Component } from 'react'; -import { Message } from 'semantic-ui-react'; +import React, { Component, PropTypes } from 'react'; +import { Container, Message } from 'semantic-ui-react'; import GamestateComp from '../imports/gamestate-comp'; +import moment from 'moment'; -Game = class Game extends Component { +class GameInner extends Component { render() { - if (this.props.gamestate.gameplay) { - this._renderMain(); - } - else { - return <Message - info - header='Game Not Running' - content='Indication Gameplay is Currently Off' - /> - } + return ( + <Container> + <PuzzlePageTitle title='The Game'/> + { this._renderMain() } + </Container> + ); } _renderMain() { + const { ready, gamestate } = this.props; + const timeToStart = moment('2017-04-01T10:00:00-07:00').fromNow(); + if (!ready) { + return <Loading/> + } + else if (!gamestate.gameplay) { + return <Message + info + header='The Hunt has not started yet!' + content={`The Hunt will begin ${timeToStart}`} + /> + } return ( - <GameAccess /> + <div>Game ON!</div> ); } - } -Game = GamestateComp(Game); +GameInner.propTypes = { + ready: PropTypes.bool.isRequired, + gamestate: PropTypes.object, +}; + +Game = GamestateComp(GameInner);
020b2c6d200688377eeeb22e899c06763c301235
src/components/mdc/icon-button.jsx
src/components/mdc/icon-button.jsx
// @flow import {h} from 'preact' import MaterialComponent from 'preact-material-components/MaterialComponent' import style from './icon-button.css' export type IconButtonProps = { icon: React$Element<any>, onClick: ?() => void } export class IconButton extends MaterialComponent { props: IconButtonProps control: HTMLElement static defaultProps = { ripple: true } componentDidMount() { this.attachRipple() } render() { const {onClick} = this.props const className = `mdc-ripple-surface ${style.iconButton}` return ( <div ref={control => (this.control = control)} className={className} onClick={onClick}> {this.props.icon} </div> ) } }
// @flow import {h} from 'preact' import MaterialComponent from 'preact-material-components/MaterialComponent' import style from './icon-button.css' export type IconButtonProps = { icon: React$Element<any>, onClick?: () => void } export class IconButton extends MaterialComponent { props: IconButtonProps control: HTMLElement static defaultProps = { ripple: true } componentDidMount() { this.attachRipple() } render() { const {onClick} = this.props const className = `mdc-ripple-surface ${style.iconButton}` return ( <div ref={control => (this.control = control)} className={className} onClick={onClick}> {this.props.icon} </div> ) } }
Mark onClick handler on icon button as optional
Mark onClick handler on icon button as optional
JSX
mit
Holi0317/bridge-calc,Holi0317/bridge-calc,Holi0317/bridge-calc
--- +++ @@ -5,7 +5,7 @@ export type IconButtonProps = { icon: React$Element<any>, - onClick: ?() => void + onClick?: () => void } export class IconButton extends MaterialComponent {
99974d4023467126c626a36c4ae4cbc82d4d7e9e
src/js/components/login/Username.jsx
src/js/components/login/Username.jsx
/** * Username.jsx * Created by Kyle Fox 2/19/16 **/ import React, { PropTypes } from 'react'; import * as Icons from '../SharedComponents/icons/Icons.jsx'; const propTypes = { handleChange: PropTypes.func.isRequired }; const defaultProps = { tabIndex: "1" } export default class Username extends React.Component { render() { return ( <div className="usa-da-input-container"> <label className="sr-only" htmlFor="username">Username or email address</label> <input className="usa-da-input-with-icon" id="username" name="username" type="text" placeholder="Username" aria-describedby="username" onChange={this.props.handleChange} tabIndex={this.props.tabIndex} /> <span className="usa-da-icon"> <Icons.User /> </span> </div> ); } } Username.defaultProps = defaultProps; Username.propTypes = propTypes;
/** * Username.jsx * Created by Kyle Fox 2/19/16 **/ import React, { PropTypes } from 'react'; import * as Icons from '../SharedComponents/icons/Icons.jsx'; const propTypes = { handleChange: PropTypes.func.isRequired }; const defaultProps = { tabIndex: "1" } export default class Username extends React.Component { render() { return ( <div className="usa-da-input-container"> <label className="sr-only" htmlFor="username">Username or email address</label> <input className="usa-da-input-with-icon" id="username" name="username" type="text" placeholder="Email Address" aria-describedby="username" onChange={this.props.handleChange} tabIndex={this.props.tabIndex} /> <span className="usa-da-icon"> <Icons.User /> </span> </div> ); } } Username.defaultProps = defaultProps; Username.propTypes = propTypes;
Change username to email address
Change username to email address
JSX
cc0-1.0
fedspendingtransparency/data-act-broker-web-app,fedspendingtransparency/data-act-broker-web-app
--- +++ @@ -24,7 +24,7 @@ id="username" name="username" type="text" - placeholder="Username" + placeholder="Email Address" aria-describedby="username" onChange={this.props.handleChange} tabIndex={this.props.tabIndex}
62c35c89d7bd2cfacc05d4e04f85057fb740adb1
client/src/components/yes-no-field.jsx
client/src/components/yes-no-field.jsx
import React from 'react'; import Input from 'react-bootstrap/lib/Input'; import QuestionContainer from './question-container.jsx'; export default React.createClass({ commitChange: function(e) { if ( this.props.onChange ) { this.props.onChange(this.props.fieldName, e); var clearIf = this.props.clearIf; if ( !clearIf ) { return; } if ( clearIf.isNot ) { for ( var i = 0; i < clearIf.fields.length; i++ ) { var field = clearIf.fields[i]; if ( this.props.data[field] !== clearIf.isNot ) { this.props.onChange(field, ""); } } } } }, render: function() { return ( <div className="form-group"> <label className="control-label"> {this.props.label} </label> <div> <label className="radio-inline"> <input onChange={this.commitChange} checked={this.props.value === "true"} type="radio" name={this.props.fieldName} ref={this.props.fieldName} value="true">Yes</input> </label> <label className="radio-inline"> <input onChange={this.commitChange} checked={this.props.value !== "true"} type="radio" name={this.props.fieldName} ref={this.props.fieldName} value="false">No</input> </label> </div> </div> ); } });
import React from 'react'; import Input from 'react-bootstrap/lib/Input'; import QuestionContainer from './question-container.jsx'; export default React.createClass({ commitChange: function(e) { if ( this.props.onChange ) { this.props.onChange(this.props.fieldName, e); var clearIf = this.props.clearIf; if ( !clearIf ) { return; } if ( clearIf.isNot ) { for ( var i = 0; i < clearIf.fields.length; i++ ) { var field = clearIf.fields[i]; if ( this.props.data[field] !== clearIf.isNot ) { this.props.onChange(field, ""); } } } } }, render: function() { return ( <div className="form-group"> <label className="control-label"> {this.props.label} </label> <div> <label className="radio-inline"> <input onChange={this.commitChange} checked={this.props.value === "true"} type="radio" name={this.props.fieldName} ref={this.props.fieldName} value="true" />Yes </label> <label className="radio-inline"> <input onChange={this.commitChange} checked={this.props.value !== "true"} type="radio" name={this.props.fieldName} ref={this.props.fieldName} value="false" />No </label> </div> </div> ); } });
Remove closing input tags from radio buttons in Yes No field
Remove closing input tags from radio buttons in Yes No field
JSX
agpl-3.0
mi-squared/volunteer-portal,mi-squared/volunteer-portal,mi-squared/volunteer-portal
--- +++ @@ -36,12 +36,12 @@ <label className="radio-inline"> <input onChange={this.commitChange} checked={this.props.value === "true"} - type="radio" name={this.props.fieldName} ref={this.props.fieldName} value="true">Yes</input> + type="radio" name={this.props.fieldName} ref={this.props.fieldName} value="true" />Yes </label> <label className="radio-inline"> <input onChange={this.commitChange} checked={this.props.value !== "true"} - type="radio" name={this.props.fieldName} ref={this.props.fieldName} value="false">No</input> + type="radio" name={this.props.fieldName} ref={this.props.fieldName} value="false" />No </label> </div> </div>
5cca2163f2939ff5ec3eec87b025730e83b7d1bd
src/path.jsx
src/path.jsx
export function normalize(path) { let source = path.split(/\/+/) let target = [] for(let token of source) { if(token === '..') { target.pop() } else if(token !== '' && token !== '.') { target.push(token) } } if(path.charAt(0) === '/') return '/' + target.join('/') else return target.join('/') }
export function normalize(path) { let source = path.split(/\/+/) let target = [] for(let token of source) { if(token === '..') { target.pop() } else if(token !== '' && token !== '.') { target.push(token) } } if(path.charAt(0) === '/') return '/' + target.join('/') else return target.join('/') } export function join(a, b) { return normalize(a + '/' + b) }
Add VT100 terminal emulator + minimal shell + simple cat command
Add VT100 terminal emulator + minimal shell + simple cat command
JSX
mit
LivelyKernel/lively4-core,LivelyKernel/lively4-core
--- +++ @@ -16,3 +16,7 @@ else return target.join('/') } + +export function join(a, b) { + return normalize(a + '/' + b) +}
8026c98bf474f5b19245d08ca007a20712c80fcf
src/app/components/elements/SteemMarket.jsx
src/app/components/elements/SteemMarket.jsx
import React, { Component } from 'react'; import { connect } from 'react-redux'; class SteemMarket extends Component { render() { const steemMarketData = this.props.steemMarketData; const timepoints = steemMarketData.get('timepoints'); const topCoins = steemMarketData.get('top_coins'); const steem = steemMarketData.get('steem'); const sbd = steemMarketData.get('sbd'); return ( <div className="steem-market"> <ul> <li>{`STEEM ${steem.getIn([0, 'price_usd'])}`}</li> <li>{`SBD ${steem.getIn([0, 'price_usd'])}`}</li> {topCoins.map(coin => { const name = coin.get('name'); const priceUsd = coin.get('price_usd'); return <li key={name}>{`${name} ${priceUsd}`}</li>; })} </ul> </div> ); } } export default connect( // mapStateToProps (state, ownProps) => { const steemMarketData = state.app.get('steemMarket'); return { ...ownProps, steemMarketData, }; }, // mapDispatchToProps dispatch => ({}) )(SteemMarket);
import React, { Component } from 'react'; import { connect } from 'react-redux'; class SteemMarket extends Component { render() { const steemMarketData = this.props.steemMarketData; const topCoins = steemMarketData.get('top_coins'); const steem = steemMarketData.get('steem'); const sbd = steemMarketData.get('sbd'); return ( <div className="steem-market"> <ul> <li>{`STEEM ${steem.getIn([ 'timepoints', 0, 'price_usd', ])}`}</li> <li>{`SBD ${steem.getIn([ 'timepoints', 0, 'price_usd', ])}`}</li> {topCoins.map(coin => { const name = coin.get('name'); const priceUsd = coin.getIn([ 'timepoints', 0, 'price_usd', ]); return <li key={name}>{`${name} ${priceUsd}`}</li>; })} </ul> </div> ); } } export default connect( // mapStateToProps (state, ownProps) => { const steemMarketData = state.app.get('steemMarket'); return { ...ownProps, steemMarketData, }; }, // mapDispatchToProps dispatch => ({}) )(SteemMarket);
Use updated API response structure
Use updated API response structure
JSX
mit
TimCliff/steemit.com,TimCliff/steemit.com,steemit/steemit.com,steemit/steemit.com,TimCliff/steemit.com,steemit/steemit.com
--- +++ @@ -4,7 +4,6 @@ class SteemMarket extends Component { render() { const steemMarketData = this.props.steemMarketData; - const timepoints = steemMarketData.get('timepoints'); const topCoins = steemMarketData.get('top_coins'); const steem = steemMarketData.get('steem'); const sbd = steemMarketData.get('sbd'); @@ -12,11 +11,23 @@ return ( <div className="steem-market"> <ul> - <li>{`STEEM ${steem.getIn([0, 'price_usd'])}`}</li> - <li>{`SBD ${steem.getIn([0, 'price_usd'])}`}</li> + <li>{`STEEM ${steem.getIn([ + 'timepoints', + 0, + 'price_usd', + ])}`}</li> + <li>{`SBD ${steem.getIn([ + 'timepoints', + 0, + 'price_usd', + ])}`}</li> {topCoins.map(coin => { const name = coin.get('name'); - const priceUsd = coin.get('price_usd'); + const priceUsd = coin.getIn([ + 'timepoints', + 0, + 'price_usd', + ]); return <li key={name}>{`${name} ${priceUsd}`}</li>; })} </ul>
a432c9bfca0c0c02723af34c1e95fe9f86264ddd
src/client/scripts/components/home/home.jsx
src/client/scripts/components/home/home.jsx
import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import PlacesAutocomplete, { geocodeByAddress } from 'react-places-autocomplete'; class Home extends Component { constructor(props) { super(props); this.state = { address: '', lat: '', lng: '', }; this.handleSubmit = this.handleSubmit.bind(this); this.handleChange = this.handleChange.bind(this); } render() { return ( <div> <h2> Where are you going ?</h2> <form onSubmit={this.handleSubmit}> <PlacesAutocomplete value={this.state.address} onChange={this.handleChange} /> <button type="submit">Search</button> </form> </div> ); } handleChange(e) { this.setState({ address: e }); } handleSubmit(event) { event.preventDefault(); console.log(PlacesAutocomplete); geocodeByAddress(this.state.address, (err, res) => { if (err) { console.log('Oh no!', err); } console.log(res); this.setState({ lat: res.lat, lng: res.lng, }); console.log(this.state); }); this.setState({ address: '' }); } } ReactDOM.render(<Home />, document.getElementById('home'));
import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import PlacesAutocomplete, { geocodeByAddress } from 'react-places-autocomplete'; class Home extends Component { constructor(props) { super(props); this.state = { address: '', lat: '', lng: '', }; this.handleSubmit = this.handleSubmit.bind(this); this.handleChange = this.handleChange.bind(this); } render() { return ( <div> <h2> Where are you going ?</h2> <form onSubmit={this.handleSubmit}> <PlacesAutocomplete value={this.state.address} onChange={this.handleChange} /> <button type="submit">Search</button> </form> </div> ); } handleChange(e) { this.setState({ address: e }); } handleSubmit(event) { event.preventDefault(); geocodeByAddress(this.state.address, (err, res) => { if (err) { console.log('Oh no! Error: ', err); } this.setState({ lat: res.lat, lng: res.lng, }); console.log(this.state); }); this.setState({ address: '' }); } } ReactDOM.render(<Home />, document.getElementById('home'));
Remove extra console.logs; clarify error statement
Remove extra console.logs; clarify error statement
JSX
mit
theredspoon/trip-raptor,Tropical-Raptor/trip-raptor
--- +++ @@ -35,12 +35,10 @@ handleSubmit(event) { event.preventDefault(); - console.log(PlacesAutocomplete); geocodeByAddress(this.state.address, (err, res) => { if (err) { - console.log('Oh no!', err); + console.log('Oh no! Error: ', err); } - console.log(res); this.setState({ lat: res.lat, lng: res.lng,
9bcb7bd0ad57beb5b1c60ff90cb914090443496c
frontend/src/component/strategies/list-component.jsx
frontend/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,Unleash/unleash,Unleash/unleash,Unleash/unleash
--- +++ @@ -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> );
3e3185cd0f49c31c15411269b1e1ea7fe235a045
imports/ui/components/StudyPlan.jsx
imports/ui/components/StudyPlan.jsx
import React from 'react'; import SignIn from './SignIn2' import TabbedContainer from './common/TabbedContainer'; import BasicTable from './common/BasicTable'; /*export default function StudyPlan() { return ( <div className="page-content"> <div className="container-fluid"> <div className="col-xxl-3 col-md-6"> Study Plan </div> </div> </div> ); }*/ export default class StudyPlan extends React.Component { render() { // in here, will need to call list of planner ids from accounts // from list of planner ids, loop and call getPlanner to get an array of planner objects // for each planner object, create a 'basic table' tab that will input the necessay inputs (such as semesters) into the table // do loop and for each do a push <BasicTable /> component into the array var contentPanelsList = [<BasicTable />]; // basic table will need input of basic information using props return ( <TabbedContainer tabTitleList={["Plan A", "Plan B", "Plan C"]} contentPanelsList={contentPanelsList}/> ); } }
import React from 'react'; import SignIn from './SignIn2' import TabbedContainer from './common/TabbedContainer'; import BasicTable from './common/BasicTable'; /*export default function StudyPlan() { return ( <div className="page-content"> <div className="container-fluid"> <div className="col-xxl-3 col-md-6"> Study Plan </div> </div> </div> ); }*/ export default class StudyPlan extends React.Component { render() { // in here, will need to call list of planner ids from accounts // without accounts done, just return an empty id array // from list of planner ids, loop and call getPlanner to get an array of planner objects // for each planner object, create a 'basic table' tab that will input the necessay inputs (such as semesters) into the table // do loop and for each do a push <BasicTable /> component into the array var contentPanelsList = [<BasicTable />]; // basic table will need input of basic information using props // tab list will contain the string name of planner return ( <TabbedContainer tabTitleList={["Plan A", "Plan B"]} contentPanelsList={contentPanelsList}/> ); } }
ADD instructions on how to integrate study plan with ui
ADD instructions on how to integrate study plan with ui
JSX
mit
nus-mtp/nus-oracle,nus-mtp/nus-oracle
--- +++ @@ -18,6 +18,7 @@ export default class StudyPlan extends React.Component { render() { // in here, will need to call list of planner ids from accounts + // without accounts done, just return an empty id array // from list of planner ids, loop and call getPlanner to get an array of planner objects @@ -27,8 +28,10 @@ var contentPanelsList = [<BasicTable />]; // basic table will need input of basic information using props + // tab list will contain the string name of planner + return ( - <TabbedContainer tabTitleList={["Plan A", "Plan B", "Plan C"]} + <TabbedContainer tabTitleList={["Plan A", "Plan B"]} contentPanelsList={contentPanelsList}/> ); }
efaede0eae24ea839c2744aec34b4ea9f05ae4cb
src/apps/company-lists/client/CreateListFormSection.jsx
src/apps/company-lists/client/CreateListFormSection.jsx
/* eslint-disable */ import React from 'react' import axios from 'axios' import { CreateListForm } from 'data-hub-components' const CreateListFormSection = ( { id, csrfToken, name, hint, label, cancelUrl, maxLength, }) => { async function onCreateList (listName) { await axios({ method: 'POST', url: `/companies/${id}/lists/create?_csrf=${csrfToken}`, data: { name: listName }, }) return cancelUrl } return ( <CreateListForm name={name} hint={hint} label={label} cancelUrl={cancelUrl} maxLength={maxLength} onSubmitHandler={onCreateList} /> ) } export default CreateListFormSection
/* eslint-disable */ import React from 'react' import axios from 'axios' import { CreateListForm } from 'data-hub-components' const CreateListFormSection = ( { id, csrfToken, name, hint, label, cancelUrl, maxLength, }) => { async function onCreateList ({listName}) { await axios({ method: 'POST', url: `/companies/${id}/lists/create?_csrf=${csrfToken}`, data: { name: listName }, }) return cancelUrl } return ( <CreateListForm name={name} hint={hint} label={label} cancelUrl={cancelUrl} maxLength={maxLength} onSubmitHandler={onCreateList} /> ) } export default CreateListFormSection
Replace deconstructed prop for post value
Replace deconstructed prop for post value
JSX
mit
uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2
--- +++ @@ -15,7 +15,7 @@ maxLength, }) => { - async function onCreateList (listName) { + async function onCreateList ({listName}) { await axios({ method: 'POST', url: `/companies/${id}/lists/create?_csrf=${csrfToken}`,
533c02b690865a89d209800bec7a8b6d8dea12a3
src/js/util/getLoginUrl.jsx
src/js/util/getLoginUrl.jsx
import qs from "qs"; import join from "url-join"; export default function getLoginUrl({API_URL, CLIENT_ID, redirect_uri = window.location.href, response_type = 'token'}) { return `${join(API_URL, 'authorize')}` + `?${qs.stringify({client_id: CLIENT_ID, redirect_uri, response_type: 'token'})}`; }
import qs from "qs"; import join from "url-join"; export default function getLoginUrl({API_URL, CLIENT_ID, redirect_uri = window.location.href, response_type = 'token'}) { return `${join(API_URL, 'authorize')}` + `?${qs.stringify({client_id: CLIENT_ID, redirect_uri, response_type})}`; }
Use passed in response type
Use passed in response type
JSX
mit
moodysalem/o2fe,moodysalem/o2fe
--- +++ @@ -3,5 +3,5 @@ export default function getLoginUrl({API_URL, CLIENT_ID, redirect_uri = window.location.href, response_type = 'token'}) { return `${join(API_URL, 'authorize')}` + - `?${qs.stringify({client_id: CLIENT_ID, redirect_uri, response_type: 'token'})}`; + `?${qs.stringify({client_id: CLIENT_ID, redirect_uri, response_type})}`; }
306c1119faf97a2ce4a81b48134fe945c93f746f
app/assets/javascripts/components/news_feed/news_feed_item_post.js.jsx
app/assets/javascripts/components/news_feed/news_feed_item_post.js.jsx
var Markdown = require('../markdown.js.jsx'); var NewsFeedItemModalMixin = require('../../mixins/news_feed_item_modal_mixin'); module.exports = React.createClass({ displayName: 'NewsFeedItemPost', propTypes: { title: React.PropTypes.string.isRequired, body: React.PropTypes.string.isRequired, url: React.PropTypes.string.isRequired }, mixins: [NewsFeedItemModalMixin], render: function() { var target = this.props.target; return ( <a className="block mt0 mb3" href={this.props.url} onClick={this.handleClick}> <div className="p3"> <div className="h3 mt0 mb1">{this.props.title}</div> {this.renderSummary()} <div className="mt3 gray-darker" style={{ fontSize: 16 }}> <Markdown content={this.props.body} normalized={true} /> </div> </div> </a> ); }, renderSummary: function() { if (this.props.target && this.props.target.summary) { return ( <div className="gray"> <Markdown content={this.props.target.summary} normalized={true} /> </div> ); } } });
var Markdown = require('../markdown.js.jsx'); var NewsFeedItemModalMixin = require('../../mixins/news_feed_item_modal_mixin'); module.exports = React.createClass({ displayName: 'NewsFeedItemPost', propTypes: { title: React.PropTypes.string.isRequired, body: React.PropTypes.string.isRequired, url: React.PropTypes.string.isRequired }, mixins: [NewsFeedItemModalMixin], render: function() { var target = this.props.target; return ( <div className="p3 clickable" onClick={this.handleClick}> <a className="h3 block mt0 mb1 black" href={this.props.url}>{this.props.title}</a> {this.renderSummary()} <div className="mt3 gray-darker" style={{ fontSize: 16 }}> <Markdown content={this.props.body} normalized={true} /> </div> </div> ); }, renderSummary: function() { if (this.props.target && this.props.target.summary) { return ( <div className="gray"> <Markdown content={this.props.target.summary} normalized={true} /> </div> ); } } });
Make nfi posts look like bounty posts
Make nfi posts look like bounty posts
JSX
agpl-3.0
assemblymade/meta,assemblymade/meta,lachlanjc/meta,assemblymade/meta,assemblymade/meta,lachlanjc/meta,lachlanjc/meta,lachlanjc/meta
--- +++ @@ -16,16 +16,14 @@ var target = this.props.target; return ( - <a className="block mt0 mb3" href={this.props.url} onClick={this.handleClick}> - <div className="p3"> - <div className="h3 mt0 mb1">{this.props.title}</div> - {this.renderSummary()} + <div className="p3 clickable" onClick={this.handleClick}> + <a className="h3 block mt0 mb1 black" href={this.props.url}>{this.props.title}</a> + {this.renderSummary()} - <div className="mt3 gray-darker" style={{ fontSize: 16 }}> - <Markdown content={this.props.body} normalized={true} /> - </div> + <div className="mt3 gray-darker" style={{ fontSize: 16 }}> + <Markdown content={this.props.body} normalized={true} /> </div> - </a> + </div> ); },
631a3f2ac8ac1228489383fd8397b5f53f348754
src/components/Session/SessionContent/Send/SendSuccess/SendSuccess.jsx
src/components/Session/SessionContent/Send/SendSuccess/SendSuccess.jsx
import React from 'react'; import PropTypes from 'prop-types'; import Driver from '../../../../../lib/Driver'; export default function SendSuccess(props) { const { txId, handlers } = props.d.send; const { serverUrl } = props.d.Server; const resultMessage = !props.awaitSiners ? (<p> Transaction ID:{' '} <a target="_blank" rel="noopener noreferrer" href={`${serverUrl}/transactions/${txId}`}> {txId} </a> <br /> Keep the transaction ID as proof of payment. </p>) : (<p> Transaction successfully created and signed by your key! Await signers! </p>); return ( <div className="island"> <div className="island__header">Send Payment</div> <h3 className="Send__resultTitle">Success!</h3> <div className="Send__resultContent"> {resultMessage} </div> <button className="s-button Send__startOver" onClick={handlers.reset}> Start over </button> </div> ); } SendSuccess.propTypes = { d: PropTypes.instanceOf(Driver).isRequired, awaitSiners: PropTypes.bool, };
import React from 'react'; import PropTypes from 'prop-types'; import Driver from '../../../../../lib/Driver'; export default function SendSuccess(props) { const { txId, handlers } = props.d.send; const { serverUrl } = props.d.Server; const resultMessage = !props.awaitSiners ? (<p> Transaction ID:{' '} <a target="_blank" rel="noopener noreferrer" href={`${serverUrl}/transactions/${txId}`}> {txId} </a> <br /> Keep the transaction ID as proof of payment. </p>) : (<p> Transaction was signed with your key. Add additional signatures and submit to the network. </p>); return ( <div className="island"> <div className="island__header">Send Payment</div> <h3 className="Send__resultTitle">Success!</h3> <div className="Send__resultContent"> {resultMessage} </div> <button className="s-button Send__startOver" onClick={handlers.reset}> Start over </button> </div> ); } SendSuccess.propTypes = { d: PropTypes.instanceOf(Driver).isRequired, awaitSiners: PropTypes.bool, };
Update message for missing signatures for new tx
Update message for missing signatures for new tx
JSX
apache-2.0
irisli/stellarterm,irisli/stellarterm,irisli/stellarterm
--- +++ @@ -16,7 +16,7 @@ Keep the transaction ID as proof of payment. </p>) : (<p> - Transaction successfully created and signed by your key! Await signers! + Transaction was signed with your key. Add additional signatures and submit to the network. </p>); return (
475abc178f9f409aa7281420daab1860d058f9a8
src/components/question/question.jsx
src/components/question/question.jsx
import PropTypes from 'prop-types'; import React from 'react'; import styles from './question.css'; import Input from '../forms/input.jsx'; const QuestionComponent = props => { const { answer, question, onChange, onClick, onKeyPress } = props; return ( <div className={styles.questionWrapper}> <div className={styles.questionContainer}> {question ? ( <div className={styles.questionLabel}>{question}</div> ) : null} <div className={styles.questionInput}> <Input autoFocus value={answer} onChange={onChange} onKeyPress={onKeyPress} /> <button className={styles.questionSubmitButton} onClick={onClick} > {'✔︎' /* @todo should this be an image? */} </button> </div> </div> </div> ); }; QuestionComponent.propTypes = { answer: PropTypes.string, onChange: PropTypes.func.isRequired, onClick: PropTypes.func.isRequired, onKeyPress: PropTypes.func.isRequired, question: PropTypes.string }; export default QuestionComponent;
import PropTypes from 'prop-types'; import React from 'react'; import styles from './question.css'; import Input from '../forms/input.jsx'; import enterIcon from './icon--enter.svg'; const QuestionComponent = props => { const { answer, question, onChange, onClick, onKeyPress } = props; return ( <div className={styles.questionWrapper}> <div className={styles.questionContainer}> {question ? ( <div className={styles.questionLabel}>{question}</div> ) : null} <div className={styles.questionInput}> <Input autoFocus value={answer} onChange={onChange} onKeyPress={onKeyPress} /> <button className={styles.questionSubmitButton} onClick={onClick} > <img draggable={false} src={enterIcon} > </button> </div> </div> </div> ); }; QuestionComponent.propTypes = { answer: PropTypes.string, onChange: PropTypes.func.isRequired, onClick: PropTypes.func.isRequired, onKeyPress: PropTypes.func.isRequired, question: PropTypes.string }; export default QuestionComponent;
Use svg image rather than unicode emoji
Use svg image rather than unicode emoji
JSX
bsd-3-clause
LLK/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui,LLK/scratch-gui,cwillisf/scratch-gui
--- +++ @@ -2,6 +2,7 @@ import React from 'react'; import styles from './question.css'; import Input from '../forms/input.jsx'; +import enterIcon from './icon--enter.svg'; const QuestionComponent = props => { const { @@ -28,7 +29,10 @@ className={styles.questionSubmitButton} onClick={onClick} > - {'✔︎' /* @todo should this be an image? */} + <img + draggable={false} + src={enterIcon} + > </button> </div> </div>
e5d82cd28f09f6b12db9e14d22c0f15f6e219784
imports/ui/components/inplace-edit.jsx
imports/ui/components/inplace-edit.jsx
import React from 'react'; export default class InplaceEdit extends React.Component { constructor(props) { super(props); this.state = { editing: false, }; this.view = this.view.bind(this); this.edit = this.edit.bind(this); } view() { this.props.onChange(this.refs.input.value); this.setState({ editing: false }); } edit() { this.setState({ editing: true }, () => { this.refs.input.focus(); }); } editIcon() { if (!this.props.text) { return ( <span className="glyphicon glyphicon-pencil"></span> ); } } render() { if (this.state.editing) { return ( <input style={{ marginTop: '-3px', marginBottom: '-3px' }} type="text" defaultValue={this.props.text} ref="input" onBlur={this.view} size={this.props.text.length} /> ); } return ( <div style={{ display: 'inline-block' }} onClick={this.edit} > {this.editIcon()} {this.props.text} </div> ); } } InplaceEdit.propTypes = { text: React.PropTypes.string, onChange: React.PropTypes.func.isRequired, };
import React from 'react'; export default class InplaceEdit extends React.Component { constructor(props) { super(props); this.state = { editing: false, }; this.view = this.view.bind(this); this.edit = this.edit.bind(this); } view() { this.props.onChange(this.refs.input.value); this.setState({ editing: false }); } edit() { this.setState({ editing: true }, () => { this.refs.input.focus(); }); } editIcon() { if (!this.props.text) { return ( <span className="glyphicon glyphicon-pencil"></span> ); } } render() { if (this.state.editing) { return ( <input style={{ marginTop: '-3px', marginBottom: '-3px' }} type="text" defaultValue={this.props.text} ref="input" onBlur={this.view} size={this.props.text.length} /> ); } return ( <div style={{ display: 'inline-block', paddingLeft: '2px' }} onClick={this.edit} > {this.editIcon()} {this.props.text} </div> ); } } InplaceEdit.propTypes = { text: React.PropTypes.string, onChange: React.PropTypes.func.isRequired, };
Add padding to inplace edit for smoothe transition
Add padding to inplace edit for smoothe transition
JSX
mit
minden/data-furnace,minden/data-furnace
--- +++ @@ -23,9 +23,9 @@ editIcon() { if (!this.props.text) { - return ( - <span className="glyphicon glyphicon-pencil"></span> - ); + return ( + <span className="glyphicon glyphicon-pencil"></span> + ); } } @@ -45,7 +45,7 @@ return ( <div - style={{ display: 'inline-block' }} + style={{ display: 'inline-block', paddingLeft: '2px' }} onClick={this.edit} > {this.editIcon()}