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
8bebe4f4468877d1dd9addfcdd3716535470af60
src/styles/theme/connect-with-theme.jsx
src/styles/theme/connect-with-theme.jsx
import React from 'react'; import PropTypes from 'prop-types'; /** * A Wrapper function to inject the theme passed in by the context as a prop into the JSS HOC. * * @private * @param {Function} Component - The HOC from JSS. * @param {String} [componentName] - The name of the component so we only pass the theme * for the component. This makes it easier with jss. * @returns {Function} - Returns the new wrapper function which will render the HOC from JSS. */ export default function connectWithTheme(Component, componentName = null) { /** * The Wrapper component to pass the theme as a prop. * * @param {Object} props - Additional props for the element. * @param {Object} context - The context of the function. * @param {Object} context.theme - The theme provided by the context. * @returns {JSX} - Returns the HOC from JSS. */ function Wrapper(props, { theme }) { return ( <Component theme={componentName ? theme[componentName] : theme} {...props} /> ); } Wrapper.contextTypes = { theme: PropTypes.object }; return Wrapper; }
import React from 'react'; import PropTypes from 'prop-types'; /** * A Wrapper function to inject the theme passed in by the context as a prop into the JSS HOC. * * @private * @param {Function} Component - The HOC from JSS. * @param {String} [componentName] - The name of the component so we only pass the theme * for the component. This makes it easier with jss. * @returns {Function} - Returns the new wrapper function which will render the HOC from JSS. */ export default function connectWithTheme(Component, componentName = null) { /** * The Wrapper component to pass the theme as a prop. * * @param {Object} props - Additional props for the element. * @param {Object} context - The context of the function. * @param {Object} context.theme - The theme provided by the context. * @returns {JSX} - Returns the HOC from JSS. */ function Wrapper(props, { theme }) { return ( <Component theme={componentName ? theme[componentName] : theme} {...props} /> ); } Wrapper.contextTypes = { theme: PropTypes.object }; const displayName = Component.displayName || Component.name || 'Component'; Wrapper.displayName = displayName.startsWith('Jss') ? `connectWithTheme(${displayName.slice(4, displayName.length - 1)})` : `connectWithTheme(${displayName})`; return Wrapper; }
Add a more descriptive displayName for the wrapper component returned by connectWithTheme
Add a more descriptive displayName for the wrapper component returned by connectWithTheme
JSX
mit
HenriBeck/materialize-react,HenriBeck/materialize-react,TF2PickupNET/components
--- +++ @@ -30,5 +30,11 @@ Wrapper.contextTypes = { theme: PropTypes.object }; + const displayName = Component.displayName || Component.name || 'Component'; + + Wrapper.displayName = displayName.startsWith('Jss') + ? `connectWithTheme(${displayName.slice(4, displayName.length - 1)})` + : `connectWithTheme(${displayName})`; + return Wrapper; }
553f4d70dbf93f87b1640f319f4b513276410252
client/source/Index.jsx
client/source/Index.jsx
// React + React-Router Dependencies import React, { Component } from 'react'; import { render } from 'react-dom'; import { Router, IndexRoute, Route, browserHistory } from 'react-router'; // Importing the React components from components folder import App from './components/App'; import LandingPage from './components/LandingPage'; import User from './components/User/UserPage'; import RecipeMain from './components/Recipe/RecipeMain'; import CreateRecipeMain from './components/CreateRecipe/CreateRecipeMain'; import EditRecipeMain from './components/EditRecipe/EditRecipeMain'; render(( <Router history={browserHistory}> <Route path="/" component={App}> <IndexRoute component={LandingPage} /> <Route path="/User" component={User} /> <Route path="/User/:username" component={User} /> <Route path="/Recipe" component={RecipeMain} /> <Route path="/Recipe/:username/:recipe" component={RecipeMain} /> <Route path="/Create" component={CreateRecipeMain} /> <Route path="/Edit" component={EditRecipeMain} /> </Route> </Router> ), document.getElementById('app'));
// React + React-Router Dependencies import React, { Component } from 'react'; import { render } from 'react-dom'; import { Router, IndexRoute, Route, browserHistory } from 'react-router'; // Importing the React components from components folder import App from './components/App'; import LandingPage from './components/LandingPage'; import User from './components/User/UserPage'; import AltUser from './components/User/AltUserPage'; import RecipeMain from './components/Recipe/RecipeMain'; import CreateRecipeMain from './components/CreateRecipe/CreateRecipeMain'; import EditRecipeMain from './components/EditRecipe/EditRecipeMain'; render(( <Router history={browserHistory}> <Route path="/" component={App}> <IndexRoute component={LandingPage} /> <Route path="/User" component={User} /> <Route path="/User/:username" component={User} /> <Route path="/User/Profile/:username" component={AltUser} /> <Route path="/Recipe" component={RecipeMain} /> <Route path="/Recipe/:username/:recipe" component={RecipeMain} /> <Route path="/Create" component={CreateRecipeMain} /> <Route path="/Edit" component={EditRecipeMain} /> </Route> </Router> ), document.getElementById('app'));
Add additional routes to handle users accessing other users profiles
Add additional routes to handle users accessing other users profiles
JSX
mit
JAC-Labs/SkilletHub,JAC-Labs/SkilletHub
--- +++ @@ -7,6 +7,7 @@ import App from './components/App'; import LandingPage from './components/LandingPage'; import User from './components/User/UserPage'; +import AltUser from './components/User/AltUserPage'; import RecipeMain from './components/Recipe/RecipeMain'; import CreateRecipeMain from './components/CreateRecipe/CreateRecipeMain'; import EditRecipeMain from './components/EditRecipe/EditRecipeMain'; @@ -17,6 +18,7 @@ <IndexRoute component={LandingPage} /> <Route path="/User" component={User} /> <Route path="/User/:username" component={User} /> + <Route path="/User/Profile/:username" component={AltUser} /> <Route path="/Recipe" component={RecipeMain} /> <Route path="/Recipe/:username/:recipe" component={RecipeMain} /> <Route path="/Create" component={CreateRecipeMain} />
bf7d15c580e45f850b9e9cf9f4d39a95703ac4cb
components/button/__examples__/brand-disabled-destructive-inverse.jsx
components/button/__examples__/brand-disabled-destructive-inverse.jsx
import React from 'react'; import IconSettings from '~/components/icon-settings'; import Button from '~/components/button'; // `~` is replaced with design-system-react at runtime class Example extends React.Component { static displayName = 'ButtonExample'; render() { return ( <IconSettings iconPath="/assets/icons"> <div className="-x-small-buttons--horizontal"> <Button label="Brand" variant="brand" /> <Button disabled label="Disabled" onClick={() => { console.log('Disabled Button Clicked'); }} variant="brand" /> <Button label="Destructive" variant="destructive" /> <div style={{ backgroundColor: '#16325c', padding: '10px', display: 'inline-block', }} className="-m-horizontal--small" > <Button inverse label="Inverse" variant="base" /> </div> </div> </IconSettings> ); } } export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
import React from 'react'; import IconSettings from '~/components/icon-settings'; import Button from '~/components/button'; // `~` is replaced with design-system-react at runtime class Example extends React.Component { static displayName = 'ButtonExample'; render() { return ( <IconSettings iconPath="/assets/icons"> <div className="-x-small-buttons--horizontal"> <Button label="Brand" variant="brand" /> <Button disabled label="Disabled" onClick={() => { console.log('Disabled Button Clicked'); }} variant="brand" /> <Button label="Destructive" variant="destructive" /> <Button label="Outline Brand" variant="outline-brand" /> <div style={{ backgroundColor: '#16325c', padding: '10px', display: 'inline-block', }} className="-m-horizontal--small" > <Button inverse label="Inverse" variant="base" /> </div> </div> </IconSettings> ); } } export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
Add `outline-brand` variant to doc site examples
Button: Add `outline-brand` variant to doc site examples Fixes #1943
JSX
bsd-3-clause
salesforce/design-system-react,salesforce/design-system-react,salesforce/design-system-react
--- +++ @@ -23,6 +23,8 @@ <Button label="Destructive" variant="destructive" /> + <Button label="Outline Brand" variant="outline-brand" /> + <div style={{ backgroundColor: '#16325c',
42810b299fd18187a534efb78f8b6b883928cb61
src/index.jsx
src/index.jsx
/** @jsx createElement */ import {createElement} from 'elliptical' const defaultProps = { label: 'string', limit: 1, trimmed: true } function describe ({props}) { return ( <placeholder label={props.label} arguments={props.phraseArguments || (props.phraseArguments ? [props.phraseArgument] : [props.label])}> <freetext greedy={props.greedy} consumeAll={props.consumeAll} splitOn={props.splitOn} trimmed={props.trimmed} filter={(input) => filter(input, props)} limit={props.limit} /> </placeholder> ) } function filter (input, props) { if (props.trimmed && (/^\s/.test(input) || /\s$/.test(input))) { return false } if (props.filter) { return props.filter(input) } return true } export const String = {defaultProps, describe}
/** @jsx createElement */ import {createElement} from 'elliptical' const defaultProps = { label: 'string', limit: 1, trimmed: true } function describe ({props}) { return ( <placeholder label={props.label} arguments={props.phraseArguments || (props.phraseArguments ? [props.phraseArgument] : [props.label])}> <freetext greedy={props.greedy} consumeAll={props.consumeAll} splitOn={props.splitOn} trimmed={props.trimmed} filter={(input) => filter(input, props)} limit={props.limit} /> </placeholder> ) } function filter (input, props) { if (props.trimmed && (/^\s/.test(input) || /\s$/.test(input))) { return false } if (props.filter) { return props.filter(input) } return true } export const String = {defaultProps, describe, id: 'elliptical-string:String'}
Add id to make Lacona extension easier
Add id to make Lacona extension easier
JSX
mit
lacona/lacona-phrase-string
--- +++ @@ -35,4 +35,4 @@ return true } -export const String = {defaultProps, describe} +export const String = {defaultProps, describe, id: 'elliptical-string:String'}
9bcfcf4199f51e5d92fbfd5e7babbfab032f5c72
src/index.jsx
src/index.jsx
const React = require('react') const ReactDom = require('react-dom') const ReactRedux = require('react-redux') const Redux = require('redux') const { remote } = require('electron') const { persistStore, autoRehydrate } = require('redux-persist') const { AsyncNodeStorage } = require('redux-persist-node-storage') const App = require('./components/App') const reducer = require('./reducers/reducer') const store = Redux.createStore(reducer, undefined, autoRehydrate()) const persistDir = remote.app.getPath('desktop') const persistOptions = { storage: new AsyncNodeStorage(persistDir) } persistStore(store, persistOptions) ReactDom.render( <ReactRedux.Provider store={store}> <App /> </ReactRedux.Provider>, document.getElementById('content') )
const React = require('react') const ReactDom = require('react-dom') const ReactRedux = require('react-redux') const Redux = require('redux') const { remote } = require('electron') const { persistStore, autoRehydrate } = require('redux-persist') const { AsyncNodeStorage } = require('redux-persist-node-storage') const App = require('./components/App') const reducer = require('./reducers/reducer') const store = Redux.createStore(reducer, undefined, autoRehydrate()) const persistDir = remote.app.getPath('userData') const persistOptions = { storage: new AsyncNodeStorage(persistDir) } persistStore(store, persistOptions) ReactDom.render( <ReactRedux.Provider store={store}> <App /> </ReactRedux.Provider>, document.getElementById('content') )
Store it all in userData again
Store it all in userData again
JSX
mit
cheshire137/gh-notifications-snoozer,cheshire137/gh-notifications-snoozer
--- +++ @@ -10,7 +10,7 @@ const reducer = require('./reducers/reducer') const store = Redux.createStore(reducer, undefined, autoRehydrate()) -const persistDir = remote.app.getPath('desktop') +const persistDir = remote.app.getPath('userData') const persistOptions = { storage: new AsyncNodeStorage(persistDir) } persistStore(store, persistOptions)
347ff4fe719064e0e21dc3e40b3e14e6eb39bd1a
src/components/carousel/carousel.jsx
src/components/carousel/carousel.jsx
var React = require('react'); var Slider = require('react-slick'); var Thumbnail = require('../thumbnail/thumbnail.jsx'); require('slick-carousel/slick/slick.scss'); require('slick-carousel/slick/slick-theme.scss'); require('./carousel.scss'); module.exports = React.createClass({ propTypes: { items: React.PropTypes.array }, getDefaultProps: function () { return { items: require('./carousel.json'), settings: { arrows: true, dots: false, infinite: false, lazyLoad: true, slidesToShow: 5, slidesToScroll: 5, variableWidth: true } }; }, render: function () { return ( <Slider className={'carousel ' + this.props.className} {... this.props.settings}> {this.props.items.map(function (item) { var href = ''; switch (item.type) { case 'gallery': href = '/studio/' + item.id + '/'; break; default: href = '/' + item.type + '/' + item.id + '/'; } return ( <Thumbnail key={item.id} type={item.type} href={href} title={item.title} src={item.thumbnailUrl} creator={item.creator} remixes={item.remixes} loves={item.loves} /> ); })} </Slider> ); } });
var React = require('react'); var Slider = require('react-slick'); var Thumbnail = require('../thumbnail/thumbnail.jsx'); require('slick-carousel/slick/slick.scss'); require('slick-carousel/slick/slick-theme.scss'); require('./carousel.scss'); module.exports = React.createClass({ propTypes: { items: React.PropTypes.array }, getDefaultProps: function () { return { items: require('./carousel.json'), settings: { arrows: true, dots: false, infinite: false, lazyLoad: true, slidesToShow: 5, slidesToScroll: 5, variableWidth: true } }; }, render: function () { return ( <Slider className={'carousel ' + this.props.className} {... this.props.settings}> {this.props.items.map(function (item) { var href = ''; switch (item.type) { case 'gallery': href = '/studio/' + item.id + '/'; break; case 'project': href = '/projects/' + item.id + '/'; break; default: href = '/' + item.type + '/' + item.id + '/'; } return ( <Thumbnail key={item.id} type={item.type} href={href} title={item.title} src={item.thumbnailUrl} creator={item.creator} remixes={item.remixes} loves={item.loves} /> ); })} </Slider> ); } });
Fix GH-37: Construct project urls correctly
Fix GH-37: Construct project urls correctly
JSX
bsd-3-clause
LLK/scratch-www,LLK/scratch-www
--- +++ @@ -33,6 +33,9 @@ case 'gallery': href = '/studio/' + item.id + '/'; break; + case 'project': + href = '/projects/' + item.id + '/'; + break; default: href = '/' + item.type + '/' + item.id + '/'; }
c512918d29e1a753560b9000a8b2504ee6cf0c4c
app/react/components/user-list/user-list.jsx
app/react/components/user-list/user-list.jsx
// Gets passed an array of users. Returns array of GithubAvatars for users matching role import React from "react"; import GithubAvatar from "../../components/github-avatar/github-avatar.jsx"; export default React.createClass({ propTypes: { users: React.PropTypes.array, role: React.PropTypes.string }, getDefaultProps() { return { users: [], role: ``, avatar: true, name: true, exclude: [] }; }, render() { // Get an array of users by checking if they're of the right role (or there's no role filter), and they're not in the exclude array let users = this.props.users.filter(user=>{ if (this.props.role === `` || this.props.role === user.role) { if(this.props.exclude.length) { return !this.props.exclude.find(el => { return el.github_username === user.github_username; }); } else { return true; } } }); users = users.map((user, index) => { let avatar, name; if(this.props.avatar){ avatar = <GithubAvatar user={user}/>; } if(this.props.name){ name = <span className="user-name"><a href={`https://github.com/${user.github_username}`}>{user.name}</a></span>; } return <span className="user" key={index}>{avatar}{name}</span>; }); return <span className="user-list">{users}</span>; } });
// Gets passed an array of users. Returns array of GithubAvatars for users matching role import React from "react"; import GithubAvatar from "../../components/github-avatar/github-avatar.jsx"; export default class UserList extends React.Component { render() { // Get an array of users by checking if they're of the right role (or there's no role filter), and they're not in the exclude array let users = this.props.users.filter(user=>{ if (this.props.role === `` || this.props.role === user.role) { if(this.props.exclude.length) { return !this.props.exclude.find(el => { return el.github_username === user.github_username; }); } else { return true; } } }); users = users.map((user, index) => { let avatar, name; if(this.props.avatar){ avatar = <GithubAvatar user={user}/>; } if(this.props.name){ name = <span className="user-name"><a href={`https://github.com/${user.github_username}`}>{user.name}</a></span>; } return <span className="user" key={index}>{avatar}{name}</span>; }); return <span className="user-list">{users}</span>; } } UserList.propTypes = { users: React.PropTypes.array, role: React.PropTypes.string }; UserList.defaultProps = { users: [], role: ``, avatar: true, name: true, exclude: [] };
Make changes for es6 migrations
UserList: Make changes for es6 migrations See #613
JSX
mpl-2.0
mozilla/science.mozilla.org,mozilla/science.mozilla.org
--- +++ @@ -3,20 +3,8 @@ import React from "react"; import GithubAvatar from "../../components/github-avatar/github-avatar.jsx"; -export default React.createClass({ - propTypes: { - users: React.PropTypes.array, - role: React.PropTypes.string - }, - getDefaultProps() { - return { - users: [], - role: ``, - avatar: true, - name: true, - exclude: [] - }; - }, +export default class UserList extends React.Component { + render() { // Get an array of users by checking if they're of the right role (or there's no role filter), and they're not in the exclude array @@ -46,5 +34,17 @@ return <span className="user-list">{users}</span>; } -}); +} +UserList.propTypes = { + users: React.PropTypes.array, + role: React.PropTypes.string +}; + +UserList.defaultProps = { + users: [], + role: ``, + avatar: true, + name: true, + exclude: [] +};
59ba74958c2cb4eab5ba0522181ac7eed21e7148
extensions/lite/views/Admin/index.jsx
extensions/lite/views/Admin/index.jsx
import React, { Component } from 'react' export default class AdminView extends Component { render() { return null } }
// To fix commit import React, { Component } from 'react' export default class AdminView extends Component { render() { return null } }
Add a comment to fix commit number error
Add a comment to fix commit number error
JSX
agpl-3.0
botpress/botpress,botpress/botpress,botpress/botpress,botpress/botpress
--- +++ @@ -1,3 +1,5 @@ +// To fix commit + import React, { Component } from 'react' export default class AdminView extends Component {
9c0934a63603a2ef471651ae904da2680c284c8a
src/js/containers/TasksContainer.jsx
src/js/containers/TasksContainer.jsx
import React from 'react'; import request from 'superagent'; import Tasks from '../components/Tasks.jsx'; export default class TasksContainer extends React.Component { constructor(props) { super(props); this.state = { tasks: [], }; this.getTasksFromServer = this.getTasksFromServer.bind(this); } componentDidMount() { this.getTasksFromServer(); // setInterval(this.getTasksFromServer, this.props.pollInterval); } getTasksFromServer() { request .get('http://localhost:3000/tasks') .end((err, res) => { if (err) { throw err; } this.setState({ tasks: res.body }); }); } render() { const tasksTodo = []; const tasksDoing = []; const tasksDone = []; this.state.tasks.map((task) => { switch (task.status) { case 1: tasksTodo.push(task); break; case 2: tasksDoing.push(task); break; case 3: tasksDone.push(task); break; default: console.log('needs error handling.'); } }); return ( <div className="column"> <Tasks tasks={tasksTodo} label="TODO" /> <Tasks tasks={tasksDoing} label="DOING" /> <Tasks tasks={tasksDone} label="DONE" /> <br /> </div> ); } }
import React from 'react'; import request from 'superagent'; import Tasks from '../components/Tasks.jsx'; export default class TasksContainer extends React.Component { constructor(props) { super(props); this.state = { tasks: [], }; this.getTasksFromServer = this.getTasksFromServer.bind(this); } componentDidMount() { this.getTasksFromServer(); // setInterval(this.getTasksFromServer, this.props.pollInterval); } getTasksFromServer() { request .get('http://localhost:3000/tasks') .end((err, res) => { if (err) { throw err; } this.setState({ tasks: res.body }); }); } render() { const tasksTodo = []; const tasksDoing = []; const tasksDone = []; this.state.tasks.forEach((task) => { switch (task.status) { case 1: tasksTodo.push(task); break; case 2: tasksDoing.push(task); break; case 3: tasksDone.push(task); break; default: console.log('needs error handling.'); } }); return ( <div className="column"> <Tasks tasks={tasksTodo} label="TODO" /> <Tasks tasks={tasksDoing} label="DOING" /> <Tasks tasks={tasksDone} label="DONE" /> <br /> </div> ); } }
Use forEach instead of map
Use forEach instead of map
JSX
mit
tanaka0325/nippo-web,tanaka0325/nippo-web
--- +++ @@ -34,7 +34,7 @@ const tasksTodo = []; const tasksDoing = []; const tasksDone = []; - this.state.tasks.map((task) => { + this.state.tasks.forEach((task) => { switch (task.status) { case 1: tasksTodo.push(task);
e80f0e49fbcd4c69e3a9bf27b1cc013b6731ec16
src/components/EditablePolyline.jsx
src/components/EditablePolyline.jsx
import { Polyline } from 'react-leaflet' import { icon } from 'leaflet' import { PolylineEditor } from 'leaflet-editable-polyline' export default class EditablePolyline extends Polyline { componentWillMount () { let options = {} for (let key in this.props) { if (this.props.hasOwnProperty(key)) { options[key] = this.props[key] } } options.pointIcon = icon({ iconUrl: '/pointIcon.svg', iconSize: [12, 12], iconAnchor: [6, 6] }) options.newPointIcon = icon({ iconUrl: '/newPointIcon.svg', iconSize: [12, 12], iconAnchor: [6, 6] }) this.leafletElement = PolylineEditor(this.props.positions, options) } }
import { Polyline } from 'react-leaflet' import { icon } from 'leaflet' import { PolylineEditor } from 'leaflet-editable-polyline' export default class EditablePolyline extends Polyline { componentWillMount () { let options = {} for (let key in this.props) { if (this.props.hasOwnProperty(key)) { options[key] = this.props[key] } } options.pointIcon = icon({ iconUrl: '/pointIcon.svg', iconSize: [12, 12], iconAnchor: [6, 6] }) options.newPointIcon = icon({ iconUrl: '/newPointIcon.svg', iconSize: [12, 12], iconAnchor: [6, 6] }) options.maxMarkers = 500 this.leafletElement = PolylineEditor(this.props.positions, options) } }
Increase number of points to edit a segment that can be displayed
Increase number of points to edit a segment that can be displayed
JSX
mit
ruipgil/GatherMySteps,ruipgil/GatherMySteps
--- +++ @@ -20,6 +20,7 @@ iconSize: [12, 12], iconAnchor: [6, 6] }) + options.maxMarkers = 500 this.leafletElement = PolylineEditor(this.props.positions, options) } }
709d306d3cb2df02e652e6a20a3201f3728bfa6e
src/components/StarterComponent.jsx
src/components/StarterComponent.jsx
import React from 'react'; export default class StarterComponent extends React.Component { displayName = 'StarterComponent'; constructor() { super(); } render() { return <div>{'StarterComponent'}</div>; } }
import React from 'react'; export default class StarterComponent extends React.Component { displayName = 'StarterComponent'; constructor(props) { super(props); } render() { return <div>{'StarterComponent'}</div>; } }
Add props to component constructor
Add props to component constructor
JSX
mit
motiz88/yet-another-universal-package-starter,motiz88/yet-another-react-component-starter,motiz88/react-dygraphs
--- +++ @@ -3,8 +3,8 @@ export default class StarterComponent extends React.Component { displayName = 'StarterComponent'; - constructor() { - super(); + constructor(props) { + super(props); } render() {
592f72077f78fe857aa2624c443f619509befa32
src/js/components/widgets/altitudeWidget.jsx
src/js/components/widgets/altitudeWidget.jsx
import React from 'react'; import altitudeStore from '../../stores/altitudeStore'; import classNames from 'classnames'; export default class AltitudeWidget extends React.Component { constructor() { super(); this.state = { altitude: this.getAltitude() }; altitudeStore.addChangeListener(this.setAltitude); } render() { return ( <div id="wind-speed-widget"> <div className="windmill"> <div> <div className="blade"></div> <div className="blade"></div> <div className="blade"></div> </div> </div> <div className="speed-wrapper"> <span className="speed-value">{this.state.altitude}</span> </div> <span className="widget-unit">m</span> </div> ); } setAltitude = () => { let altitude = this.getAltitude(); this.setState({ altitude }); } getAltitude() { return altitudeStore.getState().altitude; } }
import React from 'react'; import altitudeStore from '../../stores/altitudeStore'; import classNames from 'classnames'; export default class AltitudeWidget extends React.Component { constructor() { super(); this.state = { altitude: this.getAltitude() }; altitudeStore.addChangeListener(this.setAltitude); } render() { return ( <div id="wind-speed-widget"> <div className="windmill"> </div> <div className="speed-wrapper"> <span className="speed-value">{this.state.altitude}</span> </div> <span className="widget-unit">m</span> </div> ); } setAltitude = () => { let altitude = this.getAltitude(); this.setState({ altitude }); } getAltitude() { return altitudeStore.getState().altitude; } }
Remove blades div from altitude widget.
Remove blades div from altitude widget.
JSX
mit
prodec/trail-blazer,prodec/trail-blazer
--- +++ @@ -13,11 +13,6 @@ return ( <div id="wind-speed-widget"> <div className="windmill"> - <div> - <div className="blade"></div> - <div className="blade"></div> - <div className="blade"></div> - </div> </div> <div className="speed-wrapper"> <span className="speed-value">{this.state.altitude}</span>
e2aff619a818c90b30e1068f395ece366b92f2fd
src/components/SightingList.jsx
src/components/SightingList.jsx
import React from 'react'; import { Card, CardMedia, CardTitle, CardText } from 'material-ui/Card'; // import styled from 'styled-components'; // const Img = styled.img` // margin: // ` const SightingList = props => { console.log(props); return ( <div> <h1>Sighting List</h1> {props.sightings.map(s => ( <Card> <CardTitle title={s.scientificName} subtitle={'Lat: ' + s.lat + ', Long: ' + s.lon} /> <CardMedia> <img src={s.photoURL || 'https://evolution.berkeley.edu/evolibrary/images/evo/ontogenew.gif'} alt={s.scientificName} /> </CardMedia> <CardText> <h3>Count: {s.count}</h3> <h3>Sex: {s.sex}</h3> <h3>Location: {s.lat + ', ' + s.lon}</h3> </CardText> </Card> ))} </div> ); }; export default SightingList;
import React from 'react'; import { Card, CardMedia, CardTitle, CardText } from 'material-ui/Card'; // import styled from 'styled-components'; // const Img = styled.img` // margin: // ` const SightingList = props => { console.log(props); return ( <div> <h1>Sighting List</h1> {props.sightings.map(s => ( <Card> <CardTitle title={s.scientificName} subtitle={'Lat: ' + s.lat + ', Long: ' + s.lon} /> <CardMedia> <img src={s.photoURL || 'https://evolution.berkeley.edu/evolibrary/images/evo/ontogenew.gif'} alt={s.scientificName || 'Sighting image here.'} /> </CardMedia> <CardText> <h3>Count: {s.count}</h3> <h3>Sex: {s.sex}</h3> <h3>Location: {s.lat + ', ' + s.lon}</h3> </CardText> </Card> ))} </div> ); }; export default SightingList;
Add default image data in case there's no relevant info
Add default image data in case there's no relevant info
JSX
mit
omarcodex/butterfly-pinner,omarcodex/butterfly-pinner
--- +++ @@ -16,7 +16,7 @@ <CardMedia> <img src={s.photoURL || 'https://evolution.berkeley.edu/evolibrary/images/evo/ontogenew.gif'} - alt={s.scientificName} + alt={s.scientificName || 'Sighting image here.'} /> </CardMedia> <CardText>
4e2275a2e3f6d55b32a65bf23f78bb37ec700fd6
client/components/Events/Event.jsx
client/components/Events/Event.jsx
import React, { PropTypes } from 'react'; import { Link } from 'react-router'; const Event = ({ eventName, contractAddress, description, eventStartDateTime, eventEndDateTime, eventContractAddress, price, addressLine1, addressLine2, city, state, zipPostalCode, country }) => ( <li> <img src="http://tctechcrunch2011.files.wordpress.com/2008/04/linux-penguin-small.png" /> <h2><Link to={{ pathname: '/events/' + eventName, query: { eventName, description, eventStartDateTime, eventEndDateTime, eventContractAddress, price, addressLine1, addressLine2, city, state, zipPostalCode, country, }, }} >{eventName}</Link></h2> <p>Date: {eventStartDateTime}</p> <p>Price: {price}</p> <p>City: {city}</p> </li> ); export default Event;
import React, { PropTypes } from 'react'; import { Link } from 'react-router'; const Event = ({ eventName, contractAddress, description, eventStartDateTime, eventEndDateTime, eventContractAddress, price, addressLine1, addressLine2, city, state, zipPostalCode, country }) => ( <li> <Link to={{ pathname: '/events/' + eventName, query: { eventName, description, eventStartDateTime, eventEndDateTime, eventContractAddress, price, addressLine1, addressLine2, city, state, zipPostalCode, country, }, }} ><img src="http://tctechcrunch2011.files.wordpress.com/2008/04/linux-penguin-small.png" /></Link> <h2><Link to={{ pathname: '/events/' + eventName, query: { eventName, description, eventStartDateTime, eventEndDateTime, eventContractAddress, price, addressLine1, addressLine2, city, state, zipPostalCode, country, }, }} >{eventName}</Link></h2> <p>Date: {eventStartDateTime}</p> <p>Price: {price}</p> <p>City: {city}</p> </li> ); export default Event;
Add commit before pulling upstream
Add commit before pulling upstream
JSX
mit
digitalsherpas/ticket-sherpa,andrewk17/ticket-sherpa,kevinbrosamle/ticket-sherpa,kevinbrosamle/ticket-sherpa,chrispicato/ticket-sherpa,digitalsherpas/ticket-sherpa,andrewk17/ticket-sherpa,chrispicato/ticket-sherpa
--- +++ @@ -3,7 +3,25 @@ const Event = ({ eventName, contractAddress, description, eventStartDateTime, eventEndDateTime, eventContractAddress, price, addressLine1, addressLine2, city, state, zipPostalCode, country }) => ( <li> - <img src="http://tctechcrunch2011.files.wordpress.com/2008/04/linux-penguin-small.png" /> + <Link + to={{ pathname: + '/events/' + eventName, + query: { + eventName, + description, + eventStartDateTime, + eventEndDateTime, + eventContractAddress, + price, + addressLine1, + addressLine2, + city, + state, + zipPostalCode, + country, + }, + }} + ><img src="http://tctechcrunch2011.files.wordpress.com/2008/04/linux-penguin-small.png" /></Link> <h2><Link to={{ pathname: '/events/' + eventName,
7738546008330e98047c9845b44b99656d107d0b
public/components/MultipleGlasses.jsx
public/components/MultipleGlasses.jsx
import React from 'react'; import glassDetails from './../../glassDetails.js'; import beerPair from './../../pairList.js'; class MultipleGlasses extends React.Component { constructor(props){ super(props); this.handleGlassUpdate = this.handleGlassUpdate.bind(this); } handleGlassUpdate(e) { e.preventDefault(); this.props.updateGlass(e.target.innerHTML); } render(){ let temp = this.props.glasses.slice(); temp.splice(temp.indexOf(this.props.currentGlass), 1); const list = temp.map((glass, i) => { return <li key={i} onClick={this.handleGlassUpdate}>{glass}</li> }); return( <div> <p>You can also use a: </p> <ul> {list} </ul> </div> ) } } export default MultipleGlasses;
import React from 'react'; import glassDetails from './../../glassDetails.js'; import beerPair from './../../pairList.js'; const MultipleGlasses = (props) => { const handleGlassUpdate = (e) => { e.preventDefault(); props.updateGlass(e.target.innerHTML); } let temp = props.glasses.slice(); temp.splice(temp.indexOf(props.currentGlass), 1); const list = temp.map((glass, i) => { return <li key={i} onClick={handleGlassUpdate}>{glass}</li> }); return ( <div> <p>You can also use a: </p> <ul> {list} </ul> </div> ); } export default MultipleGlasses;
Refactor multiple glasses component to stateless component
Refactor multiple glasses component to stateless component
JSX
mit
joeylaguna/tankard.io,joeylaguna/tankard.io
--- +++ @@ -1,35 +1,27 @@ -import React from 'react'; -import glassDetails from './../../glassDetails.js'; -import beerPair from './../../pairList.js'; +import React from 'react'; +import glassDetails from './../../glassDetails.js'; +import beerPair from './../../pairList.js'; -class MultipleGlasses extends React.Component { - constructor(props){ - super(props); - this.handleGlassUpdate = this.handleGlassUpdate.bind(this); +const MultipleGlasses = (props) => { + const handleGlassUpdate = (e) => { + e.preventDefault(); + props.updateGlass(e.target.innerHTML); } - handleGlassUpdate(e) { - e.preventDefault(); - this.props.updateGlass(e.target.innerHTML); - } - - render(){ - let temp = this.props.glasses.slice(); - temp.splice(temp.indexOf(this.props.currentGlass), 1); - const list = temp.map((glass, i) => { - return <li key={i} onClick={this.handleGlassUpdate}>{glass}</li> - }); - - return( - <div> - <p>You can also use a: </p> - <ul> - {list} - </ul> - </div> - ) - } + let temp = props.glasses.slice(); + temp.splice(temp.indexOf(props.currentGlass), 1); + const list = temp.map((glass, i) => { + return <li key={i} onClick={handleGlassUpdate}>{glass}</li> + }); + + return ( + <div> + <p>You can also use a: </p> + <ul> + {list} + </ul> + </div> + ); } - export default MultipleGlasses;
dd8579026bbae1a2579afb2e170eacc399275002
src/components/ui/ListForms.jsx
src/components/ui/ListForms.jsx
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; class ListForms extends PureComponent { render() { return <ul> { Object.keys(this.props.forms).map(project => <li key={ `key-${project}` }> <a target="_blank" href={ this.props.forms[project] }>{ project }</a> </li> ) } </ul>; } } ListForms.propTypes = { forms: PropTypes.object.isRequired, } export default ListForms;
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { List, Segment } from 'semantic-ui-react'; class ListForms extends PureComponent { render() { return <Segment textAlign="left"> <List relaxed divided> { Object.keys(this.props.forms).map(project => <List.Item key={ `key-${project}` } target="_blank" href={ this.props.forms[project] }> <List.Icon name="file text outline" /> <List.Content> { project } </List.Content> </List.Item> ) } </List> </Segment>; } } ListForms.propTypes = { forms: PropTypes.object.isRequired, } export default ListForms;
Use sematic UI List element
Use sematic UI List element
JSX
mit
BrunoGodefroy/theodo-form-printer,BrunoGodefroy/theodo-form-printer,BrunoGodefroy/theodo-form-printer
--- +++ @@ -1,15 +1,21 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; +import { List, Segment } from 'semantic-ui-react'; class ListForms extends PureComponent { render() { - return <ul> - { Object.keys(this.props.forms).map(project => - <li key={ `key-${project}` }> - <a target="_blank" href={ this.props.forms[project] }>{ project }</a> - </li> - ) } - </ul>; + return <Segment textAlign="left"> + <List relaxed divided> + { Object.keys(this.props.forms).map(project => + <List.Item key={ `key-${project}` } target="_blank" href={ this.props.forms[project] }> + <List.Icon name="file text outline" /> + <List.Content> + { project } + </List.Content> + </List.Item> + ) } + </List> + </Segment>; } }
9628d2885f3bdb3b58fd58baeb6b26bb76c2b122
src/app/components/change-password/ChangePasswordForm.jsx
src/app/components/change-password/ChangePasswordForm.jsx
import React, { Component } from 'react'; import Input from '../Input' import PropTypes from 'prop-types'; const propTypes = { formData: PropTypes.shape({ inputs: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string.isRequired, value: PropTypes.string, label: PropTypes.string.isRequired, type: PropTypes.string, onChange: PropTypes.func, error: PropTypes.string })), onSubmit: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired }).isRequired }; export default class ChangePasswordForm extends Component { constructor(props) { super(props); } render() { const inputs = this.props.formData.inputs; return ( <div> <div className="modal__header"> <h2>Change password</h2> </div> <form onSubmit={this.props.formData.onSubmit}> <div className="modal__body"> { inputs.map((input, index) => { return <Input key={index} {...input} /> }) } </div> <div className="modal__footer"> <button className="btn btn--positive" onClick={this.props.formData.onSubmit}>Update password</button> <button className="btn" onClick={this.props.formData.onCancel}>Cancel</button> </div> </form> </div> ) } } ChangePasswordForm.propTypes = propTypes;
import React, { Component } from 'react'; import Input from '../Input' import PropTypes from 'prop-types'; const propTypes = { formData: PropTypes.shape({ inputs: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string.isRequired, value: PropTypes.string, label: PropTypes.string.isRequired, type: PropTypes.string, onChange: PropTypes.func, error: PropTypes.string })), onSubmit: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired, isSubmitting: PropTypes.bool }).isRequired }; export default class ChangePasswordForm extends Component { constructor(props) { super(props); } render() { const inputs = this.props.formData.inputs || []; const isSubmitting = this.props.formData.isSubmitting || false; return ( <div> <div className="modal__header"> <h2>Change password</h2> </div> <form onSubmit={this.props.formData.onSubmit}> <div className="modal__body"> { inputs.map((input, index) => { return <Input key={index} {...input} disabled={isSubmitting} /> }) } </div> <div className="modal__footer"> <button className="btn btn--positive" onClick={this.props.formData.onSubmit} disabled={isSubmitting}>Update password</button> <button className="btn" onClick={this.props.formData.onCancel} disabled={isSubmitting}>Cancel</button> {isSubmitting ? <div className="form__loader loader loader--dark margin-left--1"></div> : ""} </div> </form> </div> ) } } ChangePasswordForm.propTypes = propTypes;
Add isSubmitting check and disable input and buttons and show loader if true
Add isSubmitting check and disable input and buttons and show loader if true Former-commit-id: 054d688cf76d87a77605ae7515105dbe35799c93 Former-commit-id: ace2c726643f5214e26d786232dad5ee86d4b5fa Former-commit-id: feace0245e270a55f8ee9216f74c672f84427e8a
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -13,7 +13,8 @@ error: PropTypes.string })), onSubmit: PropTypes.func.isRequired, - onCancel: PropTypes.func.isRequired + onCancel: PropTypes.func.isRequired, + isSubmitting: PropTypes.bool }).isRequired }; @@ -25,7 +26,8 @@ } render() { - const inputs = this.props.formData.inputs; + const inputs = this.props.formData.inputs || []; + const isSubmitting = this.props.formData.isSubmitting || false; return ( <div> @@ -36,13 +38,15 @@ <div className="modal__body"> { inputs.map((input, index) => { - return <Input key={index} {...input} /> + return <Input key={index} {...input} disabled={isSubmitting} /> }) } </div> <div className="modal__footer"> - <button className="btn btn--positive" onClick={this.props.formData.onSubmit}>Update password</button> - <button className="btn" onClick={this.props.formData.onCancel}>Cancel</button> + <button className="btn btn--positive" onClick={this.props.formData.onSubmit} disabled={isSubmitting}>Update password</button> + <button className="btn" onClick={this.props.formData.onCancel} disabled={isSubmitting}>Cancel</button> + + {isSubmitting ? <div className="form__loader loader loader--dark margin-left--1"></div> : ""} </div> </form> </div>
b199d835cadaaa4329501988cbc0a55992f4a975
web/src/js/components/ChatContainer.jsx
web/src/js/components/ChatContainer.jsx
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { roomInputChange, roomInputSend } from 'actions/roomActions'; import Paper from 'material-ui/Paper'; class ChatContainer extends React.Component { static propTypes = { dispatch: PropTypes.func }; static defaultProps = { dispatch: () => {} }; componentDidMount() { setTimeout(() => { this.inputRef.focus(); }, 1000); } handleKeyDownInput = (e) => { if (e.keyCode === 13) { this.props.dispatch(roomInputSend()); } }; render() { const { dispatch, inputValue } = this.props; return ( <Paper elevation = {4} className = "up-room__paper_container up-room__chat"> <div className="up-room__chat__users"> Users </div> <div className="up-room__chat__messages"> <div className="up-room__chat__scroll"> Messages </div> <div className="up-room__chat__input"> <input type="text" value={inputValue} onKeyDown={this.handleKeyDownInput} onChange={(e) => { dispatch(roomInputChange(e.target.value)); }} ref={(ref) => { this.inputRef = ref; }} /> </div> </div> </Paper> ); } } function mapStateToProps(state) { return Object.assign({}, state.room); } export default connect(mapStateToProps)(ChatContainer);
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { roomInputChange, roomInputSend } from 'actions/roomActions'; import Paper from 'material-ui/Paper'; class ChatContainer extends React.Component { static propTypes = { dispatch: PropTypes.func }; static defaultProps = { dispatch: () => {} }; componentDidMount() { setTimeout(() => { this.inputRef.focus(); }, 1000); } handleKeyDownInput = (e) => { if (e.keyCode === 13) { this.props.dispatch(roomInputSend()); } }; render() { const { dispatch, inputValue } = this.props; return ( <Paper elevation = {4} className = "up-room__paper_container"> <div className="up-room__chat"> <div className="up-room__chat__users"> Users </div> <div className="up-room__chat__messages"> <div className="up-room__chat__scroll"> Messages </div> <div className="up-room__chat__input"> <input type="text" value={inputValue} onKeyDown={this.handleKeyDownInput} onChange={(e) => { dispatch(roomInputChange(e.target.value)); }} ref={(ref) => { this.inputRef = ref; }} /> </div> </div> </div> </Paper> ); } } function mapStateToProps(state) { return Object.assign({}, state.room); } export default connect(mapStateToProps)(ChatContainer);
Revert "fix more material stuff"
Revert "fix more material stuff" This reverts commit 46d88e7e4526e076ed99c0360da853624c123e72.
JSX
mit
upnextfm/upnextfm,upnextfm/upnextfm,upnextfm/upnextfm,upnextfm/upnextfm
--- +++ @@ -28,7 +28,8 @@ const { dispatch, inputValue } = this.props; return ( - <Paper elevation = {4} className = "up-room__paper_container up-room__chat"> + <Paper elevation = {4} className = "up-room__paper_container"> + <div className="up-room__chat"> <div className="up-room__chat__users"> Users </div> @@ -46,6 +47,7 @@ /> </div> </div> + </div> </Paper> ); }
2aa4d6cb89f52cc156d28e29f24f5c7a67516293
src/readme_page.jsx
src/readme_page.jsx
/** * @license Apache-2.0 * * Copyright (c) 2019 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // MODULES // import React from 'react'; import HTML_FRAGMENT_CACHE from './html_fragment_cache.js'; // MAIN // /** * Returns a React component for rendering a README. * * @private * @param {Object} props - component properties * @returns {ReactComponent} React component */ function ReadmePage( props ) { // TODO: consider whether to redirect to a 404 page var html = HTML_FRAGMENT_CACHE[ props.path ] || '{{ FRAGMENT }}'; return ( <div id="readme" className="readme" suppressHydrationWarning dangerouslySetInnerHTML={{ __html: html }} /> ); }; // EXPORTS // export default ReadmePage;
/** * @license Apache-2.0 * * Copyright (c) 2019 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // MODULES // import React from 'react'; import HTML_FRAGMENT_CACHE from './html_fragment_cache.js'; // MAIN // /** * Returns a React component for rendering a README. * * @private * @param {Object} props - component properties * @returns {ReactComponent} React component */ function ReadmePage( props ) { var html = HTML_FRAGMENT_CACHE[ props.path ] || ''; return ( <div id="readme" className="readme" suppressHydrationWarning dangerouslySetInnerHTML={{ __html: html }} /> ); }; // EXPORTS // export default ReadmePage;
Fix flashing of template string
Fix flashing of template string
JSX
apache-2.0
stdlib-js/www,stdlib-js/www,stdlib-js/www
--- +++ @@ -32,8 +32,7 @@ * @returns {ReactComponent} React component */ function ReadmePage( props ) { - // TODO: consider whether to redirect to a 404 page - var html = HTML_FRAGMENT_CACHE[ props.path ] || '{{ FRAGMENT }}'; + var html = HTML_FRAGMENT_CACHE[ props.path ] || ''; return ( <div id="readme"
6128399c186cf23f36ccad4b3f478808223e4993
src/components/semver-checker-form.jsx
src/components/semver-checker-form.jsx
var React = require('react'); var SemverCheckerForm = React.createClass({ handleChange: function() { var constraint = this.refs.constraint.getDOMNode().value.trim(), version = this.refs.version.getDOMNode().value.trim(), valid = true; if (!constraint && !version) { this.props.resetState(); return; } if (!!version && this.props.onSemverValidate(version)) { this.refs.version.getDOMNode().classList.remove('error'); this.props.setVersion(version); } else { this.refs.version.getDOMNode().classList.add('error'); this.props.setVersion(null); valid = false; } if (!!constraint && this.props.onConstraintValidate(constraint)) { this.refs.constraint.getDOMNode().classList.remove('error'); this.props.setConstraint(constraint); } else { this.refs.constraint.getDOMNode().classList.add('error'); this.props.setConstraint(null); valid = false; } if (!valid) { this.props.resetSatisfies(); return; } this.props.onSemverCheck(version, constraint); }, render: function() { return ( <form className="semverCheckerForm"> <input type="text" placeholder="Constraint" ref="constraint" onChange={this.handleChange} /> <input type="text" placeholder="Version" ref="version" onChange={this.handleChange} /> </form> ); } }); module.exports = SemverCheckerForm;
var React = require('react'); var SemverCheckerForm = React.createClass({ handleChange: function() { var constraint = this.refs.constraint.getDOMNode().value.trim(), version = this.refs.version.getDOMNode().value.trim(), valid = true; if (!constraint && !version) { this.props.resetState(); return; } if (!!version && this.props.onSemverValidate(version)) { this.refs.version.getDOMNode().classList.remove('error'); this.props.setVersion(version); } else { this.refs.version.getDOMNode().classList.add('error'); this.props.setVersion(null); valid = false; } if (!!constraint && this.props.onConstraintValidate(constraint)) { this.refs.constraint.getDOMNode().classList.remove('error'); this.props.setConstraint(constraint); } else { this.refs.constraint.getDOMNode().classList.add('error'); if (!constraint) { this.props.setConstraint(null); } valid = false; } if (!valid) { this.props.resetSatisfies(); return; } this.props.onSemverCheck(version, constraint); }, render: function() { return ( <form className="semverCheckerForm"> <input type="text" placeholder="Constraint" ref="constraint" onChange={this.handleChange} /> <input type="text" placeholder="Version" ref="version" onChange={this.handleChange} /> </form> ); } }); module.exports = SemverCheckerForm;
Set constraint state only when valid
Set constraint state only when valid
JSX
mit
jubianchi/semver-check,jubianchi/semver-check
--- +++ @@ -25,7 +25,9 @@ this.props.setConstraint(constraint); } else { this.refs.constraint.getDOMNode().classList.add('error'); - this.props.setConstraint(null); + if (!constraint) { + this.props.setConstraint(null); + } valid = false; }
5130cdedf1c71fce7096096736a02dda1073ccb3
src/utils/ChromeAPI.jsx
src/utils/ChromeAPI.jsx
export function searchHistory(q = "", d = false, e = false, m = 0) { let params = { text: q, maxResults: m }; if (d) { params["startTime"] = d; } if (e) { params["endTime"] = e; } return new Promise((resolve, reject) => { chrome.history.search(params, (h) => { //console.table(h); resolve(h); }); }); }; export function getVisits(u) { return new Promise((resolve, reject) => { chrome.history.getVisits({url: u}, (v) => { //console.table(v); resolve(v); }); }); };
export function searchHistory(q = "", d = 0, e = false, m = 0) { let params = { text: q, maxResults: m, startTime: d }; if (e) { params["endTime"] = e; } return new Promise((resolve, reject) => { chrome.history.search(params, (h) => { //console.table(h); resolve(h); }); }); }; export function getVisits(u) { return new Promise((resolve, reject) => { chrome.history.getVisits({url: u}, (v) => { //console.table(v); resolve(v); }); }); };
Remove a condition on start time; it should always be set (at least to 0 to search all)
Remove a condition on start time; it should always be set (at least to 0 to search all)
JSX
mit
MrSaints/historyx,MrSaints/historyx
--- +++ @@ -1,11 +1,9 @@ -export function searchHistory(q = "", d = false, e = false, m = 0) { +export function searchHistory(q = "", d = 0, e = false, m = 0) { let params = { text: q, - maxResults: m + maxResults: m, + startTime: d }; - if (d) { - params["startTime"] = d; - } if (e) { params["endTime"] = e; }
1097892d4b51155dc4759c5fd15e6c0436503637
src/cred/phone-number/ask_location.jsx
src/cred/phone-number/ask_location.jsx
import React from 'react'; import LocationSelect from './location_select'; import { cancelSelectPhoneLocation, changePhoneLocation } from './actions'; import { initialLocationSearchStr, selectingLocation } from './index'; import * as l from '../../lock/index'; export default class AskLocation extends React.Component { render() { return ( <LocationSelect selectHandler={::this.handleSelect} cancelHandler={::this.handleCancel} initialLocationSearchStr={this.props.initialLocationSearchStr} locationFilterInputPlaceholder={this.t(["locationFilterInputPlaceholder"], {__textOnly: true})} /> ); } handleCancel() { cancelSelectPhoneLocation(l.id(this.props.lock)); } handleSelect(location) { changePhoneLocation(l.id(this.props.lock), location); } t(keyPath, params) { return l.ui.t(this.props.lock, ["location"].concat(keyPath), params); } } export function renderAskLocation(lock) { return selectingLocation(lock) ? <AskLocation initialLocationSearchStr={initialLocationSearchStr(lock)} key="auxiliarypane" lock={lock} /> : null; }
import React from 'react'; import LocationSelect from './location_select'; import { cancelSelectPhoneLocation, changePhoneLocation } from './actions'; import { initialLocationSearchStr, selectingLocation } from './index'; import * as l from '../../lock/index'; export default class AskLocation extends React.Component { handleCancel() { cancelSelectPhoneLocation(l.id(this.props.lock)); } handleSelect(location) { changePhoneLocation(l.id(this.props.lock), location); } t(keyPath, params) { return l.ui.t(this.props.lock, ["location"].concat(keyPath), params); } render() { return ( <LocationSelect cancelHandler={::this.handleCancel} initialLocationSearchStr={this.props.initialLocationSearchStr} locationFilterInputPlaceholder={this.t(["locationFilterInputPlaceholder"], {__textOnly: true})} selectHandler={::this.handleSelect} /> ); } } export function renderAskLocation(lock) { return selectingLocation(lock) ? <AskLocation initialLocationSearchStr={initialLocationSearchStr(lock)} key="auxiliarypane" lock={lock} /> : null; }
Update code style in AskLocation
Update code style in AskLocation
JSX
mit
mike-casas/lock,auth0/lock-passwordless,auth0/lock-passwordless,auth0/lock-passwordless,mike-casas/lock,mike-casas/lock
--- +++ @@ -5,14 +5,6 @@ import * as l from '../../lock/index'; export default class AskLocation extends React.Component { - render() { - return ( - <LocationSelect selectHandler={::this.handleSelect} - cancelHandler={::this.handleCancel} - initialLocationSearchStr={this.props.initialLocationSearchStr} - locationFilterInputPlaceholder={this.t(["locationFilterInputPlaceholder"], {__textOnly: true})} /> - ); - } handleCancel() { cancelSelectPhoneLocation(l.id(this.props.lock)); @@ -26,6 +18,17 @@ return l.ui.t(this.props.lock, ["location"].concat(keyPath), params); } + render() { + return ( + <LocationSelect + cancelHandler={::this.handleCancel} + initialLocationSearchStr={this.props.initialLocationSearchStr} + locationFilterInputPlaceholder={this.t(["locationFilterInputPlaceholder"], {__textOnly: true})} + selectHandler={::this.handleSelect} + /> + ); + } + } export function renderAskLocation(lock) {
d8420d49fa1eddeeb5c968b8b70c69cba95fc02c
frontend/src/components/start/index.jsx
frontend/src/components/start/index.jsx
//@flow import React, {PropTypes} from 'react'; import {fetchJson} from '../../services/backend'; import styles from './style.css' const Start = React.createClass({ getInitialState() { return { songs: [] }; }, componentDidMount() { fetchJson('/api/songs.json').then(songs => this.setState({songs})); }, renderSong(song) { return ( <div key={song.id} className={styles.song}> <div className={styles.title}>{song.title}</div> <div className={styles.artist}>{song.artist}</div> </div> ) }, render() { const songs = this.state.songs; return ( <div> <h1>singIT</h1> <div className={styles.searchBox}>Search</div> {songs.map(this.renderSong)} </div> ) } }); export default Start
//@flow import React, {PropTypes} from 'react'; import {fetchJson} from '../../services/backend'; import styles from './style.css' const Start = React.createClass({ getInitialState() { return { searchString: '', songs: [] }; }, componentDidMount() { fetchJson('/api/songs.json').then(songs => this.setState({songs})); }, renderSong(song) { return ( <div key={song.id} className={styles.song}> <div className={styles.title}>{song.title}</div> <div className={styles.artist}>{song.artist}</div> </div> ) }, handleSearchInput(event) { this.setState({ searchString: event.target.value }) }, render() { const { songs, searchString } = this.state; const searchboxStyles = [styles.searchBox]; return ( <div> <h1>singIT</h1> <input type="text" className={searchboxStyles.join(' ')} onChange={this.handleSearchInput} value={searchString} placeholder="Search" /> {songs.map(this.renderSong)} </div> ) } }); export default Start
Replace placeholder div with actual input element
Replace placeholder div with actual input element
JSX
mit
cthit/singIT,cthit/singIT,cthit/singIT,cthit/singIT,cthit/singIT
--- +++ @@ -8,6 +8,7 @@ const Start = React.createClass({ getInitialState() { return { + searchString: '', songs: [] }; }, @@ -25,12 +26,24 @@ ) }, + handleSearchInput(event) { + this.setState({ + searchString: event.target.value + }) + }, + render() { - const songs = this.state.songs; + const { songs, searchString } = this.state; + const searchboxStyles = [styles.searchBox]; + return ( <div> <h1>singIT</h1> - <div className={styles.searchBox}>Search</div> + <input type="text" + className={searchboxStyles.join(' ')} + onChange={this.handleSearchInput} + value={searchString} + placeholder="Search" /> {songs.map(this.renderSong)} </div> )
2d5e67b5be15cd6daf7af690e190b794fa982201
src/field/phone-number/ask_location.jsx
src/field/phone-number/ask_location.jsx
import React from 'react'; import LocationSelect from './location_select'; import { cancelSelectPhoneLocation, changePhoneLocation } from './actions'; import { initialLocationSearchStr, selectingLocation } from './index'; import * as l from '../../core/index'; export default class AskLocation extends React.Component { handleCancel() { cancelSelectPhoneLocation(l.id(this.props.lock)); } handleSelect(location) { changePhoneLocation(l.id(this.props.lock), location); } t(keyPath, params) { return l.ui.t(this.props.lock, ["location"].concat(keyPath), params); } render() { return ( <LocationSelect cancelHandler={::this.handleCancel} initialLocationSearchStr={this.props.initialLocationSearchStr} locationFilterInputPlaceholder={this.t(["locationFilterInputPlaceholder"], {__textOnly: true})} selectHandler={::this.handleSelect} /> ); } } export function renderAskLocation(lock) { return selectingLocation(lock) ? <AskLocation initialLocationSearchStr={initialLocationSearchStr(lock)} key="auxiliarypane" lock={lock} /> : null; }
import React from 'react'; import LocationSelect from './location_select'; import { cancelSelectPhoneLocation, changePhoneLocation } from './actions'; import { initialLocationSearchStr, selectingLocation } from './index'; import * as l from '../../core/index'; import * as i18n from '../../i18n'; // TODO: can't we get this from props? export default class AskLocation extends React.Component { handleCancel() { cancelSelectPhoneLocation(l.id(this.props.lock)); } handleSelect(location) { changePhoneLocation(l.id(this.props.lock), location); } render() { return ( <LocationSelect cancelHandler={::this.handleCancel} initialLocationSearchStr={this.props.initialLocationSearchStr} locationFilterInputPlaceholder={i18n.str(this.props.lock, "locationFilterInputPlaceholder")} selectHandler={::this.handleSelect} /> ); } } export function renderAskLocation(lock) { return selectingLocation(lock) ? <AskLocation initialLocationSearchStr={initialLocationSearchStr(lock)} key="auxiliarypane" lock={lock} /> : null; }
Use i18n module in AskLocation
Use i18n module in AskLocation
JSX
mit
mike-casas/lock,mike-casas/lock,mike-casas/lock
--- +++ @@ -3,6 +3,7 @@ import { cancelSelectPhoneLocation, changePhoneLocation } from './actions'; import { initialLocationSearchStr, selectingLocation } from './index'; import * as l from '../../core/index'; +import * as i18n from '../../i18n'; // TODO: can't we get this from props? export default class AskLocation extends React.Component { @@ -14,16 +15,12 @@ changePhoneLocation(l.id(this.props.lock), location); } - t(keyPath, params) { - return l.ui.t(this.props.lock, ["location"].concat(keyPath), params); - } - render() { return ( <LocationSelect cancelHandler={::this.handleCancel} initialLocationSearchStr={this.props.initialLocationSearchStr} - locationFilterInputPlaceholder={this.t(["locationFilterInputPlaceholder"], {__textOnly: true})} + locationFilterInputPlaceholder={i18n.str(this.props.lock, "locationFilterInputPlaceholder")} selectHandler={::this.handleSelect} /> );
b82baba6b0168f156cc45f47c98c0dde723c06d9
app/assets/javascripts/components/popover_link.es6.jsx
app/assets/javascripts/components/popover_link.es6.jsx
class PopoverLink extends React.Component { constructor(props) { super(props); this.state = { showPopover: false, user: null, position: null }; } render () { return ( <span className="popover-link" onMouseEnter={this.handleMouseEnter.bind(this)} onMouseLeave={this.handleMouseLeave.bind(this)} > <a href={this.props.url}> {this.props.children} </a> {this.renderPopover()} </span> ); } renderPopover() { if (this.state.showPopover) { return ( <UserPopover user={this.state.user} position={this.state.position} /> ); } else { return; } } handleMouseEnter(event) { let position; const POPOVER_HEIGHT = 200; if ( POPOVER_HEIGHT + 30 > event.clientY) { position = "bottom"; } else { position = "top"; } $.ajax({ url: `/api/users/${this.props.user_id}`, method: 'GET', success: (data) => { this.setState({ user: data, showPopover: true, position: position }); } }); } handleMouseLeave(event) { setTimeout(() => { this.setState({ showPopover: false }); }, 180); } }
class PopoverLink extends React.Component { constructor(props) { super(props); this.state = { showPopover: false, user: null, position: null }; } render () { return ( <span className="popover-link" onMouseEnter={this.handleMouseEnter.bind(this)} onMouseLeave={this.handleMouseLeave.bind(this)} > <a href={this.props.url}> {this.props.children} </a> {this.renderPopover()} </span> ); } renderPopover() { if (this.state.showPopover) { return ( <UserPopover user={this.state.user} position={this.state.position} /> ); } else { return; } } handleMouseEnter(event) { let position; const POPOVER_HEIGHT = 200; if ( POPOVER_HEIGHT + 30 > event.clientY) { this.position = "bottom"; } else { this.position = "top"; } this.timeoutID = setTimeout(() => { $.ajax({ url: `/api/users/${this.props.user_id}`, method: 'GET', success: (data) => { this.setState({ user: data, showPopover: true, position: this.position }); } }); }, 450); } handleMouseLeave(event) { if (this.timeoutID) { clearTimeout(this.timeoutID); this.timeoutID = null; } setTimeout(() => { this.setState({ showPopover: false, position: null }); }, 180); } }
Add setTimeout to PopoverLink component to defer displaying popover when user hovers over the link
Add setTimeout to PopoverLink component to defer displaying popover when user hovers over the link
JSX
mit
dev-warner/Revinyl-Product,aamin005/Firdowsspace,aamin005/Firdowsspace,kenny-hibino/stories,aamin005/Firdowsspace,dev-warner/Revinyl-Product,dev-warner/Revinyl-Product,kenny-hibino/stories,kenny-hibino/stories
--- +++ @@ -36,21 +36,27 @@ let position; const POPOVER_HEIGHT = 200; if ( POPOVER_HEIGHT + 30 > event.clientY) { - position = "bottom"; + this.position = "bottom"; } else { - position = "top"; + this.position = "top"; } - $.ajax({ - url: `/api/users/${this.props.user_id}`, - method: 'GET', - success: (data) => { - this.setState({ user: data, showPopover: true, position: position }); - } - }); + this.timeoutID = setTimeout(() => { + $.ajax({ + url: `/api/users/${this.props.user_id}`, + method: 'GET', + success: (data) => { + this.setState({ user: data, showPopover: true, position: this.position }); + } + }); + }, 450); } handleMouseLeave(event) { - setTimeout(() => { this.setState({ showPopover: false }); }, 180); + if (this.timeoutID) { + clearTimeout(this.timeoutID); + this.timeoutID = null; + } + setTimeout(() => { this.setState({ showPopover: false, position: null }); }, 180); } }
627cb667d69f655ea0b47f6e2ea46bb52fbdbc25
frontend/src/tutorial/TutorialModal.jsx
frontend/src/tutorial/TutorialModal.jsx
import React, { Component, PropTypes } from "react"; import Icon from "metabase/components/Icon.jsx"; export default class TutorialModal extends Component { render() { const { modalStepIndex, modalStepCount } = this.props; return ( <div className="TutorialModalContent p2"> <div className="flex"> <a className="text-grey-4 p1 cursor-pointer flex-align-right" onClick={this.props.onClose}> <Icon name='close' width="16px" height="16px"/> </a> </div> <div className="px4"> {this.props.children} </div> <div className="flex"> { modalStepIndex > 0 && <a className="text-grey-4 cursor-pointer" onClick={this.props.onBack}>back</a> } <span className="text-grey-4 flex-align-right">{modalStepIndex + 1} of {modalStepCount}</span> </div> </div> ); } }
import React, { Component, PropTypes } from "react"; import Icon from "metabase/components/Icon.jsx"; const ENABLE_BACK_BUTTON = false; // disabled due to possibility of getting in inconsistent states export default class TutorialModal extends Component { render() { const { modalStepIndex, modalStepCount } = this.props; return ( <div className="TutorialModalContent p2"> <div className="flex"> <a className="text-grey-4 p1 cursor-pointer flex-align-right" onClick={this.props.onClose}> <Icon name='close' width="16px" height="16px"/> </a> </div> <div className="px4"> {this.props.children} </div> <div className="flex"> { ENABLE_BACK_BUTTON && modalStepIndex > 0 && <a className="text-grey-4 cursor-pointer" onClick={this.props.onBack}>back</a> } <span className="text-grey-4 flex-align-right">{modalStepIndex + 1} of {modalStepCount}</span> </div> </div> ); } }
Disable tutorial back button for now
Disable tutorial back button for now
JSX
agpl-3.0
Endika/metabase,blueoceanideas/metabase,dashkb/metabase,Endika/metabase,blueoceanideas/metabase,dashkb/metabase,Endika/metabase,dashkb/metabase,dashkb/metabase,Endika/metabase,dashkb/metabase,blueoceanideas/metabase,Endika/metabase,blueoceanideas/metabase,blueoceanideas/metabase
--- +++ @@ -1,6 +1,8 @@ import React, { Component, PropTypes } from "react"; import Icon from "metabase/components/Icon.jsx"; + +const ENABLE_BACK_BUTTON = false; // disabled due to possibility of getting in inconsistent states export default class TutorialModal extends Component { render() { @@ -16,7 +18,7 @@ {this.props.children} </div> <div className="flex"> - { modalStepIndex > 0 && + { ENABLE_BACK_BUTTON && modalStepIndex > 0 && <a className="text-grey-4 cursor-pointer" onClick={this.props.onBack}>back</a> } <span className="text-grey-4 flex-align-right">{modalStepIndex + 1} of {modalStepCount}</span>
aa6101c8bad5202399b833c5086e2607d3feb937
src/public/views/pages/donate.jsx
src/public/views/pages/donate.jsx
'use strict'; import React from 'react'; import { strings } from '../../lib/i18n'; import Header from '../header.jsx'; import Footer from '../footer.jsx'; import Title from '../components/title.jsx'; export default React.createClass({ render: function() { return ( <div id='donate'> <Header active='donate' /> <Title title={strings().donate.title} /> <div className='section'> <div className='container'> <div className='row service-wrapper-row'> <div className='col-sm-3'> <div className='service-image'> <img src='/img/donation-address-qr.png' alt='Fingerprint' /> </div> </div> <div className='col-sm-9'> <p> {strings().donate.intro} </p> <br /> <h2 className="green">{strings().donate.supportus}</h2> <br /> <p> {strings().donate.address} </p> <p><pre> 36XTMVtgJqqNYymsSvRonpUsbZRGkm1jvX </pre></p> </div> </div> </div> </div> <Footer /> </div> ); } });
'use strict'; import React from 'react'; import { strings } from '../../lib/i18n'; import Header from '../header.jsx'; import Footer from '../footer.jsx'; import Title from '../components/title.jsx'; export default React.createClass({ render: function() { return ( <div id='donate'> <Header active='donate' /> <Title title={strings().donate.title} /> <div className='section'> <div className='container'> <div className='row service-wrapper-row'> <div className='col-sm-3'> <div className='service-image'> <img src='/img/donation-address-qr.png' alt='Fingerprint' /> </div> </div> <div className='col-sm-9'> <h2 className="green">{strings().donate.supportus}</h2> <p> {strings().donate.intro} </p> <p> {strings().donate.address} </p> <p><pre> 36XTMVtgJqqNYymsSvRonpUsbZRGkm1jvX </pre></p> </div> </div> </div> </div> <Footer /> </div> ); } });
Move intro message to below the title
Move intro message to below the title
JSX
mit
thofmann/BitcoinUnlimitedWeb,sinahab/BitcoinUnlimitedWeb,thofmann/BitcoinUnlimitedWeb,BitcoinUnlimited/BitcoinUnlimitedWeb,BitcoinUnlimited/BitcoinUnlimitedWeb,gandrewstone/BitcoinUnlimitedWeb,gandrewstone/BitcoinUnlimitedWeb,BitcoinUnlimited/BitcoinUnlimitedWeb,sinahab/BitcoinUnlimitedWeb
--- +++ @@ -24,12 +24,10 @@ </div> </div> <div className='col-sm-9'> + <h2 className="green">{strings().donate.supportus}</h2> <p> {strings().donate.intro} </p> - <br /> - <h2 className="green">{strings().donate.supportus}</h2> - <br /> <p> {strings().donate.address} </p>
1fe1a01b494cc2eddab417dace089fde59203b9c
app/Resources/client/jsx/project/helpers/addTraitToProject.jsx
app/Resources/client/jsx/project/helpers/addTraitToProject.jsx
function addTraitToProject(traitName, traitValues, traitCitations, biom, dimension, dbVersion,internalProjectId, action) { console.log(arguments) var trait_metadata = biom.getMetadata({dimension: dimension, attribute: ['fennec', dbversion, 'fennec_id']}).map( function (value) { if (value in traitValues) { return traitValues[value]; } return null; } ); var trait_citations = biom.getMetadata({dimension: dimension, attribute: ['fennec', dbversion, 'fennec_id']}).map( function (value) { if (value in traitCitations) { return traitCitations[value]; } return []; } ); biom.addMetadata({dimension: dimension, attribute: traitName, values: trait_metadata}); biom.addMetadata({dimension: dimension, attribute: ['trait_citations', traitName], values: trait_citations}); let webserviceUrl = Routing.generate('api_edit_update_project', {'dbversion': dbversion}); $.ajax(webserviceUrl, { data: { "project_id": internalProjectId, "biom": biom.toString() }, method: "POST", success: action, error: (error) => showMessageDialog(error, 'danger') }); } module.exports = addTraitToProject;
function addTraitToProject(traitName, traitValues, traitCitations, biom, dimension, dbVersion,internalProjectId, action) { console.log(arguments) var trait_metadata = biom.getMetadata({dimension: dimension, attribute: ['fennec', dbVersion, 'fennec_id']}).map( function (value) { if (value in traitValues) { return traitValues[value]; } return null; } ); var trait_citations = biom.getMetadata({dimension: dimension, attribute: ['fennec', dbVersion, 'fennec_id']}).map( function (value) { if (value in traitCitations) { return traitCitations[value]; } return []; } ); biom.addMetadata({dimension: dimension, attribute: traitName, values: trait_metadata}); biom.addMetadata({dimension: dimension, attribute: ['trait_citations', traitName], values: trait_citations}); let webserviceUrl = Routing.generate('api_edit_update_project', {'dbversion': dbVersion}); $.ajax(webserviceUrl, { data: { "projectId": internalProjectId, "biom": biom.toString() }, method: "POST", success: action, error: (error) => showMessageDialog(error, 'danger') }); } module.exports = addTraitToProject;
Rename dbversion to dbVersion in traitDetails jsx
Rename dbversion to dbVersion in traitDetails jsx
JSX
mit
molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec
--- +++ @@ -1,6 +1,6 @@ function addTraitToProject(traitName, traitValues, traitCitations, biom, dimension, dbVersion,internalProjectId, action) { console.log(arguments) - var trait_metadata = biom.getMetadata({dimension: dimension, attribute: ['fennec', dbversion, 'fennec_id']}).map( + var trait_metadata = biom.getMetadata({dimension: dimension, attribute: ['fennec', dbVersion, 'fennec_id']}).map( function (value) { if (value in traitValues) { return traitValues[value]; @@ -8,7 +8,7 @@ return null; } ); - var trait_citations = biom.getMetadata({dimension: dimension, attribute: ['fennec', dbversion, 'fennec_id']}).map( + var trait_citations = biom.getMetadata({dimension: dimension, attribute: ['fennec', dbVersion, 'fennec_id']}).map( function (value) { if (value in traitCitations) { return traitCitations[value]; @@ -18,10 +18,10 @@ ); biom.addMetadata({dimension: dimension, attribute: traitName, values: trait_metadata}); biom.addMetadata({dimension: dimension, attribute: ['trait_citations', traitName], values: trait_citations}); - let webserviceUrl = Routing.generate('api_edit_update_project', {'dbversion': dbversion}); + let webserviceUrl = Routing.generate('api_edit_update_project', {'dbversion': dbVersion}); $.ajax(webserviceUrl, { data: { - "project_id": internalProjectId, + "projectId": internalProjectId, "biom": biom.toString() }, method: "POST",
0f22a42cd5f947f99274b83fdddaa84b45b6ecc5
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, logInHRD } from './actions'; import { enterpriseDomain, isSingleHRDConnection } from '../enterprise'; const Component = ({model, t}) => { const headerText = t("headerText", {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 logInHRD; } 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 = ({model, t}) => { const headerText = t("headerText", {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; } }
Fix logging in with a corporate connection
Fix logging in with a corporate connection
JSX
mit
mike-casas/lock,mike-casas/lock,mike-casas/lock
--- +++ @@ -2,7 +2,7 @@ import Screen from '../../core/screen'; import { renderSignedInConfirmation } from '../../core/signed_in_confirmation'; import HRDPane from './hrd_pane'; -import { cancelHRD, logInHRD } from './actions'; +import { cancelHRD, logIn } from './actions'; import { enterpriseDomain, isSingleHRDConnection } from '../enterprise'; const Component = ({model, t}) => { @@ -30,7 +30,7 @@ } submitHandler(model) { - return logInHRD; + return logIn; } renderAuxiliaryPane(model) {
d0f119b00e50e0a8dc5cb7dca1c439fbb0a17c0a
shared/components/handlebars-example.jsx
shared/components/handlebars-example.jsx
/** @jsx React.DOM */ /* global React */ import ExampleMixin from '../mixins/example'; import Code from './code'; import LocaleSelect from './locale-select'; import HandlebarsOutput from './handlebars-output'; export default React.createClass({ displayName: 'HandlebarsExample', mixins : [ExampleMixin], render: function () { var example = this.props.example, currentLocale = this.state.currentLocale, messages = this.props.intl.messages[currentLocale]; return ( <div id={example.id} className="example"> <div className="example-source"> <Code lang="html">{example.source.template}</Code> </div> <div className="example-context"> <Code lang="javascript">{example.source.context}</Code> </div> <div className="example-intl"> <Code lang="javascript">{this.generateIntlDataCode()}</Code> </div> <div className="example-output"> <HandlebarsOutput locales={currentLocale} formats={this.props.intl.formats} messages={messages} source={example.source.template} context={example.context} /> </div> <div className="example-controls"> <LocaleSelect currentLocale={currentLocale} availableLocales={this.props.intl.availableLocales} onLocaleChange={this.updateLocale} /> </div> </div> ); } });
/** @jsx React.DOM */ /* global React */ import ExampleMixin from '../mixins/example'; import Code from './code'; import LocaleSelect from './locale-select'; import HandlebarsOutput from './handlebars-output'; export default React.createClass({ displayName: 'HandlebarsExample', mixins : [ExampleMixin], genderateRenderCode: function () { return [ this.generateIntlDataCode(), '', 'var html = template(context, {', ' data: {intl: intlData}', '});' ].join('\n'); }, render: function () { var example = this.props.example, currentLocale = this.state.currentLocale, messages = this.props.intl.messages[currentLocale]; return ( <div id={example.id} className="example"> <div className="example-source"> <h3>Template</h3> <Code lang="html">{example.source.template}</Code> </div> <div className="example-context"> <h3>Context</h3> <Code lang="javascript">{example.source.context}</Code> </div> <div className="example-render"> <h3>Rendering</h3> <Code lang="javascript">{this.genderateRenderCode()}</Code> </div> <div className="example-output"> <HandlebarsOutput locales={currentLocale} formats={this.props.intl.formats} messages={messages} source={example.source.template} context={example.context} /> </div> <div className="example-controls"> <LocaleSelect currentLocale={currentLocale} availableLocales={this.props.intl.availableLocales} onLocaleChange={this.updateLocale} /> </div> </div> ); } });
Tweak HTML structure of examples
Tweak HTML structure of examples
JSX
bsd-3-clause
ericf/formatjs-site,okuryu/formatjs-site,ericf/formatjs-site
--- +++ @@ -10,6 +10,16 @@ displayName: 'HandlebarsExample', mixins : [ExampleMixin], + genderateRenderCode: function () { + return [ + this.generateIntlDataCode(), + '', + 'var html = template(context, {', + ' data: {intl: intlData}', + '});' + ].join('\n'); + }, + render: function () { var example = this.props.example, currentLocale = this.state.currentLocale, @@ -18,15 +28,18 @@ return ( <div id={example.id} className="example"> <div className="example-source"> + <h3>Template</h3> <Code lang="html">{example.source.template}</Code> </div> <div className="example-context"> + <h3>Context</h3> <Code lang="javascript">{example.source.context}</Code> </div> - <div className="example-intl"> - <Code lang="javascript">{this.generateIntlDataCode()}</Code> + <div className="example-render"> + <h3>Rendering</h3> + <Code lang="javascript">{this.genderateRenderCode()}</Code> </div> <div className="example-output">
a15e67e5251ffcce0439f4ee9814b06aa814bf5d
js/components/vendor/google-analytics.jsx
js/components/vendor/google-analytics.jsx
import React from "react"; export class GoogleAnalytics extends React.Component { static propTypes = { account: React.PropTypes.string.isRequired, history: React.PropTypes.object } componentDidMount() { window.ga = window.ga || function() { (ga.q = ga.q || []).push(arguments) }; ga.l = +new Date; const account = this.props.account; const scriptProtocol = ("https:" === document.location.protocol ? "https://ssl" : "http://www"); const scriptSrc = `${scriptProtocol}.google-analytics.com/ga.js`; jQuery.getScript(scriptSrc, () => { // Track Route changes ga("create", account, "auto"); if(this.props.history) { this.props.history.listen((newLocation) => { ga("send", "pageview"); }); } }); } render() { return <div key="google-analytics"/>; } }
import React from "react"; export class GoogleAnalytics extends React.Component { static propTypes = { account: React.PropTypes.string.isRequired, history: React.PropTypes.object } componentDidMount() { window.ga = window.ga || function() { (ga.q = ga.q || []).push(arguments) }; ga.l = +new Date; const account = this.props.account; // const scriptProtocol = ("https:" === document.location.protocol ? "https://ssl" : "http://www"); const scriptSrc = `//google-analytics.com/analytics.js`; jQuery.getScript(scriptSrc, () => { // Track Route changes ga("create", account, "auto"); if(this.props.history) { this.props.history.listen((newLocation) => { ga("send", "pageview"); }); } }); } render() { return <div key="google-analytics"/>; } }
Use new google analytics code
Use new google analytics code
JSX
isc
dennybritz/neal-react
--- +++ @@ -10,8 +10,8 @@ componentDidMount() { window.ga = window.ga || function() { (ga.q = ga.q || []).push(arguments) }; ga.l = +new Date; const account = this.props.account; - const scriptProtocol = ("https:" === document.location.protocol ? "https://ssl" : "http://www"); - const scriptSrc = `${scriptProtocol}.google-analytics.com/ga.js`; + // const scriptProtocol = ("https:" === document.location.protocol ? "https://ssl" : "http://www"); + const scriptSrc = `//google-analytics.com/analytics.js`; jQuery.getScript(scriptSrc, () => { // Track Route changes ga("create", account, "auto");
241ca0483e88b810be4e42a90adc58e714477bc7
imports/ui/report-view/table/element-characteristic-filter.jsx
imports/ui/report-view/table/element-characteristic-filter.jsx
import { Meteor } from 'meteor/meteor'; import React, { PropTypes } from 'react'; import { Glyphicon, OverlayTrigger, Popover, FormGroup, Checkbox } from 'react-bootstrap'; import Elements from '../../../api/elements/elements.js'; const ElementCharacteristicFilter = (props) => { const originalElement = Elements.collection.findOne(props.element._id); return ( <OverlayTrigger trigger="click" placement="right" rootClose overlay={ <Popover id={originalElement._id} title="Characteristics" > <FormGroup> {originalElement.characteristics.map((characteristic) => { return ( <Checkbox checked={isPresent(characteristic, props.element.favCharacteristicIds)} onClick={() => Meteor.call('Reports.toggleCharacteristic', props.reportId, props.element._id, characteristic._id, isPresent(characteristic, props.element.favCharacteristicIds) )} key={characteristic._id} > {characteristic.value} </Checkbox> ); })} </FormGroup> </Popover> } > <Glyphicon className="pull-right" glyph="filter" /> </OverlayTrigger> ); }; const isPresent = (characteristic, reportElementfavCharacteristicIds) => { return reportElementfavCharacteristicIds.indexOf(characteristic._id) > -1; }; ElementCharacteristicFilter.propTypes = { element: PropTypes.object.isRequired, reportId: PropTypes.string.isRequired, }; export default ElementCharacteristicFilter;
import { Meteor } from 'meteor/meteor'; import React, { PropTypes } from 'react'; import { Glyphicon, OverlayTrigger, Popover, FormGroup, Checkbox } from 'react-bootstrap'; import Elements from '../../../api/elements/elements.js'; const ElementCharacteristicFilter = (props) => { const originalElement = Elements.collection.findOne(props.element._id); return ( <OverlayTrigger trigger="click" placement="right" rootClose overlay={ <Popover id={originalElement._id} title="Characteristics" > <FormGroup> {originalElement.characteristics.map((characteristic) => { return ( <Checkbox checked={isPresent(characteristic, props.element.favCharacteristicIds)} onChange={() => Meteor.call( 'Reports.toggleCharacteristic', props.reportId, props.element._id, characteristic._id, isPresent(characteristic, props.element.favCharacteristicIds) )} key={characteristic._id} > {characteristic.value} </Checkbox> ); })} </FormGroup> </Popover> } > <Glyphicon className="pull-right" glyph="filter" /> </OverlayTrigger> ); }; const isPresent = (characteristic, reportElementfavCharacteristicIds) => { return reportElementfavCharacteristicIds.indexOf(characteristic._id) > -1; }; ElementCharacteristicFilter.propTypes = { element: PropTypes.object.isRequired, reportId: PropTypes.string.isRequired, }; export default ElementCharacteristicFilter;
Change onClick to onChange for checkbox preventing console warning
Change onClick to onChange for checkbox preventing console warning
JSX
mit
minden/data-furnace,minden/data-furnace
--- +++ @@ -17,7 +17,8 @@ return ( <Checkbox checked={isPresent(characteristic, props.element.favCharacteristicIds)} - onClick={() => Meteor.call('Reports.toggleCharacteristic', + onChange={() => Meteor.call( + 'Reports.toggleCharacteristic', props.reportId, props.element._id, characteristic._id, @@ -31,7 +32,7 @@ })} </FormGroup> </Popover> - } + } > <Glyphicon className="pull-right" glyph="filter" /> </OverlayTrigger>
0b7a02ae491e684b96440fc95e0d734cf7be8e1f
client/components/Index/IndexComponent.jsx
client/components/Index/IndexComponent.jsx
var React = require('react'); var IndexComponent = React.createClass({ getDefaultProps: function () { return { items: [] }; }, render: function() { if (this.props.items.length === 0) { return ( <p ref="empty">Index is empty.</p> ); } return ( <section> <h2>react-webpack-boilerplate</h2> <ul ref="indexList" className="index-list"> {this.props.items.map(function(item){ return <li>item {item}</li> })} </ul> </section> ); } }); module.exports = IndexComponent;
var React = require('react'); var IndexComponent = React.createClass({ getDefaultProps: function () { return { items: [] }; }, render: function() { if (this.props.items.length === 0) { return ( <p ref="empty">Index is empty.</p> ); } return ( <section> <h2>react-webpack-boilerplate</h2> <ul ref="indexList" className="index-list"> {this.props.items.map(function(item, index){ return <li key={index}>item {item}</li> })} </ul> </section> ); } }); module.exports = IndexComponent;
Fix React unique key test notice
Fix React unique key test notice
JSX
mit
sdbondi/react-webpack-boilerplate,sdbondi/react-webpack-play,daviferreira/classnames-webpack-eval,srn/react-webpack-boilerplate,justengland/tic-tac-toe,Widcket/react-form,tungv/editor,dclowd9901/react-ui-action-handler-decoupling,Widcket/react-form,bellicose100xp/react-webpack-boilerplate,weixing2014/react-webpack-boilerplate,saitodisse/search-mp3,srn/react-webpack-boilerplate,dclowd9901/react-ui-action-handler-decoupling,dclowd9901/js-3d-engine,dclowd9901/js-3d-engine,AgtLucas/react-webpack-boilerplate
--- +++ @@ -18,8 +18,8 @@ <section> <h2>react-webpack-boilerplate</h2> <ul ref="indexList" className="index-list"> - {this.props.items.map(function(item){ - return <li>item {item}</li> + {this.props.items.map(function(item, index){ + return <li key={index}>item {item}</li> })} </ul> </section>
f168e5dda597b61e8b55e05cc9746c77f7c5d011
app/assets/javascripts/components/common/multi_select_field.jsx
app/assets/javascripts/components/common/multi_select_field.jsx
import React from 'react'; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import Select from 'react-select'; import selectStyles from '../../styles/select'; const MultiSelectField = createReactClass({ displayName: 'MultiSelectField', propTypes: { label: PropTypes.string, options: PropTypes.array, }, getInitialState() { return { removeSelected: true, disabled: false, stayOpen: false, value: this.props.selected, rtl: false, }; }, handleSelectChange(value) { this.setState({ value }); this.props.setSelectedFilters(value); }, render() { const { disabled, stayOpen, value } = this.state; const options = this.props.options; return ( <div className="section"> <Select closeOnSelect={!stayOpen} disabled={disabled} isMulti onChange={this.handleSelectChange} options={options} placeholder={this.props.label} removeSelected={this.state.removeSelected} rtl={this.state.rtl} simpleValue value={value} styles={selectStyles} /> </div> ); } }); export default MultiSelectField;
import React from 'react'; import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import Select from 'react-select'; import selectStyles from '../../styles/select'; const MultiSelectField = createReactClass({ displayName: 'MultiSelectField', propTypes: { label: PropTypes.string, options: PropTypes.array, }, getInitialState() { return { removeSelected: true, disabled: false, stayOpen: false, value: this.props.selected, rtl: false, }; }, handleSelectChange(value) { this.setState({ value }); this.props.setSelectedFilters(value || []); }, render() { const { disabled, stayOpen, value } = this.state; const options = this.props.options; return ( <div className="section"> <Select closeOnSelect={!stayOpen} disabled={disabled} isMulti onChange={this.handleSelectChange} options={options} placeholder={this.props.label} removeSelected={this.state.removeSelected} rtl={this.state.rtl} simpleValue value={value} styles={selectStyles} /> </div> ); } }); export default MultiSelectField;
Handle de-selection of last option in MultiSelectField
Handle de-selection of last option in MultiSelectField react-select changed behavior with version 3, so that removing the last selected option from a multiselect results in value of `null` instead of `[]` as before. This was resulting in an error in the tickets selector, which assumes an array of selected filters. Related: https://github.com/JedWatson/react-select/issues/3632
JSX
mit
WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard
--- +++ @@ -23,7 +23,7 @@ handleSelectChange(value) { this.setState({ value }); - this.props.setSelectedFilters(value); + this.props.setSelectedFilters(value || []); }, render() {
9824d7fe230c67c8c73149cf9115b4e583fe32b2
app/api/openWeatherMap.jsx
app/api/openWeatherMap.jsx
var axios = require('axios'); const OPEN_WEATHER_MAP_URL = `http://api.openweathermap.org/data/2.5/weather?appid=${API_KEY}&units=imperial`; module.exports = { getCurrentWeather: function (location) { var encodedLocation = encodeURIComponent(location); var requestUrl = `${OPEN_WEATHER_MAP_URL}&q=${encodedLocation}`; return axios.get(requestUrl).then(function (res) { if (res.data.cod && res.data.message) { //if true, something went wrong throw new Error(res.data.message); //send to error handler in Weather.jsx } else { return res.data; //send to success case in Weather.jsx } }, function (res) { throw new Error(res.data.message); //if api sends an error, we pull then show to user }); } };
const axios = require('axios'); const OPEN_WEATHER_MAP_URL = 'http://api.openweathermap.org/data/2.5/'; const DEFAULT_UNIT = 'imperial'; module.exports = { getCurrentWeather: function (location) { const encodedLocation = encodeURIComponent(location); const requestUrl = `${OPEN_WEATHER_MAP_URL}weather?appid=${API_KEY}&units=${DEFAULT_UNIT}&q=${encodedLocation}`; return axios.get(requestUrl).then(function (res) { if (res.data.cod && res.data.message) { //if true, something went wrong throw new Error(res.data.message); //send to error handler in Weather.jsx } else { return res.data; //send to success case in Weather.jsx } }, function (res) { throw new Error(res.data.message); //if api sends an error, we pull then show to user }); }, get5DayForecast: function (location) { const encodedLocation = encodeURIComponent(location); const requestUrl = `${OPEN_WEATHER_MAP_URL}forecast?appid=${API_KEY}&units=${DEFAULT_UNIT}&q=${encodedLocation}`; return axios.get(requestUrl).then(function (res) { const apiDataHasError = res.data.cod !== '200'; if (apiDataHasError && res.data.message) { //if true, something went wrong throw new Error(res.data.message); //send to error handler in Weather.jsx } else { return res.data; //send to success case in Weather.jsx } }, function (res) { throw new Error(res.data.message); //if api sends an error, we pull then show to user }); } };
Add method to call OpenWeatherMap API's 5-day forecast
Add method to call OpenWeatherMap API's 5-day forecast
JSX
mit
bmorelli25/React-Weather-App,bmorelli25/React-Weather-App
--- +++ @@ -1,20 +1,38 @@ -var axios = require('axios'); +const axios = require('axios'); -const OPEN_WEATHER_MAP_URL = `http://api.openweathermap.org/data/2.5/weather?appid=${API_KEY}&units=imperial`; +const OPEN_WEATHER_MAP_URL = 'http://api.openweathermap.org/data/2.5/'; +const DEFAULT_UNIT = 'imperial'; module.exports = { - getCurrentWeather: function (location) { - var encodedLocation = encodeURIComponent(location); - var requestUrl = `${OPEN_WEATHER_MAP_URL}&q=${encodedLocation}`; + getCurrentWeather: function (location) { + const encodedLocation = encodeURIComponent(location); + const requestUrl = `${OPEN_WEATHER_MAP_URL}weather?appid=${API_KEY}&units=${DEFAULT_UNIT}&q=${encodedLocation}`; - return axios.get(requestUrl).then(function (res) { - if (res.data.cod && res.data.message) { //if true, something went wrong - throw new Error(res.data.message); //send to error handler in Weather.jsx - } else { - return res.data; //send to success case in Weather.jsx - } - }, function (res) { - throw new Error(res.data.message); //if api sends an error, we pull then show to user - }); - } + return axios.get(requestUrl).then(function (res) { + if (res.data.cod && res.data.message) { //if true, something went wrong + throw new Error(res.data.message); //send to error handler in Weather.jsx + } else { + return res.data; //send to success case in Weather.jsx + } + }, function (res) { + throw new Error(res.data.message); //if api sends an error, we pull then show to user + }); + }, + + get5DayForecast: function (location) { + const encodedLocation = encodeURIComponent(location); + const requestUrl = `${OPEN_WEATHER_MAP_URL}forecast?appid=${API_KEY}&units=${DEFAULT_UNIT}&q=${encodedLocation}`; + + return axios.get(requestUrl).then(function (res) { + const apiDataHasError = res.data.cod !== '200'; + if (apiDataHasError && res.data.message) { //if true, something went wrong + throw new Error(res.data.message); //send to error handler in Weather.jsx + } else { + return res.data; //send to success case in Weather.jsx + } + }, function (res) { + throw new Error(res.data.message); //if api sends an error, we pull then show to user + }); + } + };
f162d026d33a6d86f8fe3893ab3154062ee863f6
src/components/post-attachment-image.jsx
src/components/post-attachment-image.jsx
import React from 'react'; import numeral from 'numeral'; export default (props) => { const formattedFileSize = numeral(props.fileSize).format('0.[0] b'); const formattedImageSize = (props.imageSizes.o ? `, ${props.imageSizes.o.w}×${props.imageSizes.o.h}px` : ''); const nameAndSize = props.fileName + ' (' + formattedFileSize + formattedImageSize + ')'; const removeAttachment = () => props.removeAttachment(props.id); const imageAttributes = { src: props.thumbnailUrl, alt: nameAndSize, width: props.imageSizes.t ? props.imageSizes.t.w : undefined, height: props.imageSizes.t ? props.imageSizes.t.h : undefined }; return ( <div className="attachment"> <a href={props.url} title={nameAndSize} target="_blank"> {props.thumbnailUrl ? ( <img {...imageAttributes}/> ) : ( props.id )} </a> {props.isEditing ? ( <a className="remove-attachment fa fa-times" title="Remove image" onClick={removeAttachment}></a> ) : false} </div> ); };
import React from 'react'; import numeral from 'numeral'; export default (props) => { const formattedFileSize = numeral(props.fileSize).format('0.[0] b'); const formattedImageSize = (props.imageSizes.o ? `, ${props.imageSizes.o.w}×${props.imageSizes.o.h}px` : ''); const nameAndSize = props.fileName + ' (' + formattedFileSize + formattedImageSize + ')'; const removeAttachment = () => props.removeAttachment(props.id); const imageAttributes = { src: props.imageSizes.t && props.imageSizes.t.url || props.thumbnailUrl, alt: nameAndSize, width: props.imageSizes.t && props.imageSizes.t.w || undefined, height: props.imageSizes.t && props.imageSizes.t.h || undefined }; return ( <div className="attachment"> <a href={props.url} title={nameAndSize} target="_blank"> {props.thumbnailUrl ? ( <img {...imageAttributes}/> ) : ( props.id )} </a> {props.isEditing ? ( <a className="remove-attachment fa fa-times" title="Remove image" onClick={removeAttachment}></a> ) : false} </div> ); };
Make PostAttachmentImage more compatible with the new API
[retina-thumbnails] Make PostAttachmentImage more compatible with the new API
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -9,10 +9,10 @@ const removeAttachment = () => props.removeAttachment(props.id); const imageAttributes = { - src: props.thumbnailUrl, + src: props.imageSizes.t && props.imageSizes.t.url || props.thumbnailUrl, alt: nameAndSize, - width: props.imageSizes.t ? props.imageSizes.t.w : undefined, - height: props.imageSizes.t ? props.imageSizes.t.h : undefined + width: props.imageSizes.t && props.imageSizes.t.w || undefined, + height: props.imageSizes.t && props.imageSizes.t.h || undefined }; return (
48f10bcb732f6541b4299541d231b20b6451813a
src/components/inputs/AutocompleteInput.jsx
src/components/inputs/AutocompleteInput.jsx
import React from 'react' import Autocomplete from 'react-autocomplete' import input from '../../config/input' import colors from '../../config/colors' import { margins, fontSizes } from '../../config/scales' class AutocompleteInput extends React.Component { static propTypes = { value: React.PropTypes.string.isRequired, options: React.PropTypes.array.isRequired, style: React.PropTypes.object, onChange: React.PropTypes.func.isRequired, } render() { return <Autocomplete menuStyle={{ border: 'none', padding: '2px 0', position: 'fixed', overflow: 'auto', maxHeight: '50%', }} inputProps={{ style: { ...input.input, width: null, ...this.props.style, } }} value={this.props.value} items={this.props.options} getItemValue={(item) => item[0]} onSelect={v => this.props.onChange(v)} onChange={(e, v) => this.props.onChange(v)} renderItem={(item, isHighlighted) => ( <div key={item[0]} style={{ userSelect: 'none', color: colors.lowgray, background: isHighlighted ? colors.midgray : colors.gray, padding: margins[0], fontSize: fontSizes[5], }} > {item[1]} </div> )} /> } } export default AutocompleteInput
import React from 'react' import Autocomplete from 'react-autocomplete' import input from '../../config/input' import colors from '../../config/colors' import { margins, fontSizes } from '../../config/scales' class AutocompleteInput extends React.Component { static propTypes = { value: React.PropTypes.string.isRequired, options: React.PropTypes.array.isRequired, style: React.PropTypes.object, onChange: React.PropTypes.func.isRequired, } render() { return <Autocomplete menuStyle={{ border: 'none', padding: '2px 0', position: 'fixed', overflow: 'auto', maxHeight: '50%', background: colors.gray, zIndex: 3, }} inputProps={{ style: { ...input.input, width: null, ...this.props.style, } }} value={this.props.value} items={this.props.options} getItemValue={(item) => item[0]} onSelect={v => this.props.onChange(v)} onChange={(e, v) => this.props.onChange(v)} renderItem={(item, isHighlighted) => ( <div key={item[0]} style={{ userSelect: 'none', color: colors.lowgray, background: isHighlighted ? colors.midgray : colors.gray, padding: margins[0], fontSize: fontSizes[5], zIndex: 3, }} > {item[1]} </div> )} /> } } export default AutocompleteInput
Convert Autocmplete from tabs to spaces
Convert Autocmplete from tabs to spaces
JSX
mit
maputnik/editor,maputnik/editor
--- +++ @@ -13,41 +13,44 @@ } render() { - return <Autocomplete - menuStyle={{ - border: 'none', + return <Autocomplete + menuStyle={{ + border: 'none', padding: '2px 0', position: 'fixed', overflow: 'auto', maxHeight: '50%', - }} - inputProps={{ + background: colors.gray, + zIndex: 3, + }} + inputProps={{ style: { - ...input.input, - width: null, + ...input.input, + width: null, ...this.props.style, - } - }} + } + }} value={this.props.value} - items={this.props.options} - getItemValue={(item) => item[0]} - onSelect={v => this.props.onChange(v)} + items={this.props.options} + getItemValue={(item) => item[0]} + onSelect={v => this.props.onChange(v)} onChange={(e, v) => this.props.onChange(v)} - renderItem={(item, isHighlighted) => ( - <div - key={item[0]} - style={{ - userSelect: 'none', - color: colors.lowgray, - background: isHighlighted ? colors.midgray : colors.gray, - padding: margins[0], - fontSize: fontSizes[5], - }} - > - {item[1]} - </div> - )} - /> + renderItem={(item, isHighlighted) => ( + <div + key={item[0]} + style={{ + userSelect: 'none', + color: colors.lowgray, + background: isHighlighted ? colors.midgray : colors.gray, + padding: margins[0], + fontSize: fontSizes[5], + zIndex: 3, + }} + > + {item[1]} + </div> + )} + /> } }
a008141868527e8533fc7aefe225348e39afa5cb
src/drive/web/modules/services/components/Picker/AddFolderButton.jsx
src/drive/web/modules/services/components/Picker/AddFolderButton.jsx
import React from 'react' import { connect } from 'react-redux' import { Button } from 'cozy-ui/react' const AddFolderButton = ({ addFolder }) => ( <Button onClick={addFolder}>Nouveau dossier</Button> ) const mapDispatchToPropsButton = (dispatch, ownProps) => ({ addFolder: () => dispatch(showNewFolderInput()) }) export default connect(null, mapDispatchToPropsButton)(AddFolderButton)
import React from 'react' import { connect } from 'react-redux' import { Button, ButtonAction, withBreakpoints, Icon } from 'cozy-ui/react' import IconFolderAdd from 'drive/assets/icons/icon-folder-add.svg' import { showNewFolderInput } from 'drive/web/modules/filelist/duck' const AddFolderButton = ({ addFolder, breakpoints: { isMobile } }) => { if (isMobile) return ( <ButtonAction compact rightIcon={<Icon icon={IconFolderAdd} color="coolGrey" />} onClick={addFolder} label={'Nouveau dossier'} /> ) else return ( <Button icon={IconFolderAdd} onClick={addFolder}> Nouveau dossier </Button> ) } const mapDispatchToPropsButton = (dispatch, ownProps) => ({ addFolder: () => dispatch(showNewFolderInput()) }) export default connect(null, mapDispatchToPropsButton)( withBreakpoints()(AddFolderButton) )
Add folder buton on mobile
fix: Add folder buton on mobile
JSX
agpl-3.0
y-lohse/cozy-drive,nono/cozy-files-v3,cozy/cozy-files-v3,y-lohse/cozy-drive,cozy/cozy-files-v3,nono/cozy-files-v3,cozy/cozy-files-v3,y-lohse/cozy-files-v3,y-lohse/cozy-files-v3,y-lohse/cozy-drive,y-lohse/cozy-drive,y-lohse/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3,cozy/cozy-files-v3
--- +++ @@ -1,13 +1,31 @@ import React from 'react' import { connect } from 'react-redux' -import { Button } from 'cozy-ui/react' +import { Button, ButtonAction, withBreakpoints, Icon } from 'cozy-ui/react' +import IconFolderAdd from 'drive/assets/icons/icon-folder-add.svg' +import { showNewFolderInput } from 'drive/web/modules/filelist/duck' -const AddFolderButton = ({ addFolder }) => ( - <Button onClick={addFolder}>Nouveau dossier</Button> -) +const AddFolderButton = ({ addFolder, breakpoints: { isMobile } }) => { + if (isMobile) + return ( + <ButtonAction + compact + rightIcon={<Icon icon={IconFolderAdd} color="coolGrey" />} + onClick={addFolder} + label={'Nouveau dossier'} + /> + ) + else + return ( + <Button icon={IconFolderAdd} onClick={addFolder}> + Nouveau dossier + </Button> + ) +} const mapDispatchToPropsButton = (dispatch, ownProps) => ({ addFolder: () => dispatch(showNewFolderInput()) }) -export default connect(null, mapDispatchToPropsButton)(AddFolderButton) +export default connect(null, mapDispatchToPropsButton)( + withBreakpoints()(AddFolderButton) +)
f2b7b30af38e98095e602b4e1aa557bdbc301de1
app/components/App.jsx
app/components/App.jsx
import AppBar from 'material-ui/AppBar'; import FlatButton from 'material-ui/FlatButton'; import NavLogo from 'components/NavLogo'; import React from 'react'; const App = React.createClass({ render() { const styleAppBar = { height: '125px' }; const styleFlatButton = { height: '125px', lineHeight: '125px', minWidth: '60px' }; const styleFlatButtonLabel = { fontSize: '.7rem', padding: '0' }; const styleIconLeft = { marginLeft: '35px' }; return <div> <AppBar style={styleAppBar} title="workflow | Job Search Management" iconElementLeft={<NavLogo/>} iconStyleLeft={styleIconLeft} > <FlatButton label="Dashboard" labelStyle={styleFlatButtonLabel} style={styleFlatButton} /> <FlatButton label="Jobs" labelStyle={styleFlatButtonLabel} style={styleFlatButton} /> <FlatButton label="Contacts" labelStyle={styleFlatButtonLabel} style={styleFlatButton} /> <FlatButton label="Logout" labelStyle={styleFlatButtonLabel} style={styleFlatButton} /> </AppBar> </div> } }); export default App;
import AppBar from 'material-ui/AppBar'; import FlatButton from 'material-ui/FlatButton'; import NavLogo from 'components/NavLogo'; import React from 'react'; const App = React.createClass({ render() { const styleAppBar = { height: '125px' }; const styleFlatButton = { height: '125px', lineHeight: '125px', minWidth: '60px' }; const styleFlatButtonLabel = { fontSize: '.7rem', padding: '0' }; const styleIconLeft = { height: '125px', lineHeight: '125px', marginLeft: '35px', marginTop: '14px' }; const styleSubTitle = { fontSize: '.9rem', marginLeft: '10px', position: 'relative', top: '-5px' }; const styleTitle = { cursor: 'pointer', fontSize: '1.1rem', height: '125px', lineHeight: '71px' }; return <div> <AppBar iconElementLeft={<NavLogo/>} iconStyleLeft={styleIconLeft} style={styleAppBar} title={<h1>workflow | <span style={styleSubTitle}>Job Search Management</span> </h1>} titleStyle={styleTitle} > <FlatButton label="Dashboard" labelStyle={styleFlatButtonLabel} style={styleFlatButton} /> <FlatButton label="Jobs" labelStyle={styleFlatButtonLabel} style={styleFlatButton} /> <FlatButton label="Contacts" labelStyle={styleFlatButtonLabel} style={styleFlatButton} /> <FlatButton label="Logout" labelStyle={styleFlatButtonLabel} style={styleFlatButton} /> </AppBar> </div> } }); export default App;
Update styles for Main navbar
Update styles for Main navbar
JSX
mit
brybrophy/workflow,brybrophy/workflow
--- +++ @@ -22,15 +22,35 @@ }; const styleIconLeft = { - marginLeft: '35px' + height: '125px', + lineHeight: '125px', + marginLeft: '35px', + marginTop: '14px' + }; + + const styleSubTitle = { + fontSize: '.9rem', + marginLeft: '10px', + position: 'relative', + top: '-5px' + }; + + const styleTitle = { + cursor: 'pointer', + fontSize: '1.1rem', + height: '125px', + lineHeight: '71px' }; return <div> <AppBar - style={styleAppBar} - title="workflow | Job Search Management" iconElementLeft={<NavLogo/>} iconStyleLeft={styleIconLeft} + style={styleAppBar} + title={<h1>workflow | + <span style={styleSubTitle}>Job Search Management</span> + </h1>} + titleStyle={styleTitle} > <FlatButton label="Dashboard"
c6ef853a89a525b3e72cc92e7dcf07e5b31009b3
app/react/components/data-card/data-card.jsx
app/react/components/data-card/data-card.jsx
import React from "react"; import Categories from "../../components/categories/categories.jsx"; export default React.createClass({ propTypes: { className: React.PropTypes.string, showPicture: React.PropTypes.bool, picture: React.PropTypes.string, categories: React.PropTypes.arrayOf(React.PropTypes.string) }, getDefaultProps() { return{ showPicture: false }; }, render() { return ( <div className={`data-card-wrapper ${this.props.className}`}> <div className="data-card"> {this.props.showPicture ? <img className="card-image" src={this.props.picture} /> : null } <Categories categories={this.props.categories} /> {this.props.children} </div> </div> ); } });
import React from "react"; import Categories from "../../components/categories/categories.jsx"; export default class DataCard extends React.Component { render() { return ( <div className={`data-card-wrapper ${this.props.className}`}> <div className="data-card"> {this.props.showPicture ? <img className="card-image" src={this.props.picture} /> : null } <Categories categories={this.props.categories} /> {this.props.children} </div> </div> ); } } DataCard.propTypes = { className: React.PropTypes.string, showPicture: React.PropTypes.bool, picture: React.PropTypes.string, categories: React.PropTypes.arrayOf(React.PropTypes.string) }; DataCard.defaultProps = { showPicture: false };
Make changes for es6 migrations
DataCard: Make changes for es6 migrations See #613
JSX
mpl-2.0
mozilla/science.mozilla.org,mozilla/science.mozilla.org
--- +++ @@ -2,18 +2,8 @@ import React from "react"; import Categories from "../../components/categories/categories.jsx"; -export default React.createClass({ - propTypes: { - className: React.PropTypes.string, - showPicture: React.PropTypes.bool, - picture: React.PropTypes.string, - categories: React.PropTypes.arrayOf(React.PropTypes.string) - }, - getDefaultProps() { - return{ - showPicture: false - }; - }, +export default class DataCard extends React.Component { + render() { return ( @@ -26,4 +16,15 @@ </div> ); } -}); +} + +DataCard.propTypes = { + className: React.PropTypes.string, + showPicture: React.PropTypes.bool, + picture: React.PropTypes.string, + categories: React.PropTypes.arrayOf(React.PropTypes.string) +}; + +DataCard.defaultProps = { + showPicture: false +};
1c8f3386730fb4d6391fecd4c0b907991a7874f2
code/client/routes.jsx
code/client/routes.jsx
import React from 'react'; import {render} from 'react-dom' import {mount} from 'react-mounter'; // load Layout and Welcome React components import {Exemplars, HowTo, Layout, Users, Welcome} from './app.jsx'; import {Router, Route, IndexRoute} from 'react-router' import createBrowserHistory from 'history/lib/createBrowserHistory' const routes = <Router history={createBrowserHistory()}> { // The components for all routes within this one will be nested within Layout. } <Route path='/' component={Layout}> { // IndexRoute sets what the Layout defaults if nothing is passed after the // slash. We pass a function (a component) instead of just a component // name because Welcome needs an argument. } <IndexRoute component={() => <Welcome name="The World's Best Father" />} /> <Route path='users' component={Users} /> <Route path='how-to' component={HowTo} /> <Route path='exemplars' component={Exemplars} /> </Route> </Router> const renderTarget = document.createElement('div'); // When the app starts up, put react-router in the body. $(() => { document.body.appendChild(renderTarget) render( routes, renderTarget ) })
import React from 'react'; import {render} from 'react-dom'; // load Layout and Welcome React components import {Exemplars, HowTo, Layout, Users, Welcome} from './app.jsx'; import {Router, Route, IndexRoute} from 'react-router' import createBrowserHistory from 'history/lib/createBrowserHistory' const routes = <Router history={createBrowserHistory()}> { // The components for all routes within this one will be nested within Layout. } <Route path='/' component={Layout}> { // IndexRoute sets what the Layout defaults if nothing is passed after the // slash. We pass a function (a component) instead of just a component // name because Welcome needs an argument. } <IndexRoute component={() => <Welcome name="The World's Best Father" />} /> <Route path='users' component={Users} /> <Route path='how-to' component={HowTo} /> <Route path='exemplars' component={Exemplars} /> </Route> </Router> const renderTarget = document.createElement('div'); // When the app starts up, put react-router in the body. $(() => { document.body.appendChild(renderTarget) render( routes, renderTarget ) })
Remove react-mounter (no longer using flow-router).
Remove react-mounter (no longer using flow-router).
JSX
bsd-3-clause
DouglasUrner/Class-Blog
--- +++ @@ -1,6 +1,6 @@ import React from 'react'; -import {render} from 'react-dom' -import {mount} from 'react-mounter'; +import {render} from 'react-dom'; + // load Layout and Welcome React components import {Exemplars, HowTo, Layout, Users, Welcome} from './app.jsx'; import {Router, Route, IndexRoute} from 'react-router'
7bf48ea61756ef6596d0aba8147c886b35c1499c
src/client/components/ActivityFeed/activities/card/ActivityCardLabels.jsx
src/client/components/ActivityFeed/activities/card/ActivityCardLabels.jsx
import React from 'react' import Tag from '../../../Tag' import styled from 'styled-components' import PropTypes from 'prop-types' import { SPACING } from '@govuk-react/constants' const TagRow = styled('div')` display: flex; justify-content: space-between; padding-bottom: ${SPACING.SCALE_2}; margin-right: ${SPACING.SCALE_1}; ` const TagColumn = styled('div')` display: flex; ` const StyledThemeTag = styled(Tag)` margin-right: ${SPACING.SCALE_1}; ` const ActivityCardLabels = ({ theme, service, kind }) => ( <TagRow> <TagColumn> {theme && ( <StyledThemeTag data-test="activity-theme-label" colour="default"> {theme} </StyledThemeTag> )} {service && ( <Tag data-test="activity-service-label" colour="blue"> {service} </Tag> )} </TagColumn> <TagColumn> {kind && ( <Tag data-test="activity-kind-label" colour="grey"> {kind} </Tag> )} </TagColumn> </TagRow> ) ActivityCardLabels.propTypes = { theme: PropTypes.string, service: PropTypes.string, kind: PropTypes.string, } export default ActivityCardLabels
import React from 'react' import Tag from '../../../Tag' import styled from 'styled-components' import PropTypes from 'prop-types' import { SPACING } from '@govuk-react/constants' const TagRow = styled('div')` display: flex; justify-content: space-between; padding-bottom: ${SPACING.SCALE_2}; margin-right: ${SPACING.SCALE_1}; ` const TagColumn = styled('div')` display: flex; ` const StyledThemeTag = styled(Tag)` margin-right: ${SPACING.SCALE_1}; ` const ActivityCardLabels = ({ theme, service, kind }) => ( <TagRow> <TagColumn> {theme && ( <StyledThemeTag data-test="activity-theme-label" colour="default"> {theme} </StyledThemeTag> )} {service && ( <Tag data-test="activity-service-label" colour="blue"> {service} </Tag> )} </TagColumn> <TagColumn> <Tag data-test="activity-kind-label" colour="grey"> {kind} </Tag> </TagColumn> </TagRow> ) ActivityCardLabels.propTypes = { theme: PropTypes.string, service: PropTypes.string, kind: PropTypes.string, } export default ActivityCardLabels
Remove redundant check for interaction kind
Remove redundant check for interaction kind
JSX
mit
uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-frontend
--- +++ @@ -35,11 +35,9 @@ )} </TagColumn> <TagColumn> - {kind && ( - <Tag data-test="activity-kind-label" colour="grey"> - {kind} - </Tag> - )} + <Tag data-test="activity-kind-label" colour="grey"> + {kind} + </Tag> </TagColumn> </TagRow> )
60f96256581f4c49790b221a218cee4823f4c8cd
web/static/js/configs/stage_configs.jsx
web/static/js/configs/stage_configs.jsx
import React from "react" export default { "prime-directive": { alert: null, confirmationMessage: "Are you sure want to proceed to the Idea Generation stage?", nextStage: "idea-generation", progressionButton: { copy: "Proceed to Idea Generation", iconClass: "arrow right", }, }, "idea-generation": { alert: null, confirmationMessage: "Are you sure you would like to proceed to the action items stage?", nextStage: "action-items", progressionButton: { copy: "Proceed to Action Items", iconClass: "arrow right", }, }, "action-items": { alert: null, confirmationMessage: "Are you sure you want to distribute this retrospective's action items? This will close the retro.", nextStage: "action-item-distribution", progressionButton: { copy: "Send Action Items", iconClass: "send", }, }, "action-item-distribution": { alert: { headerText: "Action Items Distributed", bodyText: <div> <p>The facilitator has distributed this retro's action items. You will receive an email breakdown shortly!</p> <p>Thank you for using Remote Retro! Please click <a href="https://www.surveymonkey.com/r/JKT9FXM" target="_blank" rel="noopener noreferrer">here</a> to give us feedback on your experience.</p> </div>, }, confirmationMessage: null, nextStage: null, progressionButton: null, }, }
import React from "react" export default { "prime-directive": { alert: null, confirmationMessage: "Your entire party has arrived?", nextStage: "idea-generation", progressionButton: { copy: "Proceed to Idea Generation", iconClass: "arrow right", }, }, "idea-generation": { alert: null, confirmationMessage: "Are you sure you would like to proceed to the action items stage?", nextStage: "action-items", progressionButton: { copy: "Proceed to Action Items", iconClass: "arrow right", }, }, "action-items": { alert: null, confirmationMessage: "Are you sure you want to distribute this retrospective's action items? This will close the retro.", nextStage: "action-item-distribution", progressionButton: { copy: "Send Action Items", iconClass: "send", }, }, "action-item-distribution": { alert: { headerText: "Action Items Distributed", bodyText: <div> <p>The facilitator has distributed this retro's action items. You will receive an email breakdown shortly!</p> <p>Thank you for using Remote Retro! Please click <a href="https://www.surveymonkey.com/r/JKT9FXM" target="_blank" rel="noopener noreferrer">here</a> to give us feedback on your experience.</p> </div>, }, confirmationMessage: null, nextStage: null, progressionButton: null, }, }
Update prime directive stage progression text
Update prime directive stage progression text - we want folks to not move to the idea generation stage until everyone in (or the majority of) the party has arrived
JSX
mit
stride-nyc/remote_retro,tnewell5/remote_retro,samdec11/remote_retro,tnewell5/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro
--- +++ @@ -3,7 +3,7 @@ export default { "prime-directive": { alert: null, - confirmationMessage: "Are you sure want to proceed to the Idea Generation stage?", + confirmationMessage: "Your entire party has arrived?", nextStage: "idea-generation", progressionButton: { copy: "Proceed to Idea Generation",
87f316ff1396efaa3a6e51b22de7744a5b0a4793
installer/frontend/components/cidr.jsx
installer/frontend/components/cidr.jsx
import React from 'react'; import { Deselect, Input, WithClusterConfig } from './ui'; import { validate } from '../validate'; import { DESELECTED_FIELDS } from '../cluster-config.js'; import { WithTooltip } from './tooltip'; const generateTooltipText = ({value}) => { if (validate.CIDR(value)) { return; } const [, bits] = value.split('/'); // javascript's bit shifting only works on signed 32bit ints so <<31 // would be negative :( const addresses = Math.pow(2, 32 - parseInt(bits, 10)); return `${addresses} IP address${addresses === 1 ? '' : 'es'}`; }; export const CIDR = ({field, name, disabled, placeholder, autoFocus, validator, selectable, fieldName}) => { fieldName = fieldName || field; return <div className="row form-group"> <div className="col-xs-3"> {selectable && <Deselect field={fieldName} />} <label htmlFor={(selectable ? `${DESELECTED_FIELDS}.` : '') + fieldName}>{name}</label> </div> <div className="col-xs-5 withtooltip"> <WithClusterConfig field={field} validator={validator || validate.CIDR}> <WithTooltip generateText={generateTooltipText}> <Input placeholder={placeholder} id={field} disabled={disabled} autoFocus={autoFocus} /> </WithTooltip> </WithClusterConfig> </div> </div>; };
import React from 'react'; import { Deselect, Input, WithClusterConfig } from './ui'; import { validate } from '../validate'; import { DESELECTED_FIELDS } from '../cluster-config.js'; export const CIDR = ({field, name, disabled, placeholder, autoFocus, validator, selectable, fieldName}) => { fieldName = fieldName || field; return <div className="row form-group"> <div className="col-xs-3"> {selectable && <Deselect field={fieldName} />} <label htmlFor={(selectable ? `${DESELECTED_FIELDS}.` : '') + fieldName}>{name}</label> </div> <div className="col-xs-5"> <WithClusterConfig field={field} validator={validator || validate.CIDR}> <Input placeholder={placeholder} id={field} disabled={disabled} autoFocus={autoFocus} /> </WithClusterConfig> </div> </div>; };
Fix tooltip preventing editing of CIDR inputs
frontend: Fix tooltip preventing editing of CIDR inputs
JSX
apache-2.0
hhoover/tectonic-installer,rithujohn191/tectonic-installer,enxebre/tectonic-installer,s-urbaniak/tectonic-installer,everett-toews/tectonic-installer,lander2k2/tectonic-installer,lander2k2/tectonic-installer,yifan-gu/tectonic-installer,aknuds1/tectonic-installer,colemickens/tectonic-installer,everett-toews/tectonic-installer,kalmog/tectonic-installer,derekhiggins/installer,everett-toews/tectonic-installer,squat/tectonic-installer,aknuds1/tectonic-installer,colemickens/tectonic-installer,colemickens/tectonic-installer,cpanato/tectonic-installer,derekhiggins/installer,rithujohn191/tectonic-installer,joshix/tectonic-installer,AduroIdeja/tectonic-installer,rithujohn191/tectonic-installer,kalmog/tectonic-installer,coreos/tectonic-installer,s-urbaniak/tectonic-installer,alexsomesan/tectonic-installer,enxebre/tectonic-installer,cpanato/tectonic-installer,kyoto/tectonic-installer,yifan-gu/tectonic-installer,kalmog/tectonic-installer,coreos/tectonic-installer,rithujohn191/tectonic-installer,alexsomesan/tectonic-installer,bsiegel/tectonic-installer,justaugustus/tectonic-installer,mrwacky42/tectonic-installer,mrwacky42/tectonic-installer,metral/tectonic-installer,yifan-gu/tectonic-installer,s-urbaniak/tectonic-installer,squat/tectonic-installer,alexsomesan/tectonic-installer,metral/tectonic-installer,yifan-gu/tectonic-installer,joshix/tectonic-installer,joshix/tectonic-installer,zbwright/tectonic-installer,hhoover/tectonic-installer,rithujohn191/tectonic-installer,joshix/tectonic-installer,bsiegel/tectonic-installer,justaugustus/tectonic-installer,bsiegel/tectonic-installer,everett-toews/tectonic-installer,kyoto/tectonic-installer,metral/tectonic-installer,hhoover/tectonic-installer,lander2k2/tectonic-installer,zbwright/tectonic-installer,zbwright/tectonic-installer,justaugustus/tectonic-installer,enxebre/tectonic-installer,mrwacky42/tectonic-installer,s-urbaniak/tectonic-installer,coreos/tectonic-installer,hhoover/tectonic-installer,squat/tectonic-installer,bsiegel/tectonic-installer,lander2k2/tectonic-installer,metral/tectonic-installer,AduroIdeja/tectonic-installer,kyoto/tectonic-installer,enxebre/tectonic-installer,aknuds1/tectonic-installer,coreos/tectonic-installer,AduroIdeja/tectonic-installer,cpanato/tectonic-installer,hhoover/tectonic-installer,coreos/tectonic-installer,aknuds1/tectonic-installer,metral/tectonic-installer,AduroIdeja/tectonic-installer,squat/tectonic-installer,aknuds1/tectonic-installer,colemickens/tectonic-installer,yifan-gu/tectonic-installer,colemickens/tectonic-installer,AduroIdeja/tectonic-installer,s-urbaniak/tectonic-installer,everett-toews/tectonic-installer,justaugustus/tectonic-installer,joshix/tectonic-installer,kyoto/tectonic-installer,alexsomesan/tectonic-installer,cpanato/tectonic-installer,zbwright/tectonic-installer,alexsomesan/tectonic-installer,zbwright/tectonic-installer,justaugustus/tectonic-installer,enxebre/tectonic-installer,mrwacky42/tectonic-installer,mrwacky42/tectonic-installer,kyoto/tectonic-installer,bsiegel/tectonic-installer
--- +++ @@ -3,18 +3,6 @@ import { Deselect, Input, WithClusterConfig } from './ui'; import { validate } from '../validate'; import { DESELECTED_FIELDS } from '../cluster-config.js'; -import { WithTooltip } from './tooltip'; - -const generateTooltipText = ({value}) => { - if (validate.CIDR(value)) { - return; - } - const [, bits] = value.split('/'); - // javascript's bit shifting only works on signed 32bit ints so <<31 - // would be negative :( - const addresses = Math.pow(2, 32 - parseInt(bits, 10)); - return `${addresses} IP address${addresses === 1 ? '' : 'es'}`; -}; export const CIDR = ({field, name, disabled, placeholder, autoFocus, validator, selectable, fieldName}) => { fieldName = fieldName || field; @@ -23,11 +11,9 @@ {selectable && <Deselect field={fieldName} />} <label htmlFor={(selectable ? `${DESELECTED_FIELDS}.` : '') + fieldName}>{name}</label> </div> - <div className="col-xs-5 withtooltip"> + <div className="col-xs-5"> <WithClusterConfig field={field} validator={validator || validate.CIDR}> - <WithTooltip generateText={generateTooltipText}> - <Input placeholder={placeholder} id={field} disabled={disabled} autoFocus={autoFocus} /> - </WithTooltip> + <Input placeholder={placeholder} id={field} disabled={disabled} autoFocus={autoFocus} /> </WithClusterConfig> </div> </div>;
952d6579c6d08b29be91a87c73cffcb83826987e
src/js/components/DateHeader.jsx
src/js/components/DateHeader.jsx
import React from 'react'; const DateHeader = () => { const today = new Date(); return ( <div className="section"> <nav className="nav has-shadow"> <div className="container"> <div className="nav-left"> <a>◀</a> </div> <div className="nav-center"> {today.getFullYear()}/{today.getMonth()}/{today.getDate()} </div> <div className="nav-right"> <a>▶</a> </div> </div> </nav> </div> ); }; export default DateHeader;
import React, { PropTypes } from 'react'; const propTypes = { date: PropTypes.string.isRequired, prevDate: PropTypes.func.isRequired, nextDate: PropTypes.func.isRequired, }; export default class DateHeader extends React.Component { constructor(props) { super(props); this._onClickPrevDate = this._onClickPrevDate.bind(this); this._onClickNextDate = this._onClickNextDate.bind(this); } _onClickPrevDate() { this.props.prevDate(); } _onClickNextDate() { this.props.nextDate(); } render() { return ( <div className="section"> <nav className="nav has-shadow"> <div className="container"> <div className="nav-left"> <a onClick={this._onClickPrevDate}>◀</a> </div> <div className="nav-center"> {this.props.date} </div> <div className="nav-right"> <a onClick={this._onClickNextDate}>▶</a> </div> </div> </nav> </div> ); } } DateHeader.propTypes = propTypes;
Implement prev/next Date on click
Implement prev/next Date on click
JSX
mit
tanaka0325/nippo-web,tanaka0325/nippo-web
--- +++ @@ -1,24 +1,46 @@ -import React from 'react'; +import React, { PropTypes } from 'react'; -const DateHeader = () => { - const today = new Date(); - return ( - <div className="section"> - <nav className="nav has-shadow"> - <div className="container"> - <div className="nav-left"> - <a>◀</a> - </div> - <div className="nav-center"> - {today.getFullYear()}/{today.getMonth()}/{today.getDate()} - </div> - <div className="nav-right"> - <a>▶</a> - </div> - </div> - </nav> - </div> - ); +const propTypes = { + date: PropTypes.string.isRequired, + prevDate: PropTypes.func.isRequired, + nextDate: PropTypes.func.isRequired, }; -export default DateHeader; +export default class DateHeader extends React.Component { + constructor(props) { + super(props); + + this._onClickPrevDate = this._onClickPrevDate.bind(this); + this._onClickNextDate = this._onClickNextDate.bind(this); + } + + _onClickPrevDate() { + this.props.prevDate(); + } + + _onClickNextDate() { + this.props.nextDate(); + } + + render() { + return ( + <div className="section"> + <nav className="nav has-shadow"> + <div className="container"> + <div className="nav-left"> + <a onClick={this._onClickPrevDate}>◀</a> + </div> + <div className="nav-center"> + {this.props.date} + </div> + <div className="nav-right"> + <a onClick={this._onClickNextDate}>▶</a> + </div> + </div> + </nav> + </div> + ); + } +} + +DateHeader.propTypes = propTypes;
ea013b011a9ad14f6bea834d2b4da8d6feb0ee76
src/client/views/layouts/home-layout.jsx
src/client/views/layouts/home-layout.jsx
MainLayout = React.createClass({ render() { return <div> <header> <h1>Welcome to the Github Gamified Issue Tracker</h1> <p>Fix some issues and get sweet points</p> </header> <main> Content Goes Here </main> <footer> Made by Meteor Phoenix <a href="http://github.com/meteor-phoenix/global-hackathon">View on Github</a> </footer> </div> } });
HomeLayout = React.createClass({ render() { return <div> <header> <h1>Welcome to the Github Gamified Issue Tracker</h1> <p>Fix some issues and get sweet points</p> </header> <main> Content Goes Here </main> <footer> Made by Meteor Phoenix <a href="http://github.com/meteor-phoenix/global-hackathon">View on Github</a> </footer> </div> } });
Fix name for home layout
Fix name for home layout
JSX
mit
meteor-phoenix/global-hackathon,meteor-phoenix/global-hackathon
--- +++ @@ -1,4 +1,4 @@ -MainLayout = React.createClass({ +HomeLayout = React.createClass({ render() { return <div> <header>
40f8c665c2f1f4cee594f54ad5d75f6d1a15ef33
src/components/app.jsx
src/components/app.jsx
import React from 'react'; import { IndexLink, Link } from 'react-router'; export default function App(props) { const { children, encounter, location } = props; let link = null; if (location.pathname !== '/') { link = <IndexLink to="/">Home</IndexLink>; } else if (encounter.length) { link = <Link to="/encounter">Encounter</Link>; } return ( <div> {link} {React.cloneElement(children)} </div> ); } App.propTypes = { children: React.PropTypes.element.isRequired, location: React.PropTypes.shape({ pathname: React.PropTypes.string.isRequired }).isRequired, encounter: React.PropTypes.arrayOf( React.PropTypes.shape({}) ) };
import React from 'react'; import GlobalHeader from './global-header'; export default function App({children}) { return ( <div> <GlobalHeader /> {React.cloneElement(children)} </div> ); } App.propTypes = { children: React.PropTypes.element.isRequired };
Move nav to new component global-header
Move nav to new component global-header
JSX
mit
jkrayer/summoner,jkrayer/summoner
--- +++ @@ -1,30 +1,15 @@ import React from 'react'; -import { IndexLink, Link } from 'react-router'; +import GlobalHeader from './global-header'; -export default function App(props) { - const { children, encounter, location } = props; - let link = null; - - if (location.pathname !== '/') { - link = <IndexLink to="/">Home</IndexLink>; - } else if (encounter.length) { - link = <Link to="/encounter">Encounter</Link>; - } - +export default function App({children}) { return ( <div> - {link} + <GlobalHeader /> {React.cloneElement(children)} </div> ); } App.propTypes = { - children: React.PropTypes.element.isRequired, - location: React.PropTypes.shape({ - pathname: React.PropTypes.string.isRequired - }).isRequired, - encounter: React.PropTypes.arrayOf( - React.PropTypes.shape({}) - ) + children: React.PropTypes.element.isRequired };
8f05b612f40012c8e3c14bb2c55ac7ae14651167
src/components/AddServiceTile.jsx
src/components/AddServiceTile.jsx
import React, { Component } from 'react' import { withClient } from 'cozy-client' import Icon from 'cozy-ui/react/Icon' import AppLinker, { generateWebLink } from 'cozy-ui/react/AppLinker' import palette from 'cozy-ui/stylus/settings/palette.json' export class AddServiceTile extends Component { render() { const { label, client } = this.props const nativePath = '/discover/?type=konnector' const slug = 'store' const cozyURL = new URL(client.getStackClient().uri) return ( <AppLinker slug={'store'} nativePath={nativePath} href={generateWebLink({ cozyUrl: cozyURL.origin, slug: slug, nativePath: nativePath })} > {({ onClick, href }) => ( <a onClick={onClick} href={href} className="item item--add-service"> <div className="item-icon"> <Icon icon="plus" size={16} color={palette['dodgerBlue']} /> </div> <span className="item-title">{label}</span> </a> )} </AppLinker> ) } } export default withClient(AddServiceTile)
import React from 'react' import { withClient } from 'cozy-client' import Icon from 'cozy-ui/react/Icon' import AppLinker, { generateWebLink } from 'cozy-ui/react/AppLinker' import palette from 'cozy-ui/stylus/settings/palette.json' const AddServiceTile = ({ label, client }) => { const nativePath = '/discover/?type=konnector' const slug = 'store' const cozyURL = new URL(client.getStackClient().uri) return ( <AppLinker slug={'store'} nativePath={nativePath} href={generateWebLink({ cozyUrl: cozyURL.origin, slug: slug, nativePath: nativePath })} > {({ onClick, href }) => ( <a onClick={onClick} href={href} className="item item--add-service"> <div className="item-icon"> <Icon icon="plus" size={16} color={palette['dodgerBlue']} /> </div> <span className="item-title">{label}</span> </a> )} </AppLinker> ) } export default withClient(AddServiceTile)
Transform class into a function
refactor: Transform class into a function
JSX
agpl-3.0
cozy/cozy-home,cozy/cozy-home,cozy/cozy-home
--- +++ @@ -1,38 +1,34 @@ -import React, { Component } from 'react' +import React from 'react' import { withClient } from 'cozy-client' - import Icon from 'cozy-ui/react/Icon' import AppLinker, { generateWebLink } from 'cozy-ui/react/AppLinker' import palette from 'cozy-ui/stylus/settings/palette.json' -export class AddServiceTile extends Component { - render() { - const { label, client } = this.props - const nativePath = '/discover/?type=konnector' - const slug = 'store' - const cozyURL = new URL(client.getStackClient().uri) +const AddServiceTile = ({ label, client }) => { + const nativePath = '/discover/?type=konnector' + const slug = 'store' + const cozyURL = new URL(client.getStackClient().uri) - return ( - <AppLinker - slug={'store'} - nativePath={nativePath} - href={generateWebLink({ - cozyUrl: cozyURL.origin, - slug: slug, - nativePath: nativePath - })} - > - {({ onClick, href }) => ( - <a onClick={onClick} href={href} className="item item--add-service"> - <div className="item-icon"> - <Icon icon="plus" size={16} color={palette['dodgerBlue']} /> - </div> - <span className="item-title">{label}</span> - </a> - )} - </AppLinker> - ) - } + return ( + <AppLinker + slug={'store'} + nativePath={nativePath} + href={generateWebLink({ + cozyUrl: cozyURL.origin, + slug: slug, + nativePath: nativePath + })} + > + {({ onClick, href }) => ( + <a onClick={onClick} href={href} className="item item--add-service"> + <div className="item-icon"> + <Icon icon="plus" size={16} color={palette['dodgerBlue']} /> + </div> + <span className="item-title">{label}</span> + </a> + )} + </AppLinker> + ) } export default withClient(AddServiceTile)
58a9cebffd7d81bc1438458711b9add0816655a9
example/js/app.jsx
example/js/app.jsx
import React from 'react'; import Row from './row.jsx'; let App = React.createClass({ displayName : 'App', render() { var st = this.state; return ( <div {...this.props} className="app"> <Row> <p>Column 1</p> <p>Column 2</p> <p>Column 3</p> </Row> </div> ); } }); export default App;
import React from 'react'; import Row from './row.jsx'; let App = React.createClass({ displayName : 'App', render() { var st = this.state; return ( <div {...this.props} className="app"> <Row rowName="example"> <p>Column 1</p> <p>Column 2</p> <p>Column 3</p> </Row> </div> ); } }); export default App;
Add an example name to remember its old dimensions
Add an example name to remember its old dimensions
JSX
mit
renemonroy/react-row,renemonroy/react-row
--- +++ @@ -9,7 +9,7 @@ var st = this.state; return ( <div {...this.props} className="app"> - <Row> + <Row rowName="example"> <p>Column 1</p> <p>Column 2</p> <p>Column 3</p>
341bf207c10de69a67497d96177133e643c06de1
source/assets/js/app/components/user_media_configurator_modal.es6.jsx
source/assets/js/app/components/user_media_configurator_modal.es6.jsx
const UserMediaConfiguratorModal = (props) => { return <div className="modal hide fade modal-center" id="modal-user-media-configurator" data-backdrop="static"> <div className="modal-header"> <h3>You are about to join a palava conference!</h3> </div> <div className="modal-body"> <p>Please choose which media streams you want to send to other participants</p> <ul className="user-media-buttons"> <li><button onClick={() => props.initConferenceFn({video: true, audio:true})} id="user-media-video-audio" className="btn btn-primary">Video &amp; Audio</button></li> <li><button onClick={() => props.initConferenceFn({video: true, audio:false})} id="user-media-video" className="btn btn-info">Only Video</button></li> <li><button onClick={() => props.initConferenceFn({video: false, audio:true})} id="user-media-audio" className="btn btn-info">Only Audio</button></li> </ul> <p><Link to="/info/how">click here to learn about palava</Link></p> </div> </div> }
const UserMediaConfiguratorModal = (props) => { return <div className="modal hide fade modal-center" id="modal-user-media-configurator" data-backdrop="static"> <div className="modal-header"> <h3>You are about to join a palava conference!</h3> </div> <div className="modal-body"> <p><strong>Please note:</strong> This will join or create a video chat room with others. For technical reasons, your IP address and other personal data is sent to all other participants via our server. See our <a href="/info/privacy">privacy policy</a> for more details. </p> <p>Choose which media streams you want to send to other participants<br/>and consent to our privacy policy:</p> <ul className="user-media-buttons"> <li><button onClick={() => props.initConferenceFn({video: true, audio:true})} id="user-media-video-audio" className="btn btn-primary">Video &amp; Audio</button></li> <li><button onClick={() => props.initConferenceFn({video: true, audio:false})} id="user-media-video" className="btn btn-info">Only Video</button></li> <li><button onClick={() => props.initConferenceFn({video: false, audio:true})} id="user-media-audio" className="btn btn-info">Only Audio</button></li> </ul> <p><Link to="/info/how">click here to learn about palava</Link></p> </div> </div> }
Add privacy policy to prompt
Add privacy policy to prompt
JSX
mit
palavatv/palava-portal,palavatv/palava-portal,palavatv/palava-portal
--- +++ @@ -4,7 +4,8 @@ <h3>You are about to join a palava conference!</h3> </div> <div className="modal-body"> - <p>Please choose which media streams you want to send to other participants</p> + <p><strong>Please note:</strong> This will join or create a video chat room with others. For technical reasons, your IP address and other personal data is sent to all other participants via our server. See our <a href="/info/privacy">privacy policy</a> for more details. </p> + <p>Choose which media streams you want to send to other participants<br/>and consent to our privacy policy:</p> <ul className="user-media-buttons"> <li><button onClick={() => props.initConferenceFn({video: true, audio:true})} id="user-media-video-audio" className="btn btn-primary">Video &amp; Audio</button></li> <li><button onClick={() => props.initConferenceFn({video: true, audio:false})} id="user-media-video" className="btn btn-info">Only Video</button></li>
5eb0e36faf7f0682ca3aa35f9bf952a61f217383
src/components/fields/DocLabel.jsx
src/components/fields/DocLabel.jsx
import React from 'react' import input from '../../config/input.js' import colors from '../../config/colors.js' import { margins, fontSizes } from '../../config/scales.js' export default class DocLabel extends React.Component { static propTypes = { label: React.PropTypes.string.isRequired, doc: React.PropTypes.string.isRequired, style: React.PropTypes.object, } constructor(props) { super(props) this.state = { showDoc: false } } render() { return <label style={{ ...input.label, ...this.props.style, position: 'relative', }} > <span onMouseOver={e => this.setState({showDoc: true})} onMouseOut={e => this.setState({showDoc: false})} style={{ cursor: 'help', }} > {this.props.label} </span> <div style={{ backgroundColor: colors.gray, padding: margins[1], position: 'absolute', top: 20, left: 0, width: 100, display: this.state.showDoc ? null : 'none', zIndex: 3, }}> {this.props.doc} </div> </label> } }
import React from 'react' import input from '../../config/input.js' import colors from '../../config/colors.js' import { margins, fontSizes } from '../../config/scales.js' export default class DocLabel extends React.Component { static propTypes = { label: React.PropTypes.string.isRequired, doc: React.PropTypes.string.isRequired, style: React.PropTypes.object, } constructor(props) { super(props) this.state = { showDoc: false } } render() { return <label style={{ ...input.label, ...this.props.style, position: 'relative', }} > <span onMouseOver={e => this.setState({showDoc: true})} onMouseOut={e => this.setState({showDoc: false})} style={{ cursor: 'help', }} > {this.props.label} </span> <div style={{ backgroundColor: colors.gray, padding: margins[1], fontSize: 10, position: 'absolute', top: 20, left: 0, width: 120, display: this.state.showDoc ? null : 'none', zIndex: 3, }}> {this.props.doc} </div> </label> } }
Decrease doc label font size
Decrease doc label font size
JSX
mit
maputnik/editor,maputnik/editor
--- +++ @@ -35,10 +35,11 @@ <div style={{ backgroundColor: colors.gray, padding: margins[1], + fontSize: 10, position: 'absolute', top: 20, left: 0, - width: 100, + width: 120, display: this.state.showDoc ? null : 'none', zIndex: 3, }}>
1a6bd94b1330706d96d5470b7833640d2bb56fbd
src/components/InputBar/InputBar.jsx
src/components/InputBar/InputBar.jsx
import React from 'react'; import Button from '../Button/Button.jsx'; import './InputBar.css'; const InputBar = () => ( <div className="InputBar"> <textarea placeholder="text here, dummy" /> <Button variant="send" onClick={() => {}}>Send</Button> </div> ); export default InputBar;
import React, { Component } from 'react'; import Button from '../Button/Button.jsx'; import './InputBar.css'; class InputBar extends Component { state = { chatText: '', } sendChat = () => { console.log('aldkfjalkd'); } handleChange = (e) => { this.setState({ [e.target.name]: e.target.value, }); } render () { return ( <div className="InputBar"> <textarea onChange={this.handleChange} name="chatText" placeholder="text here, dummy" /> <Button variant="send" onClick={() => {}}>Send</Button> </div> ); } } /* const InputBar = () => ( * <div className="InputBar"> * <textarea placeholder="text here, dummy" /> * <Button variant="send" onClick={() => {}}>Send</Button> * </div> * ); * */ export default InputBar;
Make chat text box into class based components for testing sockets
Make chat text box into class based components for testing sockets - no point in hooking up the text chat thing to redux yet until we actually have sockets working.
JSX
bsd-3-clause
minimalchat/operator-app,minimalchat/operator-app
--- +++ @@ -1,13 +1,39 @@ -import React from 'react'; +import React, { Component } from 'react'; import Button from '../Button/Button.jsx'; import './InputBar.css'; -const InputBar = () => ( - <div className="InputBar"> - <textarea placeholder="text here, dummy" /> - <Button variant="send" onClick={() => {}}>Send</Button> - </div> -); +class InputBar extends Component { + state = { + chatText: '', + } + + sendChat = () => { + console.log('aldkfjalkd'); + } + + handleChange = (e) => { + this.setState({ + [e.target.name]: e.target.value, + }); + } + + render () { + return ( + <div className="InputBar"> + <textarea onChange={this.handleChange} name="chatText" placeholder="text here, dummy" /> + <Button variant="send" onClick={() => {}}>Send</Button> + </div> + ); + } +} + +/* const InputBar = () => ( + * <div className="InputBar"> + * <textarea placeholder="text here, dummy" /> + * <Button variant="send" onClick={() => {}}>Send</Button> + * </div> + * ); + * */ export default InputBar;
332e11c87c1c29ecf135f3ec1103150a64979b36
web/static/js/components/stage_change_info_prime_directive.jsx
web/static/js/components/stage_change_info_prime_directive.jsx
import React from "react" export default () => ( <p> The Prime Directive is used to frame the retrospective, such that the time spent is as constructive as possible. Read it for yourself, and try to keep it in mind as the retro moves forward </p> )
import React from "react" export default () => ( <p> The Prime Directive is used to frame the retrospective, such that the time spent is as constructive as possible. Read it to yourself! Internalize it! </p> )
Update prime directive stage info copy
Update prime directive stage info copy
JSX
mit
stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro
--- +++ @@ -3,7 +3,6 @@ export default () => ( <p> The Prime Directive is used to frame the retrospective, such that the time - spent is as constructive as possible. Read it for yourself, and try to keep - it in mind as the retro moves forward + spent is as constructive as possible. Read it to yourself! Internalize it! </p> )
81f8cda7bf41fcfe8610873a00bfe72dcc242f55
src/Onboard.jsx
src/Onboard.jsx
// ./components/my-form-component.js' import React from 'react'; import { Control, Form, getFormValues, formValueSelector } from 'redux-form'; import Nav from './Nav.jsx'; import WizardForm from './WizardForm.jsx'; import { OverlayTrigger, Popover, FormGroup, FormControl, ControlLabel, Radio, ButtonGroup, ButtonToolbar, Button, Modal } from 'react-bootstrap'; import { connect } from 'react-redux'; import { saveCase } from './actions/api' const popoverRight = ( <Popover id="popover-positioned-right" title="Description"> Include some <strong>information about your conundrum</strong>. </Popover> ); function postForm(data_insert) { saveCase(data_insert); // console.log(JSON.stringify(data_insert)); } class OnboardData extends React.Component { render() { return ( <div className="wrapper main-container"> <Nav /> <main className="onboardform"> <WizardForm onSubmit={postForm} values={this.props.values} / > </main> </div> ); } } function mapStateToProps(state) { return { } } function mapDispatchToProps(dispatch) { return { saveCase: (data) => { console.log('SAVECASE', data); // dispatch(saveCase(data)) }, } } export default connect(mapStateToProps, mapDispatchToProps, state => ({ values: getFormValues('wizard')(state), }) )(OnboardData);
// ./components/my-form-component.js' import React from 'react'; import { Control, Form, getFormValues, formValueSelector } from 'redux-form'; import Nav from './Nav.jsx'; import WizardForm from './WizardForm.jsx'; import { OverlayTrigger, Popover, FormGroup, FormControl, ControlLabel, Radio, ButtonGroup, ButtonToolbar, Button, Modal } from 'react-bootstrap'; import { connect } from 'react-redux'; import { saveCase } from './actions/api' const popoverRight = ( <Popover id="popover-positioned-right" title="Description"> Include some <strong>information about your conundrum</strong>. </Popover> ); class OnboardData extends React.Component { render() { return ( <div className="wrapper main-container"> <Nav /> <main className="onboardform"> <WizardForm onSubmit={this.props.saveCase} values={this.props.values} / > </main> </div> ); } } function mapStateToProps(state) { return { values: getFormValues('wizard')(state), } } function mapDispatchToProps(dispatch) { return { saveCase: (data) => { dispatch(saveCase(data)) }, } } export default connect(mapStateToProps, mapDispatchToProps)(OnboardData);
Send Data from form to backend
Send Data from form to backend
JSX
mit
potatowave/escolha,potatowave/escolha
--- +++ @@ -14,11 +14,6 @@ </Popover> ); -function postForm(data_insert) { - saveCase(data_insert); - // console.log(JSON.stringify(data_insert)); -} - class OnboardData extends React.Component { render() { @@ -30,7 +25,7 @@ <Nav /> <main className="onboardform"> - <WizardForm onSubmit={postForm} values={this.props.values} / > + <WizardForm onSubmit={this.props.saveCase} values={this.props.values} / > </main> </div> @@ -40,22 +35,16 @@ function mapStateToProps(state) { return { - + values: getFormValues('wizard')(state), } } function mapDispatchToProps(dispatch) { return { saveCase: (data) => { - console.log('SAVECASE', data); - - // dispatch(saveCase(data)) + dispatch(saveCase(data)) }, } } -export default connect(mapStateToProps, mapDispatchToProps, - state => ({ - values: getFormValues('wizard')(state), - }) -)(OnboardData); +export default connect(mapStateToProps, mapDispatchToProps)(OnboardData);
87e0708d2437f15cea42f17862ce902f737f7a7c
js/copy-url-button.jsx
js/copy-url-button.jsx
/** * External dependencies */ var React = require( 'react' ), ReactZeroClipboard = require( 'react-zeroclipboard' ); module.exports = React.createClass( { getResultsURL: function() { return 'http://www.abtestcalculator.com' + '?ap=' + this.props.variations.a.participants + '&ac=' + this.props.variations.a.conversions + '&bp=' + this.props.variations.b.participants + '&bc=' + this.props.variations.b.conversions; }, urlCopied: function() { alert( 'The URL for these A/B test results was successfully copied to your clipboard.' ); }, render: function() { if ( ! this.props.isValid ) { return null; } return ( <div className="copy-url"> <ReactZeroClipboard text={ this.getResultsURL() } onAfterCopy={ this.urlCopied }> Copy Results URL </ReactZeroClipboard> </div> ); }, } );
/** * External dependencies */ var React = require( 'react' ), ReactZeroClipboard = require( 'react-zeroclipboard' ); /** * Internal dependencies */ var analytics = require( './analytics' ); module.exports = React.createClass( { getResultsURL: function() { return 'http://www.abtestcalculator.com' + '?ap=' + this.props.variations.a.participants + '&ac=' + this.props.variations.a.conversions + '&bp=' + this.props.variations.b.participants + '&bc=' + this.props.variations.b.conversions; }, urlCopied: function() { analytics.recordEvent( 'copy results url' ); alert( 'The URL for these A/B test results was successfully copied to your clipboard.' ); }, render: function() { if ( ! this.props.isValid ) { return null; } return ( <div className="copy-url"> <ReactZeroClipboard text={ this.getResultsURL() } onAfterCopy={ this.urlCopied }> Copy Results URL </ReactZeroClipboard> </div> ); }, } );
Add analytics event for copying results url
Add analytics event for copying results url
JSX
mit
mattm/abtestcalculator,mattm/abtestcalculator
--- +++ @@ -3,6 +3,11 @@ */ var React = require( 'react' ), ReactZeroClipboard = require( 'react-zeroclipboard' ); + +/** + * Internal dependencies + */ +var analytics = require( './analytics' ); module.exports = React.createClass( { getResultsURL: function() { @@ -14,6 +19,7 @@ }, urlCopied: function() { + analytics.recordEvent( 'copy results url' ); alert( 'The URL for these A/B test results was successfully copied to your clipboard.' ); },
4862d529cc3966278b849ec8a654ec8d0af55aa6
src/js/popup/components/Panel.jsx
src/js/popup/components/Panel.jsx
import {connect} from 'react-redux' import {createElement, PropTypes} from 'react' import CSSModules from 'react-css-modules' import BookmarkTree from './BookmarkTree' import Search from './Search' import styles from '../../../css/popup/panel.css' const Panel = (props) => { const {trees} = props const mainPanelItems = [] const subPanelItems = [] for (const [treeIndex] of trees.entries()) { const targetPanelItems = treeIndex % 2 === 0 ? mainPanelItems : subPanelItems targetPanelItems.push( <BookmarkTree key={String(treeIndex)} treeIndex={treeIndex} /> ) } mainPanelItems.unshift( <Search key='search' /> ) return ( <main styleName='main'> <section styleName='master' className='panel-width'> {mainPanelItems} </section> <section styleName='slave' className='panel-width' hidden={!subPanelItems.length}> {subPanelItems} </section> </main> ) } Panel.propTypes = { trees: PropTypes.arrayOf(PropTypes.object).isRequired } const mapStateToProps = (state) => ({ trees: state.trees }) export default connect(mapStateToProps)( CSSModules(Panel, styles) )
import {connect} from 'react-redux' import {createElement, PropTypes} from 'react' import CSSModules from 'react-css-modules' import BookmarkTree from './BookmarkTree' import Search from './Search' import styles from '../../../css/popup/panel.css' const Panel = (props) => { const {trees} = props const mainPanelItems = [] const subPanelItems = [] for (const [treeIndex, treeInfo] of trees.entries()) { const targetPanelItems = treeIndex % 2 === 0 ? mainPanelItems : subPanelItems targetPanelItems.push( <BookmarkTree key={treeInfo.id} treeIndex={treeIndex} /> ) } mainPanelItems.unshift( <Search key='search' /> ) return ( <main styleName='main'> <section styleName='master' className='panel-width'> {mainPanelItems} </section> <section styleName='slave' className='panel-width' hidden={!subPanelItems.length}> {subPanelItems} </section> </main> ) } Panel.propTypes = { trees: PropTypes.arrayOf(PropTypes.object).isRequired } const mapStateToProps = (state) => ({ trees: state.trees }) export default connect(mapStateToProps)( CSSModules(Panel, styles) )
Use treeInfo.id as key instead of treeIndex
Use treeInfo.id as key instead of treeIndex
JSX
mit
foray1010/Popup-my-Bookmarks,foray1010/Popup-my-Bookmarks
--- +++ @@ -13,12 +13,12 @@ const mainPanelItems = [] const subPanelItems = [] - for (const [treeIndex] of trees.entries()) { + for (const [treeIndex, treeInfo] of trees.entries()) { const targetPanelItems = treeIndex % 2 === 0 ? mainPanelItems : subPanelItems targetPanelItems.push( <BookmarkTree - key={String(treeIndex)} + key={treeInfo.id} treeIndex={treeIndex} /> )
cba6c33927ad1520a8a1db541398d5f13cd6b1d7
components/charts/Area.jsx
components/charts/Area.jsx
const React = require("react"); const c3 = require('c3'); module.exports = React.createClass({ displayName: 'AreaChart', onClick() { }, componentDidMount() { this.chart = c3.generate({ bindto: this.getDOMNode(), data: { x: 'x', json: {} } }); this.renderChart(); }, componentDidUpdate() { this.renderChart(); }, renderChart() { const firstDimension = this.props.data[this.props.item.dimensions[0]]; const groups = Object.keys(firstDimension); const chartData = groups.reduce((series, g) => { series[g] = firstDimension[g].personer; return series; }, {}) chartData.x = this.props.time; console.log(this.props.data); console.log(chartData) this.chart.load({ json: chartData, axis: { x: { type: 'timeseries', tick: { format: '%Y-%m-%d' } } }, types: groups.reduce((types, g) => { types[g] = 'area' // 'line', 'spline', 'step', 'area', 'area-step' are also available to stack return types; }, {}), groups: [groups] }); }, render() { return <div/> } });
const React = require("react"); const c3 = require('c3'); module.exports = React.createClass({ displayName: 'AreaChart', onClick() { }, componentDidMount() { this.chart = c3.generate({ bindto: this.getDOMNode(), data: { x: 'x', json: [] }, axis: { x: { type: 'timeseries', tick: { format: '%Y' } } } }); this.renderChart(); }, componentDidUpdate() { this.renderChart(); }, renderChart() { const firstDimension = this.props.data[this.props.item.dimensions[0]]; const groups = Object.keys(firstDimension); let chartData = groups.reduce((series, g) => { series[g] = firstDimension[g].personer; return series; }, {}) chartData.x = this.props.time; console.info(groups); console.info(chartData); this.chart.load({ json: chartData, types: groups.reduce((types, g) => { types[g] = 'area' // 'line', 'spline', 'step', 'area', 'area-step' are also available to stack return types; }, {}), groups: [groups] }); }, render() { return <div/> } });
Add timeseries on x axis
Add timeseries on x axis
JSX
mit
bengler/imdikator,bengler/imdikator
--- +++ @@ -11,8 +11,16 @@ bindto: this.getDOMNode(), data: { x: 'x', - json: {} - } + json: [] + }, + axis: { + x: { + type: 'timeseries', + tick: { + format: '%Y' + } + } + } }); this.renderChart(); }, @@ -20,30 +28,21 @@ this.renderChart(); }, renderChart() { - const firstDimension = this.props.data[this.props.item.dimensions[0]]; const groups = Object.keys(firstDimension); - const chartData = groups.reduce((series, g) => { + let chartData = groups.reduce((series, g) => { series[g] = firstDimension[g].personer; return series; }, {}) - + chartData.x = this.props.time; - console.log(this.props.data); - console.log(chartData) + console.info(groups); + console.info(chartData); this.chart.load({ json: chartData, - axis: { - x: { - type: 'timeseries', - tick: { - format: '%Y-%m-%d' - } - } - }, types: groups.reduce((types, g) => { types[g] = 'area' // 'line', 'spline', 'step', 'area', 'area-step' are also available to stack
bf373cba03e982e39caabe0cb0e287742a53688a
packages/lesswrong/components/sequences/SequencesNavigationLink.jsx
packages/lesswrong/components/sequences/SequencesNavigationLink.jsx
import { Components, registerComponent, withDocument} from 'meteor/vulcan:core'; import { Posts } from '../../lib/collections/posts'; import IconButton from 'material-ui/IconButton' import React from 'react'; import { withRouter } from 'react-router'; const SequencesNavigationLink = ({ slug, document, documentId, documentUrl, loading, direction, router} ) => { const post = (slug || documentId) && document const className = "sequences-navigation-top-" + direction const iconStyle = !slug && !documentId ? {color: "rgba(0,0,0,.2)"} : {} return ( <IconButton iconStyle={ iconStyle } className={ className } disabled={ !slug && !documentId } iconClassName="material-icons" tooltip={post && post.title} onClick={() => router.push(documentUrl)}> { direction === "left" ? "navigate_before" : "navigate_next" } </IconButton> ) }; const options = { collection: Posts, queryName: "SequencesPostNavigationLinkQuery", fragmentName: 'SequencesPostNavigationLink', enableTotal: false, } registerComponent('SequencesNavigationLink', SequencesNavigationLink, [withDocument, options], withRouter);
import { Components, registerComponent, withDocument} from 'meteor/vulcan:core'; import { Posts } from '../../lib/collections/posts'; import IconButton from 'material-ui/IconButton' import React from 'react'; import { withRouter } from 'react-router'; import { withStyles } from '@material-ui/core/styles'; const styles = theme => ({ normal: { "& .material-icons": { color: "rgba(0,0,0, 0.5) !important" } }, disabled: { "& .material-icons": { color: "rgba(0,0,0, 0.2) !important" } }, }); const SequencesNavigationLink = ({ slug, document, documentId, documentUrl, loading, direction, router, classes} ) => { const post = (slug || documentId) && document const disabled = (!slug && !documentId); return ( <IconButton className={disabled ? classes.disabled : classes.normal} disabled={disabled} iconClassName="material-icons" tooltip={post && post.title} onClick={() => router.push(documentUrl)}> { direction === "left" ? "navigate_before" : "navigate_next" } </IconButton> ) }; const options = { collection: Posts, queryName: "SequencesPostNavigationLinkQuery", fragmentName: 'SequencesPostNavigationLink', enableTotal: false, } registerComponent('SequencesNavigationLink', SequencesNavigationLink, [withDocument, options], withRouter, withStyles(styles, {name: "SequencesNavigationLink"}));
Fix sequences navigation button coloring
Fix sequences navigation button coloring There was a regression introduced by deleting seemingly-unused SCSS, because `SequencesNavigationLink` was dynamically constructing the class names `sequences-navigation-top-left` and `sequences-navigation-top-right`. Additionally, the SCSS that was incorrectly removed contained a bug, where the style that was supposed to apply to a disabled button (graying it out) wasn't applied. Fix all that and move it to JSS.
JSX
mit
Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2
--- +++ @@ -3,6 +3,20 @@ import IconButton from 'material-ui/IconButton' import React from 'react'; import { withRouter } from 'react-router'; +import { withStyles } from '@material-ui/core/styles'; + +const styles = theme => ({ + normal: { + "& .material-icons": { + color: "rgba(0,0,0, 0.5) !important" + } + }, + disabled: { + "& .material-icons": { + color: "rgba(0,0,0, 0.2) !important" + } + }, +}); const SequencesNavigationLink = ({ slug, @@ -11,16 +25,15 @@ documentUrl, loading, direction, - router} + router, + classes} ) => { const post = (slug || documentId) && document - const className = "sequences-navigation-top-" + direction - const iconStyle = !slug && !documentId ? {color: "rgba(0,0,0,.2)"} : {} + const disabled = (!slug && !documentId); return ( <IconButton - iconStyle={ iconStyle } - className={ className } - disabled={ !slug && !documentId } + className={disabled ? classes.disabled : classes.normal} + disabled={disabled} iconClassName="material-icons" tooltip={post && post.title} onClick={() => router.push(documentUrl)}> @@ -36,4 +49,5 @@ enableTotal: false, } -registerComponent('SequencesNavigationLink', SequencesNavigationLink, [withDocument, options], withRouter); +registerComponent('SequencesNavigationLink', SequencesNavigationLink, + [withDocument, options], withRouter, withStyles(styles, {name: "SequencesNavigationLink"}));
ff599d53643198fe8896d65f46c0ca81e54a554d
src/js/components/PayoutSelectContainer.jsx
src/js/components/PayoutSelectContainer.jsx
import React from 'react'; import InputBlock from './InputBlock'; import text from '../helpers/text'; const PayoutSelectContainer = (props) => { const props2 = Object.keys(props) .filter((key) => key !== 'state' && key !== 'options') .reduce((props2, key) => (props2[key] = props[key], props2), {}); return (<InputBlock heading={text('Payout Amount')}> <div className='payout-input'> <div className='float-left'> ¥ <input {...props2} id='payout'/> <label className='payout-mult' htmlFor='payout'>,000</label> </div> <div className='float-left hint'>{text('min: 1,000')}<br />{text('max: 100,000')}</div> </div> </InputBlock>); } PayoutSelectContainer.displayName = 'PayoutSelectContainer'; export default PayoutSelectContainer;
import React from 'react'; import InputBlock from './InputBlock'; import text from '../helpers/text'; const PayoutSelectContainer = (props) => { const props2 = Object.keys(props) .filter((key) => key !== 'state' && key !== 'options') .reduce((props2, key) => (props2[key] = props[key], props2), {}); return (<InputBlock heading={text('Payout Amount')}> <div className='payout-input'> <div className='float-left'> {text('¥')} <input {...props2} id='payout'/> <label className='payout-mult' htmlFor='payout'>{text(',000')}</label> </div> <div className='float-left hint'>{text('min: 1,000')}<br />{text('max: 100,000')}</div> </div> </InputBlock>); } PayoutSelectContainer.displayName = 'PayoutSelectContainer'; export default PayoutSelectContainer;
Add new strings for translation
Add new strings for translation
JSX
apache-2.0
binary-com/japanui,binary-com/japanui,binary-com/japanui
--- +++ @@ -12,8 +12,8 @@ heading={text('Payout Amount')}> <div className='payout-input'> <div className='float-left'> - ¥ <input {...props2} id='payout'/> - <label className='payout-mult' htmlFor='payout'>,000</label> + {text('¥')} <input {...props2} id='payout'/> + <label className='payout-mult' htmlFor='payout'>{text(',000')}</label> </div> <div className='float-left hint'>{text('min: 1,000')}<br />{text('max: 100,000')}</div> </div>
b6a66f9a6cbd51e64fd3af4e36e6fb9e689e362e
src/app/login/Login.jsx
src/app/login/Login.jsx
import React, { Component } from 'react'; import { connect } from 'react-redux' import Layout from '../global/Layout'; class Login extends Component { constructor(props) { super(props); } render() { return ( <Layout > <div>This is login</div> </Layout> ) } } export default connect()(Layout);
import React, { Component } from 'react'; import { connect } from 'react-redux' import { post } from '../utilities/post' class Login extends Component { constructor(props) { super(props); this.state = { email: "", password: "" }; this.handleSubmit = this.handleSubmit.bind(this); this.handleEmailChange = this.handleEmailChange.bind(this); this.handlePasswordChange = this.handlePasswordChange.bind(this); } handleSubmit(event) { event.preventDefault(); const postBody = { email: this.state.email, password: this.state.password }; function setAccessTokenCookie(accessToken) { document.cookie = "access_token=" + accessToken+ ";path=/"; console.log(`Cookie: access_token: ${accessToken} set`); // TODO update state authentication property } return post('/zebedee/login', postBody) .then(function(accessToken) { setAccessTokenCookie(accessToken); }).catch(function(error) { return error; }); } handleEmailChange(event) { this.setState({email: event.target.value}); } handlePasswordChange(event) { this.setState({password: event.target.value}); } render() { return ( <div className="col--4 login-wrapper"> <h1>Login</h1> <form onSubmit={this.handleSubmit}> <label htmlFor="email">Email:</label> <input id="email" type="email" className="fl-user-and-access__email" name="email" cols="40" rows="1" onChange={this.handleEmailChange}/> <label htmlFor="password">Password:</label> <input id="password" type="password" className="fl-user-and-access__password" name="password" cols="40" rows="1" onChange={this.handlePasswordChange}/> <button type="submit" id="login" className="btn btn--primary margin-left--0 btn-florence-login fl-panel--user-and-access__login ">Log in</button> </form> </div> ) } } export default connect()(Login);
Add login form and set cookie functionality
Add login form and set cookie functionality Former-commit-id: fef22bf27286c177022e74155b6dcb5b4ad5091f Former-commit-id: db0c2838cf6268459a99f3313db3f7f4b37d40bb Former-commit-id: 239ee8594ae5280a24b54f7a066207ed023dae5b
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -1,20 +1,73 @@ import React, { Component } from 'react'; import { connect } from 'react-redux' -import Layout from '../global/Layout'; +import { post } from '../utilities/post' class Login extends Component { constructor(props) { super(props); + + this.state = { + email: "", + password: "" + }; + + this.handleSubmit = this.handleSubmit.bind(this); + this.handleEmailChange = this.handleEmailChange.bind(this); + this.handlePasswordChange = this.handlePasswordChange.bind(this); + + } + + handleSubmit(event) { + event.preventDefault(); + + const postBody = { + email: this.state.email, + password: this.state.password + }; + + function setAccessTokenCookie(accessToken) { + document.cookie = "access_token=" + accessToken+ ";path=/"; + console.log(`Cookie: access_token: ${accessToken} set`); + // TODO update state authentication property + } + + return post('/zebedee/login', postBody) + .then(function(accessToken) { + setAccessTokenCookie(accessToken); + }).catch(function(error) { + return error; + }); + + + } + + + handleEmailChange(event) { + this.setState({email: event.target.value}); + } + + handlePasswordChange(event) { + this.setState({password: event.target.value}); } render() { return ( - <Layout > - <div>This is login</div> - </Layout> + <div className="col--4 login-wrapper"> + <h1>Login</h1> + + <form onSubmit={this.handleSubmit}> + <label htmlFor="email">Email:</label> + <input id="email" type="email" className="fl-user-and-access__email" name="email" cols="40" rows="1" onChange={this.handleEmailChange}/> + + <label htmlFor="password">Password:</label> + <input id="password" type="password" className="fl-user-and-access__password" name="password" cols="40" rows="1" onChange={this.handlePasswordChange}/> + + <button type="submit" id="login" className="btn btn--primary margin-left--0 btn-florence-login fl-panel--user-and-access__login ">Log in</button> + </form> + </div> ) } } -export default connect()(Layout); +export default connect()(Login);
d1b5665f0df4038965246c06edd93c1a29ab8931
src/sui-card/index.jsx
src/sui-card/index.jsx
import React from 'react'; import cx from 'classnames'; class SuiCard extends React.Component { static get propTypes(){ return { landscapeLayout: React.PropTypes.bool, contentFirst: React.PropTypes.bool, primary: React.PropTypes.any.isRequired, secondary: React.PropTypes.any, className: React.PropTypes.string }; } constructor(props){ super(props); this.state = { landscapeLayout: this.props.landscapeLayout }; } render() { const classNames = cx({ 'sui-Card': !this.props.className, [`${this.props.className}`]: this.props.className, 'sui-Card--landscape': this.state.landscapeLayout, 'sui-Card--contentfirst': this.props.landscapeLayout && this.props.contentFirst }); return ( <div className={classNames}> <div className='sui-Card-primary'> {this.props.primary} </div> { this.props.secondary && <div className='sui-Card-secondary'> {this.props.secondary} </div> } </div> ); } } export default SuiCard;
import React, { PropTypes } from 'react'; import cx from 'classnames'; export default function SuiCard (props) { const classNames = cx({ 'sui-Card': !props.className, [`${props.className}`]: props.className, 'sui-Card--landscape': props.landscapeLayout, 'sui-Card--contentfirst': props.landscapeLayout && props.contentFirst }); return ( <div className={classNames}> <div className='sui-Card-primary'> {props.primary} </div> { props.secondary && <div className='sui-Card-secondary'> {props.secondary} </div> } </div> ); } SuiCard.propTypes = { landscapeLayout: PropTypes.bool, contentFirst: PropTypes.bool, primary: PropTypes.any.isRequired, secondary: PropTypes.any, className: PropTypes.string };
Move to a stateless component
Move to a stateless component
JSX
mit
SUI-Components/sui-card
--- +++ @@ -1,46 +1,33 @@ -import React from 'react'; +import React, { PropTypes } from 'react'; import cx from 'classnames'; -class SuiCard extends React.Component { - static get propTypes(){ - return { - landscapeLayout: React.PropTypes.bool, - contentFirst: React.PropTypes.bool, - primary: React.PropTypes.any.isRequired, - secondary: React.PropTypes.any, - className: React.PropTypes.string - }; - } +export default function SuiCard (props) { + const classNames = cx({ + 'sui-Card': !props.className, + [`${props.className}`]: props.className, + 'sui-Card--landscape': props.landscapeLayout, + 'sui-Card--contentfirst': props.landscapeLayout && props.contentFirst + }); - constructor(props){ - super(props); - this.state = { - landscapeLayout: this.props.landscapeLayout - }; - } - - render() { - const classNames = cx({ - 'sui-Card': !this.props.className, - [`${this.props.className}`]: this.props.className, - 'sui-Card--landscape': this.state.landscapeLayout, - 'sui-Card--contentfirst': this.props.landscapeLayout && this.props.contentFirst - }); - - return ( - <div className={classNames}> - <div className='sui-Card-primary'> - {this.props.primary} + return ( + <div className={classNames}> + <div className='sui-Card-primary'> + {props.primary} + </div> + { + props.secondary && + <div className='sui-Card-secondary'> + {props.secondary} </div> - { - this.props.secondary && - <div className='sui-Card-secondary'> - {this.props.secondary} - </div> - } - </div> - ); - } + } + </div> + ); } -export default SuiCard; +SuiCard.propTypes = { + landscapeLayout: PropTypes.bool, + contentFirst: PropTypes.bool, + primary: PropTypes.any.isRequired, + secondary: PropTypes.any, + className: PropTypes.string +};
c6b018b07121f83e5598f556bd1ba97a59285004
app/js/home/Page.jsx
app/js/home/Page.jsx
import React from 'react'; import asyncComponent from 'common/components/AsyncComponent'; import Hero from 'home/components/Hero'; import 'scss/home.scss'; // Load the events list async from the Events Chunck const HomeEvents = asyncComponent(() => import(/* webpackChunkName: "Events" */ 'events/containers/HomeEvents')); const PageHome = () => ( <div> <Hero /> <div className="flex-container"> <div className="flex-2 flex-content"> <h4 className="front-heading">Mentoring <small>10am - 6pm, Mon - Fri</small></h4> <p> The SSE has a mentor on duty every day that can help with SE, CS and other technical classes. There are also physics tutors who hold open mentoring hours in our lab. </p> <h4 className="front-heading">Getting involved</h4> <p> Want to get involved in the SSE? Feel free to stop by our mentoring lab at RIT. You can find us in building 70 (Golisano), room 1670. Students of any major are welcome! </p> </div> <div className="flex-1 flex-border"> <h4 className="front-heading">Upcoming Events</h4> <HomeEvents /> </div> </div> </div> ); export default PageHome;
import React from 'react'; import asyncComponent from 'common/components/AsyncComponent'; import Hero from 'home/components/Hero'; import 'scss/home.scss'; // Load the events list async from the Events Chunck const HomeEvents = asyncComponent(() => import(/* webpackChunkName: "Events" */ 'events/containers/HomeEvents')); const PageHome = () => ( <div> <Hero /> <div className="flex-container"> <div className="flex-2 flex-content"> <h4 className="front-heading">Mentoring <small>10am - 6pm, Mon - Fri</small></h4> <p> The SSE has a mentor on duty every day that can help with SE, CS and other technical classes. There are also physics tutors who hold open mentoring hours in our lab. You can checkout <a>sse.rit.edu/go/mentors</a> for a schedule of the times of each mentor. </p> <h4 className="front-heading">Getting involved</h4> <p> Want to get involved in the SSE? Feel free to stop by our mentoring lab at RIT. You can find us in building 70 (Golisano), room 1670. Students of any major are welcome! </p> </div> <div className="flex-1 flex-border"> <h4 className="front-heading">Upcoming Events</h4> <HomeEvents /> </div> </div> </div> ); export default PageHome;
Add link to the mentor schedule on the homepage
Add link to the mentor schedule on the homepage
JSX
mit
rit-sse/OneRepoToRuleThemAll
--- +++ @@ -15,7 +15,7 @@ <h4 className="front-heading">Mentoring <small>10am - 6pm, Mon - Fri</small></h4> <p> The SSE has a mentor on duty every day that can help with SE, CS and other technical classes. - There are also physics tutors who hold open mentoring hours in our lab. + There are also physics tutors who hold open mentoring hours in our lab. You can checkout <a>sse.rit.edu/go/mentors</a> for a schedule of the times of each mentor. </p> <h4 className="front-heading">Getting involved</h4> <p>
4349f21a5555baac8b8496a3bc34f33b2cd1fcd0
js/search.jsx
js/search.jsx
const React = require('react') const ShowCard = require('./ShowCard') const data = require('../public/data') const Search = () => ( <div className='container'> <div className='shows'> {data.shows.map((show) => ( <ShowCard show={show} key={show.imdbID}/> ))} </div> </div> ) module.exports = Search
const React = require('react') const ShowCard = require('./ShowCard') const data = require('../public/data') const Search = () => ( <div className='container'> <div className='shows'> {data.shows.map((show) => ( <ShowCard show={show} key={show.imdbID} /> ))} </div> </div> ) module.exports = Search
Fix the unique key prop error
Fix the unique key prop error
JSX
mit
michaeldumalag/ReactSelfLearning,michaeldumalag/ReactSelfLearning
--- +++ @@ -6,7 +6,7 @@ <div className='container'> <div className='shows'> {data.shows.map((show) => ( - <ShowCard show={show} key={show.imdbID}/> + <ShowCard show={show} key={show.imdbID} /> ))} </div> </div>
c218a26b1a170dcbef7f250052e4e64b9490c106
app/components/NotFound.jsx
app/components/NotFound.jsx
import React from 'react'; import {Link} from 'react-router'; const NotFound = () => ( <div className="app__content__main not-found"> <h1 className="not-found__disclaimer">Nothing to see here</h1> Go <a href="" onClick={(e) => (e.preventDefault(), history.back())}>back</a> Go <Link to="/">home</Link> </div> ); export default NotFound;
import React from 'react'; import {Link} from 'react-router'; const NotFound = () => ( <div className="app__content__main not-found"> <h1 className="not-found__disclaimer">Nothing to see here</h1> <p> Go <a href="" onClick={(e) => (e.preventDefault(), history.back())}>back</a> Go <Link to="/">home</Link> </p> </div> ); export default NotFound;
Fix links on not-found route out of alignment
fix(not-found): Fix links on not-found route out of alignment
JSX
mit
Velenir/workers-journey,Velenir/workers-journey
--- +++ @@ -4,8 +4,10 @@ const NotFound = () => ( <div className="app__content__main not-found"> <h1 className="not-found__disclaimer">Nothing to see here</h1> - Go <a href="" onClick={(e) => (e.preventDefault(), history.back())}>back</a> - Go <Link to="/">home</Link> + <p> + Go <a href="" onClick={(e) => (e.preventDefault(), history.back())}>back</a> + Go <Link to="/">home</Link> + </p> </div> );
0b528a6aad1f3196c80826574210db46b409d339
src/components/xp-calculator.jsx
src/components/xp-calculator.jsx
import React from 'react'; import Input from './input'; import style from '../style/xp-calculator.css'; export default class XpCalculator extends React.Component { constructor(props) { super(props); this.state = { split: null, total: 0 }; this.calculateXpReward = this.calculateXpReward.bind(this); } componentWillMount() { const { encounter } = this.props; let total = 0; encounter.forEach((monster) => { total += monster.xp * monster.hpPerMonster.length; }); this.setState({ total }); } calculateXpReward(val) { const divisor = parseInt(val, 10); let split = 0; if (isNaN(divisor)) { split = null; } else { split = ['=', Math.round(this.state.total / divisor), 'per player'].join(' '); } this.setState({ split }); } render() { const { split, total } = this.state; return ( <div className={style.calc}> Encounter XP: {total} / <Input blurEvent={this.calculateXpReward} placeholder="# of Players" /> {split} </div> ); } } XpCalculator.propTypes = { encounter: React.PropTypes.arrayOf( React.PropTypes.shape({}) ) };
import React from 'react'; import Input from './input'; import style from '../style/xp-calculator.css'; export default class XpCalculator extends React.Component { constructor(props) { super(props); this.state = { split: null, total: 0 }; this.calculateXpReward = this.calculateXpReward.bind(this); this.setTotal = this.setTotal.bind(this); } componentWillMount() { this.setTotal(this.props.encounter); } componentWillReceiveProps(nextProps) { if (nextProps.encounter !== this.props.encounter) { this.setTotal(nextProps.encounter); } } setTotal(encounter) { let total = 0; encounter.forEach((monster) => { total += monster.xp * monster.hpPerMonster.length; }); this.setState({ total }); } calculateXpReward(val) { const divisor = parseInt(val, 10); let split = 0; if (isNaN(divisor)) { split = null; } else { split = ['=', Math.round(this.state.total / divisor), 'per player'].join(' '); } this.setState({ split }); } render() { const { split, total } = this.state; return ( <div className={style.calc}> Encounter XP: {total} / <Input blurEvent={this.calculateXpReward} placeholder="# of Players" /> {split} </div> ); } } XpCalculator.propTypes = { encounter: React.PropTypes.arrayOf( React.PropTypes.shape({}) ) };
Refactor to handle encounter changes
Refactor to handle encounter changes
JSX
mit
jkrayer/summoner,jkrayer/summoner
--- +++ @@ -10,9 +10,17 @@ total: 0 }; this.calculateXpReward = this.calculateXpReward.bind(this); + this.setTotal = this.setTotal.bind(this); } componentWillMount() { - const { encounter } = this.props; + this.setTotal(this.props.encounter); + } + componentWillReceiveProps(nextProps) { + if (nextProps.encounter !== this.props.encounter) { + this.setTotal(nextProps.encounter); + } + } + setTotal(encounter) { let total = 0; encounter.forEach((monster) => { total += monster.xp * monster.hpPerMonster.length;
503100cbd59abb9ca8676030cf1825410a4448da
templates/minimal/public/javascripts/main.jsx
templates/minimal/public/javascripts/main.jsx
// View that displays a button to call the server var NameLoaderView = React.createClass({ render: function() { return ( <div> <h1>{this.props.staticName}</h1> <p>Hello {this.props.staticName}</p> <input type="button" value="Get app name" onClick={this.props.handleClick} /> <p>{this.props.appName}</p> </div> ); } }); // React component that handles the button click var NameLoader = React.createClass({ getInitialState: function () { return { appName: '' }; }, handleClick: function () { var xhr = new XMLHttpRequest(); xhr.open('GET', '/api', true); xhr.onload = function () { this.setState({ appname: xhr.responseText }); }.bind(this); xhr.send(); }, render: function () { return <NameLoaderView appName={this.state.appName} staticName={this.props.staticName} handleClick={this.handleClick} />; } }); // Tell react to render the component React.render(<NameLoader staticName="<%= appname %>" />, document.getElementById('content'));
// View that displays a button to call the server var NameLoaderView = React.createClass({ render: function() { return ( <div> <h1>{this.props.staticName}</h1> <p>Hello {this.props.staticName}</p> <input type="button" value="Get app name" onClick={this.props.handleClick} /> <p>{this.props.appName}</p> </div> ); } }); // React component that handles the button click var NameLoader = React.createClass({ getInitialState: function () { return { appName: '' }; }, handleClick: function () { var xhr = new XMLHttpRequest(); xhr.open('GET', '/api', true); xhr.onload = function () { this.setState({ appName: xhr.responseText }); }.bind(this); xhr.send(); }, render: function () { return <NameLoaderView appName={this.state.appName} staticName={this.props.staticName} handleClick={this.handleClick} />; } }); // Tell react to render the component React.render(<NameLoader staticName="<%= appname %>" />, document.getElementById('content'));
Fix appName type in minimal template
Fix appName type in minimal template
JSX
mit
peterjuras/slush-azure-node,peterjuras/slush-react-express,peterjuras/slush-react-express,peterjuras/slush-react-express,peterjuras/slush-azure-node,peterjuras/slush-azure-node
--- +++ @@ -21,7 +21,7 @@ var xhr = new XMLHttpRequest(); xhr.open('GET', '/api', true); xhr.onload = function () { - this.setState({ appname: xhr.responseText }); + this.setState({ appName: xhr.responseText }); }.bind(this); xhr.send(); },
57e5ca9fe1cce60d825f9b6457bad001fd98811c
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}); } 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 }; this.change = this.change.bind(this); this.passDataToCreateUser = this.passDataToCreateUser.bind(this); } change(e) { this.setState ({ userName: e.target.value, userNameExists: true }); } passDataToCreateUser() { console.log('please work'); 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;
Add buttonClicked function invocation when Submit button is clicked to update parent state
Add buttonClicked function invocation when Submit button is clicked to update parent state
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -24,7 +24,9 @@ } passDataToCreateUser() { + console.log('please work'); this.props.dataFromInputBox({userName: this.state.userName, userNameExists: this.state.userNameExists}); + this.props.buttonClicked(true); } render () {
29f746881eee0db17b82c510a23e9e56e035a066
src/links.jsx
src/links.jsx
// Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. import _ from 'underscore'; import React from 'react'; import { FormatTemplate, MatchFilter } from './utils.jsx'; import { Filter } from './dispatch.jsx'; export default class LinksPanel extends React.Component { render() { return ( <div> {this.props.links.map(function(link) { return <Link match={link.match} url={link.url} text={link.text} /> }.bind(this))} </div> ); } } LinksPanel.propTypes = { links: React.PropTypes.array.isRequired, } class Link extends React.Component { constructor(props) { super(props); this.state = {}; this._update = this._update.bind(this); } componentWillMount() { Filter.onUpdate(this._update); } componentWillUnmount() { Filter.offUpdate(this._update); } _update() { this.setState({}); } render() { if (!MatchFilter(this.props.match, Filter.filter())) { return false; } var url = FormatTemplate(this.props.url, Filter.filter()); var text = FormatTemplate(this.props.text, Filter.filter()); return <a href={url}>{text}</a> } } Link.propTypes = { match: React.PropTypes.object, url: React.PropTypes.string.isRequired, text: React.PropTypes.string.isRequired, }
// Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. import _ from 'underscore'; import React from 'react'; import { FormatTemplate, MatchFilter } from './utils.jsx'; import { Filter } from './dispatch.jsx'; export default class LinksPanel extends React.Component { render() { return ( <div> {this.props.links.map(function(link, index) { return <Link key={index} match={link.match} url={link.url} text={link.text} /> }.bind(this))} </div> ); } } LinksPanel.propTypes = { links: React.PropTypes.array.isRequired, } class Link extends React.Component { constructor(props) { super(props); this.state = {}; this._update = this._update.bind(this); } componentWillMount() { Filter.onUpdate(this._update); } componentWillUnmount() { Filter.offUpdate(this._update); } _update() { this.setState({}); } render() { if (!MatchFilter(this.props.match, Filter.filter())) { return false; } var url = FormatTemplate(this.props.url, Filter.filter()); var text = FormatTemplate(this.props.text, Filter.filter()); return <a href={url}>{text}</a> } } Link.propTypes = { match: React.PropTypes.object, url: React.PropTypes.string.isRequired, text: React.PropTypes.string.isRequired, }
Add missing key prop in LinksPanel rendering.
Add missing key prop in LinksPanel rendering.
JSX
apache-2.0
devnev/boardwalk,devnev/boardwalk
--- +++ @@ -10,8 +10,8 @@ render() { return ( <div> - {this.props.links.map(function(link) { - return <Link match={link.match} url={link.url} text={link.text} /> + {this.props.links.map(function(link, index) { + return <Link key={index} match={link.match} url={link.url} text={link.text} /> }.bind(this))} </div> );
833ae362aa7d014f2fe30cb6179143eaf22e5cca
src/js/components/refugee-map/refugee-time-range-indicator.jsx
src/js/components/refugee-map/refugee-time-range-indicator.jsx
var React = require('react'); var moment = require('moment'); var RefugeeTimeRangeIndicator = React.createClass({ displayTimeRange: function(timeRange) { var startMoment = moment.unix(timeRange[0]); var endMoment = moment.unix(timeRange[1]); if (startMoment.month() == endMoment.month() && startMoment.year() == endMoment.year()) { return startMoment.format("MMM/YYYY"); } else { return startMoment.format("MMM/YYYY") + " - " + endMoment.format("MMM/YYYY"); } }, render: function() { return ( <div className="refugee-time-range-indicator"> {this.displayTimeRange(this.props.timeRange)} </div> ); } }); module.exports = RefugeeTimeRangeIndicator;
var React = require('react'); var moment = require('moment'); var RefugeeTimeRangeIndicator = React.createClass({ displayTimeRange: function(timeRange) { var startMoment = moment.unix(timeRange[0]); var endMoment = moment.unix(timeRange[1]); if (startMoment.month() == endMoment.month() && startMoment.year() == endMoment.year()) { return startMoment.format("MMM YYYY"); } else { return startMoment.format("MMM YYYY") + " - " + endMoment.format("MMM YYYY"); } }, render: function() { return ( <div className="refugee-time-range-indicator"> {this.displayTimeRange(this.props.timeRange)} </div> ); } }); module.exports = RefugeeTimeRangeIndicator;
Change format to "Jan 2015"
Change format to "Jan 2015"
JSX
mit
lucified/lucify-asylum-countries,lucified/lucify-asylum-countries,lucified/lucify-asylum-countries,lucified/lucify-asylum-countries
--- +++ @@ -11,9 +11,9 @@ if (startMoment.month() == endMoment.month() && startMoment.year() == endMoment.year()) { - return startMoment.format("MMM/YYYY"); + return startMoment.format("MMM YYYY"); } else { - return startMoment.format("MMM/YYYY") + " - " + endMoment.format("MMM/YYYY"); + return startMoment.format("MMM YYYY") + " - " + endMoment.format("MMM YYYY"); } },
1318e090eef13ac06b6fda81466172bdcfd3be0d
react-component-template/example/entry.jsx
react-component-template/example/entry.jsx
import React from 'react' import ReactDOM from 'react-dom' import {{PascalName}} from '../index.jsx' import data from './data.js' import styles from './entry.css' import a11y from 'react-a11y' // expose React for debugging window.React = React a11y(React) ReactDOM.render(<{{PascalName}} {...data} />, document.getElementById('app'))
import React from 'react' import {{PascalName}} from '../index.jsx' import data from './data.js' import styles from './entry.css' import a11y from 'react-a11y' // expose React for debugging window.React = React a11y(React) React.render(<{{PascalName}} {...data} />, document.getElementById('app'))
Revert "update example to require react DOM"
Revert "update example to require react DOM" This reverts commit 7fd76eef357cd63124e738ff7e4fd24a0966e86a.
JSX
mit
cstumph/ribcage-gen,Techwraith/ribcage-gen,Techwraith/ribcage-gen,cstumph/ribcage-gen,tedbreen/ribcage-gen
--- +++ @@ -1,6 +1,4 @@ import React from 'react' -import ReactDOM from 'react-dom' - import {{PascalName}} from '../index.jsx' import data from './data.js' import styles from './entry.css' @@ -10,4 +8,4 @@ window.React = React a11y(React) -ReactDOM.render(<{{PascalName}} {...data} />, document.getElementById('app')) +React.render(<{{PascalName}} {...data} />, document.getElementById('app'))
95e77f6e46c1d6e39752d13aa27fb4fe50927315
src/Seguidor/Seguidor.jsx
src/Seguidor/Seguidor.jsx
import React, { Component } from 'react'; import { Link } from 'react-router'; import FetchingIndicator from '../Fetching/FetchingIndicator'; import SeguidorHeading from './SeguidorHeading'; import Carousel from './Carousel/Carousel'; import YearTabsMobile from './YearTabsMobile'; import MediaQuery from 'react-responsive'; class Seguidor extends Component { constructor(props) { super(props) } componentDidMount() { this.props.onLoad(); } render() { const { isFetching, error, materias, estados} = this.props; if(isFetching) return <FetchingIndicator />; if(error) return <p>Hubo un error recuperando las materias</p>; return( <div> <div> <SeguidorHeading /> </div> <div> <MediaQuery minDeviceWidth={1224} > <Carousel materias={materias} yearsPerTab={3} updateFn={this.props.updateEstado} /> </MediaQuery> <MediaQuery maxDeviceWidth={1224}> <Carousel materias={materias} yearsPerTab={1} updateFn={this.props.updateEstado} /> </MediaQuery> </div> </div> ); } } export default Seguidor;
import React, { Component } from 'react' import MediaQuery from 'react-responsive' import FetchingIndicator from '../Fetching/FetchingIndicator' import SeguidorHeading from './SeguidorHeading' import Carousel from './Carousel/Carousel' class Seguidor extends Component { componentDidMount() { this.props.onLoad() } render() { const { isFetching, error, materias } = this.props if (isFetching) { return <FetchingIndicator /> } if (error) { return <p>Hubo un error recuperando las materias</p> } return ( <div> <div> <SeguidorHeading /> </div> <div> <MediaQuery minDeviceWidth={1224}> <Carousel materias={materias} yearsPerTab={3} updateFn={this.props.updateEstado} /> </MediaQuery> <MediaQuery maxDeviceWidth={1224}> <Carousel materias={materias} yearsPerTab={1} updateFn={this.props.updateEstado} /> </MediaQuery> </div> </div> ) } } export default Seguidor
Fix para reflejar refactor anterior
Fix para reflejar refactor anterior
JSX
isc
UTNianos/frontend,UTNianos/frontend
--- +++ @@ -1,59 +1,50 @@ -import React, { Component } from 'react'; -import { Link } from 'react-router'; -import FetchingIndicator from '../Fetching/FetchingIndicator'; -import SeguidorHeading from './SeguidorHeading'; -import Carousel from './Carousel/Carousel'; -import YearTabsMobile from './YearTabsMobile'; -import MediaQuery from 'react-responsive'; +import React, { Component } from 'react' +import MediaQuery from 'react-responsive' +import FetchingIndicator from '../Fetching/FetchingIndicator' +import SeguidorHeading from './SeguidorHeading' +import Carousel from './Carousel/Carousel' class Seguidor extends Component { + componentDidMount() { + this.props.onLoad() + } - constructor(props) { - super(props) - } + render() { - componentDidMount() { - this.props.onLoad(); - } + const { isFetching, error, materias } = this.props - render() { + if (isFetching) { return <FetchingIndicator /> } - const { isFetching, error, materias, estados} = this.props; + if (error) { return <p>Hubo un error recuperando las materias</p> } - if(isFetching) - return <FetchingIndicator />; + return ( + <div> - if(error) - return <p>Hubo un error recuperando las materias</p>; + <div> + <SeguidorHeading /> + </div> - return( - <div> - - <div> - <SeguidorHeading /> - </div> + <div> + <MediaQuery minDeviceWidth={1224}> + <Carousel + materias={materias} + yearsPerTab={3} + updateFn={this.props.updateEstado} + /> + </MediaQuery> + <MediaQuery maxDeviceWidth={1224}> + <Carousel + materias={materias} + yearsPerTab={1} + updateFn={this.props.updateEstado} + /> + </MediaQuery> + </div> + </div> + ) - <div> - <MediaQuery minDeviceWidth={1224} > - <Carousel - materias={materias} - yearsPerTab={3} - updateFn={this.props.updateEstado} - /> - </MediaQuery> - <MediaQuery maxDeviceWidth={1224}> - <Carousel - materias={materias} - yearsPerTab={1} - updateFn={this.props.updateEstado} - /> - </MediaQuery> - </div> - </div> - ); - - } - + } + } -export default Seguidor; +export default Seguidor
ce3db70d103dcd5ba1fa75ec5ddb9de6e9360198
src/containers/LanguagePicker.jsx
src/containers/LanguagePicker.jsx
import { connect } from 'react-redux' import { getLang } from '../selectors/locales' import { getUrlName } from '../routeTable' import * as locales from '../locales' import LanguagePicker from '../components/LanguagePicker' const mapStateToProps = state => ({ pathName: typeof window === 'undefined' || !window ? 'home' : getUrlName(getLang(state), window.location.pathname) || 'home', availableLangs: Object.keys(locales), selectedLang: getLang(state) }) export default connect(mapStateToProps)(LanguagePicker)
import { connect } from 'react-redux' import { getLang } from '../selectors/locales' import { getUrlName } from '../routeTable' import * as locales from '../locales' import LanguagePicker from '../components/LanguagePicker' const mapStateToProps = (state) => ({ pathName: (typeof window === 'undefined' || !window ? getUrlName(getLang(state), state.server.entryPath) : getUrlName(getLang(state), window.location.pathname)) || 'home', availableLangs: Object.keys(locales), selectedLang: getLang(state) }) export default connect(mapStateToProps)(LanguagePicker)
Resolve language picker from URL on ssr
Resolve language picker from URL on ssr
JSX
mit
just-paja/improtresk-web,just-paja/improtresk-web
--- +++ @@ -7,8 +7,10 @@ import LanguagePicker from '../components/LanguagePicker' -const mapStateToProps = state => ({ - pathName: typeof window === 'undefined' || !window ? 'home' : getUrlName(getLang(state), window.location.pathname) || 'home', +const mapStateToProps = (state) => ({ + pathName: (typeof window === 'undefined' || !window + ? getUrlName(getLang(state), state.server.entryPath) + : getUrlName(getLang(state), window.location.pathname)) || 'home', availableLangs: Object.keys(locales), selectedLang: getLang(state) })
323825db0b441072e90d1dcb3e31510e928041d1
app/assets/javascripts/components/river.js.jsx
app/assets/javascripts/components/river.js.jsx
var SetIntervalMixin = { componentWillMount: function() { this.intervals = []; }, setInterval: function() { this.intervals.push(setInterval.apply(null, arguments)); }, componentWillUnmount: function() { this.intervals.forEach(clearInterval); } }; var Comment = React.createClass({ mixins: [SetIntervalMixin], getInitialState: function(){ return {seconds: 0, pins: this.props.pins}; }, componentDidMount: function(){ this.setInterval(this.comment, 5000); }, comment: function(){ $.ajax({ url: "/maps", dataType: 'json', type: 'GET', cache: false, success: function(data){ this.setState({pins: data}); }.bind(this) }); }, render() { console.log(this.state.pins); return (<div>{this.state.pins.map(function (key, value){ return <div key={key.id}> Comment: {key.comment} Name: {key.username} </div>; })} </div>) } });
var SetIntervalMixin = { componentWillMount: function() { this.intervals = []; }, setInterval: function() { this.intervals.push(setInterval.apply(null, arguments)); }, componentWillUnmount: function() { this.intervals.forEach(clearInterval); } }; var Comment = React.createClass({ mixins: [SetIntervalMixin], getInitialState: function(){ return {seconds: 0, pins: this.props.pins}; }, componentDidMount: function(){ this.setInterval(this.comment, 5000); }, comment: function(){ $.ajax({ url: "/maps", dataType: 'json', type: 'GET', cache: false, success: function(data){ this.setState({pins: data}); }.bind(this) }); }, render() { console.log(this.state.pins); return (<div>{this.state.pins.map(function (key, value){ return <div key={key.id}> <p className='river'>{key.username} @ {key.location} Song: {} - {key.comment}</p> </div>; })} </div>) } });
Make River Function with Necessary Information
Make River Function with Necessary Information
JSX
mit
jjshin85/echo,jjshin85/echo,jjshin85/echo
--- +++ @@ -37,7 +37,7 @@ console.log(this.state.pins); return (<div>{this.state.pins.map(function (key, value){ return <div key={key.id}> - Comment: {key.comment} Name: {key.username} + <p className='river'>{key.username} @ {key.location} Song: {} - {key.comment}</p> </div>; })} </div>)
bb6071b9c1540889f24d9f775f8a1021f5987ab6
client/app/bundles/course/assessment/submission/components/pastAnswers/PastProgrammingAnswer.jsx
client/app/bundles/course/assessment/submission/components/pastAnswers/PastProgrammingAnswer.jsx
import React, { Component } from 'react'; import ProgrammingImportEditor from '../../containers/ProgrammingImportEditor'; import ReadOnlyEditor from '../../containers/ReadOnlyEditor'; import TestCaseView from '../../containers/TestCaseView'; import { answerShape, questionShape } from '../../propTypes'; export default class PastProgrammingAnswer extends Component { static propTypes = { answer: answerShape, question: questionShape, }; renderFileSubmissionPastAnswer() { const { question, answer } = this.props; return ( <div> <ProgrammingImportEditor questionId={answer.questionId} answerId={answer.id} viewHistory {...{ question, }} /> <TestCaseView answerId={answer.id} viewHistory /> </div> ); } render() { const { question, answer } = this.props; const file = answer.files_attributes.length > 0 ? answer.files_attributes[0] : null; const content = file ? file.content.split('\n') : ''; if (question.fileSubmission) { return this.renderFileSubmissionPastAnswer().bind(this); } return ( <div> <ReadOnlyEditor answerId={answer.id} fileId={file.id} content={content} /> <TestCaseView answerId={answer.id} viewHistory /> </div> ); } }
import React, { Component } from 'react'; import ProgrammingImportEditor from '../../containers/ProgrammingImportEditor'; import ReadOnlyEditor from '../../containers/ReadOnlyEditor'; import TestCaseView from '../../containers/TestCaseView'; import { answerShape, questionShape } from '../../propTypes'; export default class PastProgrammingAnswer extends Component { static propTypes = { answer: answerShape, question: questionShape, }; renderFileSubmissionPastAnswer() { const { question, answer } = this.props; return ( <div> <ProgrammingImportEditor questionId={answer.questionId} answerId={answer.id} viewHistory {...{ question, }} /> <TestCaseView answerId={answer.id} viewHistory /> </div> ); } render() { const { question, answer } = this.props; const file = answer.files_attributes.length > 0 ? answer.files_attributes[0] : null; const content = file ? file.content.split('\n') : ''; if (question.fileSubmission) { return this.renderFileSubmissionPastAnswer(); } return ( <div> <ReadOnlyEditor answerId={answer.id} fileId={file.id} content={content} /> <TestCaseView answerId={answer.id} viewHistory /> </div> ); } }
Fix past file upload answers
Fix past file upload answers
JSX
mit
Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,cysjonathan/coursemology2
--- +++ @@ -35,7 +35,7 @@ const content = file ? file.content.split('\n') : ''; if (question.fileSubmission) { - return this.renderFileSubmissionPastAnswer().bind(this); + return this.renderFileSubmissionPastAnswer(); } return (
02a8d1a9a6f0324eed066624df52a25fe6fae38b
src/FacebookLoading.jsx
src/FacebookLoading.jsx
import React, { PropTypes } from 'react'; import styles from './FacebookLoading.styl'; const FacebookLoading = (props) => { let { style, duration, zoom } = props; if (typeof duration === 'number') { duration += 's'; } return ( <div className={styles.loading} style={{ animationDuration: duration, webkitAnimationDuration: duration, mozAnimationDuration: duration, oAnimationDuration: duration, zoom: zoom, ...style }} /> ); }; FacebookLoading.propTypes = { duration: PropTypes.oneOf([ PropTypes.number, PropTypes.string ]), zoom: PropTypes.number }; FacebookLoading.defaultProps = { duration: '0.8s', zoom: 1 }; export default FacebookLoading;
import React, { PropTypes } from 'react'; import styles from './FacebookLoading.styl'; const FacebookLoading = (props) => { let { style, duration, zoom } = props; if (typeof duration === 'number') { duration += 's'; } return ( <div className={styles.loading} style={{ animationDuration: duration, WebkitAnimationDuration: duration, MozAnimationDuration: duration, OAnimationDuration: duration, zoom: zoom, ...style }} /> ); }; FacebookLoading.propTypes = { duration: PropTypes.oneOf([ PropTypes.number, PropTypes.string ]), zoom: PropTypes.number }; FacebookLoading.defaultProps = { duration: '0.8s', zoom: 1 }; export default FacebookLoading;
Resolve an issue of incorrect vendor-prefixed style property
Resolve an issue of incorrect vendor-prefixed style property
JSX
mit
cheton/react-facebook-loading
--- +++ @@ -13,9 +13,9 @@ className={styles.loading} style={{ animationDuration: duration, - webkitAnimationDuration: duration, - mozAnimationDuration: duration, - oAnimationDuration: duration, + WebkitAnimationDuration: duration, + MozAnimationDuration: duration, + OAnimationDuration: duration, zoom: zoom, ...style }}
dd954b42c0b7b4d89baec8f3ad1ba832db5099f8
client/network/site-connected-filter.jsx
client/network/site-connected-filter.jsx
import React from 'react' import { connect } from 'react-redux' import siteSocket from './site-socket' import { makeServerUrl } from './server-url' import styles from './site-connected-filter.css' import LoadingIndicator from '../progress/dots.jsx' let applyCookies = async () => {} if (IS_ELECTRON) { const { remote } = require('electron') const curSession = remote.require('./current-session.js').default // engine.io uses Node APIs to make web requests in Electron, so we have to explicitly put the // right cookies on its headers applyCookies = async () => { return new Promise(resolve => { curSession().cookies.get({ url: makeServerUrl('') }, (err, cookies) => { if (err) { resolve() return } siteSocket.opts.extraHeaders = { Origin: 'http://client.shieldbattery.net', 'x-shield-battery-client': 'true', Cookie: cookies .map(c => `${encodeURIComponent(c.name)}=${encodeURIComponent(c.value)}`) .join('; '), } resolve() }) }) } } @connect(state => ({ siteNetwork: state.network.site })) export default class SiteConnectedFilter extends React.Component { mounted = false componentDidMount() { this.mounted = true applyCookies().then(() => { if (this.mounted) { siteSocket.connect() } }) } componentWillUnmount() { this.mounted = false siteSocket.disconnect() } render() { // TODO(tec27): just render an overlay if we were previously connected? (This would help avoid // losing transient state, like the state of inputs, if we get disconnected briefly) if (this.props.siteNetwork.isConnected) { return React.Children.only(this.props.children) } else { return ( <div className={styles.loadingArea}> <LoadingIndicator /> </div> ) } } }
import React from 'react' import { connect } from 'react-redux' import siteSocket from './site-socket' import styles from './site-connected-filter.css' import LoadingIndicator from '../progress/dots.jsx' @connect(state => ({ siteNetwork: state.network.site })) export default class SiteConnectedFilter extends React.Component { componentDidMount() { siteSocket.opts.extraHeaders = { 'x-shield-battery-client': 'true', } siteSocket.connect() } componentWillUnmount() { siteSocket.disconnect() } render() { // TODO(tec27): just render an overlay if we were previously connected? (This would help avoid // losing transient state, like the state of inputs, if we get disconnected briefly) if (this.props.siteNetwork.isConnected) { return React.Children.only(this.props.children) } else { return ( <div className={styles.loadingArea}> <LoadingIndicator /> </div> ) } } }
Remove the unnecessary explicit cookie applying
Remove the unnecessary explicit cookie applying Previously this was required because webpack didn't respect the `browser` field in the `package.json` for the `electron-renderer` targets, which `engine.io-client` used to determine when to use which version of `XMLHttpRequest`, so it used the node's version. Newer version of webpack fixed this, so our explicit setting of cookies is not required anymore.
JSX
mit
ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery
--- +++ @@ -1,52 +1,20 @@ import React from 'react' import { connect } from 'react-redux' import siteSocket from './site-socket' -import { makeServerUrl } from './server-url' import styles from './site-connected-filter.css' import LoadingIndicator from '../progress/dots.jsx' -let applyCookies = async () => {} -if (IS_ELECTRON) { - const { remote } = require('electron') - const curSession = remote.require('./current-session.js').default - // engine.io uses Node APIs to make web requests in Electron, so we have to explicitly put the - // right cookies on its headers - applyCookies = async () => { - return new Promise(resolve => { - curSession().cookies.get({ url: makeServerUrl('') }, (err, cookies) => { - if (err) { - resolve() - return - } - siteSocket.opts.extraHeaders = { - Origin: 'http://client.shieldbattery.net', - 'x-shield-battery-client': 'true', - Cookie: cookies - .map(c => `${encodeURIComponent(c.name)}=${encodeURIComponent(c.value)}`) - .join('; '), - } - resolve() - }) - }) - } -} - @connect(state => ({ siteNetwork: state.network.site })) export default class SiteConnectedFilter extends React.Component { - mounted = false - componentDidMount() { - this.mounted = true - applyCookies().then(() => { - if (this.mounted) { - siteSocket.connect() - } - }) + siteSocket.opts.extraHeaders = { + 'x-shield-battery-client': 'true', + } + siteSocket.connect() } componentWillUnmount() { - this.mounted = false siteSocket.disconnect() }
25eb0c6575f808c27b72ab2ecae823133d3fcf5f
src/map/components/panel-handle/__tests__/MapPanelHandle.test.jsx
src/map/components/panel-handle/__tests__/MapPanelHandle.test.jsx
import React from 'react'; import { shallow } from 'enzyme'; import MapPanelHandle from '../MapPanelHandle'; describe('MapPanelHandle', () => { it('should render children by default', () => { const mapPanelHandle = shallow( <MapPanelHandle isMapPanelHandleVisible onMapPanelHandleToggle={() => {}} > <div className="children-test" /> </MapPanelHandle> ); expect(mapPanelHandle.find('.children-test').length).toBe(1); expect(mapPanelHandle).toMatchSnapshot(); }); it('should hide children on click', () => { const onButtonClickSpy = jest.fn(); const mapPanelHandle = shallow( <MapPanelHandle isMapPanelHandleVisible={false} onMapPanelHandleToggle={onButtonClickSpy} > <div className="children-test" /> </MapPanelHandle> ); mapPanelHandle.find('.map-panel-handle__toggle').simulate('click'); expect(onButtonClickSpy.mock.calls.length).toBe(1); expect(mapPanelHandle.find('.children-test').length).toBe(0); }); });
import React from 'react'; import { shallow } from 'enzyme'; import MapPanelHandle from '../MapPanelHandle'; describe('MapPanelHandle', () => { it('should render children by default', () => { const mapPanelHandle = shallow( <MapPanelHandle isMapPanelHandleVisible onMapPanelHandleToggle={() => {}} > <div className="children-test" /> </MapPanelHandle> ); expect(mapPanelHandle.find('.children-test').length).toBe(1); expect(mapPanelHandle).toMatchSnapshot(); }); it('should hide children on click', () => { const onButtonClickSpy = jest.fn(); const mapPanelHandle = shallow( <MapPanelHandle isMapPanelHandleVisible={false} onMapPanelHandleToggle={onButtonClickSpy} > <div className="children-test" /> </MapPanelHandle> ); mapPanelHandle.find('.map-panel-handle__toggle').simulate('click'); expect(onButtonClickSpy).toHaveBeenCalledTimes(1); expect(mapPanelHandle.find('.children-test').length).toBe(0); }); });
Use mock features of Jest instead of Sinon
Use mock features of Jest instead of Sinon
JSX
mpl-2.0
Amsterdam/atlas,Amsterdam/atlas,DatapuntAmsterdam/atlas,DatapuntAmsterdam/atlas_prototype,DatapuntAmsterdam/atlas,Amsterdam/atlas,DatapuntAmsterdam/atlas,DatapuntAmsterdam/atlas_prototype,Amsterdam/atlas
--- +++ @@ -30,7 +30,7 @@ ); mapPanelHandle.find('.map-panel-handle__toggle').simulate('click'); - expect(onButtonClickSpy.mock.calls.length).toBe(1); + expect(onButtonClickSpy).toHaveBeenCalledTimes(1); expect(mapPanelHandle.find('.children-test').length).toBe(0); }); });
deb45df71282d605ccc9df50cd2d83e429bc748f
src/components/SocialLinks.jsx
src/components/SocialLinks.jsx
import React from 'react'; import PropTypes from 'prop-types'; const propTypes = {}; const defaultProps = {}; const SocialLinks = (props) => { const text = encodeURIComponent(props.messages.morse); const url = encodeURIComponent(`http://simoneduca.com/#/morse-translator/message/${props.params.message_id}`); return ( <div className="share-buttons"> <a className="social-link" href={`http://twitter.com/share?url=${url}&text=${text}`} rel="noopener noreferrer" target="_blank" > TWEET IT </a> <a className="social-link" href={`http://twitter.com/share?url=${url}&text=${text}`} rel="noopener noreferrer" target="_blank" > TWEET IT </a> <a className="social-link" href={`http://twitter.com/share?url=${url}&text=${text}`} rel="noopener noreferrer" target="_blank" > TWEET IT </a> </div> ); }; SocialLinks.propTypes = propTypes; SocialLinks.defaultProps = defaultProps; export default SocialLinks;
import React from 'react'; import PropTypes from 'prop-types'; const propTypes = {}; const defaultProps = {}; const SocialLinks = (props) => { const text = encodeURIComponent(props.messages.morse); const url = encodeURIComponent(`http://simoneduca.com/morse-translator/#/message/${props.params.message_id}`); return ( <div className="share-buttons"> <a className="social-link" href={`http://twitter.com/share?url=${url}&text=${text}`} rel="noopener noreferrer" target="_blank" > TWEET IT </a> <a className="social-link" href={`http://twitter.com/share?url=${url}&text=${text}`} rel="noopener noreferrer" target="_blank" > TWEET IT </a> <a className="social-link" href={`http://twitter.com/share?url=${url}&text=${text}`} rel="noopener noreferrer" target="_blank" > TWEET IT </a> </div> ); }; SocialLinks.propTypes = propTypes; SocialLinks.defaultProps = defaultProps; export default SocialLinks;
Put hash in the correct place
Put hash in the correct place
JSX
apache-2.0
simoneduca/morse-translator,simoneduca/morse-translator
--- +++ @@ -7,7 +7,7 @@ const SocialLinks = (props) => { const text = encodeURIComponent(props.messages.morse); - const url = encodeURIComponent(`http://simoneduca.com/#/morse-translator/message/${props.params.message_id}`); + const url = encodeURIComponent(`http://simoneduca.com/morse-translator/#/message/${props.params.message_id}`); return ( <div className="share-buttons"> <a
317515b850a46dc14decacfa04edaf5ee5a667c3
src/js/components/Task.jsx
src/js/components/Task.jsx
import React, { PropTypes } from 'react'; const propTypes = { task: PropTypes.object.isRequired, }; export default class Task extends React.Component { render() { return ( <tr> <td> {this.props.task.text} </td> </tr> ); } } Task.propTypes = propTypes;
import React, { PropTypes } from 'react'; const propTypes = { task: PropTypes.object.isRequired, }; export default class Task extends React.Component { render() { return ( <tr> <td> {this.props.task.text} </td> <td className="is-icon"> <i className="fa fa-check" /> </td> <td className="is-icon"> <i className="fa fa-pencil" /> </td> <td className="is-icon"> <i className="fa fa-trash" /> </td> </tr> ); } } Task.propTypes = propTypes;
Add icon in task, but not work yet
Add icon in task, but not work yet
JSX
mit
tanaka0325/nippo-web,tanaka0325/nippo-web
--- +++ @@ -11,6 +11,15 @@ <td> {this.props.task.text} </td> + <td className="is-icon"> + <i className="fa fa-check" /> + </td> + <td className="is-icon"> + <i className="fa fa-pencil" /> + </td> + <td className="is-icon"> + <i className="fa fa-trash" /> + </td> </tr> ); }
6724ce34a1dfc54e71310c1b787b65d9ae1a5a4a
app/lib/Create.jsx
app/lib/Create.jsx
'use strict'; var React = require('react'); var SkyLight = require('jsx!react-skylight/src/skylight.jsx'); var Button = require('react-pure-button'); var Form = require('lib/Form'); module.exports = React.createClass({ displayName: 'Create', propTypes: { actions: React.PropTypes.object, schema: React.PropTypes.object, children: React.PropTypes.any, }, getInitialState: function() { return { modal: { title: null, content: null, }, }; }, render() { var modal = this.state.modal || {}; return ( <div> <Button onClick={this.createNew}>{this.props.children}</Button> <SkyLight ref='modal' title={modal.title}>{modal.content}</SkyLight> </div> ); }, createNew: function() { var that = this; this.setState({ modal: { title: that.props.children, content: <Form schema={that.props.schema} onSubmit={onSubmit} /> } }); this.refs.modal.show(); function onSubmit(data, value, errors) { if(value === 'Cancel') { return that.refs.modal.hide(); } if(!Object.keys(errors).length) { that.refs.modal.hide(); delete data.id; that.props.actions.create(data); } } }, });
'use strict'; var React = require('react'); var SkyLight = require('jsx!react-skylight/src/skylight.jsx'); var Button = require('react-pure-button'); var Form = require('lib/Form'); module.exports = React.createClass({ displayName: 'Create', propTypes: { actions: React.PropTypes.object, schema: React.PropTypes.object, children: React.PropTypes.any, }, getInitialState: function() { return { modal: { title: null, content: null, }, }; }, render() { var modal = this.state.modal || {}; return ( <div> <Button onClick={this.createNew}>{this.props.children}</Button> <SkyLight ref='modal' title={modal.title}>{modal.content}</SkyLight> </div> ); }, createNew: function() { var that = this; this.setState({ modal: { title: that.props.children, content: <Form schema={that.props.schema} onSubmit={onSubmit} /> } }); this.refs.modal.show(); function onSubmit(data, value, errors) { if(value === 'Cancel') { return that.refs.modal.hide(); } if(!Object.keys(errors).length) { that.refs.modal.hide(); delete data.id; that.props.actions.create(data); } else { console.info('errors', errors); } } }, });
Print possible submit errors to console
Print possible submit errors to console
JSX
mit
bebraw/react-crm-frontend,koodilehto/koodilehto-crm-frontend,bebraw/react-crm-frontend,koodilehto/koodilehto-crm-frontend
--- +++ @@ -62,6 +62,9 @@ that.props.actions.create(data); } + else { + console.info('errors', errors); + } } }, });
441b37e1bcec19c5ae87e690da4f5b9c03995d53
client/src/MyMap.jsx
client/src/MyMap.jsx
import React from 'react'; import ReactMapboxGl, { Layer, Feature } from "react-mapbox-gl"; import accessTokens from './accessTokens.js'; // import mapboxStyle from './mapboxStyle.js'; const containerStyle = { height: "80vh", width: "80vw", }; class MyMap extends React.Component { constructor(props) { super(props); this.state = { center: [-122.431297, 37.773972], zoom: 11, locations: {}, }; } componentWillMount() { } render() { return ( <div> <ReactMapboxGl style="mapbox://styles/mapbox/streets-v9" center={this.state.center} zoom={this.state.zoom} accessToken={accessTokens.SODA_api} containerStyle={containerStyle}> <Layer id="pin" type="symbol" layout={{ "icon-image": "marker-15" }}> {} </Layer> </ReactMapboxGl> </div> ); } }; export default MyMap;
import React from 'react'; import ReactMapboxGl, { Layer, Feature } from "react-mapbox-gl"; import accessTokens from './accessTokens.js'; import { Map } from 'immutable'; const containerStyle = { height: "80vh", width: "80vw", }; class MyMap extends React.Component { constructor(props) { super(props); this.state = { center: [-122.431297, 37.773972], zoom: 11, locations: [], }; } componentWillMount() { // this.props.data; const dummyPosition = [-122.431297, 37.773972]; this.setState({ locations: [ { position: dummyPosition, }, ], }); } render() { return ( <div> <ReactMapboxGl style="mapbox://styles/mapbox/streets-v9" center={this.state.center} zoom={this.state.zoom} accessToken={accessTokens.SODA_api} containerStyle={containerStyle}> <Layer id="marker" type="symbol" layout={{ "icon-image": "marker-15" }}> { this.state.locations.map((location, index) => { <Feature key={index} coordinates={location.position} /> }) } </Layer> </ReactMapboxGl> </div> ); } }; export default MyMap;
Implement Feature in map Layer
Implement Feature in map Layer
JSX
mit
conniedaisy/filmSF,conniedaisy/filmSF
--- +++ @@ -1,7 +1,7 @@ import React from 'react'; import ReactMapboxGl, { Layer, Feature } from "react-mapbox-gl"; import accessTokens from './accessTokens.js'; -// import mapboxStyle from './mapboxStyle.js'; +import { Map } from 'immutable'; const containerStyle = { height: "80vh", @@ -14,12 +14,20 @@ this.state = { center: [-122.431297, 37.773972], zoom: 11, - locations: {}, + locations: [], }; } componentWillMount() { - + // this.props.data; + const dummyPosition = [-122.431297, 37.773972]; + this.setState({ + locations: [ + { + position: dummyPosition, + }, + ], + }); } render() { @@ -33,10 +41,17 @@ containerStyle={containerStyle}> <Layer - id="pin" + id="marker" type="symbol" layout={{ "icon-image": "marker-15" }}> - {} + { + this.state.locations.map((location, index) => { + <Feature + key={index} + coordinates={location.position} + /> + }) + } </Layer> </ReactMapboxGl>
696f6e4e7e5fa95fb7a6cf72ff004fbdc1ffc485
test/BrowseNotesSpec.jsx
test/BrowseNotesSpec.jsx
import React from 'react'; import { expect } from 'chai'; import { mount } from 'enzyme'; import BrowseNotes from './../client/components/BrowseNotes'; describe('<BrowseNotes />', () => { it('should render component', () => { const wrapper = mount(<BrowseNotes />); expect(wrapper.find('h2')).to.have.length(1); }); }); // Should exist // Should get all notes from database for a given user // Should create a list item for every note received from database // Each list item shoud have a note title // Each item should have a snippet of the note body // Should have a search element // Should filter out notes that do not meet search parameters // Should open note for editing when it is clicked
import React from 'react'; import { expect } from 'chai'; import { mount } from 'enzyme'; import BrowseNotes from './../client/components/BrowseNotes'; describe('<BrowseNotes />', () => { it('should render component', () => { const wrapper = mount(<BrowseNotes />); expect(wrapper.find('h2')).to.have.length(1); }); }); // Should exist // Should get all notes from database for a given user // Should create a list item for every note received from database // Each list item shoud have a note title // Each item should have a snippet of the note body // Should have a search element // Should filter out notes that do not meet search parameters // Should open note component with note data when clicked
Tweak pseudo code very slightly for browse notes spec
Tweak pseudo code very slightly for browse notes spec
JSX
mit
enchanted-spotlight/Plato,enchanted-spotlight/Plato
--- +++ @@ -25,5 +25,4 @@ // Should filter out notes that do not meet search parameters -// Should open note for editing when it is clicked - +// Should open note component with note data when clicked
a2327632a55620b8cf32ccac8e8ea489d86fa67c
src/components/registration/registration.jsx
src/components/registration/registration.jsx
var React = require('react'); var Modal = require('../modal/modal.jsx'); require('./registration.scss'); Modal.setAppElement(document.getElementById('view')); var Registration = React.createClass({ propTypes: { isOpen: React.PropTypes.bool, onRegistrationDone: React.PropTypes.func, onRequestClose: React.PropTypes.func }, onMessage: function (e) { if (e.origin != window.location.origin) return; if (e.data == 'registration-done') this.props.onRegistrationDone(); }, componentDidMount: function () { window.addEventListener('message', this.onMessage); }, componentWillUnmount: function () { window.removeEventListener('message', this.onMessage); }, render: function () { var frameSettings = { width: 610, height: 438 }; return ( <Modal isOpen={this.props.isOpen} onRequestClose={this.props.onRequestClose} className="registration" frameSettings={frameSettings}> <iframe src="/accounts/standalone-registration/" {...frameSettings} /> </Modal> ); } }); module.exports = Registration;
var React = require('react'); var Modal = require('../modal/modal.jsx'); require('./registration.scss'); Modal.setAppElement(document.getElementById('view')); var Registration = React.createClass({ propTypes: { isOpen: React.PropTypes.bool, onRegistrationDone: React.PropTypes.func, onRequestClose: React.PropTypes.func }, onMessage: function (e) { if (e.origin != window.location.origin) return; if (e.source != this.refs.registrationIframe.contentWindow) return; if (e.data == 'registration-done') this.props.onRegistrationDone(); if (e.data == 'registration-relaunch') { this.refs.registrationIframe.contentWindow.location.reload(); } }, toggleMessageListener: function (present) { if (present) { window.addEventListener('message', this.onMessage); } else { window.removeEventListener('message', this.onMessage); } }, componentDidMount: function () { if (this.props.isOpen) this.toggleMessageListener(true); }, componentDidUpdate: function (prevProps) { this.toggleMessageListener(this.props.isOpen && !prevProps.isOpen); }, componentWillUnmount: function () { this.toggleMessageListener(false); }, render: function () { var frameSettings = { width: 610, height: 438 }; return ( <Modal isOpen={this.props.isOpen} onRequestClose={this.props.onRequestClose} className="registration" frameSettings={frameSettings}> <iframe ref="registrationIframe" src="/accounts/standalone-registration/" {...frameSettings} /> </Modal> ); } }); module.exports = Registration;
Handle relaunch requests from the iframe
Handle relaunch requests from the iframe Only attach the message listener when the modal is displaying. This prevents multiple listeners being set up by multiple registration components on the page. Also, scope the `onMessage` handler to that component's iframe, so that we don't respond to other component's messages.
JSX
bsd-3-clause
LLK/scratch-www,LLK/scratch-www
--- +++ @@ -13,13 +13,27 @@ }, onMessage: function (e) { if (e.origin != window.location.origin) return; + if (e.source != this.refs.registrationIframe.contentWindow) return; if (e.data == 'registration-done') this.props.onRegistrationDone(); + if (e.data == 'registration-relaunch') { + this.refs.registrationIframe.contentWindow.location.reload(); + } + }, + toggleMessageListener: function (present) { + if (present) { + window.addEventListener('message', this.onMessage); + } else { + window.removeEventListener('message', this.onMessage); + } }, componentDidMount: function () { - window.addEventListener('message', this.onMessage); + if (this.props.isOpen) this.toggleMessageListener(true); + }, + componentDidUpdate: function (prevProps) { + this.toggleMessageListener(this.props.isOpen && !prevProps.isOpen); }, componentWillUnmount: function () { - window.removeEventListener('message', this.onMessage); + this.toggleMessageListener(false); }, render: function () { var frameSettings = { @@ -32,7 +46,7 @@ onRequestClose={this.props.onRequestClose} className="registration" frameSettings={frameSettings}> - <iframe src="/accounts/standalone-registration/" {...frameSettings} /> + <iframe ref="registrationIframe" src="/accounts/standalone-registration/" {...frameSettings} /> </Modal> ); }
8b2e4230dc2b3c35c584d9ef9292f0b0b94b6725
src/components/user-feed.jsx
src/components/user-feed.jsx
import React from 'react' import {Link} from 'react-router' import PaginatedView from './paginated-view' import Feed from './feed' export default props => ( <div> {props.viewUser.blocked ? ( <div className="box-body"> <p>You have blocked <b>{props.viewUser.screenName}</b>, so all of their posts and comments are invisible to you.</p> <p><a onClick={()=>props.userActions.unban({username: props.viewUser.username, id: props.viewUser.id})}>Un-block</a></p> </div> ) : props.viewUser.isPrivate === '1' && !props.viewUser.subscribed ? ( <div className="box-body"> <p><b>{props.viewUser.screenName}</b> has a private feed.</p> </div> ) : ( <PaginatedView> <Feed {...props} isInUserFeed={true}/> </PaginatedView> )} </div> )
import React from 'react' import {Link} from 'react-router' import PaginatedView from './paginated-view' import Feed from './feed' export default props => ( <div> {props.viewUser.blocked ? ( <div className="box-body"> <p>You have blocked <b>{props.viewUser.screenName}</b>, so all of their posts and comments are invisible to you.</p> <p><a onClick={()=>props.userActions.unban({username: props.viewUser.username, id: props.viewUser.id})}>Un-block</a></p> </div> ) : props.viewUser.isPrivate === '1' && !props.viewUser.subscribed && !props.viewUser.isItMe ? ( <div className="box-body"> <p><b>{props.viewUser.screenName}</b> has a private feed.</p> </div> ) : ( <PaginatedView> <Feed {...props} isInUserFeed={true}/> </PaginatedView> )} </div> )
Fix user's own private feed
Fix user's own private feed Before: user is shown "user has a private feed" for their own feed. After: user is shown the feed contents.
JSX
mit
davidmz/freefeed-react-client,FreeFeed/freefeed-html-react,clbn/freefeed-gamma,kadmil/freefeed-react-client,kadmil/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,FreeFeed/freefeed-html-react,clbn/freefeed-gamma,clbn/freefeed-gamma,ujenjt/freefeed-react-client,FreeFeed/freefeed-react-client,FreeFeed/freefeed-html-react,kadmil/freefeed-react-client,ujenjt/freefeed-react-client,ujenjt/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-react-client
--- +++ @@ -11,7 +11,7 @@ <p>You have blocked <b>{props.viewUser.screenName}</b>, so all of their posts and comments are invisible to you.</p> <p><a onClick={()=>props.userActions.unban({username: props.viewUser.username, id: props.viewUser.id})}>Un-block</a></p> </div> - ) : props.viewUser.isPrivate === '1' && !props.viewUser.subscribed ? ( + ) : props.viewUser.isPrivate === '1' && !props.viewUser.subscribed && !props.viewUser.isItMe ? ( <div className="box-body"> <p><b>{props.viewUser.screenName}</b> has a private feed.</p> </div>
5ac3571b2d8dbeb8cf74ebfbc8f2fe5d1df17713
app/components/Input.jsx
app/components/Input.jsx
import React, { Component, PropTypes } from 'react' export default class Input extends Component { static propTypes = { handleChange: PropTypes.func, handleSubmit: PropTypes.func, id: PropTypes.string, type: PropTypes.oneOf(['text']).isRequired, value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]) } handleChange (evt) { this.props.handleChange(evt.target.value) } handleKeyUp (evt) { const ENTER_KEY_CODE = 13 const isEnter = evt.keyCode === ENTER_KEY_CODE const message = this.props.value.trim() const messageIsValid = message.length > 0 if (isEnter && messageIsValid && this.props.handleSubmit) { this.props.handleSubmit(message) } } render () { return <input className="ba2 b--govuk-gray-1 outline w-100" id={this.props.id} onChange={this::this.handleChange} onKeyUp={this::this.handleKeyUp} type={this.props.type} value={this.props.value} style={{ padding: '5px' }} /> } }
import React, { Component, PropTypes } from 'react' export default class Input extends Component { static propTypes = { handleChange: PropTypes.func, handleSubmit: PropTypes.func, id: PropTypes.string, type: PropTypes.oneOf(['text']).isRequired, value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]) } handleChange (evt) { this.props.handleChange(evt.target.value) } handleKeyUp (evt) { const ENTER_KEY_CODE = 13 const isEnter = evt.keyCode === ENTER_KEY_CODE const message = this.props.value.trim() const messageIsValid = message.length > 0 if (isEnter && messageIsValid && this.props.handleSubmit) { this.props.handleSubmit(message) } } render () { return <input className="ba2 b--govuk-gray-1 outline w-100 input-reset" id={this.props.id} onChange={this::this.handleChange} onKeyUp={this::this.handleKeyUp} type={this.props.type} value={this.props.value} style={{ padding: '5px' }} /> } }
Fix input styling on iOS
Fix input styling on iOS
JSX
mit
quis/notify-public-research-prototype,quis/notify-public-research-prototype,quis/notify-public-research-prototype
--- +++ @@ -25,7 +25,7 @@ render () { return <input - className="ba2 b--govuk-gray-1 outline w-100" + className="ba2 b--govuk-gray-1 outline w-100 input-reset" id={this.props.id} onChange={this::this.handleChange} onKeyUp={this::this.handleKeyUp}
fa1d91396d9aabe4241699e4f55224a88880bdf6
frontend/components/app.jsx
frontend/components/app.jsx
import React from 'react'; const App = ({ children }) => ( <div> {/* TODO: Build header, footer, and categories and render here*/} {/*<header className="header-bar u-full-width"> <a>This is the header</a> </header>*/} {children} </div> ); export default App;
import React from 'react'; const App = ({ children }) => ( <div> {children} </div> ); export default App;
Remove todo, items will be in seperate component
Remove todo, items will be in seperate component
JSX
mit
PGilbertSchmitt/SwappingApp,PGilbertSchmitt/SwappingApp,PGilbertSchmitt/SwappingApp
--- +++ @@ -2,10 +2,6 @@ const App = ({ children }) => ( <div> - {/* TODO: Build header, footer, and categories and render here*/} - {/*<header className="header-bar u-full-width"> - <a>This is the header</a> - </header>*/} {children} </div> );
03f6e166b0de21424a472cf300dee3c44d88c2e1
src/Stagger/index.jsx
src/Stagger/index.jsx
import React from 'react'; import { node, number } from 'prop-types'; import { TransitionGroup } from 'react-transition-group'; const Stagger = ({ children, chunk, delay, ...props }) => { const getDelay = idx => { if (chunk) { return (idx % chunk) * delay; } return idx * delay; }; return ( <TransitionGroup appear {...props}> {React.Children.map(children, (child, i) => React.cloneElement(child, { delay: `${getDelay(i)}ms`, }) )} </TransitionGroup> ); }; Stagger.propTypes = { children: node, chunk: number, delay: number, }; Stagger.defaultProps = { delay: 100, }; export default Stagger;
import React from 'react'; import { node, number } from 'prop-types'; import { TransitionGroup } from 'react-transition-group'; export const getStaggerDelay = (idx, props) => { if (props.chunk) { return (idx % props.chunk) * props.delay; } return idx * props.delay; }; const Stagger = ({ children, ...props }) => { return ( <TransitionGroup appear {...props}> {React.Children.map(children, (child, i) => React.cloneElement(child, { delay: `${getStaggerDelay(i, props)}ms`, }) )} </TransitionGroup> ); }; Stagger.propTypes = { children: node, chunk: number, delay: number, }; Stagger.defaultProps = { delay: 100, }; export default Stagger;
Move getDelay out of component and rename to make more testable
Move getDelay out of component and rename to make more testable
JSX
mit
unruffledBeaver/react-animation-components
--- +++ @@ -2,19 +2,19 @@ import { node, number } from 'prop-types'; import { TransitionGroup } from 'react-transition-group'; -const Stagger = ({ children, chunk, delay, ...props }) => { - const getDelay = idx => { - if (chunk) { - return (idx % chunk) * delay; - } - return idx * delay; - }; +export const getStaggerDelay = (idx, props) => { + if (props.chunk) { + return (idx % props.chunk) * props.delay; + } + return idx * props.delay; +}; +const Stagger = ({ children, ...props }) => { return ( <TransitionGroup appear {...props}> {React.Children.map(children, (child, i) => React.cloneElement(child, { - delay: `${getDelay(i)}ms`, + delay: `${getStaggerDelay(i, props)}ms`, }) )} </TransitionGroup>
9996226bc05b1208d946fb5f11e3f7eb3f6f088c
client/src/Nav.jsx
client/src/Nav.jsx
import React from 'react'; class Nav extends React.Component { constructor(props) { super(props); this.state({ }); } render() { return ( <div> <button id="my-shopping-list">My Shopping List</button> <button id="house-inventory">House Inventory</button> </div> ); } } export default Nav;
import React from 'react'; class Nav extends React.Component { constructor(props) { super(props); this.state = { }; } render() { return ( <div> <button id="my-shopping-list">My Shopping List</button> <button id="house-inventory">House Inventory</button> </div> ); } } export default Nav;
Fix syntax error in this.state
Fix syntax error in this.state
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -4,9 +4,9 @@ constructor(props) { super(props); - this.state({ + this.state = { - }); + }; }
803e5641c4a473948038645ea494908e60f4d4fe
src/ui/input/input_wrap.jsx
src/ui/input/input_wrap.jsx
import React from 'react'; export default class InputWrap extends React.Component { render() { const { before, focused, isValid, name, icon } = this.props; let blockClassName = `auth0-lock-input-block auth0-lock-input-${name}`; if (!isValid) { blockClassName += " auth0-lock-error"; } let wrapClassName = "auth0-lock-input-wrap"; if (focused && isValid) { wrapClassName += " auth0-lock-focused"; } // NOTE: Ugly hack until we upgrade to React 15 which has better // support for SVG. let iconElement = null; if (typeof icon === "string") { iconElement = <span dangerouslySetInnerHTML={{__html: icon}} />; } else if (icon) { iconElement = icon; } if (iconElement) { wrapClassName += " auth0-lock-input-wrap-with-icon"; } return ( <div className={blockClassName}> {before} <div className={wrapClassName}> {iconElement} {this.props.children} </div> </div> ); } } InputWrap.propTypes = { before: React.PropTypes.element, children: React.PropTypes.oneOfType([ React.PropTypes.element.isRequired, React.PropTypes.arrayOf(React.PropTypes.element).isRequired ]), focused: React.PropTypes.bool, isValid: React.PropTypes.bool.isRequired, name: React.PropTypes.string.isRequired, svg: React.PropTypes.string };
import React from 'react'; export default class InputWrap extends React.Component { render() { const { after, before, focused, isValid, name, icon } = this.props; let blockClassName = `auth0-lock-input-block auth0-lock-input-${name}`; if (!isValid) { blockClassName += " auth0-lock-error"; } let wrapClassName = "auth0-lock-input-wrap"; if (focused && isValid) { wrapClassName += " auth0-lock-focused"; } // NOTE: Ugly hack until we upgrade to React 15 which has better // support for SVG. let iconElement = null; if (typeof icon === "string") { iconElement = <span dangerouslySetInnerHTML={{__html: icon}} />; } else if (icon) { iconElement = icon; } if (iconElement) { wrapClassName += " auth0-lock-input-wrap-with-icon"; } return ( <div className={blockClassName}> {before} <div className={wrapClassName}> {iconElement} {this.props.children} </div> {after} </div> ); } } InputWrap.propTypes = { after: React.PropTypes.element, before: React.PropTypes.element, children: React.PropTypes.oneOfType([ React.PropTypes.element.isRequired, React.PropTypes.arrayOf(React.PropTypes.element).isRequired ]), focused: React.PropTypes.bool, isValid: React.PropTypes.bool.isRequired, name: React.PropTypes.string.isRequired, svg: React.PropTypes.string };
Add after prop to InputWrap
Add after prop to InputWrap This will allow to show a validation hint.
JSX
mit
mike-casas/lock,mike-casas/lock,mike-casas/lock
--- +++ @@ -3,7 +3,7 @@ export default class InputWrap extends React.Component { render() { - const { before, focused, isValid, name, icon } = this.props; + const { after, before, focused, isValid, name, icon } = this.props; let blockClassName = `auth0-lock-input-block auth0-lock-input-${name}`; if (!isValid) { blockClassName += " auth0-lock-error"; @@ -35,12 +35,14 @@ {iconElement} {this.props.children} </div> + {after} </div> ); } } InputWrap.propTypes = { + after: React.PropTypes.element, before: React.PropTypes.element, children: React.PropTypes.oneOfType([ React.PropTypes.element.isRequired,
f2bca1bdc04260c0268c307f14245d3bd00c2311
src/js/app.jsx
src/js/app.jsx
import React from 'react'; import { connect } from 'react-redux'; import { showMonster } from '../redux/actions'; import MonsterList from './monsterlist'; import Monster from './monster' const App = React.createClass({ propTypes: { allMonsters: React.PropTypes.array.isRequired }, render () { let monster = this.props.visibleStatBlock ? <Monster monster={this.props.visibleStatBlock} /> : null; return ( <div> <MonsterList allMonsters={this.props.allMonsters} onToggleMonster={this._toggleMonster} /> {monster} </div> ); }, _toggleMonster (arrayKey) { this.props.dispatch({type:'SHOW_MONSTER', key:arrayKey}); } }); function select(state) { return { allMonsters: state.allMonsters, visibleStatBlock: state.visibleStatBlock }; } // Wrap the component to inject dispatch and state into it export default connect(select)(App);
import React from 'react'; import { connect } from 'react-redux'; import { showMonster } from '../redux/actions'; import MonsterList from './monsterlist'; import Monster from './monster' const App = React.createClass({ propTypes: { allMonsters: React.PropTypes.array.isRequired, visibleStatBlock: React.PropTypes.object }, render () { let monster = this.props.visibleStatBlock ? <Monster monster={this.props.visibleStatBlock} /> : null; return ( <div> <MonsterList allMonsters={this.props.allMonsters} onToggleMonster={this._toggleMonster} /> {monster} </div> ); }, _toggleMonster (arrayKey) { this.props.dispatch({type:'SHOW_MONSTER', key:arrayKey}); } }); function select(state) { return state; } // Wrap the component to inject dispatch and state into it export default connect(select)(App);
Add proptypes and simplify select
Add proptypes and simplify select
JSX
mit
jkrayer/summoner,jkrayer/summoner
--- +++ @@ -6,7 +6,8 @@ const App = React.createClass({ propTypes: { - allMonsters: React.PropTypes.array.isRequired + allMonsters: React.PropTypes.array.isRequired, + visibleStatBlock: React.PropTypes.object }, render () { let monster = this.props.visibleStatBlock ? <Monster monster={this.props.visibleStatBlock} /> : null; @@ -23,10 +24,7 @@ }); function select(state) { - return { - allMonsters: state.allMonsters, - visibleStatBlock: state.visibleStatBlock - }; + return state; } // Wrap the component to inject dispatch and state into it
02077028997db9f3248bc9d1256762ccd729da5b
src/cesium/CesiumProjectContents.jsx
src/cesium/CesiumProjectContents.jsx
import React, {Component} from "react"; import BillboardCollection from "cesium/Source/Scene/BillboardCollection"; import CesiumBillboard from "./primitives/CesiumBillboard"; export class CesiumProjectContents extends Component { constructor(props) { super(props); this.billboards = new BillboardCollection(); const {scene} = props; if(scene) { scene.primitives.add(this.billboards); } } componentWillUnmount() { const {billboards} = this; if(!billboards.isDestroyed()) { billboards.destroy(); } const {scene} = this.props; if(scene && !scene.isDestroyed() && scene.primitives) { scene.primitives.remove(billboards); } } render() { const {icons = []} = this.props; const renderedBillboards = icons.map( (icon, index) => <CesiumBillboard {...icon} billboards={this.billboards} key={index} /> ); return ( <span> {renderedBillboards} </span> ); } } export default CesiumProjectContents;
Add a CesiumContents component to render many billboards
Add a CesiumContents component to render many billboards
JSX
mit
markerikson/cesium-react-webpack-demo,markerikson/cesium-react-webpack-demo
--- +++ @@ -0,0 +1,55 @@ +import React, {Component} from "react"; + +import BillboardCollection from "cesium/Source/Scene/BillboardCollection"; + +import CesiumBillboard from "./primitives/CesiumBillboard"; + +export class CesiumProjectContents extends Component { + constructor(props) { + super(props); + + this.billboards = new BillboardCollection(); + + const {scene} = props; + + if(scene) { + scene.primitives.add(this.billboards); + } + } + + componentWillUnmount() { + const {billboards} = this; + + if(!billboards.isDestroyed()) { + billboards.destroy(); + } + + const {scene} = this.props; + + if(scene && !scene.isDestroyed() && scene.primitives) { + scene.primitives.remove(billboards); + } + } + + render() { + const {icons = []} = this.props; + + const renderedBillboards = icons.map( (icon, index) => + <CesiumBillboard + {...icon} + billboards={this.billboards} + key={index} + /> + ); + + + return ( + <span> + {renderedBillboards} + </span> + ); + } +} + + +export default CesiumProjectContents;
8e7bde93dc6b352c32b034ad00b005977ddd8e63
app/js/main.jsx
app/js/main.jsx
import Action from './action' import Chat from './components/chat.jsx' import LogList from './components/log_list.jsx' import UnitGroup from './components/unit_group.jsx' import Clock from './stores/clock' import {LogStore} from './stores/log' import UnitGroupStore, {UNIT_GROUP_PLAYER, UNIT_GROUP_AI} from './stores/unit_group' const action = new Action(global.SERVER_URL) const clock = new Clock(action) const logStore = new LogStore(action) const playerUnitGroupStore = new UnitGroupStore(action, UNIT_GROUP_PLAYER) const aiUnitGroupStore = new UnitGroupStore(action, UNIT_GROUP_AI) global.action = action React.render( <div> <UnitGroup unitGroup={playerUnitGroupStore} clock={clock} /> <UnitGroup unitGroup={aiUnitGroupStore} clock={clock} /> <LogList log={logStore} /> <Chat action={action} /> </div>, document.getElementById('crescent') )
import Action from './action' import Chat from './components/chat.jsx' import LogList from './components/log_list.jsx' import UnitGroup from './components/unit_group.jsx' import Clock from './stores/clock' import {LogStore} from './stores/log' import UnitGroupStore, {UNIT_GROUP_PLAYER, UNIT_GROUP_AI} from './stores/unit_group' const action = new Action(global.SERVER_URL) const clock = new Clock(action) const logStore = new LogStore(action) const playerUnitGroupStore = new UnitGroupStore(action, UNIT_GROUP_PLAYER) const aiUnitGroupStore = new UnitGroupStore(action, UNIT_GROUP_AI) React.render( <div> <UnitGroup unitGroup={playerUnitGroupStore} clock={clock} /> <UnitGroup unitGroup={aiUnitGroupStore} clock={clock} /> <LogList log={logStore} /> <Chat action={action} /> </div>, document.getElementById('crescent') )
Remove the action object from global
Remove the action object from global
JSX
mit
etheriqa/crescent-client,etheriqa/crescent-client
--- +++ @@ -12,8 +12,6 @@ const playerUnitGroupStore = new UnitGroupStore(action, UNIT_GROUP_PLAYER) const aiUnitGroupStore = new UnitGroupStore(action, UNIT_GROUP_AI) -global.action = action - React.render( <div> <UnitGroup unitGroup={playerUnitGroupStore} clock={clock} />
9c3c7c971dbe3e66c57524f16811b4a2a2577236
src/components/CartItems.jsx
src/components/CartItems.jsx
var React = require('react'); var ItemName = require('./ItemName.jsx'); var RemoveButton = require('./RemoveButton.jsx'); var CartItems = React.createClass({ render: function () { var _this = this; var itemNames = this.props.items.map(function (item, index) { return ( <li key={index} className="item"> <ItemName value={item.name} isEditable={item.edit} onEdit={_this.props.editItem} /> - <span className="item-quantity">{item.quantity}</span> {item.edit ? <button>ok</button> : <RemoveButton name={item.name} action={_this.props.remove}/>} </li> ); }); return ( <ul> {itemNames} </ul> ); } }); module.exports = CartItems;
var React = require('react'); var ItemName = require('./ItemName.jsx'); var RemoveButton = require('./RemoveButton.jsx'); var CartItems = React.createClass({ render: function () { var itemNames = this.props.items.map((item, index) => { return ( <li key={index} className="item"> <ItemName value={item.name} isEditable={item.edit} onEdit={this.props.editItem} /> - <span className="item-quantity">{item.quantity}</span> {item.edit ? <button>ok</button> : <RemoveButton name={item.name} action={this.props.remove}/>} </li> ); }); return ( <ul> {itemNames} </ul> ); } }); module.exports = CartItems;
Use ES6 arrow functions to avoid 'this' binding
Use ES6 arrow functions to avoid 'this' binding
JSX
mit
rahulbaphana/Reactive-Cart,rahulbaphana/Reactive-Cart
--- +++ @@ -5,13 +5,12 @@ var CartItems = React.createClass({ render: function () { - var _this = this; - var itemNames = this.props.items.map(function (item, index) { + var itemNames = this.props.items.map((item, index) => { return ( <li key={index} className="item"> - <ItemName value={item.name} isEditable={item.edit} onEdit={_this.props.editItem} /> - + <ItemName value={item.name} isEditable={item.edit} onEdit={this.props.editItem} /> - <span className="item-quantity">{item.quantity}</span> - {item.edit ? <button>ok</button> : <RemoveButton name={item.name} action={_this.props.remove}/>} + {item.edit ? <button>ok</button> : <RemoveButton name={item.name} action={this.props.remove}/>} </li> ); });
1e6dd5809a7ac55b8e01ba13c08875445c7f83f8
src/app/App.jsx
src/app/App.jsx
import React, { Component } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { hasValidAuthToken } from './utilities/hasValidAuthToken'; import { userLoggedIn } from './config/actions'; import user from './utilities/user'; const propTypes = { children: PropTypes.node, dispatch: PropTypes.func.isRequired }; class App extends Component { constructor(props) { super(props); this.state = { isCheckingAuthentication: false } } componentWillMount() { this.setState({isCheckingAuthentication: true}); hasValidAuthToken().then(isValid => { if (isValid) { const email = localStorage.getItem("loggedInAs"); if (!email) { console.warn(`Unable to find item 'loggedInAs' from local storage`); return; } user.getPermissions(email).then(userType => { user.setUserState(userType); }); return; } this.setState({isCheckingAuthentication: false}); }) } render() { return ( <div> { this.state.isCheckingAuthentication ? "Loading..." : this.props.children } </div> ) } } App.propTypes = propTypes; export default connect()(App);
import React, { Component } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { hasValidAuthToken } from './utilities/hasValidAuthToken'; import { userLoggedIn } from './config/actions'; import user from './utilities/user'; const propTypes = { children: PropTypes.node, dispatch: PropTypes.func.isRequired }; class App extends Component { constructor(props) { super(props); this.state = { isCheckingAuthentication: false } } componentWillMount() { this.setState({isCheckingAuthentication: true}); hasValidAuthToken().then(isValid => { if (isValid) { const email = localStorage.getItem("loggedInAs"); if (!email) { console.warn(`Unable to find item 'loggedInAs' from local storage`); return; } user.getPermissions(email).then(userType => { user.setUserState(userType); this.setState({isCheckingAuthentication: false}); }); return; } this.setState({isCheckingAuthentication: false}); }) } render() { return ( <div> { this.state.isCheckingAuthentication ? <div className="grid grid--align-center grid--align-self-center grid--full-height"> <div className="loader loader--large loader--dark"></div> </div> : this.props.children } </div> ) } } App.propTypes = propTypes; export default connect()(App);
Fix app not loading and add loader animation
Fix app not loading and add loader animation Former-commit-id: 8b7cd270f37f8d54ba8375b399eb73814aafffe8 Former-commit-id: dda5bd7528e029cc4518918d1743bf4b0c3a44d1 Former-commit-id: efa4e5a9c42c5c3848573dfd092dbececdbf540f
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -32,6 +32,7 @@ user.getPermissions(email).then(userType => { user.setUserState(userType); + this.setState({isCheckingAuthentication: false}); }); return; } @@ -44,7 +45,9 @@ <div> { this.state.isCheckingAuthentication ? - "Loading..." + <div className="grid grid--align-center grid--align-self-center grid--full-height"> + <div className="loader loader--large loader--dark"></div> + </div> : this.props.children }
9fd0699054c1604a9eda8c82175af93a72099847
app/src/components/Navbar/Navbar.jsx
app/src/components/Navbar/Navbar.jsx
import React, {Component} from 'react'; import './Navbar.css'; class Navbar extends Component{ render(){ return( <div className="topnav"> <a href="https://github.com/Roshanjossey/first-contributions/blob/master/README.md">Get Started</a> <a href="#about">About</a> </div> ) } } export default Navbar;
import React, {Component} from 'react'; import './Navbar.css'; class Navbar extends Component{ render(){ return( <div className="topnav"> <a href="https://twitter.com/1stContribution" target="_blank">twitter</a> <a href="https://firstcontributions.herokuapp.com" target="_blank">slack</a> </div> ) } } export default Navbar;
Change links in navbar to point to slach and twitter
Change links in navbar to point to slach and twitter
JSX
mit
lauratavares/first-contributions,Shhzdmrz/first-contributions,Shhzdmrz/first-contributions,dichaves/first-contributions,RickHaan/first-contributions,Abhishekchakru/first-contributions,FearTheFrail/first-contributions,RickHaan/first-contributions,dichaves/first-contributions,lauratavares/first-contributions,Abhishekchakru/first-contributions,FearTheFrail/first-contributions
--- +++ @@ -5,8 +5,8 @@ render(){ return( <div className="topnav"> - <a href="https://github.com/Roshanjossey/first-contributions/blob/master/README.md">Get Started</a> - <a href="#about">About</a> + <a href="https://twitter.com/1stContribution" target="_blank">twitter</a> + <a href="https://firstcontributions.herokuapp.com" target="_blank">slack</a> </div> ) }
5f2dffb39a3688d154220456302129518bcda332
src/components/stage-selector/stage-selector.jsx
src/components/stage-selector/stage-selector.jsx
const classNames = require('classnames'); const PropTypes = require('prop-types'); const React = require('react'); const Box = require('../box/box.jsx'); const CostumeCanvas = require('../costume-canvas/costume-canvas.jsx'); const styles = require('./stage-selector.css'); const StageSelector = props => { const { backdropCount, selected, url, onClick, ...componentProps } = props; return ( <Box className={styles.stageSelector} onClick={onClick} {...componentProps} > <div className={styles.header}> <div className={styles.headerTitle}>Stage</div> </div> <div className={styles.body}> <div className={classNames({ [styles.flexWrapper]: true, [styles.isSelected]: selected })} > {url ? ( <CostumeCanvas className={styles.costumeCanvas} height={44} url={url} width={56} /> ) : null} <div className={styles.label}>Backdrops</div> <div className={styles.count}>{backdropCount}</div> </div> </div> </Box> ); }; StageSelector.propTypes = { backdropCount: PropTypes.number.isRequired, onClick: PropTypes.func, selected: PropTypes.bool.isRequired, url: PropTypes.string }; module.exports = StageSelector;
const classNames = require('classnames'); const PropTypes = require('prop-types'); const React = require('react'); const Box = require('../box/box.jsx'); const CostumeCanvas = require('../costume-canvas/costume-canvas.jsx'); const styles = require('./stage-selector.css'); const StageSelector = props => { const { backdropCount, selected, url, onClick, ...componentProps } = props; return ( <Box className={styles.stageSelector} onClick={onClick} {...componentProps} > <div className={styles.header}> <div className={styles.headerTitle}>Stage</div> </div> <div className={styles.body}> <div className={classNames({ [styles.flexWrapper]: true, [styles.isSelected]: selected })} > {url ? ( <CostumeCanvas className={styles.costumeCanvas} height={42} url={url} width={56} /> ) : null} <div className={styles.label}>Backdrops</div> <div className={styles.count}>{backdropCount}</div> </div> </div> </Box> ); }; StageSelector.propTypes = { backdropCount: PropTypes.number.isRequired, onClick: PropTypes.func, selected: PropTypes.bool.isRequired, url: PropTypes.string }; module.exports = StageSelector;
Use 4x3 ratio for backdrop thumbnail to prevent blank space
Use 4x3 ratio for backdrop thumbnail to prevent blank space
JSX
bsd-3-clause
cwillisf/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui,LLK/scratch-gui,LLK/scratch-gui
--- +++ @@ -33,7 +33,7 @@ {url ? ( <CostumeCanvas className={styles.costumeCanvas} - height={44} + height={42} url={url} width={56} />
3f4d3f020781604aff4170eb251a3bf5caa1cd28
lib/components/input-email/InputEmail.jsx
lib/components/input-email/InputEmail.jsx
import React from 'react'; import { assign, isEmpty, trim } from 'lodash'; import classnames from 'classnames'; import bem from 'bem-classname'; import isValidValueEntered from './validations'; import FieldComponent from '../FieldComponent'; export default class InputEmail extends FieldComponent { onChangeBound = this.onChange.bind(this); constructor(props) { super(props); this.state = assign({}, this.state, { value: props.value }); } renderViewMode(baseClassName: string) { return ( <div className={bem(baseClassName, 'InputEmail__View')}> {this.props.value} </div> ); } renderEditMode(baseClassName: string) { const className = classnames( bem(baseClassName, 'InputEmail__Edit', { error: !this.isValid() }), this.props.className ); return ( <input className={className} ref={(el) => this.element = el} type='email' value={this.state.value} name={this.name} placeholder={this.props.placeholder} onChange={this.onChangeBound} autoComplete={'off'} /> ); } getValue() { return this.state.value; } isValid() { return true; } onChange(event: React.SyntheticEvent<HTMLInputElement>) { this.setState({ value: event.currentTarget.value }); if (this.props.onChange) { this.props.onChange(value); } } }
import React from 'react'; import { assign, isEmpty, trim } from 'lodash'; import classnames from 'classnames'; import bem from 'bem-classname'; import isValidValueEntered from './validations'; import FieldComponent from '../FieldComponent'; export default class InputEmail extends FieldComponent { onChangeBound = this.onChange.bind(this); constructor(props) { super(props); this.state = assign({}, this.state, { value: props.value }); } renderViewMode(baseClassName: string) { return ( <div className={bem(baseClassName, 'InputEmail__View')}> {this.props.value} </div> ); } renderEditMode(baseClassName: string) { const className = classnames( bem(baseClassName, 'InputEmail__Edit', { error: !this.isValid() }), this.props.className ); return ( <input className={className} ref={(el) => this.element = el} type='email' value={this.state.value} name={this.name} placeholder={this.props.placeholder} onChange={this.onChangeBound} autoComplete={'off'} /> ); } getValue() { return this.state.value; } isValid() { return true; } onChange(event: React.SyntheticEvent<HTMLInputElement>) { const value = event.currentTarget.value; this.setState({ value: value }); if (this.props.onChange) { this.props.onChange(value); } } }
Fix issue in input email component
Fix issue in input email component
JSX
mit
drioemgaoin/react-responsive-form,drioemgaoin/react-responsive-form
--- +++ @@ -49,7 +49,9 @@ } onChange(event: React.SyntheticEvent<HTMLInputElement>) { - this.setState({ value: event.currentTarget.value }); + const value = event.currentTarget.value; + + this.setState({ value: value }); if (this.props.onChange) { this.props.onChange(value);
213e18f18ddaaf80b8897acb436b56617f8c92e7
src/components/elements/realtime-switch.jsx
src/components/elements/realtime-switch.jsx
import React from 'react'; import { connect } from 'react-redux'; import { updateFrontendPreferences, home } from '../../redux/action-creators'; const RealtimeSwitch = (props) => ( <div className={'realtime-switch' + (props.frontendPreferences.realtimeActive ? ' on' : ' off')}> <div className="realtime-switch-label">Realtime updates</div> <div className="realtime-switch-range" onClick={() => props.toggle(props.userId, props.frontendPreferences)}> <div className="realtime-switch-state">{props.frontendPreferences.realtimeActive ? 'on' : 'off'}</div> <div className="realtime-switch-toggle"></div> </div> </div> ); const mapStateToProps = (state) => { return { userId: state.user.id, frontendPreferences: state.user.frontendPreferences }; }; const mapDispatchToProps = (dispatch) => { return { toggle: (userId, frontendPreferences) => { const realtimeActive = !frontendPreferences.realtimeActive; // Submit new preferences dispatch(updateFrontendPreferences(userId, { ...frontendPreferences, realtimeActive })); // Reload home feed if realtime activated if (realtimeActive) { dispatch(home()); } } }; }; export default connect(mapStateToProps, mapDispatchToProps)(RealtimeSwitch);
import React from 'react'; import { connect } from 'react-redux'; import { updateFrontendPreferences, home } from '../../redux/action-creators'; const RealtimeSwitch = (props) => ( <div className={'realtime-switch' + (props.frontendPreferences.realtimeActive ? ' on' : ' off')}> <div className="realtime-switch-label">Realtime updates</div> <div className="realtime-switch-range" onClick={props.handleClick}> <div className="realtime-switch-state">{props.frontendPreferences.realtimeActive ? 'on' : 'off'}</div> <div className="realtime-switch-toggle"></div> </div> </div> ); const mapStateToProps = (state) => { return { userId: state.user.id, frontendPreferences: state.user.frontendPreferences }; }; const mapDispatchToProps = (dispatch) => { return { toggle: (userId, frontendPreferences) => { const realtimeActive = !frontendPreferences.realtimeActive; // Submit new preferences dispatch(updateFrontendPreferences(userId, { ...frontendPreferences, realtimeActive })); // Reload home feed if realtime activated if (realtimeActive) { dispatch(home()); } } }; }; const mergeProps = (stateProps, dispatchProps) => { return { ...stateProps, handleClick: () => dispatchProps.toggle(stateProps.userId, stateProps.frontendPreferences) }; }; export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(RealtimeSwitch);
Replace arrow function with prepared prop in RealtimeSwitch
[jsx-no-bind] Replace arrow function with prepared prop in RealtimeSwitch
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -6,7 +6,7 @@ const RealtimeSwitch = (props) => ( <div className={'realtime-switch' + (props.frontendPreferences.realtimeActive ? ' on' : ' off')}> <div className="realtime-switch-label">Realtime updates</div> - <div className="realtime-switch-range" onClick={() => props.toggle(props.userId, props.frontendPreferences)}> + <div className="realtime-switch-range" onClick={props.handleClick}> <div className="realtime-switch-state">{props.frontendPreferences.realtimeActive ? 'on' : 'off'}</div> <div className="realtime-switch-toggle"></div> </div> @@ -36,4 +36,11 @@ }; }; -export default connect(mapStateToProps, mapDispatchToProps)(RealtimeSwitch); +const mergeProps = (stateProps, dispatchProps) => { + return { + ...stateProps, + handleClick: () => dispatchProps.toggle(stateProps.userId, stateProps.frontendPreferences) + }; +}; + +export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(RealtimeSwitch);
0796575aca7072c01b2e0978eae981593c03a7c2
templates/scaffolds/component/component.jsx
templates/scaffolds/component/component.jsx
import React from 'react'; import './{{name}}.less'; type Props = { } class {{name}} extends React.Component { description: '{{description}}' props: Props constructor(props: Props) { super(props); } /* Component Custom Methods */ /* End Component Custom Methods */ /* React Component LifeCycle Methods */ //componentWillMount() {} //componentDidMount() {} //componentWillReceiveProps(nextProps) {} //shouldComponentUpdate(nextProps, nextState) {} //componentWillUpdate(nextProps, nextState) {} //componentDidUpdate(prevProps, prevState) {} //componentWillUnmount() {} render() { return ( <div className="{{class}}"> <h1>{{name}}</h1> <p>{{description}}</p> </div> ); } /* End React Component LifeCycle Methods */ } export default {{name}}; //Unit test entry point export const _{{name}} = {{name}};
import React from 'react'; import './{{name}}.less'; type Props = { } class {{name}} extends React.Component { description: '{{description}}' props: Props constructor(props: Props) { super(props); } /* Component Custom Methods */ /* End Component Custom Methods */ /* React Component LifeCycle Methods */ //componentWillMount() {} //componentDidMount() {} //componentWillReceiveProps(nextProps) {} //shouldComponentUpdate(nextProps, nextState) {} //componentWillUpdate(nextProps, nextState) {} //componentDidUpdate(prevProps, prevState) {} //componentWillUnmount() {} render() { return ( <div className="{{class}}"> <h1>{{name}}</h1> <p>{{description}}</p> </div> ); } /* End React Component LifeCycle Methods */ } export default {{name}}; //Unit test entry point export const _{{name}} = {{name}};
Remove spacing on compinent scaffold
Remove spacing on compinent scaffold
JSX
mit
111StudioKK/lambda-cli,111StudioKK/lambda-cli
--- +++ @@ -1,7 +1,5 @@ import React from 'react'; - import './{{name}}.less'; - type Props = {
9731569807cde71e802beca8b45a3e40e0f8a356
src/specs/css-module.spec.jsx
src/specs/css-module.spec.jsx
import React from 'react'; import { lorem } from './util'; const IS_BROWSER = typeof(window) !== 'undefined'; let css; if (IS_BROWSER) { css = require('./css-module.module.css'); console.log("css", css); } const CssSample = () => ( <div className="css-module-sample"> <p>{ lorem(50) }</p> <p>{ lorem(50) }</p> </div> ); describe('css-module', function() { this.header(`## Webpack CSS modules.`); before(() => { this .component( <CssSample/> ); }); });
import React from 'react'; import { lorem } from './util'; const IS_BROWSER = typeof(window) !== 'undefined'; let css; if (IS_BROWSER) { // css = require('./css-module.module.css'); // console.log("css", css); } const CssSample = () => ( <div className="css-module-sample"> <p>{ lorem(50) }</p> <p>{ lorem(50) }</p> </div> ); describe('css-module', function() { this.header(`## Webpack CSS modules.`); before(() => { this .component( <CssSample/> ); }); });
Comment out failing module reference.
Comment out failing module reference.
JSX
mit
philcockfield/ui-harness,philcockfield/ui-harness,philcockfield/ui-harness
--- +++ @@ -4,8 +4,8 @@ const IS_BROWSER = typeof(window) !== 'undefined'; let css; if (IS_BROWSER) { - css = require('./css-module.module.css'); - console.log("css", css); + // css = require('./css-module.module.css'); + // console.log("css", css); }