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
7858325abc93519c83009167cd3966e6b57c60d6
app/scripts/components/entry_form.jsx
app/scripts/components/entry_form.jsx
import React from 'react' class EntryForm extends React.Component { handleAddButtonClick() { const node = React.findDOMNode(this.refs.input) const text = node.value.trim() this.props.onEntry(text) node.value = '' } render() { return ( <section className="form"> <input type="text" id="link" ref="input" /> <button onClick={this.handleAddButtonClick.bind(this)}>Add</button> </section> ) } } export default EntryForm
import React from 'react' class EntryForm extends React.Component { handleAddButtonClick = () => { const node = React.findDOMNode(this.refs.input) const text = node.value.trim() this.props.onEntry(text) node.value = '' } render() { return ( <section className="form"> <input type="text" id="link" ref="input" /> <button onClick={this.handleAddButtonClick}>Add</button> </section> ) } } export default EntryForm
Use bound function instead of binding
Use bound function instead of binding
JSX
mit
adelgado/linkbag,adelgado/linkbag
--- +++ @@ -2,7 +2,7 @@ class EntryForm extends React.Component { - handleAddButtonClick() { + handleAddButtonClick = () => { const node = React.findDOMNode(this.refs.input) const text = node.value.trim() this.props.onEntry(text) @@ -13,7 +13,7 @@ return ( <section className="form"> <input type="text" id="link" ref="input" /> - <button onClick={this.handleAddButtonClick.bind(this)}>Add</button> + <button onClick={this.handleAddButtonClick}>Add</button> </section> ) }
ec184a369c63dde9585d1e01c73a0676685e5132
src/components/note_section/note_reference.jsx
src/components/note_section/note_reference.jsx
"use strict"; var React = require('react') module.exports = React.createClass({ displayName: 'NoteReferenceSection', render: function () { return ( <h1>FIXME</h1> {/* <div className="note-section note-reference-section"> <div className="note-reference-note"> <i className="fa fa-pencil"></i> <a href="{{ section.note_reference.get_absolute_url }}">{{ section.note_reference.as_html|safe }}</a> </div> {% if section.has_content %} <div className="note-section-content"> {{ section.content|as_html }} </div> {% endif %} </div> */} ) } });
"use strict"; var React = require('react') module.exports = React.createClass({ displayName: 'NoteReferenceSection', render: function () { return <h1>FIXME</h1> /* <div className="note-section note-reference-section"> <div className="note-reference-note"> <i className="fa fa-pencil"></i> <a href="{{ section.note_reference.get_absolute_url }}">{{ section.note_reference.as_html|safe }}</a> </div> {% if section.has_content %} <div className="note-section-content"> {{ section.content|as_html }} </div> {% endif %} </div> */ } });
Fix type in note reference section
Fix type in note reference section
JSX
agpl-3.0
editorsnotes/editorsnotes-renderer
--- +++ @@ -5,9 +5,8 @@ module.exports = React.createClass({ displayName: 'NoteReferenceSection', render: function () { - return ( - <h1>FIXME</h1> - {/* + return <h1>FIXME</h1> + /* <div className="note-section note-reference-section"> <div className="note-reference-note"> <i className="fa fa-pencil"></i> @@ -19,7 +18,6 @@ </div> {% endif %} </div> - */} - ) + */ } });
f4e4212b037e3ca841bec6a9e643c52f2bdf63d0
client/src/houseInventory.jsx
client/src/houseInventory.jsx
import React from 'react'; import ReactDOM from 'react-dom'; import $ from 'jquery'; import HouseInventoryList from './HouseInventoryList.jsx'; import Nav from './Nav.jsx'; class HouseInventory extends React.Component { constructor(props) { super(props); this.state({ items: [] }); } componentDidMount() { this.getItems(this.updateItems.bind(this)); } getItems(callback) { $.ajax({ type: 'GET', url: '/inventory', success: function(data) { console.log('Successful GET request - house inventory items retrieved'); callback(data); }, error: function() { console.log('Unable to GET house inventory items'); } }); } updateItems(data) { this.setState({ items: data }); } render() { return ( <div> <h1>House Inventory</h1> <Nav /> <HouseInventoryList items={this.state.items}/> </div> ); } } ReactDOM.render(<Inventory />, document.getElementById('inventory'));
import React from 'react'; import ReactDOM from 'react-dom'; import $ from 'jquery'; import HouseInventoryList from './HouseInventoryList.jsx'; import Nav from './Nav.jsx'; class HouseInventory extends React.Component { constructor(props) { super(props); this.state = { items: [] }; } componentDidMount() { this.getItems(this.updateItems.bind(this)); } getItems(callback) { $.ajax({ type: 'GET', url: '/inventory', success: function(data) { console.log('Successful GET request - house inventory items retrieved'); callback(data); }, error: function() { console.log('Unable to GET house inventory items'); } }); } updateItems(data) { this.setState({ items: data }); } render() { return ( <div> <h1>House Inventory</h1> <Nav /> <HouseInventoryList items={this.state.items}/> </div> ); } } ReactDOM.render(<HouseInventory />, document.getElementById('inventory'));
Fix syntax error in this.state
Fix syntax error in this.state
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -8,9 +8,9 @@ constructor(props) { super(props); - this.state({ + this.state = { items: [] - }); + }; } componentDidMount() { @@ -48,4 +48,4 @@ } } -ReactDOM.render(<Inventory />, document.getElementById('inventory')); +ReactDOM.render(<HouseInventory />, document.getElementById('inventory'));
e0705e6b4b23ce697462204d1a21810453c0b44c
app/client/routes.jsx
app/client/routes.jsx
FlowRouter.route("/", { name: 'Home', subscriptions(params) { }, action(params) { renderMainLayoutWith(<Camino.Home />); } }); FlowRouter.route("/login", { name: "Login", subscriptions(params) { }, action(params) { renderMainLayoutWith(<Camino.UserLogin />); } }); function renderMainLayoutWith(component) { ReactLayout.render(Camino.MainLayout, { header: <Camino.MainHeader />, content: component, footer: <Camino.MainFooter /> }); }
FlowRouter.route("/", { name: 'Home', subscriptions(params) { }, action(params) { renderMainLayoutWith(<Camino.Home />); } }); FlowRouter.route("/login", { name: "Login", subscriptions(params) { }, action(params) { renderMainLayoutWith(<Camino.UserLogin />); } }); FlowRouter.triggers.enter([checkIsLoggedIn]); function renderMainLayoutWith(component) { ReactLayout.render(Camino.MainLayout, { header: <Camino.MainHeader />, content: component, footer: <Camino.MainFooter /> }); } function checkIsLoggedIn() { if (!Meteor.userId()) { FlowRouter.go('Login'); } }
Add redirect to Login if the user is not logged in
Add redirect to Login if the user is not logged in
JSX
mit
fjaguero/camino,fjaguero/camino
--- +++ @@ -18,6 +18,8 @@ } }); +FlowRouter.triggers.enter([checkIsLoggedIn]); + function renderMainLayoutWith(component) { ReactLayout.render(Camino.MainLayout, { header: <Camino.MainHeader />, @@ -25,3 +27,9 @@ footer: <Camino.MainFooter /> }); } + +function checkIsLoggedIn() { + if (!Meteor.userId()) { + FlowRouter.go('Login'); + } +}
3c627f8f7e3cbf3574ecb800f9af686dabbf7721
imports/ui/components/authenticatedNavigation.jsx
imports/ui/components/authenticatedNavigation.jsx
import { Meteor } from 'meteor/meteor'; import React from 'react'; import { PropTypes } from 'prop-types'; import { withRouter } from 'react-router-dom'; import { LinkContainer } from 'react-router-bootstrap'; import Nav from 'react-bootstrap/lib/Nav'; import NavItem from 'react-bootstrap/lib/NavItem'; import NavDropdown from 'react-bootstrap/lib/NavDropdown'; import MenuItem from 'react-bootstrap/lib/MenuItem'; const userName = () => { const user = Meteor.user(); const name = user ? user.name : ''; return user ? `${name.first} ${name.last}` : ''; }; const AuthenticatedNavigation = ({ history }) => ( <div> <Nav> <LinkContainer to="/documents"> <NavItem eventKey={2} href="/documents">Documents</NavItem> </LinkContainer> </Nav> <Nav pullRight> <NavDropdown eventKey={3} title={userName()} id="basic-nav-dropdown"> <MenuItem eventKey={3.1} onClick={() => Meteor.logout(() => history.push('/login'))}>Se déconnecter</MenuItem> </NavDropdown> </Nav> </div> ); AuthenticatedNavigation.defaultProps = { history: null, }; AuthenticatedNavigation.propTypes = { history: PropTypes.object, }; export default withRouter(AuthenticatedNavigation);
import { Meteor } from 'meteor/meteor'; import React from 'react'; import { PropTypes } from 'prop-types'; import { LinkContainer } from 'react-router-bootstrap'; import Nav from 'react-bootstrap/lib/Nav'; import NavItem from 'react-bootstrap/lib/NavItem'; import NavDropdown from 'react-bootstrap/lib/NavDropdown'; import MenuItem from 'react-bootstrap/lib/MenuItem'; const AuthenticatedNavigation = props => ( <div> <Nav> <LinkContainer to="/documents"> <NavItem eventKey={2} href="/documents">Documents</NavItem> </LinkContainer> </Nav> <Nav pullRight> <NavDropdown eventKey={3} title={props.name} id="basic-nav-dropdown"> <MenuItem eventKey={3.1} onClick={() => Meteor.logout()}>Se déconnecter</MenuItem> </NavDropdown> </Nav> </div> ); AuthenticatedNavigation.defaultProps = { name: '', }; AuthenticatedNavigation.propTypes = { name: PropTypes.string.isRequired, }; export default AuthenticatedNavigation;
Update UI AuthenticatedNavigation with name props
Update UI AuthenticatedNavigation with name props
JSX
mit
ggallon/rock,ggallon/rock
--- +++ @@ -1,20 +1,13 @@ import { Meteor } from 'meteor/meteor'; import React from 'react'; import { PropTypes } from 'prop-types'; -import { withRouter } from 'react-router-dom'; import { LinkContainer } from 'react-router-bootstrap'; import Nav from 'react-bootstrap/lib/Nav'; import NavItem from 'react-bootstrap/lib/NavItem'; import NavDropdown from 'react-bootstrap/lib/NavDropdown'; import MenuItem from 'react-bootstrap/lib/MenuItem'; -const userName = () => { - const user = Meteor.user(); - const name = user ? user.name : ''; - return user ? `${name.first} ${name.last}` : ''; -}; - -const AuthenticatedNavigation = ({ history }) => ( +const AuthenticatedNavigation = props => ( <div> <Nav> <LinkContainer to="/documents"> @@ -22,19 +15,19 @@ </LinkContainer> </Nav> <Nav pullRight> - <NavDropdown eventKey={3} title={userName()} id="basic-nav-dropdown"> - <MenuItem eventKey={3.1} onClick={() => Meteor.logout(() => history.push('/login'))}>Se déconnecter</MenuItem> + <NavDropdown eventKey={3} title={props.name} id="basic-nav-dropdown"> + <MenuItem eventKey={3.1} onClick={() => Meteor.logout()}>Se déconnecter</MenuItem> </NavDropdown> </Nav> </div> ); AuthenticatedNavigation.defaultProps = { - history: null, + name: '', }; AuthenticatedNavigation.propTypes = { - history: PropTypes.object, + name: PropTypes.string.isRequired, }; -export default withRouter(AuthenticatedNavigation); +export default AuthenticatedNavigation;
726cdb48a2589e2ba4dcd5047512e7dce5aeffd9
packages/cmpd-fe-nominations/src/app/dashboard/household/components/ErrorModal.jsx
packages/cmpd-fe-nominations/src/app/dashboard/household/components/ErrorModal.jsx
import * as React from 'react'; import { Button, Modal } from 'react-bootstrap'; import { flatten } from 'rambda'; const ValidationError = ({ error }) => <li>{error}</li>; const ValidationErrorSummary = ({ errors = [] }) => { const errorList = flatten(errors.map(({ constraints }) => Object.values(constraints))); console.log(errorList); return <ul>{errorList.map(error => <ValidationError error={error} />)}</ul>; }; export default props => { const { show, title = 'Submission error', message = 'There was an issue submitting your form.', validationErrors = [], handleClose } = props; return ( <Modal show={show}> <Modal.Header> <Modal.Title>{title}</Modal.Title> </Modal.Header> <Modal.Body> <h4>{message}</h4> <ValidationErrorSummary errors={validationErrors} /> </Modal.Body> <Modal.Footer> <Button onClick={handleClose} bsStyle="primary"> Close </Button> </Modal.Footer> </Modal> ); };
import * as React from 'react'; import { Button, Modal } from 'react-bootstrap'; import { flatten } from 'rambda'; const ValidationError = ({ error }) => <li>{error}</li>; const ValidationErrorSummary = ({ errors = [] }) => { const errorList = flatten(errors.map(({ constraints }) => Object.values(constraints))); return <ul>{errorList.map(error => <ValidationError error={error} />)}</ul>; }; export default props => { const { show, title = 'Submission error', message = 'There was an issue submitting your form.', validationErrors = [], handleClose } = props; return ( <Modal show={show}> <Modal.Header> <Modal.Title>{title}</Modal.Title> </Modal.Header> <Modal.Body> <h4>{message}</h4> <ValidationErrorSummary errors={validationErrors} /> </Modal.Body> <Modal.Footer> <Button onClick={handleClose} bsStyle="primary"> Close </Button> </Modal.Footer> </Modal> ); };
Remove erorr list log statement
Remove erorr list log statement
JSX
mit
CodeForCharlotte/cmpd-holiday-gift-backend,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/cmpd-holiday-gift-backend,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/cmpd-holiday-gift-backend
--- +++ @@ -7,7 +7,6 @@ const ValidationErrorSummary = ({ errors = [] }) => { const errorList = flatten(errors.map(({ constraints }) => Object.values(constraints))); - console.log(errorList); return <ul>{errorList.map(error => <ValidationError error={error} />)}</ul>; };
b03c9b03a55d7bcdc741df69d78a99e908e3fd4d
src/containers/home/home.jsx
src/containers/home/home.jsx
import React from 'react'; var LogoVerticalWhite = require('../../components/logo/logo'); var Geolocalizer = require('../../components/geolocalizer/geolocalizer'); var Slider = require('../../components/slider/slider'); var Home = React.createClass ({ getInitialState: function () { return { meters: "50" } }, updateMeters: function (meters) { this.setState({meters: meters}); }, render: function () { return ( <main className="ktg-home"> <header className="ktg-home__header"> <LogoVerticalWhite /> </header> <form id="ktg-form-metersAround"> <Slider meters={this.state.meters} updateMeters={this.updateMeters}/> <Geolocalizer /> </form> </main> ); } }); module.exports = Home;
import React from 'react'; var LogoVerticalWhite = require('../../components/logo/logo'); var Geolocalizer = require('../../components/geolocalizer/geolocalizer'); var Slider = require('../../components/slider/slider'); var Results = require('../results/results'); var Home = React.createClass ({ getInitialState: function () { return { meters: "50" } }, updateMeters: function (meters) { this.setState({meters: meters}); }, render: function () { return ( <main className="ktg-home"> <Results /> </main> ); } }); module.exports = Home;
Remove this commit: for testing purpose
Remove this commit: for testing purpose
JSX
apache-2.0
swcraftersclm/katangapp-frontend,swcraftersclm/katangapp-frontend,swcraftersclm/katangapp-frontend
--- +++ @@ -3,6 +3,7 @@ var LogoVerticalWhite = require('../../components/logo/logo'); var Geolocalizer = require('../../components/geolocalizer/geolocalizer'); var Slider = require('../../components/slider/slider'); +var Results = require('../results/results'); var Home = React.createClass ({ getInitialState: function () { @@ -16,13 +17,7 @@ render: function () { return ( <main className="ktg-home"> - <header className="ktg-home__header"> - <LogoVerticalWhite /> - </header> - <form id="ktg-form-metersAround"> - <Slider meters={this.state.meters} updateMeters={this.updateMeters}/> - <Geolocalizer /> - </form> + <Results /> </main> ); }
46e6fd9e01dd11640d1a6d86a5262e9374dbdf40
src/year_dropdown.jsx
src/year_dropdown.jsx
import React from 'react' import YearDropdownOptions from './year_dropdown_options.jsx' var YearDropdown = React.createClass({ displayName: 'YearDropdown', propTypes: { onChange: React.PropTypes.func.isRequired, year: React.PropTypes.number.isRequired }, getInitialState () { return { dropdownVisible: false } }, renderReadView () { return ( <div className="react-datepicker__year-read-view" onClick={this.toggleDropdown}> <span className="react-datepicker__year-read-view--selected-year">{this.props.year}</span> <span className="react-datepicker__year-read-view--down-arrow"></span> </div> ) }, renderDropdown () { return ( <YearDropdownOptions ref="options" year={this.props.year} onChange={this.onChange} onCancel={this.toggleDropdown} /> ) }, onChange (year) { this.toggleDropdown() if (year === this.props.year) return this.props.onChange(year) }, toggleDropdown () { this.setState({ dropdownVisible: !this.state.dropdownVisible }) }, render () { return ( <div> {this.state.dropdownVisible ? this.renderDropdown() : this.renderReadView()} </div> ) } }) module.exports = YearDropdown
import React from 'react' import YearDropdownOptions from './year_dropdown_options' var YearDropdown = React.createClass({ displayName: 'YearDropdown', propTypes: { onChange: React.PropTypes.func.isRequired, year: React.PropTypes.number.isRequired }, getInitialState () { return { dropdownVisible: false } }, renderReadView () { return ( <div className="react-datepicker__year-read-view" onClick={this.toggleDropdown}> <span className="react-datepicker__year-read-view--selected-year">{this.props.year}</span> <span className="react-datepicker__year-read-view--down-arrow"></span> </div> ) }, renderDropdown () { return ( <YearDropdownOptions ref="options" year={this.props.year} onChange={this.onChange} onCancel={this.toggleDropdown} /> ) }, onChange (year) { this.toggleDropdown() if (year === this.props.year) return this.props.onChange(year) }, toggleDropdown () { this.setState({ dropdownVisible: !this.state.dropdownVisible }) }, render () { return ( <div> {this.state.dropdownVisible ? this.renderDropdown() : this.renderReadView()} </div> ) } }) module.exports = YearDropdown
Remove .jsx from import line
Remove .jsx from import line This isn't needed now that webpack is set up to work with `.jsx` files. It's problematic because it causes imports to break after babel transforms the file from `.jsx` -> `.js`.
JSX
mit
mitchrosu/react-datepicker,Hacker0x01/react-datepicker,bekerov/react-datepicker-roco,flexport/react-datepicker,BrunoAlcides/react-datepicker,lmenus/react-datepicker,lmenus/react-datepicker,BrunoAlcides/react-datepicker,bekerov/react-datepicker-roco,lmenus/react-datepicker,bekerov/react-datepicker-roco,flexport/react-datepicker,Hacker0x01/react-datepicker,Hacker0x01/react-datepicker,mitchrosu/react-datepicker,flexport/react-datepicker,BrunoAlcides/react-datepicker,mitchrosu/react-datepicker
--- +++ @@ -1,5 +1,5 @@ import React from 'react' -import YearDropdownOptions from './year_dropdown_options.jsx' +import YearDropdownOptions from './year_dropdown_options' var YearDropdown = React.createClass({ displayName: 'YearDropdown',
64ebf9591b7baa90a5a6c134699964cab2f79f72
src/main/webapp/resources/js/pages/projects/linelist/components/LineList/LineList.jsx
src/main/webapp/resources/js/pages/projects/linelist/components/LineList/LineList.jsx
import React from "react"; import PropTypes from "prop-types"; import { Loader } from "../Loader"; import { LineListLayoutComponent } from "./LineListLayoutComponent"; import { ErrorAlert } from "../../../../../components/alerts/ErrorAlert"; /** * Container class for the higher level states of the page: * 1. Loading * 2. Table * 3. Loading error. */ export function LineList(props) { const { initializing } = props; if (initializing) { return <Loader />; } else if (props.error) { return <ErrorAlert message={__("linelist.error.message")} />; } return <LineListLayoutComponent {...props} />; } LineList.propTypes = { initializing: PropTypes.bool.isRequired, error: PropTypes.bool };
import React from "react"; import PropTypes from "prop-types"; import { Loader } from "../Loader"; import { LineListLayoutComponent } from "./LineListLayoutComponent"; import { ErrorAlert } from "../../../../../components/alerts/ErrorAlert"; const { project } = window.PAGE; /** * Container class for the higher level states of the page: * 1. Loading * 2. Table * 3. Loading error. */ export function LineList(props) { const { initializing } = props; if (initializing) { return <Loader />; } else if (props.error) { return <ErrorAlert message={__("linelist.error.message").replace("{0}", project["name"])} />; } return <LineListLayoutComponent {...props} />; } LineList.propTypes = { initializing: PropTypes.bool.isRequired, error: PropTypes.bool };
Update linelist ErrorAlert to use correct message with replacement of project name
Update linelist ErrorAlert to use correct message with replacement of project name
JSX
apache-2.0
phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida
--- +++ @@ -3,6 +3,8 @@ import { Loader } from "../Loader"; import { LineListLayoutComponent } from "./LineListLayoutComponent"; import { ErrorAlert } from "../../../../../components/alerts/ErrorAlert"; + +const { project } = window.PAGE; /** * Container class for the higher level states of the page: @@ -15,7 +17,7 @@ if (initializing) { return <Loader />; } else if (props.error) { - return <ErrorAlert message={__("linelist.error.message")} />; + return <ErrorAlert message={__("linelist.error.message").replace("{0}", project["name"])} />; } return <LineListLayoutComponent {...props} />;
ce3ee990d8b565907917c0f1a26a255a4284f06e
js/src/Chat.jsx
js/src/Chat.jsx
var React = require('react'); var util = require('./util'); var Chat = React.createClass({ render: function() { var chat = this.props.chat, dateString = util.convertFromEpoch(chat.time), output = false; var serializedChat = chat.msg.map(function(curr){ var output = false; if (curr.text){ output = (<span>{curr.text}</span>); } else if (curr.img64){ output = (<img src={curr.img64} />); } else if (curr.img){ output = (<img src={curr.img} />); } return output; }); return ( <div className="msg"> <div className="payload"> {chat.user.name + " sez: "}{serializedChat} </div> <div className="time"> {dateString} </div> </div> ); } }); module.exports = Chat;
var React = require('react'); var util = require('./util'); var Chat = React.createClass({ render: function() { var chat = this.props.chat, dateString = util.convertFromEpoch(chat.time), output = false; var serializedChat = chat.msg.map(function(curr, idx){ var output = false; if (curr.text){ output = (<span key={idx} >{curr.text}</span>); } else if (curr.img64){ output = (<img key={idx} src={curr.img64} />); } else if (curr.img){ output = (<img key={idx} src={curr.img} />); } return output; }); return ( <div className="msg"> <div className="payload"> {chat.user.name + " sez: "}{serializedChat} </div> <div className="time"> {dateString} </div> </div> ); } }); module.exports = Chat;
Add keys to chat items
Add keys to chat items
JSX
mit
ebenpack/chatblast,ebenpack/chatblast,ebenpack/chatblast
--- +++ @@ -7,14 +7,14 @@ dateString = util.convertFromEpoch(chat.time), output = false; - var serializedChat = chat.msg.map(function(curr){ + var serializedChat = chat.msg.map(function(curr, idx){ var output = false; if (curr.text){ - output = (<span>{curr.text}</span>); + output = (<span key={idx} >{curr.text}</span>); } else if (curr.img64){ - output = (<img src={curr.img64} />); + output = (<img key={idx} src={curr.img64} />); } else if (curr.img){ - output = (<img src={curr.img} />); + output = (<img key={idx} src={curr.img} />); } return output; });
3bc9e4029aa59a7a425a6aa4a620aedd1e25b14f
pages/schedule.jsx
pages/schedule.jsx
import React from 'react' import BoxPage from '../components/box-page' import * as schedule from '../data/schedule' import Waypoint from 'react-waypoint' import Events from '../components/events' class Schedule extends React.Component { constructor (props) { super(props) this.state = { footerPosition: Waypoint.below } } onLeave = ({ currentPosition }) => { this.setState({ footerPosition: currentPosition }) } render () { const { footerPosition } = this.state return ( <BoxPage expanded inverse> <Events conference={schedule.conference} so={schedule.so} footerPosition={footerPosition} /> <Waypoint onPositionChange={this.onLeave} bottomOffset={100} /> </BoxPage> ) } } export default Schedule
import React from 'react' import Helmet from 'react-helmet' import BoxPage from '../components/box-page' import * as schedule from '../data/schedule' import Waypoint from 'react-waypoint' import Events from '../components/events' class Schedule extends React.Component { constructor (props) { super(props) this.state = { footerPosition: Waypoint.below } } onLeave = ({ currentPosition }) => { this.setState({ footerPosition: currentPosition }) } render () { const { footerPosition } = this.state return ( <BoxPage expanded inverse> <Helmet title="Schedule" meta={[ { property: 'og:title', content: 'Schedule - JSConf Iceland 2018', }, { name: 'twitter:title', content: 'Schedule - JSConf Iceland 2018', }, ]} /> <Events conference={schedule.conference} so={schedule.so} footerPosition={footerPosition} /> <Waypoint onPositionChange={this.onLeave} bottomOffset={100} /> </BoxPage> ) } } export default Schedule
Set correct meta titles for Schedule
Set correct meta titles for Schedule
JSX
mit
jsis/jsconf.is,jsis/jsconf.is
--- +++ @@ -1,4 +1,5 @@ import React from 'react' +import Helmet from 'react-helmet' import BoxPage from '../components/box-page' import * as schedule from '../data/schedule' import Waypoint from 'react-waypoint' @@ -17,6 +18,19 @@ const { footerPosition } = this.state return ( <BoxPage expanded inverse> + <Helmet + title="Schedule" + meta={[ + { + property: 'og:title', + content: 'Schedule - JSConf Iceland 2018', + }, + { + name: 'twitter:title', + content: 'Schedule - JSConf Iceland 2018', + }, + ]} + /> <Events conference={schedule.conference} so={schedule.so}
d54d5f5d299533b4a456a4a07ef0ae00a4a52dfc
app/classifier/restart-button.jsx
app/classifier/restart-button.jsx
import React from 'react'; class RestartButton extends React.Component { constructor(props) { super(props); } getCallback() { // override in sub-class return () => {}; } shouldRender() { // override in sub-class return true; } render() { // state and props are passed into getCallback and shouldRender // to avoind binding a sub-class function to the parent class `this` const onClick = this.getCallback(this.state, this.props); if (this.shouldRender(this.state, this.props)) { return ( <button type="button" {...this.props} onClick={onClick}> {this.props.children} </button> ); } else { return null; } } } RestartButton.defaultProps = { workflow: null, project: null, user: null, dialog: null }; RestartButton.propTypes = { workflow: React.PropTypes.object, project: React.PropTypes.object, user: React.PropTypes.object, children: React.PropTypes.node, Dialog: React.PropTypes.func, dialog: React.PropTypes.object }; export default RestartButton;
import React from 'react'; class RestartButton extends React.Component { constructor(props) { super(props); } getCallback() { // override in sub-class return () => {}; } shouldRender() { // override in sub-class return true; } render() { // state and props are passed into getCallback and shouldRender // to avoind binding a sub-class function to the parent class `this` const onClick = this.getCallback(this.state, this.props); const {className, style} = this.props; if (this.shouldRender(this.state, this.props)) { return ( <button type="button" className={className} style={style} onClick={onClick}> {this.props.children} </button> ); } else { return null; } } } RestartButton.defaultProps = { workflow: null, project: null, user: null, dialog: null, className: null, style: null }; RestartButton.propTypes = { workflow: React.PropTypes.object, project: React.PropTypes.object, user: React.PropTypes.object, children: React.PropTypes.node, Dialog: React.PropTypes.func, dialog: React.PropTypes.object, className: React.PropTypes.string, style: React.PropTypes.object }; export default RestartButton;
Fix unknown props warning on restart button
Fix unknown props warning on restart button
JSX
apache-2.0
parrish/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,zooniverse/Panoptes-Front-End,parrish/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,parrish/Panoptes-Front-End,jelliotartz/Panoptes-Front-End
--- +++ @@ -19,9 +19,10 @@ // state and props are passed into getCallback and shouldRender // to avoind binding a sub-class function to the parent class `this` const onClick = this.getCallback(this.state, this.props); + const {className, style} = this.props; if (this.shouldRender(this.state, this.props)) { return ( - <button type="button" {...this.props} onClick={onClick}> + <button type="button" className={className} style={style} onClick={onClick}> {this.props.children} </button> ); @@ -35,7 +36,9 @@ workflow: null, project: null, user: null, - dialog: null + dialog: null, + className: null, + style: null }; RestartButton.propTypes = { @@ -44,7 +47,9 @@ user: React.PropTypes.object, children: React.PropTypes.node, Dialog: React.PropTypes.func, - dialog: React.PropTypes.object + dialog: React.PropTypes.object, + className: React.PropTypes.string, + style: React.PropTypes.object }; export default RestartButton;
64e5b355afbff053514a13b4b7f6c8e5943ab4e9
public/src/components/header.jsx
public/src/components/header.jsx
import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import { Navbar, Row, Col } from 'react-bootstrap'; import Navigation from './navigation'; export default class Header extends Component { constructor(props) { super(props); // Bind this.getLinks = this.getLinks.bind(this); } getLinks() { // links to pass into the navigation based on session info const currentUser = this.props.userId; let links = []; if (currentUser) { // user is logged in aka id present links = [ { title: 'Account', href: `/account/${currentUser}` }, { title: 'Logout', href: '/logout' } ]; } else { links = [ { title: 'Register', href: '/registration' }, { title: 'Login', href: '/login' } ]; } return links; } render() { return ( <Navbar> <Row> <Col md={4}> <Navbar.Brand> <Link to="/">Phonebank</Link> </Navbar.Brand> </Col> <Col md={4} id="navigation"> <Navigation title={!this.props.userId ? 'Menu' : this.props.userInfo.first_name} links={this.getLinks()}/> </Col> </Row> </Navbar> ); } }
import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import { Navbar, Row, Col } from 'react-bootstrap'; import Navigation from './navigation'; export default class Header extends Component { constructor(props) { super(props); // Bind this.getLinks = this.getLinks.bind(this); } getLinks() { // links to pass into the navigation based on session info const { userId } = this.props; let links = []; if (userId) { // user is logged in aka id present links = [ { title: 'Account', href: `/account/${userId}` }, { title: 'Logout', href: '/logout' } ]; } else { links = [ { title: 'Register', href: '/registration' }, { title: 'Login', href: '/login' } ]; } return links; } render() { return ( <Navbar> <Row> <Col md={4}> <Navbar.Brand> <Link to="/">Phonebank</Link> </Navbar.Brand> </Col> <Col md={4} id="navigation"> <Navigation title={!this.props.userId ? 'Menu' : this.props.userInfo.first_name} links={this.getLinks()} logout={this.props.logout} history={this.props.history} /> </Col> </Row> </Navbar> ); } }
Clean up getLinks() and pass logout action and store history to Navigation
Clean up getLinks() and pass logout action and store history to Navigation
JSX
mit
Twilio-org/phonebank,Twilio-org/phonebank
--- +++ @@ -11,11 +11,11 @@ } getLinks() { // links to pass into the navigation based on session info - const currentUser = this.props.userId; + const { userId } = this.props; let links = []; - if (currentUser) { // user is logged in aka id present + if (userId) { // user is logged in aka id present links = [ - { title: 'Account', href: `/account/${currentUser}` }, + { title: 'Account', href: `/account/${userId}` }, { title: 'Logout', href: '/logout' } ]; } else { @@ -36,7 +36,12 @@ </Navbar.Brand> </Col> <Col md={4} id="navigation"> - <Navigation title={!this.props.userId ? 'Menu' : this.props.userInfo.first_name} links={this.getLinks()}/> + <Navigation + title={!this.props.userId ? 'Menu' : this.props.userInfo.first_name} + links={this.getLinks()} + logout={this.props.logout} + history={this.props.history} + /> </Col> </Row> </Navbar>
32a1f53817c4bea796c71cf5dbcf9a11f4584b80
src/application/HelloWorld/index.jsx
src/application/HelloWorld/index.jsx
import React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; import { Router, browserHistory, RouterContext } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; import store from './store'; import routes from './routes'; // Hot Reload! if (module.hot) module.hot.accept(); // Always check if env.BROWSER if (process.env.BROWSER) { require('../../../node_modules/sanitize.css/sanitize.css'); require('./style/skeleton.scss'); } class Application extends React.Component { static name = 'HelloWorld'; // The Application's name must coincide with the folder's name. static routerProps = {}; // It's defined by the server when matching the url with the routes. static store = store; static Routes = routes; componentDidMount() { // Let the reducer(s) decide if it should load the state from "PRELOAD_STATE" if (process.env.BROWSER) store.dispatch({ type: 'PRELOAD_STATE' }); } render() { return ( <Provider store={store}> {process.env.BROWSER ? // Client-Side / Server-Side rendering <Router history={syncHistoryWithStore(browserHistory, store)} > {Application.Routes} </Router> : <RouterContext {...this.props.routerProps} /> } </Provider> ); } } // Render only in client-side. if (process.env.BROWSER) { render( <Application />, document.getElementById('app-body'), ); } export default Application;
import React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; import { Router, browserHistory, RouterContext } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; import store from './store'; import routes from './routes'; // Hot Reload! if (module.hot) module.hot.accept(); // Always check if env.BROWSER if (process.env.BROWSER) { require('../../../node_modules/sanitize.css/sanitize.css'); require('./style/skeleton.scss'); } class Application extends React.Component { static name = 'HelloWorld'; // The Application's name must coincide with the folder's name. static routerProps = {}; // It's defined by the server when matching the url with the routes. static store = store; static Routes = routes; componentDidMount() { // Let the reducer(s) decide if it should load the state from "PRELOAD_STATE" if (process.env.BROWSER) store.dispatch({ type: 'PRELOAD_STATE' }); } render() { return ( <Provider store={store}> {process.env.BROWSER ? // Client-Side / Server-Side rendering <Router history={syncHistoryWithStore(browserHistory, store)}> {Application.Routes} </Router> : <RouterContext {...this.props.routerProps} /> } </Provider> ); } } // Render only in client-side. if (process.env.BROWSER) { render( <Application />, document.getElementById('app-body'), ); } export default Application;
Put routes, store, and app in separate files.
Put routes, store, and app in separate files.
JSX
mit
eddyw/mern-workflow
--- +++ @@ -28,9 +28,7 @@ return ( <Provider store={store}> {process.env.BROWSER ? // Client-Side / Server-Side rendering - <Router - history={syncHistoryWithStore(browserHistory, store)} - > + <Router history={syncHistoryWithStore(browserHistory, store)}> {Application.Routes} </Router> : <RouterContext {...this.props.routerProps} />
e9390bd325f777dd443bfb6ef18abd0f44faf619
js/src/Commands.jsx
js/src/Commands.jsx
var React = require('react'); var Reflux = require('reflux'); var Store = require('./Store'); var Actions = require('./Actions'); var Connect = require('./Connect.jsx'); var Chatblast = React.createClass({ render: function() { return ( <div> <Connect className={this.props.connectClass} readyState={this.props.readyState} /> </div> ); } }); module.exports = Chatblast;
var React = require('react'); var Reflux = require('reflux'); var Store = require('./Store'); var Actions = require('./Actions'); var Connect = require('./Connect.jsx'); var Chatblast = React.createClass({ render: function() { if (this.props.readyState !== 1) { return ( <div> <Connect className={this.props.connectClass} readyState={this.props.readyState} /> </div> ); } else { return (<div></div>); } } }); module.exports = Chatblast;
Hide login when already logged in
Hide login when already logged in
JSX
mit
ebenpack/chatblast,ebenpack/chatblast,ebenpack/chatblast
--- +++ @@ -7,12 +7,16 @@ var Chatblast = React.createClass({ render: function() { - return ( - <div> - <Connect className={this.props.connectClass} readyState={this.props.readyState} /> - </div> - - ); + if (this.props.readyState !== 1) { + return ( + <div> + <Connect className={this.props.connectClass} readyState={this.props.readyState} /> + </div> + + ); + } else { + return (<div></div>); + } } });
180b85fc7c59438e45c93b52aa42b289c2e00240
src/component/canvas/Scatter.jsx
src/component/canvas/Scatter.jsx
// @flow import type {Node} from 'react'; import type {Dimension} from '../../useScales'; import type {ComponentType} from 'react'; import React from 'react'; const defaultDot = (props: Object): Node => { return <circle fill='black' r={3} {...props.position}/>; }; const isNumber = (value) => typeof value === 'number' && !isNaN(value); type Props = { x: Dimension, y: Dimension, color: Array<string>, Dot?: ComponentType<*> }; export default function Scatter(props: Props) { const {y} = props; const {x} = props; const {Dot = defaultDot} = props; return <g> {y.scaledData.map((series, seriesIndex) => series.map((row, index) => { const xValue = x.scaledData[0][index][0]; const yValue = y.stack ? row[1] : row[0]; if(!isNumber(yValue) || !isNumber(xValue)) return null; return <Dot key={`${seriesIndex}.${index}`} position={{ cx: x.scaledData[0][index], cy: yValue }} />; }))} </g>; }
// @flow import type {Node} from 'react'; import type {Dimension} from '../../useScales'; import type {ComponentType} from 'react'; import React from 'react'; const defaultDot = (props: Object): Node => { return <circle fill='black' r={3} {...props.position}/>; }; const isNumber = (value) => typeof value === 'number' && !isNaN(value); type Props = { x: Dimension, y: Dimension, color: Array<string>, Dot?: ComponentType<*> }; export default function Scatter(props: Props) { const {y} = props; const {x} = props; const {color} = props; const {Dot = defaultDot} = props; return <g> {y.scaledData.map((series, seriesIndex) => series.map((row, index) => { const xValue = x.scaledData[0][index][0]; const yValue = y.stack ? row[1] : row[0]; if(!isNumber(yValue) || !isNumber(xValue)) return null; return <Dot key={`${seriesIndex}.${index}`} color={color[seriesIndex]} position={{ cx: x.scaledData[0][index], cy: yValue }} />; }))} </g>; }
Add color to scatter charts
Add color to scatter charts
JSX
mit
bigdatr/pnut,bigdatr/pnut
--- +++ @@ -23,6 +23,7 @@ export default function Scatter(props: Props) { const {y} = props; const {x} = props; + const {color} = props; const {Dot = defaultDot} = props; @@ -34,6 +35,7 @@ if(!isNumber(yValue) || !isNumber(xValue)) return null; return <Dot key={`${seriesIndex}.${index}`} + color={color[seriesIndex]} position={{ cx: x.scaledData[0][index], cy: yValue
fa49b2b2cb898923a618ba7f795733fe4b41af37
www/app/script/component/TextStatusSelect.jsx
www/app/script/component/TextStatusSelect.jsx
var React = require('react'); var ReactIntl = require('react-intl'); var ReactBootstrap = require('react-bootstrap'); var ReactRouter = require('react-router'); var Link = ReactRouter.Link; var TextAction = require('../action/TextAction'); var TextStatusSelect = React.createClass({ mixins: [ReactIntl.IntlMixin], changeHandler: function(event) { TextAction.changeStatus(this.props.text.id, event.target.value); }, options: { 'draft': 'Brouillon', 'review': 'Révision', 'debate': 'Débat', 'vote': 'Vote', 'published': 'Publié' }, render: function() { return ( <select className={this.props.className} onChange={this.changeHandler} value={this.props.text.status}> {Object.keys(this.options).map((key) => { return ( <option value={key}> {this.options[key]} </option> ); })} </select> ); } }); module.exports = TextStatusSelect;
var React = require('react'); var ReactIntl = require('react-intl'); var ReactBootstrap = require('react-bootstrap'); var ReactRouter = require('react-router'); var Link = ReactRouter.Link; var TextAction = require('../action/TextAction'); var TextStatusSelect = React.createClass({ mixins: [ReactIntl.IntlMixin], changeHandler: function(event) { TextAction.changeStatus(this.props.text.id, event.target.value); }, options: { 'draft': 'Brouillon', 'review': 'Révision', 'debate': 'Débat', 'vote': 'Vote', 'published': 'Publié' }, render: function() { return ( <select className={this.props.className} onChange={this.changeHandler} value={this.props.text.status}> {Object.keys(this.options).map((key) => { return ( <option value={key} key={key}> {this.options[key]} </option> ); })} </select> ); } }); module.exports = TextStatusSelect;
Fix React missing id/key attribute warnings.
Fix React missing id/key attribute warnings.
JSX
mit
promethe42/cocorico,promethe42/cocorico,promethe42/cocorico,promethe42/cocorico,promethe42/cocorico
--- +++ @@ -31,7 +31,7 @@ value={this.props.text.status}> {Object.keys(this.options).map((key) => { return ( - <option value={key}> + <option value={key} key={key}> {this.options[key]} </option> );
02bf1cc016f60939ca13d738d24d1d290071ffac
app/feedback/FeedbackControls.jsx
app/feedback/FeedbackControls.jsx
import "feedback/FeedbackControls.styl"; import { h, Component } from "preact"; export default class FeedbackControls extends Component { openFeedbackModal(type) { this.props.openModal("feedback", { type: type }); } render(props, state) { return <div class="feedbackControls"> <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "smile")}><i class="fa fa-smile-o" /></button> <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "frown")}><i class="fa fa-frown-o" /></button> <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "idea")}><i class="fa fa-lightbulb-o" /></button> </div>; } };
import "feedback/FeedbackControls.styl"; import { h, Component } from "preact"; export default class FeedbackControls extends Component { openFeedbackModal(type) { this.props.openModal("feedback", { type: type }); } render(props, state) { return <div class="feedbackControls"> <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "smile")}><i class="fa fa-fw fa-smile-o" /></button> <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "frown")}><i class="fa fa-fw fa-frown-o" /></button> <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "idea")}><i class="fa fa-fw fa-lightbulb-o" /></button> </div>; } };
Make feedback buttons at the bottom the same size
Make feedback buttons at the bottom the same size
JSX
mit
ULTIMATHEXERS/DaltonTab
--- +++ @@ -11,9 +11,9 @@ render(props, state) { return <div class="feedbackControls"> - <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "smile")}><i class="fa fa-smile-o" /></button> - <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "frown")}><i class="fa fa-frown-o" /></button> - <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "idea")}><i class="fa fa-lightbulb-o" /></button> + <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "smile")}><i class="fa fa-fw fa-smile-o" /></button> + <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "frown")}><i class="fa fa-fw fa-frown-o" /></button> + <button class="btn btn-default" onClick={this.openFeedbackModal.bind(this, "idea")}><i class="fa fa-fw fa-lightbulb-o" /></button> </div>; } };
db5a999a13f6a7192ee2d41517f90e14346a59e2
components/ExamplePluginComponent.jsx
components/ExamplePluginComponent.jsx
import React from "react/addons"; import ExamplePluginStore from "../stores/ExamplePluginStore"; import ExamplePluginEvents from "../events/ExamplePluginEvents"; var PluginDispatcher = global.MarathonUIPluginAPI.PluginDispatcher; var ExamplePluginComponent = React.createClass({ getInitialState: function () { return { appsCount: 0 }; }, componentDidMount: function () { ExamplePluginStore.on(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, componentWillUnmount: function () { ExamplePluginStore.removeListener(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, onAppsChange: function () { this.setState({ appsCount: ExamplePluginStore.apps.length }); }, handleClick: function (e) { e.stopPropagation(); PluginDispatcher.dispatch({ actionType: "PLUGIN_DIALOG_ALERT", data: { title: "Hello world", message: "Hi, Plugin speaking here." } }); }, render: function () { return ( <div> <div className="flex-row"> <h3 className="small-caps">Example Plugin</h3> </div> <ul className="list-group filters"> <li>{this.state.appsCount} applications in total</li> <li><hr /></li> <li className="clickable" onClick={this.handleClick}> <a>Click me</a> </li> </ul> </div> ); } }); export default ExamplePluginComponent;
import React from "react/addons"; import ExamplePluginStore from "../stores/ExamplePluginStore"; import ExamplePluginEvents from "../events/ExamplePluginEvents"; var MarathonUIPluginAPI = global.MarathonUIPluginAPI; var PluginActions = MarathonUIPluginAPI.PluginActions; var PluginDispatcher = MarathonUIPluginAPI.PluginDispatcher; var ExamplePluginComponent = React.createClass({ getInitialState: function () { return { appsCount: 0 }; }, componentDidMount: function () { ExamplePluginStore.on(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, componentWillUnmount: function () { ExamplePluginStore.removeListener(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange); }, onAppsChange: function () { this.setState({ appsCount: ExamplePluginStore.apps.length }); }, handleClick: function (e) { e.stopPropagation(); PluginDispatcher.dispatch({ actionType: PluginActions.DIALOG_ALERT, data: { title: "Hello world", message: "Hi, Plugin speaking here." } }); }, render: function () { return ( <div> <div className="flex-row"> <h3 className="small-caps">Example Plugin</h3> </div> <ul className="list-group filters"> <li>{this.state.appsCount} applications in total</li> <li><hr /></li> <li className="clickable" onClick={this.handleClick}> <a>Click me</a> </li> </ul> </div> ); } }); export default ExamplePluginComponent;
Introduce read-only plugin actions contant file
Introduce read-only plugin actions contant file
JSX
apache-2.0
mesosphere/marathon-ui-example-plugin
--- +++ @@ -3,7 +3,10 @@ import ExamplePluginStore from "../stores/ExamplePluginStore"; import ExamplePluginEvents from "../events/ExamplePluginEvents"; -var PluginDispatcher = global.MarathonUIPluginAPI.PluginDispatcher; +var MarathonUIPluginAPI = global.MarathonUIPluginAPI; +var PluginActions = MarathonUIPluginAPI.PluginActions; +var PluginDispatcher = MarathonUIPluginAPI.PluginDispatcher; + var ExamplePluginComponent = React.createClass({ @@ -32,7 +35,7 @@ e.stopPropagation(); PluginDispatcher.dispatch({ - actionType: "PLUGIN_DIALOG_ALERT", + actionType: PluginActions.DIALOG_ALERT, data: { title: "Hello world", message: "Hi, Plugin speaking here."
d677875a644d817a59915e42012a8de911fd288c
app/javascript/app/components/tag/tag-component.jsx
app/javascript/app/components/tag/tag-component.jsx
import React, { PureComponent } from 'react'; import Proptypes from 'prop-types'; import Icon from 'components/icon'; import cx from 'classnames'; import closeIcon from 'assets/icons/legend-close.svg'; import styles from './tag-styles.scss'; class Tag extends PureComponent { render() { const { data, onRemove, className, canRemove } = this.props; return ( <li className={cx(styles.tag, className)}> <span className={styles.dot} style={{ backgroundColor: data.color }} /> <p className={styles.label}>{data.label}</p> {canRemove && ( <button className={styles.closeButton} onClick={() => onRemove(data)}> <Icon icon={closeIcon} className={styles.icon} /> </button> )} </li> ); } } Tag.propTypes = { data: Proptypes.object, onRemove: Proptypes.func, className: Proptypes.string, canRemove: Proptypes.bool }; Tag.defaultPropTypes = { canRemove: false }; export default Tag;
import React, { PureComponent } from 'react'; import Proptypes from 'prop-types'; import Icon from 'components/icon'; import cx from 'classnames'; import { Link } from 'react-router-dom'; import closeIcon from 'assets/icons/legend-close.svg'; import styles from './tag-styles.scss'; class Tag extends PureComponent { render() { const { data, onRemove, className, canRemove } = this.props; return data.url ? ( <Link to={data.url} className={cx(styles.tag, className)}> <span className={styles.dot} style={{ backgroundColor: data.color }} /> <p className={styles.label}>{data.label}</p> {canRemove && ( <button className={styles.closeButton} onClick={() => onRemove(data)}> <Icon icon={closeIcon} className={styles.icon} /> </button> )} </Link> ) : ( <li className={cx(styles.tag, className)}> <span className={styles.dot} style={{ backgroundColor: data.color }} /> <p className={styles.label}>{data.label}</p> {canRemove && ( <button className={styles.closeButton} onClick={() => onRemove(data)}> <Icon icon={closeIcon} className={styles.icon} /> </button> )} </li> ); } } Tag.propTypes = { data: Proptypes.object, onRemove: Proptypes.func, className: Proptypes.string, canRemove: Proptypes.bool }; Tag.defaultPropTypes = { canRemove: false }; export default Tag;
Add link to tag component
Add link to tag component
JSX
mit
Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch
--- +++ @@ -2,6 +2,7 @@ import Proptypes from 'prop-types'; import Icon from 'components/icon'; import cx from 'classnames'; +import { Link } from 'react-router-dom'; import closeIcon from 'assets/icons/legend-close.svg'; import styles from './tag-styles.scss'; @@ -9,7 +10,17 @@ class Tag extends PureComponent { render() { const { data, onRemove, className, canRemove } = this.props; - return ( + return data.url ? ( + <Link to={data.url} className={cx(styles.tag, className)}> + <span className={styles.dot} style={{ backgroundColor: data.color }} /> + <p className={styles.label}>{data.label}</p> + {canRemove && ( + <button className={styles.closeButton} onClick={() => onRemove(data)}> + <Icon icon={closeIcon} className={styles.icon} /> + </button> + )} + </Link> + ) : ( <li className={cx(styles.tag, className)}> <span className={styles.dot} style={{ backgroundColor: data.color }} /> <p className={styles.label}>{data.label}</p>
6c534ea468ae0651a7a4f95cec8e2159fbde08bf
components/InputRow.jsx
components/InputRow.jsx
var React = require('react'); var Label = require('./Label.jsx'); var ClassBuilder = require('../utils/ClassBuilder'); var InputRow = React.createClass({ displayName: 'InputRow', propTypes: { label: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.object ]), width: React.PropTypes.number, visible: React.PropTypes.bool }, getDefaultProps: function() { return { width: 70, visible: true }; }, render: function() { var classes = new ClassBuilder('InputRow'); classes.add(!this.props.visible, 'is-disabled'); classes.add(this.props.className); var labelWidth = 100 - this.props.width; function widthStyle(width) { return { width: `${width}%` }; } return ( <div className={classes.className} style={this.props.style}> <div className="InputRow_label" style={widthStyle(labelWidth)}><Label>{this.props.label}</Label></div> <div className="InputRow_input" style={widthStyle(this.props.width)}>{this.props.children}</div> </div> ); } }); module.exports = InputRow;
var React = require('react'); var Label = require('./Label.jsx'); var ClassBuilder = require('../utils/ClassBuilder'); var InputRow = React.createClass({ displayName: 'InputRow', propTypes: { label: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.object ]), width: React.PropTypes.number, visible: React.PropTypes.bool }, getDefaultProps: function() { return { visible: true }; }, render: function() { var classes = new ClassBuilder('InputRow'); classes.add(!this.props.visible, 'is-disabled'); classes.add(this.props.className); } return ( <div className={classes.className}> <div className="InputRow_label"><Label>{this.props.label}</Label></div> <div className="InputRow_input">{this.props.children}</div> </div> ); } }); module.exports = InputRow;
Remove inline widths from 'input row' component
Remove inline widths from 'input row' component
JSX
bsd-3-clause
bigdatr/bd-stampy
--- +++ @@ -15,7 +15,6 @@ }, getDefaultProps: function() { return { - width: 70, visible: true }; }, @@ -23,19 +22,12 @@ var classes = new ClassBuilder('InputRow'); classes.add(!this.props.visible, 'is-disabled'); classes.add(this.props.className); - - var labelWidth = 100 - this.props.width; - - function widthStyle(width) { - return { - width: `${width}%` - }; } return ( - <div className={classes.className} style={this.props.style}> - <div className="InputRow_label" style={widthStyle(labelWidth)}><Label>{this.props.label}</Label></div> - <div className="InputRow_input" style={widthStyle(this.props.width)}>{this.props.children}</div> + <div className={classes.className}> + <div className="InputRow_label"><Label>{this.props.label}</Label></div> + <div className="InputRow_input">{this.props.children}</div> </div> ); }
6f76f1bc779f09b1ca9b90fb40f5d066281a201e
src/app.jsx
src/app.jsx
// Core JS Array.from polyfill import 'core-js/fn/array/from'; // 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'; const appInstance = ( <ReactRouter.Route name="app" path="/" handler={App}> {routes} </ReactRouter.Route> ); const Bootstrapper = { start() { ReactRouter.run(appInstance, ReactRouter.HistoryLocation, function(Handler) { React.render(<Handler />, document.getElementById('mainContainer')); }); }, }; export default Bootstrapper;
// Core JS Array.from polyfill import 'core-js/fn/array/from'; // 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'; const appInstance = ( <ReactRouter.Route name="app" path="/" handler={App}> {routes} </ReactRouter.Route> ); const Bootstrapper = { start() { ReactRouter.run(appInstance, ReactRouter.HistoryLocation, function(Handler) { React.render(<Handler />, document.getElementById('mainContainer')); }); }, }; export default Bootstrapper;
Add ES6 Symbol polyfill (for Safari)
Add ES6 Symbol polyfill (for Safari)
JSX
cc0-1.0
acusti/primal-multiplication,acusti/primal-multiplication
--- +++ @@ -1,5 +1,7 @@ // Core JS Array.from polyfill import 'core-js/fn/array/from'; +// Symbol polyfill +import 'core-js/es6/symbol'; // React import React from 'react'; import ReactRouter from 'react-router';
24f90683383b308f6930686fbc2fcffb63317338
client/app/bundles/course/user-notification/components/Popup.jsx
client/app/bundles/course/user-notification/components/Popup.jsx
import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; import translations from 'lib/translations/form'; const styles = { dialog: { width: 400, }, centralise: { display: 'flex', flexDirection: 'column', alignItems: 'center', }, }; class Popup extends React.Component { static propTypes = { title: PropTypes.string, onDismiss: PropTypes.func, children: PropTypes.node, } render() { const { title, children } = this.props; const actions = [ <FlatButton primary label={<FormattedMessage {...translations.dismiss} />} onClick={this.props.onDismiss} />, ]; return ( <Dialog open title={title} actions={actions} contentStyle={styles.dialog} titleStyle={styles.centralise} bodyStyle={styles.centralise} > { children } </Dialog> ); } } export default Popup;
import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; import translations from 'lib/translations/form'; const styles = { dialog: { width: 400, }, centralise: { display: 'flex', flexDirection: 'column', alignItems: 'center', }, }; class Popup extends React.Component { static propTypes = { title: PropTypes.string, onDismiss: PropTypes.func, children: PropTypes.node, } render() { const { title, children } = this.props; const actions = [ <FlatButton primary label={<FormattedMessage {...translations.dismiss} />} onClick={this.props.onDismiss} />, ]; return ( <Dialog open title={title} actions={actions} contentStyle={styles.dialog} titleStyle={styles.centralise} bodyStyle={styles.centralise} onRequestClose={this.props.onDismiss} > { children } </Dialog> ); } } export default Popup;
Allow popup notification to be dismiss when ‘Dismiss’ button is obscured
Allow popup notification to be dismiss when ‘Dismiss’ button is obscured
JSX
mit
Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,cysjonathan/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2
--- +++ @@ -41,6 +41,7 @@ contentStyle={styles.dialog} titleStyle={styles.centralise} bodyStyle={styles.centralise} + onRequestClose={this.props.onDismiss} > { children } </Dialog>
e0a19e87a328c41adfd51c7e2cdcd29d0412e916
src/js/post-911-gib-status/containers/PrintPage.jsx
src/js/post-911-gib-status/containers/PrintPage.jsx
import React from 'react'; import { connect } from 'react-redux'; import UserInfoSection from '../components/UserInfoSection'; import { formatDateLong } from '../../common/utils/helpers'; class PrintPage extends React.Component { render() { const enrollmentData = this.props.enrollmentData || {}; const todayFormatted = formatDateLong(new Date()); return ( <div className="usa-width-two-thirds medium-8 columns gib-info"> <div className="print-status"> <div className="print-screen"> <img src="/img/design/logo/va-logo.png" alt="VA logo" width="300"/> <h1 className="section-header">Post-9/11 GI Bill<sup>&reg;</sup> Statement of Benefits</h1> <p> The information in this letter is the Post-9/11 GI Bill Statement of Benefits for the beneficiary listed below as of {todayFormatted}. Any pending or recent changes to enrollment may affect remaining entitlement. </p> <UserInfoSection enrollmentData={enrollmentData}/> </div> </div> </div> ); } } function mapStateToProps(state) { return { enrollmentData: state.post911GIBStatus.enrollmentData }; } export default connect(mapStateToProps)(PrintPage);
import React from 'react'; import { connect } from 'react-redux'; import UserInfoSection from '../components/UserInfoSection'; import { formatDateLong } from '../../common/utils/helpers'; class PrintPage extends React.Component { render() { const enrollmentData = this.props.enrollmentData || {}; const todayFormatted = formatDateLong(new Date()); return ( <div className="usa-width-two-thirds medium-8 columns gib-info"> <div className="print-status"> <div className="print-screen"> <img src="/img/design/logo/va-logo.png" alt="VA logo" width="300"/> <h1 className="section-header">Post-9/11 GI Bill<sup>&reg;</sup> Statement of Benefits</h1> <p> The information in this letter is the Post-9/11 GI Bill Statement of Benefits for the beneficiary listed below as of {todayFormatted}. Any pending or recent changes to enrollment may affect remaining entitlement. </p> <UserInfoSection enrollmentData={enrollmentData}/> </div> </div> </div> ); } } function mapStateToProps(state) { return { enrollmentData: state.post911GIBStatus.enrollmentData }; } export default connect(mapStateToProps)(PrintPage);
Add trademark symbol to print page
Add trademark symbol to print page
JSX
cc0-1.0
department-of-veterans-affairs/vets-website,department-of-veterans-affairs/vets-website
--- +++ @@ -12,21 +12,18 @@ const todayFormatted = formatDateLong(new Date()); return ( - <div className="usa-width-two-thirds medium-8 columns gib-info"> - <div className="print-status"> - <div className="print-screen"> - <img src="/img/design/logo/va-logo.png" alt="VA logo" width="300"/> - <h1 className="section-header">Post-9/11 GI Bill<sup>&reg;</sup> Statement of Benefits</h1> - <p> - The information in this letter is the Post-9/11 GI Bill - Statement of Benefits for the beneficiary listed below as of - {todayFormatted}. Any pending or recent changes to enrollment may - affect remaining entitlement. - </p> - <UserInfoSection enrollmentData={enrollmentData}/> - </div> + <div className="usa-width-two-thirds medium-8 columns gib-info"> + <div className="print-status"> + <div className="print-screen"> + <img src="/img/design/logo/va-logo.png" alt="VA logo" width="300"/> + <h1 className="section-header">Post-9/11 GI Bill<sup>&reg;</sup> Statement of Benefits</h1> + <p> + The information in this letter is the Post-9/11 GI Bill Statement of Benefits for the beneficiary listed below as of {todayFormatted}. Any pending or recent changes to enrollment may affect remaining entitlement. + </p> + <UserInfoSection enrollmentData={enrollmentData}/> + </div> + </div> </div> - </div> ); } }
4678731fa949f3c9d499fa6d9b8d9aa3bd9ec33b
assets/js/components/active-learning-circles-list.jsx
assets/js/components/active-learning-circles-list.jsx
import React from 'react' import PagedTable from './paged-table' import moment from 'moment' export default class ActiveLearningCircleList extends React.Component { render(){ var heading = ( <tr> <th>{gettext("Details")}</th> <th>{gettext("Signups")}</th> <th>{gettext("Facilitator")}</th> <th>{gettext("Next meeting")}</th> <th></th> </tr> ); let learningCircleRows = this.props.learningCircles.map(lc => ( <tr> <td> { lc.course_title }<br/> { lc.day }s, { lc.meeting_time } {gettext("at")} { lc.venue_name } </td> <td> { lc.signup_count } </td> <td> { lc.facilitator.first_name } { lc.facilitator } </td> <td> { moment(lc.next_meeting_date).format('ddd, D MMM') } </td> <td> <a className="btn btn-primary" href={ lc.url }>{gettext("View")}</a> </td> </tr> )); return ( <div className="active-learning-circles-list"> <h2>{gettext("Active Learning Circles")}</h2> <PagedTable perPage={10} heading={heading}>{learningCircleRows}</PagedTable> <a href="/organize/studygroups/">{gettext("View all learning circles")}</a> </div> ); } }
import React from 'react' import PagedTable from './paged-table' import moment from 'moment' export default class ActiveLearningCircleList extends React.Component { render(){ var heading = ( <tr> <th>{gettext("Details")}</th> <th>{gettext("Signups")}</th> <th>{gettext("Facilitator")}</th> <th>{gettext("Next meeting")}</th> <th></th> </tr> ); let learningCircleRows = this.props.learningCircles.map(lc => ( <tr> <td> { lc.course_title }<br/> { lc.day }s, { lc.meeting_time } {gettext("at")} { lc.venue_name } </td> <td> { lc.signup_count } </td> <td> { lc.facilitator.first_name } { lc.facilitator } </td> <td> { lc.next_meeting_date && moment(lc.next_meeting_date).format('ddd, D MMM') } </td> <td> <a className="btn btn-primary" href={ lc.url }>{gettext("View")}</a> </td> </tr> )); return ( <div className="active-learning-circles-list"> <h2>{gettext("Active Learning Circles")}</h2> <PagedTable perPage={10} heading={heading}>{learningCircleRows}</PagedTable> <a href="/organize/studygroups/">{gettext("View all learning circles")}</a> </div> ); } }
Fix display error when there is not next meeting for an active learning circle
Fix display error when there is not next meeting for an active learning circle
JSX
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
--- +++ @@ -28,7 +28,7 @@ { lc.facilitator.first_name } { lc.facilitator } </td> <td> - { moment(lc.next_meeting_date).format('ddd, D MMM') } + { lc.next_meeting_date && moment(lc.next_meeting_date).format('ddd, D MMM') } </td> <td> <a className="btn btn-primary" href={ lc.url }>{gettext("View")}</a>
ecbebfbfc87c813fe4487eda2b3a0918e89155e8
js/__tests__/Search.spec.jsx
js/__tests__/Search.spec.jsx
import React from 'react'; import { shallow } from 'enzyme'; import Search from '../Search'; test('Search renders correctly', () => { const component = shallow(<Search />); expect(component).toMatchSnapshot(); }); ````;
import React from 'react'; import { shallow } from 'enzyme'; import Search from '../Search'; test('Search renders correctly', () => { const component = shallow(<Search />); expect(component).toMatchSnapshot(); });
Remove a bunch of backticks
Remove a bunch of backticks
JSX
mit
mikestephens/complete-intro-to-react,mikestephens/complete-intro-to-react
--- +++ @@ -6,4 +6,3 @@ const component = shallow(<Search />); expect(component).toMatchSnapshot(); }); -````;
ea3c2ec561c0dd80dbc4f39cf81616cf7caa544e
src/client/scripts/app.jsx
src/client/scripts/app.jsx
import React from 'react'; import { render } from 'react-dom'; import { Router, Route, IndexRoute, browserHistory } from 'react-router'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import reducer from './reducers/combine_reducers'; import PlaceInput from './components/place_input'; import Canvas from './components/canvas'; import POI from './components/poi'; const store = createStore( reducer, applyMiddleware(thunk), ); // TODO: add implementation for /city/*/* render(( <Provider store={store}> <Router history={browserHistory}> <Route path="/" component={PlaceInput} /> <Route path="/city" > <IndexRoute component={Canvas} /> <Route path="/city/*" component={Canvas} /> <Route path="/city/*/*" component={Canvas} /> </Route> </Router> </Provider> ), document.getElementById('container'));
import React from 'react'; import { render } from 'react-dom'; import { Router, Route, IndexRoute, browserHistory } from 'react-router'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux'; import reducer from './reducers/combine_reducers'; import PlaceInput from './components/place_input'; import Canvas from './components/canvas'; import POI from './components/poi'; const store = createStore( reducer, applyMiddleware( thunk, routerMiddleware(browserHistory), ), ); const history = syncHistoryWithStore(browserHistory, store); render(( <Provider store={store}> <Router history={history}> <Route path="/" component={PlaceInput} /> <Route path="/city" > <IndexRoute component={Canvas} /> <Route path="/city/*" component={Canvas} /> <Route path="/city/*/*" component={Canvas} /> </Route> </Router> </Provider> ), document.getElementById('container'));
Update Router with middleware to handle state changes
Update Router with middleware to handle state changes
JSX
mit
Tropical-Raptor/trip-raptor,theredspoon/trip-raptor
--- +++ @@ -4,6 +4,7 @@ import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; +import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux'; import reducer from './reducers/combine_reducers'; import PlaceInput from './components/place_input'; @@ -12,14 +13,17 @@ const store = createStore( reducer, - applyMiddleware(thunk), + applyMiddleware( + thunk, + routerMiddleware(browserHistory), + ), ); -// TODO: add implementation for /city/*/* +const history = syncHistoryWithStore(browserHistory, store); render(( <Provider store={store}> - <Router history={browserHistory}> + <Router history={history}> <Route path="/" component={PlaceInput} /> <Route path="/city" > <IndexRoute component={Canvas} />
ad9b655a7bc9cd69d457676be8583a51bdcd48c4
client/app/bundles/DenpaioApp/components/SearchBar.jsx
client/app/bundles/DenpaioApp/components/SearchBar.jsx
import React from 'react'; export default class SearchBar extends React.Component { handleSubmit = (e) => { e.preventDefault(); let searchbar = e.target.searchbar; let keyword = searchbar.value; searchbar.value = ''; searchbar.blur(); this.props.onSearch(keyword); }; render() { return ( <form onSubmit={this.handleSubmit} style={searchFormStyle} > <input name="searchbar" className="searchbar" type="search" placeholder="Search" style={searchBarStyle} /> </form> ); } } const searchFormStyle = { float: 'right', }; const searchBarStyle = { display: 'inline-block', backgroundColor: 'transparent', margin: 0, border: 'none', maxWidth: '300px', height: '2em', };
import React from 'react'; import Radium from 'radium'; @Radium export default class SearchBar extends React.Component { handleSubmit = (e) => { e.preventDefault(); let searchbar = e.target.searchbar; let keyword = searchbar.value; searchbar.value = ''; searchbar.blur(); this.props.onSearch(keyword); }; render() { return ( <form onSubmit={this.handleSubmit} style={searchFormStyle} > <input name="searchbar" className="searchbar" type="search" placeholder="Search" style={searchBarStyle} /> </form> ); } } const searchFormStyle = { float: 'right', }; const searchBarStyle = { display: 'inline-block', backgroundColor: 'transparent', margin: 0, border: 'none', maxWidth: '300px', height: '2em', boxShadow: '0px 2px 0px #cc4b37', ':focus': { backgroundColor: 'rgba(255, 255, 255, 0.1)', } };
Add a border line at bottom of search bar
Add a border line at bottom of search bar
JSX
mit
denpaio/denpaio,denpaio/denpaio,denpaio/denpaio,denpaio/denpaio
--- +++ @@ -1,5 +1,7 @@ import React from 'react'; +import Radium from 'radium'; +@Radium export default class SearchBar extends React.Component { handleSubmit = (e) => { e.preventDefault(); @@ -38,4 +40,8 @@ border: 'none', maxWidth: '300px', height: '2em', + boxShadow: '0px 2px 0px #cc4b37', + ':focus': { + backgroundColor: 'rgba(255, 255, 255, 0.1)', + } };
e34d349f52972d0fa001b16537cb2f3cc2f87002
client/javascript/pages/SignIn.jsx
client/javascript/pages/SignIn.jsx
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import { replace } from 'react-router-redux'; import serialize from 'form-serialize'; import { signIn } from '../actions'; import { allFormFieldsComplete } from '../utils'; import routes from '../constants/routes'; class SignIn extends Component { handleSubmit(event) { event.preventDefault(); const formData = serialize(event.target, { hash: true }); if (allFormFieldsComplete(formData, ['username'])) { this.props.onSubmit(formData.username); } } render() { return ( <form action="/" method="POST" className="form" onSubmit={event => this.handleSubmit(event)}> <h1 className="form-title heading-large">Enter your full name</h1> <div className="form-group"> <input type="text" className="form-control" id="username" name="username" /> </div> <div className="form-group"> <input type="submit" className="button" value="Sign in" /> </div> </form> ); } } SignIn.propTypes = { onSubmit: PropTypes.func, }; const mapActionsToProps = dispatch => ({ onSubmit: (name) => { dispatch(replace(routes.BEFORE_YOU_START)); dispatch(signIn(name)); }, }); export { SignIn }; export default connect(null, mapActionsToProps)(SignIn);
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import { replace } from 'react-router-redux'; import serialize from 'form-serialize'; import { signIn } from '../actions'; import { allFormFieldsComplete } from '../utils'; import routes from '../constants/routes'; class SignIn extends Component { handleSubmit(event) { event.preventDefault(); const formData = serialize(event.target, { hash: true }); if (allFormFieldsComplete(formData, ['username'])) { this.props.onSubmit(formData.username); } } render() { return ( <form action="/" method="POST" className="form" onSubmit={event => this.handleSubmit(event)}> <h1 className="form-title heading-large">Your full name</h1> <div className="form-group"> <input type="text" className="form-control" id="username" name="username" /> </div> <div className="form-group"> <input type="submit" className="button" value="Sign in" /> </div> </form> ); } } SignIn.propTypes = { onSubmit: PropTypes.func, }; const mapActionsToProps = dispatch => ({ onSubmit: (name) => { dispatch(replace(routes.BEFORE_YOU_START)); dispatch(signIn(name)); }, }); export { SignIn }; export default connect(null, mapActionsToProps)(SignIn);
Update the sign in instruction
CSRA-000: Update the sign in instruction
JSX
mit
noms-digital-studio/csra-app,noms-digital-studio/csra-app,noms-digital-studio/csra-app
--- +++ @@ -23,7 +23,7 @@ render() { return ( <form action="/" method="POST" className="form" onSubmit={event => this.handleSubmit(event)}> - <h1 className="form-title heading-large">Enter your full name</h1> + <h1 className="form-title heading-large">Your full name</h1> <div className="form-group"> <input type="text" className="form-control" id="username" name="username" />
0d3185eb6f733b6c06bf9236a000ea44d9f493fe
examples/forms/checkbox/default.jsx
examples/forms/checkbox/default.jsx
import React from 'react'; import Checkbox from '~/components/checkbox'; // `~` is replaced with design-system-react at runtime const Example = React.createClass({ displayName: 'CheckboxExample', render () { return ( <div className="slds-grid slds-grid--pull-padded slds-grid--vertical-align-center"> <div className="slds-col--padded"> <Checkbox assistiveText="Default" label="Default" /> </div> <div className="slds-col--padded"> <Checkbox assistiveText="Indeterminate" indeterminate label="Indeterminate" /> </div> <div className="slds-col--padded"> <Checkbox assistiveText="Indeterminate" label="Required" required /> </div> <div className="slds-col--padded"> <Checkbox assistiveText="Disabled" label="Disabled" disabled /> </div> </div> ); } }); export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
import React from 'react'; import Checkbox from '~/components/forms/checkbox'; // `~` is replaced with design-system-react at runtime const Example = React.createClass({ displayName: 'CheckboxExample', render () { return ( <div className="slds-grid slds-grid--pull-padded slds-grid--vertical-align-center"> <div className="slds-col--padded"> <Checkbox assistiveText="Default" label="Default" /> </div> <div className="slds-col--padded"> <Checkbox assistiveText="Indeterminate" indeterminate label="Indeterminate" /> </div> <div className="slds-col--padded"> <Checkbox assistiveText="Indeterminate" label="Required" required /> </div> <div className="slds-col--padded"> <Checkbox assistiveText="Disabled" label="Disabled" disabled /> </div> </div> ); } }); export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
Update doc site example checkbox import
Update doc site example checkbox import
JSX
bsd-3-clause
salesforce/design-system-react,salesforce/design-system-react,salesforce/design-system-react
--- +++ @@ -1,5 +1,5 @@ import React from 'react'; -import Checkbox from '~/components/checkbox'; // `~` is replaced with design-system-react at runtime +import Checkbox from '~/components/forms/checkbox'; // `~` is replaced with design-system-react at runtime const Example = React.createClass({ displayName: 'CheckboxExample',
6072c763d88f102c5f887b82f5978289aaae1090
ui/js/component/NavMenu.jsx
ui/js/component/NavMenu.jsx
'use strict'; var React = require('react'); var MenuControl = require('mixin/MenuControl'); var NavMenu = React.createClass({ mixins : [ require('mixin/MenuControl') ], propTypes : { text : React.PropTypes.string.isRequired, icon : React.PropTypes.string }, render : function () { var display = !!this.props.icon ? (<span><i className={'fa fa-lg ' + this.props.icon}></i>&ensp;{this.props.text}</span>) : (<span>{this.props.text}</span>); return ( <span> <a onClick={this._toggleMenu}> {display}&emsp;<i className='fa fa-chevron-down'></i> </a> </span> ); } }); module.exports = NavMenu;
'use strict'; var React = require('react'); var MenuControl = require('mixin/MenuControl'); var NavMenu = React.createClass({ mixins : [ require('mixin/MenuControl') ], propTypes : { text : React.PropTypes.string.isRequired, icon : React.PropTypes.string }, render : function () { var display = !!this.props.icon ? (<span><i className={'fa fa-lg ' + this.props.icon}></i>&ensp;{this.props.text}</span>) : (<span>{this.props.text}</span>); return ( <a onClick={this._toggleMenu} onBlur={this._onBlur} tabIndex='-1'> {display}&emsp;<i className='fa fa-chevron-down'></i> </a> ); }, componentDidUpdate : function () { if (this.state.open) { React.findDOMNode(this).focus(); } }, _onBlur : function () { this.setState({ open : false }); } }); module.exports = NavMenu;
Use blur to close open menus
Use blur to close open menus
JSX
agpl-3.0
SeedScientific/polio,SeedScientific/polio,SeedScientific/polio,unicef/polio,unicef/polio,unicef/rhizome,unicef/rhizome,unicef/rhizome,unicef/polio,SeedScientific/polio,unicef/rhizome,SeedScientific/polio,unicef/polio
--- +++ @@ -20,12 +20,20 @@ (<span>{this.props.text}</span>); return ( - <span> - <a onClick={this._toggleMenu}> - {display}&emsp;<i className='fa fa-chevron-down'></i> - </a> - </span> + <a onClick={this._toggleMenu} onBlur={this._onBlur} tabIndex='-1'> + {display}&emsp;<i className='fa fa-chevron-down'></i> + </a> ); + }, + + componentDidUpdate : function () { + if (this.state.open) { + React.findDOMNode(this).focus(); + } + }, + + _onBlur : function () { + this.setState({ open : false }); } });
f24ff717b6167eccde85aab9ecba974cdd2ba36b
src/components/ContactForm.jsx
src/components/ContactForm.jsx
import React from 'react'; export default () => ( <form name="contact" method="POST" data-netlify="true" action="/"> <p> <label>Your Name: <input type="text" name="name" /></label> </p> <p> <label>Your Email: <input type="email" name="email" /></label> </p> <p> <label>Message: <textarea name="message"></textarea></label> </p> <p> <button type="submit">Send</button> </p> </form> );
import React from 'react'; export default () => ( <form name="contact" method="POST" data-netlify="true" action="/"> <input type="hidden" name="contact" value="contact" /> <p> <label>Your Name: <input type="text" name="name" /></label> </p> <p> <label>Your Email: <input type="email" name="email" /></label> </p> <p> <label>Message: <textarea name="message"></textarea></label> </p> <p> <button type="submit">Send</button> </p> </form> );
Add hidden input w/ name
Add hidden input w/ name
JSX
mit
snirp/royprins.com
--- +++ @@ -2,6 +2,7 @@ export default () => ( <form name="contact" method="POST" data-netlify="true" action="/"> + <input type="hidden" name="contact" value="contact" /> <p> <label>Your Name: <input type="text" name="name" /></label> </p>
1ffb9723869013998a9795ebd64ce497fb269e83
src/DayHeader.jsx
src/DayHeader.jsx
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import withAvailableWidth from 'react-with-available-width'; import day from './Day'; import styles from './DayHeader.css'; class DayHeader extends Component { render() { const { day, availableWidth, } = this.props; return ( <div className={styles.component} > {availableWidth > 40 && day.name} {availableWidth < 40 && day.abbreviated} </div> ) } } DayHeader.propTypes = { day: PropTypes.instanceOf(Date), availableWidth: PropTypes.number, }; export default withAvailableWidth(DayHeader);
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import withAvailableWidth from 'react-with-available-width'; import day from './Day'; import styles from './DayHeader.css'; class DayHeader extends Component { render() { const { day, availableWidth, } = this.props; return ( <div className={styles.component} > {availableWidth >= 80 && day.name} {availableWidth < 80 && day.abbreviated} </div> ) } } DayHeader.propTypes = { day: PropTypes.instanceOf(Date), availableWidth: PropTypes.number, }; export default withAvailableWidth(DayHeader);
Adjust breakpoint for day names in header
Adjust breakpoint for day names in header So that Wednesday fits.
JSX
mit
trotzig/react-available-times,trotzig/react-available-times
--- +++ @@ -16,8 +16,8 @@ <div className={styles.component} > - {availableWidth > 40 && day.name} - {availableWidth < 40 && day.abbreviated} + {availableWidth >= 80 && day.name} + {availableWidth < 80 && day.abbreviated} </div> ) }
5f3a1aa872300e62c0fdec893dd2c21d1328b034
src/js/hca-rjsf/hca-rjsf-entry.jsx
src/js/hca-rjsf/hca-rjsf-entry.jsx
import React from 'react'; import ReactDOM from 'react-dom'; import { createHistory } from 'history'; import { Router, useRouterHistory } from 'react-router'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; import initReact from '../common/init-react'; import route from './routes'; import reducer from './reducer'; require('../common'); require('../../sass/hca.scss'); require('../../sass/edu-benefits.scss'); require('../login/login-entry.jsx'); let store; if (__BUILDTYPE__ === 'development' && window.devToolsExtension) { store = createStore(reducer, compose(applyMiddleware(thunk), window.devToolsExtension())); } else { store = createStore(reducer, compose(applyMiddleware(thunk))); } // TODO: Change the basename path once we replace hca with this form // (should be 'healthcare/appy/application') const browserHistory = useRouterHistory(createHistory)({ basename: '/healthcare/rjsf' }); function init() { ReactDOM.render(( <Provider store={store}> <Router history={browserHistory}> {route} </Router> </Provider> ), document.getElementById('react-root')); } // Start react. initReact(init);
import React from 'react'; import ReactDOM from 'react-dom'; import { createHistory } from 'history'; import { Router, useRouterHistory } from 'react-router'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; import initReact from '../common/init-react'; import route from './routes'; import reducer from './reducer'; require('../common'); require('../../sass/hca.scss'); require('../../sass/edu-benefits.scss'); require('../login/login-entry.jsx'); let store; if (__BUILDTYPE__ === 'development' && window.devToolsExtension) { store = createStore(reducer, compose(applyMiddleware(thunk), window.devToolsExtension())); } else { store = createStore(reducer, compose(applyMiddleware(thunk))); } // Change the basename path once we replace hca with this form // (should be 'healthcare/appy/application') const browserHistory = useRouterHistory(createHistory)({ basename: '/healthcare/rjsf' }); function init() { ReactDOM.render(( <Provider store={store}> <Router history={browserHistory}> {route} </Router> </Provider> ), document.getElementById('react-root')); } // Start react. initReact(init);
Remove TODO because code climate failure bothers me
Remove TODO because code climate failure bothers me
JSX
cc0-1.0
department-of-veterans-affairs/vets-website,department-of-veterans-affairs/vets-website
--- +++ @@ -23,7 +23,7 @@ store = createStore(reducer, compose(applyMiddleware(thunk))); } -// TODO: Change the basename path once we replace hca with this form +// Change the basename path once we replace hca with this form // (should be 'healthcare/appy/application') const browserHistory = useRouterHistory(createHistory)({ basename: '/healthcare/rjsf'
6e7b54f91416b073aa8def4907384d2e9d375108
public/app/screens/main/sections/device-list/devices.jsx
public/app/screens/main/sections/device-list/devices.jsx
var React = require('react'); var Reflux = require('reflux'); var Room = require('./room'); var DeviceFinder = require('./device-finder'); var Button = require('common/components/controls/button'); var roomStore = require('stores/room'); var roomActions = require('actions/room'); var styleMixin = require('mixins/style-mixin'); var DevicesSection = React.createClass({ mixins: [ styleMixin(require('./style.scss')), Reflux.connect(roomStore, 'rooms') ], render: function render () { return ( <div className='cc-devices grid-14 padded'> <div className='row fixed-height-3'> <div className='columns'> <DeviceFinder /> </div> </div> { this.state.rooms.map((room) => <Room title={ room.title } /> ) } </div> ); }, handleAddRoom: function handleAddRoom () { roomActions.createRoom(); } }); module.exports = DevicesSection;
var React = require('react'); var Reflux = require('reflux'); var Room = require('./room'); var DeviceFinder = require('./device-finder'); var Button = require('common/components/controls/button'); var roomStore = require('stores/room'); var roomActions = require('actions/room'); var styleMixin = require('mixins/style-mixin'); var DevicesSection = React.createClass({ mixins: [ styleMixin(require('./style.scss')), Reflux.connect(roomStore, 'rooms') ], render: function render () { return ( <div className='cc-devices grid-14 padded'> <div className='row fixed-height-3'> <div className='columns'> <DeviceFinder /> </div> </div> { this.state.rooms.map((room, index) => <Room title={room.title} key={index} /> ) } </div> ); }, handleAddRoom: function handleAddRoom () { roomActions.createRoom(); } }); module.exports = DevicesSection;
Add keys to the Rooms list
Add keys to the Rooms list
JSX
mit
yetu/controlcenter,yetu/controlcenter,yetu/controlcenter
--- +++ @@ -26,8 +26,8 @@ </div> </div> { - this.state.rooms.map((room) => - <Room title={ room.title } /> + this.state.rooms.map((room, index) => + <Room title={room.title} key={index} /> ) } </div>
8b4293dcb97f2c7b423897a3dac8ae404a761871
app/assets/javascripts/components/quilleditor.js.jsx
app/assets/javascripts/components/quilleditor.js.jsx
var QuillEditor = React.createClass({ componentDidMount: function () { let self = this; // Add getHtml function to get html from editor textarea. Quill.prototype.getHtml = function () { return this.container.querySelector('.ql-editor').innerHTML; }; this.initQuillEditor(); this.quill.clipboard.dangerouslyPasteHTML(this.props.text); this.bindQuillEditorEvent(); }, initQuillEditor: function () { this.quill = new Quill('#' + this.props.elementId, { modules: { toolbar: [ ['bold', 'italic', 'underline', 'link'] ], clipboard: true }, placeholder: 'Enter text here...', theme: 'snow' }); }, bindQuillEditorEvent: function () { let self = this; this.quill.on('text-change', function (delta, oldDelta, source) { if (source == 'user') { self.props.handleInput(self.quill.getHtml()); } }); }, render: function () { return ( <div className="QuillEditor"> <div id={this.props.elementId}> </div> </div> ) } });
var QuillEditor = React.createClass({ componentDidMount: function () { let self = this; // Add getHtml function to get html from editor textarea. Quill.prototype.getHtml = function () { return this.container.querySelector('.ql-editor').innerHTML; }; this.initQuillEditor(); this.quill.clipboard.dangerouslyPasteHTML(this.props.text); this.bindQuillEditorEvent(); }, componentWillUpdate: function (nextProps) { if(nextProps.text == '') { this.quill.setContents([{ insert: '\n' }]); } }, initQuillEditor: function () { this.quill = new Quill('#' + this.props.elementId, { modules: { toolbar: [ ['bold', 'italic', 'underline', 'link'] ], clipboard: true }, placeholder: 'Enter text here...', theme: 'snow' }); }, bindQuillEditorEvent: function () { let self = this; this.quill.on('text-change', function (delta, oldDelta, source) { console.log(source, delta); if (source == 'user') { self.props.handleInput(self.quill.getHtml()); } }); }, render: function () { return ( <div className="QuillEditor"> <div id={this.props.elementId}> </div> </div> ) } });
Clear content on empty string.
Clear content on empty string.
JSX
mit
kirillis/mytopten,kirillis/mytopten,krisimmig/mytopten,krisimmig/mytopten,krisimmig/mytopten,kirillis/mytopten
--- +++ @@ -10,6 +10,12 @@ this.initQuillEditor(); this.quill.clipboard.dangerouslyPasteHTML(this.props.text); this.bindQuillEditorEvent(); + }, + + componentWillUpdate: function (nextProps) { + if(nextProps.text == '') { + this.quill.setContents([{ insert: '\n' }]); + } }, initQuillEditor: function () { @@ -28,6 +34,7 @@ bindQuillEditorEvent: function () { let self = this; this.quill.on('text-change', function (delta, oldDelta, source) { + console.log(source, delta); if (source == 'user') { self.props.handleInput(self.quill.getHtml()); }
c20db55f734cede42488a3d85c2e2a6f1cf5d956
client/src/index.jsx
client/src/index.jsx
import React from 'react'; import { render } from 'react-dom'; import { Router, Route, IndexRoute, hashHistory } from 'react-router'; import injectTapEventPlugin from 'react-tap-event-plugin'; import App from './containers/App'; import LandingPage from './containers/LandingPage'; import Nav from './containers/Nav'; import Login from './containers/Login'; import Signup from './containers/Signup'; import SelectInstrument from './containers/SelectInstrument'; import SelectRoom from './containers/SelectRoom'; import JamRoom from './containers/JamRoom'; // Needed for onTouchTap // http://stackoverflow.com/a/34015469/988941 injectTapEventPlugin(); const NavAndLandingPage = () => { return ( <div> <Nav change={this.toggleView} /> <LandingPage change={this.toggleView} /> </div> ); }; render(( <Router history={hashHistory}> <Route path="/" component={App}> <IndexRoute component={NavAndLandingPage} /> <Route path="login" component={Login} /> <Route path="signup" component={Signup} /> <Route path="selectInstrument" component={SelectInstrument} /> <Route path="selectRoom" component={SelectRoom} /> <Route path="jam" component={JamRoom} /> </Route> </Router> ), document.getElementById('app'));
import React from 'react'; import { render } from 'react-dom'; import { Router, Route, IndexRoute, browserHistory } from 'react-router'; import injectTapEventPlugin from 'react-tap-event-plugin'; import App from './containers/App'; import LandingPage from './containers/LandingPage'; import Nav from './containers/Nav'; import Login from './containers/Login'; import Signup from './containers/Signup'; import SelectInstrument from './containers/SelectInstrument'; import SelectRoom from './containers/SelectRoom'; import JamRoom from './containers/JamRoom'; // Needed for onTouchTap // http://stackoverflow.com/a/34015469/988941 injectTapEventPlugin(); const NavAndLandingPage = () => { return ( <div> <Nav /> <LandingPage /> </div> ); }; render(( <Router history={browserHistory}> <Route path="/" component={App}> <IndexRoute component={NavAndLandingPage} /> <Route path="login" component={Login} /> <Route path="signup" component={Signup} /> <Route path="selectInstrument" component={SelectInstrument} /> <Route path="selectRoom" component={SelectRoom} /> <Route path="jam" component={JamRoom} /> </Route> </Router> ), document.getElementById('app'));
Use browserHistory instead of hashHistory
Use browserHistory instead of hashHistory
JSX
mit
NerdDiffer/reprise,NerdDiffer/reprise,NerdDiffer/reprise
--- +++ @@ -1,6 +1,6 @@ import React from 'react'; import { render } from 'react-dom'; -import { Router, Route, IndexRoute, hashHistory } from 'react-router'; +import { Router, Route, IndexRoute, browserHistory } from 'react-router'; import injectTapEventPlugin from 'react-tap-event-plugin'; import App from './containers/App'; @@ -19,14 +19,14 @@ const NavAndLandingPage = () => { return ( <div> - <Nav change={this.toggleView} /> - <LandingPage change={this.toggleView} /> + <Nav /> + <LandingPage /> </div> ); }; render(( - <Router history={hashHistory}> + <Router history={browserHistory}> <Route path="/" component={App}> <IndexRoute component={NavAndLandingPage} /> <Route path="login" component={Login} />
36e44ec49092eb17a8a4100ee532ad3221d2bb44
src/page-viewer/index.jsx
src/page-viewer/index.jsx
import React, { PropTypes } from 'react' export const localVersionAvailable = ({page}) => ( !!page.html ) export const LinkToLocalVersion = ({page, children, ...props}) => ( <a href={`data:text/html;charset=UTF-8,${page.html}`} title='Stored text version available' {...props} > {children} </a> ) LinkToLocalVersion.propTypes = { page: PropTypes.object.isRequired, children: PropTypes.node, }
import React, { PropTypes } from 'react' export const localVersionAvailable = ({page}) => ( !!page.html ) export const LinkToLocalVersion = ({page, children, ...props}) => ( <a href={URL.createObjectURL(new Blob([page.html], {type: 'text/html;charset=UTF-8'}))} title='Stored text version available' {...props} > {children} </a> ) LinkToLocalVersion.propTypes = { page: PropTypes.object.isRequired, children: PropTypes.node, }
Use blob URI for saved version href.
Use blob URI for saved version href.
JSX
mit
WorldBrain/WebMemex,WorldBrain/WebMemex
--- +++ @@ -6,7 +6,7 @@ export const LinkToLocalVersion = ({page, children, ...props}) => ( <a - href={`data:text/html;charset=UTF-8,${page.html}`} + href={URL.createObjectURL(new Blob([page.html], {type: 'text/html;charset=UTF-8'}))} title='Stored text version available' {...props} >
3b023bb0e36352378b779c658ee2c18eb4d48acd
src/request/components/request-detail-panel-execution.jsx
src/request/components/request-detail-panel-execution.jsx
'use strict'; var React = require('react'); var subItem = function (data, title, level) { var results = {}; for (var key in data) { var value = data[key] || '--'; if (key == 'type' && level == 0) { title = value; } else if (typeof value === 'object') { results[key] = subItem(value, key, level + 1); } else { results[key] = <span><strong>{key}:</strong> {value} &nbsp; </span>; } } return ( <table> <tr> <th>{title}</th> <td> &nbsp; &nbsp; &nbsp; </td> <td>{results}</td> </tr> </table> ); }; module.exports = React.createClass({ render: function () { var output = this.props.data.payload.map(function (item) { var result = subItem(item, 'Row', 0); return <div>{result}<br /><br /></div>; }); return <div>{output}</div>; } }); // TODO: Need to come up with a better self registration process (function () { var requestTabController = require('../request-tab'); requestTabController.registerTab({ key: 'tab.execution', component: module.exports }); })();
'use strict'; var React = require('react'); var subItem = function (data, title, level) { var results = []; for (var key in data) { var value = data[key] || '--'; if (key == 'type' && level == 0) { title = value; } else if (typeof value === 'object') { results.push(subItem(value, key, level + 1)); } else { results.push(<span><strong>{key}:</strong> {value} &nbsp; </span>); } } return ( <table> <tr> <th>{title}</th> <td> &nbsp; &nbsp; &nbsp; </td> <td>{results}</td> </tr> </table> ); }; module.exports = React.createClass({ render: function () { var output = this.props.data.payload.map(function (item) { var result = subItem(item, 'Row', 0); return <div>{result}<br /><br /></div>; }); return <div>{output}</div>; } }); // TODO: Need to come up with a better self registration process (function () { var requestTabController = require('../request-tab'); requestTabController.registerTab({ key: 'tab.execution', component: module.exports }); })();
Fix bug warning from react about usage of dict
Fix bug warning from react about usage of dict
JSX
unknown
avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype
--- +++ @@ -3,17 +3,17 @@ var React = require('react'); var subItem = function (data, title, level) { - var results = {}; + var results = []; for (var key in data) { var value = data[key] || '--'; if (key == 'type' && level == 0) { title = value; } else if (typeof value === 'object') { - results[key] = subItem(value, key, level + 1); + results.push(subItem(value, key, level + 1)); } else { - results[key] = <span><strong>{key}:</strong> {value} &nbsp; </span>; + results.push(<span><strong>{key}:</strong> {value} &nbsp; </span>); } }
bb378932a7e7eda8db5fe3fe5d13bdc267e60d52
client/src/components/UserNameInputBox.jsx
client/src/components/UserNameInputBox.jsx
import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import { Card } from 'material-ui/Card'; import TextField from 'material-ui/TextField'; class UserNameInputBox extends React.Component { constructor (props) { super(props); this.state = { userName: '', userNameExists: false, error: '' }; this.change = this.change.bind(this); this.passDataToCreateUser = this.passDataToCreateUser.bind(this); } change(e) { this.setState ({ userName: e.target.value, userNameExists: true }); } passDataToCreateUser() { this.props.dataFromInputBox({userName: this.state.userName, userNameExists: this.state.userNameExists}); this.props.buttonClicked(true); } render () { return ( <div> <TextField type="text" floatingLabelText="Name" errorText={this.props.error} onChange={this.change}></TextField> <div> <RaisedButton className="somePadding" secondary={true} label="Submit" onClick={(e)=>{ this.passDataToCreateUser(); }}></RaisedButton> </div> </div> ); } } export default UserNameInputBox;
import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import { Card } from 'material-ui/Card'; import TextField from 'material-ui/TextField'; class UserNameInputBox extends React.Component { constructor (props) { super(props); this.state = { userName: '', userNameExists: false, error: '' }; this.change = this.change.bind(this); this.passDataToCreateUser = this.passDataToCreateUser.bind(this); } change(e) { this.setState ({ userName: e.target.value, userNameExists: true }); } passDataToCreateUser() { this.props.dataFromInputBox({userName: this.state.userName, userNameExists: this.state.userNameExists}); this.setState({ userName: '' }); this.props.buttonClicked(true); } render () { return ( <div> <TextField type="text" floatingLabelText="Name" errorText={this.props.error} onChange={this.change} value={this.state.userName}></TextField> <div> <RaisedButton className="somePadding" secondary={true} label="Submit" onClick={(e)=>{ this.passDataToCreateUser(); }}></RaisedButton> </div> </div> ); } } export default UserNameInputBox;
Update InputField to empty on submit button click
Update InputField to empty on submit button click
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -26,6 +26,9 @@ passDataToCreateUser() { this.props.dataFromInputBox({userName: this.state.userName, userNameExists: this.state.userNameExists}); + this.setState({ + userName: '' + }); this.props.buttonClicked(true); } @@ -33,7 +36,7 @@ return ( <div> - <TextField type="text" floatingLabelText="Name" errorText={this.props.error} onChange={this.change}></TextField> + <TextField type="text" floatingLabelText="Name" errorText={this.props.error} onChange={this.change} value={this.state.userName}></TextField> <div> <RaisedButton className="somePadding" secondary={true} label="Submit" onClick={(e)=>{ this.passDataToCreateUser(); }}></RaisedButton> </div>
04236e881e760a95077deec46a60fedada2a7a31
lib/Root.jsx
lib/Root.jsx
import React, { PropTypes } from 'react' //import { Redirect, Router, Route } from 'react-router' import { Provider } from 'redux/react' //import { createDispatcher, createRedux, composeStores } from 'redux' //import { loggerMiddleware, thunkMiddleware } from './middleware' //import * as components from './components' //import * as stores from './stores' // //const { // Application, // About, // GithubStargazers, // GithubRepo, // GithubUser //} = components //const dispatcher = createDispatcher( // composeStores(stores), // getState => [ thunkMiddleware(getState), loggerMiddleware ] //) //const redux = createRedux(dispatcher) // class Root extends React.Component { // //static propTypes = { // history: PropTypes.object.isRequired //} render () { //const { history } = this.props return ( <Provider> <h1>Emoji App</h1> </Provider> ) } } Root.contextTypes = { history: PropTypes.object.isRequired } export default Root //function renderRoutes (history) { // return ( // <Router history={history}> // <Route component={Application}> // <Route path="about" component={About} /> // <Route path="stargazers" component={GithubStargazers}> // <Route name='repo' path=':username/:repo' component={GithubRepo} /> // <Route name='user' path=':username' component={GithubUser} /> // </Route> // <Redirect from="/" to="/stargazers/emmenko" /> // </Route> // </Router> // ) //}
import React, { PropTypes } from 'react' import { Redirect, Router, Route } from 'react-router' import { Provider } from 'redux/react' import { createDispatcher, createRedux, composeStores } from 'redux' import { loggerMiddleware, thunkMiddleware } from './middleware' import * as components from './components' import * as stores from './stores' const { Application, About, GithubStargazers, GithubRepo, GithubUser } = components const dispatcher = createDispatcher( composeStores(stores), getState => [ thunkMiddleware(getState), loggerMiddleware ] ) const redux = createRedux(dispatcher) export default class Root extends React.Component { static propTypes = { history: PropTypes.object.isRequired } render () { const { history } = this.props return ( <Provider redux={redux}> {renderRoutes.bind(null, history)} </Provider> ) } } function renderRoutes (history) { return ( <Router history={history}> <Route component={Application}> <Route path="about" component={About} /> <Route path="stargazers" component={GithubStargazers}> <Route name='repo' path=':username/:repo' component={GithubRepo} /> <Route name='user' path=':username' component={GithubUser} /> </Route> <Redirect from="/" to="/stargazers/emmenko" /> </Route> </Router> ) }
Revert "chore(lib): comment out unnecessary code"
Revert "chore(lib): comment out unnecessary code" This reverts commit eb84f62ec9a654f4d01d58b8283bfd91d36d0307.
JSX
mit
lyrictenor/nwjs-emoji-app,togusafish/lyrictenor-_-nwjs-emoji-app,togusafish/lyrictenor-_-nwjs-emoji-app,lyrictenor/nwjs-emoji-app
--- +++ @@ -1,56 +1,51 @@ import React, { PropTypes } from 'react' -//import { Redirect, Router, Route } from 'react-router' +import { Redirect, Router, Route } from 'react-router' import { Provider } from 'redux/react' -//import { createDispatcher, createRedux, composeStores } from 'redux' -//import { loggerMiddleware, thunkMiddleware } from './middleware' -//import * as components from './components' -//import * as stores from './stores' -// -//const { -// Application, -// About, -// GithubStargazers, -// GithubRepo, -// GithubUser -//} = components -//const dispatcher = createDispatcher( -// composeStores(stores), -// getState => [ thunkMiddleware(getState), loggerMiddleware ] -//) -//const redux = createRedux(dispatcher) -// -class Root extends React.Component { - // - //static propTypes = { - // history: PropTypes.object.isRequired - //} +import { createDispatcher, createRedux, composeStores } from 'redux' +import { loggerMiddleware, thunkMiddleware } from './middleware' +import * as components from './components' +import * as stores from './stores' + +const { + Application, + About, + GithubStargazers, + GithubRepo, + GithubUser + } = components +const dispatcher = createDispatcher( + composeStores(stores), + getState => [ thunkMiddleware(getState), loggerMiddleware ] +) +const redux = createRedux(dispatcher) + +export default class Root extends React.Component { + + static propTypes = { + history: PropTypes.object.isRequired + } render () { - //const { history } = this.props + const { history } = this.props return ( - <Provider> - <h1>Emoji App</h1> + <Provider redux={redux}> + {renderRoutes.bind(null, history)} </Provider> ) } } -Root.contextTypes = { - history: PropTypes.object.isRequired +function renderRoutes (history) { + return ( + <Router history={history}> + <Route component={Application}> + <Route path="about" component={About} /> + <Route path="stargazers" component={GithubStargazers}> + <Route name='repo' path=':username/:repo' component={GithubRepo} /> + <Route name='user' path=':username' component={GithubUser} /> + </Route> + <Redirect from="/" to="/stargazers/emmenko" /> + </Route> + </Router> + ) } - -export default Root -//function renderRoutes (history) { -// return ( -// <Router history={history}> -// <Route component={Application}> -// <Route path="about" component={About} /> -// <Route path="stargazers" component={GithubStargazers}> -// <Route name='repo' path=':username/:repo' component={GithubRepo} /> -// <Route name='user' path=':username' component={GithubUser} /> -// </Route> -// <Redirect from="/" to="/stargazers/emmenko" /> -// </Route> -// </Router> -// ) -//}
0dc6a3149732fb86bcc81dc78117e136bfb1da8f
templates/PaginationPage.jsx
templates/PaginationPage.jsx
import React from "react" import BlogPostSummary from "../../components/BlogPostSummary" import Link from "../../components/Link" const pageData = {} export default () => ( <div> { pageData.blogPosts && pageData.blogPosts.map(({ file, formattedDate, path, title }, index) => ( <BlogPostSummary key={index} path={path} title={title} formattedDate={formattedDate} content={require(`../blog/${file}`).intro} /> )) } {pageData.nextPage && <div className="moreLink"><Link to={pageData.nextPage}>Older Stories...</Link></div> } </div> )
import React from "react" import BlogPostSummary from "../../components/BlogPostSummary" import Link from "../../components/Link" const pageData = {} export default () => ( <div> { pageData.blogPosts && pageData.blogPosts.map(({ file, formattedDate, path, title }, index) => ( <BlogPostSummary key={index} path={path} title={title} formattedDate={formattedDate} content={require(`../blog/${file}`).intro} /> )) } {pageData.previousPage && <div className="previousLink"><Link to={pageData.previousPage}>{"< Newer Stories"}</Link></div> } {pageData.nextPage && <div className="moreLink"><Link to={pageData.nextPage}>{"Older Stories >"}</Link></div> } </div> )
Tweak older and newer links
Tweak older and newer links
JSX
mit
lparry/blog-3.0
--- +++ @@ -17,8 +17,11 @@ /> )) } + {pageData.previousPage && + <div className="previousLink"><Link to={pageData.previousPage}>{"< Newer Stories"}</Link></div> + } {pageData.nextPage && - <div className="moreLink"><Link to={pageData.nextPage}>Older Stories...</Link></div> + <div className="moreLink"><Link to={pageData.nextPage}>{"Older Stories >"}</Link></div> } </div> )
2fe732f943f2333efc34f312fc9127532c02211b
src/app/routes/routes.jsx
src/app/routes/routes.jsx
'use strict'; import App from '../components/app.jsx'; import HomeContainer from '../components/home-container.jsx'; import MapContainer from '../components/map-container.jsx'; const Routes = { path: '/', component: App, indexRoute: { component: HomeContainer }, childRoutes: [ { path: 'maps/', component: HomeContainer }, { path: 'maps/:urlString', component: MapContainer } ] }; export default Routes;
'use strict'; import App from '../components/app.jsx'; import HomeContainer from '../components/home-container.jsx'; import MapContainer from '../components/map-container.jsx'; const Routes = { path: '/', component: App, indexRoute: { component: HomeContainer }, childRoutes: [ { path: 'maps/', component: HomeContainer }, { path: 'maps/:mapId', component: MapContainer } ] }; export default Routes;
Change route param to ID
Change route param to ID
JSX
mit
jkrayer/poc-map-points,jkrayer/poc-map-points
--- +++ @@ -10,7 +10,7 @@ indexRoute: { component: HomeContainer }, childRoutes: [ { path: 'maps/', component: HomeContainer }, - { path: 'maps/:urlString', component: MapContainer } + { path: 'maps/:mapId', component: MapContainer } ] };
f363dd94d468e00ca7d5a61d0f031d3e76e2dbe8
app/scripts/components/Partners/index.jsx
app/scripts/components/Partners/index.jsx
import React from 'react'; import Article from '../Content/Article'; import Thumbnail from '../Thumbnails/Thumbnail'; function Partners(props) { return ( <div className="c-partners"> <Article grid="small-12"> <div className="row align-stretch"> {props.data.map((partner, i)=>{ return ( <div className="columns small-12 medium-4" key={i}> <div className="c-article-module"> <Thumbnail url={partner.url} src={config.apiUrl + partner.logo_medium} alt={partner.name} border={'neutral'} /> <h3>{partner.name}</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam egestas sollicitudin pulvinar. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nunc pharetra, tortor a imperdiet ultrices, nunc augue ornare lacus, quis ultrices sem lorem id sapien. Sed sodales vitae nisl ut consectetur.</p> </div> </div> ); })} </div> </Article> </div> ); } export default Partners;
import React from 'react'; import Article from '../Content/Article'; import Thumbnail from '../Thumbnails/Thumbnail'; function Partners(props) { return ( <div className="c-partners"> <Article grid="small-12"> <div className="row align-stretch"> {props.data.map((partner, i)=>{ return ( <div className="columns small-12 medium-4" key={i}> <div className="c-article-module"> <Thumbnail url={partner.url} src={config.apiUrl + partner.logo_large} alt={partner.name} border={'neutral'} /> <h3>{partner.name}</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam egestas sollicitudin pulvinar. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nunc pharetra, tortor a imperdiet ultrices, nunc augue ornare lacus, quis ultrices sem lorem id sapien. Sed sodales vitae nisl ut consectetur.</p> </div> </div> ); })} </div> </Article> </div> ); } export default Partners;
Use logo large in partners page
Use logo large in partners page
JSX
mit
resource-watch/prep-app,resource-watch/prep-app
--- +++ @@ -15,7 +15,7 @@ <div className="c-article-module"> <Thumbnail url={partner.url} - src={config.apiUrl + partner.logo_medium} + src={config.apiUrl + partner.logo_large} alt={partner.name} border={'neutral'} />
b00c732570ed4cfad5587811f32c30e98d087a24
web/static/js/components/stage_change_info_action_items.jsx
web/static/js/components/stage_change_info_action_items.jsx
import React from "react" export default () => ( <div> The skinny on Action-Item Generation: <div className="ui basic segment"> <ul className="ui list"> <li>Discuss the highest-voted items on the board. <ul> <li> <small> <strong>Protip: </strong> let discussions breathe, conducting root cause analyses where appropriate. </small> </li> </ul> </li> <li>Generate action-items aimed at: <ul> <li>exploding the team's bottlenecks</li> <li>bolstering the team's successes</li> </ul> </li> </ul> </div> </div> )
import React from "react" export default () => ( <div> The skinny on Action-Item Generation: <div className="ui basic segment"> <ul className="ui list"> <li>Discuss the highest-voted items on the board.</li> <li>Generate action-items aimed at: <ul> <li>exploding the team's bottlenecks</li> <li>bolstering the team's successes</li> </ul> </li> <li> If you're physically present in the room with the facilitator, put your laptop away so you can focus. </li> </ul> </div> </div> )
Update action items stage prompt such that folks put their laptops away
Update action items stage prompt such that folks put their laptops away
JSX
mit
stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro
--- +++ @@ -5,22 +5,17 @@ The skinny on Action-Item Generation: <div className="ui basic segment"> <ul className="ui list"> - <li>Discuss the highest-voted items on the board. - <ul> - <li> - <small> - <strong>Protip: </strong> - let discussions breathe, conducting root cause analyses where appropriate. - </small> - </li> - </ul> - </li> + <li>Discuss the highest-voted items on the board.</li> <li>Generate action-items aimed at: <ul> <li>exploding the team's bottlenecks</li> <li>bolstering the team's successes</li> </ul> </li> + <li> + If you're physically present in the room with the facilitator, put + your laptop away so you can focus. + </li> </ul> </div> </div>
96e0cf9af7b49c4cfc2131f9ab1581190292b405
src/shell/components/shell-view.jsx
src/shell/components/shell-view.jsx
var React = require('react'), glimpse = require('glimpse'); module.exports = React.createClass({ _applicationAdded: function() { this.forceUpdate(); }, componentDidMount: function() { this._applicationAddedOn = glimpse.on('shell.application.added', this._applicationAdded); }, componentWillUnmount: function() { glimpse.off(this._applicationAddedOn); }, render: function() { return ( <div className="application-holder hjhjh"> {this.props.applications} </div> ); } });
var React = require('react'), glimpse = require('glimpse'); module.exports = React.createClass({ _applicationAdded: function() { this.forceUpdate(); }, componentDidMount: function() { this._applicationAddedOn = glimpse.on('shell.application.added', this._applicationAdded); }, componentWillUnmount: function() { glimpse.off(this._applicationAddedOn); }, render: function() { return ( <div className="application-holder"> {this.props.applications} </div> ); } });
Remove dud class on app container
Remove dud class on app container
JSX
unknown
Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype
--- +++ @@ -13,7 +13,7 @@ }, render: function() { return ( - <div className="application-holder hjhjh"> + <div className="application-holder"> {this.props.applications} </div> );
2f9a4ae19408792eb0a1a99ac6616e87bec8fb85
client/components/pages/HomePage.jsx
client/components/pages/HomePage.jsx
import React, { Component } from 'react'; import NavBar from '../includes/navbar'; import AuthForm from '../auth/AuthForm'; import { connect } from 'react-redux'; class HomePage extends Component { render() { if(localStorage.getItem('token')){ window.location.href='/dashboard' } return ( <div> <NavBar /> <AuthForm message = {this.props.message}/> </div> ); } } function mapStateToProps(state){ return { message: state.auth.message } } export default connect(mapStateToProps)(HomePage);
import React, { Component } from 'react'; import NavBar from '../includes/NavBar'; import AuthForm from '../auth/AuthForm'; import { connect } from 'react-redux'; class HomePage extends Component { render() { if(localStorage.getItem('token')){ window.location.href='/dashboard' } return ( <div> <NavBar /> <AuthForm message = {this.props.message}/> </div> ); } } function mapStateToProps(state){ return { message: state.auth.message } } export default connect(mapStateToProps)(HomePage);
Fix heroku build from failing
Fix heroku build from failing
JSX
mit
nosisky/Hello-Books,nosisky/Hello-Books
--- +++ @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import NavBar from '../includes/navbar'; +import NavBar from '../includes/NavBar'; import AuthForm from '../auth/AuthForm'; import { connect } from 'react-redux';
743280ef8aef1ccbeb6ed800db17ba59a65ca354
src/client/components/MyInvestmentProjects/InvestmentList.jsx
src/client/components/MyInvestmentProjects/InvestmentList.jsx
import React from 'react' import PropTypes from 'prop-types' import styled from 'styled-components' import InvestmentListItem from './InvestmentListItem' const StyledOrderedList = styled('ol')` margin-top: 0; ${({ isPaginated }) => isPaginated && `border-bottom: 2px solid red;`} ` const InvestmentList = ({ items, isPaginated, showDetails }) => ( <StyledOrderedList isPaginated={isPaginated}> {items.map((item) => ( <InvestmentListItem key={item.id} showDetails={showDetails} {...item} /> ))} </StyledOrderedList> ) InvestmentList.propTypes = { items: PropTypes.array.isRequired, } export default InvestmentList
import React from 'react' import PropTypes from 'prop-types' import styled from 'styled-components' import { GREY_1 } from 'govuk-colours' import InvestmentListItem from './InvestmentListItem' const StyledOrderedList = styled('ol')` margin-top: 0; ${({ isPaginated }) => isPaginated && `border-bottom: 2px solid ${GREY_1};`} ` const InvestmentList = ({ items, isPaginated, showDetails }) => ( <StyledOrderedList isPaginated={isPaginated}> {items.map((item) => ( <InvestmentListItem key={item.id} showDetails={showDetails} {...item} /> ))} </StyledOrderedList> ) InvestmentList.propTypes = { items: PropTypes.array.isRequired, } export default InvestmentList
Change horizontal line colour from red to grey
Change horizontal line colour from red to grey
JSX
mit
uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2
--- +++ @@ -1,12 +1,13 @@ import React from 'react' import PropTypes from 'prop-types' import styled from 'styled-components' +import { GREY_1 } from 'govuk-colours' import InvestmentListItem from './InvestmentListItem' const StyledOrderedList = styled('ol')` margin-top: 0; - ${({ isPaginated }) => isPaginated && `border-bottom: 2px solid red;`} + ${({ isPaginated }) => isPaginated && `border-bottom: 2px solid ${GREY_1};`} ` const InvestmentList = ({ items, isPaginated, showDetails }) => (
77ea78e309949695c780840f4c5da477844833e0
client/libs/react-app-context.jsx
client/libs/react-app-context.jsx
// XXX: Move this into a NPM module import {React} from 'meteor/react-runtime'; export function applyContext(context, _actions) { const actions = {}; for (let key in _actions) { if (_actions.hasOwnProperty(key)) { const actionMap = _actions[key]; for (let actionName in actionMap) { if (actionMap.hasOwnProperty(actionName)) { actionMap[actionName] = actionMap[actionName].bind(null, context); } } actions[key] = actionMap; } } return function (ChildComponent) { const Context = React.createClass({ childContextTypes: { context: React.PropTypes.object, actions: React.PropTypes.object }, getChildContext() { return { context, actions }; }, render() { return (<ChildComponent {...this.props} />); } }); return Context; }; } const defaultMapper = (context, actions) => ({ context: () => context, actions: () => actions }); export function withContext(mapper = defaultMapper) { return function (ChildComponent) { const ContextWrapper = React.createClass({ render() { const {context, actions} = this.context; const mappedProps = mapper(context, actions); const newProps = { ...this.props, ...mappedProps }; return (<ChildComponent {...newProps} />); }, contextTypes: { context: React.PropTypes.object, actions: React.PropTypes.object } }); return ContextWrapper; }; }
// XXX: Move this into a NPM module import {React} from 'meteor/react-runtime'; export function applyContext(context, _actions) { const actions = {}; for (let key in _actions) { if (_actions.hasOwnProperty(key)) { const actionMap = _actions[key]; for (let actionName in actionMap) { if (actionMap.hasOwnProperty(actionName)) { actionMap[actionName] = actionMap[actionName].bind(null, context); } } actions[key] = actionMap; } } return function (ChildComponent) { const Context = React.createClass({ childContextTypes: { context: React.PropTypes.object, actions: React.PropTypes.object }, getChildContext() { return { context, actions }; }, render() { return (<ChildComponent {...this.props} />); } }); return Context; }; } const defaultMapper = (context, actions) => ({ context: () => context, actions: () => actions }); export function withContext(mapper = defaultMapper) { return function (ChildComponent) { const ContextWrapper = React.createClass({ render() { const {context, actions} = this.context; const mappedProps = mapper(context, actions); const newProps = { ...this.props, ...mappedProps }; return (<ChildComponent {...newProps} />); }, contextTypes: { context: React.PropTypes.object, actions: React.PropTypes.object } }); return ContextWrapper; }; }
Fix a simple eslint issue
Fix a simple eslint issue
JSX
mit
LikeJasper/mantra-plus,warehouseman/meteor-mantra-kickstarter,TheAncientGoat/mantra-sample-blog-coffee,Entropy03/jianwei,mantrajs/mantra-sample-blog-app,hacksong2016/angel,mantrajs/mantra-dialogue,mantrajs/meteor-mantra-kickstarter,warehouseman/meteor-mantra-kickstarter,worldwidejamie/silicon-basement,markoshust/mantra-sample-blog-app,ShockiTV/mantra-test,wmzhai/mantra-demo,warehouseman/meteor-mantra-kickstarter
756be5f810ea027f3933221ab2da7e196de33896
web-server/app/assets/javascripts/components/packages-component.jsx
web-server/app/assets/javascripts/components/packages-component.jsx
define(['jquery', 'react', '../mixins/serialize-form', '../mixins/fluxbone', '../mixins/request-status', './package-component', 'sota-dispatcher'], function($, React, serializeForm, Fluxbone, RequestStatus, PackageComponent, SotaDispatcher) { var Packages = React.createClass({ mixins: [ Fluxbone.Mixin("PackageStore") ], render: function() { var packages = this.props.PackageStore.models.map(function(package) { return ( <PackageComponent Package={ package } key={package.get('name') + package.get('version')}/> ); }); return ( <div> <ul className="list-group"> { packages } </ul> </div> ); } }); return Packages; });
define(['jquery', 'react', '../mixins/serialize-form', '../mixins/fluxbone', '../mixins/request-status', './package-component', 'sota-dispatcher'], function($, React, serializeForm, Fluxbone, RequestStatus, PackageComponent, SotaDispatcher) { var Packages = React.createClass({ mixins: [ Fluxbone.Mixin("PackageStore", "sync change") ], render: function() { var packages = this.props.PackageStore.models.map(function(package) { return ( <PackageComponent Package={ package } key={package.get('name') + package.get('version')}/> ); }); return ( <div> <ul className="list-group"> { packages } </ul> </div> ); } }); return Packages; });
Fix packages component rendering too often
Fix packages component rendering too often
JSX
mpl-2.0
PDXostc/rvi_sota_server,PDXostc/rvi_sota_server,PDXostc/rvi_sota_server
--- +++ @@ -2,7 +2,7 @@ var Packages = React.createClass({ mixins: [ - Fluxbone.Mixin("PackageStore") + Fluxbone.Mixin("PackageStore", "sync change") ], render: function() { var packages = this.props.PackageStore.models.map(function(package) {
f630da669b4c1437bc9048d1b8ac9c7e13fbf803
src/drive/web/modules/trash/components/DestroyConfirm.jsx
src/drive/web/modules/trash/components/DestroyConfirm.jsx
import React from 'react' import classNames from 'classnames' import { useClient } from 'cozy-client' import Modal from 'cozy-ui/transpiled/react/Modal' import { translate } from 'cozy-ui/transpiled/react/I18n' import { deleteFilesPermanently } from 'drive/web/modules/actions/utils' import styles from 'drive/styles/confirms.styl' const DestroyConfirm = ({ t, files, onClose }) => { const client = useClient() const confirmationTexts = ['forbidden', 'restore'].map(type => ( <p className={classNames(styles['fil-confirm-text'], styles[`icon-${type}`])} key={`key_destroy_${type}`} > {t(`destroyconfirmation.${type}`, files.length)} </p> )) return ( <Modal title={t('destroyconfirmation.title', files.length)} description={confirmationTexts} secondaryType="secondary" secondaryText={t('destroyconfirmation.cancel')} dismissAction={onClose} secondaryAction={onClose} primaryType="danger" primaryText={t('destroyconfirmation.delete')} primaryAction={async () => { try { await deleteFilesPermanently(client, files) } catch { //eslint-disable-next-line } finally { onClose() } }} /> ) } export default translate()(DestroyConfirm)
import React from 'react' import classNames from 'classnames' import { useClient } from 'cozy-client' import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs' import Button from 'cozy-ui/transpiled/react/Button' import { translate } from 'cozy-ui/transpiled/react/I18n' import { deleteFilesPermanently } from 'drive/web/modules/actions/utils' import styles from 'drive/styles/confirms.styl' const DestroyConfirm = ({ t, files, onClose }) => { const client = useClient() const confirmationTexts = ['forbidden', 'restore'].map(type => ( <p className={classNames(styles['fil-confirm-text'], styles[`icon-${type}`])} key={`key_destroy_${type}`} > {t(`destroyconfirmation.${type}`, files.length)} </p> )) return ( <ConfirmDialog open={true} onClose={onClose} title={t('destroyconfirmation.title', files.length)} content={confirmationTexts} actions={ <> <Button theme="secondary" onClick={onClose} label={t('destroyconfirmation.cancel')} /> <Button theme="danger" label={t('destroyconfirmation.delete')} onClick={async () => { try { await deleteFilesPermanently(client, files) } catch { //eslint-disable-next-line } finally { onClose() } }} /> </> } /> ) } export default translate()(DestroyConfirm)
Use CozyDialog instead of Modal
feat: Use CozyDialog instead of Modal
JSX
agpl-3.0
nono/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3
--- +++ @@ -1,8 +1,11 @@ import React from 'react' import classNames from 'classnames' + import { useClient } from 'cozy-client' -import Modal from 'cozy-ui/transpiled/react/Modal' +import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs' +import Button from 'cozy-ui/transpiled/react/Button' import { translate } from 'cozy-ui/transpiled/react/I18n' + import { deleteFilesPermanently } from 'drive/web/modules/actions/utils' import styles from 'drive/styles/confirms.styl' @@ -16,26 +19,34 @@ {t(`destroyconfirmation.${type}`, files.length)} </p> )) - return ( - <Modal + <ConfirmDialog + open={true} + onClose={onClose} title={t('destroyconfirmation.title', files.length)} - description={confirmationTexts} - secondaryType="secondary" - secondaryText={t('destroyconfirmation.cancel')} - dismissAction={onClose} - secondaryAction={onClose} - primaryType="danger" - primaryText={t('destroyconfirmation.delete')} - primaryAction={async () => { - try { - await deleteFilesPermanently(client, files) - } catch { - //eslint-disable-next-line - } finally { - onClose() - } - }} + content={confirmationTexts} + actions={ + <> + <Button + theme="secondary" + onClick={onClose} + label={t('destroyconfirmation.cancel')} + /> + <Button + theme="danger" + label={t('destroyconfirmation.delete')} + onClick={async () => { + try { + await deleteFilesPermanently(client, files) + } catch { + //eslint-disable-next-line + } finally { + onClose() + } + }} + /> + </> + } /> ) }
b75f2c8719b8c27e392e3ffb21b3106801840dde
ui/src/message_popup/mobile_prototype/message_components_story.jsx
ui/src/message_popup/mobile_prototype/message_components_story.jsx
import React from 'react'; import _ from 'lodash'; import {storiesOf} from '@kadira/storybook'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import {StudentMessage, UserMessage, InfoMessage} from './message_components.jsx'; import {allStudents} from '../../data/virtual_school.js'; const student = _.first(allStudents); storiesOf('MessageComponents') .add('StudentMessage', () => ( <MuiThemeProvider> <StudentMessage text="Hello from the student." student={student} onOpenStudentDialog={() => alert('onOpenStudentDialog')} /> </MuiThemeProvider> )) .add('UserMessage', () => ( <MuiThemeProvider> <UserMessage text="Hello from the user." /> </MuiThemeProvider> )) .add('InfoMessage', () => ( <MuiThemeProvider> <UserMessage text="Info message." /> </MuiThemeProvider> ))
import React from 'react'; import _ from 'lodash'; import {storiesOf} from '@kadira/storybook'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import {StudentMessage, UserMessage, InfoMessage} from './message_components.jsx'; import {allStudents} from '../../data/virtual_school.js'; const student = _.first(allStudents); storiesOf('MessageComponents') .add('StudentMessage', () => ( <MuiThemeProvider> <StudentMessage text="Hello from the student." student={student} onOpenStudentDialog={() => alert('onOpenStudentDialog')} /> </MuiThemeProvider> )) .add('UserMessage', () => ( <MuiThemeProvider> <UserMessage text="Hello from the user." /> </MuiThemeProvider> )) .add('InfoMessage', () => ( <MuiThemeProvider> <InfoMessage text="Info message." /> </MuiThemeProvider> ));
Fix bug with InfoMessage and linting
Fix bug with InfoMessage and linting
JSX
mit
kesiena115/threeflows,kesiena115/threeflows,kesiena115/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows
--- +++ @@ -20,6 +20,6 @@ )) .add('InfoMessage', () => ( <MuiThemeProvider> - <UserMessage text="Info message." /> + <InfoMessage text="Info message." /> </MuiThemeProvider> - )) + ));
cd2ece6c1d2c73842d9ecc5a53723509a3eb77bd
client/download/download-page.jsx
client/download/download-page.jsx
import React from 'react' import { makeServerUrl } from '../network/server-url' import styles from './download.css' import Download from './download.jsx' import LogoText from '../logos/logotext-640x100.svg' export default class DownloadPage extends React.Component { render() { return (<div className={styles.background}> <div className={styles.wrapper}> <img className={styles.logo} src={makeServerUrl('/images/logo.svg')} /> <div className={styles.logoText}><LogoText /></div> <div> <Download /> </div> </div> </div>) } }
import React from 'react' import { makeServerUrl } from '../network/server-url' import styles from './download.css' import Download from './download.jsx' import LogoText from '../logos/logotext-640x100.svg' export default class DownloadPage extends React.Component { render() { return (<div> <div className={styles.wrapper}> <img className={styles.logo} src={makeServerUrl('/images/logo.svg')} /> <div className={styles.logoText}><LogoText /></div> <div> <Download /> </div> </div> </div>) } }
Remove unnecessary/undefined style from DownloadPage body.
Remove unnecessary/undefined style from DownloadPage body.
JSX
mit
ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery
--- +++ @@ -7,7 +7,7 @@ export default class DownloadPage extends React.Component { render() { - return (<div className={styles.background}> + return (<div> <div className={styles.wrapper}> <img className={styles.logo} src={makeServerUrl('/images/logo.svg')} /> <div className={styles.logoText}><LogoText /></div>
117f171a5217c545835f2e0a8e8eef0ce303d091
src/main/resources/assets/js/components/AppVersionListComponent.jsx
src/main/resources/assets/js/components/AppVersionListComponent.jsx
/** @jsx React.DOM */ define([ "React", "jsx!components/AppVersionListItemComponent", ], function(React, AppVersionListItemComponent) { return React.createClass({ displayName: "AppVersionListComponent", propTypes: { app: React.PropTypes.object.isRequired, appVersions: React.PropTypes.array, onRollback: React.PropTypes.func }, getInitialState: function() { return { expandedAppVersions: {} }; }, render: function() { var listItems; if (this.props.appVersions == null) { listItems = ( <tr><td className="text-muted text-center">Loading versions...</td></tr> ); } else { if (this.props.appVersions.length > 0) { listItems = []; this.props.appVersions.forEach(function(v) { return ( <AppVersionListItemComponent app={this.props.app} appVersion={v} key={v.get("version")} onRollback={this.props.onRollback} onShowDetails={this.props.onShowDetails} /> ); }, this); } else { listItems = <tr><td className="text-muted text-center">No previous versions</td></tr> } } return ( <table className="table table-selectable"> <tbody> {listItems} </tbody> </table> ); } }); });
/** @jsx React.DOM */ define([ "React", "jsx!components/AppVersionListItemComponent", ], function(React, AppVersionListItemComponent) { return React.createClass({ displayName: "AppVersionListComponent", propTypes: { app: React.PropTypes.object.isRequired, appVersions: React.PropTypes.array, onRollback: React.PropTypes.func }, getInitialState: function() { return { expandedAppVersions: {} }; }, render: function() { var listItems; if (this.props.appVersions == null) { listItems = ( <tr><td className="text-muted text-center">Loading versions...</td></tr> ); } else { if (this.props.appVersions.length > 0) { listItems = this.props.appVersions.map(function(v) { return ( <AppVersionListItemComponent app={this.props.app} appVersion={v} key={v.get("version")} onRollback={this.props.onRollback} onShowDetails={this.props.onShowDetails} /> ); }, this); } else { listItems = <tr><td className="text-muted text-center">No previous versions</td></tr> } } return ( <table className="table table-selectable"> <tbody> {listItems} </tbody> </table> ); } }); });
Use `map` to render app versions
Use `map` to render app versions
JSX
apache-2.0
yp-engineering/marathon,pugna0/marathon,guenter/marathon,drewrobb/marathon,rtward/marathon,EasonYi/marathon,manojlds/marathon,cherrydocker/marathon-1,bobrik/marathon,Yhgenomics/marathon,felixb/marathon,okuryu/marathon,bsideup/marathon,mikejihbe/marathon,bobrik/marathon,Caerostris/marathon,14Zen/marathon,EvanKrall/marathon,MrMarvin/marathon,airbnb/marathon,sielaq/marathon,mikejihbe/marathon,MrMarvin/marathon,meln1k/marathon,natemurthy/marathon,c089/marathon,meln1k/marathon,HardikDR/marathon,titosand/marathon,vivekjuneja/marathon,meln1k/marathon,IanSaunders/marathon,SivagnanamCiena/marathon,ayouwei/marathon,EvanKrall/marathon,okuryu/marathon,pgkelley4/marathon,Kosta-Github/marathon,manojlds/marathon,yp-engineering/marathon,sledigabel/marathon,14Zen/marathon,sledigabel/marathon,bobrik/marathon,drewrobb/marathon,mesosphere/marathon,guenter/marathon,hangyan/marathon,ss75710541/marathon,EvanKrall/marathon,sttts/marathon,sielaq/marathon,c089/marathon,natemurthy/marathon,SivagnanamCiena/marathon,quamilek/marathon,pgkelley4/marathon,cgvarela/marathon,ramitsurana/marathon,ramitsurana/marathon,spacejam/marathon,Yhgenomics/marathon,spacejam/marathon,sielaq/marathon,natemurthy/marathon,lelezi/marathon,guenter/marathon,sielaq/marathon,sttts/marathon,Caerostris/marathon,titosand/marathon,ayouwei/marathon,janisz/marathon,sttts/marathon,c089/marathon,rtward/marathon,meln1k/marathon,mesosphere/marathon,cherrydocker/marathon-1,hangyan/marathon,gsantovena/marathon,matsluni/marathon,ss75710541/marathon,IanSaunders/marathon,felixb/marathon,timcharper/marathon,quamilek/marathon,pugna0/marathon,c089/marathon,bobrik/marathon,gsantovena/marathon,sledigabel/marathon,spacejam/marathon,gsantovena/marathon,matsluni/marathon,guenter/marathon,guenter/marathon,ayouwei/marathon,janisz/marathon,14Zen/marathon,felixb/marathon,gsantovena/marathon,EasonYi/marathon,pugna0/marathon,Yhgenomics/marathon,sepiroth887/marathon,HardikDR/marathon,timcharper/marathon,mikejihbe/marathon,sepiroth887/marathon,vivekjuneja/marathon,matsluni/marathon,HardikDR/marathon,okuryu/marathon,janisz/marathon,ss75710541/marathon,rtward/marathon,Caerostris/marathon,Caerostris/marathon,sepiroth887/marathon,murat-lacework/marathon,cherrydocker/marathon-1,hangyan/marathon,SivagnanamCiena/marathon,gsantovena/marathon,quamilek/marathon,spacejam/marathon,mesosphere/marathon,sttts/marathon,cgvarela/marathon,janisz/marathon,janisz/marathon,MrMarvin/marathon,drewrobb/marathon,mesosphere/marathon,airbnb/marathon,14Zen/marathon,airbnb/marathon,ramitsurana/marathon,Caerostris/marathon,IanSaunders/marathon,lelezi/marathon,timcharper/marathon,manojlds/marathon,airbnb/marathon,drewrobb/marathon,murat-lacework/marathon,felixb/marathon,cgvarela/marathon,mesosphere/marathon,lelezi/marathon,vivekjuneja/marathon,murat-lacework/marathon,EasonYi/marathon,EvanKrall/marathon,bsideup/marathon,meln1k/marathon,bsideup/marathon,Kosta-Github/marathon
--- +++ @@ -27,8 +27,7 @@ ); } else { if (this.props.appVersions.length > 0) { - listItems = []; - this.props.appVersions.forEach(function(v) { + listItems = this.props.appVersions.map(function(v) { return ( <AppVersionListItemComponent app={this.props.app}
7c2148b5acec7145079fa907eed88a555e95700a
src/components/side-panel/add-swatches/AddSwatchesPanel.jsx
src/components/side-panel/add-swatches/AddSwatchesPanel.jsx
// @flow import React from 'react'; import AddSwatchForm from './AddSwatchForm'; import Palette from './Palette'; import type { PaletteType } from '../../../../types'; type Props = { palettes: Array<PaletteType>, addNewSwatch: Function, deleteSwatches: Function } const AddSwatchesPanel = (props: Props): React$Element<any> => ( <div> <AddSwatchForm addNewSwatch={props.addNewSwatch} /> {props.palettes.map((palette, i) => <Palette {...palette} addNewSwatch={props.addNewSwatch} key={`palette${i}`} />)} <button className="btn btn-primary btn-block" id="delete-all" onClick={props.deleteSwatches} > <i className="icon icon-delete" /> Delete all </button> </div> ); export default AddSwatchesPanel;
// @flow import React from 'react'; import AddSwatchForm from './AddSwatchForm'; import Palette from './Palette'; import type { PaletteType } from '../../../../types'; type Props = { palettes: Array<PaletteType>, addNewSwatch: Function, deleteSwatches: Function } const AddSwatchesPanel = (props: Props): React$Element<any> => ( <div> <h4>Custom swatch</h4> <AddSwatchForm addNewSwatch={props.addNewSwatch} /> <h4 className="mt-10">Pre-made palettes</h4> {props.palettes.map((palette, i) => <Palette {...palette} addNewSwatch={props.addNewSwatch} key={`palette${i}`} />)} <h4 className="mt-10">Options</h4> <button className="btn btn-primary btn-block" id="delete-all" onClick={props.deleteSwatches} > <i className="icon icon-delete" /> Delete all </button> </div> ); export default AddSwatchesPanel;
Add titles to swatch panel
[Style] Add titles to swatch panel
JSX
isc
eddyerburgh/palette-picker,eddyerburgh/palette-picker
--- +++ @@ -13,13 +13,16 @@ const AddSwatchesPanel = (props: Props): React$Element<any> => ( <div> + <h4>Custom swatch</h4> <AddSwatchForm addNewSwatch={props.addNewSwatch} /> + <h4 className="mt-10">Pre-made palettes</h4> {props.palettes.map((palette, i) => <Palette {...palette} addNewSwatch={props.addNewSwatch} key={`palette${i}`} />)} + <h4 className="mt-10">Options</h4> <button className="btn btn-primary btn-block" id="delete-all"
425fc80d6c78e42dd2dcf73f76d2c0866f2537a9
client/app/bundles/RentersRights/components/ResourceIndexItem.jsx
client/app/bundles/RentersRights/components/ResourceIndexItem.jsx
import React from 'react'; export default class ResourceIndexItem extends React.Component { constructor(props) { super(props); } render() { const { organization, phone, email, website, region, description, address, } = this.props.resource; return ( <div> <a href={website}><h3>{organization}</h3></a> <p>{description}</p> <p>Contact: </p> <p><span className="glyphicon glyphicon-earphone"></span> Phone: {phone}</p> <p> Address: {address}</p> </div> ) } }
import React from 'react'; export default class ResourceIndexItem extends React.Component { constructor(props) { super(props); } render() { const { organization, phone, email, website, region, description, address, } = this.props.resource; return ( <div> <a href={website} target="_blank"><h3>{organization}</h3></a> <p>{description}</p> <p>Contact: </p> <p><span className="glyphicon glyphicon-earphone"></span> Phone: {phone}</p> <p> Address: {address}</p> </div> ) } }
Add target=_blank to a tags to open link in new window
Add target=_blank to a tags to open link in new window
JSX
mit
codeforsanjose/renters-rights,codeforsanjose/renters-rights,codeforsanjose/renters-rights
--- +++ @@ -18,7 +18,7 @@ return ( <div> - <a href={website}><h3>{organization}</h3></a> + <a href={website} target="_blank"><h3>{organization}</h3></a> <p>{description}</p> <p>Contact: </p> <p><span className="glyphicon glyphicon-earphone"></span> Phone: {phone}</p>
63a669312c94ccddee1b733874109dc815851659
app/layout/Navbar.jsx
app/layout/Navbar.jsx
import React from 'react' let Navbar = React.createClass({ render: function () { return <nav className="navbar navbar-default navbar-static-top" role="navigation"> <div className="navbar-header"> <button type="button" className="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span className="sr-only">Toggle navigation</span> <span className="icon-bar"></span> <span className="icon-bar"></span> <span className="icon-bar"></span> </button> <a className="navbar-brand" href="/"> <i className="fa fa-lg fa-rocket" aria-hidden="true"></i> </a> </div> <ul className="nav navbar-top-links navbar-right"> </ul> </nav>; } }); export default Navbar
import React from 'react' let Navbar = React.createClass({ renderNavEntry: function(entry, i) { return <li className="dropdown"> </li> }, render: function () { return <nav className="navbar navbar-default navbar-static-top" role="navigation"> <div className="navbar-header"> <button type="button" className="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span className="sr-only">Toggle navigation</span> <span className="icon-bar"></span> <span className="icon-bar"></span> <span className="icon-bar"></span> </button> <a className="navbar-brand" href="/"> <i className="fa fa-lg fa-rocket" aria-hidden="true"></i> </a> </div> <ul className="nav navbar-top-links navbar-right"> </ul> </nav>; } }); export default Navbar
Add dropdown function for navigation bar
Add dropdown function for navigation bar
JSX
agpl-3.0
mbrossard/go-experiments,mbrossard/go-experiments,mbrossard/go-experiments
--- +++ @@ -1,6 +1,10 @@ import React from 'react' let Navbar = React.createClass({ + renderNavEntry: function(entry, i) { + return <li className="dropdown"> + </li> + }, render: function () { return <nav className="navbar navbar-default navbar-static-top" role="navigation"> <div className="navbar-header">
cda77c6a8e21767600e7103db234d7adda9d2e36
frontend/src/components/print/print-react/components/program/Program.jsx
frontend/src/components/print/print-react/components/program/Program.jsx
// eslint-disable-next-line no-unused-vars import React from 'react' import { Page, View } from '@react-pdf/renderer' import styles from '../styles.js' import sortBy from 'lodash/sortBy.js' import ScheduleEntry from '../scheduleEntry/ScheduleEntry.jsx' function Program(props) { const periods = props.content.options.periods.map((periodUri) => props.store.get(periodUri) ) if (!periods.some((period) => period.scheduleEntries().items.length > 0)) { return null } return ( <Page size="A4" orientation="portrait" style={{ ...styles.page, fontSize: '8pt' }}> {periods.map((period) => { if (period.scheduleEntries().items.length === 0) { return <React.Fragment key={`${props.id}-${period.id}`} /> } return ( <View key={`${props.id}-${period.id}`} id={`${props.id}-${period.id}`} bookmark={{ title: period.description, fit: true }} > {sortBy(period.scheduleEntries().items, [ 'dayNumber', 'scheduleEntryNumber', ]).map((scheduleEntry) => ( <ScheduleEntry {...props} scheduleEntry={scheduleEntry} key={scheduleEntry.id} id={`${props.id}-${period.id}-${scheduleEntry.id}`} /> ))} </View> ) })} </Page> ) } export default Program
// eslint-disable-next-line no-unused-vars import React from 'react' import { Page, View } from '@react-pdf/renderer' import styles from '../styles.js' import sortBy from 'lodash/sortBy.js' import ScheduleEntry from '../scheduleEntry/ScheduleEntry.jsx' function Program(props) { const periods = props.content.options.periods.map((periodUri) => props.store.get(periodUri) ) if (!periods.some((period) => period.scheduleEntries().items.length > 0)) { return null } return ( <Page size="A4" orientation="portrait" style={{ ...styles.page, fontSize: '8pt' }}> {periods.map((period) => { if (period.scheduleEntries().items.length === 0) { return <React.Fragment key={`${props.id}-${period.id}`} /> } return ( <View key={`${props.id}-${period.id}`}> <View id={`${props.id}-${period.id}`} bookmark={{ title: period.description, fit: true }} /> {sortBy(period.scheduleEntries().items, [ 'dayNumber', 'scheduleEntryNumber', ]).map((scheduleEntry) => ( <ScheduleEntry {...props} scheduleEntry={scheduleEntry} key={scheduleEntry.id} id={`${props.id}-${period.id}-${scheduleEntry.id}`} /> ))} </View> ) })} </Page> ) } export default Program
Fix program bookmark jumping to the last instead of the first page of the program
Fix program bookmark jumping to the last instead of the first page of the program
JSX
agpl-3.0
usu/ecamp3,ecamp/ecamp3,ecamp/ecamp3,usu/ecamp3,ecamp/ecamp3,usu/ecamp3,ecamp/ecamp3,usu/ecamp3
--- +++ @@ -19,11 +19,11 @@ return <React.Fragment key={`${props.id}-${period.id}`} /> } return ( - <View - key={`${props.id}-${period.id}`} - id={`${props.id}-${period.id}`} - bookmark={{ title: period.description, fit: true }} - > + <View key={`${props.id}-${period.id}`}> + <View + id={`${props.id}-${period.id}`} + bookmark={{ title: period.description, fit: true }} + /> {sortBy(period.scheduleEntries().items, [ 'dayNumber', 'scheduleEntryNumber',
17a4a02c718b067504fc41beb35ff0c4755b9d0f
src/app/components/Messages/Header.jsx
src/app/components/Messages/Header.jsx
import './Header.less'; import React from 'react'; // import { Anchor } from '@r/platform/components'; export default function MessagesHeader() { return ( <div className='MessageHeader'> <div className='MessageHeader__title'>Inbox</div> {/*Don't allow access to messager composition until that feature is ready <Anchor className='MessageHeader__compose icon icon-message' href='/message/compose' />*/} </div> ); }
import './Header.less'; import React from 'react'; import { Anchor } from '@r/platform/components'; export default function MessagesHeader() { return ( <div className='MessageHeader'> <div className='MessageHeader__title'>Inbox</div> <Anchor className='MessageHeader__compose icon icon-message' href='/message/compose' /> </div> ); }
Enable showing the link to message compose
Enable showing the link to message compose This was previously working but hidden due to a captcha-related issue. This should now be working, so we can unhide the link.
JSX
mit
ajacksified/reddit-mobile,ajacksified/reddit-mobile,ajacksified/reddit-mobile,ajacksified/reddit-mobile
--- +++ @@ -1,16 +1,15 @@ import './Header.less'; import React from 'react'; -// import { Anchor } from '@r/platform/components'; +import { Anchor } from '@r/platform/components'; export default function MessagesHeader() { return ( <div className='MessageHeader'> <div className='MessageHeader__title'>Inbox</div> - {/*Don't allow access to messager composition until that feature is ready <Anchor className='MessageHeader__compose icon icon-message' href='/message/compose' - />*/} + /> </div> ); }
77e70ff2b90b0cd6a2be69a278996840f48f9e50
src/Filters.jsx
src/Filters.jsx
import React, { Component } from 'react'; import PropTypes from 'proptypes'; import Filter from './Filter.jsx'; import filterData from './filter-data.js'; class Filters extends Component { static propTypes = { filters: PropTypes.array, addFilter: PropTypes.func, removeFilter: PropTypes.func, updateFilter: PropTypes.func } addFilter = (type) => { return () => { this.props.addFilter({ type, value: '', exclude: false }); }; } render() { return ( <div id="filter-div"> <ul className="list-group"> <li className="list-group-item active"> {Object.keys(filterData).map(filterName => <span className="col" key={filterName} onClick={this.addFilter(filterName)}>{filterName}</span>)} </li> { this.props.filters.map((filter, index) => { return filter && <Filter data={filter} key={index} index={index} update={this.props.updateFilter} remove={this.props.removeFilter} />; }) } </ul> </div> ); } } export default Filters;
import React, { Component } from 'react'; import PropTypes from 'proptypes'; import Filter from './Filter.jsx'; import axios from 'axios'; class Filters extends Component { componentWillMount = () => { this.setState({ filterTypes: [] }); axios.get('http://localhost:8080/filters') .then(({ data }) => { this.setState({ filterTypes: data }); }); } static propTypes = { filters: PropTypes.array, addFilter: PropTypes.func, removeFilter: PropTypes.func, updateFilter: PropTypes.func } addFilter = (type) => { return () => { this.props.addFilter({ type, value: '', exclude: false }); }; } render() { return ( <div id="filter-div"> <ul className="list-group"> <li className="list-group-item active"> {this.state.filterTypes.map(filter => <span className="col" key={filter.id} onClick={this.addFilter(filter.type)}>{filter.type}</span>)} </li> { this.props.filters.map((filter, index) => { return filter && <Filter data={filter} key={index} index={index} update={this.props.updateFilter} remove={this.props.removeFilter} />; }) } </ul> </div> ); } } export default Filters;
Load filter types from database
Load filter types from database
JSX
mit
ivallee/lhl-final-project,ivallee/lhl-final-project
--- +++ @@ -1,9 +1,17 @@ import React, { Component } from 'react'; import PropTypes from 'proptypes'; import Filter from './Filter.jsx'; -import filterData from './filter-data.js'; +import axios from 'axios'; class Filters extends Component { + + componentWillMount = () => { + this.setState({ filterTypes: [] }); + axios.get('http://localhost:8080/filters') + .then(({ data }) => { + this.setState({ filterTypes: data }); + }); + } static propTypes = { filters: PropTypes.array, @@ -23,7 +31,7 @@ <div id="filter-div"> <ul className="list-group"> <li className="list-group-item active"> - {Object.keys(filterData).map(filterName => <span className="col" key={filterName} onClick={this.addFilter(filterName)}>{filterName}</span>)} + {this.state.filterTypes.map(filter => <span className="col" key={filter.id} onClick={this.addFilter(filter.type)}>{filter.type}</span>)} </li> { this.props.filters.map((filter, index) => {
9ea1e39a615d9cd61a28574e8d51f750424a6091
client/components/inputs/TextField.jsx
client/components/inputs/TextField.jsx
var cn = require('classnames'), React = require('react/addons'), {PureRenderMixin} = React.addons.PureRenderMixin var TextField = React.createClass({ mixins: [PureRenderMixin], propTypes: { label: React.PropTypes.string, errorText: React.PropTypes.string, name: React.PropTypes.string.isRequired, value: React.PropTypes.string.isRequired, onChange: React.PropTypes.func.isRequired }, getInitialState: function () { return {focused: false} }, render: function () { var {name, errorText, label, value, onChange} = this.props var wrapperClassNames = cn('text-field', { 'has-focus': this.state.focused, 'has-error': !!errorText, 'has-value': !!value }) var inputProps = { name, value, onChange, onFocus: this._onFocus, onBlur: this._onBlur } return ( <div className={wrapperClassNames}> <label className='text-field-floating-label'> {label || name} </label> <input className='text-field-input' type='text' {...inputProps}/> <hr className='text-field-underline'/> <hr className='text-field-focus-underline'/> {errorText ? <div className='text-field-error'>{errorText}</div> : null} </div> ) }, _onFocus: function () { this.setState({focused: true}) }, _onBlur: function () { this.setState({focused: false}) } }) module.exports = TextField
var cn = require('classnames') var React = require('react/addons') var {PureRenderMixin} = React.addons.PureRenderMixin var TextField = React.createClass({ mixins: [PureRenderMixin], propTypes: { label: React.PropTypes.string, errorText: React.PropTypes.string, name: React.PropTypes.string.isRequired, value: React.PropTypes.string.isRequired, onChange: React.PropTypes.func.isRequired }, getInitialState: function () { return {focused: false} }, render: function () { var {name, errorText, label, value, onChange} = this.props var wrapperClassNames = cn('text-field', { 'has-focus': this.state.focused, 'has-error': !!errorText, 'has-value': !!value }) var inputProps = { name, value, onChange, onFocus: this._onFocus, onBlur: this._onBlur } return ( <div className={wrapperClassNames}> <label className='text-field-floating-label'> {label || name} </label> <input className='text-field-input' type='text' {...inputProps}/> <hr className='text-field-underline'/> <hr className='text-field-focus-underline'/> {errorText ? <div className='text-field-error'>{errorText}</div> : null} </div> ) }, _onFocus: function () { this.setState({focused: true}) }, _onBlur: function () { this.setState({focused: false}) } }) module.exports = TextField
Use var for each line
Use var for each line
JSX
apache-2.0
cesarandreu/bshed,cesarandreu/bshed
--- +++ @@ -1,6 +1,6 @@ -var cn = require('classnames'), - React = require('react/addons'), - {PureRenderMixin} = React.addons.PureRenderMixin +var cn = require('classnames') +var React = require('react/addons') +var {PureRenderMixin} = React.addons.PureRenderMixin var TextField = React.createClass({ mixins: [PureRenderMixin],
81cd3f2d78f4c2c85cfe66f892dec71c04590469
src/app/views/login/LoginForm.jsx
src/app/views/login/LoginForm.jsx
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Input from '../../components/Input'; const propTypes = { formData: PropTypes.shape({ inputs: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, label: PropTypes.string, type: PropTypes.string, onChange: PropTypes.func, error: PropTypes.string })), onSubmit: PropTypes.func, isSubmitting: PropTypes.bool }) } export default class LoginForm extends Component { constructor(props) { super(props); } render() { const inputs = this.props.formData.inputs; const isSubmitting = this.props.formData.isSubmitting; return ( <div className="grid grid--justify-center"> <div className="grid__col-3"> <h1>Login</h1> <form className="form" onSubmit={this.props.formData.onSubmit}> { inputs.map((input, index) => { return <Input key={index} {...input} disabled={isSubmitting}/> }) } <button type="submit" className="btn btn--primary margin-top--1" disabled={isSubmitting}> Log in </button> {isSubmitting ? <div className="form__loader loader loader--dark margin-left--1"></div> : ""} </form> </div> </div> ) } } LoginForm.propTypes = propTypes;
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Input from '../../components/Input'; const propTypes = { formData: PropTypes.shape({ inputs: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, label: PropTypes.string, type: PropTypes.string, onChange: PropTypes.func, error: PropTypes.string })), onSubmit: PropTypes.func, isSubmitting: PropTypes.bool }) } export default class LoginForm extends Component { constructor(props) { super(props); } render() { const inputs = this.props.formData.inputs; const isSubmitting = this.props.formData.isSubmitting; return ( <div className="grid grid--justify-center"> <div className="grid__col-3"> <h1>Login</h1> <form className="form" onSubmit={this.props.formData.onSubmit}> { inputs.map((input, index) => { return <Input key={index} {...input} disabled={isSubmitting} allowAutoComplete={true}/> }) } <button type="submit" className="btn btn--primary margin-top--1" disabled={isSubmitting}> Log in </button> {isSubmitting ? <div className="form__loader loader loader--dark margin-left--1"></div> : ""} </form> </div> </div> ) } } LoginForm.propTypes = propTypes;
Set login fields to allow auto complete
Set login fields to allow auto complete
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -36,7 +36,7 @@ { inputs.map((input, index) => { - return <Input key={index} {...input} disabled={isSubmitting}/> + return <Input key={index} {...input} disabled={isSubmitting} allowAutoComplete={true}/> }) }
02112086c07c406dfbcb18d57189d0a218e293c9
frontend/components/topic-input.jsx
frontend/components/topic-input.jsx
import React, { useState } from 'react' import Select from 'react-select'; const TopicInput = (props) => { const [selectedGuides, setSelectedGuides] = useState(props.value || []); const handleSelect = (selected) => { setSelectedGuides(selected); } const topicOptions = Array.from(props.topics); topicOptions.sort(); return( <span> <select type="hidden" name="topic_guides" multiple style={{display:"none"}}> { selectedGuides.map( t => { return ( <option value={t.value} selected key={t.value}>{t.label}</option> ) }) } </select> <Select name="topics_input" isMulti={true} value={selectedGuides} onChange={handleSelect} options={topicOptions} /> </span> ) } export default TopicInput;
import React, { useState } from 'react' import Select from 'react-select'; const TopicInput = (props) => { const [selectedGuides, setSelectedGuides] = useState(props.value || []); const handleSelect = (selected) => { setSelectedGuides(selected); } const topicOptions = Array.from(props.topics); topicOptions.sort(); return( <span> <select type="hidden" name="topic_guides" multiple style={{display:"none"}} value={selectedGuides.map( t => t.value )} > { selectedGuides.map( t => { return ( <option value={t.value} key={t.value}>{t.label}</option> ) }) } </select> <Select name="topics_input" isMulti={true} value={selectedGuides} onChange={handleSelect} options={topicOptions} /> </span> ) } export default TopicInput;
Stop react from complaining about option tags with selected attribute
Stop react from complaining about option tags with selected attribute
JSX
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
--- +++ @@ -13,15 +13,22 @@ return( <span> - <select type="hidden" name="topic_guides" multiple style={{display:"none"}}> + <select + type="hidden" + name="topic_guides" + multiple + style={{display:"none"}} + value={selectedGuides.map( t => t.value )} + > { selectedGuides.map( t => { return ( - <option value={t.value} selected key={t.value}>{t.label}</option> + <option value={t.value} key={t.value}>{t.label}</option> ) }) } </select> + <Select name="topics_input" isMulti={true}
bdedfbf9445659c0561963b3ec111fa38955b4f0
src/shared/components/index.jsx
src/shared/components/index.jsx
/** * Created by hhj on 12/23/15. */ import React from 'react' export default class AppView extends React.Component { render() { return ( <div id="app-view"> <h1>Dohlestr</h1> <hr /> {this.props.children} </div> ) } }
/** * Created by hhj on 12/23/15. */ import React from 'react' export default class AppView extends React.Component { render() { return ( <div id="app-view"> <h1>Dohlestr</h1> <hr /> {this.props.children} <hr /> <div>hhj - based on <a href="https://medium.com/front-end-developers/handcrafting-an-isomorphic-redux-application-with-love-40ada4468af4#.dyjo0n2px"> tutorial </a> </div> </div> ) } }
Add source tutorial link to footer
Add source tutorial link to footer
JSX
mit
hhjcz/too-simple-react-skeleton
--- +++ @@ -13,6 +13,13 @@ <hr /> {this.props.children} + + <hr /> + + <div>hhj - based on <a href="https://medium.com/front-end-developers/handcrafting-an-isomorphic-redux-application-with-love-40ada4468af4#.dyjo0n2px"> + tutorial + </a> + </div> </div> ) }
8137bd05d5c6263d32b23f0be32318e7859de5fe
examples/menu/index.jsx
examples/menu/index.jsx
import React from 'react' import ReactDOM from 'react-dom' import Menu from 'menu' import Logger from 'utils/logger' export default class FormExamples extends React.Component { constructor(props) { super(props) } render() { return ( <div> <h1>Menu</h1> <Menu menu={this.getMenu()}/> </div> ) } getMenu() { return { search: false, left: [ { image: 'http://lorempixel.com/24/24', route: '/system/dashboard' }, { label: 'Menu I', items: [ { label: 'Item IA', route: '/1A' }, { label: 'Item IB', route: '/IB' }, { label: 'Item IC', route: '/IC' } ] }, { label: 'Menu II', items: [ { label: 'Item IIA', route: '/IIA' }, { label: 'Item IIB', route: '/IIB' }, { label: 'Item IIC', route: '/IIC' } ] } ], right: [ { label: 'John Doe', image: 'http://lorempixel.com/24/24', items: [ { label: 'Signout', route: '/system/signout' }, ] } ] } } }
import React from 'react' import ReactDOM from 'react-dom' import Menu from 'menu' import Logger from 'utils/logger' export default class MenuExamples extends React.Component { constructor(props) { super(props) } render() { return ( <div> <h1>Menu</h1> <Menu menu={this.getMenu()}/> </div> ) } getMenu() { return { search: false, left: [ { image: 'http://lorempixel.com/24/24', route: '/system/dashboard' }, { label: 'Menu I', items: [ { label: 'Item IA', route: '/1A' }, { label: 'Item IB', route: '/IB' }, { label: 'Item IC', route: '/IC' } ] }, { label: 'Menu II', items: [ { label: 'Item IIA', route: '/IIA' }, { label: 'Item IIB', route: '/IIB' }, { label: 'Item IIC', route: '/IIC' } ] } ], right: [ { label: 'John Doe', image: 'http://lorempixel.com/24/24', items: [ { label: 'Signout', route: '/system/signout' }, ] } ] } } }
Fix small typo with component name
Fix small typo with component name
JSX
mit
thinktopography/reframe,thinktopography/reframe
--- +++ @@ -3,7 +3,7 @@ import Menu from 'menu' import Logger from 'utils/logger' -export default class FormExamples extends React.Component { +export default class MenuExamples extends React.Component { constructor(props) { super(props) }
cc7e11516be56b33aca1be34884c23912fc175e1
src/common/components/code-renderer.jsx
src/common/components/code-renderer.jsx
import React, { PropTypes as P } from 'react'; import Lowlight from 'react-lowlight'; import shallowCompare from 'react-addons-shallow-compare'; // import js from 'highlight.js/lib/languages/javascript'; import cpp from 'highlight.js/lib/languages/cpp'; // Lowlight.registerLanguage('js', js); Lowlight.registerLanguage('cpp', cpp); class CodeBlock extends React.Component { static displayName = 'CodeBlock'; static propTypes = { literal: P.string, language: P.string, inline: P.bool, }; static defaultProps = { literal: '', language: 'js', inline: false, }; shouldComponentUpdate(nextProps, nextState) { return shallowCompare(this, nextProps, nextState); } render() { return ( <Lowlight language={this.props.language || 'js'} value={this.props.literal} inline={this.props.inline} /> ); } } export default CodeBlock;
import React, { PropTypes as P } from 'react'; import Lowlight from 'react-lowlight'; // import shallowCompare from 'react-addons-shallow-compare'; // import js from 'highlight.js/lib/languages/javascript'; import cpp from 'highlight.js/lib/languages/cpp'; // Lowlight.registerLanguage('js', js); Lowlight.registerLanguage('cpp', cpp); class CodeBlock extends React.PureComponent { static displayName = 'CodeBlock'; static propTypes = { literal: P.string, language: P.string, inline: P.bool, }; static defaultProps = { literal: '', language: 'js', inline: false, }; /* // Deprecated, see: https://facebook.github.io/react/docs/shallow-compare.html shouldComponentUpdate(nextProps, nextState) { return shallowCompare(this, nextProps, nextState); } */ render() { return ( <Lowlight language={this.props.language || 'js'} value={this.props.literal} inline={this.props.inline} /> ); } } export default CodeBlock;
Use pure component instead of deprecated shallow compare
Use pure component instead of deprecated shallow compare
JSX
mit
sse2016-peer-grading/TJLMS-FE,sse2016-peer-grading/TJLMS-FE
--- +++ @@ -1,13 +1,13 @@ import React, { PropTypes as P } from 'react'; import Lowlight from 'react-lowlight'; -import shallowCompare from 'react-addons-shallow-compare'; +// import shallowCompare from 'react-addons-shallow-compare'; // import js from 'highlight.js/lib/languages/javascript'; import cpp from 'highlight.js/lib/languages/cpp'; // Lowlight.registerLanguage('js', js); Lowlight.registerLanguage('cpp', cpp); -class CodeBlock extends React.Component { +class CodeBlock extends React.PureComponent { static displayName = 'CodeBlock'; @@ -23,9 +23,12 @@ inline: false, }; + /* + // Deprecated, see: https://facebook.github.io/react/docs/shallow-compare.html shouldComponentUpdate(nextProps, nextState) { return shallowCompare(this, nextProps, nextState); } + */ render() { return (
7328173834c93faaeb6c35028939f1efefb9f68f
src/lib/components/timeago.jsx
src/lib/components/timeago.jsx
'use strict'; var React = require('react'); var SetIntervalMixin = require('./set-interval-mixin'); var moment = require('moment'); module.exports = React.createClass({ mixins: [ SetIntervalMixin ], render: function () { var time = moment(this.props.time); return <span title={time.format('MMM Do YYYY, h:mm:ss a')}>{time.fromNow()}</span>; }, componentDidMount: function () { var interval = this.props.duration || 60000; this.setInterval(this.forceUpdate.bind(this), interval); } });
'use strict'; var _ = require('lodash'); var React = require('react'); var SetIntervalMixin = require('./set-interval-mixin'); var moment = require('moment'); var items = [ { target: 'a few seconds', replace: '1s' }, { target: ' minutes', replace: 'm' }, { target: 'a minute', replace: '1m' }, { target: ' hours', replace: 'h' }, { target: 'an hour', replace: '1h' }, { target: ' days', replace: 'd' }, { target: 'a day', replace: '1d' }, { target: ' years', replace: 'y' }, { target: 'a year', replace: '1y' } ]; var parse = function(value) { var result = ''; _.forEach(items, function(item) { if (value.indexOf(item.target) > -1) { result = value.replace(item.target, item.replace); return false; } }); return result; }; module.exports = React.createClass({ mixins: [ SetIntervalMixin ], render: function () { var time = moment(this.props.time); var diff = parse(time.fromNow()); return <span title={time.format('MMM Do YYYY, h:mm:ss a')}>{diff}</span>; }, componentDidMount: function () { var interval = this.props.duration || 60000; this.setInterval(this.forceUpdate.bind(this), interval); } });
Update time ago with a temp hack to shorten the value we render out
Update time ago with a temp hack to shorten the value we render out
JSX
unknown
Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype
--- +++ @@ -1,14 +1,40 @@ 'use strict'; +var _ = require('lodash'); var React = require('react'); var SetIntervalMixin = require('./set-interval-mixin'); var moment = require('moment'); + +var items = [ + { target: 'a few seconds', replace: '1s' }, + { target: ' minutes', replace: 'm' }, + { target: 'a minute', replace: '1m' }, + { target: ' hours', replace: 'h' }, + { target: 'an hour', replace: '1h' }, + { target: ' days', replace: 'd' }, + { target: 'a day', replace: '1d' }, + { target: ' years', replace: 'y' }, + { target: 'a year', replace: '1y' } +]; + +var parse = function(value) { + var result = ''; + _.forEach(items, function(item) { + if (value.indexOf(item.target) > -1) { + result = value.replace(item.target, item.replace); + return false; + } + }); + + return result; +}; module.exports = React.createClass({ mixins: [ SetIntervalMixin ], render: function () { var time = moment(this.props.time); - return <span title={time.format('MMM Do YYYY, h:mm:ss a')}>{time.fromNow()}</span>; + var diff = parse(time.fromNow()); + return <span title={time.format('MMM Do YYYY, h:mm:ss a')}>{diff}</span>; }, componentDidMount: function () { var interval = this.props.duration || 60000;
7136201e62c4876728dafd3f725b9c07668f1d5c
src/js/components/next-up/index.jsx
src/js/components/next-up/index.jsx
import debug from "debug"; import React, { Component } from "react"; import Track from "../track"; const log = debug("schedule:components:next-up"); export class NextUp extends Component { updateNextSessions(props) { const { getState } = props; const { upcoming, tracks, sessions } = getState(); this.setState({ sessions: upcoming.sessions. map(id => sessions[id]). reduce((a, s) => null == a.find(ss => s.track === ss.track) ? [...a, s] : a, []). slice(0, 3). map(s => ({ ...tracks[s.track], sessions: [s] })) }); } componentWillMount() { this.updateNextSessions(this.props); } componentWillReceiveProps(newProps) { this.updateNextSessions(newProps); } render() { const { sessions } = this.state; return ( <div className="next-up"> { sessions.map(t => { return ( <div key={t.name} className="next-up__track"> <Track { ...t } /> </div> ); }) } </div> ); } } export default NextUp;
import debug from "debug"; import React, { Component } from "react"; import Track from "../track"; const log = debug("schedule:components:next-up"); export class NextUp extends Component { updateNextSessions(props) { const { getState } = props; const { upcoming, tracks, sessions } = getState(); this.setState({ sessions: upcoming.sessions. map(id => sessions[id]). reduce((a, s) => null == a.find(ss => s.track === ss.track) ? [...a, s] : a, []). slice(0, 3). map(s => ({ ...tracks[s.track], sessions: [s] })) }); } componentWillMount() { this.updateNextSessions(this.props); } componentWillReceiveProps(newProps) { this.updateNextSessions(newProps); } render() { const { sessions } = this.state; return ( <div className="next-up"> { 0 < sessions.length ? sessions.map(t => { return ( <div key={t.id} className="next-up__track"> <Track { ...t } /> </div> ); }) : <p>No upcoming sessions :-(</p> } </div> ); } } export default NextUp;
Add cure for empty next up page
Add cure for empty next up page
JSX
mit
nikcorg/schedule,nikcorg/schedule,nikcorg/schedule
--- +++ @@ -32,13 +32,15 @@ return ( <div className="next-up"> { - sessions.map(t => { + 0 < sessions.length + ? sessions.map(t => { return ( - <div key={t.name} className="next-up__track"> + <div key={t.id} className="next-up__track"> <Track { ...t } /> </div> ); }) + : <p>No upcoming sessions :-(</p> } </div> );
b8634e1657b592d8010074a49e90c928a18a76b7
client/src/components/WorkoutOptions.jsx
client/src/components/WorkoutOptions.jsx
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { allWorkouts } from '../utils.js'; class WorkoutOptions extends Component { constructor(props) { super(props); } render() { const { currentWorkout } = this.props; return ( <div className="ui seven item menu"> {Object.keys(allWorkouts).map(workout => ( <a className={workout === currentWorkout ? "active item" : "item"}> {allWorkouts[workout].name} </a>) )} </div> ) } } const mapStateToProps = (state) => { return { currentWorkout: state.displayedPlayers.workout } } const mapDispatchToProps = (dispatch) => { return {}; } export default connect(mapStateToProps, mapDispatchToProps)(WorkoutOptions);
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { allWorkouts } from '../utils.js'; import { changeWorkout } from '../actions.js'; class WorkoutOptions extends Component { constructor(props) { super(props); } render() { const { currentWorkout, changeWorkout } = this.props; return ( <div className="ui seven item menu"> {Object.keys(allWorkouts).map(workout => ( <a className={workout === currentWorkout ? "active item" : "item"} onClick={() => changeWorkout(workout)} key={workout.name} > {allWorkouts[workout].name} </a>) )} </div> ) } } const mapStateToProps = (state) => { return { currentWorkout: state.displayedPlayers.workout } } const mapDispatchToProps = (dispatch) => { return { changeWorkout: workout => dispatch(changeWorkout(workout)) }; } export default connect(mapStateToProps, mapDispatchToProps)(WorkoutOptions);
Allow user to choose different workouts
Allow user to choose different workouts
JSX
mit
smclendening/nfl-draft,smclendening/nfl-draft
--- +++ @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; import { allWorkouts } from '../utils.js'; +import { changeWorkout } from '../actions.js'; class WorkoutOptions extends Component { constructor(props) { @@ -8,12 +9,16 @@ } render() { - const { currentWorkout } = this.props; + const { currentWorkout, changeWorkout } = this.props; return ( <div className="ui seven item menu"> {Object.keys(allWorkouts).map(workout => ( - <a className={workout === currentWorkout ? "active item" : "item"}> + <a + className={workout === currentWorkout ? "active item" : "item"} + onClick={() => changeWorkout(workout)} + key={workout.name} + > {allWorkouts[workout].name} </a>) )} @@ -29,7 +34,9 @@ } const mapDispatchToProps = (dispatch) => { - return {}; + return { + changeWorkout: workout => dispatch(changeWorkout(workout)) + }; } export default connect(mapStateToProps, mapDispatchToProps)(WorkoutOptions);
6c13452a756c26b6d24576da2fb42919e10524a1
public/jsx/sc_selector.jsx
public/jsx/sc_selector.jsx
class ScSelector extends React.Component { constructor(props) { super(props); this.state = { firstName: "Index" } this.activate = this.activate.bind(this); } activate(name, setActiveTab) { console.log("ScSelector.activate " + name); if (name == this.state.firstName) { ReactDOM.render( <SupportConfigIndex setActiveTab={setActiveTab}/>, document.getElementById('body') ); } else { ReactDOM.render( <SupportConfig name={name}/>, document.getElementById('body') ); } } render() { return <Tabs firstName={this.state.firstName} activateTab={this.activate}/>; } }
class ScSelector extends React.Component { constructor(props) { super(props); this.activate = this.activate.bind(this); } activate(name, setActiveTab) { console.log("ScSelector.activate " + name); if (name == this.props.firstName) { ReactDOM.render( <SupportConfigIndex setActiveTab={setActiveTab}/>, document.getElementById('body') ); } else { ReactDOM.render( <SupportConfig name={name}/>, document.getElementById('body') ); } } render() { return <Tabs firstName={this.props.firstName} activateTab={this.activate}/>; } } ScSelector.defaultProps = { firstName: "Index" };
Make firstName a prop if sc_index, not a state
Make firstName a prop if sc_index, not a state
JSX
bsd-3-clause
kkaempf/Ongorora,kkaempf/Ongorora,kkaempf/Ongorora
--- +++ @@ -1,14 +1,11 @@ class ScSelector extends React.Component { constructor(props) { super(props); - this.state = { - firstName: "Index" - } this.activate = this.activate.bind(this); } activate(name, setActiveTab) { console.log("ScSelector.activate " + name); - if (name == this.state.firstName) { + if (name == this.props.firstName) { ReactDOM.render( <SupportConfigIndex setActiveTab={setActiveTab}/>, document.getElementById('body') @@ -22,6 +19,8 @@ } } render() { - return <Tabs firstName={this.state.firstName} activateTab={this.activate}/>; + return <Tabs firstName={this.props.firstName} activateTab={this.activate}/>; } } + +ScSelector.defaultProps = { firstName: "Index" };
61a98d30528d08c6085340fbdd94e55d64e63e8d
app/src/components/LeftNav/index.jsx
app/src/components/LeftNav/index.jsx
import React, { PropTypes } from 'react'; import Drawer from 'material-ui/Drawer'; import MenuItem from 'material-ui/MenuItem'; import { CLOSE_LEFT_NAV, OPEN_SETTINGS, OPEN_SYNC_STATUS } from '../../constants'; // TODO add icons const LeftNav = ({ open, handleAction }) => <Drawer open={open}> <MenuItem onTouchTap={() => handleAction(CLOSE_LEFT_NAV)}>Close</MenuItem> <MenuItem onTouchTap={() => { handleAction(OPEN_SETTINGS); handleAction(CLOSE_LEFT_NAV); }} > Settings </MenuItem> <MenuItem onTouchTap={() => { handleAction(OPEN_SYNC_STATUS); handleAction(CLOSE_LEFT_NAV); }} > Sync Status </MenuItem> {/* <MenuItem>Advanced Search</MenuItem> <MenuItem>About</MenuItem>*/} </Drawer>; LeftNav.propTypes = { open: PropTypes.bool, handleAction: PropTypes.func.isRequired, }; export default LeftNav;
import React, { PropTypes } from 'react'; import Drawer from 'material-ui/Drawer'; import MenuItem from 'material-ui/MenuItem'; import ArrowBack from 'material-ui/svg-icons/navigation/arrow-back'; import Settings from 'material-ui/svg-icons/action/settings'; import Backup from 'material-ui/svg-icons/action/backup'; import { CLOSE_LEFT_NAV, OPEN_SETTINGS, OPEN_SYNC_STATUS } from '../../constants'; const LeftNav = ({ open, handleAction }) => <Drawer open={open}> <MenuItem leftIcon={<ArrowBack />} onTouchTap={() => handleAction(CLOSE_LEFT_NAV)} > Close </MenuItem> <MenuItem leftIcon={<Settings />} onTouchTap={() => { handleAction(OPEN_SETTINGS); handleAction(CLOSE_LEFT_NAV); }} > Settings </MenuItem> <MenuItem leftIcon={<Backup />} onTouchTap={() => { handleAction(OPEN_SYNC_STATUS); handleAction(CLOSE_LEFT_NAV); }} > Sync Status </MenuItem> {/* <MenuItem>Advanced Search</MenuItem> <MenuItem>About</MenuItem>*/} </Drawer>; LeftNav.propTypes = { open: PropTypes.bool, handleAction: PropTypes.func.isRequired, }; export default LeftNav;
Add icons to left nav
Add icons to left nav
JSX
mit
nponiros/bookmarks_manager,nponiros/bookmarks_manager
--- +++ @@ -1,13 +1,21 @@ import React, { PropTypes } from 'react'; import Drawer from 'material-ui/Drawer'; import MenuItem from 'material-ui/MenuItem'; +import ArrowBack from 'material-ui/svg-icons/navigation/arrow-back'; +import Settings from 'material-ui/svg-icons/action/settings'; +import Backup from 'material-ui/svg-icons/action/backup'; import { CLOSE_LEFT_NAV, OPEN_SETTINGS, OPEN_SYNC_STATUS } from '../../constants'; -// TODO add icons const LeftNav = ({ open, handleAction }) => <Drawer open={open}> - <MenuItem onTouchTap={() => handleAction(CLOSE_LEFT_NAV)}>Close</MenuItem> <MenuItem + leftIcon={<ArrowBack />} + onTouchTap={() => handleAction(CLOSE_LEFT_NAV)} + > + Close + </MenuItem> + <MenuItem + leftIcon={<Settings />} onTouchTap={() => { handleAction(OPEN_SETTINGS); handleAction(CLOSE_LEFT_NAV); @@ -16,6 +24,7 @@ Settings </MenuItem> <MenuItem + leftIcon={<Backup />} onTouchTap={() => { handleAction(OPEN_SYNC_STATUS); handleAction(CLOSE_LEFT_NAV);
cecdaa4aa9ad48a1d5cc2901e85e7367d2c623ad
app/pages/lab/translations/index.jsx
app/pages/lab/translations/index.jsx
import React from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import * as translationsActions from '../../../redux/ducks/translations'; class TranslationsManager extends React.Component { render() { return ( <p>Manage your project translations here.</p> ); } } const mapStateToProps = state => ({ translations: state.translations }); const mapDispatchToProps = dispatch => ({ actions: { translations: bindActionCreators(translationsActions, dispatch) } }); export default connect(mapStateToProps, mapDispatchToProps)(TranslationsManager); export { TranslationsManager };
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { Link } from 'react-router'; import * as translationsActions from '../../../redux/ducks/translations'; class TranslationsManager extends React.Component { componentDidMount() { const { translations } = this.props.actions; translations.listLanguages('project', this.props.project.id); } render() { const { languages } = this.props.translations; const { project } = this.props; return ( <div> <p>Manage your project translations here.</p> <ul> {languages.project && languages.project.map(languageCode => ( <li key={languageCode}> <Link to={`/projects/${project.slug}?language=${languageCode}`}>{languageCode}</Link> </li> ))} </ul> </div> ); } } const mapStateToProps = state => ({ translations: state.translations }); const mapDispatchToProps = dispatch => ({ actions: { translations: bindActionCreators(translationsActions, dispatch) } }); TranslationsManager.propTypes = { actions: PropTypes.shape({ translations: PropTypes.shape({ listLanguages: PropTypes.func }) }).isRequired, translations: PropTypes.shape({ languages: PropTypes.shape({ project: PropTypes.arrayOf(PropTypes.string) }) }), project: PropTypes.shape({ id: PropTypes.string }).isRequired }; TranslationsManager.defaultProps = { translations: { languages: { project: [] } } }; export default connect(mapStateToProps, mapDispatchToProps)(TranslationsManager); export { TranslationsManager };
Add a basic list of languages for the project List the available project language codes, each linked to the project in that language.
Add a basic list of languages for the project List the available project language codes, each linked to the project in that language.
JSX
apache-2.0
amyrebecca/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,zooniverse/Panoptes-Front-End,amyrebecca/Panoptes-Front-End
--- +++ @@ -1,12 +1,30 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; +import { Link } from 'react-router'; import * as translationsActions from '../../../redux/ducks/translations'; class TranslationsManager extends React.Component { + componentDidMount() { + const { translations } = this.props.actions; + translations.listLanguages('project', this.props.project.id); + } + render() { + const { languages } = this.props.translations; + const { project } = this.props; return ( - <p>Manage your project translations here.</p> + <div> + <p>Manage your project translations here.</p> + <ul> + {languages.project && languages.project.map(languageCode => ( + <li key={languageCode}> + <Link to={`/projects/${project.slug}?language=${languageCode}`}>{languageCode}</Link> + </li> + ))} + </ul> + </div> ); } } @@ -21,5 +39,29 @@ } }); +TranslationsManager.propTypes = { + actions: PropTypes.shape({ + translations: PropTypes.shape({ + listLanguages: PropTypes.func + }) + }).isRequired, + translations: PropTypes.shape({ + languages: PropTypes.shape({ + project: PropTypes.arrayOf(PropTypes.string) + }) + }), + project: PropTypes.shape({ + id: PropTypes.string + }).isRequired +}; + +TranslationsManager.defaultProps = { + translations: { + languages: { + project: [] + } + } +}; + export default connect(mapStateToProps, mapDispatchToProps)(TranslationsManager); export { TranslationsManager };
b5e06aae3b54187b3e859ea248ca98b46313175e
src/components/parts/Header.jsx
src/components/parts/Header.jsx
// This component renders a nav bar which has dropdowns for the card selection import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import { Link } from 'react-router'; import NavBar from 'react-bootstrap/lib/Navbar'; import Nav from 'react-bootstrap/lib/Nav'; import DropdownButton from 'react-bootstrap/lib/DropdownButton'; // Connect to the stores that the header uses var select = (state) => ({ SetStore: state.SetStore }); export default class Header extends Component { static propTypes = { SetStore: PropTypes.array.isRequired }; render() { const { SetStore } = this.props; var siteName = 'Dominion Card Spoilers'; return ( <NavBar staticTop> <Nav> <div className='navbar-header'><span className='navbar-brand'>{siteName}</span></div> { SetStore.length > 0 ? ( <DropdownButton id="set-dropdown" eventKey={1} title='Set'> {SetStore.map((set) => ( <li id={set} key={set}> <Link to={`/set/${set}`}>{set}</Link> </li> ))} </DropdownButton> ) : null} </Nav> </NavBar> ); } } export default connect(select)(Header);
// This component renders a nav bar which has dropdowns for the card selection import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import { Link } from 'react-router'; import NavBar from 'react-bootstrap/lib/Navbar'; import Nav from 'react-bootstrap/lib/Nav'; import DropdownButton from 'react-bootstrap/lib/DropdownButton'; // Connect to the stores that the header uses var select = (state) => ({ SetStore: state.SetStore }); export default class Header extends Component { static propTypes = { SetStore: PropTypes.array.isRequired }; render() { const { SetStore } = this.props; var siteName = 'Dominion Card Spoilers'; return ( <NavBar staticTop> <Nav> <div className='navbar-header'><span className='navbar-brand'>{siteName}</span></div> { SetStore.length > 0 ? ( <DropdownButton id="set-dropdown" eventKey={1} title='Choose Expansion'> {SetStore.map((set) => ( <li id={set} key={set}> <Link to={`/set/${set}`}>{set}</Link> </li> ))} </DropdownButton> ) : null} </Nav> </NavBar> ); } } export default connect(select)(Header);
Change dropdown title to Choose Expansion
Change dropdown title to Choose Expansion
JSX
mit
mdiehr/dominion,mdiehr/dominion
--- +++ @@ -26,7 +26,7 @@ <Nav> <div className='navbar-header'><span className='navbar-brand'>{siteName}</span></div> { SetStore.length > 0 ? ( - <DropdownButton id="set-dropdown" eventKey={1} title='Set'> + <DropdownButton id="set-dropdown" eventKey={1} title='Choose Expansion'> {SetStore.map((set) => ( <li id={set} key={set}> <Link to={`/set/${set}`}>{set}</Link>
f1805c2a81f6379cc130da51fe962948a4c89f13
shared/components/table-of-contents.jsx
shared/components/table-of-contents.jsx
/** @jsx React.DOM */ export default React.createClass({ displayName: 'TableOfContents', selectors: [ '.secs > h2', '.secs > h3', '.secs > h4' ], getLists: function (target, selectorIndex, maxDepth) { var data = []; var headers = target.querySelectorAll(this.selectors[selectorIndex]); var header; var anchor; var section; var childHeaders; var nextSelector = selectorIndex + 1; for (var i = 0, l = headers.length; i < l; i++) { header = headers[i]; anchor = <a href={'#' + header.id}>{header.textContent}</a>; section = header.parentNode; childHeaders = section.querySelectorAll(this.selectors[nextSelector]); if (childHeaders.length > 0 && nextSelector <= maxDepth) { data.push( <li> {anchor} <ol> {this.getLists(section, nextSelector, maxDepth)} </ol> </li> ); } else { data.push( <li> {anchor} </li> ); } } return data; }, render: function () { var lists = this.getLists(this.props.contents, 0, this.props.maxDepth); return ( <ol role="directory">{lists}</ol> ); } });
/** @jsx React.DOM */ export default React.createClass({ displayName: 'TableOfContents', selectors: [ '.secs > h2', '.secs > h3', '.secs > h4' ], getLists: function (target, selectorIndex, maxDepth) { var data = []; var headers = target.querySelectorAll(this.selectors[selectorIndex]); var header; var anchor; var section; var childHeaders; var nextSelector = selectorIndex + 1; for (var i = 0, l = headers.length; i < l; i++) { header = headers[i]; anchor = <a href={'#' + header.id}>{header.textContent}</a>; section = header.parentNode; childHeaders = section.querySelectorAll(this.selectors[nextSelector]); if (childHeaders.length > 0 && nextSelector < maxDepth) { data.push( <li> {anchor} <ol> {this.getLists(section, nextSelector, maxDepth)} </ol> </li> ); } else { data.push( <li> {anchor} </li> ); } } return data; }, render: function () { var lists = this.getLists(this.props.contents, 0, this.props.maxDepth); return ( <ol role="directory">{lists}</ol> ); } });
Fix TOC component's `maxDepth` comparison
Fix TOC component's `maxDepth` comparison This changes the interpretation of the TOC component's `maxDepth`. A `maxDepth = 2`, should mean two levels of headings in the TOC, not three.
JSX
bsd-3-clause
ericf/formatjs-site,ericf/formatjs-site
--- +++ @@ -23,7 +23,7 @@ anchor = <a href={'#' + header.id}>{header.textContent}</a>; section = header.parentNode; childHeaders = section.querySelectorAll(this.selectors[nextSelector]); - if (childHeaders.length > 0 && nextSelector <= maxDepth) { + if (childHeaders.length > 0 && nextSelector < maxDepth) { data.push( <li> {anchor}
a67354b3a975177fccf3e75aafcc3b41b461a839
src/app/components/simple-selectable-list/SimpleSelectableListItem.jsx
src/app/components/simple-selectable-list/SimpleSelectableListItem.jsx
import React, { Component } from "react"; import PropTypes from "prop-types"; import { Link } from "react-router"; const propTypes = { title: PropTypes.string.isRequired, id: PropTypes.string.isRequired, url: PropTypes.string.isRequired, externalLink: PropTypes.bool.isRequired, details: PropTypes.arrayOf(PropTypes.string), disabled: PropTypes.bool }; const defaultProps = { externalLink: false }; export default class SimpleSelectableListItem extends Component { constructor(props) { super(props); } render() { const details = this.props.details || []; return ( <li className="simple-select-list__item"> {this.props.disabled ? ( <p className="simple-select-list__title simple-select-list__title--disabled">{this.props.title}</p> ) : this.props.externalLink ? ( <a href={this.props.url}> <p className="simple-select-list__title">{this.props.title}</p> </a> ) : ( <Link to={this.props.url}> <p className="simple-select-list__title">{this.props.title}</p> </Link> )} {details.map((detail, i) => { return <p key={`detail-${i}`}>{detail}</p>; })} </li> ); } } SimpleSelectableListItem.propTypes = propTypes; SimpleSelectableListItem.defaultProps = defaultProps;
import React, { Component } from "react"; import PropTypes from "prop-types"; import { Link } from "react-router"; const propTypes = { title: PropTypes.string.isRequired, id: PropTypes.string.isRequired, url: PropTypes.string.isRequired, externalLink: PropTypes.bool.isRequired, details: PropTypes.arrayOf(PropTypes.string), disabled: PropTypes.bool }; const defaultProps = { externalLink: false }; export default class SimpleSelectableListItem extends Component { constructor(props) { super(props); } renderTitle = () => { if (this.props.disabled) { return <p className="simple-select-list__title simple-select-list__title--disabled">{this.props.title}</p>; } if (this.props.externalLink) { return ( <a href={this.props.url}> <p className="simple-select-list__title">{this.props.title}</p> </a> ); } return ( <Link to={this.props.url}> <p className="simple-select-list__title">{this.props.title}</p> </Link> ); }; render() { const details = this.props.details || []; return ( <li className="simple-select-list__item"> {this.renderTitle()} {details.map((detail, i) => { return <p key={`detail-${i}`}>{detail}</p>; })} </li> ); } } SimpleSelectableListItem.propTypes = propTypes; SimpleSelectableListItem.defaultProps = defaultProps;
Move rendering of title to seperate method
Move rendering of title to seperate method
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -20,21 +20,31 @@ super(props); } + renderTitle = () => { + if (this.props.disabled) { + return <p className="simple-select-list__title simple-select-list__title--disabled">{this.props.title}</p>; + } + + if (this.props.externalLink) { + return ( + <a href={this.props.url}> + <p className="simple-select-list__title">{this.props.title}</p> + </a> + ); + } + + return ( + <Link to={this.props.url}> + <p className="simple-select-list__title">{this.props.title}</p> + </Link> + ); + }; + render() { const details = this.props.details || []; return ( <li className="simple-select-list__item"> - {this.props.disabled ? ( - <p className="simple-select-list__title simple-select-list__title--disabled">{this.props.title}</p> - ) : this.props.externalLink ? ( - <a href={this.props.url}> - <p className="simple-select-list__title">{this.props.title}</p> - </a> - ) : ( - <Link to={this.props.url}> - <p className="simple-select-list__title">{this.props.title}</p> - </Link> - )} + {this.renderTitle()} {details.map((detail, i) => { return <p key={`detail-${i}`}>{detail}</p>; })}
831ff6c95fda0031739c0fa46a5e92762fd91779
src/components/side-panel/SidePanel.jsx
src/components/side-panel/SidePanel.jsx
// @flow import React from 'react'; import Tabs from './tabs/Tabs'; import AddSwatchesPanel from './add-swatches/AddSwatchesPanel'; import AboutPanel from './about/AboutPanel'; import type { PaletteType } from '../../../types'; type Props = { addNewSwatch: Function, // eslint-disable-line react/no-unused-prop-types tabs: Array<string>, activeTab: string, switchActiveTab: Function, palettes: Array<PaletteType>, // eslint-disable-line react/no-unused-prop-types deleteSwatches: Function // eslint-disable-line react/no-unused-prop-types } const SidePanel = (props: Props): React$Element<any> => ( <div className="sidepanel"> <header className="sidepanel__header bg-secondary"> <Tabs tabs={props.tabs} activeTab={props.activeTab} switchActiveTab={props.switchActiveTab} /> </header> <main className="sidepanel__content"> {props.activeTab === 'add swatches' && <AddSwatchesPanel addNewSwatch={props.addNewSwatch} deleteSwatches={props.deleteSwatches} palettes={props.palettes} />} {props.activeTab === 'about' && <AboutPanel />} </main> </div> ); export default SidePanel;
// @flow import React from 'react'; import Tabs from './tabs/Tabs'; import AddSwatchesPanel from './add-swatches/AddSwatchesPanel'; import AboutPanel from './about/AboutPanel'; import type { PaletteType } from '../../../types'; type Props = { addNewSwatch: Function, tabs: Array<string>, activeTab: string, switchActiveTab: Function, palettes: Array<PaletteType>, deleteSwatches: Function } const SidePanel = (props: Props): React$Element<any> => ( <div className="sidepanel"> <header className="sidepanel__header bg-secondary"> <Tabs tabs={props.tabs} activeTab={props.activeTab} switchActiveTab={props.switchActiveTab} /> </header> <main className="sidepanel__content"> {props.activeTab === 'add swatches' && <AddSwatchesPanel addNewSwatch={props.addNewSwatch} deleteSwatches={props.deleteSwatches} palettes={props.palettes} />} {props.activeTab === 'about' && <AboutPanel />} </main> </div> ); export default SidePanel;
Remove unused eslint disable rules
[Refactor] Remove unused eslint disable rules
JSX
isc
eddyerburgh/palette-picker,eddyerburgh/palette-picker
--- +++ @@ -7,12 +7,12 @@ import type { PaletteType } from '../../../types'; type Props = { - addNewSwatch: Function, // eslint-disable-line react/no-unused-prop-types + addNewSwatch: Function, tabs: Array<string>, activeTab: string, switchActiveTab: Function, - palettes: Array<PaletteType>, // eslint-disable-line react/no-unused-prop-types - deleteSwatches: Function // eslint-disable-line react/no-unused-prop-types + palettes: Array<PaletteType>, + deleteSwatches: Function } const SidePanel = (props: Props): React$Element<any> => (
c50fbb96590bbd9a768bdc29627c51e2e31df8c5
app/javascript/components/meal/extras.jsx
app/javascript/components/meal/extras.jsx
import React from "react"; import { inject, observer } from "mobx-react"; const styles = { main: { padding: "1rem 0 0 1rem", backgroundColor: "white" }, open: { visibility: "hidden" }, closed: {}, title: { textDecoration: "underline" } }; const Extras = inject("store")( observer(({ store }) => ( <div style={styles.main}> <h5 style={styles.title}>Extras</h5> <div style={store.meal && store.meal.closed ? styles.closed : styles.open} > {[0, 1, 2, 3, 4, 5, 6, 7, 8].map(val => { return ( <div key={val} className="pretty p-default p-round p-fill"> <input key={val} type="checkbox" value={val} checked={store.meal && store.meal.extras === val} onChange={e => store.meal.setExtras(e.target.value)} disabled={store.meal && store.meal.reconciled} /> <div className="state p-success"> <label>{val}</label> </div> </div> ); })} </div> </div> )) ); export default Extras;
import React from "react"; import { inject, observer } from "mobx-react"; const styles = { main: { padding: "1rem 0 0 1rem", backgroundColor: "white" }, open: { visibility: "hidden" }, closed: {}, title: { textDecoration: "underline" } }; const Extras = inject("store")( observer(({ store }) => ( <div style={styles.main}> <h5 style={styles.title}>Extras</h5> <div style={store.meal && store.meal.closed ? styles.closed : styles.open} > {[0, 1, 2, 3, 4, 5, 6, 7, 8].map(val => { return ( <div key={val} className="pretty p-default p-round p-fill"> <input key={val} type="checkbox" value={val} checked={store.meal ? store.meal.extras === val : false} onChange={e => store.meal.setExtras(e.target.value)} disabled={store.meal ? store.meal.reconciled : false} /> <div className="state p-success"> <label>{val}</label> </div> </div> ); })} </div> </div> )) ); export default Extras;
Fix for unconrolled component warning due to initial null value
Fix for unconrolled component warning due to initial null value
JSX
mit
joyvuu-dave/comeals-rewrite,joyvuu-dave/comeals-rewrite,joyvuu-dave/comeals-rewrite
--- +++ @@ -29,9 +29,9 @@ key={val} type="checkbox" value={val} - checked={store.meal && store.meal.extras === val} + checked={store.meal ? store.meal.extras === val : false} onChange={e => store.meal.setExtras(e.target.value)} - disabled={store.meal && store.meal.reconciled} + disabled={store.meal ? store.meal.reconciled : false} /> <div className="state p-success"> <label>{val}</label>
af2eb5823f9be6332f99a15c705fedf4f458b5bd
client/javascript/components/Document.jsx
client/javascript/components/Document.jsx
import React from 'react'; import classNames from 'classnames'; class Document extends React.Component { render() { const elementClasses = classNames({ 'document': true, 'selected': this.props.selected }); return ( <div className={elementClasses} onClick={this.props.onClick}> <div className="title">{this.props.title}</div> <div className="last-modified">{this.props.lastModified}</div> <div className="permission"></div> </div> ); } } Document.propTypes = { title: React.PropTypes.string, lastModified: React.PropTypes.string, selected: React.PropTypes.bool, onClick: React.PropTypes.func }; export default Document;
import React from 'react'; import classNames from 'classnames'; class Document extends React.Component { render() { const elementClasses = classNames({ document: true, selected: this.props.selected }); return ( <div className={elementClasses} onClick={this.props.onClick}> <div className="title">{this.props.title}</div> <div className="last-modified">{this.props.lastModified}</div> <div className="permission"></div> </div> ); } } Document.propTypes = { title: React.PropTypes.string, lastModified: React.PropTypes.string, selected: React.PropTypes.bool, onClick: React.PropTypes.func }; export default Document;
Fix ESLint problem of property quotes
Fix ESLint problem of property quotes
JSX
bsd-3-clause
zesik/insnota,zesik/insnota
--- +++ @@ -4,8 +4,8 @@ class Document extends React.Component { render() { const elementClasses = classNames({ - 'document': true, - 'selected': this.props.selected + document: true, + selected: this.props.selected }); return ( <div className={elementClasses} onClick={this.props.onClick}>
f42c8f5da8d56a0bde3186340603432cdcd1311e
src/components/AtBat.jsx
src/components/AtBat.jsx
import React from 'react'; import { useSelector } from 'react-redux'; import { selectCurrentPlay } from '../features/games'; function AtBat() { const currentPlay = useSelector(selectCurrentPlay); const playEvents = currentPlay.playEvents; const playResult = currentPlay.about.isComplete ? currentPlay.result.description : ''; const content = playEvents && playEvents.slice().reverse().map(event => { let line = ''; if (event.isPitch) { line = `[${event.details.description}] `; if (event.pitchData?.startSpeed) { line += `${event.pitchData.startSpeed} MPH `; } if (event.details?.type?.description) { line += event.details.type.description; } if (!event.details?.isInPlay) { line += `{|} ${event.count.balls}-${event.count.strikes}`; } } else { if (event.details?.event) { line += `[${event.details.event}] `; } line += event.details.description; } return line; }).join('\n') + `\n\n${playResult}`; return ( <box content={content} tags /> ); } export default AtBat;
import React from 'react'; import { useSelector } from 'react-redux'; import { selectCurrentPlay } from '../features/games'; function AtBat() { const currentPlay = useSelector(selectCurrentPlay); const playEvents = currentPlay.playEvents; const playResult = currentPlay.about.isComplete ? currentPlay.result.description : ''; let content = ''; if (playResult) { content += `${playResult}\n\n`; } if (playEvents && playEvents.length) { content += playEvents.slice().reverse().map(event => { let line = ''; if (event.isPitch) { line = `[${event.details.description}] `; if (event.pitchData?.startSpeed) { line += `${event.pitchData.startSpeed} MPH `; } if (event.details?.type?.description) { line += event.details.type.description; } if (!event.details?.isInPlay) { line += `{|} ${event.count.balls}-${event.count.strikes}`; } } else { if (event.details?.event) { line += `[${event.details.event}] `; } line += event.details.description; } return line; }).join('\n'); } return ( <box content={content} tags /> ); } export default AtBat;
Move play result to top of at bat display
Move play result to top of at bat display
JSX
mit
paaatrick/playball
--- +++ @@ -6,27 +6,33 @@ const currentPlay = useSelector(selectCurrentPlay); const playEvents = currentPlay.playEvents; const playResult = currentPlay.about.isComplete ? currentPlay.result.description : ''; - const content = playEvents && playEvents.slice().reverse().map(event => { - let line = ''; - if (event.isPitch) { - line = `[${event.details.description}] `; - if (event.pitchData?.startSpeed) { - line += `${event.pitchData.startSpeed} MPH `; + let content = ''; + if (playResult) { + content += `${playResult}\n\n`; + } + if (playEvents && playEvents.length) { + content += playEvents.slice().reverse().map(event => { + let line = ''; + if (event.isPitch) { + line = `[${event.details.description}] `; + if (event.pitchData?.startSpeed) { + line += `${event.pitchData.startSpeed} MPH `; + } + if (event.details?.type?.description) { + line += event.details.type.description; + } + if (!event.details?.isInPlay) { + line += `{|} ${event.count.balls}-${event.count.strikes}`; + } + } else { + if (event.details?.event) { + line += `[${event.details.event}] `; + } + line += event.details.description; } - if (event.details?.type?.description) { - line += event.details.type.description; - } - if (!event.details?.isInPlay) { - line += `{|} ${event.count.balls}-${event.count.strikes}`; - } - } else { - if (event.details?.event) { - line += `[${event.details.event}] `; - } - line += event.details.description; - } - return line; - }).join('\n') + `\n\n${playResult}`; + return line; + }).join('\n'); + } return ( <box content={content} tags /> );
270a103569aa44cd840dcbf467c3d108da32fad1
templates/client/modules/core/components/home.jsx
templates/client/modules/core/components/home.jsx
import React from 'react'; const Home = React.createClass({ render() { return ( <div> <h1>Mantra</h1> <p> Welcome to Mantra 0.2.0. </p> <p> <ul> <li> Read <a target="_blank" href="https://kadirahq.github.io/mantra/">spec</a> </li> <li> Learn <a target="_blank" href="https://github.com/sungwoncho/mantra-cli#commands">CLI</a> </li> </ul> </p> </div> ); } }); export default Home;
import React from 'react'; const Home = () => ( <div> <h1>Mantra</h1> <p> Welcome to Mantra 0.2.0. </p> <p> <ul> <li> Read <a target="_blank" href="https://kadirahq.github.io/mantra/">spec</a> </li> <li> Learn <a target="_blank" href="https://github.com/sungwoncho/mantra-cli#commands">CLI</a> </li> </ul> </p> </div> ); export default Home;
Use stateless component for autogenerated Home component
Use stateless component for autogenerated Home component
JSX
mit
StorytellerCZ/mantra-cli,mcmunder/bija,mantrajs/mantra-cli,StorytellerCZ/mantra-cli,sungwoncho/mantra-cli,mantrajs/mantra-cli
--- +++ @@ -1,26 +1,22 @@ import React from 'react'; -const Home = React.createClass({ - render() { - return ( - <div> - <h1>Mantra</h1> - <p> - Welcome to Mantra 0.2.0. - </p> - <p> - <ul> - <li> - Read <a target="_blank" href="https://kadirahq.github.io/mantra/">spec</a> - </li> - <li> - Learn <a target="_blank" href="https://github.com/sungwoncho/mantra-cli#commands">CLI</a> - </li> - </ul> - </p> - </div> - ); - } -}); +const Home = () => ( + <div> + <h1>Mantra</h1> + <p> + Welcome to Mantra 0.2.0. + </p> + <p> + <ul> + <li> + Read <a target="_blank" href="https://kadirahq.github.io/mantra/">spec</a> + </li> + <li> + Learn <a target="_blank" href="https://github.com/sungwoncho/mantra-cli#commands">CLI</a> + </li> + </ul> + </p> + </div> +); export default Home;
e54fb960ede199c173b0de1e165c273b288957aa
src/components/BoundingBox.jsx
src/components/BoundingBox.jsx
import React from 'react'; import {Shape, Group} from 'react-art'; import Colors from '../styles/Colors.js'; import {drawRectBetweenTwoPoints, PropTypes} from './utils/DrawingUtils.js'; /** * A bounding box is a transparent box used to detect mouse events near a component. */ export default class BoundingBox extends React.Component { render() { const end1 = this.props.from, end2 = this.props.to, boundingBoxPath = drawRectBetweenTwoPoints(end1, end2, this.props.width); return ( <Group> {this.props.children} <Shape // at the bottom to properly detect mouse events onMouseOver={this.props.handlers.mouseOver} onMouseOut={this.props.handlers.mouseOut} fill={Colors.transparent} d={boundingBoxPath} /> </Group> ); } } BoundingBox.propTypes = { from: PropTypes.Vector.isRequired, to: PropTypes.Vector.isRequired, width: React.PropTypes.number.isRequired, handlers: React.PropTypes.shape({ mouseOver: PropTypes.ArtListener, mouseOut: PropTypes.ArtListener }) }; function noop () { } BoundingBox.defaultProps = { mouseOver: noop, mouseOut: noop };
import React from 'react'; import {Shape, Group} from 'react-art'; import Colors from '../styles/Colors.js'; import {drawRectBetweenTwoPoints, PropTypes} from './utils/DrawingUtils.js'; /** * A bounding box is a transparent box used to detect mouse events near a component. */ export default class BoundingBox extends React.Component { render() { const end1 = this.props.from, end2 = this.props.to, boundingBoxPath = drawRectBetweenTwoPoints(end1, end2, this.props.width), handlers = this.props.handlers || {}; return ( <Group> {this.props.children} <Shape // at the bottom to properly detect mouse events onMouseOver={handlers.mouseOver} onMouseOut={handlers.mouseOut} fill={Colors.transparent} d={boundingBoxPath} /> </Group> ); } } BoundingBox.propTypes = { from: PropTypes.Vector.isRequired, to: PropTypes.Vector.isRequired, width: React.PropTypes.number.isRequired, handlers: React.PropTypes.shape({ mouseOver: PropTypes.ArtListener, mouseOut: PropTypes.ArtListener }) }; function noop () { } BoundingBox.defaultProps = { mouseOver: noop, mouseOut: noop };
Handle having no handlers in bounding box
Handle having no handlers in bounding box
JSX
epl-1.0
circuitsim/circuit-simulator,circuitsim/circuit-simulator,circuitsim/circuit-simulator
--- +++ @@ -13,14 +13,15 @@ render() { const end1 = this.props.from, end2 = this.props.to, - boundingBoxPath = drawRectBetweenTwoPoints(end1, end2, this.props.width); + boundingBoxPath = drawRectBetweenTwoPoints(end1, end2, this.props.width), + handlers = this.props.handlers || {}; return ( <Group> {this.props.children} <Shape // at the bottom to properly detect mouse events - onMouseOver={this.props.handlers.mouseOver} - onMouseOut={this.props.handlers.mouseOut} + onMouseOver={handlers.mouseOver} + onMouseOut={handlers.mouseOut} fill={Colors.transparent} d={boundingBoxPath} />
a2b399da0f27deee45b04f92fd07242d725cb20c
src/js/components/next-up/index.jsx
src/js/components/next-up/index.jsx
import debug from "debug"; import React, { Component } from "react"; import Session from "../session"; const log = debug("schedule:components:next-up"); export class NextUp extends Component { render() { const { getState } = this.props; const { days, time: { today, now } } = getState(); let currentDay = Object.keys(days).filter(d => today <= new Date(d)).shift(); let tracks = Object.keys(days[currentDay].tracks).map(name => ({ name, sessions: days[currentDay].tracks[name] })); let nextSessions = tracks.map(t => { return { ...t, sessions: [t.sessions.filter(s => now <= s.start).shift()] }; }). sort((a, b) => { return Number(a.sessions[0].start) - Number(b.sessions[0].start); }); return ( <div className="next-up"> { nextSessions.map(t => { return ( <div className="next-up__session"> <h2>Track: {t.name}</h2> <Session session={t.next} /> </div> ); }) } </div> ); } } export default NextUp;
import debug from "debug"; import React, { Component } from "react"; import Track from "../track"; const log = debug("schedule:components:next-up"); export class NextUp extends Component { render() { const { getState } = this.props; const { days, time: { today, now } } = getState(); let currentDay = Object.keys(days).filter(d => today <= new Date(d)).shift(); let tracks = Object.keys(days[currentDay].tracks).map(name => ({ name, sessions: days[currentDay].tracks[name] })); let nextSessions = tracks.map(t => { return { ...t, sessions: [t.sessions.filter(s => now <= s.start).shift()] }; }). sort((a, b) => { return Number(a.sessions[0].start) - Number(b.sessions[0].start); }); return ( <div className="next-up"> { nextSessions.map(t => { return ( <div key={t.name} className="next-up__session"> <Track { ...t } /> </div> ); }) } </div> ); } } export default NextUp;
Fix use track component in next-up view
Fix use track component in next-up view
JSX
mit
orangecms/schedule,orangecms/schedule,nikcorg/schedule,orangecms/schedule,nikcorg/schedule,nikcorg/schedule
--- +++ @@ -1,6 +1,6 @@ import debug from "debug"; import React, { Component } from "react"; -import Session from "../session"; +import Track from "../track"; const log = debug("schedule:components:next-up"); @@ -27,9 +27,8 @@ { nextSessions.map(t => { return ( - <div className="next-up__session"> - <h2>Track: {t.name}</h2> - <Session session={t.next} /> + <div key={t.name} className="next-up__session"> + <Track { ...t } /> </div> ); })
b70198cb248e881e966f871e2eed0fd4b19bc7f9
app/components/Header/index.jsx
app/components/Header/index.jsx
import React from 'react'; import './style'; import Auth from '../Auth'; import BoardSelector from '../BoardSelector'; import { asanaUrl } from '../../utils' const Header = ({auth, projectName, projectId}) => { let headerButton = <Auth />; if (auth.isAsanaAuthed) { let url = asanaUrl(); if (projectId !== null) { url = url + `0/${projectId}`; } headerButton = <a className="header__cta cta" href={url} target="_blank">Open asana</a>; } return ( <header className="header"> <div className="pure-u-8-24"> <div className="header__breadcrumbs"> <BoardSelector /> <span className="header__current-project">{projectName}</span> </div> </div> <div className="pure-u-8-24 header__logo__wrapper"> <img className="header__logo" src="logo.jpg" /> </div> <div className="pure-u-8-24"> <div className="pull-right"> {headerButton} </div> </div> </header> ) } export default Header;
import React from 'react'; import './style'; import Auth from '../Auth'; import BoardSelector from '../BoardSelector'; import { asanaUrl } from '../../utils' const Header = ({auth, projectName, projectId}) => { let headerButton = <Auth />; if (auth.isAsanaAuthed) { let url = asanaUrl(); if (projectId !== null) { url = url + `0/${projectId}`; } headerButton = <a className="header__cta cta" href={url} target="_blank">Open asana</a>; } return ( <header className="header"> <div className="pure-u-8-24"> <div className="header__breadcrumbs"> { auth.isAsanaAuthed && <BoardSelector /> } <span className="header__current-project">{projectName}</span> </div> </div> <div className="pure-u-8-24 header__logo__wrapper"> <img className="header__logo" src="logo.jpg" /> </div> <div className="pure-u-8-24"> <div className="pull-right"> {headerButton} </div> </div> </header> ) } export default Header;
Hide projects button when not authed
Hide projects button when not authed
JSX
isc
SmoofCreative/kasban,SmoofCreative/kasban
--- +++ @@ -22,7 +22,7 @@ <header className="header"> <div className="pure-u-8-24"> <div className="header__breadcrumbs"> - <BoardSelector /> + { auth.isAsanaAuthed && <BoardSelector /> } <span className="header__current-project">{projectName}</span> </div> </div>
1a580957821e21c9e6199b8b4e1543f64094ffb5
src/views/join/join.jsx
src/views/join/join.jsx
const React = require('react'); const render = require('../../lib/render.jsx'); const JoinModal = require('../../components/modal/join/modal.jsx'); const ErrorBoundary = require('../../components/errorboundary/errorboundary.jsx'); // Require this even though we don't use it because, without it, webpack runs out of memory... const Page = require('../../components/page/www/page.jsx'); // eslint-disable-line no-unused-vars const openModal = true; const showCloseButton = false; const Register = () => ( <ErrorBoundary> <JoinModal isOpen={openModal} key="scratch3registration" showCloseButton={showCloseButton} /> </ErrorBoundary> ); render(<Register />, document.getElementById('app'));
const React = require('react'); const render = require('../../lib/render.jsx'); const JoinModal = require('../../components/modal/join/modal.jsx'); const ErrorBoundary = require('../../components/errorboundary/errorboundary.jsx'); // Require this even though we don't use it because, without it, webpack runs out of memory... const Page = require('../../components/page/www/page.jsx'); // eslint-disable-line no-unused-vars const Register = () => ( <ErrorBoundary> <JoinModal isOpen key="scratch3registration" showCloseButton={false} /> </ErrorBoundary> ); render(<Register />, document.getElementById('app'));
Put values directly in render props.
Put values directly in render props.
JSX
bsd-3-clause
LLK/scratch-www,LLK/scratch-www
--- +++ @@ -5,14 +5,12 @@ // Require this even though we don't use it because, without it, webpack runs out of memory... const Page = require('../../components/page/www/page.jsx'); // eslint-disable-line no-unused-vars -const openModal = true; -const showCloseButton = false; const Register = () => ( <ErrorBoundary> <JoinModal - isOpen={openModal} + isOpen key="scratch3registration" - showCloseButton={showCloseButton} + showCloseButton={false} /> </ErrorBoundary> );
38ea352d45257a11e9e6b26ebf77bcd17d04e3c7
src/components/pagination-links.jsx
src/components/pagination-links.jsx
import React from 'react' import {Link} from 'react-router' const PAGE_SIZE = 30 const offsetObject = offset => offset ? ({offset}) : undefined const minOffset = offset => Math.max(offset - PAGE_SIZE, 0) const maxOffset = offset => offset + PAGE_SIZE //deep merge is deep indeed const getNextRoute = (router, offset) => ({ ...router, location: { ...router.location, query: { ...router.location.query, offset } } }) const routingCallback = (props, offsetSelector) => _ => props.routingActions(props.routename)(getNextRoute(props, offsetSelector(props.offset))) export default props => ( <ul className="pager p-pagination-controls"> {props.offset > 0 ? <li> <Link to={{pathname:'', query: offsetObject(minOffset(props.offset))}} onClick={routingCallback(props, minOffset)} className="p-pagination-newer">« Newer items</Link> </li> : false} <li> <Link to={{pathname:'', query:offsetObject(maxOffset(props.offset))}} onClick={routingCallback(props, maxOffset)} className="p-pagination-older">Older items »</Link> </li> </ul> )
import React from 'react' import {Link} from 'react-router' const PAGE_SIZE = 30 const offsetObject = offset => offset ? ({offset}) : undefined const minOffset = offset => Math.max(offset - PAGE_SIZE, 0) const maxOffset = offset => offset + PAGE_SIZE //deep merge is deep indeed const getNextRoute = (router, offset) => ({ ...router, location: { ...router.location, query: { ...router.location.query, offset } } }) const routingCallback = (props, offsetSelector) => _ => props.routingActions(props.routename)(getNextRoute(props, offsetSelector(props.offset))) export default props => ( <ul className="pager p-pagination-controls"> {props.offset > 0 ? <li> <Link to={{pathname: props.location.pathname, query: offsetObject(minOffset(props.offset))}} onClick={routingCallback(props, minOffset)} className="p-pagination-newer">« Newer items</Link> </li> : false} <li> <Link to={{pathname: props.location.pathname, query: offsetObject(maxOffset(props.offset))}} onClick={routingCallback(props, maxOffset)} className="p-pagination-older">Older items »</Link> </li> </ul> )
Fix "Older items" for any page which is not Home
Fix "Older items" for any page which is not Home Fixes #338.
JSX
mit
FreeFeed/freefeed-html-react,kadmil/freefeed-react-client,FreeFeed/freefeed-react-client,davidmz/freefeed-react-client,clbn/freefeed-gamma,FreeFeed/freefeed-react-client,clbn/freefeed-gamma,kadmil/freefeed-react-client,davidmz/freefeed-react-client,davidmz/freefeed-react-client,ujenjt/freefeed-react-client,kadmil/freefeed-react-client,ujenjt/freefeed-react-client,ujenjt/freefeed-react-client,FreeFeed/freefeed-html-react,FreeFeed/freefeed-html-react,FreeFeed/freefeed-react-client,clbn/freefeed-gamma
--- +++ @@ -25,13 +25,13 @@ <ul className="pager p-pagination-controls"> {props.offset > 0 ? <li> - <Link to={{pathname:'', query: offsetObject(minOffset(props.offset))}} + <Link to={{pathname: props.location.pathname, query: offsetObject(minOffset(props.offset))}} onClick={routingCallback(props, minOffset)} className="p-pagination-newer">« Newer items</Link> </li> : false} <li> - <Link to={{pathname:'', query:offsetObject(maxOffset(props.offset))}} + <Link to={{pathname: props.location.pathname, query: offsetObject(maxOffset(props.offset))}} onClick={routingCallback(props, maxOffset)} className="p-pagination-older">Older items »</Link> </li>
4545a40a36063214fa9909f2e8e0e933f8358dcd
src/scrollto.jsx
src/scrollto.jsx
/** * Created by Aaron on 12/21/2015. */ import * as React from 'react'; //Algorithm described here: https://cgd.io/2008/using-javascript-to-scroll-to-a-specific-elementobject/ function findPos( element ) { var curtop = 0; if( element.offsetParent ) { do { curtop += element.offsetTop; } while( element = element.offsetParent ); return [curtop]; } } class ScrollToElement extends React.Component { static displayName = 'ScrollToElement'; static propTypes = { id: React.PropTypes.string.isRequired, component: React.PropTypes.node }; static defaultProps = { component: 'div' }; scroll() { let ref = this.refs['scroll']; let element = React.findDOMNode( ref ); if( typeof element.scrollIntoView === 'function' ) { element.scrollIntoView( true ); } else { const pos = this.findPos( element ); window.scroll( 0, pos ); } } render() { const {id, component, children} = this.props; return React.createElement( component, {...this.props, id, ref: 'scroll'}, children ); } } export default ScrollToElement;
/** * Created by Aaron on 12/21/2015. */ import * as React from 'react'; //Algorithm described here: https://cgd.io/2008/using-javascript-to-scroll-to-a-specific-elementobject/ function findPos( element ) { var curtop = 0; if( element.offsetParent ) { do { curtop += element.offsetTop; } while( element = element.offsetParent ); return [curtop]; } } class ScrollToElement extends React.Component { static displayName = 'ScrollToElement'; static propTypes = { id: React.PropTypes.string.isRequired, component: React.PropTypes.node }; static defaultProps = { component: 'div' }; scroll() { let ref = this.refs['scroll']; let element = React.findDOMNode( ref ); if( typeof element.scrollIntoView === 'function' ) { element.scrollIntoView( true ); } else { const pos = this.findPos( element ); if( pos ) { window.scroll( 0, pos ); } } } render() { const {id, component, children} = this.props; return React.createElement( component, {...this.props, id, ref: 'scroll'}, children ); } } export default ScrollToElement;
Test for position before scrolling to it
src: Test for position before scrolling to it
JSX
mit
novacrazy/react-scrollto,novacrazy/react-scrollto
--- +++ @@ -40,7 +40,9 @@ } else { const pos = this.findPos( element ); - window.scroll( 0, pos ); + if( pos ) { + window.scroll( 0, pos ); + } } }
8f3f55783ce161d98d46d39a279ee3b69419a69a
src/connection/enterprise/hrd_screen.jsx
src/connection/enterprise/hrd_screen.jsx
import React from 'react'; import Screen from '../../core/screen'; import { renderSignedInConfirmation } from '../../core/signed_in_confirmation'; import HRDPane from './hrd_pane'; import { cancelHRD, logIn } from './actions'; import { enterpriseDomain, isSingleHRDConnection } from '../enterprise'; const Component = ({model, t}) => { const headerText = t("enterpriseActiveLoginInstructions", {domain: enterpriseDomain(model)}) || null; const header = headerText && <p>{headerText}</p>; return ( <HRDPane header={header} model={model} passwordInputPlaceholder={t("passwordInputPlaceholder", {__textOnly: true})} usernameInputPlaceholder={t("usernameInputPlaceholder", {__textOnly: true})} /> ); } export default class HRDScreen extends Screen { constructor() { super("hrd"); } backHandler(model) { return isSingleHRDConnection(model) ? null : cancelHRD; } submitHandler(model) { return logIn; } renderAuxiliaryPane(model) { return renderSignedInConfirmation(model); } render() { return Component; } }
import React from 'react'; import Screen from '../../core/screen'; import { renderSignedInConfirmation } from '../../core/signed_in_confirmation'; import HRDPane from './hrd_pane'; import { cancelHRD, logIn } from './actions'; import { enterpriseDomain, isSingleHRDConnection } from '../enterprise'; const Component = ({i18n, model}) => { const headerText = i18n.html("enterpriseActiveLoginInstructions", {domain: enterpriseDomain(model)}) || null; const header = headerText && <p>{headerText}</p>; return ( <HRDPane header={header} model={model} passwordInputPlaceholder={i18n.str("passwordInputPlaceholder")} usernameInputPlaceholder={i18n.str("usernameInputPlaceholder")} /> ); } export default class HRDScreen extends Screen { constructor() { super("hrd"); } backHandler(model) { return isSingleHRDConnection(model) ? null : cancelHRD; } submitHandler(model) { return logIn; } renderAuxiliaryPane(model) { return renderSignedInConfirmation(model); } render() { return Component; } }
Use i18n.html in HRD screen
Use i18n.html in HRD screen
JSX
mit
mike-casas/lock,mike-casas/lock,mike-casas/lock
--- +++ @@ -5,16 +5,16 @@ import { cancelHRD, logIn } from './actions'; import { enterpriseDomain, isSingleHRDConnection } from '../enterprise'; -const Component = ({model, t}) => { - const headerText = t("enterpriseActiveLoginInstructions", {domain: enterpriseDomain(model)}) || null; +const Component = ({i18n, model}) => { + const headerText = i18n.html("enterpriseActiveLoginInstructions", {domain: enterpriseDomain(model)}) || null; const header = headerText && <p>{headerText}</p>; return ( <HRDPane header={header} model={model} - passwordInputPlaceholder={t("passwordInputPlaceholder", {__textOnly: true})} - usernameInputPlaceholder={t("usernameInputPlaceholder", {__textOnly: true})} + passwordInputPlaceholder={i18n.str("passwordInputPlaceholder")} + usernameInputPlaceholder={i18n.str("usernameInputPlaceholder")} /> ); }
fb75cc8799da25ce69db2a9edb47df86f4f80e19
app/components/Login.jsx
app/components/Login.jsx
import React from 'react' import {Link} from 'react-router' export const Login = ({ login }) => ( <div className="modal-login"> <nav> <button className="btn bg-blue"><span className="icon icon-facebook-square"></span>Facebook</button> <button className="btn bg-green"><span className="icon icon-google-plus-square"></span>Google</button> </nav> <form onSubmit={evt => { evt.preventDefault() login(evt.target.username.value, evt.target.password.value) } }> <input name="username" placeholder="e-mail" /> <input name="password" type="password" placeholder="password" /> <input className="btn btn-primary" type="submit" value="Login" /> </form> <div className="login-footer"> <p><Link href="#">Forgot Password?</Link></p> <p><Link href="#">Create account</Link></p> </div> </div> ) import {login} from 'APP/app/reducers/auth' import {connect} from 'react-redux' export default connect ( state => ({}), {login}, ) (Login)
import React from 'react' import {Link} from 'react-router' export const Login = ({ login }) => ( <div className="modal-login"> <nav> <button className="btn bg-blue"><span className="icon icon-facebook-square"></span>Facebook</button> <button className="btn bg-green"><span className="icon icon-google-plus-square"></span>Google</button> </nav> <form onSubmit={evt => { evt.preventDefault() login(evt.target.username.value, evt.target.password.value) } }> <input name="username" placeholder="e-mail" /> <input name="password" type="password" placeholder="password" /> <input className="btn btn-primary" type="submit" value="Login" /> </form> <div className="login-footer"> <p><Link href="#">Forgot Password?</Link></p> <p><Link to="/signup">Create account</Link></p> </div> </div> ) import {login} from 'APP/app/reducers/auth' import {connect} from 'react-redux' export default connect ( state => ({}), {login}, ) (Login)
Add link to signup page
Add link to signup page
JSX
mit
galxzx/pegma,galxzx/pegma,galxzx/pegma
--- +++ @@ -19,7 +19,7 @@ <div className="login-footer"> <p><Link href="#">Forgot Password?</Link></p> - <p><Link href="#">Create account</Link></p> + <p><Link to="/signup">Create account</Link></p> </div> </div>
5e2375848ae3bc4c7d37f74d83c9ce96663f2e18
src/app/views/collections/CollectionsController.jsx
src/app/views/collections/CollectionsController.jsx
import React, { Component } from 'react'; import { connect } from 'react-redux' import CollectionCreate from './create/CollectionCreate'; class Collections extends Component { constructor(props) { super(props); } render () { return ( <div> <div className="grid grid--justify-space-around"> <div className="grid__col-4"> <h1>Select a collection</h1> </div> <div className="grid__col-4"> <h1>Create a team</h1> </div> </div> </div> ) } } export default connect()(Collections);
import React, { Component } from 'react'; import { connect } from 'react-redux' import CollectionCreate from './create/CollectionCreate'; class Collections extends Component { constructor(props) { super(props); } handleCollectionCreateSuccess() { // route to collection details pane for new collection // update list of collections } render () { return ( <div> <div className="grid grid--justify-space-around"> <div className="grid__col-4"> <h1>Select a collection</h1> </div> <div className="grid__col-4"> <h1>Create a collection</h1> <CollectionCreate onSuccess={this.handleCollectionCreateSuccess}/> </div> </div> </div> ) } } export default connect()(Collections);
Add temporary handle create success fucntions and corect heading text
Add temporary handle create success fucntions and corect heading text
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -6,6 +6,11 @@ class Collections extends Component { constructor(props) { super(props); + } + + handleCollectionCreateSuccess() { + // route to collection details pane for new collection + // update list of collections } render () { @@ -17,8 +22,8 @@ </div> <div className="grid__col-4"> - <h1>Create a team</h1> - + <h1>Create a collection</h1> + <CollectionCreate onSuccess={this.handleCollectionCreateSuccess}/> </div> </div>
c2f23eda6529a9b9ea3f6c3216905e4d17b4e5a0
app/assets/javascripts/components/nav.jsx
app/assets/javascripts/components/nav.jsx
import React from 'react'; import { slide as Menu } from 'react-burger-menu'; class Nav extends React.Component { componentWillMount() { this.updateDimensions(); } componentDidMount() { window.addEventListener("resize", this.updateDimensions); } componentWillUnmount() { window.removeEventListener("resize", this.updateDimensions); } updateDimensions() { this.setState({ width: $(window).width(), height: $(window).height() }); } showSettings(event) { event.preventDefault(); } render() { let navBar; if (this.state.width < 500) { navBar = ( <div> <span>{this.state.width} x {this.state.height} </span> <Menu> <a id="home" className="menu-item" href="/">Home</a> <a id="about" className="menu-item" href="/about">About</a> <a id="contact" className="menu-item" href="/contact">Contact</a> </Menu> </div> ); } else { navBar = ( <div> <nav className="fluid top-nav"> <div className="container"> </div> </nav> </div> ); } return ( <div> {navBar} </div> ); } } Nav.propTypes = { main_app: React.PropTypes.string }; export default Nav;
import React from 'react'; import { slide as Menu } from 'react-burger-menu'; const Nav = React.createClass({ // class Nav extends React.Component { getInitialState() { return { width: $(window).width(), height: $(window).height() }; }, componentWillMount() { this.updateDimensions(); }, componentDidMount() { window.addEventListener("resize", this.updateDimensions); }, componentWillUnmount() { window.removeEventListener("resize", this.updateDimensions); }, updateDimensions() { this.setState({ width: $(window).width(), height: $(window).height() }); }, showSettings(event) { event.preventDefault(); }, render() { let navBar; if (this.state.width < 500) { navBar = ( <div> <span>{this.state.width} x {this.state.height} </span> <Menu> <a id="home" className="menu-item" href="/">Home</a> <a id="about" className="menu-item" href="/about">About</a> <a id="contact" className="menu-item" href="/contact">Contact</a> </Menu> </div> ); } else { navBar = ( <div> <nav className="fluid top-nav"> <div className="container"> </div> </nav> </div> ); } return ( <div> {navBar} </div> ); } }); export default Nav;
Create component calling createClass instead of extending the parent Component class.
Create component calling createClass instead of extending the parent Component class.
JSX
mit
WikiEducationFoundation/WikiEduDashboard,alpha721/WikiEduDashboard,alpha721/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,alpha721/WikiEduDashboard,KarmaHater/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,KarmaHater/WikiEduDashboard,majakomel/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,majakomel/WikiEduDashboard,alpha721/WikiEduDashboard,sejalkhatri/WikiEduDashboard,majakomel/WikiEduDashboard,sejalkhatri/WikiEduDashboard,KarmaHater/WikiEduDashboard,majakomel/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,KarmaHater/WikiEduDashboard
--- +++ @@ -1,26 +1,33 @@ import React from 'react'; import { slide as Menu } from 'react-burger-menu'; +const Nav = React.createClass({ +// class Nav extends React.Component { -class Nav extends React.Component { + getInitialState() { + return { + width: $(window).width(), + height: $(window).height() + }; + }, componentWillMount() { this.updateDimensions(); - } + }, componentDidMount() { window.addEventListener("resize", this.updateDimensions); - } + }, componentWillUnmount() { window.removeEventListener("resize", this.updateDimensions); - } + }, updateDimensions() { this.setState({ width: $(window).width(), height: $(window).height() }); - } + }, showSettings(event) { event.preventDefault(); - } + }, render() { let navBar; @@ -53,8 +60,6 @@ </div> ); } -} -Nav.propTypes = { - main_app: React.PropTypes.string -}; +}); + export default Nav;
5ff7f91715b533196dd336e99123d116dc857183
client/src/components/UserNameInputBox.jsx
client/src/components/UserNameInputBox.jsx
import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import { Card } from 'material-ui/Card'; import TextField from 'material-ui/TextField'; class UserNameInputBox extends React.Component { constructor (props) { super(props); this.state = { userName: '', userNameExists: false }; this.change = this.change.bind(this); this.passDataToCreateUser = this.passDataToCreateUser.bind(this); } change(e) { this.setState ({ userName: e.target.value, userNameExists: true }); } passDataToCreateUser() { this.props.dataFromInputBox({userName: this.state.userName, userNameExists: this.state.userNameExists}); this.props.buttonClicked(true); } render () { return ( <div> <TextField type="text" floatingLabelText="Name" onChange={this.change}></TextField> <div> <RaisedButton className="somePadding" secondary={true} label="Submit" onClick={(e)=>{ this.passDataToCreateUser(); }}></RaisedButton> </div> </div> ); } } export default UserNameInputBox;
import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import { Card } from 'material-ui/Card'; import TextField from 'material-ui/TextField'; class UserNameInputBox extends React.Component { constructor (props) { super(props); this.state = { userName: '', userNameExists: false, error: '' }; this.change = this.change.bind(this); this.passDataToCreateUser = this.passDataToCreateUser.bind(this); } change(e) { this.setState ({ userName: e.target.value, userNameExists: true }); } passDataToCreateUser() { this.props.dataFromInputBox({userName: this.state.userName, userNameExists: this.state.userNameExists}); this.props.buttonClicked(true); } render () { return ( <div> <TextField type="text" floatingLabelText="Name" errorText={this.props.error} onChange={this.change}></TextField> <div> <RaisedButton className="somePadding" secondary={true} label="Submit" onClick={(e)=>{ this.passDataToCreateUser(); }}></RaisedButton> </div> </div> ); } } export default UserNameInputBox;
Remove error message logic, move to parent component
Remove error message logic, move to parent component
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -8,7 +8,8 @@ super(props); this.state = { userName: '', - userNameExists: false + userNameExists: false, + error: '' }; this.change = this.change.bind(this); @@ -32,7 +33,7 @@ return ( <div> - <TextField type="text" floatingLabelText="Name" onChange={this.change}></TextField> + <TextField type="text" floatingLabelText="Name" errorText={this.props.error} onChange={this.change}></TextField> <div> <RaisedButton className="somePadding" secondary={true} label="Submit" onClick={(e)=>{ this.passDataToCreateUser(); }}></RaisedButton> </div>
4ea0465131e37829b8e18a868ae4d61e7e5de65e
examples/modal/index.jsx
examples/modal/index.jsx
import React from 'react' import ReactDOM from 'react-dom' import ModalWindow from 'src/modal/window.jsx' import Logger from 'src/utils/logger' export default class FormExamples extends React.Component { constructor(props) { super(props) this.state = { modalEnabled: false } } render() { return ( <div> <h1>Forms</h1> <button className="ui large primary button" onClick={this.showModal.bind(this)}>Show Modal</button> {this.state.modalEnabled ? this.getModal() : null} </div> ) } showModal() { this.setState({modalEnabled: true}) } hideModal() { this.setState({modalEnabled: false}) } getModal() { return ( <ModalWindow title="Well look at that." onApprove={this.hideModal.bind(this)} onCancel={this.hideModal.bind(this)} onClose={this.hideModal.bind(this)}> <h1>Oh my gosh, whaddaya know!</h1> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur, delectus dolor dolore molestias quibusdam tempore tenetur vero. Accusamus corporis nemo reprehenderit. A, alias autem blanditiis consectetur fugit incidunt iste tenetur.</p> </ModalWindow> ) } }
import React from 'react' import ReactDOM from 'react-dom' import ModalWindow from 'src/modal/window.jsx' import Logger from 'src/utils/logger' export default class FormExamples extends React.Component { constructor(props) { super(props) this.state = { modalEnabled: false } } render() { return ( <div> <h1>Modals</h1> <button className="ui large primary button" onClick={this.showModal.bind(this)}>Show Modal</button> {this.state.modalEnabled ? this.getModal() : null} </div> ) } showModal() { this.setState({modalEnabled: true}) } hideModal() { this.setState({modalEnabled: false}) } getModal() { return ( <ModalWindow title="Well look at that." onApprove={this.hideModal.bind(this)} onCancel={this.hideModal.bind(this)} onClose={this.hideModal.bind(this)}> <h1>Oh my gosh, whaddaya know!</h1> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur, delectus dolor dolore molestias quibusdam tempore tenetur vero. Accusamus corporis nemo reprehenderit. A, alias autem blanditiis consectetur fugit incidunt iste tenetur.</p> </ModalWindow> ) } }
Fix typo in modals example
Fix typo in modals example
JSX
mit
thinktopography/reframe,thinktopography/reframe
--- +++ @@ -14,7 +14,7 @@ render() { return ( <div> - <h1>Forms</h1> + <h1>Modals</h1> <button className="ui large primary button" onClick={this.showModal.bind(this)}>Show Modal</button> {this.state.modalEnabled ? this.getModal() : null}
d4b76f959b7010357f22112321fbdbad9352dafa
src/js/components/AppEmbedded.jsx
src/js/components/AppEmbedded.jsx
import React from 'react'; import Map from './Map'; import Editor from './Editor'; import Divider from './Divider'; import RefreshButton from './RefreshButton'; import { initTangramPlay } from '../tangram-play'; /** * This class is identical to normal Tangram Play but represents an embedded version of the app */ export default class AppEmbedded extends React.Component { componentDidMount () { initTangramPlay(); } shouldComponentUpdate () { return false; } render () { return ( <div className='workspace-container'> <div id='draggable-container'> <div id='draggable-container-child'> </div> </div> <div> <Map panel={false} /> <Divider /> <Editor /> </div> <RefreshButton /> </div> ); } }
import React from 'react'; import Map from './Map'; import Editor from './Editor'; import RefreshButton from './RefreshButton'; import { initTangramPlay } from '../tangram-play'; /** * This class is identical to normal Tangram Play but represents an embedded version of the app */ export default class AppEmbedded extends React.Component { componentDidMount () { initTangramPlay(); } shouldComponentUpdate () { return false; } render () { return ( <div className='workspace-container'> <div id='draggable-container'> <div id='draggable-container-child'> </div> </div> <div> <Map panel={false} /> <Editor /> </div> <RefreshButton /> </div> ); } }
Move divider element for EmbeddedApp
Move divider element for EmbeddedApp
JSX
mit
tangrams/tangram-play,tangrams/tangram-play
--- +++ @@ -1,7 +1,6 @@ import React from 'react'; import Map from './Map'; import Editor from './Editor'; -import Divider from './Divider'; import RefreshButton from './RefreshButton'; import { initTangramPlay } from '../tangram-play'; @@ -28,7 +27,6 @@ <div> <Map panel={false} /> - <Divider /> <Editor /> </div>
6abe37f0035e62565c574907854ce2ca94731826
app/react/components/greeting/greeting.jsx
app/react/components/greeting/greeting.jsx
import React from "react"; export default React.createClass({ render: function() { return ( <div className="jumbotron"> <h1>{this.props.header}</h1> <p className="lead">{this.props.subHeader}</p> </div> ); } });
import React from "react"; export default class Greeting extends React.Component { render() { return ( <div className="jumbotron"> <h1>{this.props.header}</h1> <p className="lead">{this.props.subHeader}</p> </div> ); } }
Make changes for es6 migrations
Greeting: Make changes for es6 migrations See #613
JSX
mpl-2.0
mozilla/science.mozilla.org,mozilla/science.mozilla.org
--- +++ @@ -1,7 +1,9 @@ import React from "react"; -export default React.createClass({ - render: function() { +export default class Greeting extends React.Component { + + render() { + return ( <div className="jumbotron"> <h1>{this.props.header}</h1> @@ -9,4 +11,4 @@ </div> ); } -}); +}
abf13ad06a257f0425699ed99049f19c690838c2
src/components/Parameters.jsx
src/components/Parameters.jsx
/* global __WEBPACK__ */ import React from 'react'; import NumberEditor from 'react-number-editor'; if (__WEBPACK__) { require('../../style/components/Parameters.less'); } class Parameters extends React.Component { render() { return ( <div className="parameters"> <label> How many primes do you want to show? <NumberEditor min={1} max={100000} step={1} decimals={0} {...this.props} /> </label> <p className="parameters__help"> <span className="glyphicon glyphicon-question-sign"></span> To edit the total: click on the number and drag, click and use the arrow keys, or double click to enter a new number </p> </div> ); } } Parameters.propTypes = { initialValue: React.PropTypes.number }; export default Parameters;
/* global __WEBPACK__ */ import React from 'react'; import NumberEditor from 'react-number-editor'; if (__WEBPACK__) { require('../../style/components/Parameters.less'); } class Parameters extends React.Component { render() { return ( <div className="parameters"> <label> How many primes do you want to show? <NumberEditor min={1} max={200000} step={1} decimals={0} {...this.props} /> </label> <p className="parameters__help"> <span className="glyphicon glyphicon-question-sign"></span> To edit the total: click on the number and drag, click and use the arrow keys, or double click to enter a new number </p> </div> ); } } Parameters.propTypes = { initialValue: React.PropTypes.number }; export default Parameters;
Increase total limit (200000 isn't too slow)
Increase total limit (200000 isn't too slow)
JSX
cc0-1.0
acusti/primal-multiplication,acusti/primal-multiplication
--- +++ @@ -10,7 +10,7 @@ return ( <div className="parameters"> <label> - How many primes do you want to show? <NumberEditor min={1} max={100000} step={1} decimals={0} {...this.props} /> + How many primes do you want to show? <NumberEditor min={1} max={200000} step={1} decimals={0} {...this.props} /> </label> <p className="parameters__help"> <span className="glyphicon glyphicon-question-sign"></span> To edit the total: click on the number and drag, click and use the arrow keys, or double click to enter a new number
a1a961f644a38b441549f66dbc2b6c4c107d4391
src/client/components/TimeAgo/TimeAgo.jsx
src/client/components/TimeAgo/TimeAgo.jsx
import React, { Component, PropTypes } from 'react'; import moment from 'moment' import Tooltip from '../Tooltip' export default class TimeAgo extends Component { constructor(props) { super(props) this._interval = setInterval(this.forceUpdate, props.refreshRate) } componentWillUnmount() { clearInterval(this._interval) } render() { const time = moment(this.props.time); return ( <Tooltip content={time.format(this.props.format)} className="timeago" position="top" > {time.fromNow()} </Tooltip> ) } } TimeAgo.defaultProps = { refreshRate: 60000, format: 'dddd [at] hh:mm:ss A' } TimeAgo.propTypes = { time: PropTypes.oneOfType([ PropTypes.string, PropTypes.array, PropTypes.number ]), refreshRate: PropTypes.number, format: PropTypes.string }
import React, { Component, PropTypes } from 'react'; import moment from 'moment' import Tooltip from '../Tooltip' export default class TimeAgo extends Component { constructor(props) { super(props) this.update = this.update.bind(this) this._interval = setInterval(this.update, props.refreshRate) } componentWillUnmount() { clearInterval(this._interval) } render() { const time = moment(this.props.time); return ( <Tooltip content={time.format(this.props.format)} className="timeago" > {time.fromNow()} </Tooltip> ) } update() { this.forceUpdate() } } TimeAgo.defaultProps = { refreshRate: 60000, format: 'dddd [at] hh:mm:ss A' } TimeAgo.propTypes = { time: PropTypes.oneOfType([ PropTypes.string, PropTypes.array, PropTypes.number ]), refreshRate: PropTypes.number, format: PropTypes.string }
Fix react bug forceUpdate in setInterval
Fix react bug forceUpdate in setInterval
JSX
mit
AdamSalma/Lurka,AdamSalma/Lurka
--- +++ @@ -5,7 +5,8 @@ export default class TimeAgo extends Component { constructor(props) { super(props) - this._interval = setInterval(this.forceUpdate, props.refreshRate) + this.update = this.update.bind(this) + this._interval = setInterval(this.update, props.refreshRate) } componentWillUnmount() { @@ -18,11 +19,14 @@ <Tooltip content={time.format(this.props.format)} className="timeago" - position="top" > {time.fromNow()} </Tooltip> ) + } + + update() { + this.forceUpdate() } }
bd50f1db3fc4a8da919a9ff52eac4f32ec9ec966
components/font_icon/index.jsx
components/font_icon/index.jsx
/* global React */ import { addons } from 'react/addons'; import style from './style'; import CSSModules from 'react-css-modules'; const FontIcon = React.createClass({ mixins: [addons.PureRenderMixin], displayName: 'FontIcon', propTypes: { className: React.PropTypes.string, value: React.PropTypes.string }, getDefaultProps () { return { className: '' }; }, onClick (event) { if (this.props.onClick) { this.props.onClick(event); } }, render () { return ( <span data-toolbox='icon' className={this.props.className} styleName={this.props.value} onClick={this.props.onClick} /> ); } }); export default CSSModules(FontIcon, style);
/* global React */ import { addons } from 'react/addons'; import style from './style'; export default React.createClass({ mixins: [addons.PureRenderMixin], displayName: 'FontIcon', propTypes: { className: React.PropTypes.string, value: React.PropTypes.string }, getDefaultProps () { return { className: '' }; }, onClick (event) { if (this.props.onClick) { this.props.onClick(event); } }, render () { let className = style[this.props.value]; if (this.props.className) className += ` ${this.props.className}`; return <span data-toolbox='icon' className={className} onClick={this.props.onClick} />; } });
Remove react css modules from font ico
Remove react css modules from font ico
JSX
mit
jasonleibowitz/react-toolbox,showings/react-toolbox,showings/react-toolbox,KerenChandran/react-toolbox,rubenmoya/react-toolbox,rubenmoya/react-toolbox,react-toolbox/react-toolbox,react-toolbox/react-toolbox,jasonleibowitz/react-toolbox,Magneticmagnum/react-atlas,rubenmoya/react-toolbox,react-toolbox/react-toolbox,soyjavi/react-toolbox,soyjavi/react-toolbox,DigitalRiver/react-atlas,KerenChandran/react-toolbox
--- +++ @@ -2,9 +2,8 @@ import { addons } from 'react/addons'; import style from './style'; -import CSSModules from 'react-css-modules'; -const FontIcon = React.createClass({ +export default React.createClass({ mixins: [addons.PureRenderMixin], displayName: 'FontIcon', @@ -27,15 +26,8 @@ }, render () { - return ( - <span - data-toolbox='icon' - className={this.props.className} - styleName={this.props.value} - onClick={this.props.onClick} - /> - ); + let className = style[this.props.value]; + if (this.props.className) className += ` ${this.props.className}`; + return <span data-toolbox='icon' className={className} onClick={this.props.onClick} />; } }); - -export default CSSModules(FontIcon, style);
2ee6ab9c4b084c5912efa92fa71ac246bcbd83f4
app.jsx
app.jsx
var React = require('react'); var Router = require('react-router'); var Route = Router.Route; var RouteHandler = Router.RouteHandler; var About = React.createClass({ render: function () { return <h2>About</h2>; } }); var Inbox = React.createClass({ render: function () { return <h2>Inbox</h2>; } }); var Home = React.createClass({ render: function () { return <h2>Home</h2>; } }); var Message = React.createClass({ render: function () { return <h3>Message</h3>; } }); var routes = ( <Route handler={App}> <Route handler={Home}/> <Route path="about" handler={About}/> <Route path="inbox" handler={Inbox}> <Route path="messages/:id" handler={Message}/> </Route> </Route> ); var App = React.createClass({ render () { return ( <div> <h1>App</h1> <RouteHandler/> </div> ); } }); Router.run(routes, Router.HashLocation, (Root) => { React.render(<Root />, document.body); });
var React = require('react'); var Router = require('react-router'); var Route = Router.Route; var RouteHandler = Router.RouteHandler; var About = React.createClass({ render: function () { return <h2>About</h2>; } }); var Inbox = React.createClass({ render: function () { return <h2>Inbox</h2>; } }); var Home = React.createClass({ render: function () { return <h2>Home</h2>; } }); var Message = React.createClass({ render: function () { return <h3>Message</h3>; } }); var routes = ( <Route handler={App}> <Route handler={Home}/> <Route path="about" handler={About}/> <Route path="inbox" handler={Inbox}> <Route path="messages/:id" handler={Message}/> </Route> </Route> ); var App = React.createClass({ render () { return ( <div> <h1>App</h1> <RouteHandler/> </div> ); } }); Router.run(routes, Router.HistoryLocation, (Root) => { React.render(<Root />, document.body); });
Update routes to use HTML History API!
Update routes to use HTML History API!
JSX
mit
AgtLucas/rrr,AgtLucas/rrr
--- +++ @@ -48,6 +48,6 @@ } }); -Router.run(routes, Router.HashLocation, (Root) => { +Router.run(routes, Router.HistoryLocation, (Root) => { React.render(<Root />, document.body); });
bd0d7dafb2af6d7f147039b10f5e61073235cc4d
src/page-viewer/index.jsx
src/page-viewer/index.jsx
import React, { PropTypes } from 'react' export const localVersionAvailable = ({page}) => ( !!page.html ) export const LinkToLocalVersion = ({page, children, ...props}) => ( <a href={`data:text/html;charset=UTF-8,${page.html}`} title='Stored text version available' {...props} > {children} </a> ) LinkToLocalVersion.propTypes = { page: PropTypes.object.isRequired, children: PropTypes.node, }
import React, { PropTypes } from 'react' export const localVersionAvailable = ({page}) => ( !!page.html ) export const LinkToLocalVersion = ({page, children, ...props}) => ( <a href={URL.createObjectURL(new Blob([page.html], {type: 'text/html;charset=UTF-8'}))} title='Stored text version available' {...props} > {children} </a> ) LinkToLocalVersion.propTypes = { page: PropTypes.object.isRequired, children: PropTypes.node, }
Use blob URI for saved version href.
Use blob URI for saved version href.
JSX
mit
WorldBrain/WebMemex,WorldBrain/WebMemex
--- +++ @@ -6,7 +6,7 @@ export const LinkToLocalVersion = ({page, children, ...props}) => ( <a - href={`data:text/html;charset=UTF-8,${page.html}`} + href={URL.createObjectURL(new Blob([page.html], {type: 'text/html;charset=UTF-8'}))} title='Stored text version available' {...props} >
e9b4cd9a17a1e559804d4599a579604a32e0a69c
src/js/components/DuplicableRowControls.jsx
src/js/components/DuplicableRowControls.jsx
import classNames from "classnames"; import React from "react/addons"; var DuplicableRowControls = React.createClass({ displayName: "DuplicableRowControls", propTypes: { disableRemoveButton: React.PropTypes.bool, handleAddRow: React.PropTypes.func.isRequired, handleRemoveRow: React.PropTypes.func.isRequired }, render: function () { var props = this.props; var removeButtonClassSet = classNames({ "btn btn-link remove": true, "disabled": props.disableRemoveButton }); return ( <div className="controls"> <button className={removeButtonClassSet} onClick={this.props.handleRemoveRow}> <i className="icon ion-ios-minus-outline"/> <i className="icon icon-hover ion-ios-minus"/> </button> <button className="btn btn-link add" onClick={this.props.handleAddRow}> <i className="icon ion-ios-plus-outline"/> <i className="icon icon-hover ion-ios-plus"/> </button> </div> ); } }); export default DuplicableRowControls;
import classNames from "classnames"; import React from "react/addons"; var DuplicableRowControls = React.createClass({ displayName: "DuplicableRowControls", propTypes: { disableRemoveButton: React.PropTypes.bool, handleAddRow: React.PropTypes.func.isRequired, handleRemoveRow: React.PropTypes.func.isRequired }, render: function () { var props = this.props; var removeButtonClassSet = classNames({ "btn btn-link remove": true, "disabled": props.disableRemoveButton }); return ( <div className="controls"> <button type="button" className={removeButtonClassSet} onClick={this.props.handleRemoveRow}> <i className="icon ion-ios-minus-outline"/> <i className="icon icon-hover ion-ios-minus"/> </button> <button type="button" className="btn btn-link add" onClick={this.props.handleAddRow}> <i className="icon ion-ios-plus-outline"/> <i className="icon icon-hover ion-ios-plus"/> </button> </div> ); } }); export default DuplicableRowControls;
Add `type="button"` to prevent event hijacking
Add `type="button"` to prevent event hijacking
JSX
apache-2.0
mesosphere/marathon-ui,cribalik/marathon-ui,mesosphere/marathon-ui,cribalik/marathon-ui
--- +++ @@ -18,12 +18,15 @@ return ( <div className="controls"> - <button className={removeButtonClassSet} + <button type="button" + className={removeButtonClassSet} onClick={this.props.handleRemoveRow}> <i className="icon ion-ios-minus-outline"/> <i className="icon icon-hover ion-ios-minus"/> </button> - <button className="btn btn-link add" onClick={this.props.handleAddRow}> + <button type="button" + className="btn btn-link add" + onClick={this.props.handleAddRow}> <i className="icon ion-ios-plus-outline"/> <i className="icon icon-hover ion-ios-plus"/> </button>