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
cb101a631f9d39970b9be919502bff957ddf383d
common/app/routes/Hikes/components/Hike.jsx
common/app/routes/Hikes/components/Hike.jsx
import React, { PropTypes } from 'react'; import { Col, Panel, Row } from 'react-bootstrap'; import Lecture from './Lecture.jsx'; import Questions from './Questions.jsx'; export default React.createClass({ displayName: 'Hike', propTypes: { currentHike: PropTypes.object, showQuestions: PropTypes.bool }, renderBody(showQuestions) { if (showQuestions) { return <Questions />; } return <Lecture />; }, render() { const { currentHike: { title } = {}, showQuestions } = this.props; const videoTitle = <h2>{ title }</h2>; return ( <Col xs={ 12 }> <Row> <Panel className={ 'text-center' } title={ videoTitle }> { this.renderBody(showQuestions) } </Panel> </Row> </Col> ); } });
import React, { PropTypes } from 'react'; import { Col, Panel, Row } from 'react-bootstrap'; import Lecture from './Lecture.jsx'; import Questions from './Questions.jsx'; export default React.createClass({ displayName: 'Hike', propTypes: { currentHike: PropTypes.object, showQuestions: PropTypes.bool }, renderBody(showQuestions) { if (showQuestions) { return <Questions />; } return <Lecture />; }, render() { const { currentHike: { title } = {}, showQuestions } = this.props; const videoTitle = <h4>{ title }</h4>; return ( <Col xs={ 12 }> <Row> <Panel className={ 'text-center' } header={ videoTitle } title={ title }> { this.renderBody(showQuestions) } </Panel> </Row> </Col> ); } });
Fix title for panel This fixes hover object Object issue
Fix title for panel This fixes hover object Object issue
JSX
bsd-3-clause
BhaveshSGupta/FreeCodeCamp,raisedadead/FreeCodeCamp,tmashuang/FreeCodeCamp,1111113j8Pussy420/https-github.com-raisedadead-freeCodeCamp,matthew-t-smith/freeCodeCamp,no-stack-dub-sack/freeCodeCamp,1111113j8Pussy420/https-github.com-raisedadead-freeCodeCamp,tmashuang/FreeCodeCamp,sakthik26/FreeCodeCamp,no-stack-dub-sack/freeCodeCamp,BrendanSweeny/FreeCodeCamp,systimotic/FreeCodeCamp,HKuz/FreeCodeCamp,BhaveshSGupta/FreeCodeCamp,systimotic/FreeCodeCamp,pahosler/freecodecamp,Munsterberg/freecodecamp,TheeMattOliver/FreeCodeCamp,Munsterberg/freecodecamp,matthew-t-smith/freeCodeCamp,FreeCodeCampQuito/FreeCodeCamp,BerkeleyTrue/FreeCodeCamp,jonathanihm/freeCodeCamp,techstonia/FreeCodeCamp,BrendanSweeny/FreeCodeCamp,pahosler/freecodecamp,sakthik26/FreeCodeCamp,DusanSacha/FreeCodeCamp,raisedadead/FreeCodeCamp,HKuz/FreeCodeCamp,otavioarc/freeCodeCamp,codeman869/FreeCodeCamp,TheeMattOliver/FreeCodeCamp,jonathanihm/freeCodeCamp,FreeCodeCamp/FreeCodeCamp,MiloATH/FreeCodeCamp,BerkeleyTrue/FreeCodeCamp,codeman869/FreeCodeCamp,techstonia/FreeCodeCamp,FreeCodeCampQuito/FreeCodeCamp,FreeCodeCamp/FreeCodeCamp,BhaveshSGupta/FreeCodeCamp,DusanSacha/FreeCodeCamp,otavioarc/freeCodeCamp,MiloATH/FreeCodeCamp
--- +++ @@ -29,14 +29,15 @@ showQuestions } = this.props; - const videoTitle = <h2>{ title }</h2>; + const videoTitle = <h4>{ title }</h4>; return ( <Col xs={ 12 }> <Row> <Panel className={ 'text-center' } - title={ videoTitle }> + header={ videoTitle } + title={ title }> { this.renderBody(showQuestions) } </Panel> </Row>
e03ae05b1c2e7b1ce8b7120d5e3832cc1088f33a
src/field/or/ask_social_network_or_email.jsx
src/field/or/ask_social_network_or_email.jsx
import React from 'react'; import Screen from '../../core/screen'; import EmailPane from '../email/email_pane'; import SocialButtonsPane from '../social/social_buttons_pane'; import PaneSeparator from '../../core/pane_separator'; import { requestPasswordlessEmail } from '../../connection/passwordless/actions'; import { renderEmailSentConfirmation } from '../../connection/passwordless/email_sent_confirmation'; import { renderSignedInConfirmation } from '../../core/signed_in_confirmation'; const Component = ({i18n, model, t}) => ( <div> <SocialButtonsPane labelFn={i18n.str} lock={model} signUp={false} smallButtonsHeader={t("smallSocialButtonsHeader", {__textOnly: true})} /> <PaneSeparator>{t("separatorText")}</PaneSeparator> <EmailPane lock={model} placeholder={t("emailInputPlaceholder", {__textOnly: true})} /> </div> ); export default class AskSocialNetworkOrEmail extends Screen { constructor() { super("networkOrEmail"); } submitHandler() { return requestPasswordlessEmail; } renderAuxiliaryPane(lock) { return renderEmailSentConfirmation(lock) || renderSignedInConfirmation(lock); } render() { return Compoent; } }
import React from 'react'; import Screen from '../../core/screen'; import EmailPane from '../email/email_pane'; import SocialButtonsPane from '../social/social_buttons_pane'; import PaneSeparator from '../../core/pane_separator'; import { requestPasswordlessEmail } from '../../connection/passwordless/actions'; import { renderEmailSentConfirmation } from '../../connection/passwordless/email_sent_confirmation'; import { renderSignedInConfirmation } from '../../core/signed_in_confirmation'; // TODO: review when bringing passwordless back const Component = ({i18n, model}) => ( <div> <SocialButtonsPane instructions={i18n.html("socialLoginInstructions")} labelFn={i18n.str} lock={model} signUp={false} /> <PaneSeparator /> <EmailPane lock={model} placeholder={i18n.str("emailInputPlaceholder")} /> </div> ); export default class AskSocialNetworkOrEmail extends Screen { constructor() { super("networkOrEmail"); } submitHandler() { return requestPasswordlessEmail; } renderAuxiliaryPane(lock) { return renderEmailSentConfirmation(lock) || renderSignedInConfirmation(lock); } render() { return Compoent; } }
Use i18n prop in AskSocialNetworkOrEmail
Use i18n prop in AskSocialNetworkOrEmail
JSX
mit
mike-casas/lock,mike-casas/lock,mike-casas/lock
--- +++ @@ -8,18 +8,19 @@ import { renderEmailSentConfirmation } from '../../connection/passwordless/email_sent_confirmation'; import { renderSignedInConfirmation } from '../../core/signed_in_confirmation'; -const Component = ({i18n, model, t}) => ( +// TODO: review when bringing passwordless back +const Component = ({i18n, model}) => ( <div> <SocialButtonsPane + instructions={i18n.html("socialLoginInstructions")} labelFn={i18n.str} lock={model} signUp={false} - smallButtonsHeader={t("smallSocialButtonsHeader", {__textOnly: true})} /> - <PaneSeparator>{t("separatorText")}</PaneSeparator> + <PaneSeparator /> <EmailPane lock={model} - placeholder={t("emailInputPlaceholder", {__textOnly: true})} + placeholder={i18n.str("emailInputPlaceholder")} /> </div> );
9932b983fb6ae04399bd7a3ecf506b6c191356fa
src/components/navbar/Navbar.jsx
src/components/navbar/Navbar.jsx
import React, { Component } from 'react' import { Link } from 'react-router-dom' import { Button, Layout, Menu } from 'antd' import routes from '../../config/routes' import './style.css' const { Header } = Layout class Navbar extends Component { renderLinks() { const links = [ { to: routes.root, text: 'Home' }, { to: routes.register, text: 'Register' }, ] return links.map(link => (<Menu.Item key={link.text}> <Link to={link.to}>{link.text}</Link> </Menu.Item>), ) } render() { return ( <Header className="navbarHeader"> <div className="navbarLogo" /> <Menu theme="dark" mode="horizontal" defaultSelectedKeys={['Home']} className="navbarMenu" > {this.renderLinks()} </Menu> <Link to={routes.logout} className="navbarLogout"> <Button icon="logout"> Log out </Button> </Link> </Header> ) } } export default Navbar
import React, { Component } from 'react' import { Link } from 'react-router-dom' import { Button, Layout, Menu } from 'antd' import routes from '../../config/routes' import { history } from '../../store' import './style.css' const { Header } = Layout class Navbar extends Component { renderLinks() { const links = [ { to: routes.root, text: 'Home' }, { to: routes.register, text: 'Register' }, ] return links.map(link => (<Menu.Item key={link.text}> <Link to={link.to}>{link.text}</Link> </Menu.Item>), ) } renderLogout() { const isLogoutRequired = history.location.pathname !== '/login' && history.location.pathname !== '/register' return isLogoutRequired ? ( <Link to={routes.logout} className="navbarLogout"> <Button icon="logout"> Log out </Button> </Link> ) : ( null ) } render() { return ( <Header className="navbarHeader"> <div className="navbarLogo" /> <Menu theme="dark" mode="horizontal" defaultSelectedKeys={['Home']} className="navbarMenu" > {this.renderLinks()} </Menu> {this.renderLogout()} </Header> ) } } export default Navbar
Hide logout button when the user is on the login or register page
Hide logout button when the user is on the login or register page
JSX
mit
awi2017-option1group3/Prello-Client,awi2017-option1group3/Prello-Client
--- +++ @@ -1,7 +1,9 @@ import React, { Component } from 'react' import { Link } from 'react-router-dom' import { Button, Layout, Menu } from 'antd' + import routes from '../../config/routes' +import { history } from '../../store' import './style.css' const { Header } = Layout @@ -20,6 +22,19 @@ ) } + renderLogout() { + const isLogoutRequired = history.location.pathname !== '/login' && history.location.pathname !== '/register' + return isLogoutRequired ? ( + <Link to={routes.logout} className="navbarLogout"> + <Button icon="logout"> + Log out + </Button> + </Link> + ) : ( + null + ) + } + render() { return ( <Header className="navbarHeader"> @@ -32,11 +47,7 @@ > {this.renderLinks()} </Menu> - <Link to={routes.logout} className="navbarLogout"> - <Button icon="logout"> - Log out - </Button> - </Link> + {this.renderLogout()} </Header> ) }
f65204718a193d0d753a9de0aa66636d2a7e9e1a
lib/steps_components/options/OptionElement.jsx
lib/steps_components/options/OptionElement.jsx
import styled from 'styled-components'; import defaultTheme from '../../theme'; const OptionElement = styled.a` background: ${({ theme }) => theme.botBubbleColor}; border-radius: 22px; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); color: ${({ theme }) => theme.botFontColor}; display: inline-block; font-size: 14px; padding: 12px; &:hover { opacity: 0.7; } `; OptionElement.defaultProps = { theme: defaultTheme }; export default OptionElement;
import styled from 'styled-components'; import defaultTheme from '../../theme'; const OptionElement = styled.button` background: ${({ theme }) => theme.botBubbleColor}; border: 0; border-radius: 22px; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); color: ${({ theme }) => theme.botFontColor}; display: inline-block; font-size: 14px; padding: 12px; &:hover { opacity: 0.7; } &:active, &:hover:focus { outline:none; } `; OptionElement.defaultProps = { theme: defaultTheme }; export default OptionElement;
Use button for option element - Enables keyboard navigation.
Use button for option element - Enables keyboard navigation.
JSX
mit
LucasBassetti/react-simple-chatbot,LucasBassetti/react-simple-chatbot
--- +++ @@ -1,8 +1,9 @@ import styled from 'styled-components'; import defaultTheme from '../../theme'; -const OptionElement = styled.a` +const OptionElement = styled.button` background: ${({ theme }) => theme.botBubbleColor}; + border: 0; border-radius: 22px; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); color: ${({ theme }) => theme.botFontColor}; @@ -13,6 +14,10 @@ &:hover { opacity: 0.7; } + &:active, + &:hover:focus { + outline:none; + } `; OptionElement.defaultProps = {
f6e6f1db006b3681f16dcbb92e3ea6a98ecf7477
app/components/Access.jsx
app/components/Access.jsx
import React from 'react'; const Access = React.createClass({ render() { return <div className="content-container"> <h1 className="main-header">Enter the unique code to access to access your KJs song list. </h1> </div> } }) export default Access;
import React from 'react'; import TextField from 'material-ui/TextField'; import FlatButton from 'material-ui/FlatButton'; const Access = React.createClass({ render() { const inputStyle = { borderColor: '#F4AF1D' }; return <div className="content-container"> <h1 className="main-header">Enter the unique code to access to access your KJ's song list. </h1> <TextField underlineFocusStyle={inputStyle}/> <FlatButton label="View songs" /> </div> } }) export default Access;
Add input and flat button to access
Add input and flat button to access
JSX
mit
spanningtime/voque,spanningtime/voque
--- +++ @@ -1,11 +1,19 @@ import React from 'react'; +import TextField from 'material-ui/TextField'; +import FlatButton from 'material-ui/FlatButton'; const Access = React.createClass({ render() { + const inputStyle = { + borderColor: '#F4AF1D' + }; + return <div className="content-container"> - <h1 className="main-header">Enter the unique code to access to access your KJs song list. + <h1 className="main-header">Enter the unique code to access to access your KJ's song list. </h1> + <TextField underlineFocusStyle={inputStyle}/> + <FlatButton label="View songs" /> </div> } })
fa333a26649ddb6d4498e710d6f60080f4ceffaa
client/src/components/UserList.jsx
client/src/components/UserList.jsx
import React from 'react'; import { Link } from 'react-router-dom'; const UserList = (props) => { return ( <div> {props.addUser.map((user)=>(<div className="user" key={user} onClick={props.passInCooks}>Continue as <Link to="/inventory">{user}</Link></div>))} <div>or <Link to="/users">go back</Link> and select a different user.</div> </div> ); }; export default UserList;
import React from 'react'; import { Link } from 'react-router-dom'; const UserList = (props) => { if (props.clicked) { console.log('true click: ', props.addUser); return ( <div> <div>Continue as: </div> {props.addUser.map((user)=>(<div key={user} onClick={props.passInCooks}><Link to="/inventory">{user}</Link></div>))} <div>or <Link to="/users">go back</Link> and select a different user.</div> </div> ); } else { console.log('false click'); return ( <div> <div>or <Link to="/users">go back</Link> and select a different user.</div> </div> ); } }; export default UserList;
Add conditional rendering based on whether Submit button has been clicked
Add conditional rendering based on whether Submit button has been clicked
JSX
mit
SentinelsOfMagic/SentinelsOfMagic
--- +++ @@ -2,12 +2,23 @@ import { Link } from 'react-router-dom'; const UserList = (props) => { - return ( - <div> - {props.addUser.map((user)=>(<div className="user" key={user} onClick={props.passInCooks}>Continue as <Link to="/inventory">{user}</Link></div>))} - <div>or <Link to="/users">go back</Link> and select a different user.</div> - </div> - ); + if (props.clicked) { + console.log('true click: ', props.addUser); + return ( + <div> + <div>Continue as: </div> + {props.addUser.map((user)=>(<div key={user} onClick={props.passInCooks}><Link to="/inventory">{user}</Link></div>))} + <div>or <Link to="/users">go back</Link> and select a different user.</div> + </div> + ); + } else { + console.log('false click'); + return ( + <div> + <div>or <Link to="/users">go back</Link> and select a different user.</div> + </div> + ); + } }; export default UserList;
a03971de6795a7e197ec2861d146fdc8c0c71d35
app/components/elements/TagList.jsx
app/components/elements/TagList.jsx
import React from 'react'; import { Link } from 'react-router'; import DropdownMenu from 'app/components/elements/DropdownMenu'; export default ({post, horizontal}) => { let json = post.json_metadata; let tags = [] try { if(typeof json == 'object') { tags = json.tags || [] } else { tags = json && JSON.parse(json).tags || []; } } catch(e) { tags = [] } // Category should always be first. tags.unshift(post.category) // Uniqueness filter. tags = tags.filter( (value, index, self) => value && (self.indexOf(value) === index) ) if (horizontal) { // show it as a dropdown in Preview const list = tags.map( tag => <Link to={`/trending/${tag}`}> {tag} </Link>) return <div className="TagList__horizontal">{list}</div>; } else { if(tags.length == 1) { return <Link to={`/trending/${tags[0]}`}>{tags[0]}</Link> } else { const list = tags.map(function (tag) {return {value: tag, link: '/trending/' + tag}}); return <DropdownMenu selected={' '+tags[0]} className="TagList" items={list} el="div"/>; } } }
import React from 'react'; import { Link } from 'react-router'; import DropdownMenu from 'app/components/elements/DropdownMenu'; export default ({post, horizontal}) => { let json = post.json_metadata; let tags = [] try { if(typeof json == 'object') { tags = json.tags || [] } else { tags = json && JSON.parse(json).tags || []; } } catch(e) { tags = [] } // Category should always be first. tags.unshift(post.category) // Uniqueness filter. tags = tags.filter( (value, index, self) => value && (self.indexOf(value) === index) ) if (horizontal) { // show it as a dropdown in Preview const list = tags.map( (tag,idx) => <Link to={`/trending/${tag}`} key={idx}> {tag} </Link>) return <div className="TagList__horizontal">{list}</div>; } else { if(tags.length == 1) { return <Link to={`/trending/${tags[0]}`}>{tags[0]}</Link> } else { const list = tags.map(function (tag) {return {value: tag, link: '/trending/' + tag}}); return <DropdownMenu selected={' '+tags[0]} className="TagList" items={list} el="div"/>; } } }
Fix unique ID bug in tag mapping
Fix unique ID bug in tag mapping Uniquely identify each child by assigning it a key.
JSX
mit
TimCliff/steemit.com,TimCliff/steemit.com,steemit-intl/steemit.com,steemit/steemit.com,GolosChain/tolstoy,steemit/steemit.com,steemit/steemit.com,GolosChain/tolstoy,enisey14/platform,steemit-intl/steemit.com,TimCliff/steemit.com,GolosChain/tolstoy,enisey14/platform
--- +++ @@ -23,7 +23,7 @@ tags = tags.filter( (value, index, self) => value && (self.indexOf(value) === index) ) if (horizontal) { // show it as a dropdown in Preview - const list = tags.map( tag => <Link to={`/trending/${tag}`}> {tag} </Link>) + const list = tags.map( (tag,idx) => <Link to={`/trending/${tag}`} key={idx}> {tag} </Link>) return <div className="TagList__horizontal">{list}</div>; } else { if(tags.length == 1) {
14fcf75e7ce7a66e42123ee0e56e689588e754b3
src/components/App.jsx
src/components/App.jsx
/* Главный компонент приложения */ import React from "react"; import MenuScreen from "./MenuScreen/MenuScreen.js"; import GameScreen from "./GameScreen/GameScreen.js"; import { connect } from "react-redux"; import {MENU_SCREEN, GAME_SCREEN} from "../actions/ScreenActions.js"; const App = React.createClass({ PropTypes: { currentScreen: React.PropTypes.string, gameGrid: React.PropTypes.array, victoryStatistics: React.PropTypes.object }, renderScreen(screen) { switch(screen) { case GAME_SCREEN: return ( <GameScreen cellValues={this.props.gameGrid} dispatch={this.props.dispatch} victoryStatistics={this.props.victoryStatistics} />); case MENU_SCREEN: default: return <MenuScreen dispatch={this.props.dispatch}/> } }, render () { return this.renderScreen(this.props.currentScreen); } }); function select(state) { return { currentScreen: state.screen, gameGrid: state.game.gameGrid, victoryStatistics: state.game.victoryStatistics } } export default connect(select)(App);
/* Главный компонент приложения */ import React from "react"; import MenuScreen from "./MenuScreen/MenuScreen.js"; import GameScreen from "./GameScreen/GameScreen.js"; import { connect } from "react-redux"; import {MENU_SCREEN, GAME_SCREEN} from "../actions/ScreenActions.js"; const App = React.createClass({ PropTypes: { currentScreen: React.PropTypes.string, gameGrid: React.PropTypes.array, victoryStatistics: React.PropTypes.object }, renderScreen(screen) { switch(screen) { case GAME_SCREEN: return ( <GameScreen cellValues={this.props.gameGrid} dispatch={this.props.dispatch} victoryStatistics={this.props.victoryStatistics} />); case MENU_SCREEN: default: return <MenuScreen dispatch={this.props.dispatch}/> } }, render () { return this.renderScreen(this.props.currentScreen); } }); function select(state) { return { currentScreen: state.screen, gameGrid: state.game.get("gameGrid").toJS(), victoryStatistics: state.game.get("victoryStatistics").toJS() } } export default connect(select)(App);
Update select, to extract data from immutable structure
Update select, to extract data from immutable structure
JSX
mit
Lingvokot/Tic-Tac-Toe-React,Lingvokot/Tic-Tac-Toe-React,Lingvokot/Tic-Tac-Toe-React
--- +++ @@ -36,8 +36,8 @@ function select(state) { return { currentScreen: state.screen, - gameGrid: state.game.gameGrid, - victoryStatistics: state.game.victoryStatistics + gameGrid: state.game.get("gameGrid").toJS(), + victoryStatistics: state.game.get("victoryStatistics").toJS() } }
3f2231bc0fd95460ad206af6ecc3a861ef39aa5f
client/components/UserProfile.jsx
client/components/UserProfile.jsx
import React from 'react'; import UserAnalytics from './UserAnalytics.jsx'; import $ from 'jquery'; export default class UserProfile extends React.Component { constructor(props) { super(props); this.state = { showTextAnalytics: true, textData: [], }; } handleTextClick() { $.get('/text', { username: this.props.user }) .done((data) => { this.setState({ showTextAnalytics: true, textData: data, }); }) .fail((err) => { throw new Error('Could not retrieve text information', err); }); } handleSpeechClick() { this.setState({ showTextAnalytics: false, }); } render() { const onTextClick = this.handleTextClick.bind(this); const onSpeechClick = this.handleSpeechClick.bind(this); return ( <div> <button onClick={onTextClick}>Text Analytics</button> <button onClick={onSpeechClick}>Speech Analytics</button> <UserAnalytics textData={this.state.textData} /> </div> ); } } UserProfile.propTypes = { user: React.PropTypes.string, };
import React from 'react'; import UserAnalytics from './UserAnalytics.jsx'; import $ from 'jquery'; export default class UserProfile extends React.Component { constructor(props) { super(props); this.state = { showTextAnalytics: null, textData: [], }; } handleTextClick() { $.get('/text', { username: this.props.user }) .done((data) => { this.setState({ showTextAnalytics: true, textData: data, }); }) .fail((err) => { throw new Error('Could not retrieve text information', err); }); } handleSpeechClick() { this.setState({ showTextAnalytics: false, }); } render() { const onTextClick = this.handleTextClick.bind(this); const onSpeechClick = this.handleSpeechClick.bind(this); return ( <div> <button onClick={onTextClick}>Text Analytics</button> <button onClick={onSpeechClick}>Speech Analytics</button> { this.state.showTextAnalytics ? <UserAnalytics textData={this.state.textData} /> : <div></div> } </div> ); } } UserProfile.propTypes = { user: React.PropTypes.string, };
Add terniary condition to render UserAnalytics component when user has not selected view choice yet
Add terniary condition to render UserAnalytics component when user has not selected view choice yet
JSX
mit
nonchalantkettle/SpeechDoctor,alexxisroxxanne/SpeechDoctor,nonchalantkettle/SpeechDoctor,alexxisroxxanne/SpeechDoctor
--- +++ @@ -6,7 +6,7 @@ constructor(props) { super(props); this.state = { - showTextAnalytics: true, + showTextAnalytics: null, textData: [], }; } @@ -37,7 +37,11 @@ <div> <button onClick={onTextClick}>Text Analytics</button> <button onClick={onSpeechClick}>Speech Analytics</button> - <UserAnalytics textData={this.state.textData} /> + { + this.state.showTextAnalytics ? + <UserAnalytics textData={this.state.textData} /> : + <div></div> + } </div> ); }
4b2959d35c9660ad07a0a392f181b4d3b27190ee
src/react-chayns-list/component/ListItem.jsx
src/react-chayns-list/component/ListItem.jsx
import React from 'react'; import PropTypes from 'prop-types'; import ExpandableListItem from './ListItem/ExpandableListItem'; import SimpleListItem from './ListItem/ListItem'; const ListItem = ({ hideIndicator, children, ...props, }) => { if (children) { return ( <ExpandableListItem hideIndicator={hideIndicator} {...props} > {children} </ExpandableListItem> ); } return ( <SimpleListItem {...props} /> ); }; ListItem.propTypes = { children: PropTypes.oneOfType([ PropTypes.node, PropTypes.arrayOf(PropTypes.node) ]), notExpandable: PropTypes.bool, }; ListItem.defaultProps = { children: null, notExpandable: false, }; export default ListItem;
import React from 'react'; import PropTypes from 'prop-types'; import ExpandableListItem from './ListItem/ExpandableListItem'; import SimpleListItem from './ListItem/ListItem'; const ListItem = ({ hideIndicator, children, ...props, }) => { if (children) { return ( <ExpandableListItem hideIndicator={hideIndicator} {...props} > {children} </ExpandableListItem> ); } return ( <SimpleListItem {...props} /> ); }; ListItem.propTypes = { children: PropTypes.oneOfType([ PropTypes.node, PropTypes.arrayOf(PropTypes.node) ]), hideIndicator: PropTypes.bool, }; ListItem.defaultProps = { children: null, hideIndicator: false, }; export default ListItem;
Fix propType for wrong prop
Fix propType for wrong prop
JSX
mit
TobitSoftware/chayns-components,TobitSoftware/chayns-components,TobitSoftware/chayns-components
--- +++ @@ -30,12 +30,12 @@ PropTypes.node, PropTypes.arrayOf(PropTypes.node) ]), - notExpandable: PropTypes.bool, + hideIndicator: PropTypes.bool, }; ListItem.defaultProps = { children: null, - notExpandable: false, + hideIndicator: false, }; export default ListItem;
0e118c1549a0f2af75ab3672602729ef29fdbcb2
typesetter/static/jsx/main.jsx
typesetter/static/jsx/main.jsx
var DynamicSearch = React.createClass({ getInitialState: function() { return {searchString: ''}; }, handleChange: function(event) { var searchString = event.target.value; var url = this.props.source + searchString.trim().toLowerCase(); if (searchString.length > 2) { this.serverRequest = $.get(url, function(results) { this.setState({ results: results, searchString: searchString }); }.bind(this)); } else { this.setState({ results: null, searchString: searchString }); } }, render: function() { var results = this.state.results || []; return ( <span className="input input--yoko"> <input className="input__field input__field--yoko" id="input-0" type="text" value={this.state.searchString} onChange={this.handleChange}/> <label className="input__label input__label--yoko" for="input-0"> <span className="input__label-content input__label-content--yoko">Letters to use?</span> </label> <ul> {results.map(function(result) { return <li className={result.category} key={result.word}>{result.word}</li> })} </ul> </span> ) } }); ReactDOM.render( <DynamicSearch source="http://127.0.0.1:5000/api/search/"/>, document.getElementById('content') );
var DynamicSearch = React.createClass({ getInitialState: function() { return {searchString: ''}; }, handleChange: function(event) { var searchString = event.target.value; var url = this.props.source + searchString.trim().toLowerCase(); if (searchString.length > 2) { this.serverRequest = $.get(url, function(results) { this.setState({ results: results, searchString: searchString }); }.bind(this)); } else { this.setState({ results: null, searchString: searchString }); } }, render: function() { var results = this.state.results || []; return ( <span className="input input--yoko"> <input className="input__field input__field--yoko" id="input-0" type="text" value={this.state.searchString} onChange={this.handleChange}/> <label className="input__label input__label--yoko" for="input-0"> <span className="input__label-content input__label-content--yoko">Letters to use?</span> </label> <ul> {results.map(function(result) { return <li className={result.category} key={result.word}>{result.word}</li> })} </ul> </span> ) } }); ReactDOM.render( <DynamicSearch source="/api/search/"/>, document.getElementById('content') );
Use a relative URL for searching
Use a relative URL for searching
JSX
mit
rlucioni/typesetter,rlucioni/typesetter,rlucioni/typesetter
--- +++ @@ -45,6 +45,6 @@ ReactDOM.render( - <DynamicSearch source="http://127.0.0.1:5000/api/search/"/>, + <DynamicSearch source="/api/search/"/>, document.getElementById('content') );
71cbbccc237a69e6f9fe4e625a2d1fbceac5a388
src/components/AccountView.jsx
src/components/AccountView.jsx
import styles from '../styles/accountView' import React from 'react' import PassphraseForm from './PassphraseForm' import InputText from './InputText' import InputEmail from './InputEmail' import SelectBox from './SelectBox' const AccountView = (props) => { const { t } = props // specific to passphrase form const { onPassphraseSubmit, passphraseErrors, passphraseSubmitting, updateInfos, infosSubmitting, isFetching, instance } = props if (isFetching) { return <p>Loading...</p> } const attributes = !instance.data ? instance.data.attributes : {} return ( <div className={styles['account-view']}> <h2>{t('AccountView.title')}</h2> <InputEmail inputData='email' setValue={attributes.email || ''} updateInfos={updateInfos} infosSubmitting={infosSubmitting} t={t} /> <InputText inputData='public_name' setValue={attributes.public_name || ''} updateInfos={updateInfos} infosSubmitting={infosSubmitting} t={t} /> <PassphraseForm onPassphraseSubmit={onPassphraseSubmit} currentPassErrors={passphraseErrors || []} passphraseSubmitting={passphraseSubmitting} t={t} /> <SelectBox inputData='locale' setValue={attributes.locale || ''} updateInfos={updateInfos} infosSubmitting={infosSubmitting} t={t} /> </div> ) } export default AccountView
import styles from '../styles/accountView' import React from 'react' import PassphraseForm from './PassphraseForm' import InputText from './InputText' import InputEmail from './InputEmail' import SelectBox from './SelectBox' const AccountView = (props) => { const { t } = props // specific to passphrase form const { onPassphraseSubmit, passphraseErrors, passphraseSubmitting, updateInfos, infosSubmitting, isFetching, instance } = props if (isFetching) { return <p>Loading...</p> } const attributes = instance.data.attributes return ( <div className={styles['account-view']}> <h2>{t('AccountView.title')}</h2> <InputEmail inputData='email' setValue={attributes.email || ''} updateInfos={updateInfos} infosSubmitting={infosSubmitting} t={t} /> <InputText inputData='public_name' setValue={attributes.public_name || ''} updateInfos={updateInfos} infosSubmitting={infosSubmitting} t={t} /> <PassphraseForm onPassphraseSubmit={onPassphraseSubmit} currentPassErrors={passphraseErrors || []} passphraseSubmitting={passphraseSubmitting} t={t} /> <SelectBox inputData='locale' setValue={attributes.locale || ''} updateInfos={updateInfos} infosSubmitting={infosSubmitting} t={t} /> </div> ) } export default AccountView
Undo previous fix on instance that caused another bug
[fix] Undo previous fix on instance that caused another bug
JSX
agpl-3.0
y-lohse/cozy-settings,y-lohse/cozy-settings
--- +++ @@ -15,7 +15,7 @@ return <p>Loading...</p> } - const attributes = !instance.data ? instance.data.attributes : {} + const attributes = instance.data.attributes return ( <div className={styles['account-view']}>
ba01826622d0fcdc0a3d50cac39ecb258ad3f4cb
src/components/CirclePageNavBar.jsx
src/components/CirclePageNavBar.jsx
import React from 'react'; import { Navbar, Nav, NavItem, NavDropdown, MenuItem } from 'react-bootstrap'; export default class CirclePageNavBar extends React.Component { openPage(e) { location.href = e.target.getAttribute('href'); } render() { return ( <Navbar inverse collapseOnSelect fixedTop> <Navbar.Header> <Navbar.Brand> <a href="/">Henge</a> </Navbar.Brand> <Navbar.Toggle /> </Navbar.Header> <Navbar.Collapse> <Nav> <NavItem href="/circles/" onClick={this.openPage}>Circles</NavItem> <NavItem href="/stories/ja/" onClick={this.openPage}>Stories</NavItem> </Nav> </Navbar.Collapse> </Navbar> ); } }
import React from 'react'; import { Navbar, Nav, NavItem, NavDropdown, MenuItem } from 'react-bootstrap'; export default class CirclePageNavBar extends React.Component { openPage(e) { location.href = e.target.getAttribute('href'); } render() { const iconStyle = { fill: '#9d9d9d', width: '18px', height: '18px', marginRight: '6px', }; return ( <Navbar inverse collapseOnSelect fixedTop> <Navbar.Header> <Navbar.Brand> <a href="/"> <svg role="img" style={iconStyle}> <use xmlnsXlink="http://www.w3.org/1999/xlink" xlinkHref="/imgs/svg/sprite.svg#icon"></use> </svg> Henge</a> </Navbar.Brand> <Navbar.Toggle /> </Navbar.Header> <Navbar.Collapse> <Nav> <NavItem href="/circles/" onClick={this.openPage}>Circles</NavItem> <NavItem href="/stories/ja/" onClick={this.openPage}>Stories</NavItem> </Nav> </Navbar.Collapse> </Navbar> ); } }
Add icon to the header
Add icon to the header
JSX
mit
henge-tech/henge-tech,henge-tech/henge-tech,henge-tech/henge-tech,henge-tech/henge-tech
--- +++ @@ -7,11 +7,21 @@ } render() { + const iconStyle = { + fill: '#9d9d9d', + width: '18px', + height: '18px', + marginRight: '6px', + }; return ( <Navbar inverse collapseOnSelect fixedTop> <Navbar.Header> - <Navbar.Brand> - <a href="/">Henge</a> + <Navbar.Brand> + <a href="/"> + <svg role="img" style={iconStyle}> + <use xmlnsXlink="http://www.w3.org/1999/xlink" xlinkHref="/imgs/svg/sprite.svg#icon"></use> + </svg> + Henge</a> </Navbar.Brand> <Navbar.Toggle /> </Navbar.Header>
94330c3b94a25ec1709cefb2559fc51af5c5e58b
src/treemap/Treemap.jsx
src/treemap/Treemap.jsx
'use strict'; var React = require('react'); var Chart = require('../common').Chart; module.exports = React.createClass({ propTypes: { margins: React.PropTypes.object, data: React.PropTypes.array, width: React.PropTypes.number, height: React.PropTypes.number, title: React.PropTypes.string, textColor: React.PropTypes.string, fontSize: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.number ]) }, getDefaultProps() { return { data: [], width: 400, heigth: 200, title: '', textColor: '#f7f7f7', fontSize: '0.85em' }; }, render() { var props = this.props; return ( <Chart title={props.title} width={props.width} height={props.height} > <g className='rd3-treemap'> <DataSeries width={props.width} height={props.height} data={props.data} textColor={props.textColor} fontSize={props.fontSize} /> </g> </Chart> ); } }); exports.Treemap = Treemap;
'use strict'; var React = require('react'); var Chart = require('../common').Chart; var DataSeries = require('./DataSeries'); module.exports = React.createClass({ propTypes: { margins: React.PropTypes.object, data: React.PropTypes.array, width: React.PropTypes.number, height: React.PropTypes.number, title: React.PropTypes.string, textColor: React.PropTypes.string, fontSize: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.number ]) }, getDefaultProps() { return { data: [], width: 400, heigth: 200, title: '', textColor: '#f7f7f7', fontSize: '0.85em' }; }, render() { var props = this.props; return ( <Chart title={props.title} width={props.width} height={props.height} > <g className='rd3-treemap'> <DataSeries width={props.width} height={props.height} data={props.data} textColor={props.textColor} fontSize={props.fontSize} /> </g> </Chart> ); } });
Update treemap test for new project structure
Update treemap test for new project structure
JSX
mit
nicolasyanncouturier/react-d3,TannerRogalsky/react-d3,captainamerican/react-d3,ovjhc/react-d3,nnnnathann/react-d3,Keepsite/react-d3,captainamerican/react-d3,nightlyop/react-d3,orls/react-d3,sprintly/react-d3,yashprit/react-d3,yang-wei/rd3,Clemency10/react-d3,ernest-rhinozeros/react-d3,banzai-inc/react-d3,ernest-rhinozeros/react-d3,ovjhc/react-d3,reactiva/react-d3,Jonekee/react-d3,sprintly/react-d3,Keepsite/react-d3,BigDataSamuli/react-d3,kdoh/react-d3,vladikoff/react-d3,reactiva/react-d3,banzai-inc/react-d3,Clemency10/react-d3,esbullington/react-d3,nicolasyanncouturier/react-d3,MargiePea/react-d3,vladikoff/react-d3,BigDataSamuli/react-d3,florapdx/react-d3,esbullington/react-d3,nnnnathann/react-d3,yashprit/react-d3,TannerRogalsky/react-d3,mwhite/react-d3,mwhite/react-d3,Jonekee/react-d3,orls/react-d3,florapdx/react-d3,MargiePea/react-d3,nightlyop/react-d3,kdoh/react-d3,tobyredd/rd3,tobyredd/rd3
--- +++ @@ -2,6 +2,7 @@ var React = require('react'); var Chart = require('../common').Chart; +var DataSeries = require('./DataSeries'); module.exports = React.createClass({ @@ -54,5 +55,3 @@ } }); - -exports.Treemap = Treemap;
70f76f10b740926d9a9ac1f8e872188916deec16
src/pages/Ranking/Ranking.jsx
src/pages/Ranking/Ranking.jsx
import React from 'react'; const data = [ {'name': 'Martin', 'score': 1000}, {'name': 'Sabrina', 'score': 900}, {'name': 'Juan', 'score': 800}, {'name': 'Jose', 'score': 700}, {'name': 'Luisa', 'score': 600}, {'name': 'Carlos', 'score': 500}, {'name': 'Pablo', 'score': 400}, {'name': 'Marina', 'score': 300} ]; const ranking = () => { return ( <div style={{ 'background-color': 'rgba(227, 242, 255, 0.6)', 'padding': '20px', 'border': '1px solid lightblue', 'border-radius': '10px'}}a > <h1>RANKING:</h1> { data.map((person, index) => <h1 style={{ 'text-align': 'center', 'padding': '5px', 'display': 'block', 'margin': 'auto'}} key={person.name + index} > <strong>({index + 1})</strong> {person.name} -- {person.score} </h1>) } </div> ); }; export default ranking;
import React from 'react'; const data = [ {'name': 'Martin', 'score': 1000}, {'name': 'Sabrina', 'score': 900}, {'name': 'Juan', 'score': 800}, {'name': 'Jose', 'score': 700}, {'name': 'Luisa', 'score': 600}, {'name': 'Carlos', 'score': 500}, {'name': 'Pablo', 'score': 400}, {'name': 'Marina', 'score': 300} ]; const ranking = () = { return ( <div style={{ 'background-color': 'rgba(227, 242, 255, 0.6)', 'padding': '20px', 'border': '1px solid lightblue', 'border-radius': '10px'}} > <h1>RANKING:</h1> { data.map((person, index) => <h1 style={{ 'text-align': 'center', 'padding': '5px', 'display': 'block', 'margin': 'auto'}} key={person.name + index} > <strong>({index + 1})</strong> {person.name} -- {person.score} </h1>) } </div> ); }; export default ranking;
Test n pre-push hooks error and no warning 2
Test n pre-push hooks error and no warning 2
JSX
mit
martinnajle1/react-tetris,martinnajle1/react-tetris
--- +++ @@ -11,12 +11,12 @@ {'name': 'Marina', 'score': 300} ]; -const ranking = () => { +const ranking = () = { return ( <div style={{ 'background-color': 'rgba(227, 242, 255, 0.6)', 'padding': '20px', 'border': '1px solid lightblue', - 'border-radius': '10px'}}a + 'border-radius': '10px'}} > <h1>RANKING:</h1> { data.map((person, index) =>
408c21408fc94a6f0b3adea6b80f1a2574840435
test/DateBonduariesOptions.jsx
test/DateBonduariesOptions.jsx
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { getISOLocalDate } from './shared/dates'; export default class DateBonduariesOptions extends Component { onMinChange = (event) => { const { value } = event.target; this.props.setState({ minDate: new Date(value) }); } onMaxChange = (event) => { const { value } = event.target; this.props.setState({ maxDate: new Date(value) }); } render() { const { maxDate, minDate } = this.props; return ( <fieldset id="datebonduariesoptions"> <legend htmlFor="viewoptions">Set date externally</legend> <div> <label htmlFor="minDate">Min date</label> <input onChange={this.onMinChange} type="date" value={getISOLocalDate(minDate)} /> </div> <div> <label htmlFor="maxDate">Max date</label> <input onChange={this.onMaxChange} type="date" value={getISOLocalDate(maxDate)} /> </div> </fieldset> ); } } DateBonduariesOptions.propTypes = { maxDate: PropTypes.instanceOf(Date), minDate: PropTypes.instanceOf(Date), setState: PropTypes.func.isRequired, };
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { getISOLocalDate } from './shared/dates'; export default class DateBonduariesOptions extends Component { onMinChange = (event) => { const { value } = event.target; this.props.setState({ minDate: new Date(value) }); } onMaxChange = (event) => { const { value } = event.target; this.props.setState({ maxDate: new Date(value) }); } render() { const { maxDate, minDate, setState } = this.props; return ( <fieldset id="datebonduariesoptions"> <legend htmlFor="viewoptions">Set date externally</legend> <div> <label htmlFor="minDate">Min date</label> <input onChange={this.onMinChange} type="date" value={minDate ? getISOLocalDate(minDate) : ''} />&nbsp; <button onClick={() => setState({ minDate: null })}>Clear</button> </div> <div> <label htmlFor="maxDate">Max date</label> <input onChange={this.onMaxChange} type="date" value={maxDate ? getISOLocalDate(maxDate) : ''} />&nbsp; <button onClick={() => setState({ maxDate: null })}>Clear</button> </div> </fieldset> ); } } DateBonduariesOptions.propTypes = { maxDate: PropTypes.instanceOf(Date), minDate: PropTypes.instanceOf(Date), setState: PropTypes.func.isRequired, };
Add option to clear minDate and maxDate in test suite
Add option to clear minDate and maxDate in test suite
JSX
mit
wojtekmaj/react-calendar,wojtekmaj/react-calendar,wojtekmaj/react-calendar
--- +++ @@ -17,7 +17,7 @@ } render() { - const { maxDate, minDate } = this.props; + const { maxDate, minDate, setState } = this.props; return ( <fieldset id="datebonduariesoptions"> @@ -28,16 +28,18 @@ <input onChange={this.onMinChange} type="date" - value={getISOLocalDate(minDate)} - /> + value={minDate ? getISOLocalDate(minDate) : ''} + />&nbsp; + <button onClick={() => setState({ minDate: null })}>Clear</button> </div> <div> <label htmlFor="maxDate">Max date</label> <input onChange={this.onMaxChange} type="date" - value={getISOLocalDate(maxDate)} - /> + value={maxDate ? getISOLocalDate(maxDate) : ''} + />&nbsp; + <button onClick={() => setState({ maxDate: null })}>Clear</button> </div> </fieldset> );
f44d6616bc380095f3da1b97c77eb6f212907bac
app/components/TimelineEventToolbar.jsx
app/components/TimelineEventToolbar.jsx
'use strict'; import React from 'react'; const TimelineEventToolbar = ({ evt, logModalData, toggleModal }) => ( <div className="tl-toolbar"> <button> <i className="glyphicon glyphicon-edit" onClick={ () => { logModalData(evt); toggleModal(); } } /> </button> <button> <i className="glyphicon glyphicon-share-alt" /> </button> </div> ); export default TimelineEventToolbar;
'use strict'; import React from 'react'; const TimelineEventToolbar = ({ evt, logModalData, toggleModal }) => ( <div className="tl-toolbar"> <button type="button" name="EditEventBtn"> <i className="glyphicon glyphicon-edit" onClick={ () => { logModalData(evt); toggleModal(); } } /> </button> <button type="button" name="SocialShareBtn"> <i className="glyphicon glyphicon-share-alt" /> </button> </div> ); export default TimelineEventToolbar;
Add type='button' attribute to button elements
chore: Add type='button' attribute to button elements
JSX
mit
IsenrichO/react-timeline,IsenrichO/react-timeline
--- +++ @@ -4,12 +4,16 @@ const TimelineEventToolbar = ({ evt, logModalData, toggleModal }) => ( <div className="tl-toolbar"> - <button> + <button + type="button" + name="EditEventBtn"> <i className="glyphicon glyphicon-edit" onClick={ () => { logModalData(evt); toggleModal(); } } /> </button> - <button> + <button + type="button" + name="SocialShareBtn"> <i className="glyphicon glyphicon-share-alt" /> </button> </div>
d56e367b6ea441a0007728c1f3db779282dd7ffc
app/components/URLInput.jsx
app/components/URLInput.jsx
import React from 'react'; import LinkedStateMixin from 'react/lib/LinkedStateMixin'; import validUrl from 'valid-url'; import LinkActions from '../actions/LinkActions'; export default React.createClass({ mixins: [ LinkedStateMixin ], getInitialState: function () { return { text: '' }; }, handleSubmit: function (e) { e.preventDefault(); var text = this.state.text; if (!validUrl.isUri(text)) { return; } LinkActions.addLink({ url: text, id: Date.now() }); this.setState({ text: '' }); }, render: function () { var text = this.state.text; var style = { input: { backgroundColor: text.length > 0 ? (validUrl.isUri(text) ? '#dff0d8' : '#f2dede') : null } }; return ( <form onSubmit={this.handleSubmit}> <input className="url-input" type="text" placeholder="Paste a link" style={style.input} valueLink={this.linkState('text')} /> <button>Post</button> </form> ); } });
import React from 'react'; import LinkedStateMixin from 'react/lib/LinkedStateMixin'; import validUrl from 'valid-url'; import LinkActions from '../actions/LinkActions'; export default React.createClass({ mixins: [ LinkedStateMixin ], getInitialState: function () { return { text: '' }; }, handleSubmit: function (e) { e.preventDefault(); var text = this.state.text; if (!validUrl.isUri(text)) { return; } LinkActions.addLink({ url: text, id: Date.now() }); this.setState({ text: '' }); }, render: function () { var text = this.state.text; var style = { input: { backgroundColor: text.length > 0 ? (validUrl.isUri(text) ? '#dff0d8' : '#f2dede') : null } }; return ( <form onSubmit={this.handleSubmit}> <input className="url-input" type="text" placeholder="Paste a link and hit enter" style={style.input} valueLink={this.linkState('text')} /> <button hidden={true}>Post</button> </form> ); } });
Hide submit button (but still submit on enter).
Hide submit button (but still submit on enter).
JSX
mit
peterjmag/reading-list,peterjmag/reading-list
--- +++ @@ -40,10 +40,10 @@ <input className="url-input" type="text" - placeholder="Paste a link" + placeholder="Paste a link and hit enter" style={style.input} valueLink={this.linkState('text')} /> - <button>Post</button> + <button hidden={true}>Post</button> </form> ); }
7fe2ab05ffcee4152ef1c4aa87bbae7074d8b77e
src/client/components/BoardPost/BoardPost.jsx
src/client/components/BoardPost/BoardPost.jsx
import React from 'react'; import Tooltip from '../Tooltip'; export default ({ post, fetchThread }) => { const {id, title, comment, date, imgsrc, replies} = post; return ( <div id={"t"+id} className="board-post" onClick={() => fetchThread(id)} > <img src={imgsrc.sm} /> <Tooltip> <div className="count"> <span> <span> <i className="mdi mdi-comment-text"></i> <b>{replies.textCount}</b> </span> <span className="updater updater-replycount"> +1 </span> </span> <span> <span> <i className="mdi mdi-message-image"></i> <b>{replies.imgCount}</b> </span> <span className="updater updater-imgcount"> +1 </span> </span> </div> </Tooltip> <div className="op"> <b dangerouslySetInnerHTML={{__html: title}} className="title" /> <div dangerouslySetInnerHTML={{__html: comment}} /> </div> </div> ) }
import React from 'react'; import Tooltip from '../Tooltip'; export default ({ post, fetchThread, reshuffle }) => { const {id, title, comment, date, imgsrc, replies} = post; return ( <div id={"t"+id} className="board-post" onClick={() => fetchThread(id)} > <img src={imgsrc.sm} onLoad={reshuffle}/> <Tooltip> <div className="count"> <span> <span> <i className="mdi mdi-comment-text"></i> <b>{replies.textCount}</b> </span> <span className="updater updater-replycount"> +1 </span> </span> <span> <span> <i className="mdi mdi-message-image"></i> <b>{replies.imgCount}</b> </span> <span className="updater updater-imgcount"> +1 </span> </span> </div> </Tooltip> <div className="op"> <b dangerouslySetInnerHTML={{__html: title}} className="title" /> <div dangerouslySetInnerHTML={{__html: comment}} /> </div> </div> ) }
Fix board posts overlapping by reshuffling after every image loaded
Fix board posts overlapping by reshuffling after every image loaded
JSX
mit
AdamSalma/Lurka,AdamSalma/Lurka
--- +++ @@ -1,7 +1,7 @@ import React from 'react'; import Tooltip from '../Tooltip'; -export default ({ post, fetchThread }) => { +export default ({ post, fetchThread, reshuffle }) => { const {id, title, comment, date, imgsrc, replies} = post; return ( <div @@ -9,7 +9,7 @@ className="board-post" onClick={() => fetchThread(id)} > - <img src={imgsrc.sm} /> + <img src={imgsrc.sm} onLoad={reshuffle}/> <Tooltip> <div className="count"> <span>
59b59a6d47180b34a36ed710bb4893e298667e4d
js/components/ExerciseList.react.jsx
js/components/ExerciseList.react.jsx
var React = require('react'); var PropTypes = React.PropTypes; var {ListGroup,ListGroupItem,ButtonGroup,Row,Col,Button,Glyphicon} = require('react-bootstrap'); var ExerciseList = React.createClass({ propTypes: { doDeleteExercise: PropTypes.func.isRequired, doEditExercise: PropTypes.func.isRequired, exercises: PropTypes.array.isRequired }, render: function() { return ( <ListGroup> {this.props.exercises && this.props.exercises.map((ex) => ( <ListGroupItem key={ex.id}> <Row> <Col lg={9}>{ex.name}</Col> <Col lg={3}> <ButtonGroup className='pull-right'> <Button bsSize='small' onClick={() => this.props.doEditExercise(ex)}><Glyphicon glyph='pencil'/></Button> <Button bsSize='small' onClick={() => this.props.doDeleteExercise(ex)}><Glyphicon glyph='trash'/></Button> </ButtonGroup> </Col> </Row> </ListGroupItem> ))} </ListGroup> ); } }); module.exports = ExerciseList;
var React = require('react'); var PropTypes = React.PropTypes; var {ListGroup,ListGroupItem,ButtonGroup,Row,Col,Button,Glyphicon} = require('react-bootstrap'); var ExerciseList = React.createClass({ propTypes: { doDeleteExercise: PropTypes.func.isRequired, doEditExercise: PropTypes.func.isRequired, exercises: PropTypes.array.isRequired }, render: function() { var exercises = this.props.exercises; return ( <ListGroup> {exercises && Object.keys(exercises).map((ex_id) => { var ex = exercises[ex_id]; return( <ListGroupItem key={ex.id}> <Row> <Col lg={9}>{ex.name}</Col> <Col lg={3}> <ButtonGroup className='pull-right'> <Button bsSize='small' onClick={() => this.props.doEditExercise(ex)}><Glyphicon glyph='pencil'/></Button> <Button bsSize='small' onClick={() => this.props.doDeleteExercise(ex)}><Glyphicon glyph='trash'/></Button> </ButtonGroup> </Col> </Row> </ListGroupItem> ); })} </ListGroup> ); } }); module.exports = ExerciseList;
Change ExerciseList to support exercises as map
Change ExerciseList to support exercises as map
JSX
mit
mapster/tdl-frontend
--- +++ @@ -10,21 +10,25 @@ }, render: function() { + var exercises = this.props.exercises; return ( <ListGroup> - {this.props.exercises && this.props.exercises.map((ex) => ( - <ListGroupItem key={ex.id}> - <Row> - <Col lg={9}>{ex.name}</Col> - <Col lg={3}> - <ButtonGroup className='pull-right'> - <Button bsSize='small' onClick={() => this.props.doEditExercise(ex)}><Glyphicon glyph='pencil'/></Button> - <Button bsSize='small' onClick={() => this.props.doDeleteExercise(ex)}><Glyphicon glyph='trash'/></Button> - </ButtonGroup> - </Col> - </Row> - </ListGroupItem> - ))} + {exercises && Object.keys(exercises).map((ex_id) => { + var ex = exercises[ex_id]; + return( + <ListGroupItem key={ex.id}> + <Row> + <Col lg={9}>{ex.name}</Col> + <Col lg={3}> + <ButtonGroup className='pull-right'> + <Button bsSize='small' onClick={() => this.props.doEditExercise(ex)}><Glyphicon glyph='pencil'/></Button> + <Button bsSize='small' onClick={() => this.props.doDeleteExercise(ex)}><Glyphicon glyph='trash'/></Button> + </ButtonGroup> + </Col> + </Row> + </ListGroupItem> + ); + })} </ListGroup> ); }
c296d1bcfeb4fb1d204f049da6efe774ce398272
frontend/components/topic-input.jsx
frontend/components/topic-input.jsx
import React, { useState } from 'react' import Select from 'react-select'; const TopicInput = (props) => { const [selectedGuides, setSelectedGuides] = useState(props.value || []); const handleSelect = (selected) => { setSelectedGuides(selected); } const topicOptions = Array.from(props.topics); topicOptions.sort(); return( <span> <select type="hidden" name="topic_guides" multiple style={{display:"none"}} value={selectedGuides.map( t => t.value )} > { selectedGuides.map( t => { return ( <option value={t.value} key={t.value}>{t.label}</option> ) }) } </select> <Select name="topics_input" isMulti={true} value={selectedGuides} onChange={handleSelect} options={topicOptions} /> </span> ) } export default TopicInput;
import React, { useState } from 'react' import Select from 'react-select'; const TopicInput = (props) => { const [selectedTopics, setSelectedTopics] = useState(props.value || []); const handleSelect = (selected) => { setSelectedTopics(selected); } const topicOptions = Array.from(props.topics); topicOptions.sort(); return( <span> <select type="hidden" name="topic_guides" multiple style={{display:"none"}} value={selectedTopics.map( t => t.value )} > { selectedTopics.map( t => { return ( <option value={t.value} key={t.value}>{t.label}</option> ) }) } </select> <Select name="topics_input" isMulti={true} value={selectedTopics} onChange={handleSelect} options={topicOptions} /> </span> ) } export default TopicInput;
Make variable names consistent in TopicInput component
Make variable names consistent in TopicInput component
JSX
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
--- +++ @@ -2,10 +2,10 @@ import Select from 'react-select'; const TopicInput = (props) => { - const [selectedGuides, setSelectedGuides] = useState(props.value || []); + const [selectedTopics, setSelectedTopics] = useState(props.value || []); const handleSelect = (selected) => { - setSelectedGuides(selected); + setSelectedTopics(selected); } const topicOptions = Array.from(props.topics); @@ -18,10 +18,10 @@ name="topic_guides" multiple style={{display:"none"}} - value={selectedGuides.map( t => t.value )} + value={selectedTopics.map( t => t.value )} > { - selectedGuides.map( t => { + selectedTopics.map( t => { return ( <option value={t.value} key={t.value}>{t.label}</option> ) @@ -32,7 +32,7 @@ <Select name="topics_input" isMulti={true} - value={selectedGuides} + value={selectedTopics} onChange={handleSelect} options={topicOptions} />
05cee43b6d5998ad1aa263d9534d094be4f2b585
client/components/EmbedCode.jsx
client/components/EmbedCode.jsx
EmbedCode = React.createClass({ componentDidUpdate() { Meteor.call('validatePackageName', this.props.packageOnDisplay, (err, res) => { if (err) { console.log('Error while validating package name', err); return; } if (! res) { this.refs.embedCode.value = 'There is no package by that name.'; } }); }, getEmbedCode() { var packageName = this.props.packageOnDisplay; var iconPath = Meteor.absoluteUrl(`package/${packageName}`); var base = `[![Meteor Icon](${iconPath})](https://atmospherejs.com/`; if (packageName.split(':')[1]) { return base.concat(`${packageName.replace(/\:/, '/')}`); } else { return base.concat(`meteor/${packageName.split(':')[0]})`); } }, render() { return ( <textarea rows="5" cols="50" readOnly="readonly" className="embed-code" ref="embedCode" value={this.getEmbedCode()} /> ); } });
EmbedCode = React.createClass({ componentDidUpdate() { Meteor.call('validatePackageName', this.props.packageOnDisplay, (err, res) => { if (err) { console.log('Error while validating package name', err); return; } if (! res) { this.refs.embedCode.value = 'There is no package by that name.'; } }); }, getEmbedCode() { var packageName = this.props.packageOnDisplay; var iconPath = Meteor.absoluteUrl(`package/${packageName}`); var base = `[![Meteor Icon](${iconPath})](https://atmospherejs.com/`; if (packageName.split(':')[1]) { return base.concat(`${packageName.replace(/\:/, '/')}`); } else { return base.concat(`meteor/${packageName.split(':')[0]})`); } }, selectCode() { this.refs.embedCode.select(); }, render() { return ( <textarea rows="5" cols="50" readOnly="readonly" className="embed-code" ref="embedCode" value={this.getEmbedCode()} onFocus={this.selectCode} /> ); } });
Select the code on focus
Select the code on focus
JSX
mit
sungwoncho/meteor-icon,sungwoncho/meteor-icon
--- +++ @@ -24,6 +24,10 @@ } }, + selectCode() { + this.refs.embedCode.select(); + }, + render() { return ( <textarea rows="5" @@ -31,7 +35,8 @@ readOnly="readonly" className="embed-code" ref="embedCode" - value={this.getEmbedCode()} /> + value={this.getEmbedCode()} + onFocus={this.selectCode} /> ); } });
1afa6558b266504856e867aae00f811b186e169a
client/components/ThreadPost/helpers.jsx
client/components/ThreadPost/helpers.jsx
import React from "react"; export function createImage(ID, SRC) { return ( <div className='img-container' onClick={toggleImage.bind(null, ID, SRC)}> <span className="fullscreen hidden fa-stack fa-sm"> <i className="fa fa-circle fa-stack-2x"></i> <i className="fa fa-expand fa-stack-1x"></i> </span> <img id={ID} src={SRC.sm}/> </div> ) } export function createWebm() { console.log('Webm creation attempted'); } function toggleImage(ID, SRC) { const img = $('#'+ID) const icon = img.prev() if (img.attr('src') === SRC.sm) { // blur image while large image is loading img.addClass('image-loading') .on('load', function(){ img.removeClass('image-loading') .off('load'); icon.removeClass('hidden'); }) img.attr('src', SRC.lg); } else { img.attr('src', SRC.sm); icon.addClass('hidden'); } }
import React from "react"; export function createImage(ID, SRC) { return ( <div className='img-container' onClick={toggleImage.bind(null, ID, SRC)}> <span className="fullscreen hidden fa-stack fa-sm"> <i className="fa fa-circle fa-stack-2x"></i> <i className="fa fa-expand fa-stack-1x"></i> </span> <img id={ID} src={SRC.sm}/> </div> ) } export function createWebm() { console.log('Webm creation attempted'); } function toggleImage(ID, SRC) { const img = $('#'+ID) const icon = img.prev() if (img.attr('src') === SRC.sm) { // blur small image while large image is loading img.addClass('image-loading') .on('load', function(){ // remove blur + show fullscreen icon img.removeClass('image-loading') .off('load'); icon.removeClass('hidden'); }) img.attr('src', SRC.lg); } else { // revert to thumbnail image img.attr('src', SRC.sm); icon.addClass('hidden'); } }
Add comments to animation in ThreadPost
Add comments to animation in ThreadPost
JSX
mit
AdamSalma/Lurka,AdamSalma/Lurka
--- +++ @@ -21,16 +21,18 @@ const icon = img.prev() if (img.attr('src') === SRC.sm) { - // blur image while large image is loading + // blur small image while large image is loading img.addClass('image-loading') .on('load', function(){ - img.removeClass('image-loading') - .off('load'); - icon.removeClass('hidden'); + // remove blur + show fullscreen icon + img.removeClass('image-loading') + .off('load'); + icon.removeClass('hidden'); }) img.attr('src', SRC.lg); } else { + // revert to thumbnail image img.attr('src', SRC.sm); icon.addClass('hidden'); }
124cdaa88d80451c6109daefbda672c561337cf7
src/js/disability-benefits/components/AskVAQuestions.jsx
src/js/disability-benefits/components/AskVAQuestions.jsx
import React from 'react'; class AskVAQuestions extends React.Component { render() { return ( <div className="ask-va-questions claims-sidebar-box"> <h4 className="claims-sidebar-header">Questions?</h4> <p className="talk">Talk to a VA representative:</p> <p className="phone-number"> <a href="tel:+1-855-574-7286">1-855-574-7286</a><br/> Monday - Friday, 8:00 am - 8:00 pm ET </p> <p><a href="https://iris.custhelp.com/">Submit a question to the VA</a></p> </div> ); } } export default AskVAQuestions;
import React from 'react'; class AskVAQuestions extends React.Component { render() { return ( <div className="ask-va-questions claims-sidebar-box"> <h4 className="claims-sidebar-header">Questions?</h4> <p className="talk">Ask the vets.gov Help Desk</p> <p className="phone-number"> <a href="tel:+1-855-574-7286">1-855-574-7286</a><br/> Monday - Friday, 8:00 am - 8:00 pm ET </p> <p><a href="https://iris.custhelp.com/">Submit a question to the VA</a></p> </div> ); } } export default AskVAQuestions;
Change wording of call center info on ask va questions component
Change wording of call center info on ask va questions component
JSX
cc0-1.0
department-of-veterans-affairs/vets-website,department-of-veterans-affairs/vets-website
--- +++ @@ -5,7 +5,7 @@ return ( <div className="ask-va-questions claims-sidebar-box"> <h4 className="claims-sidebar-header">Questions?</h4> - <p className="talk">Talk to a VA representative:</p> + <p className="talk">Ask the vets.gov Help Desk</p> <p className="phone-number"> <a href="tel:+1-855-574-7286">1-855-574-7286</a><br/> Monday - Friday, 8:00 am - 8:00 pm ET
752e592e509e7540cfc716260af40b4ab563ffc1
src/index.jsx
src/index.jsx
import 'babel-polyfill'; import 'velocity-animate'; import './events/setup'; import './styles/global'; import './vendor/polyfills'; import './vendor/nanoscroller'; import '-/config/client.settings'; import React from 'react'; import ReactDOM from 'react-dom'; import App from './modules/App'; ReactDOM.render(<App />, document.querySelector('#App'));
import 'babel-polyfill'; import 'velocity-animate'; import 'nanoscroller'; import './sass/base.scss'; import './events/setup'; import './utils/polyfills'; import '-/config/client.settings'; import React from 'react'; import ReactDOM from 'react-dom'; import App from './modules/App'; ReactDOM.render(<App />, document.querySelector('#App'));
Update sass and polyfill imports
fix: Update sass and polyfill imports
JSX
mit
AdamSalma/Lurka,AdamSalma/Lurka
--- +++ @@ -1,10 +1,10 @@ import 'babel-polyfill'; import 'velocity-animate'; +import 'nanoscroller'; +import './sass/base.scss'; import './events/setup'; -import './styles/global'; -import './vendor/polyfills'; -import './vendor/nanoscroller'; +import './utils/polyfills'; import '-/config/client.settings'; import React from 'react';
391dbdffaa75692d1e9c911cd61b5f9b4bee2c45
app/scripts/components/home/home.jsx
app/scripts/components/home/home.jsx
import React from 'react'; import { Link } from 'react-router-dom'; import Countdown from './countdown.jsx'; import Quote from './quote.jsx'; export default function Home() { return ( <> <div className="wrapper text"> Well hello there! <br /> Unfortunately, there&apos;s not that much interesting here... <br /> <br /> This site was developed a while back using React, for the purpose of learning and testing new features, and acquiring basic knowledge about Webpack, Babel, Node and other web development technologies. For more information about me, click&nbsp; <Link to="/about">here</Link> &nbsp;or feel free to follow the social links at the bottom of the page. <br /> <br /> <a href="https://github.com/benct/tomlin-web/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer"> Version 2.7.2 </a> </div> <hr /> <Countdown /> <hr /> <Quote /> </> ); }
import React from 'react'; import { Link } from 'react-router-dom'; import Countdown from './countdown.jsx'; import Quote from './quote.jsx'; export default function Home() { return ( <> <div className="wrapper text"> Well hello there! <br /> Unfortunately, there&apos;s not that much interesting here... <br /> <br /> This site was developed a while back using React, for the purpose of learning and testing new features and acquiring basic knowledge about Webpack, Babel, Node and other web development technologies. More information about me can be found under the <Link to="/about">about</Link> tab, or feel free to follow the social links at the bottom of the page. <br /> <br /> <a href="https://github.com/benct/tomlin-web/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer"> Version 2.7.2 </a> </div> <hr /> <Countdown /> <hr /> <Quote /> </> ); }
Make link more descriptive to improve accessibility
Make link more descriptive to improve accessibility
JSX
mit
benct/tomlin-web,benct/tomlin-web
--- +++ @@ -13,10 +13,9 @@ Unfortunately, there&apos;s not that much interesting here... <br /> <br /> - This site was developed a while back using React, for the purpose of learning and testing new features, and acquiring basic - knowledge about Webpack, Babel, Node and other web development technologies. For more information about me, click&nbsp; - <Link to="/about">here</Link> - &nbsp;or feel free to follow the social links at the bottom of the page. + This site was developed a while back using React, for the purpose of learning and testing new features and acquiring basic + knowledge about Webpack, Babel, Node and other web development technologies. More information about me can be found under + the <Link to="/about">about</Link> tab, or feel free to follow the social links at the bottom of the page. <br /> <br /> <a href="https://github.com/benct/tomlin-web/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer">
3ffa092d1a8ddcad1f64992fd06599b3b55e0b7f
src/ui/components/DatasetDetail/StreamEditor.jsx
src/ui/components/DatasetDetail/StreamEditor.jsx
"use strict"; const React = require('react'); const { Card, CardHeader, CardMedia, CardText } = require('material-ui/Card'); const Divider = require('material-ui/Divider').default; const { StreamPlot } = require('../Plot'); const StreamTransformationPicker = require('./StreamTransformationPicker.jsx'); const firstValues = (s) => s.slice(0, 100).map(v => v.toString()).join(' '); class StreamEditor extends React.Component { render() { const { stream, transformedStream, transformation, onTransformationChange } = this.props; return ( <Card> <CardHeader title='Stream'/> <CardMedia> <StreamPlot stream={transformedStream}/> </CardMedia> <CardText> Stream: { firstValues(stream) }... </CardText> <CardText> Transformed Stream: { firstValues(transformedStream) }... </CardText> <Divider/> <CardMedia> <StreamTransformationPicker transformation={transformation} onChange={onTransformationChange}/> </CardMedia> </Card> ); } } StreamEditor.propTypes = { stream: React.PropTypes.array.isRequired, transformedStream: React.PropTypes.array.isRequired, transformation: React.PropTypes.object.isRequired, onTransformationChange: React.PropTypes.func.isRequired, }; module.exports = StreamEditor;
"use strict"; const React = require('react'); const { Card, CardHeader, CardMedia, CardText } = require('material-ui/Card'); const Divider = require('material-ui/Divider').default; const { StreamPlot } = require('../Plot'); const StreamTransformationPicker = require('./StreamTransformationPicker.jsx'); const firstValues = (s) => s.slice(0, 10).map(v => v.toString()).join(', '); class StreamEditor extends React.Component { render() { const { stream, transformedStream, transformation, onTransformationChange } = this.props; return ( <Card> <CardHeader title='Stream'/> <CardMedia> <StreamPlot stream={transformedStream}/> </CardMedia> <CardText> Stream: { firstValues(stream) }... ({stream.length} values) </CardText> <CardText> Transformed Stream: { firstValues(transformedStream) }... ({transformedStream.length} values) </CardText> <Divider/> <CardMedia> <StreamTransformationPicker transformation={transformation} onChange={onTransformationChange}/> </CardMedia> </Card> ); } } StreamEditor.propTypes = { stream: React.PropTypes.array.isRequired, transformedStream: React.PropTypes.array.isRequired, transformation: React.PropTypes.object.isRequired, onTransformationChange: React.PropTypes.func.isRequired, }; module.exports = StreamEditor;
Change shown stream values (temp only)
Change shown stream values (temp only)
JSX
apache-2.0
FrantisekGazo/PCA-Viewer,FrantisekGazo/PCA-Viewer
--- +++ @@ -8,7 +8,7 @@ const StreamTransformationPicker = require('./StreamTransformationPicker.jsx'); -const firstValues = (s) => s.slice(0, 100).map(v => v.toString()).join(' '); +const firstValues = (s) => s.slice(0, 10).map(v => v.toString()).join(', '); class StreamEditor extends React.Component { @@ -24,11 +24,11 @@ </CardMedia> <CardText> - Stream: { firstValues(stream) }... + Stream: { firstValues(stream) }... ({stream.length} values) </CardText> <CardText> - Transformed Stream: { firstValues(transformedStream) }... + Transformed Stream: { firstValues(transformedStream) }... ({transformedStream.length} values) </CardText> <Divider/>
c01c7832fcf0494149c8b81bf13417bfc42190db
src/rooms/containers/addRoomForm.container.jsx
src/rooms/containers/addRoomForm.container.jsx
import React, { Component } from 'react'; import { Button, Input, Col, Row } from 'react-materialize'; import { reduxForm, reset } from 'redux-form'; import { addRoom } from '../actions/rooms.action.js'; class AddRoomForm extends Component { addRoom(newRoomObj) { console.log(newRoomObj, this); const {addRoom, dispatch} = this.props; addRoom(newRoomObj); dispatch(reset('AddRoomForm')); } render() { const { fields: { roomName, size, notes }, handleSubmit } = this.props; return ( <form onSubmit={ handleSubmit(this.addRoom.bind(this)) } > <Col s={12}> <Row> <Input type="text" placeholder="Room Name" s={6} label="Room Name" { ...roomName } /> <Input type="text" placeholder="Size" s={6} label="Size" { ...size } /> </Row> <Row> <div class="input-field col s12"> <label for="textarea1">Notes</label> <textarea id="textarea1" className="materialize-textarea" placeholder="Notes" { ...notes }></textarea> </div> </Row> </Col> <Button type="submit">Submit</Button> </form> ); } } export default reduxForm({ form: 'AddRoomForm', fields: ['roomName', 'size', 'notes'], }, null, { addRoom })(AddRoomForm); function mapDispatchToProps(dispatch) { return bindActionCreators(null, dispatch); }
import React, { Component } from 'react'; import { Button, Input, Col, Row } from 'react-materialize'; import { reduxForm } from 'redux-form'; import { addRoom } from '../actions/rooms.action.js'; class AddRoomForm extends Component { render() { const { fields: { roomName, size, notes }, handleSubmit } = this.props; return ( <form onSubmit={ handleSubmit(this.props.addRoom) } > <Col s={12}> <Row> <Input type="text" placeholder="Room Name" s={6} label="Room Name" { ...roomName } /> <Input type="text" placeholder="Size" s={6} label="Size" { ...size } /> </Row> <Row> <div class="input-field col s12"> <label for="textarea1">Notes</label> <textarea id="textarea1" className="materialize-textarea" placeholder="Notes" { ...notes }></textarea> </div> </Row> </Col> <Button type="submit">Submit</Button> </form> ); } } export default reduxForm({ form: 'AddRoomForm', fields: ['roomName', 'size', 'notes'], }, null, { addRoom })(AddRoomForm);
Revert "fix(add room form): submit now clears form"
Revert "fix(add room form): submit now clears form" This reverts commit 993c8f795e746ecc17bb31ca473d586ca4c4f98f.
JSX
mit
Nailed-it/Designify,Nailed-it/Designify
--- +++ @@ -1,21 +1,14 @@ import React, { Component } from 'react'; import { Button, Input, Col, Row } from 'react-materialize'; -import { reduxForm, reset } from 'redux-form'; +import { reduxForm } from 'redux-form'; import { addRoom } from '../actions/rooms.action.js'; class AddRoomForm extends Component { - addRoom(newRoomObj) { - console.log(newRoomObj, this); - const {addRoom, dispatch} = this.props; - addRoom(newRoomObj); - dispatch(reset('AddRoomForm')); - } - render() { const { fields: { roomName, size, notes }, handleSubmit } = this.props; return ( - <form onSubmit={ handleSubmit(this.addRoom.bind(this)) } > + <form onSubmit={ handleSubmit(this.props.addRoom) } > <Col s={12}> <Row> <Input type="text" placeholder="Room Name" s={6} label="Room Name" { ...roomName } /> @@ -38,7 +31,3 @@ form: 'AddRoomForm', fields: ['roomName', 'size', 'notes'], }, null, { addRoom })(AddRoomForm); - -function mapDispatchToProps(dispatch) { - return bindActionCreators(null, dispatch); -}
12f461be3f29469ec0dd0b591ed9acfab14341f2
src/js/app/view/item_detail_page.jsx
src/js/app/view/item_detail_page.jsx
define(function(require) { "use strict"; var React = require("react"); var ListItemView= require("jsx!app/view/list_item"); /** * * * */ var ItemListPage = React.createClass({ getInitialState: function() { return { }; }, componentWillMount: function() {}, componentDidMount: function() {}, componentWillUnmount: function() {}, render: function() { return ( <div className="detail"> <p>Name: {this.props.model.get("name")}</p> <p>Age: {this.props.model.get("age")}</p> <p>From: {this.props.model.get("from")}</p> <a href="/">back</a> </div> ); } }); // end ItemListPage return ItemListPage; });
define(function(require) { "use strict"; var React = require("react"); var ListItemView= require("jsx!app/view/list_item"); /** * * * */ var ItemDetailPage = React.createClass({ getInitialState: function() { return { }; }, componentWillMount: function() {}, componentDidMount: function() {}, componentWillUnmount: function() {}, render: function() { return ( <div className="detail"> <p>Name: {this.props.model.get("name")}</p> <p>Age: {this.props.model.get("age")}</p> <p>From: {this.props.model.get("from")}</p> <a href="/">back</a> </div> ); } }); // end ItemDetailPage return ItemDetailPage; });
Fix naming if ItemDetailPageView class
Fix naming if ItemDetailPageView class
JSX
mit
apdev/web-application-skeleton
--- +++ @@ -11,7 +11,7 @@ * * */ - var ItemListPage = React.createClass({ + var ItemDetailPage = React.createClass({ getInitialState: function() { return { @@ -35,7 +35,7 @@ ); } - }); // end ItemListPage + }); // end ItemDetailPage - return ItemListPage; + return ItemDetailPage; });
a9c2e8e4106e5a22a0cc6e4dac6b812008b81d94
src/components/range-input.jsx
src/components/range-input.jsx
/** @jsx React.DOM */ var ValidatedNumberInput = require("../components/validated-number-input.jsx"); /* A minor abstraction on top of NumberInput for ranges * */ var RangeInput = React.createClass({ propTypes: { value: React.PropTypes.array, placeholder: React.PropTypes.array, checkValidity: React.PropTypes.func }, render: function() { var value = this.props.value; var checkValidity = this.props.checkValidity || (() => true); return <div className="range-input"> [ {this.transferPropsTo(<ValidatedNumberInput value={value[0]} checkValidity={(val) => checkValidity([val, value[1]])} onChange={this.onChange.bind(this, 0)} />)} , {this.transferPropsTo(<ValidatedNumberInput value={value[1]} checkValidity={(val) => checkValidity([value[0], val])} onChange={this.onChange.bind(this, 1)} />)} ] </div>; }, onChange: function(i, newVal) { var value = this.props.value; if (i === 0) { this.props.onChange([newVal, value[1]]); } else { this.props.onChange([value[0], newVal]); } } }); module.exports = RangeInput;
/** @jsx React.DOM */ var NumberInput = require("../components/number-input.jsx"); /* A minor abstraction on top of NumberInput for ranges * */ var RangeInput = React.createClass({ propTypes: { value: React.PropTypes.array, placeholder: React.PropTypes.array, checkValidity: React.PropTypes.func }, render: function() { var value = this.props.value; var checkValidity = this.props.checkValidity || (() => true); return <div className="range-input"> [ {this.transferPropsTo(<NumberInput value={value[0]} checkValidity={val => checkValidity([val, value[1]])} onChange={this.onChange.bind(this, 0)} />)} , {this.transferPropsTo(<NumberInput value={value[1]} checkValidity={val => checkValidity([value[0], val])} onChange={this.onChange.bind(this, 1)} />)} ] </div>; }, onChange: function(i, newVal) { var value = this.props.value; if (i === 0) { this.props.onChange([newVal, value[1]]); } else { this.props.onChange([value[0], newVal]); } } }); module.exports = RangeInput;
Change RangeInput over to using NumberInput
Change RangeInput over to using NumberInput Test Plan: see that it still works where used Auditors: jack
JSX
mit
learningequality/perseus,sachgits/perseus,abe4mvp/perseus,iamchenxin/perseus,daukantas/perseus,daukantas/perseus,junyiacademy/perseus,alexristich/perseus,ariabuckles/perseus,huangins/perseus,junyiacademy/perseus,iamchenxin/perseus,ariabuckles/perseus,alexristich/perseus,abe4mvp/perseus,sachgits/perseus,chirilo/perseus,learningequality/perseus,ariabuckles/perseus,ariabuckles/perseus,huangins/perseus,chirilo/perseus
--- +++ @@ -1,6 +1,6 @@ /** @jsx React.DOM */ -var ValidatedNumberInput = require("../components/validated-number-input.jsx"); +var NumberInput = require("../components/number-input.jsx"); /* A minor abstraction on top of NumberInput for ranges * @@ -18,14 +18,14 @@ return <div className="range-input"> [ - {this.transferPropsTo(<ValidatedNumberInput + {this.transferPropsTo(<NumberInput value={value[0]} - checkValidity={(val) => checkValidity([val, value[1]])} + checkValidity={val => checkValidity([val, value[1]])} onChange={this.onChange.bind(this, 0)} />)} , - {this.transferPropsTo(<ValidatedNumberInput + {this.transferPropsTo(<NumberInput value={value[1]} - checkValidity={(val) => checkValidity([value[0], val])} + checkValidity={val => checkValidity([value[0], val])} onChange={this.onChange.bind(this, 1)} />)} ] </div>;
8b413a34649eb91109afee403ef04de0acfccae4
app/SimpleElement.jsx
app/SimpleElement.jsx
/* @flow */ 'use strict'; import React from 'react'; import Circle from 'react-art/lib/Circle.art' export default class SimpleElement extends React.Component { constructor(props) { super(props); } render() { return ( <Circle onClick={this.onClick} radius='10' fill='blue' x={this.props.x} y={this.props.y} /> ) } }
/* @flow */ 'use strict'; import React from 'react'; import Circle from 'react-art/lib/Circle.art' export default class SimpleElement extends React.Component { constructor(props) { super(props); } render() { return ( <Circle onClick={this.onClick} radius={10} fill='blue' x={this.props.x} y={this.props.y} /> ) } }
Fix radius - string to number
Fix radius - string to number
JSX
epl-1.0
circuitsim/circuit-simulator,circuitsim/circuit-simulator,circuitsim/circuit-simulator
--- +++ @@ -16,7 +16,7 @@ return ( <Circle onClick={this.onClick} - radius='10' + radius={10} fill='blue' x={this.props.x} y={this.props.y}
f6cc8670882503b77f44f30dbd5bb4379df09d2b
app/javascript/app/pages/ndcs/ndcs-component.jsx
app/javascript/app/pages/ndcs/ndcs-component.jsx
import React from 'react'; import { renderRoutes } from 'react-router-config'; import Proptypes from 'prop-types'; import Header from 'components/header'; import Intro from 'components/intro'; import AutocompleteSearch from 'components/autocomplete-search'; import AnchorNav from 'components/anchor-nav'; import anchorNavRegularTheme from 'styles/themes/anchor-nav/anchor-nav-regular.scss'; import { NDC_CONTENT } from 'data/SEO'; import { MetaDescription, SocialMetadata } from 'components/seo'; import layout from 'styles/layout.scss'; import styles from './ndcs-styles.scss'; const NDC = ({ anchorLinks, query, route }) => ( <div> <MetaDescription descriptionContext={NDC_CONTENT} subtitle="NDC CONTENT" /> <SocialMetadata descriptionContext={NDC_CONTENT} href={location.href} /> <Header size="medium" route={route}> <div className={layout.content}> <div className={styles.cols}> <Intro title="NDC Content" /> <AutocompleteSearch /> </div> <AnchorNav useRoutes links={anchorLinks} query={query} theme={anchorNavRegularTheme} /> </div> </Header> <div className={styles.wrapper}> <div className={layout.content}>{renderRoutes(route.routes)}</div> </div> </div> ); NDC.propTypes = { query: Proptypes.string, route: Proptypes.object.isRequired, anchorLinks: Proptypes.array.isRequired }; export default NDC;
import React from 'react'; import { renderRoutes } from 'react-router-config'; import Proptypes from 'prop-types'; import cx from 'classnames'; import Header from 'components/header'; import Intro from 'components/intro'; import AutocompleteSearch from 'components/autocomplete-search'; import AnchorNav from 'components/anchor-nav'; import anchorNavRegularTheme from 'styles/themes/anchor-nav/anchor-nav-regular.scss'; import { NDC_CONTENT } from 'data/SEO'; import { MetaDescription, SocialMetadata } from 'components/seo'; import layout from 'styles/layout.scss'; import styles from './ndcs-styles.scss'; const NDC = ({ anchorLinks, query, route }) => ( <div> <MetaDescription descriptionContext={NDC_CONTENT} subtitle="NDC CONTENT" /> <SocialMetadata descriptionContext={NDC_CONTENT} href={location.href} /> <Header size="medium" route={route}> <div className={cx(styles.cols, layout.content)}> <Intro title="NDC Content" /> <AutocompleteSearch /> </div> <AnchorNav useRoutes links={anchorLinks} query={query} theme={anchorNavRegularTheme} /> </Header> <div className={styles.wrapper}> <div className={layout.content}>{renderRoutes(route.routes)}</div> </div> </div> ); NDC.propTypes = { query: Proptypes.string, route: Proptypes.object.isRequired, anchorLinks: Proptypes.array.isRequired }; export default NDC;
Restructure ndcs component to adjust to new styles
Restructure ndcs component to adjust to new styles
JSX
mit
Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch
--- +++ @@ -1,6 +1,7 @@ import React from 'react'; import { renderRoutes } from 'react-router-config'; import Proptypes from 'prop-types'; +import cx from 'classnames'; import Header from 'components/header'; import Intro from 'components/intro'; import AutocompleteSearch from 'components/autocomplete-search'; @@ -17,18 +18,16 @@ <MetaDescription descriptionContext={NDC_CONTENT} subtitle="NDC CONTENT" /> <SocialMetadata descriptionContext={NDC_CONTENT} href={location.href} /> <Header size="medium" route={route}> - <div className={layout.content}> - <div className={styles.cols}> - <Intro title="NDC Content" /> - <AutocompleteSearch /> - </div> - <AnchorNav - useRoutes - links={anchorLinks} - query={query} - theme={anchorNavRegularTheme} - /> + <div className={cx(styles.cols, layout.content)}> + <Intro title="NDC Content" /> + <AutocompleteSearch /> </div> + <AnchorNav + useRoutes + links={anchorLinks} + query={query} + theme={anchorNavRegularTheme} + /> </Header> <div className={styles.wrapper}> <div className={layout.content}>{renderRoutes(route.routes)}</div>
57c13ff063bc3cabd30fca9201b862c77be9701a
public/javascripts/components/repo/RepoPage.jsx
public/javascripts/components/repo/RepoPage.jsx
import React from 'react'; import API from '../../API'; import CurrentUserStore from '../../stores/CurrentUserStore'; import ActiveRepoStore from '../../stores/ActiveRepoStore'; let getCurrentUserFromStore = () => { return { currentUser: CurrentUserStore.getCurrentUser() }; } let getActiveRepoFromStore = () => { return { activeRepo: ActiveRepoStore.getActiveRepo() } } export default class RepoPage extends React.Component { constructor(props) { super(props); let { params } = this.props; API.getActiveRepo(params.repoid); this.state = getActiveRepoFromStore(); this.onStoreChange = this.onStoreChange.bind(this); } onStoreChange() { this.setState(getCurrentUserFromStore()); this.setState(getActiveRepoFromStore()); } componentWillMount() { CurrentUserStore.addChangeListener(this.onStoreChange); ActiveRepoStore.addChangeListener(this.onStoreChange); } componentWillUnmount() { CurrentUserStore.removeChangeListener(this.onStoreChange); ActiveRepoStore.removeChangeListener(this.onStoreChange); } render() { console.log(this.state); return ( <div className="active-repo-wrapper"> {this.state.activeRepo.repoOwner || "NAME"} </div> ) } }
import React from 'react'; var Tabs = require('react-simpletabs'); import API from '../../API'; import CurrentUserStore from '../../stores/CurrentUserStore'; import ActiveRepoStore from '../../stores/ActiveRepoStore'; let getCurrentUserFromStore = () => { return { currentUser: CurrentUserStore.getCurrentUser() }; } let getActiveRepoFromStore = () => { return { activeRepo: ActiveRepoStore.getActiveRepo() } } let topBuffer = { 'marginTop': '30px', 'marginBottom': '30px' } export default class RepoPage extends React.Component { constructor(props) { super(props); let { params } = this.props; API.getActiveRepo(params.repoid); this.state = getActiveRepoFromStore(); this.onStoreChange = this.onStoreChange.bind(this); } onStoreChange() { this.setState(getCurrentUserFromStore()); this.setState(getActiveRepoFromStore()); } componentWillMount() { CurrentUserStore.addChangeListener(this.onStoreChange); ActiveRepoStore.addChangeListener(this.onStoreChange); } componentWillUnmount() { CurrentUserStore.removeChangeListener(this.onStoreChange); ActiveRepoStore.removeChangeListener(this.onStoreChange); } render() { console.log(this.state); return ( <div className="active-repo-wrapper"> <Tabs> <Tabs.Panel title='Edit Project'> <h1>Hello word</h1> </Tabs.Panel> <Tabs.Panel title='Preview'> <h1>Preview</h1> </Tabs.Panel> </Tabs> </div> ) } }
Add tabs to repo edit
Add tabs to repo edit
JSX
unlicense
treyhuffine/gitcoders
--- +++ @@ -1,4 +1,5 @@ import React from 'react'; +var Tabs = require('react-simpletabs'); import API from '../../API'; import CurrentUserStore from '../../stores/CurrentUserStore'; @@ -9,6 +10,10 @@ } let getActiveRepoFromStore = () => { return { activeRepo: ActiveRepoStore.getActiveRepo() } +} +let topBuffer = { + 'marginTop': '30px', + 'marginBottom': '30px' } export default class RepoPage extends React.Component { @@ -35,7 +40,14 @@ console.log(this.state); return ( <div className="active-repo-wrapper"> - {this.state.activeRepo.repoOwner || "NAME"} + <Tabs> + <Tabs.Panel title='Edit Project'> + <h1>Hello word</h1> + </Tabs.Panel> + <Tabs.Panel title='Preview'> + <h1>Preview</h1> + </Tabs.Panel> + </Tabs> </div> ) }
f3ed1976dbf67d7096ba5920529b12f3d3d6626b
app/scripts/components/createGame/createGame.jsx
app/scripts/components/createGame/createGame.jsx
import React from 'react'; import GameActions from '../../actions/gameActions' import RaisedButton from 'material-ui/lib/raised-button' class CreateGame extends React.Component { _handleSubmit() { GameActions.createGame(this.state.userId); return false; } render() { return ( <RaisedButton label="Create game" onClick={() => GameActions.createGame()}/> ); } } export default CreateGame;
import React from 'react'; import GameActions from '../../actions/gameActions' import UserStore from '../../stores/userStore' import RaisedButton from 'material-ui/lib/raised-button' class CreateGame extends React.Component { constructor(props) { super(props); this.state = {}; } componentDidMount() { this.unsubscribe = UserStore.listen(userId => this.setState({ userId: userId })); } componentWillUnmount() { this.unsubscribe(); } _handleSubmit() { GameActions.createGame(this.state.userId); return false; } render() { return ( <RaisedButton label="Create game" disabled={!this.state.userId} onClick={() => GameActions.createGame()}/> ); } } export default CreateGame;
Disable button if no user id set.
Disable button if no user id set.
JSX
mit
erikogenvik/rps-frontend-react-reflux,erikogenvik/rps-frontend-react-reflux
--- +++ @@ -1,8 +1,25 @@ import React from 'react'; import GameActions from '../../actions/gameActions' +import UserStore from '../../stores/userStore' import RaisedButton from 'material-ui/lib/raised-button' class CreateGame extends React.Component { + constructor(props) { + super(props); + this.state = {}; + } + + componentDidMount() { + this.unsubscribe = UserStore.listen(userId => this.setState({ + userId: userId + })); + } + + componentWillUnmount() { + this.unsubscribe(); + } + + _handleSubmit() { GameActions.createGame(this.state.userId); return false; @@ -10,7 +27,7 @@ render() { return ( - <RaisedButton label="Create game" onClick={() => GameActions.createGame()}/> + <RaisedButton label="Create game" disabled={!this.state.userId} onClick={() => GameActions.createGame()}/> ); } }
b70d86ae734fff1448cb7076fd38447f06ab0b7a
client/js/components/ParkMap.jsx
client/js/components/ParkMap.jsx
import $ from 'jquery'; import React from 'react'; import { GeoJson, Map, Marker, Popup, TileLayer } from 'react-leaflet'; export default class ParkMap extends React.Component { constructor(props) { super(props); } render () { var center = this.props.center; var p = this.props var park = p.park ? <GeoJson data={p.park} /> : null; var amenity = p.amenity ? <GeoJson data={p.amenity} /> : null; var facility = p.facility ? <GeoJson data={p.facility} /> : null; var trail = p.trail ? <GeoJson data={p.trail} /> : null; // FIXME: Seems like this doesn't render markers / shapes sometimes var map = ( <div id='map-wrapper'> <Map id='map' center={center} zoom={15}> <TileLayer url='https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png' attribution='<a href="http://openstreetmap.org">OpenStreetMap</a> | <a href="http://mapbox.com">Mapbox</a>' id='drmaples.ipbindf8' /> {park} {amenity} {facility} {trail} </Map> </div> ); return <div>{map}</div>; } }
import $ from 'jquery'; import React from 'react'; import { GeoJson, Map, Marker, Popup, TileLayer } from 'react-leaflet'; export default class ParkMap extends React.Component { constructor(props) { super(props); } render () { var center = this.props.center; var p = this.props var makeElem = (p) => { return this.props[p] ? <GeoJson data={this.props[p]} /> : null; }; // FIXME: Seems like this doesn't render markers / shapes sometimes var map = ( <div id='map-wrapper'> <Map id='map' center={center} zoom={15}> <TileLayer url='https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png' attribution='<a href="http://openstreetmap.org">OpenStreetMap</a> | <a href="http://mapbox.com">Mapbox</a>' id='drmaples.ipbindf8' /> {makeElem("park")} {makeElem("amenity")} {makeElem("facility")} {makeElem("trail")} </Map> </div> ); return <div>{map}</div>; } }
Use a utility func to build the map layers
Use a utility func to build the map layers
JSX
unlicense
prestonp/austingreenmap,prestonp/austingreenmap,open-austin/austingreenmap,prestonp/austingreenmap,open-austin/austingreenmap,open-austin/austingreenmap,prestonp/austingreenmap,open-austin/austingreenmap
--- +++ @@ -10,10 +10,9 @@ render () { var center = this.props.center; var p = this.props - var park = p.park ? <GeoJson data={p.park} /> : null; - var amenity = p.amenity ? <GeoJson data={p.amenity} /> : null; - var facility = p.facility ? <GeoJson data={p.facility} /> : null; - var trail = p.trail ? <GeoJson data={p.trail} /> : null; + var makeElem = (p) => { + return this.props[p] ? <GeoJson data={this.props[p]} /> : null; + }; // FIXME: Seems like this doesn't render markers / shapes sometimes var map = ( <div id='map-wrapper'> @@ -22,10 +21,10 @@ url='https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png' attribution='<a href="http://openstreetmap.org">OpenStreetMap</a> | <a href="http://mapbox.com">Mapbox</a>' id='drmaples.ipbindf8' /> - {park} - {amenity} - {facility} - {trail} + {makeElem("park")} + {makeElem("amenity")} + {makeElem("facility")} + {makeElem("trail")} </Map> </div> );
d66d60362f09f4a19c876e88c1b36f1119f930db
client/src/components/Header.jsx
client/src/components/Header.jsx
import React from 'react'; import { Link } from 'react-router-dom'; import {LinkContainer} from 'react-router-bootstrap'; import {Navbar, Nav, NavItem, Glyphicon} from 'react-bootstrap'; /** * Component representing the React Header Component. * @extends Header */ const Header = ({username}) => ( <Navbar collapseOnSelect> <Navbar.Header> <Navbar.Brand> <Link to="/">Mustard Tiger Clan Builder</Link> </Navbar.Brand> <Navbar.Toggle /> </Navbar.Header> <Navbar.Collapse> <Nav pullRight> <LinkContainer to='/clan'> <NavItem>Clan</NavItem> </LinkContainer> {username ? ( <LinkContainer to={`/users/${username}`}> <NavItem>{username}</NavItem> </LinkContainer> ) : ( <LinkContainer to='/login'> <NavItem>Login</NavItem> </LinkContainer> ) } {username ? ( <LinkContainer to='/logout'> <NavItem>logout</NavItem> </LinkContainer> ) : ( <LinkContainer to='/register'> <NavItem>Register</NavItem> </LinkContainer> ) } </Nav> </Navbar.Collapse> </Navbar> ); export default Header;
import React from 'react'; import { Link } from 'react-router-dom'; import {LinkContainer} from 'react-router-bootstrap'; import {Navbar, Nav, NavItem, Glyphicon} from 'react-bootstrap'; /** * Component representing the React Header Component. * @extends Header */ const Header = ({username, clans}) => ( <Navbar collapseOnSelect> <Navbar.Header> <Navbar.Brand> <Link to="/">Mustard Tiger Clan Builder</Link> </Navbar.Brand> <Navbar.Toggle /> </Navbar.Header> <Navbar.Collapse> <Nav pullRight> {clans.map(clan => ( <LinkContainer key={clan.id} to={`/${clan.id}`}> <NavItem>{clan.name}</NavItem> </LinkContainer> ))} {username ? ( <LinkContainer to={`/users/${username}`}> <NavItem>{username}</NavItem> </LinkContainer> ) : ( <LinkContainer to='/login'> <NavItem>Login</NavItem> </LinkContainer> ) } {username ? ( <LinkContainer to='/logout'> <NavItem>logout</NavItem> </LinkContainer> ) : ( <LinkContainer to='/register'> <NavItem>Register</NavItem> </LinkContainer> ) } </Nav> </Navbar.Collapse> </Navbar> ); export default Header;
Add key to each prop
Add key to each prop
JSX
mit
iMobs/MustardTigers,MustardTigers/MustardTigers
--- +++ @@ -8,7 +8,7 @@ * @extends Header */ -const Header = ({username}) => ( +const Header = ({username, clans}) => ( <Navbar collapseOnSelect> <Navbar.Header> <Navbar.Brand> @@ -18,9 +18,11 @@ </Navbar.Header> <Navbar.Collapse> <Nav pullRight> - <LinkContainer to='/clan'> - <NavItem>Clan</NavItem> - </LinkContainer> + {clans.map(clan => ( + <LinkContainer key={clan.id} to={`/${clan.id}`}> + <NavItem>{clan.name}</NavItem> + </LinkContainer> + ))} {username ? ( <LinkContainer to={`/users/${username}`}>
ac72c3f79fac311c9684ce471a87741838fa3503
src/CreateSideEffect.jsx
src/CreateSideEffect.jsx
import React from "react"; import invariant from "react/lib/invariant"; import shallowEqual from "react/lib/shallowEqual"; const RESERVED_PROPS = { arguments: true, caller: true, key: true, length: true, name: true, prototype: true, ref: true, type: true }; export default (Component) => { invariant( typeof Object.is(Component.handleChange, "function"), "handleChange(propsList) is not a function." ); let mountedInstances = []; const emitChange = () => { Component.handleChange(mountedInstances.map(instance => instance.props)); }; class CreateSideEffect extends React.Component { static displayName = "CreateSideEffect" componentWillMount() { mountedInstances.push(this); emitChange(); } shouldComponentUpdate(nextProps) { return !shallowEqual(nextProps, this.props); } componentDidUpdate() { emitChange(); } componentWillUnmount() { const index = mountedInstances.indexOf(this); mountedInstances.splice(index, 1); emitChange(); } static dispose() { mountedInstances = []; emitChange(); }; render() { return ( <Component {...this.props} /> ); } } Object.getOwnPropertyNames(Component) .filter(componentKey => { return Component.hasOwnProperty(componentKey) && !RESERVED_PROPS[componentKey]; }) .forEach(componentKey => { CreateSideEffect[componentKey] = Component[componentKey]; }); return CreateSideEffect; };
import React from "react"; import invariant from "react/lib/invariant"; import shallowEqual from "react/lib/shallowEqual"; const RESERVED_PROPS = { arguments: true, caller: true, key: true, length: true, name: true, prototype: true, ref: true, type: true }; export default (Component) => { invariant( typeof Object.is(Component.handleChange, "function"), "handleChange(propsList) is not a function." ); const mountedInstances = new Set(); const emitChange = () => { Component.handleChange([...mountedInstances].map(instance => instance.props)); }; class CreateSideEffect extends React.Component { static displayName = "CreateSideEffect" componentWillMount() { mountedInstances.add(this); emitChange(); } shouldComponentUpdate(nextProps) { return !shallowEqual(nextProps, this.props); } componentDidUpdate() { emitChange(); } componentWillUnmount() { if (mountedInstances.has(this)) { mountedInstances.delete(this); } emitChange(); } static dispose() { mountedInstances.clear(); emitChange(); } render() { return ( <Component {...this.props} /> ); } } Object.getOwnPropertyNames(Component) .filter(componentKey => { return Component.hasOwnProperty(componentKey) && !RESERVED_PROPS[componentKey]; }) .forEach(componentKey => { CreateSideEffect[componentKey] = Component[componentKey]; }); return CreateSideEffect; };
Use a Set to manage mounted instances.
Use a Set to manage mounted instances.
JSX
mit
romanonthego/react-helmet,gaearon/react-helmet,magus/react-helmet,nfl/react-helmet,HorizonXP/react-helmet,kib357/react-helmet,cesarandreu/react-helmet,bountylabs/react-helmet,miraks/react-helmet
--- +++ @@ -19,16 +19,16 @@ "handleChange(propsList) is not a function." ); - let mountedInstances = []; + const mountedInstances = new Set(); const emitChange = () => { - Component.handleChange(mountedInstances.map(instance => instance.props)); + Component.handleChange([...mountedInstances].map(instance => instance.props)); }; class CreateSideEffect extends React.Component { static displayName = "CreateSideEffect" componentWillMount() { - mountedInstances.push(this); + mountedInstances.add(this); emitChange(); } @@ -41,15 +41,17 @@ } componentWillUnmount() { - const index = mountedInstances.indexOf(this); - mountedInstances.splice(index, 1); + if (mountedInstances.has(this)) { + mountedInstances.delete(this); + } + emitChange(); } static dispose() { - mountedInstances = []; + mountedInstances.clear(); emitChange(); - }; + } render() { return (
02a8f58bbec9d82688f35a576d17662abaf45f81
lib/src/utils/MuiPickersUtilsProvider.jsx
lib/src/utils/MuiPickersUtilsProvider.jsx
import { PureComponent } from 'react'; import PropTypes from 'prop-types'; export default class MuiPickersUtilsProvider extends PureComponent { static propTypes = { utils: PropTypes.func.isRequired, locale: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), children: PropTypes.element.isRequired, moment: PropTypes.func, } static defaultProps = { locale: undefined, moment: undefined, } static childContextTypes = { muiPickersDateUtils: PropTypes.object, } getChildContext() { const { utils: Utils, locale, moment } = this.props; return { muiPickersDateUtils: new Utils({ locale, moment }), }; } render() { return this.props.children; } }
import { Component } from 'react'; import PropTypes from 'prop-types'; export default class MuiPickersUtilsProvider extends Component { static propTypes = { utils: PropTypes.func.isRequired, locale: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), children: PropTypes.element.isRequired, moment: PropTypes.func, } static defaultProps = { locale: undefined, moment: undefined, } static childContextTypes = { muiPickersDateUtils: PropTypes.object, } getChildContext() { const { utils: Utils, locale, moment } = this.props; return { muiPickersDateUtils: new Utils({ locale, moment }), }; } render() { return this.props.children; } }
Make MuiPickerUtilsProvider component to make it works with Router HOC
Make MuiPickerUtilsProvider component to make it works with Router HOC
JSX
mit
mbrookes/material-ui,callemall/material-ui,mui-org/material-ui,dmtrKovalenko/material-ui-pickers,rscnt/material-ui,dmtrKovalenko/material-ui-pickers,mui-org/material-ui,callemall/material-ui,oliviertassinari/material-ui,rscnt/material-ui,rscnt/material-ui,oliviertassinari/material-ui,mbrookes/material-ui,mui-org/material-ui,oliviertassinari/material-ui,mbrookes/material-ui,callemall/material-ui,callemall/material-ui
--- +++ @@ -1,7 +1,7 @@ -import { PureComponent } from 'react'; +import { Component } from 'react'; import PropTypes from 'prop-types'; -export default class MuiPickersUtilsProvider extends PureComponent { +export default class MuiPickersUtilsProvider extends Component { static propTypes = { utils: PropTypes.func.isRequired, locale: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
fe3d54a3d34c34768fc298ce4ee97143377dea56
Popover/index.jsx
Popover/index.jsx
import React from 'react'; import PropTypes from 'prop-types'; import Overlay from '../Overlay'; import { calculateStyles, } from '../lib/utils'; import { modal, } from '../style/zIndex'; const popoverWrapperStyle = { position: 'absolute', top: 0, left: 0, display: 'flex', flexDirection: 'column', height: '100vh', width: '100vw', justifyContent: 'center', alignItems: 'center', }; const Popover = ({ children, left, top, bottom, right, onOverlayClick, transparentOverlay, }) => ( <div style={popoverWrapperStyle}> <div style={calculateStyles({ default: { position: 'absolute', left, top, bottom, right, zIndex: modal, }, })} > {children} </div> <Overlay onClick={onOverlayClick} transparent={transparentOverlay} /> </div> ); Popover.propTypes = { children: PropTypes.node.isRequired, left: PropTypes.string, top: PropTypes.string, bottom: PropTypes.string, right: PropTypes.string, onOverlayClick: PropTypes.func, transparentOverlay: PropTypes.bool, }; export default Popover;
import React from 'react'; import PropTypes from 'prop-types'; import Overlay from '../Overlay'; import { calculateStyles, } from '../lib/utils'; import { modal, } from '../style/zIndex'; const Popover = ({ children, left, top, bottom, right, width, onOverlayClick, transparentOverlay, }) => { const popoverWrapperStyle = { position: 'absolute', top: 0, left: 0, display: 'flex', flexDirection: 'column', height: '100vh', width: `${width || '100vw'}`, justifyContent: 'center', alignItems: 'center', }; return ( <div style={popoverWrapperStyle}> <div style={calculateStyles({ default: { position: 'absolute', left, top, bottom, right, zIndex: modal, }, })} > {children} </div> <Overlay onClick={onOverlayClick} transparent={transparentOverlay} /> </div> ); }; Popover.propTypes = { children: PropTypes.node.isRequired, left: PropTypes.string, top: PropTypes.string, bottom: PropTypes.string, right: PropTypes.string, width: PropTypes.string, onOverlayClick: PropTypes.func, transparentOverlay: PropTypes.bool, }; export default Popover;
Add option to set popover width
Add option to set popover width
JSX
mit
bufferapp/buffer-components,bufferapp/buffer-components
--- +++ @@ -8,17 +8,6 @@ modal, } from '../style/zIndex'; -const popoverWrapperStyle = { - position: 'absolute', - top: 0, - left: 0, - display: 'flex', - flexDirection: 'column', - height: '100vh', - width: '100vw', - justifyContent: 'center', - alignItems: 'center', -}; const Popover = ({ children, @@ -26,30 +15,44 @@ top, bottom, right, + width, onOverlayClick, transparentOverlay, -}) => ( - <div style={popoverWrapperStyle}> - <div - style={calculateStyles({ - default: { - position: 'absolute', - left, - top, - bottom, - right, - zIndex: modal, - }, - })} - > - {children} +}) => { + const popoverWrapperStyle = { + position: 'absolute', + top: 0, + left: 0, + display: 'flex', + flexDirection: 'column', + height: '100vh', + width: `${width || '100vw'}`, + justifyContent: 'center', + alignItems: 'center', + }; + return ( + <div style={popoverWrapperStyle}> + <div + style={calculateStyles({ + default: { + position: 'absolute', + left, + top, + bottom, + right, + zIndex: modal, + }, + })} + > + {children} + </div> + <Overlay + onClick={onOverlayClick} + transparent={transparentOverlay} + /> </div> - <Overlay - onClick={onOverlayClick} - transparent={transparentOverlay} - /> - </div> -); + ); +}; Popover.propTypes = { children: PropTypes.node.isRequired, @@ -57,6 +60,7 @@ top: PropTypes.string, bottom: PropTypes.string, right: PropTypes.string, + width: PropTypes.string, onOverlayClick: PropTypes.func, transparentOverlay: PropTypes.bool, };
1628ed9cd7fbdc047746daeba013d412901d9e00
src/js/components/session-list/index.jsx
src/js/components/session-list/index.jsx
import debug from "debug"; import React, { Component, PropTypes } from "react"; import Session from "../session"; const log = debug("schedule:components:session-list"); const MARGIN = 60 * 5 * 1000; // Display started events for 5 mins export class SessionList extends Component { render() { const { sessions } = this.props; let now = Date.now(); let sessionComps = sessions. filter(s => now <= Number(s.start) + MARGIN). map(s => { return ( <div className="session-list__session"> <Session session={s} /> </div> ); }); return ( <div className="session-list"> {sessionComps} </div> ); } } SessionList.propTypes = { sessions: PropTypes.array.isRequired }; export default SessionList;
import debug from "debug"; import React, { Component, PropTypes } from "react"; import Session from "../session"; const log = debug("schedule:components:session-list"); const MARGIN = 60 * 5 * 1000; // Display started events for 5 mins const MODE_FILTERED = "filtered"; const MODE_ALL = "all"; export class SessionList extends Component { constructor(props) { super(props); this.state = { mode: MODE_FILTERED }; } switchMode(mode) { this.setState({ mode }); } render() { const { mode } = this.state; const { sessions } = this.props; let now = Date.now(); let show = MODE_FILTERED !== mode ? sessions : sessions.filter(s => now <= Number(s.start) + MARGIN); let sessionComps = show.map(s => { return ( <div className="session-list__session"> <Session session={s} /> </div> ); }); return ( <div className="session-list"> <div className="session-list__mode-switcher"> <a href="#" onClick={e => (e.preventDefault(), this.switchMode(MODE_ALL))} className={mode !== MODE_FILTERED && "active"}>All</a> {" | "} <a href="#" onClick={e => (e.preventDefault(), this.switchMode(MODE_FILTERED))} className={mode === MODE_FILTERED && "active"}>Upcoming</a> </div> {sessionComps} </div> ); } } SessionList.propTypes = { sessions: PropTypes.array.isRequired }; export default SessionList;
Add mode switcher to session list
Add mode switcher to session list
JSX
mit
orangecms/schedule,orangecms/schedule,orangecms/schedule,nikcorg/schedule,nikcorg/schedule,nikcorg/schedule
--- +++ @@ -5,24 +5,45 @@ const log = debug("schedule:components:session-list"); const MARGIN = 60 * 5 * 1000; // Display started events for 5 mins +const MODE_FILTERED = "filtered"; +const MODE_ALL = "all"; export class SessionList extends Component { + constructor(props) { + super(props); + + this.state = { + mode: MODE_FILTERED + }; + } + + switchMode(mode) { + this.setState({ mode }); + } + render() { + const { mode } = this.state; const { sessions } = this.props; let now = Date.now(); - let sessionComps = sessions. - filter(s => now <= Number(s.start) + MARGIN). - map(s => { - return ( - <div className="session-list__session"> - <Session session={s} /> - </div> - ); - }); + let show = MODE_FILTERED !== mode ? sessions : sessions.filter(s => now <= Number(s.start) + MARGIN); + let sessionComps = show.map(s => { + return ( + <div className="session-list__session"> + <Session session={s} /> + </div> + ); + }); return ( <div className="session-list"> + <div className="session-list__mode-switcher"> + <a href="#" onClick={e => (e.preventDefault(), this.switchMode(MODE_ALL))} + className={mode !== MODE_FILTERED && "active"}>All</a> + {" | "} + <a href="#" onClick={e => (e.preventDefault(), this.switchMode(MODE_FILTERED))} className={mode === MODE_FILTERED && "active"}>Upcoming</a> + </div> + {sessionComps} </div> );
7f0794fd39b7c02cf5c204203a4d38ef9fb552ce
src/components/JsonRPC.jsx
src/components/JsonRPC.jsx
import React from "react"; import InfoBox from "./Infobox.jsx"; import EthClient from "../client/ethclient.js"; let JsonRPC = React.createClass({ getInitialState() { return { json_rpc_url: 'http://localhost:8080' }; }, handleJsonRpcSubmit(e) { e.preventDefault(); let newUrl = this.refs.jsonRpcInput.getDOMNode().value.trim(); EthClient.setJsonRPCUrl(newUrl); }, componentDidMount() { EthClient.registerListener(this.updateJsonRPCUrl); }, updateJsonRPCUrl(newUrl) { this.setState({json_rpc_url: newUrl}); }, render() { return ( <div className="container"> <h1> JsonRPC Control Panel </h1> <form onSubmit={this.handleJsonRpcSubmit}> <div className="col-md-6"> <div className="form-group"> <label labelFor="jsonrpc">JSON RPC URL</label> <input type="url" className="form-control" id="jsonrpc" ref="jsonRpcInput" placeholder={this.state.json_rpc_url}/> </div> <button type="submit" className="btn btn-primary">Change</button> </div> </form> </div> ); } }); export default JsonRPC;
import React from "react"; import InfoBox from "./Infobox.jsx"; import EthClient from "../client/ethclient.js"; let JsonRPC = React.createClass({ getInitialState() { return { json_rpc_url: EthClient.getJsonRPCUrl() }; }, handleJsonRpcSubmit(e) { e.preventDefault(); let newUrl = this.refs.jsonRpcInput.getDOMNode().value.trim(); EthClient.setJsonRPCUrl(newUrl); }, componentDidMount() { EthClient.registerListener(this.updateJsonRPCUrl); }, updateJsonRPCUrl(newUrl) { this.setState({json_rpc_url: newUrl}); }, render() { return ( <div className="container"> <h1> JsonRPC Control Panel </h1> <form onSubmit={this.handleJsonRpcSubmit}> <div className="col-md-6"> <div className="form-group"> <label labelFor="jsonrpc">JSON RPC URL</label> <input type="url" className="form-control" id="jsonrpc" ref="jsonRpcInput" placeholder={this.state.json_rpc_url}/> </div> <button type="submit" className="btn btn-primary">Change</button> </div> </form> </div> ); } }); export default JsonRPC;
Fix default rpc url in view
Fix default rpc url in view
JSX
mit
dccp/zeppelin,dccp/zeppelin,dccp/zeppelin
--- +++ @@ -5,7 +5,7 @@ let JsonRPC = React.createClass({ getInitialState() { return { - json_rpc_url: 'http://localhost:8080' + json_rpc_url: EthClient.getJsonRPCUrl() }; }, handleJsonRpcSubmit(e) {
7b6819ae47ba94a7185c98a72e0f38f3e1a27aff
lib/web/components/screens/about.jsx
lib/web/components/screens/about.jsx
'use strict' let React = require('react') let Gravatar = require('react-gravatar') let packageJson = require('../../../../package') let repoURL = packageJson.repository.url let changesLink = repoURL + '#' + packageJson.version.replace(/\./g, '') let AboutScreen = React.createClass({ render () { return ( <div className='text-center'> <h1>About</h1> <p> Le serf version <a href={changesLink} target='_blank'>{packageJson.version}</a>. </p> <p> <Gravatar email='onevasari@gmail.com' size={200} className='img-circle' /> </p> <p> Le serf is an <a target='_blank' href={repoURL}>open source</a> creation by <a target='_blank' href='http://github.com/1vasari'>1vasari</a>. </p> </div> ) } }) module.exports = AboutScreen
'use strict' let React = require('react') let Gravatar = require('react-gravatar') let packageJson = require('../../../../package') let repoURL = packageJson.repository.url let changesLink = repoURL + '#' + packageJson.version.replace(/\./g, '') let AboutScreen = React.createClass({ render () { return ( <div className='text-center'> <h1>About</h1> <p> Le serf version <a href={changesLink} target='_blank'>{packageJson.version}</a>. </p> <p> <Gravatar email='onevasari@gmail.com' size={200} className='img-circle' http={window.location.protocol === 'http:'} https={window.location.protocol === 'https:'} /> </p> <p> Le serf is an <a target='_blank' href={repoURL}>open source</a> creation by <a target='_blank' href='http://github.com/1vasari'>1vasari</a>. </p> </div> ) } }) module.exports = AboutScreen
Load my Gravatar image with the right protocol.
Load my Gravatar image with the right protocol.
JSX
mit
le-serf/le-serf,le-serf/le-serf,1vasari/le-serf,1vasari/le-serf,1vasari/le-serf,le-serf/le-serf
--- +++ @@ -24,6 +24,8 @@ email='onevasari@gmail.com' size={200} className='img-circle' + http={window.location.protocol === 'http:'} + https={window.location.protocol === 'https:'} /> </p>
b81a300af48da59dfa641fbc0492c19d4797a746
public/js/app/context/WebContext.jsx
public/js/app/context/WebContext.jsx
import React from 'react' const WebContext = React.createContext() const defaultConfig = { lang: 'sv', isAdmin: false, basicBreadcrumbs: [ { label: 'KTH', url: 'https://www-r.referens.sys.kth.se/' }, { label: 'Node', url: 'https://www-r.referens.sys.kth.se/node' }, ], proxyPrefixPath: { uri: 'node' }, message: 'howdi', } export const WebContextProvider = props => { const { configIn = {} } = props const config = { ...defaultConfig } for (const k in configIn) { if (Object.prototype.hasOwnProperty.call(configIn, k)) { if (typeof configIn[k] === 'object') { config[k] = JSON.parse(JSON.stringify(configIn[k])) } else { config[k] = configIn[k] } } } const [currentConfig, setConfig] = React.useState(config) const value = [currentConfig, setConfig] // eslint-disable-next-line react/jsx-props-no-spreading return <WebContext.Provider value={value} {...props} /> } export function useWebContext() { const context = React.useContext(WebContext) if (!context) { return [({}, () => {})] } return context } export function incrementCount() { const context = React.useContext(WebContext) const { count } = context console.log(`incrementcount`, count) // setConfig({ ...context, ...{ count: count + 1 } }) }
import React from 'react' const WebContext = React.createContext() const defaultConfig = { lang: 'sv', isAdmin: false, basicBreadcrumbs: [ { label: 'KTH', url: 'https://www-r.referens.sys.kth.se/' }, { label: 'Node', url: 'https://www-r.referens.sys.kth.se/node' }, ], proxyPrefixPath: { uri: 'node' }, message: 'howdi', } export const WebContextProvider = props => { const { configIn = {} } = props const config = { ...defaultConfig } for (const k in configIn) { if (Object.prototype.hasOwnProperty.call(configIn, k)) { if (typeof configIn[k] === 'object') { config[k] = JSON.parse(JSON.stringify(configIn[k])) } else { config[k] = configIn[k] } } } const [currentConfig, setConfig] = React.useState(config) const value = [currentConfig, setConfig] // eslint-disable-next-line react/jsx-props-no-spreading return <WebContext.Provider value={value} {...props} /> } export function useWebContext() { const context = React.useContext(WebContext) if (!context) { return [({}, () => {})] } return context }
Remove unused code in store
Remove unused code in store
JSX
mit
KTH/node-web,KTH/node-web
--- +++ @@ -38,11 +38,3 @@ } return context } - -export function incrementCount() { - const context = React.useContext(WebContext) - const { count } = context - - console.log(`incrementcount`, count) - // setConfig({ ...context, ...{ count: count + 1 } }) -}
5101946f9b187b66c0e8feea03fec150efa39ab9
src/js/components/addData/AddDataTypeSelector.jsx
src/js/components/addData/AddDataTypeSelector.jsx
/** * AddDataTypeSelector.jsx * Created by Kyle Fox 12/29/15 **/ import React from 'react'; export default class TypeSelector extends React.Component { render() { return ( <div className="usa-da-color-gray-light-half-tone usa-da-login-container usa-grid"> <div className="usa-width-one-whole"> <p> Three ways to submit your data... <button className="usa-button-big" type="submit" value="Upload CSV Files">Upload CSV Files</button> <button className="usa-button-big" type="submit" value="Upload XBRL File" disabled={true}>Upload XBRL File</button> <button className="usa-button-big" type="submit" value="Setup a Data Feed" disabled={true}>Setup a Data Feed</button> </p> </div> </div> ); } }
/** * AddDataTypeSelector.jsx * Created by Kyle Fox 12/29/15 **/ import React from 'react'; export default class TypeSelector extends React.Component { render() { return ( <div className="usa-da-color-gray-light-half-tone usa-da-login-container usa-grid container"> <div className="usa-width-one-whole row center-block"> <h2>Three ways to submit your data...</h2> <div className="row text-center"> <div className="col-md-4"><button className="usa-da-button-biggest" type="submit" value="Upload CSV Files">Upload CSV Files</button></div> <div className="col-md-4"><button className="usa-da-button-biggest" type="submit" value="Upload XBRL File" disabled={true}>Upload XBRL File</button></div> <div className="col-md-4"><button className="usa-da-button-biggest" type="submit" value="Setup a Data Feed" disabled={true}>Setup a Data Feed</button></div> </div> </div> </div> ); } }
Set styling for addData file type selection
Set styling for addData file type selection
JSX
cc0-1.0
fedspendingtransparency/data-act-broker-web-app,fedspendingtransparency/data-act-broker-web-app
--- +++ @@ -8,14 +8,14 @@ export default class TypeSelector extends React.Component { render() { return ( - <div className="usa-da-color-gray-light-half-tone usa-da-login-container usa-grid"> - <div className="usa-width-one-whole"> - <p> - Three ways to submit your data... - <button className="usa-button-big" type="submit" value="Upload CSV Files">Upload CSV Files</button> - <button className="usa-button-big" type="submit" value="Upload XBRL File" disabled={true}>Upload XBRL File</button> - <button className="usa-button-big" type="submit" value="Setup a Data Feed" disabled={true}>Setup a Data Feed</button> - </p> + <div className="usa-da-color-gray-light-half-tone usa-da-login-container usa-grid container"> + <div className="usa-width-one-whole row center-block"> + <h2>Three ways to submit your data...</h2> + <div className="row text-center"> + <div className="col-md-4"><button className="usa-da-button-biggest" type="submit" value="Upload CSV Files">Upload CSV Files</button></div> + <div className="col-md-4"><button className="usa-da-button-biggest" type="submit" value="Upload XBRL File" disabled={true}>Upload XBRL File</button></div> + <div className="col-md-4"><button className="usa-da-button-biggest" type="submit" value="Setup a Data Feed" disabled={true}>Setup a Data Feed</button></div> + </div> </div> </div> );
b5f7a3a39c3dab3c796581305f7d24e122faf4f4
app/pages/home-common/featured-project.jsx
app/pages/home-common/featured-project.jsx
/* Featured Project Component ========================== * This component highlights specific projects on the home page. * NOT to be confused with <HomePagePromoted /> * Content is hardcoded for the moment; improvements on this are welcome. * Originally created to highlight 2017 Mar/Apr Stargazing Live projects. * Design: @beckyrother; code: @shaunanoordin; documented/updated: 20170403 */ import React from 'react'; import { Link } from 'react-router'; const FeaturedProject = (() => <section className="home-featured"> <h3 className="secondary-kicker">Featured Project</h3> <div className="home-featured-images"> <img alt="The direct image (left) and dispersed spectrum (right) of a real galaxy from the WISP survey. The white arrow shows the bright light produced by an emission line." src="./assets/featured-projects/featured-project-20170531-galaxy-nurseries.jpg" /> </div> <h3 className="secondary-headline">Introducing the 100th Zooniverse project: Galaxy Nurseries</h3> <p className="display-body">Help researchers figure out how our universe has changed over time by finding baby galaxies.</p> <Link to="projects/hughdickinson/galaxy-nurseries" className="primary-button primary-button--light">View Project!</Link> </section> ); export default FeaturedProject;
/* Featured Project Component ========================== * This component highlights specific projects on the home page. * NOT to be confused with <HomePagePromoted /> * Content is hardcoded for the moment; improvements on this are welcome. * Originally created to highlight 2017 Mar/Apr Stargazing Live projects. * Design: @beckyrother; code: @shaunanoordin; documented/updated: 20170403 */ import React from 'react'; import { Link } from 'react-router'; const FeaturedProject = (() => <section className="home-featured"> <h1 className="secondary-kicker">Featured Project</h1> <div className="home-featured-images"> <img alt="The direct image (left) and dispersed spectrum (right) of a real galaxy from the WISP survey. The white arrow shows the bright light produced by an emission line." src="./assets/featured-projects/featured-project-20170531-galaxy-nurseries.jpg" /> </div> <h2 className="secondary-headline">Introducing the 100th Zooniverse project: Galaxy Nurseries</h2> <p className="display-body">Help researchers figure out how our universe has changed over time by finding baby galaxies.</p> <Link to="projects/hughdickinson/galaxy-nurseries" className="primary-button primary-button--light">View Project!</Link> </section> ); export default FeaturedProject;
Adjust Headers in Featured Project Section
Adjust Headers in Featured Project Section
JSX
apache-2.0
amyrebecca/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,zooniverse/Panoptes-Front-End,jelliotartz/Panoptes-Front-End
--- +++ @@ -13,14 +13,14 @@ const FeaturedProject = (() => <section className="home-featured"> - <h3 className="secondary-kicker">Featured Project</h3> + <h1 className="secondary-kicker">Featured Project</h1> <div className="home-featured-images"> <img alt="The direct image (left) and dispersed spectrum (right) of a real galaxy from the WISP survey. The white arrow shows the bright light produced by an emission line." src="./assets/featured-projects/featured-project-20170531-galaxy-nurseries.jpg" /> </div> - <h3 className="secondary-headline">Introducing the 100th Zooniverse project: Galaxy Nurseries</h3> + <h2 className="secondary-headline">Introducing the 100th Zooniverse project: Galaxy Nurseries</h2> <p className="display-body">Help researchers figure out how our universe has changed over time by finding baby galaxies.</p> <Link to="projects/hughdickinson/galaxy-nurseries" className="primary-button primary-button--light">View Project!</Link> </section>
28000091664f84161cec79277095652f4da99bfd
src/components/app.jsx
src/components/app.jsx
import React from 'react' import { connect } from 'react-redux' import { Grid, Row, Col, Input, Button } from 'react-bootstrap' import ObjectSelect from './objectselect.jsx' import ObjectView from './objectview.jsx' import TableView from './tableview.jsx' import { selectObject, updateObjectInfo } from '../actions.js' let stateToProps = state => { let { database, objects, objectInfoByName, selectedObjectName } = state; return { database, objects, objectInfoByName, selectedObjectName }; }; let App = connect(stateToProps)(props => { let selectedObjectInfo = props.objectInfoByName.get(props.selectedObjectName); let readOnlyQuery = props.database ? (sql, params) => props.database.query(sql, params) : () => null; return ( <Grid> <Row> <Col md={3}> <ObjectSelect objects={props.objects} onSelect={name => { props.dispatch(selectObject(name)) if(!props.objectInfoByName.get(name)) { props.dispatch(updateObjectInfo(props.database, name)); } }} /> </Col> <Col md={9}> <ObjectView readOnlyQuery={readOnlyQuery} info={selectedObjectInfo} /> </Col> </Row> </Grid> ); }); export default App;
import React from 'react' import { connect } from 'react-redux' import { Grid, Row, Col, Input, Button } from 'react-bootstrap' import ObjectSelect from './objectselect.jsx' import ObjectView from './objectview.jsx' import TableView from './tableview.jsx' import { selectObject, updateObjectInfo } from '../actions.js' let stateToProps = state => { let { database, objects, objectInfoByName, selectedObjectName } = state; return { database, objects, objectInfoByName, selectedObjectName }; }; let App = connect(stateToProps)(props => { let selectedObjectInfo = props.objectInfoByName.get(props.selectedObjectName); let readOnlyQuery = props.database ? (sql, params) => props.database.query(sql, params) : () => null; return ( <Grid> <Row> <Col md={3}> <ObjectSelect objects={props.objects} onSelect={name => { props.dispatch(selectObject(name)) if(!props.objectInfoByName.get(name)) { props.dispatch(updateObjectInfo(props.database, name)); } }} /> </Col> <Col md={9}> <h2>SQL</h2> <Input type="textarea" /> <Button>Execute</Button> <ObjectView readOnlyQuery={readOnlyQuery} info={selectedObjectInfo} /> </Col> </Row> </Grid> ); }); export default App;
Add non-functional SQL text box
Add non-functional SQL text box
JSX
mit
rjw57/rdb
--- +++ @@ -33,6 +33,10 @@ /> </Col> <Col md={9}> + <h2>SQL</h2> + <Input type="textarea" /> + <Button>Execute</Button> + <ObjectView readOnlyQuery={readOnlyQuery} info={selectedObjectInfo} /> </Col>
32232ba1eb0da206a0bc051e941a360802dabd66
src/app/global/NavBar.jsx
src/app/global/NavBar.jsx
import React, { Component } from 'react'; import { Link } from 'react-router' export default class NavBar extends Component { constructor(props) { super(props); this.state = { authenticated: true } } render() { return ( <ul className="nav__list"> { this.renderNavItems() } </ul> ) } renderNavItems() { if (this.state.authenticated) { return ( <span> <li className="nav__item"> <Link to="/florence/collections" activeClassName="selected" className="nav__link">Collections</Link> </li> <li className="nav__item"> <a className="nav__link">Publishing queue</a> </li> <li className="nav__item"> <a className="nav__link">Reports</a> </li> <li className="nav__item"> <a className="nav__link">Users and access</a> </li> <li className="nav__item"> <a className="nav__link">Teams</a> </li> <li className="nav__item"> <a className="nav__link">Logout</a> </li> </span> ) } else { return ( <li className="nav__item"> <a className="nav__link">Login</a> </li> ) } } }
import React, { Component } from 'react'; import { Link } from 'react-router' import { connect } from 'react-redux' class NavBar extends Component { constructor(props) { super(props); } render() { return ( <ul className="nav__list"> { this.renderNavItems() } </ul> ) } renderNavItems() { if (this.props.isAuthenticated) { return ( <span> <li className="nav__item"> <Link to="/florence/collections" activeClassName="selected" className="nav__link">Collections</Link> </li> <li className="nav__item"> <a className="nav__link">Publishing queue</a> </li> <li className="nav__item"> <a className="nav__link">Reports</a> </li> <li className="nav__item"> <a className="nav__link">Users and access</a> </li> <li className="nav__item"> <a className="nav__link">Teams</a> </li> <li className="nav__item"> <a className="nav__link">Logout</a> </li> </span> ) } else { return ( <li className="nav__item"> <a className="nav__link">Login</a> </li> ) } } } function mapStateToProps(state) { const isAuthenticated = state.state.user.isAuthenticated; return { isAuthenticated } } export default connect(mapStateToProps)(NavBar);
Use mapStateToProps to allow checking if user is authenticated
Use mapStateToProps to allow checking if user is authenticated Former-commit-id: 8f66bdcc2058c4aae92d764b31de7b1fdb464422 Former-commit-id: c730a300e5db246064d2bb91eb5f8b5b15339e6c Former-commit-id: 12c0fab3a752627d4ae1bd9d2d4123a10b38bb84
JSX
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -1,14 +1,12 @@ import React, { Component } from 'react'; import { Link } from 'react-router' +import { connect } from 'react-redux' -export default class NavBar extends Component { +class NavBar extends Component { constructor(props) { super(props); - this.state = { - authenticated: true - } } render() { @@ -22,7 +20,7 @@ } renderNavItems() { - if (this.state.authenticated) { + if (this.props.isAuthenticated) { return ( <span> <li className="nav__item"> @@ -60,3 +58,12 @@ } } + +function mapStateToProps(state) { + const isAuthenticated = state.state.user.isAuthenticated; + + return { + isAuthenticated + } +} +export default connect(mapStateToProps)(NavBar);
db551ae5bec81a0e92ef13f867e573fd52767946
src/view/containers/Setup/ConnectedSetupScreen.jsx
src/view/containers/Setup/ConnectedSetupScreen.jsx
"use strict"; const React = require('react'); const { connect } = require('react-redux'); const SetupScreen = require('../../components/Setup/SetupScreen.jsx'); const ProjectAction = require('../../../action/ProjectAction'); const RouterAction = require('../../../action/RouterAction'); module.exports = connect( // state to props (state) => { return {}; }, // dispatch functions to props (dispatch) => { return { onBackClick: () => { dispatch(RouterAction.createGoBackAction()); }, onCreateClick: (params) => { dispatch(ProjectAction.createSetProjectAction(params)); } }; } )(SetupScreen);
"use strict"; const React = require('react'); const { connect } = require('react-redux'); const SetupScreen = require('../../components/Setup/SetupScreen.jsx'); const ProjectAction = require('../../../action/ProjectAction'); const RouterAction = require('../../../action/RouterAction'); module.exports = connect( // state to props (state) => { return {}; }, // dispatch functions to props (dispatch) => { return { onBackClick: () => { dispatch(RouterAction.createGoToStartScreenAction()); }, onCreateClick: (params) => { dispatch(ProjectAction.createSetProjectAction(params)); } }; } )(SetupScreen);
Fix BACK button on Setup screen
Fix BACK button on Setup screen
JSX
apache-2.0
FrantisekGazo/PCA-Viewer,FrantisekGazo/PCA-Viewer
--- +++ @@ -17,7 +17,7 @@ (dispatch) => { return { onBackClick: () => { - dispatch(RouterAction.createGoBackAction()); + dispatch(RouterAction.createGoToStartScreenAction()); }, onCreateClick: (params) => { dispatch(ProjectAction.createSetProjectAction(params));
4e73b9b18e0e1a7a929eafc886b611a536237ce8
app/assets/javascripts/components/overview/course_type_selector.jsx
app/assets/javascripts/components/overview/course_type_selector.jsx
import React from 'react'; const CourseTypeSelector = React.createClass({ render() { const currentType = this.props.course.type; let selector = currentType; if (this.props.editable && currentType !== 'LegacyCourse') { selector = ( <div className="select_wrapper"> <select name="course_type" defaultValue={this.props.course.type}> <option value="ClassroomProgramCourse" key="ClassroomProgramCourse">Classroom Program</option> <option value="VisitingScholarship" key="VisitingScholarship">Visiting Scholarship</option> <option value="Editathon" key="Editathon">Edit-a-thon</option> <option value="BasicCourse" key="BasicCourse">Generic Course</option> </select> </div> ); } return ( <div className="course_type_selector"> <span>Type: {selector}</span> </div> ); } }); export default CourseTypeSelector;
import React from 'react'; const CourseTypeSelector = React.createClass({ propTypes: { course: React.PropTypes.object, editable: React.PropTypes.bool }, render() { const currentType = this.props.course.type; let selector = currentType; if (this.props.editable && currentType !== 'LegacyCourse') { selector = ( <div className="select_wrapper"> <select name="course_type" defaultValue={this.props.course.type}> <option value="ClassroomProgramCourse" key="ClassroomProgramCourse">Classroom Program</option> <option value="VisitingScholarship" key="VisitingScholarship">Visiting Scholarship</option> <option value="Editathon" key="Editathon">Edit-a-thon</option> <option value="BasicCourse" key="BasicCourse">Generic Course</option> </select> </div> ); } return ( <div className="course_type_selector"> <span>Type: {selector}</span> </div> ); } }); export default CourseTypeSelector;
Add prop validation to CourseTypeSelector
Add prop validation to CourseTypeSelector
JSX
mit
WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,alpha721/WikiEduDashboard,Wowu/WikiEduDashboard,alpha721/WikiEduDashboard,alpha721/WikiEduDashboard,feelfreelinux/WikiEduDashboard,Wowu/WikiEduDashboard,majakomel/WikiEduDashboard,feelfreelinux/WikiEduDashboard,majakomel/WikiEduDashboard,MusikAnimal/WikiEduDashboard,KarmaHater/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,KarmaHater/WikiEduDashboard,MusikAnimal/WikiEduDashboard,Wowu/WikiEduDashboard,Wowu/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,feelfreelinux/WikiEduDashboard,feelfreelinux/WikiEduDashboard,KarmaHater/WikiEduDashboard,MusikAnimal/WikiEduDashboard,KarmaHater/WikiEduDashboard,majakomel/WikiEduDashboard,sejalkhatri/WikiEduDashboard,alpha721/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,majakomel/WikiEduDashboard,MusikAnimal/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard
--- +++ @@ -1,6 +1,11 @@ import React from 'react'; const CourseTypeSelector = React.createClass({ + propTypes: { + course: React.PropTypes.object, + editable: React.PropTypes.bool + }, + render() { const currentType = this.props.course.type; let selector = currentType;
cfa1e2e180837f380c4b515d34e106756b9071bd
packages/client/src/modules/user/containers/Register.jsx
packages/client/src/modules/user/containers/Register.jsx
// React import React from 'react'; // Apollo import { graphql, compose } from 'react-apollo'; // Components import RegisterView from '../components/RegisterView'; import REGISTER from '../graphql/Register.graphql'; import settings from '../../../../../../settings'; class Register extends React.Component { render() { return <RegisterView {...this.props} />; } } const RegisterWithApollo = compose( graphql(REGISTER, { props: ({ ownProps: { history, navigation }, mutate }) => ({ register: async ({ username, email, password }) => { try { const { data: { register } } = await mutate({ variables: { input: { username, email, password } } }); if (register.errors) { return { errors: register.errors }; } if (history) { if (settings.subscription.enabled) { return history.push('/subscription'); } return history.push('/profile'); } if (navigation) { return navigation.goBack(); } } catch (e) { console.log(e.graphQLErrors); } } }) }) )(Register); export default RegisterWithApollo;
// React import React from 'react'; // Apollo import { graphql, compose } from 'react-apollo'; // Components import RegisterView from '../components/RegisterView'; import REGISTER from '../graphql/Register.graphql'; import settings from '../../../../../../settings'; class Register extends React.Component { render() { return <RegisterView {...this.props} />; } } const RegisterWithApollo = compose( graphql(REGISTER, { props: ({ ownProps: { history, navigation }, mutate }) => ({ register: async ({ username, email, password }) => { try { const { data: { register } } = await mutate({ variables: { input: { username, email, password } } }); if (register.errors) { return { errors: register.errors }; } else if (history) { if (settings.subscription.enabled) { history.push('/subscription'); } else { history.push('/profile'); } } else if (navigation) { navigation.goBack(); } } catch (e) { console.log(e.graphQLErrors); } } }) }) )(Register); export default RegisterWithApollo;
Fix error after new user registration
Fix error after new user registration
JSX
mit
sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-fullstack-starter-kit
--- +++ @@ -30,15 +30,14 @@ if (register.errors) { return { errors: register.errors }; - } - if (history) { + } else if (history) { if (settings.subscription.enabled) { - return history.push('/subscription'); + history.push('/subscription'); + } else { + history.push('/profile'); } - return history.push('/profile'); - } - if (navigation) { - return navigation.goBack(); + } else if (navigation) { + navigation.goBack(); } } catch (e) { console.log(e.graphQLErrors);
c550d46f863de22e7d28f82edadd5ee2fabd1d8b
src/app/components/InputBox.jsx
src/app/components/InputBox.jsx
import React from 'react'; import cmd from '../cmd'; export default class InputBox extends React.Component { constructor() { super(); this.history = []; this.historyIndex = 0; } render() { return <input id="in" type="text" onKeyUp={e => this.onKeyUp(e)} onKeyDown={e => this.onKeyDown(e)} className="expressionInput mono" placeholder="type expression like '1>>2' or 'help' "/>; } onKeyUp(e) { var input = e.target; if (e.keyCode != 13 || input.value.trim().length == 0) { return; } var value = input.value; this.history.unshift(value); input.value = ''; cmd.execute(value); } onKeyDown(args) { if(args.keyCode == 38) { if (this.history.length > this.historyIndex) { // up args.target.value = this.history[this.historyIndex++]; } args.preventDefault(); return; } if(args.keyCode == 40) { if(this.historyIndex > 0) { // up args.target.value = this.history[--this.historyIndex]; } args.preventDefault(); } } }
import React from 'react'; import cmd from '../cmd'; export default class InputBox extends React.Component { constructor() { super(); this.history = []; this.historyIndex = 0; } componentDidMount(){ this.nameInput.focus(); } render() { return <input id="in" type="text" ref={(input) => { this.nameInput = input; }} onKeyUp={e => this.onKeyUp(e)} onKeyDown={e => this.onKeyDown(e)} className="expressionInput mono" placeholder="type expression like '1>>2' or 'help' "/>; } onKeyUp(e) { var input = e.target; if (e.keyCode != 13 || input.value.trim().length == 0) { return; } var value = input.value; this.history.unshift(value); input.value = ''; cmd.execute(value); } onKeyDown(args) { if(args.keyCode == 38) { if (this.history.length > this.historyIndex) { // up args.target.value = this.history[this.historyIndex++]; } args.preventDefault(); return; } if(args.keyCode == 40) { if(this.historyIndex > 0) { // up args.target.value = this.history[--this.historyIndex]; } args.preventDefault(); } } }
Add autofocus for name input
Add autofocus for name input
JSX
agpl-3.0
BorysLevytskyi/BitwiseCmd,BorysLevytskyi/BitwiseCmd,BorysLevytskyi/BitwiseCmd
--- +++ @@ -8,8 +8,13 @@ this.historyIndex = 0; } + componentDidMount(){ + this.nameInput.focus(); + } + render() { return <input id="in" type="text" + ref={(input) => { this.nameInput = input; }} onKeyUp={e => this.onKeyUp(e)} onKeyDown={e => this.onKeyDown(e)} className="expressionInput mono"
3427fb992a79e04f897faaba9fa6efd32f6e3a8d
src/components/main/projects_detail/component.jsx
src/components/main/projects_detail/component.jsx
"use strict"; var React = require('react') , Immutable = require('immutable') module.exports = React.createClass({ displayName: 'Project', renderBreadcrumb: function () { var Breadcrumb = require('../../shared/breadcrumb/component.jsx') , project = this.props.data , crumbs crumbs = Immutable.fromJS([ { href: project.get('url'), label: project.get('name') } ]); return <Breadcrumb crumbs={crumbs} /> }, render: function () { var project = this.props.data console.log(project.toJS()) return ( <div id="project"> {this.renderBreadcrumb()} <header><h2>{project.get('name')}</h2></header> <section id="project-details"> <div id="project-about"> <p>{project.get('description')}</p> </div> <ul> <li><a href={project.get('notes_url')}>All notes</a></li> <li><a href={project.get('topics_url')}>All topics</a></li> <li><a href={project.get('documents_url')}>All documents</a></li> </ul> </section> </div> ) } });
"use strict"; var React = require('react') , Immutable = require('immutable') module.exports = React.createClass({ displayName: 'Project', renderBreadcrumb: function () { var Breadcrumb = require('../../shared/breadcrumb/component.jsx') , project = this.props.data , crumbs crumbs = Immutable.fromJS([ { href: project.get('url'), label: project.get('name') } ]); return <Breadcrumb crumbs={crumbs} /> }, render: function () { var project = this.props.data return ( <div id="project"> {this.renderBreadcrumb()} <header><h2>{project.get('name')}</h2></header> <section id="project-details"> <div id="project-about"> <p>{project.get('description')}</p> </div> <ul> <li><a href={project.get('notes_url')}>All notes</a></li> <li><a href={project.get('topics_url')}>All topics</a></li> <li><a href={project.get('documents_url')}>All documents</a></li> </ul> </section> </div> ) } });
Remove console logging [oops emoji].
Remove console logging [oops emoji].
JSX
agpl-3.0
editorsnotes/editorsnotes-renderer
--- +++ @@ -22,8 +22,6 @@ render: function () { var project = this.props.data - console.log(project.toJS()) - return ( <div id="project">
58a42a09fb29782053449a697d37955489b774c8
assets/scripts/menus/ContributeMenu.jsx
assets/scripts/menus/ContributeMenu.jsx
import React from 'react' import Menu from './Menu' import { trackEvent } from '../app/event_tracking' import { t } from '../app/locale' export default class ContributeMenu extends React.PureComponent { onClickGitHub () { trackEvent('INTERACTION', '[Contribute menu] GitHub link clicked', null, null, false) } onClickDonate () { trackEvent('INTERACTION', '[Contribute menu] Donate link clicked', null, null, false) } onClickStickers () { trackEvent('INTERACTION', '[Contribute menu] Stickers link clicked', null, null, false) } render () { return ( <Menu {...this.props}> <a href="https://github.com/streetmix/streetmix/" target="_blank" onClick={this.onClickGitHub}> <svg className="icon"> <use xlinkHref="#icon-github" /> </svg> <span>{t('menu.contribute.opensource', 'Contribute to open source')}</span> </a> <a href="https://opencollective.com/streetmix/" target="_blank" onClick={this.onClickDonate}> <span>{t('menu.contribute.donate', 'Donate')}</span> </a> <a href="https://www.stickermule.com/user/1069909781/stickers" target="_blank" onClick={this.onClickStickers}> <span>{t('menu.contribute.stickers', 'Buy a sticker sheet!')}</span> </a> </Menu> ) } }
import React from 'react' import Menu from './Menu' import { trackEvent } from '../app/event_tracking' import { t } from '../app/locale' export default class ContributeMenu extends React.PureComponent { onClickGitHub () { trackEvent('INTERACTION', '[Contribute menu] GitHub link clicked', null, null, false) } onClickDonate () { trackEvent('INTERACTION', '[Contribute menu] Donate link clicked', null, null, false) } onClickStickers () { trackEvent('INTERACTION', '[Contribute menu] Stickers link clicked', null, null, false) } render () { return ( <Menu {...this.props}> <a href="https://github.com/streetmix/streetmix/" target="_blank" onClick={this.onClickGitHub}> <svg className="icon"> <use xlinkHref="#icon-github" /> </svg> <span>{t('menu.contribute.opensource', 'Contribute to open source')}</span> </a> <a href="https://opencollective.com/streetmix/" target="_blank" onClick={this.onClickDonate}> <span>{t('menu.contribute.donate', 'Donate')}</span> </a> {/* Sticker link is broken <a href="https://www.stickermule.com/user/1069909781/stickers" target="_blank" onClick={this.onClickStickers}> <span>{t('menu.contribute.stickers', 'Buy a sticker sheet!')}</span> </a> */} </Menu> ) } }
Disable stickers link (is broken)
Disable stickers link (is broken)
JSX
bsd-3-clause
codeforamerica/streetmix,codeforamerica/streetmix,codeforamerica/streetmix
--- +++ @@ -28,9 +28,10 @@ <a href="https://opencollective.com/streetmix/" target="_blank" onClick={this.onClickDonate}> <span>{t('menu.contribute.donate', 'Donate')}</span> </a> + {/* Sticker link is broken <a href="https://www.stickermule.com/user/1069909781/stickers" target="_blank" onClick={this.onClickStickers}> <span>{t('menu.contribute.stickers', 'Buy a sticker sheet!')}</span> - </a> + </a> */} </Menu> ) }
17e3c22256c90c8287aacb38bbe0934edc737b57
frontend/signup.jsx
frontend/signup.jsx
import React from 'react' import ReactDOM from 'react-dom' import MobileInput from './components/mobile-input' const element = document.getElementById('div_id_mobile'); let label = element.querySelector('label'); let hint = element.querySelector('#hint_id_mobile'); let error = element.querySelector('#error_1_id_mobile'); let input = element.querySelector('#id_mobile'); ReactDOM.render( <MobileInput label={label.textContent} hint={hint.textContent} error={error?error.textContent:null} value={input.value} />, document.getElementById('div_id_mobile') ); let otherGoalDiv = document.getElementById('div_id_goals_other'); let goalInput = document.getElementById('id_goals'); if (goalInput.value != 'Other'){ otherGoalDiv.style = 'display: none;'; } goalInput.onchange = (e) => { if (e.target.value == 'Other'){ otherGoalDiv.style = ''; document.getElementById('id_goals_other').required = true; } else { otherGoalDiv.style = 'display: none;'; } };
import React from 'react' import ReactDOM from 'react-dom' import MobileInput from './components/mobile-input' const element = document.getElementById('div_id_mobile'); let label = element.querySelector('label'); let hint = element.querySelector('#hint_id_mobile'); let error = element.querySelector('#error_1_id_mobile'); let input = element.querySelector('#id_mobile'); ReactDOM.render( <MobileInput label={label.textContent} hint={hint.textContent} error={error?error.textContent:null} value={input.value} />, document.getElementById('div_id_mobile') );
Remove code previously used to show/hide "other goal" field
Remove code previously used to show/hide "other goal" field
JSX
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
--- +++ @@ -8,6 +8,7 @@ let error = element.querySelector('#error_1_id_mobile'); let input = element.querySelector('#id_mobile'); + ReactDOM.render( <MobileInput label={label.textContent} @@ -17,18 +18,3 @@ />, document.getElementById('div_id_mobile') ); - - -let otherGoalDiv = document.getElementById('div_id_goals_other'); -let goalInput = document.getElementById('id_goals'); -if (goalInput.value != 'Other'){ - otherGoalDiv.style = 'display: none;'; -} -goalInput.onchange = (e) => { - if (e.target.value == 'Other'){ - otherGoalDiv.style = ''; - document.getElementById('id_goals_other').required = true; - } else { - otherGoalDiv.style = 'display: none;'; - } -};
b6c63872423b2ec9722d786749a7420e26edc471
app/containers/NotifierContainer.jsx
app/containers/NotifierContainer.jsx
import React from 'react'; import {connect} from 'react-redux'; import playSound from '../utilities/playSound'; class Notifier extends React.Component { componentDidUpdate () { if (this.props.sound.name) { playSound(this.props.sound.url) } } render () { return null; } } let mapStateToProps = state => { return { sound: state.audioNotifier } } export default connect(mapStateToProps, null)(Notifier)
import React from 'react'; import {connect} from 'react-redux'; import playSound from '../utilities/playSound'; class Notifier extends React.Component { componentDidUpdate () { if (this.props.sound.name) { playSound(this.props.sound.url) } } render () { return null; } } let mapStateToProps = state => { return { sound: state.audioNotifier } } export default connect(mapStateToProps, null)(Notifier)
Remove extra line in audio notifier.
Remove extra line in audio notifier.
JSX
mit
donthedeveloper/kindercode,donthedeveloper/kindercode,donthedeveloper/kindercode
--- +++ @@ -22,4 +22,3 @@ } export default connect(mapStateToProps, null)(Notifier) -
524370711c0856be8b3efb4aff543bb96da102ce
ui/component/common/wait-until-on-page.jsx
ui/component/common/wait-until-on-page.jsx
// @flow import React from 'react'; import debounce from 'util/debounce'; const DEBOUNCE_SCROLL_HANDLER_MS = 300; type Props = { children: any, lastUpdateDate?: any, skipWait?: boolean, placeholder?: any, }; export default function WaitUntilOnPage(props: Props) { const ref = React.useRef(); const [shouldRender, setShouldRender] = React.useState(false); React.useEffect(() => { setShouldRender(false); }, [props.lastUpdateDate]); React.useEffect(() => { const handleDisplayingRef = debounce((e) => { const element = ref && ref.current; if (element) { const bounding = element.getBoundingClientRect(); if ( bounding.bottom >= 0 && bounding.right >= 0 && // $FlowFixMe bounding.top <= (window.innerHeight || document.documentElement.clientHeight) && // $FlowFixMe bounding.left <= (window.innerWidth || document.documentElement.clientWidth) ) { setShouldRender(true); } } if (element && !shouldRender) { window.addEventListener('scroll', handleDisplayingRef); return () => window.removeEventListener('scroll', handleDisplayingRef); } }, DEBOUNCE_SCROLL_HANDLER_MS); if (ref) { handleDisplayingRef(); } }, [ref, setShouldRender, shouldRender]); const render = props.skipWait || shouldRender; return ( <div ref={ref}> {render && props.children} {!render && props.placeholder !== undefined && props.placeholder} </div> ); }
// @flow import React from 'react'; import debounce from 'util/debounce'; const DEBOUNCE_SCROLL_HANDLER_MS = 25; type Props = { children: any, skipWait?: boolean, placeholder?: any, }; export default function WaitUntilOnPage(props: Props) { const ref = React.useRef(); const [shouldRender, setShouldRender] = React.useState(false); React.useEffect(() => { const handleDisplayingRef = debounce((e) => { const element = ref && ref.current; if (element) { const bounding = element.getBoundingClientRect(); if ( bounding.bottom >= 0 && bounding.right >= 0 && // $FlowFixMe bounding.top <= (window.innerHeight || document.documentElement.clientHeight) && // $FlowFixMe bounding.left <= (window.innerWidth || document.documentElement.clientWidth) ) { setShouldRender(true); } } if (element && !shouldRender) { window.addEventListener('scroll', handleDisplayingRef); return () => window.removeEventListener('scroll', handleDisplayingRef); } }, DEBOUNCE_SCROLL_HANDLER_MS); if (ref) { handleDisplayingRef(); } }, [ref, setShouldRender, shouldRender]); const render = props.skipWait || shouldRender; return ( <div ref={ref}> {render && props.children} {!render && props.placeholder !== undefined && props.placeholder} </div> ); }
Reduce debounce ms; remove unused hack
WaitUntilOnPage: Reduce debounce ms; remove unused hack (1) Reduced the debouncing duration so that the final element can be rendered asap after visible. - If the user is scrolling non-stop, it would continue to debounce and the GUI ends up not showing the final element. - 25ms seems enough to prevent the initial false-positive that occurs in the scenario of "adjacent/upper elements resized late, so our element was briefly on screen when mounted". If not enough, we can make this a parameter. (2) Removed `lastUpdateDate` that was a quick hack for Recommended section. We don't use it on that element anymore, so remove the hack to keep the file clean.
JSX
mit
lbryio/lbry-app,lbryio/lbry-app
--- +++ @@ -2,11 +2,10 @@ import React from 'react'; import debounce from 'util/debounce'; -const DEBOUNCE_SCROLL_HANDLER_MS = 300; +const DEBOUNCE_SCROLL_HANDLER_MS = 25; type Props = { children: any, - lastUpdateDate?: any, skipWait?: boolean, placeholder?: any, }; @@ -14,10 +13,6 @@ export default function WaitUntilOnPage(props: Props) { const ref = React.useRef(); const [shouldRender, setShouldRender] = React.useState(false); - - React.useEffect(() => { - setShouldRender(false); - }, [props.lastUpdateDate]); React.useEffect(() => { const handleDisplayingRef = debounce((e) => {
bb05528977fb3d06ad3eb57e14fbd960a9c7e392
src/components/App/index.jsx
src/components/App/index.jsx
// @flow /* eslint-disable react/prefer-stateless-function */ import React from 'react'; import { Link } from 'react-router'; import Echo from 'components/Echo'; import hello from './hello.jpg'; import s from './styles.scss'; export default class App extends React.Component { static defaultProps: { className: string, }; render() { return ( <div className={this.props.className}> <img className={s.robot} src={hello} alt="Cute robot?" /> <Echo text="Hello, world! Find me in App.jsx!" /> <div style={{ border: 'solid 1px grey' }}> <p>This is a child container for nested routes</p> {this.props.children || <Link to="/nested">Link to /nested. Click to show counter. Back/Forward buttons work.</Link>} </div> </div> ); } } App.propTypes = { children: React.PropTypes.element, className: React.PropTypes.string, }; App.defaultProps = { children: null, className: s.app, };
// @flow /* eslint-disable react/prefer-stateless-function */ import React from 'react'; import { Link } from 'react-router'; import Echo from 'components/Echo'; import hello from './hello.jpg'; import s from './styles.scss'; export default class App extends React.Component { static defaultProps: { className: string, }; render() { return ( <div className={this.props.className}> <img className={s.robot} src={hello} alt="Cute robot?" /> <Echo text="Hello, world! Find me in src/components/App/index.jsx!" /> <div style={{ border: 'solid 1px grey' }}> <p>This is a child container for nested routes</p> {this.props.children || <Link to="/nested">Link to /nested. Click to show counter. Back/Forward buttons work.</Link>} </div> </div> ); } } App.propTypes = { children: React.PropTypes.element, className: React.PropTypes.string, }; App.defaultProps = { children: null, className: s.app, };
Fix "Find me in" location for App component
Fix "Find me in" location for App component
JSX
mit
gyng/jsapp-boilerplate,gyng/ditherer,gyng/jsapp-boilerplate,gyng/jsapp-boilerplate,gyng/ditherer,gyng/ditherer,gyng/jsapp-boilerplate
--- +++ @@ -18,7 +18,7 @@ return ( <div className={this.props.className}> <img className={s.robot} src={hello} alt="Cute robot?" /> - <Echo text="Hello, world! Find me in App.jsx!" /> + <Echo text="Hello, world! Find me in src/components/App/index.jsx!" /> <div style={{ border: 'solid 1px grey' }}> <p>This is a child container for nested routes</p>
dea13412bdedc75c40147f0d1a8c792326c8951e
app/layout/site-subnav.jsx
app/layout/site-subnav.jsx
import React from 'react'; import TriggeredModalForm from 'modal-form/triggered'; const SiteSubnav = React.createClass({ propTypes: { isMobile: React.PropTypes.bool, children: React.PropTypes.node }, trigger() { return( <span className="site-nav__link" activeClassName="site-nav__link--active" title="News" aria-label="News">News</span> ); }, render() { if(this.props.isMobile) { return this.props.children; } else { return( <TriggeredModalForm className="site-nav__modal" trigger={this.trigger()}> {this.props.children} </TriggeredModalForm> ); } } }); export default SiteSubnav;
import React from 'react'; import ReactDOM from 'react-dom'; import TriggeredModalForm from 'modal-form/triggered'; const FOCUSABLES = 'a[href], button'; const UP = 38; const DOWN = 40; const SiteSubnav = React.createClass({ propTypes: { isMobile: React.PropTypes.bool, children: React.PropTypes.node }, trigger() { return( <span className="site-nav__link" activeClassName="site-nav__link--active" title="News" aria-label="News">News</span> ); }, navigateMenu(event) { const focusables = [ReactDOM.findDOMNode(this.menuButton)]; if (this.menu) { const menuItems = this.menu.querySelectorAll(FOCUSABLES); Array.prototype.forEach.call(menuItems, (item) => { focusables.push(item); }); } const focusIndex = focusables.indexOf(document.activeElement); const newIndex = { [UP]: Math.max(0, focusIndex - 1), [DOWN]: Math.min(focusables.length - 1, focusIndex + 1) }[event.which]; if (focusables[newIndex] !== undefined) { focusables[newIndex].focus(); event.preventDefault(); } }, render() { if(this.props.isMobile) { return this.props.children; } else { return( <TriggeredModalForm ref={(button) => { this.menuButton = button; }} className="site-nav__modal" trigger={this.trigger()} triggerProps={{ onKeyDown: this.navigateMenu }} > <div ref={(menu) => { this.menu = menu; }} onKeyDown={this.navigateMenu} > {this.props.children} </div> </TriggeredModalForm> ); } } }); export default SiteSubnav;
Add keyboard support to the News menu Allows the menu to be navigated with the up/down keys.
Add keyboard support to the News menu Allows the menu to be navigated with the up/down keys.
JSX
apache-2.0
zooniverse/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,jelliotartz/Panoptes-Front-End
--- +++ @@ -1,5 +1,11 @@ import React from 'react'; +import ReactDOM from 'react-dom'; import TriggeredModalForm from 'modal-form/triggered'; + +const FOCUSABLES = 'a[href], button'; + +const UP = 38; +const DOWN = 40; const SiteSubnav = React.createClass({ propTypes: { @@ -16,13 +22,46 @@ ); }, + navigateMenu(event) { + const focusables = [ReactDOM.findDOMNode(this.menuButton)]; + if (this.menu) { + const menuItems = this.menu.querySelectorAll(FOCUSABLES); + Array.prototype.forEach.call(menuItems, (item) => { + focusables.push(item); + }); + } + const focusIndex = focusables.indexOf(document.activeElement); + + const newIndex = { + [UP]: Math.max(0, focusIndex - 1), + [DOWN]: Math.min(focusables.length - 1, focusIndex + 1) + }[event.which]; + + if (focusables[newIndex] !== undefined) { + focusables[newIndex].focus(); + event.preventDefault(); + } + }, + render() { if(this.props.isMobile) { return this.props.children; } else { return( - <TriggeredModalForm className="site-nav__modal" trigger={this.trigger()}> - {this.props.children} + <TriggeredModalForm + ref={(button) => { this.menuButton = button; }} + className="site-nav__modal" + trigger={this.trigger()} + triggerProps={{ + onKeyDown: this.navigateMenu + }} + > + <div + ref={(menu) => { this.menu = menu; }} + onKeyDown={this.navigateMenu} + > + {this.props.children} + </div> </TriggeredModalForm> ); }
9034e3b5c0921abfa7e2c0cab81e781c936ba474
src/request/components/request-summary-list-view.jsx
src/request/components/request-summary-list-view.jsx
'use strict'; var glimpse = require('glimpse'); var React = require('react'); var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; var SummaryItem = require('./request-summary-list-item-view'); module.exports = React.createClass({ render: function () { var allRequets = this.props.allRequets; return ( <div className="request-summary-list-holder"> <ReactCSSTransitionGroup component="div" transitionName="request-summary-item-holder"> {allRequets.map(function(request) { return <SummaryItem key={request.id} request={request} />; })} </ReactCSSTransitionGroup> {glimpse.util.isEmpty(allRequets) ? <em>No found entries.</em> : null } </div> ); } });
'use strict'; var glimpse = require('glimpse'); var React = require('react'); var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; var SummaryItem = require('./request-summary-list-item-view'); module.exports = React.createClass({ render: function () { var allRequets = this.props.allRequets; return ( <div className="request-summary-list-holder"> <ReactCSSTransitionGroup component="div" transitionName="request-summary-group-item"> {allRequets.map(function(request) { return <SummaryItem key={request.id} request={request} />; })} </ReactCSSTransitionGroup> {glimpse.util.isEmpty(allRequets) ? <em>No found entries.</em> : null } </div> ); } });
Fix bug where transition group didn't get its class name updated to match wider refactoring
Fix bug where transition group didn't get its class name updated to match wider refactoring
JSX
unknown
avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype
--- +++ @@ -11,7 +11,7 @@ return ( <div className="request-summary-list-holder"> - <ReactCSSTransitionGroup component="div" transitionName="request-summary-item-holder"> + <ReactCSSTransitionGroup component="div" transitionName="request-summary-group-item"> {allRequets.map(function(request) { return <SummaryItem key={request.id} request={request} />; })}
095fef3d1cdf4493ad570fd9d8892933bb226587
src/common/charts/LegendChart.jsx
src/common/charts/LegendChart.jsx
'use strict'; var React = require('react'); var Legend = require('../Legend'); module.exports = React.createClass({ propTypes: { legend: React.PropTypes.bool, legendPosition: React.PropTypes.string, sideOffset: React.PropTypes.number, margins: React.PropTypes.object, data: React.PropTypes.oneOfType([ React.PropTypes.object, React.PropTypes.array ]) }, getDefaultProps: function() { return { data: {}, legend: false, legendPosition: 'right', sideOffset: 90 }; }, _renderLegend: function() { if (this.props.legend) { return ( <Legend legendPosition={this.props.legendPosition} margins={this.props.margins} colors={this.props.colors} data={this.props.data} width={this.props.width} height={this.props.height} sideOffset={this.props.sideOffset} /> ); } }, render: function() { return ( <div style={{'width': this.props.width, 'height': this.props.height}} > <h4>{this.props.title}</h4> {this._renderLegend()} <svg viewBox={this.props.viewBox} width={this.props.width - this.props.sideOffset} height={this.props.height}>{this.props.children}</svg> </div> ); } });
'use strict'; var React = require('react'); var Legend = require('../Legend'); module.exports = React.createClass({ propTypes: { legend: React.PropTypes.bool, legendPosition: React.PropTypes.string, sideOffset: React.PropTypes.number, margins: React.PropTypes.object, data: React.PropTypes.oneOfType([ React.PropTypes.object, React.PropTypes.array ]) }, getDefaultProps() { return { data: {}, legend: false, legendPosition: 'right', sideOffset: 90 }; }, _renderLegend() { if (this.props.legend) { return ( <Legend legendPosition={this.props.legendPosition} margins={this.props.margins} colors={this.props.colors} data={this.props.data} width={this.props.width} height={this.props.height} sideOffset={this.props.sideOffset} /> ); } }, render() { return ( <div style={{'width': this.props.width, 'height': this.props.height}} > <h4>{this.props.title}</h4> {this._renderLegend()} <svg viewBox={this.props.viewBox} width={this.props.width - this.props.sideOffset} height={this.props.height}>{this.props.children}</svg> </div> ); } });
Use es6 object shorthand method names in LegentChart.jsx
Use es6 object shorthand method names in LegentChart.jsx
JSX
mit
Jonekee/react-d3,kdoh/react-d3,tobyredd/rd3,captainamerican/react-d3,nnnnathann/react-d3,florapdx/react-d3,captainamerican/react-d3,sprintly/react-d3,ovjhc/react-d3,esbullington/react-d3,kdoh/react-d3,MargiePea/react-d3,Clemency10/react-d3,banzai-inc/react-d3,vladikoff/react-d3,ernest-rhinozeros/react-d3,ernest-rhinozeros/react-d3,nicolasyanncouturier/react-d3,orls/react-d3,yashprit/react-d3,Clemency10/react-d3,esbullington/react-d3,tobyredd/rd3,sprintly/react-d3,Jonekee/react-d3,reactiva/react-d3,banzai-inc/react-d3,BigDataSamuli/react-d3,reactiva/react-d3,mwhite/react-d3,nightlyop/react-d3,nicolasyanncouturier/react-d3,nnnnathann/react-d3,florapdx/react-d3,ovjhc/react-d3,yashprit/react-d3,TannerRogalsky/react-d3,MargiePea/react-d3,TannerRogalsky/react-d3,Keepsite/react-d3,vladikoff/react-d3,mwhite/react-d3,Keepsite/react-d3,BigDataSamuli/react-d3,orls/react-d3,yang-wei/rd3,nightlyop/react-d3
--- +++ @@ -16,7 +16,7 @@ ]) }, - getDefaultProps: function() { + getDefaultProps() { return { data: {}, legend: false, @@ -25,7 +25,7 @@ }; }, - _renderLegend: function() { + _renderLegend() { if (this.props.legend) { return ( <Legend @@ -41,7 +41,7 @@ } }, - render: function() { + render() { return ( <div style={{'width': this.props.width, 'height': this.props.height}} > <h4>{this.props.title}</h4>
6bfc2b83dce77c85f3bea4206c2b2409e054243e
src/assets/components/ReactModule/index.jsx
src/assets/components/ReactModule/index.jsx
import React from "react"; import PropTypes from "prop-types"; const ReactModule = props => ( <div className="ReactModule"> <h2>{props.greeting} world!</h2> <p> I'm a React component. Pura comes with <strong>React</strong> and{" "} <strong>ReactDOM</strong> installed by default. </p> <p> However, if you don't need it that's okay, too! Just don't{" "} <code>import</code> it into your modules and you'll save on precious KB. </p> </div> ); // Set default props for unset variables ReactModule.defaultProps = { greeting: "Hello" }; // Establish types for props to prevent renderering errors ReactModule.propTypes = { greeting: PropTypes.string }; export default ReactModule;
import React from "react"; import PropTypes from "prop-types"; function ReactModule({ greeting }) { return ( <div className="ReactModule"> <h2>{greeting} world!</h2> <p> I'm a React component. Pura comes with <strong>React</strong> and{" "} <strong>ReactDOM</strong> installed by default. </p> <p> However, if you don't need it that's okay, too! Just don't{" "} <code>import</code> it into your modules and you'll save on precious KB. </p> </div> ); } // Set default props for unset variables ReactModule.defaultProps = { greeting: "Hello", }; // Establish types for props to prevent renderering errors ReactModule.propTypes = { greeting: PropTypes.string, }; export default ReactModule;
Convert ReactModule to a functional component
Convert ReactModule to a functional component
JSX
mit
trendyminds/pura,trendyminds/pura
--- +++ @@ -1,28 +1,30 @@ import React from "react"; import PropTypes from "prop-types"; -const ReactModule = props => ( - <div className="ReactModule"> - <h2>{props.greeting} world!</h2> - <p> - I'm a React component. Pura comes with <strong>React</strong> and{" "} - <strong>ReactDOM</strong> installed by default. - </p> - <p> - However, if you don't need it that's okay, too! Just don't{" "} - <code>import</code> it into your modules and you'll save on precious KB. - </p> - </div> -); +function ReactModule({ greeting }) { + return ( + <div className="ReactModule"> + <h2>{greeting} world!</h2> + <p> + I'm a React component. Pura comes with <strong>React</strong> and{" "} + <strong>ReactDOM</strong> installed by default. + </p> + <p> + However, if you don't need it that's okay, too! Just don't{" "} + <code>import</code> it into your modules and you'll save on precious KB. + </p> + </div> + ); +} // Set default props for unset variables ReactModule.defaultProps = { - greeting: "Hello" + greeting: "Hello", }; // Establish types for props to prevent renderering errors ReactModule.propTypes = { - greeting: PropTypes.string + greeting: PropTypes.string, }; export default ReactModule;
2bfe8986b298dc7f1f8b572a9ed092b9dea20ef4
web/static/js/components/idea_list_item.jsx
web/static/js/components/idea_list_item.jsx
import React from "react" import * as AppPropTypes from "../prop_types" import styles from "./css_modules/idea_item.css" function IdeaListItem(props) { let { idea, currentPresence } = props return ( <li className="item" title={idea.body} key={idea.id}> {idea.author}: {idea.body} { currentPresence.user.is_facilitator ? <i id={idea.id} className={styles.delete + ` remove circle icon`} onClick={props.handleDelete} > </i> : null } </li> ) } IdeaListItem.propTypes = { idea: AppPropTypes.idea.isRequired, currentPresence: AppPropTypes.presence.isRequired, } export default IdeaListItem
import React from "react" import * as AppPropTypes from "../prop_types" import styles from "./css_modules/idea_item.css" function IdeaListItem(props) { let { idea, currentPresence } = props return ( <li className="item" title={idea.body} key={idea.id}> {idea.author}: {idea.body} { currentPresence.user.is_facilitator ? <i id={idea.id} title="Delete Idea" className={styles.delete + ` remove circle icon`} onClick={props.handleDelete} > </i> : null } </li> ) } IdeaListItem.propTypes = { idea: AppPropTypes.idea.isRequired, currentPresence: AppPropTypes.presence.isRequired, } export default IdeaListItem
Add title attribute to idea deletion icon
Add title attribute to idea deletion icon
JSX
mit
stride-nyc/remote_retro,samdec11/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,tnewell5/remote_retro
--- +++ @@ -11,6 +11,7 @@ { currentPresence.user.is_facilitator ? <i id={idea.id} + title="Delete Idea" className={styles.delete + ` remove circle icon`} onClick={props.handleDelete} >
0c76fd80e34e24d9d1bb575760f4764e4f545199
src/components/elements/post-attachment-general.jsx
src/components/elements/post-attachment-general.jsx
import React from 'react'; import numeral from 'numeral'; import Icon from "./icon"; export default (props) => { const formattedFileSize = numeral(props.fileSize).format('0.[0] b'); const nameAndSize = props.fileName + ' (' + formattedFileSize + ')'; const removeAttachment = () => props.removeAttachment(props.id); return ( <div className="attachment"> <a href={props.url} title={nameAndSize} target="_blank" rel="noopener"> <Icon name="file"/> <span>{nameAndSize}</span> </a> {props.isEditing ? ( <i className="remove-attachment" title="Remove file" onClick={removeAttachment}> <Icon name="times"/> </i> ) : false} </div> ); };
import React from 'react'; import numeral from 'numeral'; import Icon from "./icon"; export default (props) => { const formattedFileSize = numeral(props.fileSize).format('0.[0] b'); const nameAndSize = props.fileName + ' (' + formattedFileSize + ')'; const removeAttachment = () => props.removeAttachment(props.id); return ( <div className="attachment"> <a href={props.url} title={nameAndSize} target="_blank" rel="noopener"> <Icon name="file"/> <span>{nameAndSize}</span> </a> {props.isEditing ? ( <span className="remove-attachment" title="Remove file" onClick={removeAttachment}> <Icon name="times"/> </span> ) : false} </div> ); };
Fix element name in PostAttachmentGeneral
svg-icons: Fix element name in PostAttachmentGeneral
JSX
mit
clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma
--- +++ @@ -17,9 +17,9 @@ </a> {props.isEditing ? ( - <i className="remove-attachment" title="Remove file" onClick={removeAttachment}> + <span className="remove-attachment" title="Remove file" onClick={removeAttachment}> <Icon name="times"/> - </i> + </span> ) : false} </div> );
ab1b9798a03880cc36e49de32d2e4f6bfb55e104
normandy/control/static/control/js/components/ActionForm.jsx
normandy/control/static/control/js/components/ActionForm.jsx
import React from 'react' import { reduxForm } from 'redux-form' import { _ } from 'underscore' import HeartbeatForm from './action_forms/HeartbeatForm.jsx' import ConsoleLogForm from './action_forms/ConsoleLogForm.jsx' export class ActionForm extends React.Component { render() { const { fields, arguments_schema, name } = this.props; let childForm = 'No action form available'; switch(name) { case 'show-heartbeat': childForm = (<HeartbeatForm fields={fields} />); break; case 'console-log': childForm = (<ConsoleLogForm fields={fields} />); break; default: childForm = childForm; } return ( <div id="action-configuration"> <i className="fa fa-caret-up fa-lg"></i> <div className="row"> <p className="help fluid-4">{arguments_schema.description || arguments_schema.title }</p> </div> {childForm} </div> ) } } export default reduxForm({ form: 'action', }, (state, props) => { let initialValues = {}; if (props.recipe && props.recipe.action_name === props.name) { initialValues = props.recipe['arguments']; } return { initialValues } })(ActionForm)
import React from 'react' import { reduxForm } from 'redux-form' import { _ } from 'underscore' import HeartbeatForm from './action_forms/HeartbeatForm.jsx' import ConsoleLogForm from './action_forms/ConsoleLogForm.jsx' export class ActionForm extends React.Component { render() { const { fields, arguments_schema, name } = this.props; let childForm = 'No action form available'; switch(name) { case 'show-heartbeat': childForm = (<HeartbeatForm fields={fields} />); break; case 'console-log': childForm = (<ConsoleLogForm fields={fields} />); break; } return ( <div id="action-configuration"> <i className="fa fa-caret-up fa-lg"></i> <div className="row"> <p className="help fluid-4">{arguments_schema.description || arguments_schema.title }</p> </div> {childForm} </div> ) } } export default reduxForm({ form: 'action', }, (state, props) => { let initialValues = {}; if (props.recipe && props.recipe.action_name === props.name) { initialValues = props.recipe['arguments']; } return { initialValues } })(ActionForm)
Remove default action form clause
Remove default action form clause
JSX
mpl-2.0
Osmose/normandy,Osmose/normandy,mozilla/normandy,mozilla/normandy,mozilla/normandy,Osmose/normandy,mozilla/normandy,Osmose/normandy
--- +++ @@ -17,8 +17,6 @@ case 'console-log': childForm = (<ConsoleLogForm fields={fields} />); break; - default: - childForm = childForm; } return (
32850cb0547929de3adcea251b3d62a154c8e152
app/scripts/main.jsx
app/scripts/main.jsx
"use strict"; var React = require('react'); // needed for dev tools to work window.React = React; var App = require('./components/app.jsx'); React.renderComponent(<App />, document.getElementById('content-main'));
"use strict"; var React = require('react'); var routes = require('./components/router.jsx'); // React.renderComponent(<App />, document.getElementById('content-main')); React.renderComponent(routes, document.getElementById('content-main'));
Add top level component for rendering
[TASK] Add top level component for rendering
JSX
isc
dabibbit/gatewayd-quoting-app,dabibbit/gatewayd-banking-app,dabibbit/gatewayd-quoting-app,n0rmz/gatewayd-client,AiNoKame/gatewayd-basic-admin-phase-1,hserang/gatewayd-admin-seeds,cryptospora/gatewayd-basic-app,n0rmz/gatewayd-client,AiNoKame/gatewayd-basic-admin-dec,dabibbit/gatewayd-banking-app
--- +++ @@ -1,10 +1,7 @@ "use strict"; var React = require('react'); +var routes = require('./components/router.jsx'); -// needed for dev tools to work -window.React = React; - -var App = require('./components/app.jsx'); - -React.renderComponent(<App />, document.getElementById('content-main')); +// React.renderComponent(<App />, document.getElementById('content-main')); +React.renderComponent(routes, document.getElementById('content-main'));
4819b4e76947039888e594809613daaf8a4a3675
src/client/components/BoardList/BoardList.jsx
src/client/components/BoardList/BoardList.jsx
import React, { Component } from "react"; import classNames from 'classnames'; import uuid from 'uuid'; import Dropdown from '../Dropdown'; import Icon from '../Icon'; export default class BoardList extends Component { constructor({shouldPreload, boardList, provider, fetchBoardList}) { super() if (shouldPreload && !boardList) { fetchBoardList(provider); } } render() { const {boardList, provider, onClick, boardListElements} = this.props const classes = classNames('boardlist', `p-${provider}`) const hasBoards = boardList && boardList.length; return ( <div className={classes}> {hasBoards && <Dropdown onClick={onClick} items={boardListElements} scrollOpts={{sliderMinHeight: 50, alwaysVisible: true}} />} </div> ) } } BoardList.defaultProps = { searchPhrase: '', shouldPreload: true }
import React, { Component } from "react"; import classNames from 'classnames'; import uuid from 'uuid'; import Dropdown from '../Dropdown'; import Icon from '../Icon'; export default class BoardList extends Component { constructor({shouldPreload, boardList, provider, fetchBoardList}) { super() if (shouldPreload && !boardList) { fetchBoardList(provider); } } render() { const {boardList, provider, onClick, boardListElements} = this.props const classes = classNames('boardlist', `p-${provider}`) const hasBoards = boardListElements && boardListElements.length; return ( <div className={classes}> {hasBoards ? <Dropdown onClick={onClick} items={boardListElements} scrollOpts={{sliderMinHeight: 50, alwaysVisible: true}} /> : false} </div> ) } } BoardList.defaultProps = { searchPhrase: '', shouldPreload: true }
Fix empty boardlist displaying '0'
Fix empty boardlist displaying '0'
JSX
mit
AdamSalma/Lurka,AdamSalma/Lurka
--- +++ @@ -18,15 +18,15 @@ render() { const {boardList, provider, onClick, boardListElements} = this.props const classes = classNames('boardlist', `p-${provider}`) - const hasBoards = boardList && boardList.length; + const hasBoards = boardListElements && boardListElements.length; return ( <div className={classes}> - {hasBoards && <Dropdown + {hasBoards ? <Dropdown onClick={onClick} items={boardListElements} scrollOpts={{sliderMinHeight: 50, alwaysVisible: true}} - />} + /> : false} </div> ) }
88f90a0a32c9523ba656d455793a1982fb4a7f63
app/components/Body/Body.jsx
app/components/Body/Body.jsx
import styles from './_Body.scss'; import React from 'react'; import Menu from '../Menu/Menu'; import Pitch from '../Pitch/Pitch'; import AppActions from '../../actions/AppActions'; let { PropTypes } = React; export default class Body extends React.Component { constructor(props) { super(props); this.state = { isFinished: false }; } startGame() { AppActions.startGame(); } render() { let buttonOrPitch; let {matchTeamsSection, hasStarted} = this.props; if(hasStarted === null) { buttonOrPitch = <button onClick={this.startGame}>Start Game</button> } else { buttonOrPitch = <Pitch formation={matchTeamsSection.homeTeam.team.startingPitchFormation.leftToRightPlayerIds} startingLineup={matchTeamsSection.homeTeam.team.lastMatchTeamSheet.startingLineUp} /> } return ( <div className={styles.body}> <h1 className={styles.header}>Missing Men</h1> <h2 className={styles.matchResult}> <span>{matchTeamsSection.homeTeam.team.club.name} </span> <span>{matchTeamsSection.homeTeam.lastMatchResult.finalScore.home}</span> <span> - </span> <span>{matchTeamsSection.awayTeam.lastMatchResult.finalScore.away} </span> <span>{matchTeamsSection.awayTeam.team.club.name}</span> <div>{buttonOrPitch}</div> </h2> </div> ); } }
import styles from './_Body.scss'; import React from 'react'; import Menu from '../Menu/Menu'; import Pitch from '../Pitch/Pitch'; import AppActions from '../../actions/AppActions'; let { PropTypes } = React; export default class Body extends React.Component { constructor(props) { super(props); } startGame() { AppActions.startGame(); } render() { let buttonOrPitch; let {matchTeamsSection, hasStarted} = this.props; if(hasStarted === null) { buttonOrPitch = <button onClick={this.startGame}>Start Game</button> } else { buttonOrPitch = <Pitch formation={matchTeamsSection.homeTeam.team.startingPitchFormation.leftToRightPlayerIds} startingLineup={matchTeamsSection.homeTeam.team.lastMatchTeamSheet.startingLineUp} /> } return ( <div className={styles.body}> <h1 className={styles.header}>Missing Men</h1> <h2 className={styles.matchResult}> <span>{matchTeamsSection.homeTeam.team.club.name} </span> <span>{matchTeamsSection.homeTeam.lastMatchResult.finalScore.home}</span> <span> - </span> <span>{matchTeamsSection.awayTeam.lastMatchResult.finalScore.away} </span> <span>{matchTeamsSection.awayTeam.team.club.name}</span> </h2> <div>{buttonOrPitch}</div> </div> ); } }
Fix view that put buton in h2
Fix view that put buton in h2
JSX
mit
jogjayr/missing-men,jogjayr/missing-men
--- +++ @@ -9,13 +9,12 @@ export default class Body extends React.Component { constructor(props) { super(props); - this.state = { - isFinished: false - }; } + startGame() { AppActions.startGame(); } + render() { let buttonOrPitch; let {matchTeamsSection, hasStarted} = this.props; @@ -34,8 +33,8 @@ <span> - </span> <span>{matchTeamsSection.awayTeam.lastMatchResult.finalScore.away} </span> <span>{matchTeamsSection.awayTeam.team.club.name}</span> - <div>{buttonOrPitch}</div> </h2> + <div>{buttonOrPitch}</div> </div> ); }
1e56b3bd4a47141646d4326be554392a8421e9d1
src/components/TestArea/TestArea.jsx
src/components/TestArea/TestArea.jsx
import React, { Component } from 'react'; import { testArea, } from './styles'; export default class TestArea extends Component { constructor (props) { super(props); this.handleKeyDown = this.handleKeyDown.bind(this); this.handleKeyPress = this.handleKeyPress.bind(this); this.handleKeyUp = this.handleKeyUp.bind(this); } handleKeyboardEvent (e) { e.preventDefault(); } handleKeyDown (e) { if (e.key === 'Tab') { this.refs.element.blur(); } else { this.handleKeyboardEvent(e); } } handleKeyPress (e) { this.handleKeyboardEvent(e); } handleKeyUp (e) { this.handleKeyboardEvent(e); } render () { const { props } = this; return ( <textarea ref="element" className={ testArea } onKeyDown={ this.handleKeyDown } onKeyPress={ this.handleKeyPress } onKeyUp={ this.handleKeyUp } { ...props } /> ); } }
import React, { Component } from 'react'; import { testArea, } from './styles'; export default class TestArea extends Component { constructor (props) { super(props); this.handleKeyDown = this.handleKeyDown.bind(this); this.handleKeyPress = this.handleKeyPress.bind(this); this.handleKeyUp = this.handleKeyUp.bind(this); } handleKeyboardEvent (e) { e.preventDefault(); } handleKeyDown (e) { if (e.key === 'Tab') { this.refs.element.blur(); } else { this.handleKeyboardEvent(e); } } handleKeyPress (e) { this.handleKeyboardEvent(e); } handleKeyUp (e) { this.handleKeyboardEvent(e); } render () { const { props } = this; return ( <textarea ref="element" className={ testArea } placeholder="Type here to test" onKeyDown={ this.handleKeyDown } onKeyPress={ this.handleKeyPress } onKeyUp={ this.handleKeyUp } { ...props } /> ); } }
Add placeholder to test area component
Add placeholder to test area component
JSX
mit
j-/keyboard,j-/keyboard
--- +++ @@ -38,6 +38,7 @@ <textarea ref="element" className={ testArea } + placeholder="Type here to test" onKeyDown={ this.handleKeyDown } onKeyPress={ this.handleKeyPress } onKeyUp={ this.handleKeyUp }
a311fefc304a7e91f7e6f5919c9983c1d3a62270
app/assets/javascripts/components/ct101.js.jsx
app/assets/javascripts/components/ct101.js.jsx
class CT101 extends React.Component { render () { return( <div className="row"> <h2>This is where Clinical Trial 101 should go.</h2> <Question /> </div> ) } }
class CT101 extends React.Component { render () { return( <div className="row"> <div className="col-sm-3"></div> <div className="col-sm-6"> <div className="panel panel-default"> <div className="panel-heading"> <h3 className="panel-title"> Clinical Trials 101 </h3> </div> <div className="panel-body"> <Question /> </div> </div> </div> <div className="col-sm-3"></div> </div> ) } }
Add div styling to CT101 component
Add div styling to CT101 component
JSX
mit
danmckeon/crconnect,danmckeon/crconnect,danmckeon/crconnect
--- +++ @@ -2,8 +2,20 @@ render () { return( <div className="row"> - <h2>This is where Clinical Trial 101 should go.</h2> - <Question /> + <div className="col-sm-3"></div> + <div className="col-sm-6"> + <div className="panel panel-default"> + <div className="panel-heading"> + <h3 className="panel-title"> + Clinical Trials 101 + </h3> + </div> + <div className="panel-body"> + <Question /> + </div> + </div> + </div> + <div className="col-sm-3"></div> </div> ) }
ef1a3234c59471d387649968d39c25063fd96132
assets-server/components/index.jsx
assets-server/components/index.jsx
import React from 'react/addons'; import App from './app.jsx'; const loadApp = () => { React.renderComponent(<App />, document.body); }; document.addEventListener('DOMContentLoaded', loadApp);
'use strict'; import React from 'react/addons'; import App from './app.jsx'; const loadApp = () => { React.renderComponent(<App />, document.body); }; document.addEventListener('DOMContentLoaded', loadApp);
Use strict syntax since Index
Use strict syntax since Index
JSX
mit
renemonroy/es6-scaffold,renemonroy/es6-scaffold
--- +++ @@ -1,3 +1,5 @@ +'use strict'; + import React from 'react/addons'; import App from './app.jsx';
0cc601758dfd01b3f6dd413d356e90988f2821cb
web/app/components/Wallet/BalanceClaimAssetTotal.jsx
web/app/components/Wallet/BalanceClaimAssetTotal.jsx
import React, {Component, PropTypes} from "react"; import connectToStores from "alt/utils/connectToStores" import BalanceClaimActiveStore from "stores/BalanceClaimActiveStore" import FormattedAsset from "components/Utility/FormattedAsset"; @connectToStores export default class BalanceClaimAssetTotals extends Component { static getStores() { return [BalanceClaimActiveStore] } static getPropsFromStores() { var props = BalanceClaimActiveStore.getState() return props } render() { var total_by_asset = this.props.balances .groupBy( v => v.balance.asset_id ) .map( l => l.reduce( (r,v) => r + Number(v.balance.amount), 0 )) if( ! total_by_asset.size) return <div>No Balances</div> return <div> {total_by_asset.map( (total, asset_id) => <div key={asset_id}> <FormattedAsset color="info" amount={total} asset={asset_id} /> </div> ).toArray()} </div> } }
import React, {Component, PropTypes} from "react"; import connectToStores from "alt/utils/connectToStores" import BalanceClaimActiveStore from "stores/BalanceClaimActiveStore" import FormattedAsset from "components/Utility/FormattedAsset"; @connectToStores export default class BalanceClaimAssetTotals extends Component { static getStores() { return [BalanceClaimActiveStore] } static getPropsFromStores() { var props = BalanceClaimActiveStore.getState() return props } render() { var total_by_asset = this.props.balances .groupBy( v => v.balance.asset_id ) .map( l => l.reduce( (r,v) => r + Number(v.balance.amount), 0 )) if( ! total_by_asset.size) return <div>No balances to claim</div> return <div> {total_by_asset.map( (total, asset_id) => <div key={asset_id}> <FormattedAsset color="info" amount={total} asset={asset_id} /> </div> ).toArray()} </div> } }
Clarify working: no balance claims
Clarify working: no balance claims
JSX
mit
BitSharesEurope/testnet.bitshares.eu,BunkerChainLabsInc/freedomledger-wallet,bitshares/bitshares-ui,openledger/graphene-ui,poqdavid/graphene-ui,openledger/graphene-ui,poqdavid/graphene-ui,poqdavid/graphene-ui,BunkerChainLabsInc/freedomledger-wallet,BitSharesEurope/testnet.bitshares.eu,BitSharesEurope/graphene-ui-testnet,BunkerChainLabsInc/freedomledger-wallet,cryptonomex/graphene-ui,trendever/bitshares-ui,merivercap/bitshares-2-ui,valzav/graphene-ui,merivercap/bitshares-2-ui,merivercap/bitshares-2-ui,trendever/bitshares-ui,bitshares/bitshares-2-ui,BitSharesEurope/testnet.bitshares.eu,trendever/bitshares-ui,bitshares/bitshares-ui,poqdavid/graphene-ui,valzav/graphene-ui,openledger/graphene-ui,BunkerChainLabsInc/freedomledger-wallet,BitSharesEurope/graphene-ui-testnet,bitshares/bitshares-ui,valzav/graphene-ui,cryptonomex/graphene-ui,merivercap/bitshares-2-ui,bitshares/bitshares-2-ui,bitshares/bitshares-2-ui,BitSharesEurope/wallet.bitshares.eu,BitSharesEurope/graphene-ui-testnet,trendever/bitshares-ui,cryptonomex/graphene-ui,BitSharesEurope/wallet.bitshares.eu,BitSharesEurope/graphene-ui-testnet,bitshares/bitshares-ui,BitSharesEurope/testnet.bitshares.eu,BitSharesEurope/wallet.bitshares.eu,BitSharesEurope/wallet.bitshares.eu,valzav/graphene-ui
--- +++ @@ -23,7 +23,7 @@ .map( l => l.reduce( (r,v) => r + Number(v.balance.amount), 0 )) if( ! total_by_asset.size) - return <div>No Balances</div> + return <div>No balances to claim</div> return <div> {total_by_asset.map( (total, asset_id) =>
5832692afd47b41a9a798056794123fa4150541f
ditto/static/tidy/js/comments/CommentForm.jsx
ditto/static/tidy/js/comments/CommentForm.jsx
import React from 'react'; import Validate from '../lib/form/Validate.jsx'; export default class CommentForm extends React.Component { static propTypes = { onSubmit: React.PropTypes.func.isRequired, } state = { comment: "" } render () { return ( <form onSubmit={this._onSubmit}> <div className="form-group"> <Validate isRequired={true} id="comment"> <textarea className="form-control" ref="text" value={this.state.comment} onChange={v => this.setState({comment: v})} /> </Validate> <input className="btn btn-success" disabled={!this.state.comment} type="submit" /> </div> </form> ); } _onSubmit = (e) => { e.preventDefault(); this.props.onSubmit(this.state.comment); } }
import React from 'react'; import Validate from '../lib/form/Validate.jsx'; export default class CommentForm extends React.Component { static propTypes = { onSubmit: React.PropTypes.func.isRequired, } state = { comment: "" } render () { return ( <form onSubmit={this._onSubmit}> <div className="form-group"> <Validate isRequired={true} id="comment"> <textarea className="form-control" ref="text" value={this.state.comment} onChange={v => this.setState({comment: v})} /> </Validate> <input className="btn btn-success" disabled={!this.state.comment} type="submit" /> </div> </form> ); } _onSubmit = (e) => { e.preventDefault(); this.props.onSubmit(this.state.comment); this.setState({comment: ""}); } }
Clear comment form after submit
Clear comment form after submit
JSX
bsd-3-clause
Kvoti/ditto,Kvoti/ditto,Kvoti/ditto,Kvoti/ditto,Kvoti/ditto
--- +++ @@ -34,5 +34,6 @@ _onSubmit = (e) => { e.preventDefault(); this.props.onSubmit(this.state.comment); + this.setState({comment: ""}); } }
8d3badf2590a84e47ee1dff170dbaa0609858904
client/app/bundles/Events/components/GroupResources.jsx
client/app/bundles/Events/components/GroupResources.jsx
import React from 'react'; import UserAuth from '../components/UserAuth'; const GroupResources = ({resources}) => ( <div> <h4>Resources</h4> { EmptyListOf(resources) || <ul> {resources.map(GroupResource)} </ul> } </div> ); // return placeholder if all resources have no links const EmptyListOf = (resources) => ( resources.every(r => !Boolean(r.link)) ? <div style={{color: 'lightgray'}}> This group has no resources </div> : null ); const GroupResource = (r) => { if(r.auth_link){ return <UserAuth allowed={['organizer']}><li> {r.description}: <a href={r.link}>{r.link}</a> </li></UserAuth> } else if(r.link) { return <li> {r.description}: <a href={r.link}>{r.link}</a> </li> } else if(r.mailto) { return <li> {r.description}: <a href={`mailto:${r.mailto}`} target="_blank">{r.mailto}</a> </li> } }; export default GroupResources;
import React from 'react'; import UserAuth from '../components/UserAuth'; const GroupResources = ({resources}) => ( <div> <h4>Resources</h4> { EmptyListOf(resources) || <ul> {resources.map(GroupResource)} </ul> } </div> ); // return placeholder if all resources have no links const EmptyListOf = (resources) => ( resources.every(r => !Boolean(r.link)) ? <div style={{color: 'lightgray'}}> This group has no resources </div> : null ); const GroupResource = (r) => { if(r.auth_link && r.link){ return <UserAuth allowed={['organizer']}><li> {r.description}: <a href={r.link}>{r.link}</a> </li></UserAuth> } else if(r.link) { return <li> {r.description}: <a href={r.link}>{r.link}</a> </li> } else if(r.mailto) { return <li> {r.description}: <a href={`mailto:${r.mailto}`} target="_blank">{r.mailto}</a> </li> } }; export default GroupResources;
Hide google groups link in group properly.
[nostory] Hide google groups link in group properly.
JSX
agpl-3.0
advocacycommons/advocacycommons,advocacycommons/advocacycommons,advocacycommons/advocacycommons
--- +++ @@ -23,7 +23,7 @@ ); const GroupResource = (r) => { - if(r.auth_link){ + if(r.auth_link && r.link){ return <UserAuth allowed={['organizer']}><li> {r.description}: <a href={r.link}>{r.link}</a> </li></UserAuth> } else if(r.link) {
133f824dcc7317d1e7379f05053519a9113ce4f0
src/PrevMonth.jsx
src/PrevMonth.jsx
import React, { Component, PropTypes } from 'react'; class PrevMonth extends Component { static propTypes = { inner: PropTypes.node, disable: PropTypes.bool } static defaultProps = { inner: 'Prev', disable: false } handleClick() { let {onClick} = this.props; if(this.props.disable) return; onClick && onClick.call(this); } render() { let classes = 'cal__nav cal__nav--prev'; if(this.props.disable) { classes += ' cal__nav--disabled'; } return( <button className={classes} role="button" title="Previous month" onClick={::this.handleClick} > {this.props.inner} </button> ) } } export default PrevMonth;
import React, { Component, PropTypes } from 'react'; class PrevMonth extends Component { static propTypes = { inner: PropTypes.node, disable: PropTypes.bool } static defaultProps = { inner: 'Prev', disable: false } handleClick() { let {onClick} = this.props; if(this.props.disable) return; onClick && onClick.call(this); } render() { let classes = 'cal__nav cal__nav--prev'; if(this.props.disable) { classes += ' cal__nav--disabled'; } return( <button className={classes} role="button" title="Previous month" type="button" onClick={::this.handleClick} > {this.props.inner} </button> ) } } export default PrevMonth;
Set button type to "button"
Set button type to "button"
JSX
isc
souporserious/react-dately,souporserious/react-midnight,jremmen/react-dately,frederickfogerty/react-dately,jremmen/react-dately,souporserious/react-simple-calendar,frederickfogerty/react-dately,souporserious/react-dately,souporserious/react-simple-calendar,souporserious/react-midnight
--- +++ @@ -31,6 +31,7 @@ className={classes} role="button" title="Previous month" + type="button" onClick={::this.handleClick} > {this.props.inner}
3d6c7af4b03ce08a24c081efee03292c8339615e
src/jsx/components/Intro.jsx
src/jsx/components/Intro.jsx
import React, { Component } from 'react'; export default class Intro extends Component { render() { return ( <section className="Intro Grid"> <div className="Grid-fullColumn"> <h1 className="Intro-title">Hi! I'm David Minnerly</h1> <p className="Intro-text">I'm a programmer, 3D modeler, and I also make websites on occasion. I frequently post about what I'm doing on <a href="https://twitter.com/voxeldavid" className="Link--twitter">Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a href="https://github.com/vocksel" className="Link--github">Github <i className="fa fa-github" /></a>.</p> </div> </section> ); } }
import React, { Component } from 'react'; export default class Intro extends Component { render() { return ( <section className="Intro Grid"> <div className="Grid-fullColumn"> <h1 className="Intro-title">Hi! I'm David Minnerly</h1> <p className="Intro-text">I'm a programmer, 3D modeler, and I also make websites on occasion. I frequently post about what I'm doing on <a href="https://twitter.com/voxeldavid" className="Link--twitter">Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a href="https://github.com/vocksel" className="Link--github">GitHub <i className="fa fa-github" /></a>.</p> </div> </section> ); } }
Fix typo (Github to GitHub)
Fix typo (Github to GitHub)
JSX
mit
VoxelDavid/voxeldavid-website,VoxelDavid/voxeldavid-website,vocksel/my-website,vocksel/my-website
--- +++ @@ -7,7 +7,7 @@ <div className="Grid-fullColumn"> <h1 className="Intro-title">Hi! I'm David Minnerly</h1> - <p className="Intro-text">I'm a programmer, 3D modeler, and I also make websites on occasion. I frequently post about what I'm doing on <a href="https://twitter.com/voxeldavid" className="Link--twitter">Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a href="https://github.com/vocksel" className="Link--github">Github <i className="fa fa-github" /></a>.</p> + <p className="Intro-text">I'm a programmer, 3D modeler, and I also make websites on occasion. I frequently post about what I'm doing on <a href="https://twitter.com/voxeldavid" className="Link--twitter">Twitter <i className="fa fa-twitter" /></a> and many of my projets are open-sourced on <a href="https://github.com/vocksel" className="Link--github">GitHub <i className="fa fa-github" /></a>.</p> </div> </section> );
633c300509d45115cb89e2009f8791305f0f77ec
src/containers/home/home.jsx
src/containers/home/home.jsx
import React from 'react'; var LogoVerticalWhite = require('../../components/logo/logo'); var Geolocalizer = require('../../components/geolocalizer/geolocalizer'); var Slider = require('../../components/slider/slider'); var Home = React.createClass ({ getInitialState: function () { return { meters: "50" } }, updateMeters: function (meters) { this.setState({meters: meters}); }, render: function () { return ( <main className="ktg-home"> <header className="ktg-home__header"> <LogoVerticalWhite /> </header> <form id="ktg-form-metersAround"> <Slider meters={this.state.meters} updateMeters={this.updateMeters}/> <Geolocalizer /> </form> </main> ); } }); module.exports = Home;
import React from 'react'; var LogoVerticalWhite = require('../../components/logo/logo'); var Geolocalizer = require('../../components/geolocalizer/geolocalizer'); var Slider = require('../../components/slider/slider'); var Results = require('../results/results'); var Home = React.createClass ({ getInitialState: function () { return { meters: "50" } }, updateMeters: function (meters) { this.setState({meters: meters}); }, render: function () { return ( <main className="ktg-home"> <Results /> </main> ); } }); module.exports = Home;
Remove this commit: for testing purpose
Remove this commit: for testing purpose
JSX
apache-2.0
swcraftersclm/katangapp-frontend,swcraftersclm/katangapp-frontend,swcraftersclm/katangapp-frontend
--- +++ @@ -3,6 +3,7 @@ var LogoVerticalWhite = require('../../components/logo/logo'); var Geolocalizer = require('../../components/geolocalizer/geolocalizer'); var Slider = require('../../components/slider/slider'); +var Results = require('../results/results'); var Home = React.createClass ({ getInitialState: function () { @@ -16,13 +17,7 @@ render: function () { return ( <main className="ktg-home"> - <header className="ktg-home__header"> - <LogoVerticalWhite /> - </header> - <form id="ktg-form-metersAround"> - <Slider meters={this.state.meters} updateMeters={this.updateMeters}/> - <Geolocalizer /> - </form> + <Results /> </main> ); }
2db3834488ca9f96bb8f159eebe6a03e5d91822e
components/App.jsx
components/App.jsx
import React from 'react'; import { Link } from 'react-router'; function App({ children, routes }) { function generateMapMenu() { let path = ''; return ( routes.filter(route => route.mapMenuTitle) .map((route, index, array) => ( <span key={index}> <Link to={path += ((path.slice(-1) === '/' ? '' : '/') + route.path.split('/').pop())} > {route.mapMenuTitle} </Link> {(index + 1) < array.length && ' / '} </span> )) ); } return( <div style={{maxWidth: '500px'}}> <h2 style={{marginBottom: 0}}>React for GitHub Pages</h2> <a href="https://github.com/rafrex/react-github-pages#readme" style={{marginBottom: '1em', display: 'block'}} > https://github.com/rafrex/react-github-pages </a> <nav> {generateMapMenu()} </nav> {children} </div> ); } export default App;
import React from 'react'; import { Link } from 'react-router'; function App({ children, routes }) { function generateMapMenu() { let path = ''; return ( routes.filter(route => route.mapMenuTitle) .map((route, index, array) => ( <span key={index}> <Link to={path += ((path.slice(-1) === '/' ? '' : '/') + (route.path === '/' ? '' : route.path))} > {route.mapMenuTitle} </Link> {(index + 1) < array.length && ' / '} </span> )) ); } return( <div style={{maxWidth: '500px'}}> <h2 style={{marginBottom: 0}}>React for GitHub Pages</h2> <a href="https://github.com/rafrex/react-github-pages#readme" style={{marginBottom: '1em', display: 'block'}} > https://github.com/rafrex/react-github-pages </a> <nav> {generateMapMenu()} </nav> {children} </div> ); } export default App;
Simplify map menu path generation
Simplify map menu path generation
JSX
mit
ambershen/ambershen.github.io,rafrex/react-github-pages,rafrex/react-github-pages,ambershen/ambershen.github.io
--- +++ @@ -11,7 +11,7 @@ <span key={index}> <Link to={path += ((path.slice(-1) === '/' ? '' : '/') + - route.path.split('/').pop())} + (route.path === '/' ? '' : route.path))} > {route.mapMenuTitle} </Link>
b511ba47a525113d2f64fca3846285b3c5f99337
fluxible-router/components/Nav.jsx
fluxible-router/components/Nav.jsx
/** * Copyright 2014, Yahoo! Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ 'use strict'; var React = require('react'); var NavLink = require('flux-router-component').NavLink; var Nav = React.createClass({ getDefaultProps: function () { return { selected: 'home', links: {} }; }, render: function() { var selected = this.props.selected, links = this.props.links, context = this.props.context, linkHTML = Object.keys(links).map(function (name) { var className = '', link = links[name]; if (selected === name) { className = 'pure-menu-selected'; } return ( <li className={className} key={link.path}> <NavLink routeName={link.page}>{link.label}</NavLink> </li> ); }); return ( <ul className="pure-menu pure-menu-open pure-menu-horizontal"> {linkHTML} </ul> ); } }); module.exports = Nav;
/** * Copyright 2014, Yahoo! Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ 'use strict'; var React = require('react'); var NavLink = require('flux-router-component').NavLink; var Nav = React.createClass({ getDefaultProps: function () { return { selected: 'home', links: {} }; }, render: function() { var selected = this.props.selected, links = this.props.links, context = this.props.context, linkHTML = Object.keys(links).map(function (name) { var className = '', link = links[name]; //print only link with label if(link.label) { if (selected === name) { className = 'pure-menu-selected'; } return ( <li className={className} key={link.path}> <NavLink routeName={link.page}>{link.label}</NavLink> </li> ); } }); return ( <ul className="pure-menu pure-menu-open pure-menu-horizontal"> {linkHTML} </ul> ); } }); module.exports = Nav;
Print nav links only if they have a label.
Print nav links only if they have a label.
JSX
bsd-3-clause
jeffreywescott/flux-examples,devypt/flux-examples,michaelBenin/flux-examples,ybbkrishna/flux-examples,src-code/flux-examples,eriknyk/flux-examples,JonnyCheng/flux-examples
--- +++ @@ -20,14 +20,20 @@ linkHTML = Object.keys(links).map(function (name) { var className = '', link = links[name]; - if (selected === name) { - className = 'pure-menu-selected'; + + //print only link with label + if(link.label) { + if (selected === name) { + className = 'pure-menu-selected'; + } + + return ( + <li className={className} key={link.path}> + <NavLink routeName={link.page}>{link.label}</NavLink> + </li> + ); } - return ( - <li className={className} key={link.path}> - <NavLink routeName={link.page}>{link.label}</NavLink> - </li> - ); + }); return ( <ul className="pure-menu pure-menu-open pure-menu-horizontal">
74bbc81b4590b1f5e5f64009213d10e2f84c0b12
lib/web/components/task-configs/helpers/colony-list.jsx
lib/web/components/task-configs/helpers/colony-list.jsx
'use strict' let React = require('react') let Reflux = require('reflux') let $ = window.jQuery let BodyList = require('./body-list') let EmpireStore = require('../../../stores/empire') let ColonyList = React.createClass({ mixins: [ Reflux.connect(EmpireStore, 'empire') ], propTypes: { all: React.PropTypes.bool, label: React.PropTypes.string }, getDefaultProps () { return { all: true, label: 'Colony' } }, getSelected () { return this.refs.list.getSelected() }, componentDidUpdate () { if (!this.props.all) { let queryStr = `option[value="${this.state.empire.home_planet_id}"]` $(queryStr, this.refs.list.refs.list).prop('selected', true) } }, render () { return ( <BodyList bodies={this.state.empire.colonies} all={this.props.all} label={this.props.label} ref='list' /> ) } }) module.exports = ColonyList
'use strict' let React = require('react') let Reflux = require('reflux') let BodyList = require('./body-list') let EmpireStore = require('../../../stores/empire') let ColonyList = React.createClass({ mixins: [ Reflux.connect(EmpireStore, 'empire') ], propTypes: { all: React.PropTypes.bool, label: React.PropTypes.string }, getDefaultProps () { return { all: true, label: 'Colony' } }, getSelected () { return this.refs.list.getSelected() }, render () { return ( <BodyList bodies={this.state.empire.colonies} all={this.props.all} label={this.props.label} ref='list' /> ) } }) module.exports = ColonyList
Remove unecessary stuff that was borked anyway.
Remove unecessary stuff that was borked anyway.
JSX
mit
le-serf/le-serf,le-serf/le-serf,1vasari/le-serf,1vasari/le-serf,1vasari/le-serf,le-serf/le-serf
--- +++ @@ -2,7 +2,6 @@ let React = require('react') let Reflux = require('reflux') -let $ = window.jQuery let BodyList = require('./body-list') @@ -30,13 +29,6 @@ return this.refs.list.getSelected() }, - componentDidUpdate () { - if (!this.props.all) { - let queryStr = `option[value="${this.state.empire.home_planet_id}"]` - $(queryStr, this.refs.list.refs.list).prop('selected', true) - } - }, - render () { return ( <BodyList
aa9adea9f3b5239a7b707ca6adf9bd77d5309b61
WebClient/app/scene/Board/components/SideBarOverlay/components/Tools/components/Tool/index.jsx
WebClient/app/scene/Board/components/SideBarOverlay/components/Tools/components/Tool/index.jsx
import React from 'react' import ToolsSideMenu from './components/ToolsSideMenu' import Move from './../../../../../../../../model/tools/Move' import { Icon } from 'semantic-ui-react' export default class Tool extends React.Component { state = {sideMenuOpened: false} toggleSideMenu = () => { if (this.props.tool.type === 'move') { const tool = new Move(this.props.grid) this.props.changeCurrentTool(tool) } else { this.setState(lastState => { return {sideMenuOpened: !lastState.sideMenuOpened} }) } } render () { const tool = this.props.tool const opened = this.props.visibility === 'visible' && this.state.sideMenuOpened // if plus button is not opened, close all the sub menus return ( <div onClick={this.toggleSideMenu} style={{width: '38px', height: '38px'}}> <Icon name={tool.icon} size='large' style={{paddingTop: '5px', width: '38px', height: '38px'}} /> <ToolsSideMenu toolsConfig={this.props.toolsConfig} {...this.props} toggleSideMenu={this.toggleSideMenu} opened={opened} /> </div> ) } }
import React from 'react' import ToolsSideMenu from './components/ToolsSideMenu' import Move from './../../../../../../../../model/tools/Move' import { Icon } from 'semantic-ui-react' export default class Tool extends React.Component { state = {sideMenuOpened: false} toggleSideMenu = () => { // TODO(peddavid): This is because Move Tool doesn't have "subtools", // That said, this logic should not be here at all, or at least generified if (this.props.tool.type === 'move') { const tool = new Move(this.props.grid) this.props.changeCurrentTool(tool) } else { this.setState(lastState => ({sideMenuOpened: !lastState.sideMenuOpened})) } } render () { const tool = this.props.tool const opened = this.props.visibility === 'visible' && this.state.sideMenuOpened // if plus button is not opened, close all the sub menus return ( <div onClick={this.toggleSideMenu} style={{width: '38px', height: '38px'}}> <Icon name={tool.icon} size='large' style={{paddingTop: '5px', width: '38px', height: '38px'}} /> <ToolsSideMenu toolsConfig={this.props.toolsConfig} {...this.props} toggleSideMenu={this.toggleSideMenu} opened={opened} /> </div> ) } }
Simplify lambda return and add TODO to Tool
Simplify lambda return and add TODO to Tool
JSX
mit
PedDavid/qip,PedDavid/qip,PedDavid/qip
--- +++ @@ -10,11 +10,13 @@ state = {sideMenuOpened: false} toggleSideMenu = () => { + // TODO(peddavid): This is because Move Tool doesn't have "subtools", + // That said, this logic should not be here at all, or at least generified if (this.props.tool.type === 'move') { const tool = new Move(this.props.grid) this.props.changeCurrentTool(tool) } else { - this.setState(lastState => { return {sideMenuOpened: !lastState.sideMenuOpened} }) + this.setState(lastState => ({sideMenuOpened: !lastState.sideMenuOpened})) } }
d92780212674ad3d7fd693ab222ec0167059cae4
app/pages/profile/recents.jsx
app/pages/profile/recents.jsx
import React from 'react'; import { Link } from 'react-router'; import Translate from 'react-translate-component'; import Thumbnail from '../../components/thumbnail'; class Recents extends React.Component { constructor() { super(); this.state = { recents: [] }; } componentDidMount() { const { user } = this.props; user.get('recents', { project_id: this.props.project.id, sort: '-created_at' }) .then(recents => this.setState({ recents })); } render() { const { project } = this.props; return ( <div className="secondary-page"> <h2><Translate content="classifier.recents" /></h2> {this.state.recents.map(recent => ( <Link to={`/projects/${project.slug}/talk/subjects/${recent.links.subject}`}> <Thumbnail alt={`Subject ${recent.links.subject}`} src={recent.locations[0]['image/jpeg']} width={150} /> </Link> ) )} </div> ); } } export default Recents;
import React from 'react'; import { Link } from 'react-router'; import Translate from 'react-translate-component'; import Thumbnail from '../../components/thumbnail'; class Recents extends React.Component { constructor() { super(); this.state = { recents: [] }; document.documentElement.classList.add('on-secondary-page'); } componentDidMount() { const { user } = this.props; user.get('recents', { project_id: this.props.project.id, sort: '-created_at' }) .then(recents => this.setState({ recents })); } componentWillUnmount() { document.documentElement.classList.add('on-secondary-page'); } render() { const { project } = this.props; return ( <div className="secondary-page has-project-context"> <div className="hero collections-hero"> <div className="hero-container"> <Translate content="classifier.recents" component="h1" /> </div> </div> <ul className="collections-card-list"> {this.state.recents.map(recent => ( <li key={recent.id} className="collection-card"> <Link to={`/projects/${project.slug}/talk/subjects/${recent.links.subject}`}> <Thumbnail alt={`Subject ${recent.links.subject}`} src={recent.locations[0]['image/jpeg']} height={250} /> </Link> </li> ) )} </ul> </div> ); } } export default Recents;
Add basic styling Styling copied from the collections page template.
Add basic styling Styling copied from the collections page template.
JSX
apache-2.0
amyrebecca/Panoptes-Front-End,zooniverse/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,amyrebecca/Panoptes-Front-End
--- +++ @@ -9,6 +9,7 @@ this.state = { recents: [] }; + document.documentElement.classList.add('on-secondary-page'); } componentDidMount() { @@ -17,17 +18,33 @@ .then(recents => this.setState({ recents })); } + componentWillUnmount() { + document.documentElement.classList.add('on-secondary-page'); + } + render() { const { project } = this.props; return ( - <div className="secondary-page"> - <h2><Translate content="classifier.recents" /></h2> - {this.state.recents.map(recent => ( - <Link to={`/projects/${project.slug}/talk/subjects/${recent.links.subject}`}> - <Thumbnail alt={`Subject ${recent.links.subject}`} src={recent.locations[0]['image/jpeg']} width={150} /> - </Link> - ) - )} + <div className="secondary-page has-project-context"> + <div className="hero collections-hero"> + <div className="hero-container"> + <Translate content="classifier.recents" component="h1" /> + </div> + </div> + <ul className="collections-card-list"> + {this.state.recents.map(recent => ( + <li key={recent.id} className="collection-card"> + <Link to={`/projects/${project.slug}/talk/subjects/${recent.links.subject}`}> + <Thumbnail + alt={`Subject ${recent.links.subject}`} + src={recent.locations[0]['image/jpeg']} + height={250} + /> + </Link> + </li> + ) + )} + </ul> </div> ); }
fcae7875b3c7e91a1419c8b6d19204c56ace0911
src/index.jsx
src/index.jsx
import React from 'react'; import { render } from 'react-dom'; const App = () => <h1>Hello Tabio</h1>; render(<App />, document.getElementById('root'));
import React, { Component } from 'react'; import { render } from 'react-dom'; class App extends Component { constructor(props) { super(props); this.state = { foo: 'bar' }; } render() { return ( <h1> {this.state.foo} </h1> ); } } render(<App />, document.getElementById('root'));
Convert App into a stateful component
Convert App into a stateful component
JSX
mit
colebemis/tabio,colebemis/tabio
--- +++ @@ -1,6 +1,20 @@ -import React from 'react'; +import React, { Component } from 'react'; import { render } from 'react-dom'; -const App = () => <h1>Hello Tabio</h1>; +class App extends Component { + constructor(props) { + super(props); + + this.state = { foo: 'bar' }; + } + + render() { + return ( + <h1> + {this.state.foo} + </h1> + ); + } +} render(<App />, document.getElementById('root'));
2b1cf0e6a4648e8aa72f8e9b6bf3308a788c5bfc
src/drive/web/modules/certifications/CertificationTooltip.jsx
src/drive/web/modules/certifications/CertificationTooltip.jsx
import React from 'react' import Tooltip from 'cozy-ui/transpiled/react/Tooltip' import Typography from 'cozy-ui/transpiled/react/Typography' const CertificationTooltip = ({ body, caption, content }) => { return ( <Tooltip title={ <div className="u-p-half"> <Typography variant="body1">{body}</Typography> <Typography variant="caption" color="textSecondary"> {caption} </Typography> </div> } > <span>{content}</span> </Tooltip> ) } export default CertificationTooltip
import React from 'react' import Tooltip from 'cozy-ui/transpiled/react/Tooltip' import Typography from 'cozy-ui/transpiled/react/Typography' const CertificationTooltip = ({ body, caption, content }) => { return ( <Tooltip title={ <div className="u-p-half"> <Typography variant="body1">{body}</Typography> <Typography variant="caption" color="textSecondary"> {caption} </Typography> </div> } > <span className="u-w-100">{content}</span> </Tooltip> ) } export default CertificationTooltip
Add width on certification icon span wrapper
fix: Add width on certification icon span wrapper
JSX
agpl-3.0
nono/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3
--- +++ @@ -15,7 +15,7 @@ </div> } > - <span>{content}</span> + <span className="u-w-100">{content}</span> </Tooltip> ) }
cf9758f9c88368b0290f3f864122f925806b985a
src/modules/students/components/ClassroomAssignments.jsx
src/modules/students/components/ClassroomAssignments.jsx
import React, { PropTypes } from 'react'; const ClassroomAssignments = props => { const { data } = props; return ( <div className="student-assignmentlist"> <h1>Assignments!</h1> { data.map(classroom => <section key={ classroom.classroom_id }> <h3>Classroom { classroom.classroom_name }</h3> <ul className="list"> { classroom.assignments.map(assignment => <li key={ assignment.id } className="listitem"> <div> <div><strong>Name</strong></div> <div>{ assignment.name }</div> </div> <div> <div><strong>Description</strong></div> <div>{ assignment.description }</div> </div> <div> <div><strong>Due date</strong></div> <div>{ assignment.duedate }</div> </div> <div> <div><strong>Progress</strong></div> <div>{ assignment.classification_count }/{ assignment.target }</div> </div> <div> <a className="btn btn-default" href={`https://www.wildcamgorongosa.org/#/classify/assignment-${ assignment.id }`} target="_blank" role="button"> Start assignment </a> </div> </li> ) } </ul> </section> ) } </div> ); }; export default ClassroomAssignments;
import React, { PropTypes } from 'react'; const ClassroomAssignments = props => { const { data } = props; return ( <div className="student-assignmentlist"> <h1>Assignments</h1> { data.map(classroom => <section key={ classroom.classroom_id }> <h3>Classroom { classroom.classroom_name }</h3> <table className="table table-hover"> <thead> <tr> <th>Name</th> <th>Description</th> <th>Due date</th> <th>Progress</th> <th>Action</th> </tr> </thead> <tbody> { classroom.assignments.map(assignment => <tr key={ assignment.id } className="listitem"> <td>{ assignment.name }</td> <td>{ assignment.description }</td> <td>{ assignment.duedate }</td> <td>{ assignment.classification_count }/{ assignment.target }</td> <td> <a className="btn btn-primary" href={`https://www.wildcamgorongosa.org/#/classify/assignment-${ assignment.id }`} target="_blank" role="button"> Start assignment </a> </td> </tr> ) } </tbody> </table> </section> ) } </div> ); }; export default ClassroomAssignments;
Improve styling of students assignments view.
Improve styling of students assignments view.
JSX
apache-2.0
zooniverse/wildcam-gorongosa-education,zooniverse/wildcam-gorongosa-education
--- +++ @@ -4,40 +4,39 @@ const { data } = props; return ( <div className="student-assignmentlist"> - <h1>Assignments!</h1> + <h1>Assignments</h1> { data.map(classroom => <section key={ classroom.classroom_id }> <h3>Classroom { classroom.classroom_name }</h3> - <ul className="list"> + <table className="table table-hover"> + <thead> + <tr> + <th>Name</th> + <th>Description</th> + <th>Due date</th> + <th>Progress</th> + <th>Action</th> + </tr> + </thead> + <tbody> { classroom.assignments.map(assignment => - <li key={ assignment.id } className="listitem"> - <div> - <div><strong>Name</strong></div> - <div>{ assignment.name }</div> - </div> - <div> - <div><strong>Description</strong></div> - <div>{ assignment.description }</div> - </div> - <div> - <div><strong>Due date</strong></div> - <div>{ assignment.duedate }</div> - </div> - <div> - <div><strong>Progress</strong></div> - <div>{ assignment.classification_count }/{ assignment.target }</div> - </div> - <div> - <a className="btn btn-default" + <tr key={ assignment.id } className="listitem"> + <td>{ assignment.name }</td> + <td>{ assignment.description }</td> + <td>{ assignment.duedate }</td> + <td>{ assignment.classification_count }/{ assignment.target }</td> + <td> + <a className="btn btn-primary" href={`https://www.wildcamgorongosa.org/#/classify/assignment-${ assignment.id }`} target="_blank" role="button"> Start assignment </a> - </div> - </li> + </td> + </tr> ) } - </ul> + </tbody> + </table> </section> ) } </div>
1a1215a809585b16175637ca3fc98ecd5ca567a8
app/Resources/client/jsx/organism/details/appendTraits.jsx
app/Resources/client/jsx/organism/details/appendTraits.jsx
/** * Created by s216121 on 14.03.17. */ function appendTraitEntries(domElement, traitEntries, traitFormat){ $.ajax({ url: Routing.generate('api', {'namespace': 'details', 'classname': 'TraitEntries'}), data: { "dbversion": dbversion, "trait_entry_ids": traitEntries, "trait_format": traitFormat }, method: "GET", success: function(result){ $.each(result, function (key, value) { var realValue = value.value; if(value.value === null){ realValue = value.value_definition; } let unitString = "" if(value.unit != null){ unitString = " $"+ value.unit +"$" } domElement.append($('<div>').text(realValue+unitString).append($('<div class="trait-citation">').text(value.citation).css({'font-size': '11px'}))); }); } }); }
/** * Created by s216121 on 14.03.17. */ function appendTraitEntries(domElement, traitEntries, traitFormat){ $.ajax({ url: Routing.generate('api', {'namespace': 'details', 'classname': 'TraitEntries'}), data: { "dbversion": dbversion, "trait_entry_ids": traitEntries, "trait_format": traitFormat }, method: "GET", success: function(result){ $.each(result, function (key, value) { var realValue = value.value; if(value.value === null){ realValue = value.value_definition; } let unitString = "" if(value.unit != null){ unitString = " $"+ value.unit +"$" } let traitCitationDiv = $('<div class="trait-citation">').text(value.citation).css({'font-size': '11px'}) let originUrl = $(`<a href="${value.origin_url}">`).text(" origin") if(value.origin_url != ""){ traitCitationDiv.append(originUrl) } domElement.append($('<div>').text(realValue+unitString).append(traitCitationDiv)); }); } }); }
Add origin url to trait citation
Add origin url to trait citation
JSX
mit
molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec
--- +++ @@ -21,7 +21,12 @@ if(value.unit != null){ unitString = " $"+ value.unit +"$" } - domElement.append($('<div>').text(realValue+unitString).append($('<div class="trait-citation">').text(value.citation).css({'font-size': '11px'}))); + let traitCitationDiv = $('<div class="trait-citation">').text(value.citation).css({'font-size': '11px'}) + let originUrl = $(`<a href="${value.origin_url}">`).text(" origin") + if(value.origin_url != ""){ + traitCitationDiv.append(originUrl) + } + domElement.append($('<div>').text(realValue+unitString).append(traitCitationDiv)); }); } });
ce485099d52cc734ea647faa91115b26d7160cf9
src/sentry/static/sentry/app/components/loadingIndicator.jsx
src/sentry/static/sentry/app/components/loadingIndicator.jsx
import React from 'react'; import classNames from 'classnames'; function LoadingIndicator(props) { let {mini, triangle} = props; let classes = { loading: true, mini, triangle }; return ( <div className={classNames(props.className, classes)}> <div className="loading-indicator"></div> <div className="loading-message">{props.children}</div> </div> ); } LoadingIndicator.propTypes = { mini: React.PropTypes.string, triangle: React.PropTypes.string }; export default LoadingIndicator;
import React from 'react'; import classNames from 'classnames'; function LoadingIndicator(props) { let {mini, triangle} = props; let classes = { loading: true, mini, triangle }; return ( <div className={classNames(props.className, classes)}> <div className="loading-indicator"></div> <div className="loading-message">{props.children}</div> </div> ); } LoadingIndicator.propTypes = { mini: React.PropTypes.bool, triangle: React.PropTypes.bool }; export default LoadingIndicator;
Fix bad prop declaration on LoadingIndicator (fixes warning)
Fix bad prop declaration on LoadingIndicator (fixes warning)
JSX
bsd-3-clause
BuildingLink/sentry,JackDanger/sentry,ifduyue/sentry,zenefits/sentry,gencer/sentry,mvaled/sentry,fotinakis/sentry,JamesMura/sentry,zenefits/sentry,JamesMura/sentry,ifduyue/sentry,mvaled/sentry,beeftornado/sentry,mvaled/sentry,BuildingLink/sentry,looker/sentry,looker/sentry,zenefits/sentry,looker/sentry,gencer/sentry,gencer/sentry,mvaled/sentry,mitsuhiko/sentry,mvaled/sentry,jean/sentry,gencer/sentry,JackDanger/sentry,BuildingLink/sentry,ifduyue/sentry,alexm92/sentry,alexm92/sentry,fotinakis/sentry,looker/sentry,JamesMura/sentry,looker/sentry,ifduyue/sentry,beeftornado/sentry,fotinakis/sentry,BuildingLink/sentry,JamesMura/sentry,mitsuhiko/sentry,fotinakis/sentry,alexm92/sentry,gencer/sentry,mvaled/sentry,beeftornado/sentry,ifduyue/sentry,zenefits/sentry,jean/sentry,JackDanger/sentry,BuildingLink/sentry,jean/sentry,jean/sentry,JamesMura/sentry,jean/sentry,zenefits/sentry
--- +++ @@ -18,8 +18,8 @@ } LoadingIndicator.propTypes = { - mini: React.PropTypes.string, - triangle: React.PropTypes.string + mini: React.PropTypes.bool, + triangle: React.PropTypes.bool }; export default LoadingIndicator;
c379031e48a339ac8ff790e367bfe7040ee7cddc
components/charts/Area.jsx
components/charts/Area.jsx
const React = require("react"); const c3 = require('c3'); module.exports = React.createClass({ displayName: 'AreaChart', onClick() { }, componentDidMount() { const groups = this.props.data.map(d => d[0]); this.renderChart(); this.chart = c3.generate({ bindto: this.getDOMNode(), data: { columns: this.props.data, types: groups.reduce((types, g) => { types[g] = 'area' // 'line', 'spline', 'step', 'area', 'area-step' are also available to stack return types; }, {}), groups: [groups] } }); }, componentDidUpdate() { this.renderChart(); }, renderChart() { }, render() { console.log(this.props.data) 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: { columns: [] } }); this.renderChart(); }, componentDidUpdate() { this.renderChart(); }, renderChart() { const groups = this.props.data.map(d => d[0]); this.chart.load({ columns: this.props.data, 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/> } });
Load chart data in renderChart instead
Load chart data in renderChart instead
JSX
mit
bengler/imdikator,bengler/imdikator
--- +++ @@ -7,29 +7,30 @@ }, componentDidMount() { - const groups = this.props.data.map(d => d[0]); - this.renderChart(); this.chart = c3.generate({ bindto: this.getDOMNode(), data: { - columns: this.props.data, - types: groups.reduce((types, g) => { - types[g] = 'area' - // 'line', 'spline', 'step', 'area', 'area-step' are also available to stack - return types; - }, {}), - groups: [groups] + columns: [] } }); + this.renderChart(); }, componentDidUpdate() { this.renderChart(); }, renderChart() { - + const groups = this.props.data.map(d => d[0]); + this.chart.load({ + columns: this.props.data, + types: groups.reduce((types, g) => { + types[g] = 'area' + // 'line', 'spline', 'step', 'area', 'area-step' are also available to stack + return types; + }, {}), + groups: [groups] + }) }, render() { - console.log(this.props.data) return <div/> } });
1d8ea6c4fb62ba5eb6bee669f56934687c3d83de
spec/javascript/components/allow-duplicates-checkbox.test.jsx
spec/javascript/components/allow-duplicates-checkbox.test.jsx
import renderer from 'react-test-renderer' import AllowDuplicatesCheckbox from '../../../app/assets/javascripts/components/allow-duplicates-checkbox.jsx' describe('AllowDuplicatesCheckbox', () => { let component = null let isAllowed = false const props = { checked: isAllowed, onChange: allowed => { isAllowed = allowed } } beforeEach(() => { component = <AllowDuplicatesCheckbox {...props} /> }) test('matches snapshot', () => { const tree = renderer.create(component).toJSON() expect(tree).toMatchSnapshot() }) })
import renderer from 'react-test-renderer' import { shallow } from 'enzyme' import AllowDuplicatesCheckbox from '../../../app/assets/javascripts/components/allow-duplicates-checkbox.jsx' describe('AllowDuplicatesCheckbox', () => { let component = null let isAllowed = false const props = { checked: isAllowed, onChange: allowed => { isAllowed = allowed } } beforeEach(() => { component = <AllowDuplicatesCheckbox {...props} /> }) test('matches snapshot', () => { const tree = renderer.create(component).toJSON() expect(tree).toMatchSnapshot() }) test('notices when checkbox is toggled', () => { const checkbox = shallow(component).find('#allow-duplicates') checkbox.simulate('change', { target: { checked: true } }) expect(isAllowed).toBe(true) }) })
Test dupes checkbox notices changes
Test dupes checkbox notices changes
JSX
mit
cheshire137/overwatch-team-comps,cheshire137/overwatch-team-comps,cheshire137/overwatch-team-comps
--- +++ @@ -1,4 +1,5 @@ import renderer from 'react-test-renderer' +import { shallow } from 'enzyme' import AllowDuplicatesCheckbox from '../../../app/assets/javascripts/components/allow-duplicates-checkbox.jsx' @@ -19,4 +20,10 @@ const tree = renderer.create(component).toJSON() expect(tree).toMatchSnapshot() }) + + test('notices when checkbox is toggled', () => { + const checkbox = shallow(component).find('#allow-duplicates') + checkbox.simulate('change', { target: { checked: true } }) + expect(isAllowed).toBe(true) + }) })
ef4648f81be5bae5dcfc7c138119de3d55d36ac0
client/app/presentationals/components/print-view/PrintView.jsx
client/app/presentationals/components/print-view/PrintView.jsx
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import convertToPrint from 'lib/convert-to-print/index'; import { jasperState } from 'constants/exampleState'; export default class PrintView extends Component { componentDidMount() { const id = this.props.id; if (!(this.props.entities.decks.byId.id && this.props.entities.decks.byId.id.slides)) { this.props.fetchDeckContent(id); } } render() { const state = jasperState; // TODO: only until rein parser works let elements; // if (state.entities.decks.byId.id && state.entities.decks.byId.id.slides) { // elements = convertToPrint(state, this.props.id); // } elements = convertToPrint(state, this.props.id); return ( <div> {elements} </div> ); } } PrintView.propTypes = { fetchDeckContent: PropTypes.func.isRequired, id: PropTypes.string.isRequired, };
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import convertToPrint from 'lib/convert-to-print/index'; import { jasperState } from 'constants/exampleState'; export default class PrintView extends Component { componentDidMount() { const id = this.props.id; if (!(this.props.entities.decks.byId.id && this.props.entities.decks.byId.id.slides)) { this.props.fetchDeckContent(id); } } render() { const state = jasperState; // TODO: only until rein parser works let elements; // if (state.entities.decks.byId.id && state.entities.decks.byId.id.slides) { // elements = convertToPrint(state, this.props.id); // } elements = convertToPrint(state, this.props.id); return ( <div className="c_print-view"> {elements} </div> ); } } PrintView.propTypes = { fetchDeckContent: PropTypes.func.isRequired, id: PropTypes.string.isRequired, };
Add class name to container div
Add class name to container div
JSX
mit
OpenWebslides/OpenWebslides,OpenWebslides/OpenWebslides,OpenWebslides/OpenWebslides,OpenWebslides/OpenWebslides
--- +++ @@ -21,7 +21,7 @@ // } elements = convertToPrint(state, this.props.id); return ( - <div> + <div className="c_print-view"> {elements} </div> );
b64ec3928c5eb4a02c07b55aeb7b464988a796e4
src/drive/web/modules/trash/components/EmptyTrashConfirm.jsx
src/drive/web/modules/trash/components/EmptyTrashConfirm.jsx
import React from 'react' import classNames from 'classnames' import Modal from 'cozy-ui/transpiled/react/Modal' import { translate } from 'cozy-ui/transpiled/react/I18n' import styles from 'drive/styles/confirms.styl' const EmptyTrashConfirm = ({ t, onConfirm, onClose }) => { const confirmationTexts = ['forbidden', 'restore'].map(type => ( <p className={classNames(styles['fil-confirm-text'], styles[`icon-${type}`])} key={type} > {t(`emptytrashconfirmation.${type}`)} </p> )) return ( <Modal dismissAction={onClose} title={t('emptytrashconfirmation.title')} description={confirmationTexts} secondaryType="secondary" secondaryText={t('emptytrashconfirmation.cancel')} secondaryAction={onClose} primaryType="danger" primaryText={t('emptytrashconfirmation.delete')} primaryAction={async () => { await onConfirm() onClose() }} /> ) } export default translate()(EmptyTrashConfirm)
import React from 'react' import classNames from 'classnames' import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs' import Button from 'cozy-ui/transpiled/react/Button' import { translate } from 'cozy-ui/transpiled/react/I18n' import styles from 'drive/styles/confirms.styl' const EmptyTrashConfirm = ({ t, onConfirm, onClose }) => { const confirmationTexts = ['forbidden', 'restore'].map(type => ( <p className={classNames(styles['fil-confirm-text'], styles[`icon-${type}`])} key={type} > {t(`emptytrashconfirmation.${type}`)} </p> )) return ( <ConfirmDialog open={true} onClose={onClose} title={t('emptytrashconfirmation.title')} content={confirmationTexts} actions={ <> <Button theme="secondary" onClick={onClose} label={t('emptytrashconfirmation.cancel')} /> <Button theme="danger" label={t('emptytrashconfirmation.delete')} onClick={async () => { await onConfirm() onClose() }} /> </> } /> ) } export default translate()(EmptyTrashConfirm)
Use CozyDialogs instead of Modal
feat: Use CozyDialogs instead of Modal
JSX
agpl-3.0
nono/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3
--- +++ @@ -1,6 +1,8 @@ import React from 'react' import classNames from 'classnames' -import Modal from 'cozy-ui/transpiled/react/Modal' + +import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs' +import Button from 'cozy-ui/transpiled/react/Button' import { translate } from 'cozy-ui/transpiled/react/I18n' import styles from 'drive/styles/confirms.styl' @@ -14,21 +16,29 @@ {t(`emptytrashconfirmation.${type}`)} </p> )) - return ( - <Modal - dismissAction={onClose} + <ConfirmDialog + open={true} + onClose={onClose} title={t('emptytrashconfirmation.title')} - description={confirmationTexts} - secondaryType="secondary" - secondaryText={t('emptytrashconfirmation.cancel')} - secondaryAction={onClose} - primaryType="danger" - primaryText={t('emptytrashconfirmation.delete')} - primaryAction={async () => { - await onConfirm() - onClose() - }} + content={confirmationTexts} + actions={ + <> + <Button + theme="secondary" + onClick={onClose} + label={t('emptytrashconfirmation.cancel')} + /> + <Button + theme="danger" + label={t('emptytrashconfirmation.delete')} + onClick={async () => { + await onConfirm() + onClose() + }} + /> + </> + } /> ) }
2f3c99d3892dc25e861c31c1edaa5a6af8495767
resources/js/Components/Timeline/Launch.jsx
resources/js/Components/Timeline/Launch.jsx
import React, { useMemo } from 'react'; import { InertiaLink } from '@inertiajs/inertia-react'; import PlatformIcon from '../Platforms/PlatformIcon'; import clsx from 'clsx'; export default function Launch({ platform, version, url = null, overview = false, sidebar = false }) { const Component = useMemo(() => (url ? InertiaLink : 'div'), ['url']); const mainProps = useMemo(() => ({ href: url }), ['url']); return ( <Component {...mainProps} className="event text-white" style={{ background: platform.color}}> <div className="icon"> <PlatformIcon platform={platform} /> </div> <div className="message">Version <span className="fw-bold">{version}</span> is now flighting</div> <div className={ clsx( 'version', 'text-muted', { 'd-none': overview || sidebar, 'd-sm-block': overview && !sidebar || !sidebar } ) }> {version} </div> </Component> ); };
import React, { useMemo } from 'react'; import { InertiaLink } from '@inertiajs/inertia-react'; import PlatformIcon from '../Platforms/PlatformIcon'; import clsx from 'clsx'; export default function Launch({ platform, version, url = null, overview = false, sidebar = false }) { const Component = useMemo(() => (url ? InertiaLink : 'div'), ['url']); const mainProps = useMemo(() => ({ href: url }), ['url']); return ( <Component {...mainProps} className="event text-white" style={{ background: platform.color}}> <div className="icon"> <PlatformIcon platform={platform} /> </div> <div className="message">Version <span className="fw-bold">{version}</span> is now flighting</div> <div className={ clsx( 'version', { 'd-none': overview || sidebar, 'd-sm-block': overview && !sidebar || !sidebar } ) }> {version} </div> </Component> ); };
Fix incorrect styling for version
Fix incorrect styling for version
JSX
agpl-3.0
ChangeWindows/ChangeWindows,ChangeWindows/ChangeWindows,ChangeWindows/ChangeWindows
--- +++ @@ -17,7 +17,6 @@ <div className={ clsx( 'version', - 'text-muted', { 'd-none': overview || sidebar, 'd-sm-block': overview && !sidebar || !sidebar
fa025594af774782487317485918230849f5357f
Text/story.jsx
Text/story.jsx
import React from 'react'; import { storiesOf } from '@kadira/storybook'; import { checkA11y } from 'storybook-addon-a11y'; import Text from './index'; const text = 'The quick brown fox jumps over the lazy dog'; storiesOf('Text') .addDecorator(checkA11y) .add('Default', () => ( <Text>{text}</Text> )) .add('Black', () => ( <Text color={'black'}>{text}</Text> )) .add('Blue', () => ( <Text color={'blue'}>{text}</Text> )) .add('Bold', () => ( <Text weight={'bold'}>{text}</Text> )) .add('ExtraSmall', () => ( <Text size={'extra-small'}>{text}</Text> )) .add('Gray', () => ( <Text color={'gray'}>{text}</Text> )) .add('Large', () => ( <Text size={'large'}>{text}</Text> )) .add('Mini', () => ( <Text size={'mini'}>{text}</Text> )) .add('Red', () => ( <Text color={'red'}>{text}</Text> )) .add('Small', () => ( <Text size={'small'}>{text}</Text> )) .add('Thin', () => ( <Text weight={'thin'}>{text}</Text> )) .add('White', () => ( <Text color={'white'}>{text}</Text> ));
import React from 'react'; import { storiesOf } from '@kadira/storybook'; import { checkA11y } from 'storybook-addon-a11y'; import Text from './index'; const text = 'The quick brown fox jumps over the lazy dog'; storiesOf('Text') .addDecorator(checkA11y) .add('Default', () => ( <Text>{text}</Text> )) .add('Black', () => ( <Text color={'black'}>{text}</Text> )) .add('Blue', () => ( <Text color={'blue'}>{text}</Text> )) .add('Bold', () => ( <Text weight={'bold'}>{text}</Text> )) .add('ExtraSmall', () => ( <Text size={'extra-small'}>{text}</Text> )) .add('Gray', () => ( <Text color={'gray'}>{text}</Text> )) .add('Large', () => ( <Text size={'large'}>{text}</Text> )) .add('Mini', () => ( <Text size={'mini'}>{text}</Text> )) .add('Red', () => ( <Text color={'red'}>{text}</Text> )) .add('Small', () => ( <Text size={'small'}>{text}</Text> )) .add('Thin', () => ( <Text weight={'thin'}>{text}</Text> )) .add('White', () => ( <div style={{ backgroundColor: 'black' }}> <Text color={'white'}>{text}</Text> </div> ));
Add wrapper with bg color for Text's white config
Add wrapper with bg color for Text's white config
JSX
mit
bufferapp/buffer-components,bufferapp/buffer-components
--- +++ @@ -41,5 +41,7 @@ <Text weight={'thin'}>{text}</Text> )) .add('White', () => ( - <Text color={'white'}>{text}</Text> + <div style={{ backgroundColor: 'black' }}> + <Text color={'white'}>{text}</Text> + </div> ));
b611b19d604c1b83ec511b1c7a13823929045ddf
client/app/bundles/course/lesson_plan/components/LessonPlanNav.jsx
client/app/bundles/course/lesson_plan/components/LessonPlanNav.jsx
import React, { PropTypes } from 'react'; import { Affix } from 'react-overlays'; import Immutable from 'immutable'; import './LessonPlanNav.scss'; const propTypes = { milestones: PropTypes.instanceOf(Immutable.List).isRequired, }; // Need `data-turbolinks="false"` because of this issue: // https://github.com/turbolinks/turbolinks/issues/75 const LessonPlanNav = ({ milestones }) => ( <Affix offsetTop={173} affixStyle={{ top: '70px' }} > <ul className="nav nav-pills nav-stacked"> { milestones.map(milestone => ( <li key={milestone.get('id')}> <a href={`#lesson-plan-milestone-${milestone.get('id')}`} className="lesson-plan-nav-link" data-turbolinks="false" > { milestone.get('title') } </a> </li> )) } </ul> </Affix> ); LessonPlanNav.propTypes = propTypes; export default LessonPlanNav;
import React, { PropTypes } from 'react'; import { Affix } from 'react-overlays'; import Immutable from 'immutable'; import './LessonPlanNav.scss'; const propTypes = { milestones: PropTypes.instanceOf(Immutable.List).isRequired, }; const LessonPlanNav = ({ milestones }) => ( <Affix offsetTop={173} affixStyle={{ top: '70px' }} > <ul className="nav nav-pills nav-stacked"> { milestones.map(milestone => ( <li key={milestone.get('id')}> <a href={`#lesson-plan-milestone-${milestone.get('id')}`} className="lesson-plan-nav-link" > { milestone.get('title') } </a> </li> )) } </ul> </Affix> ); LessonPlanNav.propTypes = propTypes; export default LessonPlanNav;
Remove turbolinks workaround from lesson plan
Remove turbolinks workaround from lesson plan
JSX
mit
Coursemology/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2
--- +++ @@ -7,8 +7,6 @@ milestones: PropTypes.instanceOf(Immutable.List).isRequired, }; -// Need `data-turbolinks="false"` because of this issue: -// https://github.com/turbolinks/turbolinks/issues/75 const LessonPlanNav = ({ milestones }) => ( <Affix offsetTop={173} affixStyle={{ top: '70px' }} > <ul className="nav nav-pills nav-stacked"> @@ -17,7 +15,6 @@ <a href={`#lesson-plan-milestone-${milestone.get('id')}`} className="lesson-plan-nav-link" - data-turbolinks="false" > { milestone.get('title') } </a>
8562a84aed24ded4e5083c2672f883708ec07784
resources/js/Components/Cards/Channel.jsx
resources/js/Components/Cards/Channel.jsx
import React, { useMemo } from 'react'; import { InertiaLink } from '@inertiajs/inertia-react'; import clsx from 'clsx'; import { format, isToday, isYesterday } from 'date-fns'; export default function Channel({ date, build, channel, disabled = false, url = null }) { const Component = useMemo(() => (url ? InertiaLink : 'div'), ['url']); const mainProps = useMemo(() => ({ href: url }), ['url']); const formatedDate = useMemo(() => { if (isToday(date)) { return 'Today'; } else if (isYesterday(date)) { return 'Yesterday'; } else { return format(date, 'd MMMM yyyy'); }; }, [date]); return ( <div className="col"> <Component {...mainProps} className={clsx('channel', 'card', { 'channel-disabled': disabled })}> <div className="channel-name" style={{ color: channel.color }}>{channel.name}</div> <div className="channel-build">{build || 'No flight'}</div> <div className="flex-grow-1" /> <div className="channel-date">{formatedDate || 'No date'}</div> </Component> </div> ); };
import React, { useMemo } from 'react'; import { InertiaLink } from '@inertiajs/inertia-react'; import clsx from 'clsx'; import { format, isToday, isYesterday, parseISO, isValid } from 'date-fns'; export default function Channel({ date, build, channel, disabled = false, url = null }) { const Component = useMemo(() => (url ? InertiaLink : 'div'), ['url']); const mainProps = useMemo(() => ({ href: url }), ['url']); const formatedDate = useMemo(() => { if (isValid(date)) { if (isToday(date)) { return 'Today'; } else if (isYesterday(date)) { return 'Yesterday'; } else { return format(date, 'd MMMM yyyy'); }; } return 'No flight'; }, [date]); return ( <div className="col"> <Component {...mainProps} className={clsx('channel', 'card', { 'channel-disabled': disabled })}> <div className="channel-name" style={{ color: channel.color }}>{channel.name}</div> <div className="channel-build">{build || 'No flight'}</div> <div className="flex-grow-1" /> <div className="channel-date">{formatedDate || 'No date'}</div> </Component> </div> ); };
Fix crash for empty channels
Fix crash for empty channels
JSX
agpl-3.0
ChangeWindows/ChangeWindows,ChangeWindows/ChangeWindows,ChangeWindows/ChangeWindows
--- +++ @@ -2,19 +2,24 @@ import { InertiaLink } from '@inertiajs/inertia-react'; import clsx from 'clsx'; -import { format, isToday, isYesterday } from 'date-fns'; +import { format, isToday, isYesterday, parseISO, isValid } from 'date-fns'; export default function Channel({ date, build, channel, disabled = false, url = null }) { const Component = useMemo(() => (url ? InertiaLink : 'div'), ['url']); const mainProps = useMemo(() => ({ href: url }), ['url']); + const formatedDate = useMemo(() => { - if (isToday(date)) { - return 'Today'; - } else if (isYesterday(date)) { - return 'Yesterday'; - } else { - return format(date, 'd MMMM yyyy'); - }; + if (isValid(date)) { + if (isToday(date)) { + return 'Today'; + } else if (isYesterday(date)) { + return 'Yesterday'; + } else { + return format(date, 'd MMMM yyyy'); + }; + } + + return 'No flight'; }, [date]); return (
8cdf5e04d97ccfa43b4f63ba1dd2c4e642a25a19
imports/ui/components/common/ModalContainer.jsx
imports/ui/components/common/ModalContainer.jsx
import React from 'react' import { Modal } from 'react-bootstrap' /** * Modal window with animations resembling Bootstrap modal windows * Animations for the window are applied once this component is mounted. */ export default class ModalContainer extends React.Component { constructor() { super(); this.state = { show: false } } componentDidMount() { this.setState({ show: true }); } hide() { this.props.onHidden(); this.setState({ show: false }); } render() { return ( <Modal dialogClassName="custom-modal" show={this.state.show} onHide={this.hide.bind(this)}> <Modal.Header closeButton></Modal.Header> <Modal.Body> {this.props.content} </Modal.Body> </Modal> ) } } ModalContainer.propTypes = { content: React.PropTypes.node, onHidden: React.PropTypes.func }
import React from 'react' import { Modal } from 'react-bootstrap' /** * Modal window with animations resembling Bootstrap modal windows * Animations for the window are applied once this component is mounted. */ export default class ModalContainer extends React.Component { constructor() { super(); this.state = { show: false } } componentDidMount() { this.setState({ show: true }); } hide() { if(!this.props.disableHide){ this.props.onHidden(); this.setState({ show: false }); } } render() { return ( <Modal dialogClassName="custom-modal" show={this.state.show} onHide={this.hide.bind(this)}> {/* {this.props.disableHide ? null : <Modal.Header closeButton></Modal.Header>} */} <Modal.Body> {this.props.content} </Modal.Body> </Modal> ) } } ModalContainer.propTypes = { content: React.PropTypes.node, onHidden: React.PropTypes.func }
EDIT remove close button header modal container and added new prop to disable closing of modal
EDIT remove close button header modal container and added new prop to disable closing of modal
JSX
mit
nus-mtp/nus-oracle,nus-mtp/nus-oracle
--- +++ @@ -18,8 +18,10 @@ } hide() { - this.props.onHidden(); - this.setState({ show: false }); + if(!this.props.disableHide){ + this.props.onHidden(); + this.setState({ show: false }); + } } render() { @@ -27,7 +29,7 @@ <Modal dialogClassName="custom-modal" show={this.state.show} onHide={this.hide.bind(this)}> - <Modal.Header closeButton></Modal.Header> + {/* {this.props.disableHide ? null : <Modal.Header closeButton></Modal.Header>} */} <Modal.Body> {this.props.content} </Modal.Body> @@ -35,7 +37,6 @@ ) } } - ModalContainer.propTypes = { content: React.PropTypes.node, onHidden: React.PropTypes.func
deebde3f60b137754fcdc4d094ec762c6f1ad6d8
packages/mwp-app-render/src/components/uxcapture/UXCaptureFont.jsx
packages/mwp-app-render/src/components/uxcapture/UXCaptureFont.jsx
// @flow import React from 'react'; type Props = { fontFamily: string, mark: string, }; export const fontLoaderSrc = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.10/webfont.js'; const generateUXCaptureFontJS = (fontFamily: string, mark: string) => ` WebFont.load({ custom: { families: ['${fontFamily}'] }, active: function() { window.performance.mark('${mark}'); } }); `; const UXCaptureFont = ({ fontFamily, mark }: Props) => <script dangerouslySetInnerHTML={{ __html: generateUXCaptureFontJS(fontFamily, mark), }} />; // eslint-disable-line react/no-danger export default UXCaptureFont;
// @flow import React from 'react'; type Props = { fontFamily: string, mark: string, }; export const fontLoaderSrc = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.10/webfont.js'; const generateUXCaptureFontJS = (fontFamily: string, mark: string) => ` WebFont.load({ custom: { families: ['${fontFamily}'] }, active: function() { window.performance.mark('${mark}'); } }); `; // fontFamily attribute should include individual weights if separate files are used // Example: "Graphik Meetup:n4,n5,n6" // Attention, if no weight specified, only n4 (e.g. font-weight: 400) is tested for! // See https://github.com/typekit/webfontloader#events for more detail const UXCaptureFont = ({ fontFamily, mark }: Props) => <script dangerouslySetInnerHTML={{ __html: generateUXCaptureFontJS(fontFamily, mark), }} />; // eslint-disable-line react/no-danger export default UXCaptureFont;
Comment describing font weight annotations for fontFamily attribute.
Comment describing font weight annotations for fontFamily attribute.
JSX
mit
meetup/meetup-web-platform
--- +++ @@ -19,6 +19,11 @@ } }); `; + +// fontFamily attribute should include individual weights if separate files are used +// Example: "Graphik Meetup:n4,n5,n6" +// Attention, if no weight specified, only n4 (e.g. font-weight: 400) is tested for! +// See https://github.com/typekit/webfontloader#events for more detail const UXCaptureFont = ({ fontFamily, mark }: Props) => <script dangerouslySetInnerHTML={{
0b3360caa13b8afa760e594db79ee65e622e44a4
src/components/status.jsx
src/components/status.jsx
/*eslint no-extra-parens:0*/ class Status extends React.Component { static displayName = 'Status'; static propTypes = { commandLog: React.PropTypes.array, sculpture: React.PropTypes.object.isRequired }; render() { let msgs = _(this.props.commandLog).map((msg) => { return ( <p>{msg}</p> ); }).reverse().value(); return ( <div className="status"><h3>Status</h3> <p>Game: { this.props.sculpture.data.get("currentGame") } | State: { this.props.sculpture.data.get("status") }</p> <hr/> <div className="log">{ msgs }</div> </div> ); } } module.exports = Status;
/*eslint no-extra-parens:0*/ class Status extends React.Component { static displayName = 'Status'; static propTypes = { commandLog: React.PropTypes.array, sculpture: React.PropTypes.object.isRequired }; render() { let msgs = _(this.props.commandLog).map((msg, idx) => { return ( <p key={idx}>{msg}</p> ); }).reverse().value(); return ( <div className="status"><h3>Status</h3> <p>Game: { this.props.sculpture.data.get("currentGame") } | State: { this.props.sculpture.data.get("status") }</p> <hr/> <div className="log">{ msgs }</div> </div> ); } } module.exports = Status;
Add key to log message dynamic component
Add key to log message dynamic component
JSX
mit
anyWareSculpture/sculpture-emulator-client,anyWareSculpture/sculpture-emulator-client
--- +++ @@ -6,9 +6,9 @@ sculpture: React.PropTypes.object.isRequired }; render() { - let msgs = _(this.props.commandLog).map((msg) => { + let msgs = _(this.props.commandLog).map((msg, idx) => { return ( - <p>{msg}</p> + <p key={idx}>{msg}</p> ); }).reverse().value();
dcab5a7b9b7db7a6cdcda727e2f98b25ecccf13c
client/BucketList.jsx
client/BucketList.jsx
BucketList = React.createClass({ mixins: [ReactMeteorData], getMeteorData() { return { sortedBucketItems: BucketItemsCollection.find({}, {sort: {createdAt: -1}}).fetch() } }, renderBucketItems() { return this.data.sortedBucketItems.map((bucketObject) => { return <BucketItemReact key={bucketObject._id} bucketitem={bucketObject} />; }); }, handleSubmit(event) { event.preventDefault(); var title = ReactDOM.findDOMNode(this.refs.textInput).value.trim(); BucketItemsCollection.insert({ title: title, createdAt: new Date() }); ReactDOM.findDOMNode(this.refs.textInput).value = "" }, render() { return ( <div className="bucketlist"> <header> <h1>Bucket List</h1> <form className="new-bucketitem" onSubmit={this.handleSubmit}> <input type="text" ref="textInput" placeholder="Type to add new item to your bucket list" /> <input type="submit" value="submit"/> </form> </header> <ul> {this.renderBucketItems()} </ul> </div> ); } });
BucketList = React.createClass({ mixins: [ReactMeteorData], getMeteorData() { return { sortedBucketItems: BucketItemsCollection.find({}, {sort: {createdAt: -1}}).fetch() } }, getInitialState(){ return { addingItem: false } }, renderBucketItems() { return this.data.sortedBucketItems.map((bucketObject) => { return <BucketItemReact key={bucketObject._id} bucketitem={bucketObject} />; }); }, handleSubmit(event) { event.preventDefault(); var title = ReactDOM.findDOMNode(this.refs.textInput).value.trim(); BucketItemsCollection.insert({ title: title, createdAt: new Date() }); ReactDOM.findDOMNode(this.refs.textInput).value = "" this.setState({addingItem: false}) }, addingNewItem(){ this.setState({ addingItem: true }) }, render() { return ( <div className="bucketlist"> <header> <h1>Bucket List</h1> <button onClick={this.addingNewItem}>Add a new item!</button> {this.state.addingItem == true ? <form className="new-bucketitem" onSubmit={this.handleSubmit}> <p>List Title: <input type="text" ref="textInput" placeholder="Type to add new item to your bucket list" /> </p> <input type="submit" value="submit"/> </form> : null } </header> <ul> {this.renderBucketItems()} </ul> </div> ); } });
Add button for submitting new item
Add button for submitting new item
JSX
mit
jp5486/bucket-list,jp5486/bucket-list
--- +++ @@ -4,6 +4,12 @@ getMeteorData() { return { sortedBucketItems: BucketItemsCollection.find({}, {sort: {createdAt: -1}}).fetch() + } + }, + + getInitialState(){ + return { + addingItem: false } }, @@ -24,6 +30,13 @@ }); ReactDOM.findDOMNode(this.refs.textInput).value = "" + this.setState({addingItem: false}) + }, + + addingNewItem(){ + this.setState({ + addingItem: true + }) }, render() { @@ -31,15 +44,22 @@ <div className="bucketlist"> <header> <h1>Bucket List</h1> - <form className="new-bucketitem" onSubmit={this.handleSubmit}> + <button onClick={this.addingNewItem}>Add a new item!</button> + {this.state.addingItem == true + ? <form className="new-bucketitem" onSubmit={this.handleSubmit}> + + <p>List Title: <input type="text" ref="textInput" placeholder="Type to add new item to your bucket list" /> + </p> <input type="submit" value="submit"/> </form> + : null + } </header> <ul>
27b4eaebaf7fcd5568dce9f2c665b218a3f968a2
application/client/feature-detect/feature-detect.jsx
application/client/feature-detect/feature-detect.jsx
/** * Detect client side features and add css classes to html element. * * @file * @module * * @author hello@ulrichmerkel.com (Ulrich Merkel), 2016 * @version 0.0.1 * * @requires client/feature-detect/touch-events * * @changelog * - 0.0.1 basic functions and structure */ import hasTouchEvents from './touch-events'; /** * Initialize feature detection for browsers and add * css classnames to html. * * @returns {void} */ function featureDetect() { if (typeof window === 'undefined') { return; } const html = document.getElementsByTagName('html')[0]; if (!html) { return; } html.classList.remove('no-js'); html.classList.add('js'); const touchEventsPrefix = hasTouchEvents() ? '' : 'no-'; html.classList.add(`${touchEventsPrefix}touchevents`); } export default featureDetect;
/** * Detect client side features and add css classes to html element. * * @file * @module * * @author hello@ulrichmerkel.com (Ulrich Merkel), 2016 * @version 0.0.1 * * @requires client/feature-detect/touch-events * * @changelog * - 0.0.1 basic functions and structure */ import hasCssCustomProperties from './css-custom-properties'; import hasTouchEvents from './touch-events'; /** * Initialize feature detection for browsers and add * css classnames to html. * * @returns {void} */ function featureDetect() { if (typeof window === 'undefined') { return; } const html = document.getElementsByTagName('html')[0]; if (!html) { return; } html.classList.remove('no-js'); html.classList.add('js'); const cssCustomPropertiesClassName = hasCssCustomProperties() ? 'customproperties' : 'no-customproperties'; html.classList.add(cssCustomPropertiesClassName); const touchEventsClassName = hasTouchEvents() ? 'touchevents' : 'no-touchevents'; html.classList.add(touchEventsClassName); } export default featureDetect;
Improve css custom properties feature detection for browser
Improve css custom properties feature detection for browser
JSX
mit
ulrich-merkel/www.ulrichmerkel.com,ulrich-merkel/www.ulrichmerkel.com,ulrich-merkel/www.ulrichmerkel.com
--- +++ @@ -12,6 +12,7 @@ * @changelog * - 0.0.1 basic functions and structure */ +import hasCssCustomProperties from './css-custom-properties'; import hasTouchEvents from './touch-events'; /** @@ -33,8 +34,15 @@ html.classList.remove('no-js'); html.classList.add('js'); - const touchEventsPrefix = hasTouchEvents() ? '' : 'no-'; - html.classList.add(`${touchEventsPrefix}touchevents`); + const cssCustomPropertiesClassName = hasCssCustomProperties() + ? 'customproperties' + : 'no-customproperties'; + html.classList.add(cssCustomPropertiesClassName); + + const touchEventsClassName = hasTouchEvents() + ? 'touchevents' + : 'no-touchevents'; + html.classList.add(touchEventsClassName); } export default featureDetect;
b577d28675ca562311a409c3a425f5be9cec7cf2
src/article-renderer.jsx
src/article-renderer.jsx
/* eslint-disable react/prop-types, react/jsx-closing-bracket-location */ var React = require("react"); var _ = require("underscore"); var ApiOptions = require("./perseus-api.jsx").Options; var Renderer = require("./renderer.jsx"); var rendererProps = React.PropTypes.shape({ content: React.PropTypes.string, widgets: React.PropTypes.object, images: React.PropTypes.object, }); var ArticleRenderer = React.createClass({ propTypes: { json: React.PropTypes.oneOfType([ rendererProps, React.PropTypes.arrayOf(rendererProps), ]).isRequired, }, shouldComponentUpdate: function(nextProps, nextState) { return nextProps !== this.props || nextState !== this.state; }, _sections: function() { return _.isArray(this.props.json) ? this.props.json : [this.props.json]; }, render: function() { var apiOptions = _.extend( {}, ApiOptions.defaults, this.props.apiOptions, { isArticle: true, } ); // TODO(alex): Add mobile api functions and pass them down here var sections = this._sections().map((section, i) => { return <Renderer {...section} key={i} key_={i} apiOptions={apiOptions} enabledFeatures={this.props.enabledFeatures} />; }); return <div className="framework-perseus perseus-article"> {sections} </div>; }, }); module.exports = ArticleRenderer;
/* eslint-disable react/prop-types, react/jsx-closing-bracket-location */ var React = require("react"); var _ = require("underscore"); var ApiOptions = require("./perseus-api.jsx").Options; var Renderer = require("./renderer.jsx"); var rendererProps = React.PropTypes.shape({ content: React.PropTypes.string, widgets: React.PropTypes.object, images: React.PropTypes.object, }); var ArticleRenderer = React.createClass({ propTypes: { json: React.PropTypes.oneOfType([ rendererProps, React.PropTypes.arrayOf(rendererProps), ]).isRequired, }, shouldComponentUpdate: function(nextProps, nextState) { return nextProps !== this.props || nextState !== this.state; }, _sections: function() { return _.isArray(this.props.json) ? this.props.json : [this.props.json]; }, render: function() { var apiOptions = _.extend( {}, ApiOptions.defaults, this.props.apiOptions, { isArticle: true, } ); // TODO(alex): Add mobile api functions and pass them down here var sections = this._sections().map((section, i) => { return <div key={i} className="clearfix"> <Renderer {...section} key={i} key_={i} apiOptions={apiOptions} enabledFeatures={this.props.enabledFeatures} /> </div>; }); return <div className="framework-perseus perseus-article"> {sections} </div>; }, }); module.exports = ArticleRenderer;
Add clearfix divs around each of the article sections.
Add clearfix divs around each of the article sections. Summary: Fixes https://app.asana.com/0/27216215224639/56999462903835 When there were floated images inside article sections, they would sometimes overlap with other sections. This wraps all of the sections in clearfixes so they don't overlap. Test Plan: - Visit [this test article](http://localhost:9000/article.html#content=%5B%7B%22content%22%3A%22%5B%5B%E2%98%83%20image%2011%5D%5D%5Cn%5Cn%23%23%23%23%20Step%201%3A%20Spot%20the%20isosceles%20triangle.%5Cn%5CnSegments%20%24%5C%5Coverline%7B%5C%5CredD%7BBC%7D%7D%24%20and%20%24%5C%5Coverline%7B%5C%5CredD%7BBD%7D%7D%24%20are%20both%20radii%2C%20so%20they%20have%20the%20same%20length.%20This%20means%20that%20%24%5C%5Ctriangle%20CBD%24%20is%20isosceles%2C%20%20which%20also%20means%20that%20its%20base%20angles%20are%20congruent%3A%5Cn%5Cn%3E%24m%5C%5Cangle%20C%20%3D%20m%5C%5Cangle%20D%20%3D%20%5C%5CblueD%20%5C%5Cpsi%24%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%22image%2011%22%3A%7B%22type%22%3A%22image%22%2C%22alignment%22%3A%22float-right%22%2C%22static%22%3Afalse%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22static%22%3Afalse%2C%22title%22%3A%22%22%2C%22range%22%3A%5B%5B0%2C10%5D%2C%5B0%2C10%5D%5D%2C%22box%22%3A%5B200%2C200%5D%2C%22backgroundImage%22%3A%7B%22url%22%3A%22web%2Bgraphie%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2F25b7882f2d5ab80f2ac9b30c822ca3f0b9af75fd%22%2C%22width%22%3A200%2C%22height%22%3A200%7D%2C%22labels%22%3A%5B%5D%2C%22alt%22%3A%22%22%2C%22caption%22%3A%22%22%7D%2C%22version%22%3A%7B%22major%22%3A0%2C%22minor%22%3A0%7D%7D%7D%7D%2C%7B%22content%22%3A%22%5B%5B%E2%98%83%20image%201%5D%5D%5Cn%5Cn%23%23%23%23%20Step%202%3A%20Spot%20the%20straight%20angle.%5Cn%5CnAngle%20%24%5C%5Cangle%7B%5C%5CredD%7BABC%7D%7D%24%20is%20a%20straight%20angle%2C%20so%5Cn%5Cn%3E%20%24%5C%5CpurpleC%20%5C%5Ctheta%20%2B%20m%5C%5Cangle%20DBC%20%3D%20180%5E%5C%5Ccirc%24%20%5Cn%5Cn%3E%20%24%5C%5Cphantom%7B%5C%5Ctheta%2B%7Dm%5C%5Cangle%20DBC%20%3D%20180%5E%5C%5Ccirc%20-%20%5C%5CpurpleC%20%5C%5Ctheta%24%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%22image%201%22%3A%7B%22type%22%3A%22image%22%2C%22alignment%22%3A%22float-right%22%2C%22static%22%3Afalse%2C%22graded%22%3Atrue%2C%22options%22%3A%7B%22static%22%3Afalse%2C%22title%22%3A%22%22%2C%22range%22%3A%5B%5B0%2C10%5D%2C%5B0%2C10%5D%5D%2C%22box%22%3A%5B200%2C200%5D%2C%22backgroundImage%22%3A%7B%22url%22%3A%22web%2Bgraphie%3A%2F%2Fka-perseus-graphie.s3.amazonaws.com%2Fc7986d1bb533b2e30674a4b37e68cf94c5374e63%22%2C%22width%22%3A200%2C%22height%22%3A200%7D%2C%22labels%22%3A%5B%5D%2C%22alt%22%3A%22%22%2C%22caption%22%3A%22%22%7D%2C%22version%22%3A%7B%22major%22%3A0%2C%22minor%22%3A0%7D%7D%7D%7D%2C%7B%22content%22%3A%22%23%23%23%23%20Step%203%3A%20Write%20an%20equation%20and%20solve%20for%20%24%5C%5CblueD%20%5C%5Cpsi%24.%5Cn%5CnThe%20interior%20angles%20of%20%24%5C%5Ctriangle%20CBD%24%20are%20%24%5C%5CblueD%20%5C%5Cpsi%24%2C%20%24%5C%5CblueD%20%5C%5Cpsi%24%2C%20and%20%24%28180%5E%5C%5Ccirc%20-%5C%5CpurpleC%20%5C%5Ctheta%29%24%2C%20and%20we%20know%20that%20the%20interior%20angles%20of%20any%20triangle%20sum%20to%20%24180%5E%5C%5Ccirc%24.%5Cn%5Cn%3E%24%5C%5Cbegin%7Balign%7D%5Cn%5C%5CblueD%7B%5C%5Cpsi%7D%20%2B%20%5C%5CblueD%7B%5C%5Cpsi%7D%20%2B%20%28180%5E%5C%5Ccirc-%20%5C%5CpurpleC%7B%5C%5Ctheta%7D%29%20%26%3D%20180%5E%5C%5Ccirc%20%5C%5C%5C%5C%5C%5C%5C%5C%5Cn2%5C%5CblueD%7B%5C%5Cpsi%7D%20%2B%20180%5E%5C%5Ccirc-%20%5C%5CpurpleC%7B%5C%5Ctheta%7D%20%26%3D%20180%5E%5C%5Ccirc%20%5C%5C%5C%5C%5C%5C%5C%5C%5Cn2%5C%5CblueD%7B%5C%5Cpsi%7D-%20%5C%5CpurpleC%7B%5C%5Ctheta%7D%20%26%3D0%20%5C%5C%5C%5C%5C%5C%5C%5C%5Cn2%5C%5CblueD%7B%5C%5Cpsi%7D%20%26%3D%5C%5CpurpleC%7B%5C%5Ctheta%7D%5Cn%5C%5Cend%7Balign%7D%24%5Cn%5CnCool.%20We%27ve%20completed%20our%20proof%20for%20Case%20A.%20Just%20two%20more%20cases%20left%21%22%2C%22images%22%3A%7B%7D%2C%22widgets%22%3A%7B%7D%7D%5D) - View in preview/desktop mode - See that the sections don't overlap with each other. Reviewers: alex Reviewed By: alex Differential Revision: https://phabricator.khanacademy.org/D23506
JSX
mit
ariabuckles/perseus,ariabuckles/perseus,ariabuckles/perseus,learningequality/perseus,ariabuckles/perseus,learningequality/perseus
--- +++ @@ -43,13 +43,15 @@ // TODO(alex): Add mobile api functions and pass them down here var sections = this._sections().map((section, i) => { - return <Renderer - {...section} - key={i} - key_={i} - apiOptions={apiOptions} - enabledFeatures={this.props.enabledFeatures} - />; + return <div key={i} className="clearfix"> + <Renderer + {...section} + key={i} + key_={i} + apiOptions={apiOptions} + enabledFeatures={this.props.enabledFeatures} + /> + </div>; }); return <div className="framework-perseus perseus-article">