path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
internals/templates/notFoundPage.js
PanJ/SimplerCityGlide
/** * NotFoundPage * * This is the page we show when the user visits a url that doesn't have a route * * NOTE: while this component should technically be a stateless functional * component (SFC), hot reloading does not currently support SFCs. If hot * reloading is not a neccessity for you then you can refactor it and remove * the linting exception. */ import React from 'react'; export default class NotFound extends React.Component { // eslint-disable-line react/prefer-stateless-function render() { return ( <h1>Page Not Found</h1> ); } }
client/app/components/Button/index.js
Kielan/onDemanager
/** * * Button.react.js * * A common button, if you pass it a prop "route" it'll render a link to a react-router route * otherwise it'll render a link with an onclick */ import React from 'react'; import styles from './styles.css'; function Button(props) { const className = props.className ? props.className : styles.button; let button = ( <a className={className} href={props.href} onClick={props.onClick}>{props.children}</a> ); if (props.handleRoute) { button = ( <button className={className} onClick={ props.handleRoute } >{props.children}</button> ); } return ( <div className={ styles.buttonWrapper }> { button } </div> ); } Button.propTypes = { className: React.PropTypes.string, handleRoute: React.PropTypes.func, href: React.PropTypes.string, onClick: React.PropTypes.func }; export default Button;
src/svg-icons/device/location-disabled.js
kasra-co/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceLocationDisabled = (props) => ( <SvgIcon {...props}> <path d="M20.94 11c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06c-1.13.12-2.19.46-3.16.97l1.5 1.5C10.16 5.19 11.06 5 12 5c3.87 0 7 3.13 7 7 0 .94-.19 1.84-.52 2.65l1.5 1.5c.5-.96.84-2.02.97-3.15H23v-2h-2.06zM3 4.27l2.04 2.04C3.97 7.62 3.25 9.23 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c1.77-.2 3.38-.91 4.69-1.98L19.73 21 21 19.73 4.27 3 3 4.27zm13.27 13.27C15.09 18.45 13.61 19 12 19c-3.87 0-7-3.13-7-7 0-1.61.55-3.09 1.46-4.27l9.81 9.81z"/> </SvgIcon> ); DeviceLocationDisabled = pure(DeviceLocationDisabled); DeviceLocationDisabled.displayName = 'DeviceLocationDisabled'; DeviceLocationDisabled.muiName = 'SvgIcon'; export default DeviceLocationDisabled;
temp/Boy.js
duangangqiang/GitHubTrending
import React, { Component } from 'react'; import { View, Text, TouchableOpacity, Image, StyleSheet } from 'react-native'; import Girl from './Girl'; import NavigationBar from './NavigationBar'; export default class Boy extends Component { constructor(props) { super(props); this.state = { word: '' } } renderButton(image) { return ( <TouchableOpacity onPress = { () => { this.props.navigator.pop(); }} > <Image style={{ width: 22, height: 22, margin: 5 }} source={image}></Image> </TouchableOpacity> ) } render() { return ( <View style={styles.container}> <NavigationBar title={'Boy'} style = {{ backgroundColor: '#87CEFF' }} statusBar = {{ backgroundColor: "#EE6363", hidden: true }} leftButton = { this.renderButton(require('./res/images/ic_arrow_back_white_36pt.png')) } rightButton = { this.renderButton(require('./res/images/ic_star.png')) } ></NavigationBar> <Text style={styles.text}> I am Boy </Text> <Text style={styles.text} onPress={() =>{ this.props.navigator.push({ component: Girl, params: { word: '一直玫瑰', onCallBack: (word) => { this.setState({ word: word }); } } }); }}>送女孩一只玫瑰</Text> <Text style={styles.text}>{ this.state.word }</Text> </View> ) } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#FFF" }, text: { fontSize: 20 } });
docs/app/Examples/elements/Reveal/Content/RevealExampleHidden.js
mohammed88/Semantic-UI-React
import React from 'react' import { Image, Reveal } from 'semantic-ui-react' const RevealExampleHidden = () => ( <Reveal animated='small fade'> <Reveal.Content visible> <Image src='http://semantic-ui.com/images/wireframe/square-image.png' size='small' /> </Reveal.Content> <Reveal.Content hidden> <Image src='http://semantic-ui.com/images/avatar/large/ade.jpg' size='small' /> </Reveal.Content> </Reveal> ) export default RevealExampleHidden
src/components/common/svg-icons/av/web.js
abzfarah/Pearson.NAPLAN.GnomeH
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvWeb = (props) => ( <SvgIcon {...props}> <path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-5 14H4v-4h11v4zm0-5H4V9h11v4zm5 5h-4V9h4v9z"/> </SvgIcon> ); AvWeb = pure(AvWeb); AvWeb.displayName = 'AvWeb'; AvWeb.muiName = 'SvgIcon'; export default AvWeb;
docs/app/Examples/collections/Grid/Variations/GridExampleVerticalAlignmentRow.js
mohammed88/Semantic-UI-React
import React from 'react' import { Grid, Image } from 'semantic-ui-react' const GridExampleVerticalAlignmentRow = () => ( <Grid columns={4} centered> <Grid.Row verticalAlign='top'> <Grid.Column> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> </Grid.Column> <Grid.Column> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> <br /> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> </Grid.Column> <Grid.Column> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> </Grid.Column> </Grid.Row> <Grid.Row verticalAlign='middle'> <Grid.Column> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> </Grid.Column> <Grid.Column> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> <br /> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> </Grid.Column> <Grid.Column> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> </Grid.Column> </Grid.Row> <Grid.Row verticalAlign='bottom'> <Grid.Column> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> </Grid.Column> <Grid.Column> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> <br /> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> </Grid.Column> <Grid.Column> <Image src='http://semantic-ui.com/images/wireframe/image.png' /> </Grid.Column> </Grid.Row> </Grid> ) export default GridExampleVerticalAlignmentRow
app/containers/App/AppFooter/index.js
josueorozco/parlay
import React from 'react'; import classNames from 'classnames'; /* |-------------------------------------------------------------------------- | AppFooter |-------------------------------------------------------------------------- | | Stateless component | */ const AppFooter = props => ( <div className={classNames( 'app-footer', 'white', 'dk', 'pos-rtl', )} > {props.children} </div> ); AppFooter.propTypes = { children: React.PropTypes.node, }; export default AppFooter;
app/components/IssueIcon/index.js
nimzco/takemyidea-ui
import React from 'react'; class IssueIcon extends React.Component { render() { return ( <svg height="1em" width="0.875em" className={ this.props.className } > <path d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7S10.14 13.7 7 13.7 1.3 11.14 1.3 8s2.56-5.7 5.7-5.7m0-1.3C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7S10.86 1 7 1z m1 3H6v5h2V4z m0 6H6v2h2V10z" /> </svg> ); } } export default IssueIcon;
src/components/profile/DeleteProfile.js
Team-Banana-Guava/JobOrNot-React
import React from 'react'; import { connect } from 'react-redux'; import { deleteProfile } from '../../actions/DeleteProfile-actions'; import { Link } from 'react-router-dom'; import { userLogoutSuccess } from '../../actions/auth-actions'; class DeleteProfile extends React.Component { constructor(props) { super(props); this.handleDeleteProfile = this.handleDeleteProfile.bind(this); } handleDeleteProfile(e) { e.preventDefault(); let answer = prompt('Do you really want to delete? y/n'); if (answer === 'y') { this.props.deleteProfile({ method: 'DELETE', path: '/deleteAccount', token: this.props.token }) .then(() => { alert(this.props.message); this.props.signOut(); this.props.history.push('/'); }); } } render() { return ( <div> <button onClick={this.handleDeleteProfile}> <Link to='/delete-account'>Delete Account</Link> </button> </div> ); } } function mapStateToProps(state) { return { userId: state.userAuth.user._id, token: state.userAuth.token, message: state.deleteProfile.message }; } function mapDispatchToProps(dispatch) { return { deleteProfile: (options) => dispatch(deleteProfile(options)), signOut: () => dispatch(userLogoutSuccess()) }; } export default connect(mapStateToProps, mapDispatchToProps)(DeleteProfile); DeleteProfile.propTypes = { deleteProfile: React.PropTypes.func, token: React.PropTypes.string, message: React.PropTypes.string, history: React.PropTypes.any, signOut: React.PropTypes.func };
server/frontend/components/CenteredLayout/CenteredLayout.js
AlexHatesUnicorns/FDTD_Solver
import React from 'react'; import styles from './CenteredLayout.css'; export const CenteredLayout = ({ children }) => ( <div className={styles.container}> {children} </div> ); export default CenteredLayout;
src/components/forms/reset-password/ResetPasswordSent.js
LenaKari/happy-days
import React, { Component } from 'react'; import { Link } from 'react-router-dom'; // MaterialUI import RaisedButton from 'material-ui/RaisedButton'; class ResetPasswordSent extends Component { render() { return ( <div> <p>An email has been sent to the address provided with instructions on how to reset your password.</p> <div className="button-container"> <Link to='/login'> <RaisedButton label="Sign in" primary={true} fullWidth={true} /> </Link> </div> <div className="button-container"> <RaisedButton label="Resend email" secondary={true} fullWidth={true} onClick={this.props.handleResetPassword} /> </div> </div> ) } } export default ResetPasswordSent;
src/svg-icons/action/info.js
lawrence-yu/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionInfo = (props) => ( <SvgIcon {...props}> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/> </SvgIcon> ); ActionInfo = pure(ActionInfo); ActionInfo.displayName = 'ActionInfo'; ActionInfo.muiName = 'SvgIcon'; export default ActionInfo;
src/components/pages/ColorInteractionsPage/index.js
RussHR/github_page_src
import React from 'react'; import ContentLayout from '../../layout/ContentLayout'; import VideoIFrame from '../../VideoIFrame'; export default function HomageToBarraganPage() { return ( <ContentLayout header="color interactions" subheader="completed - march 2017" links={[ 'http://russrinzler.com/color-interactions', 'https://github.com/RussHR/color_interactions' ]}> <p> color interactions is a set of online exercises designed after assignments and plates in <a href="https://en.wikipedia.org/wiki/Josef_Albers" target="_blank">Josef Albers’s</a> <em>Interaction of Color</em>. </p> <VideoIFrame style={{ width:"100%", paddingBottom: `${(1528/2660) * 100}%` }} src="https://player.vimeo.com/video/265949169" /> </ContentLayout> ); }
examples/counter-2/src/Button.js
rerx/rerx
import React, { Component } from 'react'; import { dispatch } from 'rerx/core'; import { helper } from 'rerx/utils'; export class Button extends Component { constructor(props) { super(props); const thisEvent = helper.thisEvent.bind(this); this.event = { click: thisEvent('click') }; this.onClick = this.onClick.bind(this); } onClick() { dispatch({ type: 'click', target: this }); } render() { return ( <button {...this.props} onClick={this.onClick} /> ); } }
src/components/Notification/Notification.js
joshblack/carbon-components-react
/** * Copyright IBM Corp. 2016, 2018 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import classNames from 'classnames'; import { settings } from 'carbon-components'; import Close16 from '@carbon/icons-react/lib/close/16'; import ErrorFilled20 from '@carbon/icons-react/lib/error--filled/20'; import CheckmarkFilled20 from '@carbon/icons-react/lib/checkmark--filled/20'; import WarningFilled20 from '@carbon/icons-react/lib/warning--filled/20'; const { prefix } = settings; export class NotificationButton extends Component { static propTypes = { /** * Specify an optional className to be applied to the notification button */ className: PropTypes.string, /** * Specify a label to be read by screen readers on the notification button */ ariaLabel: PropTypes.string, /** * Optional prop to specify the type of the Button */ type: PropTypes.string, /** * Provide a description for "close" icon that can be read by screen readers */ iconDescription: PropTypes.string, /** * Optional prop to allow overriding the icon rendering. * Can be a React component class */ renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), /** * Specify an optional icon for the Button through a string, * if something but regular "close" icon is desirable */ name: PropTypes.string, /** * Specify the notification type */ notificationType: PropTypes.oneOf(['toast', 'inline']), }; static defaultProps = { ariaLabel: 'close notification', // TODO: deprecate this prop notificationType: 'toast', type: 'button', iconDescription: 'close icon', renderIcon: Close16, }; render() { const { ariaLabel, className, iconDescription, type, renderIcon: IconTag, name, notificationType, ...other } = this.props; const buttonClasses = classNames( { [`${prefix}--toast-notification__close-button`]: notificationType === 'toast', [`${prefix}--inline-notification__close-button`]: notificationType === 'inline', }, className ); const iconClasses = classNames({ [`${prefix}--toast-notification__close-icon`]: notificationType === 'toast', [`${prefix}--inline-notification__close-icon`]: notificationType === 'inline', }); const NotificationButtonIcon = (() => { if (Object(IconTag) === IconTag) { return ( <IconTag aria-label={ariaLabel} className={iconClasses} name={name} /> ); } return null; })(); return ( <button {...other} type={type} aria-label={iconDescription} title={iconDescription} className={buttonClasses}> {NotificationButtonIcon} </button> ); } } export class NotificationTextDetails extends Component { static propTypes = { /** * Pass in the children that will be rendered in NotificationTextDetails */ children: PropTypes.node, /** * Specify the title */ title: PropTypes.string, /** * Specify the sub-title */ subtitle: PropTypes.node, /** * Specify the caption */ caption: PropTypes.node, /** * Specify the notification type */ notificationType: PropTypes.oneOf(['toast', 'inline']), }; static defaultProps = { title: 'title', subtitle: 'subtitle', caption: 'caption', notificationType: 'toast', }; render() { const { title, subtitle, caption, notificationType, ...other } = this.props; if (notificationType === 'toast') { return ( <div {...other} className={`${prefix}--toast-notification__details`}> <h3 className={`${prefix}--toast-notification__title`}>{title}</h3> <div className={`${prefix}--toast-notification__subtitle`}> {subtitle} </div> <div className={`${prefix}--toast-notification__caption`}> {caption} </div> {this.props.children} </div> ); } if (notificationType === 'inline') { return ( <div {...other} className={`${prefix}--inline-notification__text-wrapper`}> <p className={`${prefix}--inline-notification__title`}>{title}</p> <div className={`${prefix}--inline-notification__subtitle`}> {subtitle} </div> {this.props.children} </div> ); } } } const useIcon = kindProp => ({ error: ErrorFilled20, success: CheckmarkFilled20, warning: WarningFilled20, }[kindProp]); const NotificationIcon = ({ notificationType, kind, iconDescription }) => { const NotificationIconX = useIcon(kind); return !NotificationIconX ? null : ( <NotificationIconX className={`${prefix}--${notificationType}-notification__icon`}> <title>{iconDescription}</title> </NotificationIconX> ); }; export class ToastNotification extends Component { static propTypes = { /** * Pass in the children that will be rendered within the ToastNotification */ children: PropTypes.node, /** * Specify an optional className to be applied to the notification box */ className: PropTypes.string, /** * Specify what state the notification represents */ kind: PropTypes.oneOf(['error', 'info', 'success', 'warning']).isRequired, /** * Specify the title */ title: PropTypes.string.isRequired, /** * Specify the sub-title */ subtitle: PropTypes.node.isRequired, /** * By default, this value is "alert". You can also provide an alternate * role if it makes sense from the accessibility-side */ role: PropTypes.string.isRequired, /** * Specify the caption */ caption: PropTypes.node, /** * Provide a function that is called when menu is closed */ onCloseButtonClick: PropTypes.func, /** * Provide a description for "close" icon that can be read by screen readers */ iconDescription: PropTypes.string.isRequired, /** * By default, this value is "toast". You can also provide an alternate type * if it makes sense for the underlying `<NotificationTextDetails>` and `<NotificationButton>` */ notificationType: PropTypes.string, /** * Specify the close button should be disabled, or not */ hideCloseButton: PropTypes.bool, /** * Specify an optional duration the notification should be closed in */ timeout: PropTypes.number, }; static defaultProps = { kind: 'error', title: 'provide a title', subtitle: 'provide a subtitle', caption: 'provide a caption', role: 'alert', notificationType: 'toast', iconDescription: 'closes notification', onCloseButtonClick: () => {}, hideCloseButton: false, timeout: 0, }; state = { open: true, }; componentDidMount() { if (this.props.timeout) { setTimeout(() => { this.handleCloseButtonClick(); }, this.props.timeout); } } handleCloseButtonClick = evt => { this.setState({ open: false }); this.props.onCloseButtonClick(evt); }; render() { if (!this.state.open) { return null; } const { role, notificationType, onCloseButtonClick, // eslint-disable-line iconDescription, // eslint-disable-line className, caption, subtitle, title, kind, hideCloseButton, ...other } = this.props; const classes = classNames( `${prefix}--toast-notification`, { [`${prefix}--toast-notification--${this.props.kind}`]: this.props.kind, }, className ); return ( <div {...other} role={role} kind={kind} className={classes}> <NotificationIcon notificationType={notificationType} kind={kind} iconDescription={iconDescription} /> <NotificationTextDetails title={title} subtitle={subtitle} caption={caption} notificationType={notificationType}> {this.props.children} </NotificationTextDetails> {!hideCloseButton && ( <NotificationButton iconDescription={iconDescription} notificationType={notificationType} onClick={this.handleCloseButtonClick} /> )} </div> ); } } export class InlineNotification extends Component { static propTypes = { /** * Pass in the children that will be rendered within the InlineNotification */ children: PropTypes.node, /** * Specify an optional className to be applied to the notification box */ className: PropTypes.string, /** * Specify what state the notification represents */ kind: PropTypes.oneOf(['error', 'info', 'success', 'warning']).isRequired, /** * Specify the title */ title: PropTypes.string.isRequired, /** * Specify the sub-title */ subtitle: PropTypes.node.isRequired, /** * By default, this value is "alert". You can also provide an alternate * role if it makes sense from the accessibility-side */ role: PropTypes.string.isRequired, /** * Provide a function that is called when menu is closed */ onCloseButtonClick: PropTypes.func, /** * Provide a description for "close" icon that can be read by screen readers */ iconDescription: PropTypes.string.isRequired, /** * By default, this value is "inline". You can also provide an alternate type * if it makes sense for the underlying `<NotificationTextDetails>` and `<NotificationButton>` */ notificationType: PropTypes.string, /** * Specify the close button should be disabled, or not */ hideCloseButton: PropTypes.bool, }; static defaultProps = { role: 'alert', notificationType: 'inline', iconDescription: 'closes notification', onCloseButtonClick: () => {}, hideCloseButton: false, }; state = { open: true, }; handleCloseButtonClick = evt => { this.setState({ open: false }); this.props.onCloseButtonClick(evt); }; render() { if (!this.state.open) { return null; } const { role, notificationType, onCloseButtonClick, // eslint-disable-line iconDescription, // eslint-disable-line className, subtitle, title, kind, hideCloseButton, ...other } = this.props; const classes = classNames( `${prefix}--inline-notification`, { [`${prefix}--inline-notification--${this.props.kind}`]: this.props.kind, }, className ); return ( <div {...other} role={role} kind={kind} className={classes}> <div className={`${prefix}--inline-notification__details`}> <NotificationIcon notificationType={notificationType} kind={kind} iconDescription={iconDescription} /> <NotificationTextDetails title={title} subtitle={subtitle} notificationType={notificationType}> {this.props.children} </NotificationTextDetails> </div> {!hideCloseButton && ( <NotificationButton iconDescription={iconDescription} notificationType={notificationType} onClick={this.handleCloseButtonClick} /> )} </div> ); } }
src/components/SponsorsItem/SponsorsItem.js
hack-duke/hackduke-ideate-website
import React from 'react' import classes from './SponsorsItem.scss' const determineSize = (size) => { switch (size) { case 4: return {'maxWidth': '375px'} case 3: return {'maxWidth': '225px', 'maxHeight': '150px'} case 2: return {'maxWidth': '150px'} case 1: return {'maxWidth': '100px'} default: return {'maxWidth': '100px'} } } export const SponsorsItem = (props) => ( <div> <div className={classes.imageBox}> <a href={props.sponsorUrl}> <img className={classes.image} style={determineSize(props.size)} src={props.imageUrl} /> </a> </div> </div> ) SponsorsItem.propTypes = { imageUrl: React.PropTypes.string.isRequired, sponsorUrl: React.PropTypes.string.isRequired, size: React.PropTypes.number.isRequired } export default SponsorsItem
assets/jqwidgets/demos/react/app/chart/chartcrosshairs/app.js
juannelisalde/holter
import React from 'react'; import ReactDOM from 'react-dom'; import JqxChart from '../../../jqwidgets-react/react_jqxchart.js'; class App extends React.Component { render() { let source = { datatype: 'csv', datafields: [ { name: 'Date' }, { name: 'S&P 500' }, { name: 'NASDAQ' } ], url: '../sampledata/nasdaq_vs_sp500.txt' }; let dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true, loadError: (xhr, status, error) => { alert('Error loading "' + source.url + '" : ' + error); } }); let months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; let padding = { left: 10, top: 5, right: 30, bottom: 5 }; let titlePadding = { left: 10, top: 0, right: 0, bottom: 10 }; let xAxis = { dataField: 'Date', formatFunction: (value) => { return value.getDate() + '-' + months[value.getMonth()] + '-' + value.getFullYear(); }, type: 'date', baseUnit: 'month', minValue: '01-01-2014', maxValue: '01-01-2015', unitInterval: 1, valuesOnTicks: true, gridLines: { interval: 3 }, labels: { angle: -45, rotationPoint: 'topright', offset: { x: 0, y: -25 } } }; let seriesGroups = [ { type: 'line', valueAxis: { title: { text: 'Daily Closing Price<br><br>' } }, series: [ { dataField: 'S&P 500', displayText: 'S&P 500' }, { dataField: 'NASDAQ', displayText: 'NASDAQ' } ] } ]; return ( <JqxChart style={{ width: 850, height: 500 }} title={'U.S. Stock Market Index Performance'} description={'NASDAQ Composite compared to S&P 500'} showLegend={true} enableAnimations={true} padding={padding} titlePadding={titlePadding} source={dataAdapter} xAxis={xAxis} colorScheme={'scheme01'} seriesGroups={seriesGroups} enableCrosshairs={true} crosshairsDashStyle={'2,2'} crosshairsLineWidth={1} crosshairsColor={'#888888'} /> ) } } ReactDOM.render(<App />, document.getElementById('app'));
tp-3/recursos/react-slingshot/src/components/Root.js
jpgonzalezquinteros/sovos-reactivo-2017
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import App from './App'; import { BrowserRouter as Router } from 'react-router-dom'; export default class Root extends Component { render() { return ( <Router> <App /> </Router> ); } } Root.propTypes = { history: PropTypes.object };
imports/old/signup/dob.js
jiyuu-llc/jiyuu
import React from 'react'; const DOB = () => ({ dobNext(){ var data = $("#questionInput").val(); if(data){ Session.set('dob', data); FlowRouter.go("/register/8"); }else{ alert("Please enter your birthday."); } }, render() { return ( <div id="jiyuu"> <h2 className="question">When's your Birthday?</h2> <div id="question-card" className="form-group"> <div id="questionInputContain"> <input id="questionInput" type="text" tabindex="1" placeholder="06/04/1996" className="form-control"/> </div> <div className="qnext" onClick={this.dobNext.bind(this)}> <i className="fa fa-caret-right" aria-hidden="true"/> </div> </div> </div> ); } }); export default DOB;
voting_app/frontend/src/containers/CreatePollContainer.js
azaleas/sentio
import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; import Redirect from 'react-router-dom/Redirect'; import {api} from './../utils/Api'; class CreatePollContainer extends Component { constructor(props) { super(props); this.state = { fieldErrors: {}, title: "", choicesCounter: 0, choices: [], cancelCreate: false, notEnoughChoices: false, submitting: false, created: false, } } onTitleChange = (event) => { this.setState({ title: event.target.value }) } onChoiceChange = (event) => { let elementName = event.target.name; let choices = this.state.choices || []; let elementId = elementName.replace('choice', '') - 1; choices[elementId] = event.target.value; this.setState({ choices, }); } addElement = (event) => { event.preventDefault(); this.setState({ choicesCounter: this.state.choicesCounter + 1, }); } deleteElement = (event) => { event.preventDefault(); if(this.state.choicesCounter > 0){ this.setState({ choicesCounter: this.state.choicesCounter - 1, }); let choicesCounter = this.state.choicesCounter; let choices = this.state.choices; if(typeof choices !== 'undefined'){ choices = [...choices.slice(0, choicesCounter-1)]; this.setState({ choices, }); } } } formSubmit = (event) =>{ event.preventDefault(); const fieldErrors = this.validate(this.state.choices, this.state.title); this.setState({ fieldErrors, }); if(Object.keys(fieldErrors).length > 1) return; let choiceErrors = fieldErrors.choices.filter((el, index) => { if(el) return el; }); if(choiceErrors.length) return; if(this.state.choices.length > 0){ this.setState({ notEnoughChoices: false, submitting: true, }) api.createPoll(this.state.title, this.state.choices) .then((response) => { if(response === 200){ this.setState({ created: true, }) } }) } else{ this.setState({ notEnoughChoices: true, }); return; } } cancelCreate = (event) =>{ event.preventDefault(); this.setState({ cancelCreate: true, }) } validate = (choices, title) => { const errors = {}; if(!title || typeof(title) === "undefined"){ errors.title = true; } let choiceErrors = []; for(let ref in this.refs){ if(ref.indexOf("choice") !== -1){ let choiceInput = ReactDOM.findDOMNode(this.refs[ref]).value; if(choiceInput === ""){ choiceErrors.push(true); } else{ choiceErrors.push(false); } } } errors.choices = choiceErrors; return errors; } renderChoices(){ let choices = []; for (let indexNumber = 1; indexNumber <= this.state.choicesCounter; indexNumber++){ choices.push( <div key={"choice" + indexNumber} className={"field " + ((typeof this.state.fieldErrors.choices !== "undefined" && this.state.fieldErrors.choices[indexNumber-1]) ? "error" : "")}> <input name={"choice" + indexNumber} type="text" ref={"choice" + indexNumber} placeholder="Choice..." value={(this.state.choices.length > 0) ? this.state.choices[indexNumber-1] : ""} onChange={this.onChoiceChange} /> </div> ) } return choices; } render() { return ( (this.state.cancelCreate || this.state.created) ?( <Redirect to="/mypolls"/> ) :( <div className="ui centered grid"> <div className="row"> <div className="sixteen wide tablet six wide computer column"> <div className="ui segment"> <div className="ui top attached label green">Create New Poll</div> <form onSubmit={this.formSubmit} className="ui form"> <div className={"field " + (this.state.fieldErrors.title ? "error" : "")}> <input type="text" name="question" onChange={this.onTitleChange} value={this.state.title} placeholder="Poll title"/> </div> {this.renderChoices()} <div className="two ui buttons"> <button onClick={this.addElement} className="ui button small primary"> Add Choice </button> <button onClick={this.deleteElement} className="ui button small red"> Delete Choice </button> </div> <hr/> <input type="submit" className="ui button small" value="Submit"/> <button onClick={this.cancelCreate} className="ui button small cancelbutton"> Cancel </button> </form> { this.state.notEnoughChoices ? ( <div className="ui icon error message mini"> <i className="warning circle icon"></i> <div className="content"> <div className="header"> Add at least one choice. </div> </div> </div> ) :(<p></p>) } { this.state.submitting ? ( <div className="ui icon success message mini"> <i className="warning circle icon"></i> <div className="content"> <div className="header"> Creating new poll... </div> </div> </div> ) :(<p></p>) } </div> </div> </div> </div> ) ); } } CreatePollContainer.propTypes = { className: PropTypes.string, }; export default CreatePollContainer;
src/parser/shaman/elemental/modules/checklist/Module.js
fyruna/WoWAnalyzer
import React from 'react'; import BaseChecklist from 'parser/shared/modules/features/Checklist/Module'; import CastEfficiency from 'parser/shared/modules/CastEfficiency'; import Combatants from 'parser/shared/modules/Combatants'; import PreparationRuleAnalyzer from 'parser/shared/modules/features/Checklist/PreparationRuleAnalyzer'; import Component from './Component'; class Checklist extends BaseChecklist { static dependencies = { combatants: Combatants, castEfficiency: CastEfficiency, preparationRuleAnalyzer: PreparationRuleAnalyzer, }; render() { return ( <Component combatant={this.combatants.selected} castEfficiency={this.castEfficiency} thresholds={{ ...this.preparationRuleAnalyzer.thresholds, }} /> ); } } export default Checklist;
docs/src/app/components/pages/discover-more/Showcase.js
ichiohta/material-ui
import React from 'react'; import Title from 'react-title-component'; import {GridList, GridTile} from 'material-ui/GridList'; import IconButton from 'material-ui/IconButton'; import FontIcon from 'material-ui/FontIcon'; import MarkdownElement from '../../MarkdownElement'; import showcaseText from './showcase.md'; const styles = { gridList: { margin: 10, }, gridImage: { height: '100%', transform: 'translateX(-50%)', position: 'relative', left: '50%', cursor: 'pointer', }, }; const appList = [ // Under development // { // title: 'Call-Em-All', // author: 'Call-Em-All', // img: 'images/showcase/callemall.png', // link: '', // }, { title: 'SplitMe - Split expenses with friends', author: 'Olivier Tassinari', img: 'images/showcase/splitme.png', link: 'https://splitme.net/', source: 'https://github.com/oliviertassinari/SplitMe', }, { title: 'Syncano', author: 'Syncano', img: 'images/showcase/syncano.png', link: 'https://syncano.io/', source: 'https://github.com/Syncano/syncano-dashboard', }, { title: 'admin-on-rest - A frontend framework for building admin SPAs on top of REST services', author: 'marmelab.com', img: 'http://static.marmelab.com/admin-on-rest.gif', link: 'http://marmelab.com/admin-on-rest/', source: 'https://github.com/marmelab/admin-on-rest', }, { title: 'Flow Dashboard - Personal data for quantified self & habit tracking', author: 'Jeremy Gordon', img: 'images/showcase/flow.png', link: 'http://flowdash.co', source: 'https://github.com/onejgordon/flow-dashboard', }, { title: 'Serif.nu - Course planning for Northwestern University', author: 'Joon Park', img: 'images/showcase/serif-nu.png', link: 'https://serif.nu', source: 'https://github.com/Joonpark13/serif.nu', }, { title: 'Cloudcraft', author: 'Cloudcraft', img: 'images/showcase/cloudcraft.png', link: 'https://cloudcraft.co/', }, { title: 'It\'s quiz', author: 'It\'s quiz', img: 'images/showcase/itsquiz.png', link: 'http://itsquiz.com/', }, { title: 'ArcChat.com', author: 'Lukas Liesis', img: 'images/showcase/arcchat.png', link: 'http://ArcChat.com/', }, { title: 'SmafTV - A toolset for TV apps', author: 'Infamous Labs', img: 'images/showcase/smaftv.png', link: 'http://www.smaf.tv/', }, { title: 'Dearborn Denim - American made jeans', author: 'Alexander Tanton', img: 'images/showcase/dearborn-denim.png', link: 'http://dearborndenim.us/get-my-size', }, { title: 'Casalova - Book your next rental', author: 'Casalova', img: 'images/showcase/casalova.png', link: 'https://www.casalova.com/', }, { title: 'LireLactu', author: 'miLibris', img: 'images/showcase/lirelactu.png', link: 'http://lirelactu.fr/', }, { title: 'Realty Advisors Elite', author: 'Chicago Business Intelligence', img: 'images/showcase/realty-advisors-elite.png', link: 'https://www.realtyadvisorselite.com/', }, { title: 'Humorista Jokes', author: 'Minas Mina', img: 'images/showcase/humorista.png', link: 'https://humorista.org/', }, { title: 'ApiRequest Capture (Chrome Extension)', author: '[email protected]', img: 'images/showcase/apirequest-capture-by-moesif.png', link: 'https://chrome.google.com/webstore/detail/apirequestio-capture/aeojbjinmmhjenohjehcidmappiodhjm', }, { title: 'SlimChess - Instant Chess Games on the Go', author: 'Larry Xu', img: 'images/showcase/slimchess.png', link: 'https://slimchess.com', }, ]; const Showcase = () => ( <div> <Title render={(previousTitle) => `Showcase - ${previousTitle}`} /> <MarkdownElement text={showcaseText} /> <GridList cols={3} cellHeight={200} style={styles.gridList} > {appList.map((app) => ( <GridTile key={app.title} title={app.title} subtitle={<span>{'by '}<b>{app.author}</b></span>} actionIcon={app.source && <IconButton href={app.source} target="_blank"> <FontIcon className="muidocs-icon-custom-github" color="white" /> </IconButton> } > {/* The GridTile `href` prop would nest the `actionIcon` link, so we wrap the image instead. */} <a href={app.link} target="_blank"> <img src={app.img} style={styles.gridImage} /> </a> </GridTile> ))} </GridList> </div> ); export default Showcase;
test/helpers/shallowRenderHelper.js
puregardenia/gallery-by-react
/** * Function to get the shallow output for a given component * As we are using phantom.js, we also need to include the fn.proto.bind shim! * * @see http://simonsmith.io/unit-testing-react-components-without-a-dom/ * @author somonsmith */ import React from 'react'; import TestUtils from 'react-addons-test-utils'; /** * Get the shallow rendered component * * @param {Object} component The component to return the output for * @param {Object} props [optional] The components properties * @param {Mixed} ...children [optional] List of children * @return {Object} Shallow rendered output */ export default function createComponent(component, props = {}, ...children) { const shallowRenderer = TestUtils.createRenderer(); shallowRenderer.render(React.createElement(component, props, children.length > 1 ? children : children[0])); return shallowRenderer.getRenderOutput(); }
public/app/index.js
crimsonskyrem/BetaAssisstant
import React from 'react'; import ReactDOM from 'react-dom'; import { Router, Route, hashHistory} from 'react-router' import IndexHello from './components/IndexHello'; import NotFound from './components/NotFound'; import Usr from './components/Usr'; ReactDOM.render( ( <Router history={hashHistory}> <Route path="/" component={IndexHello} /> <Route path="/usr/:usrId" component={Usr} /> <Route path="/*" component={NotFound}/> </Router> ), document.getElementById('app') );
src/components/AlbumPhotos.js
qubbit/gopal.io
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { fetchAlbumPhotos } from '../actions'; import Loader from './Loader'; import Gallery from 'react-photo-gallery'; import Measure from 'react-measure'; import Lightbox from 'react-images'; class AlbumPhotos extends Component { componentDidMount() { const params = { photoset_id: this.props.match.params.id }; this.props.fetchAlbumPhotos(params); } constructor() { super(); this.state = { width: -1, currentImage: 0 }; this.closeLightbox = this.closeLightbox.bind(this); this.openLightbox = this.openLightbox.bind(this); this.gotoNext = this.gotoNext.bind(this); this.gotoPrevious = this.gotoPrevious.bind(this); } openLightbox(event, obj) { this.setState({ currentImage: obj.index, lightboxIsOpen: true }); } closeLightbox() { this.setState({ currentImage: 0, lightboxIsOpen: false }); } gotoPrevious() { this.setState({ currentImage: this.state.currentImage - 1 }); } gotoNext() { this.setState({ currentImage: this.state.currentImage + 1 }); } render() { const { loading, album, photos } = this.props; const width = this.state.width; if (loading) { return <Loader />; } var flickrAlbumUrl = `https://www.flickr.com/photos/${album.owner}/sets/${ album.id }`; var ps = photos.map(p => ({ caption: p.description._content, width: parseInt(p.width_m, 10), height: parseInt(p.height_m, 10), src: p.url_m, srcSet: [ `${p.url_m} ${p.width_m}w`, `${p.url_c} ${p.width_c}w`, `${p.url_l} ${p.width_l}w`, `${p.url_h} ${p.width_h}w` ] })); return ( <Measure bounds onResize={contentRect => this.setState({ width: contentRect.bounds.width }) } > {({ measureRef }) => { if (width < 1) { return <div ref={measureRef} />; } let columns = 1; if (width >= 480) { columns = 2; } if (width >= 1024) { columns = 3; } if (width >= 1824) { columns = 4; } return ( <div ref={measureRef}> <div className="album-title"> <h2>{album.title}</h2> <div> <button onClick={() => this.props.history.goBack()}> ← Go Back </button> {' | '} <a className="link" href={flickrAlbumUrl}> View on Flickr </a> </div> </div> <Gallery photos={ps} columns={columns} onClick={this.openLightbox} /> <Lightbox images={ps} onClose={this.closeLightbox} onClickPrev={this.gotoPrevious} onClickNext={this.gotoNext} currentImage={this.state.currentImage} isOpen={this.state.lightboxIsOpen} /> </div> ); }} </Measure> ); } } export default connect( state => ({ photos: state.photos.photos, album: state.photos.album, loading: state.photos.loading }), { fetchAlbumPhotos } )(AlbumPhotos);
examples/src/components/App.js
kenfehling/react-designable-audio-player
import React from 'react'; import Simple from './Simple'; import WithPlaylist from './WithPlaylist'; import Unstyled from './Unstyled'; import CustomPlaylist from './CustomPlaylist'; import Fixed from './Fixed'; const rowStyle = {display: 'flex', marginTop: '40px'}; const playlistContainerStyle = {margin: 'auto'}; export default () => ( <div> <div style={rowStyle}> <div style={playlistContainerStyle}><Simple /></div> <div style={playlistContainerStyle}><WithPlaylist /></div> </div> <div style={rowStyle}> <div style={{...playlistContainerStyle, width: '320px'}}><Unstyled /></div> <div style={playlistContainerStyle}><CustomPlaylist /></div> </div> <Fixed /> </div> );
app/components/Footer.js
kensworth/olyranks
import React from 'react'; import {Link} from 'react-router'; import FooterStore from '../stores/FooterStore' import FooterActions from '../actions/FooterActions'; class Footer extends React.Component { constructor(props) { super(props); this.state = FooterStore.getState(); this.onChange = this.onChange.bind(this); } componentDidMount() { FooterStore.listen(this.onChange); FooterActions.getTopCharacters(); } componentWillUnmount() { FooterStore.unlisten(this.onChange); } onChange(state) { this.setState(state); } render() { let leaderboardCharacters = this.state.characters.map(function(character) { return ( <li key={character.characterId}> <Link to={'/characters/' + character.characterId}> <img className='thumb-md' src={'http://image.eveonline.com/Character/' + character.characterId + '_128.jpg'} /> </Link> </li> ); }); return ( <footer> <div className='container'> <div className='row'> <div className='col-sm-5'> <h3 className='lead'><strong>Information</strong> and <strong>Copyright</strong></h3> <p>Powered by <strong>Node.js</strong>, <strong>MongoDB</strong> and <strong>React</strong> with Flux architecture and server-side rendering.</p> <p>You may view the <a href='https://github.com/kensworth/olyranks'>Source Code</a> behind this project on GitHub.</p> <p>© 2015 Kenneth Zhang. <br />Inspired by Sahat Yalkabov.</p> </div> <div className='col-sm-7 hidden-xs'> <h3 className='lead'><strong>Leaderboard</strong> Top 5 Characters</h3> <ul className='list-inline'> {leaderboardCharacters} </ul> </div> </div> </div> </footer> ); } } export default Footer;
styleguide/Styleguide.js
rdjpalmer/bloom
import React, { Component } from 'react'; import { BrowserRouter, Switch, Route } from 'react-router-dom'; import SiteHeader from './components/SiteHeader/SiteHeader'; import Navigation from './components/Navigation/Navigation'; import OffCanvasPanel from './components/OffCanvasPanel/OffCanvasPanel'; import BtnContainer from '../components/BtnContainer/BtnContainer'; import Icon from '../components/Icon/Icon'; import ScreenReadable from '../components/ScreenReadable/ScreenReadable'; import Wrapper from '../components/Wrapper/Wrapper'; import BodyClassNameConductor from '../utils/BodyClassNameConductor/BodyClassNameConductor'; import ScrollToTop from './components/ScrollToTop/ScrollToTop'; /* Pages */ import Introduction from './screens/Overview/Introduction'; import Colors from './screens/Design/Colors'; import Iconography from './screens/Design/Iconography'; import ResponsiveDesign from './screens/Design/ResponsiveDesign'; import Typography from './screens/Design/Typography'; import Patterns from './screens/Patterns/Patterns'; import FourOhFour from './404'; import css from './Styleguide.css'; export default class Styleguide extends Component { constructor(props) { super(props); this.bodyClassName = new BodyClassNameConductor(this.id); } state = { showNavigation: false, }; toggleNavigation = () => { this.setState(({ showNavigation }) => ({ showNavigation: !showNavigation, })); }; openNavigation = () => { this.setState({ showNavigation: true }); this.bodyClassName.add('overflowHidden'); this.bodyClassName.add('positionFixed'); }; closeNavigation = () => { this.setState({ showNavigation: false }); this.bodyClassName.remove('overflowHidden'); this.bodyClassName.remove('positionFixed'); }; render() { const { showNavigation } = this.state; return ( <BrowserRouter> <ScrollToTop> <div className={ css.root }> <BtnContainer className={ css.menuBtn } onClick={ this.openNavigation }> <Icon className={ css.menuIcon } name="menu" /> <ScreenReadable>Open menu</ScreenReadable> </BtnContainer> <OffCanvasPanel className={ css.navigationSm } activeClassName={ css.navigationActive } active={ showNavigation } onClose={ this.closeNavigation } > <SiteHeader version={ process.env.npm_package_version } onLinkClick={ this.closeMenu } /> <Navigation onLinkClick={ this.closeNavigation } /> </OffCanvasPanel> <div className={ css.navigationLg }> <SiteHeader version={ process.env.npm_package_version } onLinkClick={ this.closeMenu } /> <Navigation onLinkClick={ this.closeNavigation } /> </div> <div className={ css.body }> <Wrapper className={ css.wrapper }> <Switch> <Route exact path="/" component={ Introduction } /> <Route path="/design/colors" component={ Colors } /> <Route path="/design/responsive-design" component={ ResponsiveDesign } /> <Route path="/design/iconography" component={ Iconography } /> <Route path="/design/typography" component={ Typography } /> <Patterns /> <Route component={ FourOhFour } /> </Switch> </Wrapper> </div> </div> </ScrollToTop> </BrowserRouter> ); } }
src/Popover.js
aparticka/react-bootstrap
import React from 'react'; import classNames from 'classnames'; import BootstrapMixin from './BootstrapMixin'; import CustomPropTypes from './utils/CustomPropTypes'; const Popover = React.createClass({ mixins: [ BootstrapMixin ], propTypes: { /** * An html id attribute, necessary for accessibility * @type {string} * @required */ id: CustomPropTypes.isRequiredForA11y(React.PropTypes.string), /** * Sets the direction the Popover is positioned towards. */ placement: React.PropTypes.oneOf(['top', 'right', 'bottom', 'left']), /** * The "left" position value for the Popover. */ positionLeft: React.PropTypes.number, /** * The "top" position value for the Popover. */ positionTop: React.PropTypes.number, /** * The "left" position value for the Popover arrow. */ arrowOffsetLeft: React.PropTypes.oneOfType([ React.PropTypes.number, React.PropTypes.string ]), /** * The "top" position value for the Popover arrow. */ arrowOffsetTop: React.PropTypes.oneOfType([ React.PropTypes.number, React.PropTypes.string ]), /** * Title text */ title: React.PropTypes.node }, getDefaultProps() { return { placement: 'right' }; }, render() { const classes = { 'popover': true, [this.props.placement]: true }; const style = { 'left': this.props.positionLeft, 'top': this.props.positionTop, 'display': 'block', // we don't want to expose the `style` property ...this.props.style // eslint-disable-line react/prop-types }; const arrowStyle = { 'left': this.props.arrowOffsetLeft, 'top': this.props.arrowOffsetTop }; return ( <div role='tooltip' {...this.props} className={classNames(this.props.className, classes)} style={style} title={null}> <div className="arrow" style={arrowStyle} /> {this.props.title ? this.renderTitle() : null} <div className="popover-content"> {this.props.children} </div> </div> ); }, renderTitle() { return ( <h3 className="popover-title">{this.props.title}</h3> ); } }); export default Popover;
docs/src/components/clients/Filters.js
tannerlinsley/react-table
import React from 'react' export const Filters = () => ( <> <svg width={0} height={0}> <defs> <filter id="high-threshold"> <feColorMatrix type="saturate" values="0" /> <feComponentTransfer> <feFuncR type="discrete" tableValues="0" /> <feFuncG type="discrete" tableValues="0" /> <feFuncB type="discrete" tableValues="0" /> </feComponentTransfer> </filter> </defs> </svg> <svg width={0} height={0}> <defs> <filter id="medium-threshold"> <feColorMatrix type="saturate" values="0" /> <feComponentTransfer> <feFuncR type="discrete" tableValues="0 1" /> <feFuncG type="discrete" tableValues="0 1" /> <feFuncB type="discrete" tableValues="0 1" /> </feComponentTransfer> </filter> </defs> </svg> <svg width={0} height={0}> <defs> <filter id="low-threshold"> <feColorMatrix type="saturate" values="0" /> <feComponentTransfer> <feFuncR type="discrete" tableValues="0 0 0 0 1" /> <feFuncG type="discrete" tableValues="0 0 0 0 1" /> <feFuncB type="discrete" tableValues="0 0 0 0 1" /> </feComponentTransfer> </filter> </defs> </svg> </> )
src/index.js
rindhane/totalsolv
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById('root') ); // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals();
src/app.js
saschaishikawa/planetary-response-network
import React from 'react'; import ReactDOM from 'react-dom'; import { Router, IndexRoute, Route } from 'react-router'; import createBrowserHistory from 'history/lib/createBrowserHistory'; import { IndexPage, UploadPage, BuildsPage, SettingsPage, LoginPage } from './pages'; ReactDOM.render( <Router history={createBrowserHistory()}> <Route path='/' component={IndexPage}/> <Route path='/upload' component={UploadPage}/> <Route path='/builds' component={BuildsPage}/> <Route path='/settings' component={SettingsPage}/> <Route path='/login' component={LoginPage}/> </Router>, document.getElementById('app-container') );
src/js/routes/Multiplier/components/Multiplier.js
vladiibine/trust-network
import React from 'react' export const Multiplier = (props) => ( <div style={{ margin: '0 auto' }} > <h2>Multiplier: {props.counter}</h2> <button className='btn btn-default' onClick={props.increment}> Double </button> {' '} <button className='btn btn-default' onClick={props.doubleAsync}> Square (Async) </button> </div> ) Multiplier.propTypes = { counter : React.PropTypes.number.isRequired, doubleAsync : React.PropTypes.func.isRequired, increment : React.PropTypes.func.isRequired } export default Multiplier
pathfinder/vtables/appmap2etom/src/common/TableUtilities.js
leanix/leanix-custom-reports
import React from 'react'; import Utilities from './Utilities'; import Link from './Link'; import LinkList from './LinkList'; /* formatting functions for the table */ const OVERFLOW_CELL_STYLE = { maxHeight: '100px', overflow: 'auto' }; function formatLinkFactsheet(setup) { const baseUrl = Utilities.getFrom(setup, 'settings.baseUrl'); return (cell, row, extraData) => { if (!cell || !baseUrl) { return ''; } return ( <Link link={baseUrl + '/factsheet/' + extraData.type + '/' + row[extraData.id]} target='_blank' text={cell} /> ); }; } function formatLinkArrayFactsheets(setup) { const baseUrl = Utilities.getFrom(setup, 'settings.baseUrl'); return (cell, row, extraData) => { if (!cell || !baseUrl) { return ''; } return ( <div style={OVERFLOW_CELL_STYLE}> <LinkList links={ cell.reduce((arr, e, i) => { arr.push({ link: baseUrl + '/factsheet/' + extraData.type + '/' + row[extraData.id][i], target: '_blank', text: e }); return arr; }, [])} delimiter={extraData.delimiter} /> </div> ); }; } function formatEnum(cell, row, enums) { if (!cell && cell !== 0) { return ''; } return enums[cell] ? enums[cell] : ''; } function formatEnumArray(cell, row, extraData) { let result = ''; if (!cell || !extraData || !extraData.delimiter || !extraData.enums) { return result; } let first = false; cell.forEach((e) => { const formatted = formatEnum(e, row, extraData.enums); if (formatted === '') { return; } if (first) { result += extraData.delimiter; } else { first = true; } result += formatted; }); if (extraData.delimiter === '<br/>') { return ( <div style={OVERFLOW_CELL_STYLE} dangerouslySetInnerHTML={{ __html: result }} /> ); } return result; } function formatOptionalText(cell, row, formatRaw) { if (!cell) { return ''; } return formatRaw ? cell : ( <div style={OVERFLOW_CELL_STYLE}>{cell}</div> ); } function formatDate(cell, row) { if (!cell) { return ''; } return ( <span style={{ paddingRight: '10%' }}> {_formatDate(cell, '-', false)} </span> ); } function _formatDate(date, delimiter, reverse) { if (reverse) { return date.getFullYear() + delimiter + _formatDateNumber(date.getMonth() + 1) + delimiter + _formatDateNumber(date.getDate()); } return _formatDateNumber(date.getDate()) + delimiter + _formatDateNumber(date.getMonth() + 1) + delimiter + date.getFullYear(); } function _formatDateNumber(n) { return n < 10 ? '0' + n : n; } function formatArray(cell, row, delimiter) { let result = ''; if (!cell || !delimiter) { return result; } cell.forEach((e) => { if (result.length) { result += delimiter; } result += e; }); if (delimiter === '<br/>') { return ( <div style={OVERFLOW_CELL_STYLE} dangerouslySetInnerHTML={{ __html: result }} /> ); } return result; } /* formatting functions for the csv export */ function csvFormatDate(cell, row) { if (!cell) { return ''; } return _formatDate(cell, '-', true); } /* pre-defined filter objects */ const textFilter = { type: 'TextFilter', condition: 'like', placeholder: 'Please enter a value' }; function selectFilter(options) { return { type: 'SelectFilter', condition: 'eq', placeholder: 'Please choose', options: options }; } const dateFilter = { type: 'DateFilter' }; const numberFilter = { type: 'NumberFilter', placeholder: 'Please enter a value', defaultValue: { comparator: '<=' } }; /* custom PropTypes */ function options(props, propName, componentName) { const options = props[propName]; if (options !== null && typeof options === 'object' && checkKeysAndValues(options)) { // test passes successfully return; } return new Error( 'Invalid prop "' + propName + '" supplied to "' + componentName + '". Validation failed.' ); } const intRegExp = /^\d+$/; function checkKeysAndValues(options) { for (let key in options) { if (!intRegExp.test(key)) { return false; } const value = options[key]; if (typeof value !== 'string' && !(value instanceof String)) { return false; } } return true; } function idArray(namesPropName) { return (props, propName, componentName) => { const ids = props[propName]; const names = props[namesPropName]; if (names && ids && Array.isArray(names) && Array.isArray(ids) && names.length === ids.length && isStringArray(ids)) { // test passes successfully return; } return new Error( 'Invalid prop "' + propName + '" supplied to "' + componentName + '". Validation failed.' ); }; } function isStringArray(arr) { for (let i = 0; i < arr.length; i++) { const e = arr[i]; if (typeof e !== 'string' && !(e instanceof String)) { return false; } } return true; } export default { OVERFLOW_CELL_STYLE: OVERFLOW_CELL_STYLE, formatLinkFactsheet: formatLinkFactsheet, formatLinkArrayFactsheets: formatLinkArrayFactsheets, formatEnum: formatEnum, formatEnumArray: formatEnumArray, formatOptionalText: formatOptionalText, formatDate: formatDate, formatArray: formatArray, csvFormatDate: csvFormatDate, textFilter: textFilter, selectFilter: selectFilter, dateFilter: dateFilter, numberFilter: numberFilter, PropTypes: { options: options, idArray: idArray } };
src/index.js
brychanrobot/recipes
import React from 'react' import ReactDOM from 'react-dom' import Root from './components/Root' import store from './store' ReactDOM.render( <Root store={store} />, document.getElementById('root') )
pages/roster/men.js
cindytung/calwtcrew
import React from 'react'; import Roster from '../../components/Roster'; import photo from '../../assets/images/mensroster.jpg'; import '../../css/rosters.scss'; const RosterPage = () => ( <div className="container"> <div className="page__header"> 2015-2016 Varsity & Novice Men </div> <div className="image"> <img alt="" src={photo} /> </div> <div className="roster"> <Roster rosterName={'Varsity Men'} names={[ 'Amos Frank', 'Andy Chung', 'Arthur Sebes', 'Ben Bavonese', 'Brian Osgood', 'Chris Chen', 'Daniel Chang', 'David Yang', 'Edison Wong', 'George Man', 'Ishaan Golding', 'Jake Tennant', 'Jason Ke', 'Jose Fernandez', 'Michael Giron', 'Palmer Hayward', 'Thomas Dwelley', ]} sides={[ 'no preference', 'starboard', 'no preference', 'port', 'port', 'port', 'starboard', 'port', 'coxswain', 'starboard', 'coxswain', 'no preference', 'starboard', 'port', 'starboard', 'no preference', 'starboard', ]} years={[ 'Freshman', 'Junior', 'Grad Student', 'Freshman', 'Senior', 'Junior', 'Sophomore', 'Junior', 'Sophomore', 'Sophomore', 'Sophomore', 'Freshman', 'Freshman', 'Sophomore', 'Junior', 'Senior', 'Junior', ]} hometowns={[ 'Vancouver, BC', 'Burbank, CA', 'Lyon, France', 'Ann Arbor, MI', 'Santa Barbara, CA', 'Arcadia, CA', 'Hightstown, NJ', 'Toronto, ON', 'Canton, China', 'San Francisco, CA', 'Austin, TX', 'Sacramento, CA', 'San Diego, CA', 'Fullerton, CA', 'Hemet, CA', 'San Diego, CA', 'Santa Barbara, CA', ]} majors={[ 'Undeclared', 'Economics', 'Transportation Engineering', 'Economics', 'Political Science', 'Chemical Biology', 'Molecular & Cell Biology', 'Chemical & Material Science Eng.', 'Cognitive Science', 'Molecular & Cell Biology', 'Political Science', 'Molecular & Cell Biology', 'Undeclared', 'Ethnic Studies', 'Development Studies', 'Mechanical Engineering', 'Mechanical Engineering', ]} /> </div> <div className="roster"> <Roster rosterName={'Novice Men'} names={[ 'Andrew Capistrano', 'Andrew Chi', 'Antonio Sakkis', 'Chris Webster', 'Chan Varma', 'Eric Vengrin', 'Derek Feng', 'Jake Yukich', 'Jameson Mah', 'Jeffrey Liu', 'Jonathan Lin', 'Jonathan Lowery', 'Joshua Sanders', 'Kevin Mahoney', 'Luca Amato', 'Magne Ledsaak', 'Mateo Lopez', 'Michael Eliot', 'Omid Rhezaii', 'Peter Birghoffer', 'Salim Dharamshi', 'Samson Mataraso', 'Shaun Singh', 'Shahzad Shaukat', 'Taeho Jung', 'Taylor Wong', 'Tristan Wasley', 'Windsor Taro', ]} sides={[ 'no preference', 'starboard', 'port', 'starboard', 'coxswain', 'no preference', 'port', 'port', 'starboard', 'port', 'starboard', 'port', 'port', 'no preference', 'starboard', 'starboard', 'port', 'no preference', 'starboard', 'starboard', 'starboard', 'port', 'port', 'starboard', 'starboard', 'starboard', 'starboard', 'no preference', ]} years={[ 'Sophomore', 'Freshman', 'Freshman', 'Sophomore', 'Freshman', 'Freshman', 'Freshman', 'Freshman', 'Freshman', 'Junior', 'Junior', 'Junior', 'Senior', 'Freshman', 'Freshman', 'Junior', 'Freshman', 'Freshman', 'Freshman', 'Freshman', 'Freshman', 'Freshman', 'Senior', 'Freshman', 'Junior', 'Freshman', 'Freshman', 'Senior', ]} hometowns={[ 'Hong Kong, China', 'Garden Grove, CA', 'Houston, TX', 'Stockton, CA', 'Bangalore, India', 'San Diego, CA', 'Fremont, CA', 'Los Angeles, CA', 'Oxnard, CA', 'Palo Alto, CA', 'San Jose, CA', 'San Diego, CA', 'Clearwater, FL', 'East Richmond Heights, CA', 'Los Angeles, CA', 'Stavanger, Norway', 'Bakersfield, CA', 'Huntington Beach, CA', 'San Diego, CA', 'Budapest, Hungary', 'Nairobi, Kenya', 'Walnut Creek, CA', 'Berkeley, CA', 'Lahore, Pakistan', 'Busan, South Korea', 'Cary, NC', 'Laguna Hills, CA', 'San Antonio, TX', ]} majors={[ 'Environmental Science', 'Economics & Pre-Business', 'Undeclared', 'Economics', 'Computer Science', 'Undeclared', 'Undeclared', 'Molecular & Cell Biology', 'Molecular & Cell Biology', 'Electrical Engineering & Comp. Sci.', 'Chemical Biology & Music', 'Economics', 'Music', 'Civil & Environmental Engineering', 'Political Science', 'Industrial Economics', 'Public Health', 'Pre-Business and Computer Science', 'Undeclared', 'Undeclared', 'History & Economics', 'Bioengineering', 'Economics', 'Undeclared', 'Japanese', 'Electrical Engineering & Comp. Sci.', 'Undeclared', 'Economics', ]} /> </div> </div> ); export default RosterPage;
src/layouts/header.js
kevin-roark/spaghettis-site
import React from 'react' const Header = () => null export default Header
src/index.js
NazarenoL/smart-mirror-front
import React from 'react'; import ReactDOM from 'react-dom'; import AppContainer from './components/AppContainer'; import '../styles/base.scss'; ReactDOM.render( <AppContainer />, document.getElementById('root') );
src/TableViewCell.js
aksonov/react-native-tableview
import React from 'react'; import { requireNativeComponent } from 'react-native'; const RNCellView = requireNativeComponent('RNCellView', null); export default class TableViewCell extends React.Component { constructor(props) { super(props); this.state = { width: 0, height: 0 }; } render() { return ( <RNCellView onLayout={event => { this.setState(event.nativeEvent.layout); }} {...this.props} componentWidth={this.state.width} componentHeight={this.state.height} /> ); } }
src/components/MessageView.js
saas-plat/saas-plat-native
import React from 'react'; import { View, Text, Platform, StatusBar, TouchableOpacity } from 'react-native'; import {autobind} from 'core-decorators'; import {connectStyle} from '../core/Theme'; import {translate} from '../core/I18n'; import { tx } from '../utils/internal'; // 消息提示 @translate('core.MessageView') @connectStyle('core.MessageView') export default class MessageView extends React.Component { @autobind onPressFeed() { this.props.history.goBack(); } getTipMsg() { let tipMsg = this.props.msg || tx('迷路了吗?返回上一页。'); switch (this.props.code) { case 'ModuleNotExists': tipMsg = tx('导航页面不存在啦~~~戳我返回上一页。'); break; case 'AuthenticationFailed': tipMsg = tx('尚未登录无法访问当前页面哦~戳我返回上一页。'); break; case 'ServerAddressNotLoaded': tipMsg = tx('服务器地址尚未加载成功,点我可以尝试退出重新登录试试。'); break; case 'ServerLoadFailed': tipMsg = tx('门户页配置错误,无法打开啦,点我进入管理控制台调整~。'); break; case 'BaseLoadFailed': tipMsg = tx('平台组件加载失败,请进入社区http://community.saas-plat.com查找解决方案~。'); break; } return tipMsg; } renderToolbar() { return (<ToolbarAndroid onIconClicked={this.onPressFeed} style={this.props.style.toolbar} title={this.props.t('MessageTitle')}/>); } render() { return ( <View style={this.props.style.page}> {(Platform.OS === 'android' || Platform.OS === 'ios')?<StatusBar hidden={false} barStyle='default'/>:null} <View style={this.props.style.container}> <TouchableOpacity onPress={this.onPressFeed}> <View> <Text style={this.props.style.error}>{this.getTipMsg()}</Text> </View> </TouchableOpacity> </View> </View> ); } }
ui/src/components/Switch.js
untoldwind/eightyish
import React from 'react' import shallowEqual from '../util/shallowEqual' export default class Switch extends React.Component { static propTypes = { onText: React.PropTypes.string.isRequired, offText: React.PropTypes.string.isRequired, id: React.PropTypes.string, label: React.PropTypes.string.isRequired, value: React.PropTypes.bool.isRequired, onChange: React.PropTypes.func } static defaultProps = { onText: 'ON', offText: 'OFF', label: '\u00a0' } constructor(props) { super(props) this.toggle = this.toggle.bind(this) } componentDidMount() { this.updateWidths() } componentDidUpdate() { this.updateWidths() } shouldComponentUpdate(nextProps) { return !shallowEqual(this.props, nextProps, true) } updateWidths() { const width = React.findDOMNode(this.refs.label).offsetWidth React.findDOMNode(this.refs.label).style.width = width + 'px' React.findDOMNode(this.refs.on).style.width = width + 'px' React.findDOMNode(this.refs.off).style.width = width + 'px' React.findDOMNode(this.refs.wrapper).style.width = (2 * width) + 'px' React.findDOMNode(this.refs.container).style.width = (3 * width) + 'px' if (this.props.value) { React.findDOMNode(this.refs.container).style.marginLeft = '0px' } else { React.findDOMNode(this.refs.container).style.marginLeft = (-width) + 'px' } } render() { let className = 'bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-animate ' if (this.props.value) { className += 'bootstrap-switch-on' } else { className += 'bootstrap-switch-off' } return ( <div className={className} id={this.props.id} onClick={this.toggle} ref="wrapper"> <div className="bootstrap-switch-container" ref="container"> <span className="bootstrap-switch-handle-on bootstrap-switch-primary" ref="on"> {this.props.onText} </span> <span className="bootstrap-switch-label" ref="label"> {this.props.label} </span> <span className="bootstrap-switch-handle-off bootstrap-switch-default" ref="off"> {this.props.offText} </span> </div> </div> ) } toggle() { if (this.props.onChange) { this.props.onChange(!this.props.value) } } }
app/javascript/flavours/glitch/features/ui/components/tabs_bar.js
Kirishima21/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import { NavLink, withRouter } from 'react-router-dom'; import { FormattedMessage, injectIntl } from 'react-intl'; import { debounce } from 'lodash'; import { isUserTouching } from 'flavours/glitch/util/is_mobile'; import Icon from 'flavours/glitch/components/icon'; import NotificationsCounterIcon from './notifications_counter_icon'; export const links = [ <NavLink className='tabs-bar__link' to='/home' data-preview-title-id='column.home' data-preview-icon='home' ><Icon id='home' fixedWidth /><FormattedMessage id='tabs_bar.home' defaultMessage='Home' /></NavLink>, <NavLink className='tabs-bar__link' to='/notifications' data-preview-title-id='column.notifications' data-preview-icon='bell' ><NotificationsCounterIcon /><FormattedMessage id='tabs_bar.notifications' defaultMessage='Notifications' /></NavLink>, <NavLink className='tabs-bar__link' to='/public/local' data-preview-title-id='column.community' data-preview-icon='users' ><Icon id='users' fixedWidth /><FormattedMessage id='tabs_bar.local_timeline' defaultMessage='Local' /></NavLink>, <NavLink className='tabs-bar__link' exact to='/public' data-preview-title-id='column.public' data-preview-icon='globe' ><Icon id='globe' fixedWidth /><FormattedMessage id='tabs_bar.federated_timeline' defaultMessage='Federated' /></NavLink>, <NavLink className='tabs-bar__link optional' to='/search' data-preview-title-id='tabs_bar.search' data-preview-icon='bell' ><Icon id='search' fixedWidth /><FormattedMessage id='tabs_bar.search' defaultMessage='Search' /></NavLink>, <NavLink className='tabs-bar__link' style={{ flexGrow: '0', flexBasis: '30px' }} to='/getting-started' data-preview-title-id='getting_started.heading' data-preview-icon='bars' ><Icon id='bars' fixedWidth /></NavLink>, ]; export function getIndex (path) { return links.findIndex(link => link.props.to === path); } export function getLink (index) { return links[index].props.to; } export default @injectIntl @withRouter class TabsBar extends React.PureComponent { static propTypes = { intl: PropTypes.object.isRequired, history: PropTypes.object.isRequired, } setRef = ref => { this.node = ref; } handleClick = (e) => { // Only apply optimization for touch devices, which we assume are slower // We thus avoid the 250ms delay for non-touch devices and the lag for touch devices if (isUserTouching()) { e.preventDefault(); e.persist(); requestAnimationFrame(() => { const tabs = Array(...this.node.querySelectorAll('.tabs-bar__link')); const currentTab = tabs.find(tab => tab.classList.contains('active')); const nextTab = tabs.find(tab => tab.contains(e.target)); const { props: { to } } = links[Array(...this.node.childNodes).indexOf(nextTab)]; if (currentTab !== nextTab) { if (currentTab) { currentTab.classList.remove('active'); } const listener = debounce(() => { nextTab.removeEventListener('transitionend', listener); this.props.history.push(to); }, 50); nextTab.addEventListener('transitionend', listener); nextTab.classList.add('active'); } }); } } render () { const { intl: { formatMessage } } = this.props; return ( <div className='tabs-bar__wrapper'> <nav className='tabs-bar' ref={this.setRef}> {links.map(link => React.cloneElement(link, { key: link.props.to, onClick: this.handleClick, 'aria-label': formatMessage({ id: link.props['data-preview-title-id'] }) }))} </nav> <div id='tabs-bar__portal' /> </div> ); } }
src/client/app/panels/assign.dashboard.panel.js
mapkiwiz/sectorisation
import React from 'react'; import {MenuLink} from './menu.link'; export function AssignDashboardPanel(props, context) { return ( <div className="col-md-4 col-md-offset-8 panel-container"> <h3> Tableau de bord <MenuLink /> </h3> <hr/> <p className="help-block">Pas encore implémenté</p> </div> ); }
react-weather-forecast/src/index.js
majalcmaj/ReactJSCourse
import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import ReduxPromise from 'redux-promise'; import App from './components/app'; import reducers from './reducers'; const createStoreWithMiddleware = applyMiddleware(ReduxPromise)(createStore); ReactDOM.render( <Provider store={createStoreWithMiddleware(reducers)}> <App /> </Provider> , document.querySelector('.container'));
src/routes/routes.react.js
ricca509/geckboard_challenge
import React from 'react'; import Router from 'react-router'; import App from '../components/App/App.react.js'; import ReposController from '../components/ReposController/ReposController.react.js'; import RepoDetailsController from '../components/RepoDetailsController/RepoDetailsController.react.js'; let Route = Router.Route; let routes = ( <Route handler={App} path="/"> <Route name="main" handler={ReposController} path="/repos/:username"></Route> <Route name="details" handler={RepoDetailsController} path="/repo/:username/:name"></Route> </Route> ); export default routes;
src/app/components/navigation/components/NavMenuItem.js
backpackcoder/world-in-flames
import React from 'react' import {Link} from 'react-router' import Msg from '../../i18n/Msg' import SmartMenuList from './NavMenuList' export default class SmartMenuItem extends React.Component { static contextTypes = { router: React.PropTypes.object.isRequired }; render() { const item = this.props.item; const title = !item.parent ? <span className="menu-item-parent"><Msg phrase={item.title}/></span> : <Msg phrase={item.title}/>; const badge = item.badge ? <span className={item.badge.class}>{item.badge.label || ''}</span> : null; const childItems = item.items ? <SmartMenuList items={item.items}/> : null; const icon = item.icon ? ( item.counter ? <i className={item.icon}><em>{item.counter}</em></i> : <i className={item.icon}/> ) : null; const liClassName = (item.route && this.context.router.isActive(item.route) ) ? 'active' : ''; const link = item.route ? <Link to={item.route} title={item.title} activeClassName="active"> {icon} {title} {badge} </Link> : <a href={item.href || '#'} onClick={this._handleClick} title={item.title}> {icon} {title} {badge} </a>; return <li className={liClassName}>{link}{childItems}</li> } }
src/Parser/Warlock/Affliction/Modules/Items/Legendaries/TheMasterHarvester.js
enragednuke/WoWAnalyzer
import React from 'react'; import ITEMS from 'common/ITEMS'; import Analyzer from 'Parser/Core/Analyzer'; import Combatants from 'Parser/Core/Modules/Combatants'; import ItemDamageDone from 'Main/ItemDamageDone'; import SoulHarvest from '../../Talents/SoulHarvest'; class TheMasterHarvester extends Analyzer { static dependencies = { soulHarvest: SoulHarvest, combatants: Combatants, }; on_initialized() { this.active = this.combatants.selected.hasChest(ITEMS.THE_MASTER_HARVESTER.id); } item() { const bonusDmg = this.soulHarvest.chestBonusDmg; return { item: ITEMS.THE_MASTER_HARVESTER, result: <ItemDamageDone amount={bonusDmg} />, }; } } export default TheMasterHarvester;
src/js/components/Remembers.js
amovah/DiveTodo
import React, { Component } from 'react'; import { removeRemember, editRemember, showModal, moveRemember } from '../actions'; export default class extends Component { constructor() { super(); this.editRemember = this.editRemember.bind(this); } editRemember(text, id) { this.props.dispatch(showModal({ title: 'Edit Remember', defaultValue: text, buttons: [{ title: 'Edit', onClick: (input => { this.props.dispatch(editRemember(input.value, id)); }).bind(this) }] })); } render() { const remembers = this.props.remembers.map((item, index) => { return ( <li className="item-with-icon hover-icon" key={index}> <p>{item.text}</p> <div> <span className="icon light icon-x" title="Remove" onClick={() => { this.props.dispatch(removeRemember(item.id)); }}></span> <span className="icon light icon-pencil" title="Edit" onClick={() => { this.editRemember(item.text, item.id); }}></span> <span className="icon light icon-arrow-left" title="Move to previous day" onClick={() => { this.props.dispatch(moveRemember(item.id, -1)); }}></span> <span className="icon light icon-arrow-right" title="Move to next day" onClick={() => { this.props.dispatch(moveRemember(item.id, 1)); }}></span> </div> </li> ); }); return ( <ul className="subitem"> {remembers} </ul> ); } }
client/index.js
michaelkirschbaum/ender-site
/** * Client entry point */ import React from 'react'; import { render } from 'react-dom'; import { AppContainer } from 'react-hot-loader'; import App from './App'; import { configureStore } from './store'; // Initialize store const store = configureStore(window.__INITIAL_STATE__); const mountApp = document.getElementById('root'); render( <AppContainer> <App store={store} /> </AppContainer>, mountApp ); // For hot reloading of react components if (module.hot) { module.hot.accept('./App', () => { // If you use Webpack 2 in ES modules mode, you can // use <App /> here rather than require() a <NextApp />. const NextApp = require('./App').default; // eslint-disable-line global-require render( <AppContainer> <NextApp store={store} /> </AppContainer>, mountApp ); }); }
test/index.spec.js
JLHwung/react-props-viewer
import { test } from 'tap' import React from 'react' import Enzyme, { shallow } from 'enzyme' import Adapter from 'enzyme-adapter-react-16' import JSONTree from 'react-json-tree' import PropsViewer from '../src' Enzyme.configure({ adapter: new Adapter() }) test('props-viewer should generate a component', (t) => { const Robot = PropsViewer('Robot') t.equal(typeof Robot, 'function') t.equal(Robot.length, 1) t.equal(Robot.displayName, 'Robot') t.end() }) test('shallow', (t) => { const Robot = PropsViewer('Robot') const props = { ava: 43 } const wrapper = shallow(<Robot {...props} />) t.equal(wrapper.contains(<span>Robot</span>), true) t.equal(wrapper.contains(<JSONTree data={props} />), true) t.end() }) test('props-viewer should throw when name is not a string', (t) => { t.throws(() => PropsViewer(), 'expected name to be a string') t.throws(() => PropsViewer(43), 'expected name to be a string') t.end() })
src/pages/404.js
muniz95/muniz95.github.io
import React from 'react' import { Link } from 'gatsby' import styled from 'styled-components' import SEO from '../components/Seo' import GlobalStyles from '../styles/global' const Container = styled.section` align-items: center; background-image: url('https://muniz95.com.br/assets/img/john-404.gif'); background-position: bottom left; background-repeat: no-repeat; background-size: 800px; color: #111; display: flex; font-family: -apple-system, BlinkMacSystemFont, 'San Francisco', 'Helvetica Neue', Helvetica, Ubuntu, Roboto, Noto, 'Segoe UI', Arial, sans-serif; flex-direction: column; height: 100vh; justify-content: center; padding: 0 20px; width: 100vw; @media screen and (max-width: 768px) { background-size: 280px; } ` const Title = styled.h1` background: var(--background); color: var(--texts); font-size: 120px; font-weight: bold; letter-spacing: 0.1em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); ` const Text = styled.p` background: var(--background); color: var(--texts); font-family: Courier, monospace; ` const Button = styled(Link)` background: var(--background); border: 1px solid var(--borders); border-radius: 6px; color: var(--texts); font-size: 11px; font-weight: bold; letter-spacing: 0.06em; line-height: 32px; margin-top: 1rem; padding: 0 10px; text-decoration: none; text-transform: uppercase; transition: opacity 0.5s; &:hover { opacity: 0.7; } ` const NotFoundPage = () => ( <Container> <SEO title="404: Not found" /> <GlobalStyles /> <Title>404</Title> <Text>Ué? Cadê? Parece que não tem o que você procura.</Text> <Button to="/">De volta ao blog!</Button> </Container> ) export default NotFoundPage
src/atoms/Trackable/index.js
policygenius/athenaeum
import React from 'react'; import PropTypes from 'prop-types'; import { dataAttributes } from './utils'; function wrappedChild(children, data) { const child = React.Children.only(children); if (child.type === Trackable) return child; return React.cloneElement(child, data); } function Trackable(props) { const { children, data } = props; return wrappedChild(children, dataAttributes(data)); } Trackable.propTypes = { /** * Will spread and render dataObj onto Component. */ data: PropTypes.object.isRequired, }; export default Trackable;
node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js
s941622/Angular2_angular-tour-of-heroes
import React from 'react'; import { render } from 'react-dom'; // It's important to not define HelloWorld component right in this file // because in that case it will do full page reload on change import HelloWorld from './HelloWorld.jsx'; render(<HelloWorld />, document.getElementById('react-root'));
node_modules/react-scripts/template/src/App.js
CodeShareRepeat/ReactBookStore
import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; class App extends Component { render() { return ( <div className="App"> <div className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <h2>Welcome to React</h2> </div> <p className="App-intro"> To get started, edit <code>src/App.js</code> and save to reload. </p> </div> ); } } export default App;
app/js/views/Icons/SimpleLineIcons/SimpleLineIcons.js
jagatjeevan/dakiya
import React, { Component } from 'react'; class SimpleLineIcons extends Component { render() { return ( <div className="animated fadeIn"> <div className="card card-default"> <div className="card-header"> <i className="fa fa-picture-o" /> Simple Line Icons </div> <div className="card-block"> <div className="row text-center"> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-user icons font-2xl d-block mt-4" />icon-user </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-people icons font-2xl d-block mt-4" />icon-people </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-user-female icons font-2xl d-block mt-4" />icon-user-female </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-user-follow icons font-2xl d-block mt-4" />icon-user-follow </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-user-following icons font-2xl d-block mt-4" />icon-user-following </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-user-unfollow icons font-2xl d-block mt-4" />icon-user-unfollow </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-login icons font-2xl d-block mt-4" />icon-login </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-logout icons font-2xl d-block mt-4" />icon-logout </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-emotsmile icons font-2xl d-block mt-4" />icon-emotsmile </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-phone icons font-2xl d-block mt-4" />icon-phone </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-call-end icons font-2xl d-block mt-4" />icon-call-end </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-call-in icons font-2xl d-block mt-4" />icon-call-in </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-call-out icons font-2xl d-block mt-4" />icon-call-out </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-map icons font-2xl d-block mt-4" />icon-map </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-location-pin icons font-2xl d-block mt-4" />icon-location-pin </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-direction icons font-2xl d-block mt-4" />icon-direction </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-directions icons font-2xl d-block mt-4" />icon-directions </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-compass icons font-2xl d-block mt-4" />icon-compass </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-layers icons font-2xl d-block mt-4" />icon-layers </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-menu icons font-2xl d-block mt-4" />icon-menu </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-list icons font-2xl d-block mt-4" />icon-list </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-options-vertical icons font-2xl d-block mt-4" />icon-options-vertical </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-options icons font-2xl d-block mt-4" />icon-options </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-arrow-down icons font-2xl d-block mt-4" />icon-arrow-down </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-arrow-left icons font-2xl d-block mt-4" />icon-arrow-left </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-arrow-right icons font-2xl d-block mt-4" />icon-arrow-right </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-arrow-up icons font-2xl d-block mt-4" />icon-arrow-up </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-arrow-up-circle icons font-2xl d-block mt-4" />icon-arrow-up-circle </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-arrow-left-circle icons font-2xl d-block mt-4" />icon-arrow-left-circle </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-arrow-right-circle icons font-2xl d-block mt-4" />icon-arrow-right-circle </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-arrow-down-circle icons font-2xl d-block mt-4" />icon-arrow-down-circle </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-check icons font-2xl d-block mt-4" />icon-check </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-clock icons font-2xl d-block mt-4" />icon-clock </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-plus icons font-2xl d-block mt-4" />icon-plus </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-close icons font-2xl d-block mt-4" />icon-close </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-trophy icons font-2xl d-block mt-4" />icon-trophy </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-screen-smartphone icons font-2xl d-block mt-4" />icon-screen-smartphone </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-screen-desktop icons font-2xl d-block mt-4" />icon-screen-desktop </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-plane icons font-2xl d-block mt-4" />icon-plane </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-notebook icons font-2xl d-block mt-4" />icon-notebook </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-mustache icons font-2xl d-block mt-4" />icon-mustache </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-mouse icons font-2xl d-block mt-4" />icon-mouse </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-magnet icons font-2xl d-block mt-4" />icon-magnet </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-energy icons font-2xl d-block mt-4" />icon-energy </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-disc icons font-2xl d-block mt-4" />icon-disc </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-cursor icons font-2xl d-block mt-4" />icon-cursor </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-cursor-move icons font-2xl d-block mt-4" />icon-cursor-move </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-crop icons font-2xl d-block mt-4" />icon-crop </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-chemistry icons font-2xl d-block mt-4" />icon-chemistry </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-speedometer icons font-2xl d-block mt-4" />icon-speedometer </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-shield icons font-2xl d-block mt-4" />icon-shield </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-screen-tablet icons font-2xl d-block mt-4" />icon-screen-tablet </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-magic-wand icons font-2xl d-block mt-4" />icon-magic-wand </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-hourglass icons font-2xl d-block mt-4" />icon-hourglass </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-graduation icons font-2xl d-block mt-4" />icon-graduation </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-ghost icons font-2xl d-block mt-4" />icon-ghost </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-game-controller icons font-2xl d-block mt-4" />icon-game-controller </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-fire icons font-2xl d-block mt-4" />icon-fire </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-eyeglass icons font-2xl d-block mt-4" />icon-eyeglass </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-envelope-open icons font-2xl d-block mt-4" />icon-envelope-open </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-envelope-letter icons font-2xl d-block mt-4" />icon-envelope-letter </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-bell icons font-2xl d-block mt-4" />icon-bell </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-badge icons font-2xl d-block mt-4" />icon-badge </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-anchor icons font-2xl d-block mt-4" />icon-anchor </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-wallet icons font-2xl d-block mt-4" />icon-wallet </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-vector icons font-2xl d-block mt-4" />icon-vector </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-speech icons font-2xl d-block mt-4" />icon-speech </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-puzzle icons font-2xl d-block mt-4" />icon-puzzle </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-printer icons font-2xl d-block mt-4" />icon-printer </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-present icons font-2xl d-block mt-4" />icon-present </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-playlist icons font-2xl d-block mt-4" />icon-playlist </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-pin icons font-2xl d-block mt-4" />icon-pin </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-picture icons font-2xl d-block mt-4" />icon-picture </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-handbag icons font-2xl d-block mt-4" />icon-handbag </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-globe-alt icons font-2xl d-block mt-4" />icon-globe-alt </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-globe icons font-2xl d-block mt-4" />icon-globe </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-folder-alt icons font-2xl d-block mt-4" />icon-folder-alt </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-folder icons font-2xl d-block mt-4" />icon-folder </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-film icons font-2xl d-block mt-4" />icon-film </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-feed icons font-2xl d-block mt-4" />icon-feed </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-drop icons font-2xl d-block mt-4" />icon-drop </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-drawer icons font-2xl d-block mt-4" />icon-drawer </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-docs icons font-2xl d-block mt-4" />icon-docs </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-doc icons font-2xl d-block mt-4" />icon-doc </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-diamond icons font-2xl d-block mt-4" />icon-diamond </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-cup icons font-2xl d-block mt-4" />icon-cup </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-calculator icons font-2xl d-block mt-4" />icon-calculator </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-bubbles icons font-2xl d-block mt-4" />icon-bubbles </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-briefcase icons font-2xl d-block mt-4" />icon-briefcase </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-book-open icons font-2xl d-block mt-4" />icon-book-open </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-basket-loaded icons font-2xl d-block mt-4" />icon-basket-loaded </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-basket icons font-2xl d-block mt-4" />icon-basket </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-bag icons font-2xl d-block mt-4" />icon-bag </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-action-undo icons font-2xl d-block mt-4" />icon-action-undo </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-action-redo icons font-2xl d-block mt-4" />icon-action-redo </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-wrench icons font-2xl d-block mt-4" />icon-wrench </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-umbrella icons font-2xl d-block mt-4" />icon-umbrella </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-trash icons font-2xl d-block mt-4" />icon-trash </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-tag icons font-2xl d-block mt-4" />icon-tag </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-support icons font-2xl d-block mt-4" />icon-support </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-frame icons font-2xl d-block mt-4" />icon-frame </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-size-fullscreen icons font-2xl d-block mt-4" />icon-size-fullscreen </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-size-actual icons font-2xl d-block mt-4" />icon-size-actual </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-shuffle icons font-2xl d-block mt-4" />icon-shuffle </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-share-alt icons font-2xl d-block mt-4" />icon-share-alt </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-share icons font-2xl d-block mt-4" />icon-share </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-rocket icons font-2xl d-block mt-4" />icon-rocket </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-question icons font-2xl d-block mt-4" />icon-question </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-pie-chart icons font-2xl d-block mt-4" />icon-pie-chart </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-pencil icons font-2xl d-block mt-4" />icon-pencil </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-note icons font-2xl d-block mt-4" />icon-note </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-loop icons font-2xl d-block mt-4" />icon-loop </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-home icons font-2xl d-block mt-4" />icon-home </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-grid icons font-2xl d-block mt-4" />icon-grid </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-graph icons font-2xl d-block mt-4" />icon-graph </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-microphone icons font-2xl d-block mt-4" />icon-microphone </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-music-tone-alt icons font-2xl d-block mt-4" />icon-music-tone-alt </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-music-tone icons font-2xl d-block mt-4" />icon-music-tone </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-earphones-alt icons font-2xl d-block mt-4" />icon-earphones-alt </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-earphones icons font-2xl d-block mt-4" />icon-earphones </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-equalizer icons font-2xl d-block mt-4" />icon-equalizer </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-like icons font-2xl d-block mt-4" />icon-like </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-dislike icons font-2xl d-block mt-4" />icon-dislike </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-control-start icons font-2xl d-block mt-4" />icon-control-start </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-control-rewind icons font-2xl d-block mt-4" />icon-control-rewind </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-control-play icons font-2xl d-block mt-4" />icon-control-play </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-control-pause icons font-2xl d-block mt-4" />icon-control-pause </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-control-forward icons font-2xl d-block mt-4" />icon-control-forward </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-control-end icons font-2xl d-block mt-4" />icon-control-end </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-volume-1 icons font-2xl d-block mt-4" />icon-volume-1 </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-volume-2 icons font-2xl d-block mt-4" />icon-volume-2 </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-volume-off icons font-2xl d-block mt-4" />icon-volume-off </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-calendar icons font-2xl d-block mt-4" />icon-calendar </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-bulb icons font-2xl d-block mt-4" />icon-bulb </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-chart icons font-2xl d-block mt-4" />icon-chart </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-ban icons font-2xl d-block mt-4" />icon-ban </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-bubble icons font-2xl d-block mt-4" />icon-bubble </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-camrecorder icons font-2xl d-block mt-4" />icon-camrecorder </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-camera icons font-2xl d-block mt-4" />icon-camera </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-cloud-download icons font-2xl d-block mt-4" />icon-cloud-download </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-cloud-upload icons font-2xl d-block mt-4" />icon-cloud-upload </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-envelope icons font-2xl d-block mt-4" />icon-envelope </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-eye icons font-2xl d-block mt-4" />icon-eye </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-flag icons font-2xl d-block mt-4" />icon-flag </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-heart icons font-2xl d-block mt-4" />icon-heart </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-info icons font-2xl d-block mt-4" />icon-info </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-key icons font-2xl d-block mt-4" />icon-key </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-link icons font-2xl d-block mt-4" />icon-link </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-lock icons font-2xl d-block mt-4" />icon-lock </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-lock-open icons font-2xl d-block mt-4" />icon-lock-open </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-magnifier icons font-2xl d-block mt-4" />icon-magnifier </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-magnifier-add icons font-2xl d-block mt-4" />icon-magnifier-add </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-magnifier-remove icons font-2xl d-block mt-4" />icon-magnifier-remove </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-paper-clip icons font-2xl d-block mt-4" />icon-paper-clip </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-paper-plane icons font-2xl d-block mt-4" />icon-paper-plane </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-power icons font-2xl d-block mt-4" />icon-power </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-refresh icons font-2xl d-block mt-4" />icon-refresh </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-reload icons font-2xl d-block mt-4" />icon-reload </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-settings icons font-2xl d-block mt-4" />icon-settings </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-star icons font-2xl d-block mt-4" />icon-star </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-symbol-female icons font-2xl d-block mt-4" />icon-symbol-female </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-symbol-male icons font-2xl d-block mt-4" />icon-symbol-male </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-target icons font-2xl d-block mt-4" />icon-target </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-credit-card icons font-2xl d-block mt-4" />icon-credit-card </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-paypal icons font-2xl d-block mt-4" />icon-paypal </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-tumblr icons font-2xl d-block mt-4" />icon-social-tumblr </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-twitter icons font-2xl d-block mt-4" />icon-social-twitter </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-facebook icons font-2xl d-block mt-4" />icon-social-facebook </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-instagram icons font-2xl d-block mt-4" />icon-social-instagram </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-linkedin icons font-2xl d-block mt-4" />icon-social-linkedin </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-pinterest icons font-2xl d-block mt-4" />icon-social-pinterest </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-github icons font-2xl d-block mt-4" />icon-social-github </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-gplus icons font-2xl d-block mt-4" />icon-social-gplus </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-reddit icons font-2xl d-block mt-4" />icon-social-reddit </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-skype icons font-2xl d-block mt-4" />icon-social-skype </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-dribbble icons font-2xl d-block mt-4" />icon-social-dribbble </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-behance icons font-2xl d-block mt-4" />icon-social-behance </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-foursqare icons font-2xl d-block mt-4" />icon-social-foursqare </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-soundcloud icons font-2xl d-block mt-4" />icon-social-soundcloud </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-spotify icons font-2xl d-block mt-4" />icon-social-spotify </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-stumbleupon icons font-2xl d-block mt-4" />icon-social-stumbleupon </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-youtube icons font-2xl d-block mt-4" />icon-social-youtube </div> <div className="col-6 col-sm-4 col-md-3"> <i className="icon-social-dropbox icons font-2xl d-block mt-4" />icon-social-dropbox </div> </div> </div> </div> </div> ); } } export default SimpleLineIcons;
client/reactComponents/EnemyTank.js
ourvrisrealerthanyours/tanks
import React from 'react'; import Turret from './Turret'; import TankBody from './TankBody'; import LifeBar from './LifeBar'; import { TANK_RADIUS } from '../../simulation/constants'; class EnemyTank extends React.Component { constructor(props) { super(props); this.radius = TANK_RADIUS; this.rotation = props.rotation || '0 0 0'; this.turretAngle = props.turretAngle || '0 0 0'; this.material = props.material || 'color: red;' this.characterId = props.character.characterId; } render () { // TODO: Add flash component for when shooting return ( <a-entity> <a-entity position={this.props.position} kinematic-body={`radius: ${this.radius}; height: ${this.radius}`} characterId={this.characterId} socket-controls={`characterId: ${this.characterId}; simulationAttribute: position`} death-listener={`characterId: ${this.characterId}`}> <TankBody radius={this.radius} material={this.props.material} rotation={this.rotation} socket={this.props.socket} characterId={this.characterId}/> <Turret position={`0 ${this.radius - 0.5} 0`} rotation={this.turretAngle} material={this.props.material} socket={this.props.socket} characterId={this.characterId}/> </a-entity> <LifeBar character={this.props.character} position={`0 ${this.radius + 2} 0`}/> </a-entity> ) } } module.exports = EnemyTank;
index.android.js
fakerabbit/SenalesDelFinRNA
/** * SenalesDelFin React Native App for Android * https://github.com/facebook/react-native * @flow */ 'use strict'; import React from 'react'; const ReactNative = require('react-native'); const ListViewFeed = require('./ListViewFeed'); const AboutView = require('./AboutView'); const GoldNavHeaderBackBtn = require('./GoldNavHeaderBackBtn'); const ShareButton = require('./ShareButton'); const { Component, PropTypes, } = React; const { AppRegistry, NavigationExperimental, ScrollView, StyleSheet, Text, TouchableOpacity, View, Image, WebView, Share, } = ReactNative; const { CardStack: NavigationCardStack, Header: NavigationHeader, PropTypes: NavigationPropTypes, StateUtils: NavigationStateUtils, } = NavigationExperimental; // First Step. // Define what app navigation state will look like. function createAppNavigationState(): Object { return { // Three tabs. tabs: { index: 0, routes: [ {key: 'noticias'}, {key: 'estudios'}, {key: 'lectura'}, {key: 'acerca'}, ], }, // Scenes for the `Noticias` tab. noticias: { index: 0, routes: [{key: 'Señales Del Fin'}], feedUrl: 'https://www.senalesdelfin.com/rss/', }, // Scenes for the `Estudios` tab. estudios: { index: 0, routes: [{key: 'Señales Del Fin'}], feedUrl: 'https://estudialabiblia.co/feed/', }, // Scenes for the `Lectura` tab. lectura: { index: 0, routes: [{key: 'Señales Del Fin'}], feedUrl: 'https://www.leelabiblia.co/rss/', }, // Scenes for the 'Acerca' tab. acerca: { index: 0, routes: [{key: 'Señales Del Fin'}], feedUrl: 'about', }, }; } // Next step. // Define what app navigation state shall be updated. function updateAppNavigationState( state: Object, action: Object, ): Object { let {type} = action; if (type === 'BackAction') { type = 'pop'; } switch (type) { case 'push': { // Push a route into the scenes stack. const route: Object = action.route; const {tabs} = state; const tabKey = tabs.routes[tabs.index].key; const scenes = state[tabKey]; const nextScenes = NavigationStateUtils.push(scenes, route); if (scenes !== nextScenes) { return { ...state, [tabKey]: nextScenes, }; } break; } case 'pop': { // Pops a route from the scenes stack. const {tabs} = state; const tabKey = tabs.routes[tabs.index].key; const scenes = state[tabKey]; const nextScenes = NavigationStateUtils.pop(scenes); if (scenes !== nextScenes) { return { ...state, [tabKey]: nextScenes, }; } break; } case 'selectTab': { // Switches the tab. const tabKey: string = action.tabKey; const tabs = NavigationStateUtils.jumpTo(state.tabs, tabKey); if (tabs !== state.tabs) { return { ...state, tabs, }; } } } return state; } // Next step. // Defines a helper function that creates a HOC (higher-order-component) // which provides a function `navigate` through component props. The // `navigate` function will be used to invoke navigation changes. // This serves a convenient way for a component to navigate. function createAppNavigationContainer(ComponentClass) { const key = '_yourAppNavigationContainerNavigateCall'; class Container extends Component { static contextTypes = { [key]: PropTypes.func, }; static childContextTypes = { [key]: PropTypes.func.isRequired, }; static propTypes = { navigate: PropTypes.func, }; getChildContext(): Object { return { [key]: this.context[key] || this.props.navigate, }; } render(): React.Element { const navigate = this.context[key] || this.props.navigate; return <ComponentClass {...this.props} navigate={navigate} />; } } return Container; } export default class SenalesDelFinRNA2 extends Component { static propTypes = { onExampleExit: PropTypes.func, }; // This sets up the initial navigation state. constructor(props, context) { super(props, context); // This sets up the initial navigation state. this.state = createAppNavigationState(); this._navigate = this._navigate.bind(this); } render(): React.Element { // User your own navigator (see next step). return ( <YourNavigator appNavigationState={this.state} navigate={this._navigate} /> ); } // This public method is optional. If exists, the UI explorer will call it // the "back button" is pressed. Normally this is the cases for Android only. handleBackAction(): boolean { return this._navigate({type: 'pop'}); } // This handles the navigation state changes. You're free and responsible // to define the API that changes that navigation state. In this exmaple, // we'd simply use a `updateAppNavigationState` to update the navigation // state. _navigate(action: Object): void { if (action.type === 'exit') { // Exits the example. `this.props.onExampleExit` is provided // by the UI Explorer. this.props.onExampleExit && this.props.onExampleExit(); return; } const state = updateAppNavigationState( this.state, action, ); // `updateAppNavigationState` (which uses NavigationStateUtils) gives you // back the same `state` if nothing has changed. You could use // that to avoid redundant re-rendering. if (this.state !== state) { this.setState(state); } } } // Next step. // Define your own controlled navigator. const YourNavigator = createAppNavigationContainer(class extends Component { static propTypes = { appNavigationState: PropTypes.shape({ noticias: NavigationPropTypes.navigationState.isRequired, estudios: NavigationPropTypes.navigationState.isRequired, lectura: NavigationPropTypes.navigationState.isRequired, acerca: NavigationPropTypes.navigationState.isRequired, tabs: NavigationPropTypes.navigationState.isRequired, }), navigate: PropTypes.func.isRequired, }; // This sets up the methods (e.g. Pop, Push) for navigation. constructor(props: any, context: any) { super(props, context); this._back = this._back.bind(this); this._renderHeader = this._renderHeader.bind(this); this._renderScene = this._renderScene.bind(this); } // Now use the `NavigationCardStack` to render the scenes. render(): React.Element { const {appNavigationState} = this.props; const {tabs} = appNavigationState; const tabKey = tabs.routes[tabs.index].key; const scenes = appNavigationState[tabKey]; return ( <View style={styles.navigator}> <NavigationCardStack key={'stack_' + tabKey} onNavigateBack={this._back} navigationState={scenes} renderHeader={this._renderHeader} renderScene={this._renderScene} style={styles.navigatorCardStack} /> <YourTabs navigationState={tabs} /> </View> ); } // Render the header. // The detailed spec of `sceneProps` is defined at `NavigationTypeDefinition` // as type `NavigationSceneRendererProps`. _renderHeader(sceneProps: Object): React.Element { return ( <YourHeader {...sceneProps} /> ); } // Render a scene for route. // The detailed spec of `sceneProps` is defined at `NavigationTypeDefinition` // as type `NavigationSceneRendererProps`. _renderScene(sceneProps: Object): React.Element { const {appNavigationState} = this.props; const {tabs} = appNavigationState; const tabKey = tabs.routes[tabs.index].key; const scenes = appNavigationState[tabKey]; const isAbout = scenes.feedUrl == 'about'? true : false; if (isAbout) { return ( <AboutScene {...sceneProps} /> ); } else { return ( <YourScene {...sceneProps} feedUrl={scenes.feedUrl} /> ); } } _back() { this.props.navigate({type: 'pop'}); } }); // Next step. // Define your own header. const YourHeader = createAppNavigationContainer(class extends Component { static propTypes = { ...NavigationPropTypes.SceneRendererProps, navigate: PropTypes.func.isRequired, }; constructor(props: Object, context: any) { super(props, context); this._back = this._back.bind(this); this._shareArticle = this._shareArticle.bind(this); this._renderTitleComponent = this._renderTitleComponent.bind(this); this._renderBackButtonComponent = this._renderBackButtonComponent.bind(this); this._renderRightButtonComponent = this._renderRightButtonComponent.bind(this); } render(): React.Element { return ( <NavigationHeader {...this.props} renderTitleComponent={this._renderTitleComponent} onNavigateBack={this._back} style={styles.header} renderLeftComponent={this._renderBackButtonComponent} renderRightComponent={this._renderRightButtonComponent} /> ); } _back(): void { this.props.navigate({type: 'pop'}); } _shareArticle(): void { const url = this.props.scene.route.url; if (url) { Share.share({ message: url }); } } _renderTitleComponent(props: Object): React.Element { return ( <NavigationHeader.Title textStyle={styles.headerText}> {props.scene.route.key} </NavigationHeader.Title> ); } _renderBackButtonComponent(props: Object): React.Element { if (props.scene.index === 0) { return null; } return ( <GoldNavHeaderBackBtn onPress={this._back} /> ); } _renderRightButtonComponent(props: Object): React.Element { if (props.scene.index === 0) { return null; } const url = props.scene.route.url; return( <ShareButton onPress={this._shareArticle} /> ); } }); // Next step. // Define your own scene. const YourScene = createAppNavigationContainer(class extends Component { static propTypes = { ...NavigationPropTypes.SceneRendererProps, navigate: PropTypes.func.isRequired, }; constructor(props: Object, context: any) { super(props, context); this._exit = this._exit.bind(this); this._popRoute = this._popRoute.bind(this); this._pushRoute = this._pushRoute.bind(this); this._onWebError = this._onWebError.bind(this); this.feedUrl = props.feedUrl; } render(): React.Element { const {navigationState} = this.props; const isListView = navigationState.index == 0; //console.log(navigationState); if (isListView) { return ( <ListViewFeed feedSource={this.feedUrl} pushRow={this._pushRoute} /> ); } else { const route = navigationState.routes[navigationState.index]; const url = route.url ? route.url : ''; return ( <WebView source={{uri: url}} scalesPageToFit={true} renderError={this._onWebError} /> ); } } renderIf(condition, content): void { if (condition) { return content; } else { return null; } } _pushRoute(title: string, rowUrl: string): void { // Just push a route with a new unique key. const route = {key: title, url: rowUrl}; //{key: '[' + this.props.scenes.length + ']-' + Date.now()}; this.props.navigate({type: 'push', route}); } _popRoute(): void { this.props.navigate({type: 'pop'}); } _exit(): void { this.props.navigate({type: 'exit'}); } _onWebError(): React.Element { const msg = 'Hubo un error cargando la página. Por favor verifique su conección a internet.'; return( <Text style={styles.webError}> {msg} </Text> ); } }); // Next step. // Define your own tabs. const YourTabs = createAppNavigationContainer(class extends Component { static propTypes = { navigationState: NavigationPropTypes.navigationState.isRequired, navigate: PropTypes.func.isRequired, }; constructor(props: Object, context: any) { super(props, context); } render(): React.Element { return ( <View style={styles.tabs}> {this.props.navigationState.routes.map(this._renderTab, this)} </View> ); } _renderTab(route: Object, index: number): React.Element { return ( <YourTab key={route.key} route={route} selected={this.props.navigationState.index === index} /> ); } }); // Next step. // Define your own Tab const YourTab = createAppNavigationContainer(class extends Component { static propTypes = { navigate: PropTypes.func.isRequired, route: NavigationPropTypes.navigationRoute.isRequired, selected: PropTypes.bool.isRequired, }; constructor(props: Object, context: any) { super(props, context); this._onPress = this._onPress.bind(this); } render(): React.Element { const style = [styles.tabText]; let img = ''; if (this.props.selected) { style.push(styles.tabSelected); } if (this.props.selected) { switch (this.props.route.key) { case 'noticias': img = require('./assets/images/[email protected]'); break; case 'estudios': img = require('./assets/images/[email protected]'); break; case 'lectura': img = require('./assets/images/[email protected]'); break; case 'acerca': img = require('./assets/images/[email protected]'); break; default: img = require('./assets/images/[email protected]'); } } else { switch (this.props.route.key) { case 'noticias': img = require('./assets/images/[email protected]'); break; case 'estudios': img = require('./assets/images/[email protected]'); break; case 'lectura': img = require('./assets/images/[email protected]'); break; case 'acerca': img = require('./assets/images/[email protected]'); break; default: img = require('./assets/images/[email protected]'); } } return ( <TouchableOpacity style={styles.tab} onPress={this._onPress}> <Image source={img} style={styles.tabImage} /> <Text style={style}> {this.props.route.key} </Text> </TouchableOpacity> ); } _onPress() { this.props.navigate({type: 'selectTab', tabKey: this.props.route.key}); } }); // // About View Scene // const AboutScene = createAppNavigationContainer(class extends Component { static propTypes = { ...NavigationPropTypes.SceneRendererProps, navigate: PropTypes.func.isRequired, }; constructor(props: Object, context: any) { super(props, context); this._exit = this._exit.bind(this); this._popRoute = this._popRoute.bind(this); this._pushRoute = this._pushRoute.bind(this); } render(): React.Element { return ( <AboutView/> ); } renderIf(condition, content): void { if (condition) { return content; } else { return null; } } _pushRoute(title: string, rowUrl: string): void { // Just push a route with a new unique key. const route = {key: title, url: rowUrl}; //{key: '[' + this.props.scenes.length + ']-' + Date.now()}; this.props.navigate({type: 'push', route}); } _popRoute(): void { this.props.navigate({type: 'pop'}); } _exit(): void { this.props.navigate({type: 'exit'}); } }); const styles = StyleSheet.create({ navigator: { flex: 1, }, navigatorCardStack: { flex: 20, }, tabs: { flex: 2, flexDirection: 'row', }, tab: { alignItems: 'center', backgroundColor: '#333333', flex: 1, justifyContent: 'center', flexDirection: 'column', }, tabText: { flex: 1, color: '#929292', fontWeight: '500', }, tabSelected: { color: '#f0bf09', }, tabImage: { height: 20, width: 20, marginTop: 8 }, header: { backgroundColor: '#333333', }, headerText: { color: '#f0bf09', fontSize: 20, height: 30, }, webError: { flex: 1, padding: 10, fontSize: 20, } }); AppRegistry.registerComponent('SenalesDelFinRNA2', () => SenalesDelFinRNA2);
src/components/Search/Search.js
TalentedEurope/te-app
import React from 'react'; import { TabNavigator } from 'react-navigation'; import Icon from 'react-native-vector-icons/FontAwesome'; import Main from './Main/Main'; import SearchStudents from './Students/Students'; import SearchCompanies from './Companies/Companies'; import SearchInstitutions from './Institutions/Institutions'; import COMMON_STYLES from '../../styles/common'; import I18n from '../../i18n/i18n'; const TabBarIcon = props => <Icon name={props.name} size={18} color={COMMON_STYLES.DARK_BLUE} />; export default TabNavigator( { Main: { screen: Main, navigationOptions: () => ({ title: I18n.t('global.home'), tabBarIcon: <TabBarIcon name="home" />, }), }, SearchStudents: { screen: SearchStudents, navigationOptions: () => ({ title: I18n.t('global.student_plural'), tabBarIcon: <TabBarIcon name="user" />, }), }, SearchCompanies: { screen: SearchCompanies, navigationOptions: () => ({ title: I18n.t('global.company_plural'), tabBarIcon: <TabBarIcon name="building" />, }), }, SearchInstitutions: { screen: SearchInstitutions, navigationOptions: () => ({ title: I18n.t('global.institution').split('|')[1], tabBarIcon: <TabBarIcon name="university" />, }), }, }, { tabBarOptions: { activeTintColor: COMMON_STYLES.DARK_BLUE, inactiveTintColor: COMMON_STYLES.DARK_BLUE, activeBackgroundColor: COMMON_STYLES.YELLOW, inactiveBackgroundColor: COMMON_STYLES.LIGHT_GRAY, showIcon: true, showLabel: false, pressColor: COMMON_STYLES.YELLOW, style: { backgroundColor: COMMON_STYLES.LIGHT_GRAY, elevation: 0, }, indicatorStyle: { backgroundColor: COMMON_STYLES.BLUE, }, }, }, );
quick-bench/src/App.js
FredTingaud/quick-bench-front-end
import React, { Component } from 'react'; import { Dropdown } from 'react-bootstrap'; import QuickBenchmark from './QuickBenchmark.js'; import Header from 'components/Header.js'; import 'components/resources/css/Shared.css'; import { BrowserRouter, Route, Redirect } from 'react-router-dom'; import AboutDialog from './dialogs/AboutDialog.js'; import BenchmarkDialog from './dialogs/BenchmarkDialog.js'; import { ReactComponent as Logo } from 'components/resources/ico/qb.svg'; import QuickFetch from './QuickFetch.js'; import DefaultSettings from 'components/DefaultSettings.js'; import ContainersDialog from 'components/dialogs/ContainersDialog.js'; class App extends Component { constructor(props) { super(props); this.state = { location: null, prevlocation: null, showAbout: false, showBenchmark: false, maxCodeSize: 20000, timeout: 60, downloadContainers: false, containers: DefaultSettings.allCompilers }; } componentDidUpdate() { if (this.state.location !== this.state.prevlocation) { this.setState({ prevlocation: this.state.location }); } } componentDidMount() { QuickFetch.fetchEnv(env => { if (!env) return; this.setState({ timeout: env.timeout, maxCodeSize: env.maxCodeSize, containers: env.containers, downloadContainers: env.containerDl }); }); } redirect() { if (this.state.location !== this.state.prevlocation && this.state.location) { return ( <Redirect push to={'/q/' + this.state.location} /> ); } return null; } openAbout() { this.setState({ showAbout: true }); } closeAbout() { this.setState({ showAbout: false }); } openBenchmark() { this.setState({ showBenchmark: true }); } closeBenchmark() { this.setState({ showBenchmark: false }); } openContainers() { this.setState({ showContainers: true }); } closeContainers() { this.setState({ showContainers: false }); } pullContainer() { this.openContainers(); } Home = ({ match }) => <QuickBenchmark id={match.params ? match.params.id : null} maxCodeSize={this.state.maxCodeSize} timeout={this.state.timeout} containers={this.state.containers} pullContainer={this.state.downloadContainers ? (() => this.pullContainer()) : null} onLocationChange={(l) => this.setState({ location: l })} />; renderEntries() { return <><Dropdown.Item onClick={() => this.openAbout()}>About Quick Bench</Dropdown.Item> <Dropdown.Item onClick={() => this.openBenchmark()}>How to write my benchmarks</Dropdown.Item> </>; } render() { return ( <BrowserRouter history={this.state.location}> <div className="one-page"> <div className="fixed-content" ref={div => { this.header = div; }}> <Header brand={<><Logo className="line-img me-2" style={{ fill: "#FFFFFF" }} title="logo" /> Quick C++ Benchmark</>} entries={() => this.renderEntries()} motd={{ url: "https://github.com/FredTingaud/bench-runner", text: "Run Quick Bench locally" }} /> </div > <Route exact path={["/", "/q/:id"]} component={this.Home} /> {this.redirect()} </div> <AboutDialog show={this.state.showAbout} onHide={() => this.closeAbout()} /> <BenchmarkDialog show={this.state.showBenchmark} onHide={() => this.closeBenchmark()} /> <ContainersDialog show={this.state.showContainers} onHide={() => this.closeContainers()} containers={this.state.containers} containersChanged={c => this.setState({ containers: c })} /> </BrowserRouter> ); } } export default App;
docs/app/Examples/elements/Icon/IconSet/IconExampleMedia.js
ben174/Semantic-UI-React
import React from 'react' import { Grid, Icon } from 'semantic-ui-react' const IconExampleMedia = () => ( <Grid columns='5' doubling> <Grid.Column> <Icon name='area chart' /> <p>area chart</p> </Grid.Column> <Grid.Column> <Icon name='bar chart' /> <p>bar chart</p> </Grid.Column> <Grid.Column> <Icon name='camera retro' /> <p>camera retro</p> </Grid.Column> <Grid.Column> <Icon name='film' /> <p>film</p> </Grid.Column> <Grid.Column> <Icon name='line chart' /> <p>line chart</p> </Grid.Column> <Grid.Column> <Icon name='newspaper' /> <p>newspaper</p> </Grid.Column> <Grid.Column> <Icon name='photo' /> <p>photo</p> </Grid.Column> <Grid.Column> <Icon name='pie chart' /> <p>pie chart</p> </Grid.Column> <Grid.Column> <Icon name='sound' /> <p>sound</p> </Grid.Column> </Grid> ) export default IconExampleMedia
admin/templates/src/components/layout/footer.js
TangMonk/tuols
import React from 'react' import styles from './main.less' import { config } from '../../utils' const Footer = () => <div className={styles.footer}> {config.footerText} </div> export default Footer
es6/Breadcrumb/BreadcrumbItem.js
yurizhang/ishow
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } import React from 'react'; import PropTypes from 'prop-types'; import { default as Component } from '../Common/plugs/index.js'; //提供style, classname方法 var BreadcrumbItem = function (_Component) { _inherits(BreadcrumbItem, _Component); function BreadcrumbItem() { _classCallCheck(this, BreadcrumbItem); return _possibleConstructorReturn(this, (BreadcrumbItem.__proto__ || Object.getPrototypeOf(BreadcrumbItem)).apply(this, arguments)); } _createClass(BreadcrumbItem, [{ key: 'render', value: function render() { return React.createElement( 'span', { style: this.style(), className: this.className('ishow-breadcrumb__item') }, React.createElement( 'span', { className: 'ishow-breadcrumb__item__inner', ref: 'link' }, this.props.children ), React.createElement( 'span', { className: 'ishow-breadcrumb__separator' }, this.context.separator ) ); } }]); return BreadcrumbItem; }(Component); export default BreadcrumbItem; BreadcrumbItem.contextTypes = { separator: PropTypes.string };
docs/src/NavMain.js
gearz-lab/react-ui
import React from 'react'; import Router, { Link } from 'react-router'; import Navbar from 'react-bootstrap/lib/Navbar'; import Nav from 'react-bootstrap/lib/Nav'; const NAV_LINKS = { 'getting-started': { link: 'getting-started', title: 'Getting started' }, 'components': { link: 'components', title: 'Components' } }; const NavMain = React.createClass({ propTypes: { activePage: React.PropTypes.string }, render() { let brand = <Link to='home' className="navbar-brand">React-UI</Link>; let links = Object.keys(NAV_LINKS).map(this.renderNavItem).concat([ <li key='github-link'> <a href='https://github.com/gearz-lab/react-ui' target='_blank'>GitHub</a> </li> ]); return ( <Navbar componentClass='header' brand={brand} staticTop className="bs-docs-nav" role="banner" toggleNavKey={0}> <Nav className="bs-navbar-collapse" role="navigation" eventKey={0} id="top"> {links} </Nav> </Navbar> ); }, renderNavItem(linkName) { let link = NAV_LINKS[linkName]; return ( <li className={this.props.activePage === linkName ? 'active' : null} key={linkName}> <Link to={link.link}>{link.title}</Link> </li> ); } }); export default NavMain;
src/containers/Charts/echarts/dynamicChartComponent.js
EncontrAR/backoffice
import React, { Component } from 'react'; import { connect } from 'react-redux'; import ReactEcharts from 'echarts-for-react'; import { updateOption } from '../../../redux/dynamicEchart/reducer'; class DynamicChartComponent extends Component { constructor(props) { super(props); this.fetchNewDate = this.fetchNewDate.bind(this); this.count = 0; } fetchNewDate() { this.props.updateOption(); } componentDidMount() { if (this.timeTicket) { clearInterval(this.timeTicket); } this.timeTicket = setInterval(this.fetchNewDate, 2500); } componentWillUnmount() { if (this.timeTicket) { clearInterval(this.timeTicket); } } render() { const option = this.props.option; return ( <div className="examples"> <ReactEcharts ref="echarts_react" option={option} style={{ height: 300 }} /> </div> ); } } export default connect( state => ({ ...state.DynamicChartComponent.toJS(), }), { updateOption }, )(DynamicChartComponent);
Examples/WithGroups/index.js
bapmrl/bapmrl-react-multiselect
import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import Multiselect from 'bapmrl-react-multiselect'; class WithGroups extends Component { constructor(props) { super(props); this.state = { items: { '0': { key: '0', label: 'Group 0', options: [ { key: '0', label: 'Option 0-0', selected: true }, { key: '1', label: 'Option 0-1', selected: false } ] }, '1': { key: '1', label: 'Group 1', options: [ { key: '0', label: 'Option 1-0', selected: true }, { key: '1', label: 'Option 1-1', selected: false } ] } } }; this.handleItemSelected = this.handleItemSelected.bind(this); } render() { return ( <Multiselect items={this.state.items} onItemSelected={this.handleItemSelected} /> ); } handleItemSelected(e) { const options = e.items[e.key].options.map((option, index) => { let selected; if (e.index === undefined) { selected = e.selected; } else { selected = e.index === index ? e.selected : option.selected; } return Object.assign({}, option, { selected }); }); const group = Object.assign({}, e.items[e.key], { options }); const items = Object.assign({}, e.items, { [e.key]: group }); this.setState({ items }); } } ReactDOM.render(<WithGroups />, document.getElementById('example-container'));
src/lib/Page.js
reapp/reapp-kit
import React from 'react'; import ContextTypes from './ContextTypes'; import ShouldUpdate from './ShouldUpdate'; import RoutedViewListMixin from 'reapp-routes/react-router/RoutedViewListMixin'; import AutoBind from './AutoBind'; import setupGetters from './setupGetters'; const Base = React.createClass(Object.assign( {}, AutoBind, ShouldUpdate, { contextTypes: ContextTypes, mixins: [RoutedViewListMixin], render: function() {} } )); class Page extends Base { constructor(props, shouldAutoBind = true) { super(props); setupGetters.call(this); if (shouldAutoBind) this.autoBind(); } } export default Page;
20161208/RN-router/index.ios.js
fengnovo/react-native
import React, { Component } from 'react'; import { AppRegistry } from 'react-native'; import App from './rn/app.js'; class RNRouter extends Component { render() { return <App /> } } AppRegistry.registerComponent('RNRouter', () => RNRouter);
src/svg-icons/image/looks-two.js
jacklam718/react-svg-iconx
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageLooksTwo = (props) => ( <SvgIcon {...props}> <path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 8c0 1.11-.9 2-2 2h-2v2h4v2H9v-4c0-1.11.9-2 2-2h2V9H9V7h4c1.1 0 2 .89 2 2v2z"/> </SvgIcon> ); ImageLooksTwo = pure(ImageLooksTwo); ImageLooksTwo.displayName = 'ImageLooksTwo'; ImageLooksTwo.muiName = 'SvgIcon'; export default ImageLooksTwo;
examples/webpack-example/src/app/app.js
tan-jerene/material-ui
import React from 'react'; import ReactDOM from 'react-dom'; import injectTapEventPlugin from 'react-tap-event-plugin'; import Main from './Main'; // Our custom react component //Needed for onTouchTap //Can go away when react 1.0 release //Check this repo: //https://github.com/zilverline/react-tap-event-plugin injectTapEventPlugin(); // Render the main app react component into the app div. // For more details see: https://facebook.github.io/react/docs/top-level-api.html#react.render ReactDOM.render(<Main />, document.getElementById('app'));
node_modules/styled-components/src/models/StyleTags.js
esteladiaz/esteladiaz.github.io
// @flow /* eslint-disable flowtype/object-type-delimiter */ /* eslint-disable react/prop-types */ import React from 'react' import { IS_BROWSER, DISABLE_SPEEDY, SC_ATTR } from '../constants' import { type ExtractedComp } from '../utils/extractCompsFromCSS' import { splitByRules } from '../utils/stringifyRules' import getNonce from '../utils/nonce' import once from '../utils/once' import { type Names, addNameForId, resetIdNames, hasNameForId, stringifyNames, cloneNames, } from '../utils/styleNames' import { sheetForTag, safeInsertRule, deleteRules, } from '../utils/insertRuleHelpers' export interface Tag<T> { // $FlowFixMe: Doesn't seem to accept any combination w/ HTMLStyleElement for some reason styleTag: HTMLStyleElement | null; /* lists all ids of the tag */ getIds(): string[]; /* checks whether `name` is already injected for `id` */ hasNameForId(id: string, name: string): boolean; /* inserts a marker to ensure the id's correct position in the sheet */ insertMarker(id: string): T; /* inserts rules according to the ids markers */ insertRules(id: string, cssRules: string[], name: ?string): void; /* removes all rules belonging to the id, keeping the marker around */ removeRules(id: string): void; css(): string; toHTML(additionalAttrs: ?string): string; toElement(): React.Element<*>; clone(): Tag<T>; } /* this error is used for makeStyleTag */ const parentNodeUnmountedErr = process.env.NODE_ENV !== 'production' ? ` Trying to insert a new style tag, but the given Node is unmounted! - Are you using a custom target that isn't mounted? - Does your document not have a valid head element? - Have you accidentally removed a style tag manually? `.trim() : '' /* this error is used for tags */ const throwCloneTagErr = () => { throw new Error( process.env.NODE_ENV !== 'production' ? ` The clone method cannot be used on the client! - Are you running in a client-like environment on the server? - Are you trying to run SSR on the client? `.trim() : '' ) } /* this marker separates component styles and is important for rehydration */ const makeTextMarker = id => `\n/* sc-component-id: ${id} */\n` /* add up all numbers in array up until and including the index */ const addUpUntilIndex = (sizes: number[], index: number): number => { let totalUpToIndex = 0 for (let i = 0; i <= index; i += 1) { totalUpToIndex += sizes[i] } return totalUpToIndex } /* create a new style tag after lastEl */ const makeStyleTag = ( target: ?HTMLElement, tagEl: ?Node, insertBefore: ?boolean ) => { const el = document.createElement('style') el.setAttribute(SC_ATTR, '') const nonce = getNonce() if (nonce) { el.setAttribute('nonce', nonce) } /* Work around insertRule quirk in EdgeHTML */ el.appendChild(document.createTextNode('')) if (target && !tagEl) { /* Append to target when no previous element was passed */ target.appendChild(el) } else { if (!tagEl || !target || !tagEl.parentNode) { throw new Error(parentNodeUnmountedErr) } /* Insert new style tag after the previous one */ tagEl.parentNode.insertBefore(el, insertBefore ? tagEl : tagEl.nextSibling) } return el } /* takes a css factory function and outputs an html styled tag factory */ const wrapAsHtmlTag = (css: () => string, names: Names) => ( additionalAttrs: ?string ): string => { const nonce = getNonce() const attrs = [ nonce && `nonce="${nonce}"`, `${SC_ATTR}="${stringifyNames(names)}"`, additionalAttrs, ] const htmlAttr = attrs.filter(Boolean).join(' ') return `<style ${htmlAttr}>${css()}</style>` } /* takes a css factory function and outputs an element factory */ const wrapAsElement = (css: () => string, names: Names) => () => { const props = { [SC_ATTR]: stringifyNames(names), } const nonce = getNonce() if (nonce) { // $FlowFixMe props.nonce = nonce } // eslint-disable-next-line react/no-danger return <style {...props} dangerouslySetInnerHTML={{ __html: css() }} /> } const getIdsFromMarkersFactory = (markers: Object) => (): string[] => Object.keys(markers) /* speedy tags utilise insertRule */ const makeSpeedyTag = ( el: HTMLStyleElement, getImportRuleTag: ?() => Tag<any> ): Tag<number> => { const names: Names = Object.create(null) const markers = Object.create(null) const sizes: number[] = [] const extractImport = getImportRuleTag !== undefined /* indicates whther getImportRuleTag was called */ let usedImportRuleTag = false const insertMarker = id => { const prev = markers[id] if (prev !== undefined) { return prev } const marker = (markers[id] = sizes.length) sizes.push(0) resetIdNames(names, id) return marker } const insertRules = (id, cssRules, name) => { const marker = insertMarker(id) const sheet = sheetForTag(el) const insertIndex = addUpUntilIndex(sizes, marker) let injectedRules = 0 const importRules = [] const cssRulesSize = cssRules.length for (let i = 0; i < cssRulesSize; i += 1) { const cssRule = cssRules[i] let mayHaveImport = extractImport /* @import rules are reordered to appear first */ if (mayHaveImport && cssRule.indexOf('@import') !== -1) { importRules.push(cssRule) } else if (safeInsertRule(sheet, cssRule, insertIndex + injectedRules)) { mayHaveImport = false injectedRules += 1 } } if (extractImport && importRules.length > 0) { usedImportRuleTag = true // $FlowFixMe getImportRuleTag().insertRules(`${id}-import`, importRules) } sizes[marker] += injectedRules /* add up no of injected rules */ addNameForId(names, id, name) } const removeRules = id => { const marker = markers[id] if (marker === undefined) return const size = sizes[marker] const sheet = sheetForTag(el) const removalIndex = addUpUntilIndex(sizes, marker) deleteRules(sheet, removalIndex, size) sizes[marker] = 0 resetIdNames(names, id) if (extractImport && usedImportRuleTag) { // $FlowFixMe getImportRuleTag().removeRules(`${id}-import`) } } const css = () => { const { cssRules } = sheetForTag(el) let str = '' let i = 0 // eslint-disable-next-line guard-for-in for (const id in markers) { str += makeTextMarker(id) const end = markers[id] + i for (; i < end; i += 1) { str += cssRules[i].cssText } } return str } return { styleTag: el, getIds: getIdsFromMarkersFactory(markers), hasNameForId: hasNameForId(names), insertMarker, insertRules, removeRules, css, toHTML: wrapAsHtmlTag(css, names), toElement: wrapAsElement(css, names), clone: throwCloneTagErr, } } const makeBrowserTag = ( el: HTMLStyleElement, getImportRuleTag: ?() => Tag<any> ): Tag<Text> => { const names = Object.create(null) const markers = Object.create(null) const extractImport = getImportRuleTag !== undefined const makeTextNode = id => document.createTextNode(makeTextMarker(id)) /* indicates whther getImportRuleTag was called */ let usedImportRuleTag = false const insertMarker = id => { const prev = markers[id] if (prev !== undefined) { return prev } const marker = (markers[id] = makeTextNode(id)) el.appendChild(marker) names[id] = Object.create(null) return marker } const insertRules = (id, cssRules, name) => { const marker = insertMarker(id) const importRules = [] const cssRulesSize = cssRules.length for (let i = 0; i < cssRulesSize; i += 1) { const rule = cssRules[i] let mayHaveImport = extractImport if (mayHaveImport && rule.indexOf('@import') !== -1) { importRules.push(rule) } else { mayHaveImport = false const separator = i === cssRulesSize - 1 ? '' : ' ' marker.appendData(`${rule}${separator}`) } } addNameForId(names, id, name) if (extractImport && importRules.length > 0) { usedImportRuleTag = true // $FlowFixMe getImportRuleTag().insertRules(`${id}-import`, importRules) } } const removeRules = id => { const marker = markers[id] if (marker === undefined) return /* create new empty text node and replace the current one */ const newMarker = makeTextNode(id) el.replaceChild(newMarker, marker) markers[id] = newMarker resetIdNames(names, id) if (extractImport && usedImportRuleTag) { // $FlowFixMe getImportRuleTag().removeRules(`${id}-import`) } } const css = () => { let str = '' // eslint-disable-next-line guard-for-in for (const id in markers) { str += markers[id].data } return str } return { styleTag: el, getIds: getIdsFromMarkersFactory(markers), hasNameForId: hasNameForId(names), insertMarker, insertRules, removeRules, css, toHTML: wrapAsHtmlTag(css, names), toElement: wrapAsElement(css, names), clone: throwCloneTagErr, } } const makeServerTag = (): Tag<[string]> => { const names = Object.create(null) const markers = Object.create(null) const insertMarker = id => { const prev = markers[id] if (prev !== undefined) { return prev } return (markers[id] = ['']) } const insertRules = (id, cssRules, name) => { const marker = insertMarker(id) marker[0] += cssRules.join(' ') addNameForId(names, id, name) } const removeRules = id => { const marker = markers[id] if (marker === undefined) return marker[0] = '' resetIdNames(names, id) } const css = () => { let str = '' // eslint-disable-next-line guard-for-in for (const id in markers) { const cssForId = markers[id][0] if (cssForId) { str += makeTextMarker(id) + cssForId } } return str } const tag = { styleTag: null, getIds: getIdsFromMarkersFactory(markers), hasNameForId: hasNameForId(names), insertMarker, insertRules, removeRules, css, toHTML: wrapAsHtmlTag(css, names), toElement: wrapAsElement(css, names), clone() { return { ...tag, names: cloneNames(names), markers: { ...markers }, } }, } return tag } export const makeTag = ( target: ?HTMLElement, tagEl: ?HTMLStyleElement, forceServer?: boolean, insertBefore?: boolean, getImportRuleTag?: () => Tag<any> ): Tag<any> => { if (IS_BROWSER && !forceServer) { const el = makeStyleTag(target, tagEl, insertBefore) if (DISABLE_SPEEDY) { return makeBrowserTag(el, getImportRuleTag) } else { return makeSpeedyTag(el, getImportRuleTag) } } return makeServerTag() } /* wraps a given tag so that rehydration is performed once when necessary */ export const makeRehydrationTag = ( tag: Tag<any>, els: HTMLStyleElement[], extracted: ExtractedComp[], names: string[], immediateRehydration: boolean ): Tag<any> => { /* rehydration function that adds all rules to the new tag */ const rehydrate = once(() => { /* add all extracted components to the new tag */ for (let i = 0; i < extracted.length; i += 1) { const { componentId, cssFromDOM } = extracted[i] const cssRules = splitByRules(cssFromDOM) tag.insertRules(componentId, cssRules) } /* remove old HTMLStyleElements, since they have been rehydrated */ for (let i = 0; i < els.length; i += 1) { const el = els[i] if (el.parentNode) { el.parentNode.removeChild(el) } } }) if (immediateRehydration) rehydrate() return { ...tag, /* add rehydration hook to insertion methods */ insertMarker: id => { rehydrate() return tag.insertMarker(id) }, insertRules: (id, cssRules, name) => { rehydrate() return tag.insertRules(id, cssRules, name) }, } }
src/components/Admin/AdminStudents/Student.js
unihackhq/skilled-acolyte-frontend
import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import { Button } from 'bloomer'; // TODO: make student specific UI const Student = ({ student: s }) => ( <React.Fragment> <pre>{JSON.stringify(s, null, 4)}</pre> <Button render={props => <Link to={`/admin/students/${s.id}`} {...props}>Details</Link>} /> </React.Fragment> ); Student.propTypes = { student: PropTypes.object.isRequired, }; export default Student;
src/components/Header.js
burakcan/framer-modules
import React, { Component } from 'react'; class Header extends Component { render() { return ( <header className="header"> <div className="container"> <h1 className="header_title">Framer modules</h1> <a className="add-plugin" href="https://github.com/interacthings/framer-modules-list" target="_blank">Add a module</a> </div> </header> ) } } export default Header;
imports/ui/components/FeedBacks/SurveyFeedBack/SurveyQuestion.js
haraneesh/mydev
/* eslint-disable max-len, no-return-assign */ import React from 'react'; import PropTypes from 'prop-types'; const SurveyQuestion = ({questionIndexNumber, questionText, ratingsObjectArray, selectedRatingValue, selectedRatingClass, onChange}) => { let ratingRows = []; const groupName = `groupName${questionIndexNumber}`; ratingsObjectArray.forEach(function(element) { const rowId=`${questionIndexNumber}${element.ratingValue}` ratingRows.push ( <div> <input type="radio" id={rowId} value={element.ratingValue} name={groupName} onClick={onChange.bind(null, { questionIndexNumber: questionIndexNumber, questionText: questionText, ratingValue: element.ratingValue, ratingText: element.ratingText })} /> <label for={rowId}>{element.ratingText}</label> </div> ); }); return ( <div className="form-group"> <div className="question">{`${questionIndexNumber}. ${questionText}`}</div> <fieldset id={groupName}> { ratingRows } </fieldset> </div> ); } SurveyQuestion.defaultProps = { questionText: '', ratingsObjectArray: [], selectedRatingClass : '', } SurveyQuestion.propTypes = { questionIndexNumber: PropTypes.number.isRequired, questionText: PropTypes.string.isRequired, ratingsObjectArray: PropTypes.array.isRequired, selectedRatingValue: PropTypes.number, onChange: PropTypes.func.isRequired }; export default SurveyQuestion;
frontend/src/components/poll/voting/select.js
1905410/Misago
// jshint ignore:start import React from 'react'; export default function(props) { return ( <ul className="list-unstyled poll-select-choices"> {props.choices.map((choice) => { return ( <ChoiceSelect choice={choice} key={choice.hash} toggleChoice={props.toggleChoice} /> ); })} </ul> ); } export class ChoiceSelect extends React.Component { onClick = () => { this.props.toggleChoice(this.props.choice.hash); }; render() { return ( <li className="poll-select-choice"> <button className={this.props.choice.selected ? 'btn btn-selected' : 'btn'} onClick={this.onClick} type="button" > <span className="material-icon"> {this.props.choice.selected ? 'check_circle' : 'check'} </span> <strong> {this.props.choice.label} </strong> </button> </li> ); } }
geonode/monitoring/frontend/monitoring/src/components/organisms/alert-setting/index.js
tomkralidis/geonode
/* ######################################################################### # # Copyright (C) 2019 OSGeo # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### */ import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import HR from '../../atoms/hr'; class AlertsSetting extends React.Component { static propTypes = { alert: PropTypes.object.isRequired, autoFocus: PropTypes.bool, } static defaultProps = { autoFocus: false, } render() { return ( <div> <HR /> <Link to={`/alerts/${this.props.alert.id}`}> <h4>{this.props.alert.name}</h4> </Link> {this.props.alert.description} </div> ); } } export default AlertsSetting;
docs/src/components/App.js
tannerlinsley/react-move
// @flow import React from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import MuiThemeProvider from '@material-ui/core/styles/MuiThemeProvider' import { createMuiTheme } from '@material-ui/core/styles' import grey from '@material-ui/core/colors/grey' import deepOrange from '@material-ui/core/colors/deepOrange' import { lightTheme, darkTheme, setPrismTheme } from '../utils/prism' import AppRouter from './AppRouter' function AppContainer(props) { const { dark } = props const theme = createMuiTheme({ typography: { suppressWarning: true, }, palette: { primary: grey, secondary: grey, accent: deepOrange, type: dark ? 'dark' : 'light', }, }) /* eslint-disable-next-line */ console.log('theme: ', theme) if (dark) { setPrismTheme(darkTheme) } else { setPrismTheme(lightTheme) } return ( <MuiThemeProvider theme={theme}> <AppRouter /> </MuiThemeProvider> ) } AppContainer.propTypes = { dark: PropTypes.bool.isRequired, } const ConnectedApp = connect(state => ({ dark: state.dark }))(AppContainer) function App() { return <ConnectedApp /> } export default App
src/components/display.js
ShaneFairweather/React-iTunes
import React, { Component } from 'react'; import Result from './result'; const Display = (props) => { var shortList = props.results; var newArray = shortList.slice(0, 25); const resultsList = newArray.map((item) => { return ( <Result artistName={item.artistName} trackName={item.trackName} imageUrl={item.artworkUrl100.replace('100x100', '1200x1200')} trackUrl={item.trackViewUrl} trackPrice={item.trackPrice} releaseDate={item.releaseDate} trackTime={item.trackTimeMillis} onItemSelect={props.getSelected} albumName={item.collectionName} /> ) }) if (shortList.length == 0) { return <div className="lead">Type in the search bar to find a song</div> } else { return ( <div className="display"> {resultsList} </div> ) } } export default Display;
src/containers/posts_index.js
JonnyPickard/blog-app-react
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import PropTypes from 'prop-types'; import _ from 'lodash'; import { fetchPosts, deletePost } from '../actions'; class PostsIndex extends Component { componentDidMount() { this.props.fetchPosts(); this.onDeleteClick = this.onDeleteClick.bind(this); } onDeleteClick(_id) { const { props } = this; props.deletePost(_id, () => { props.history.push('/'); }); } renderPosts() { return ( _.map(this.props.posts, post => ( <li className="posts-list-item list-group-item" key={post._id}> <Link to={`/posts/${post._id}`}> {post.title} </Link> <button className="btn btn-danger pull-xs-right" onClick={() => this.onDeleteClick(post._id)} > Delete Post </button> </li> )) ); } render() { return ( <div className="posts-index"> <div className="subtitle-block"> {/* SubtitlePostList:Left */} <div> <h3 className="subtitle">Posts</h3> </div> {/* ButtonNewPost:Right */} <div> <Link id="add-post-button" className="btn btn-primary" to="/posts/new"> Add a Post </Link> </div> </div> {/* PostList */} <ul className="posts-list list-group"> {this.renderPosts()} </ul> </div> ); } } PostsIndex.propTypes = { fetchPosts: PropTypes.func.isRequired, posts: PropTypes.object.isRequired, }; function mapStateToProps(state) { return { posts: state.posts }; } export default connect(mapStateToProps, { fetchPosts, deletePost })(PostsIndex);
src/Parser/SubtletyRogue/TALENT_DESCRIPTIONS.js
Yuyz0112/WoWAnalyzer
import React from 'react'; import ITEMS from 'common/ITEMS'; import ItemLink from 'common/ItemLink'; import SPELLS from 'common/SPELLS'; import SpellLink from 'common/SpellLink'; export default { descriptions: { // lv15 [SPELLS.MASTER_OF_SUBTLETY_TALENT.id]: <span>Default talent for burst-damage build. Increasing burst damage after leaving stealth or using vanish for raids and questing/soloing. Works perfectly with <ItemLink id={ITEMS.MANTLE_OF_THE_MASTER_ASSASSIN.id} />. </span>, [SPELLS.WEAPONMASTER_TALENT.id]: <span>Default talent for smooth-damage build. Good unless you have chosen <SpellLink id={SPELLS.DEATH_FROM_ABOVE_TALENT.id} />. A bug will cause <SpellLink id={SPELLS.WEAPONMASTER_TALENT.id} /> invalidating the damage of enhanced <SpellLink id={SPELLS.EVISCERATE.id} /> from <SpellLink id={SPELLS.DEATH_FROM_ABOVE_TALENT.id} />. </span>, [SPELLS.GLOOMBLADE_TALENT.id]: <span>Should only be chosen if you need to fight in front of your enemy for a long time, e.g. in Subtlety Rogue Artifact Challenge. </span>, // lv30 [SPELLS.NIGHTSTALKER_TALENT.id]: <span>Default talent for burst-damage build. Increasing burst damage in stealth or <SpellLink id={SPELLS.SHADOW_DANCE.id} />. </span>, [SPELLS.SUBTERFUGE_TALENT.id]: <span>Should not be chosen in most scenarios. </span>, [SPELLS.SHADOW_FOCUS_TALENT.id]: <span>Only choose this talent for smooth-damage build. </span>, // lv45 [SPELLS.DEEPER_STRATAGEM_TALENT.id]: <span>Default talent. Increasing damage of <SpellLink id={SPELLS.EVISCERATE.id} /> and <SpellLink id={SPELLS.NIGHTBLADE.id} />. Damage from finishing moves would be a large portion in a subtlety rogue's total damage. </span>, [SPELLS.ANTICIPATION_TALENT.id]: <span>Less powerful than <SpellLink id={SPELLS.DEEPER_STRATAGEM_TALENT.id} />. </span>, [SPELLS.VIGOR_TALENT.id]: <span>Less powerful than <SpellLink id={SPELLS.DEEPER_STRATAGEM_TALENT.id} />. </span>, // lv60 [SPELLS.SOOTHING_DARKNESS_TALENT.id]: <span>Good talent for questing or soloing. </span>, [SPELLS.ELUSIVENESS_TALENT.id]: <span><SpellLink id={SPELLS.ELUSIVENESS_TALENT.id} /> is not very useful since it only reduce non-AoE damage. Only works well in limited scenarios like soloing a elite enemy with <ItemLink id={ITEMS.WILL_OF_VALEERA.id} />. </span>, [SPELLS.CHEAT_DEATH_TALENT.id]: <span>Default talent for raids. Avoid death from a one-hit fatal damage, which is common in raids. </span>, // lv75 [SPELLS.STRIKE_FROM_THE_SHADOWS_TALENT.id]: <span>Slightly reduce the damage from a PvE target and slow down a PvP target. Only works well in limited scenarios like soloing elites. </span>, [SPELLS.PREY_ON_THE_WEAK_TALENT.id]: <span>Usually a good talent for soloing and PvP. Increase initiate damage by casting <SpellLink id={SPELLS.SAP.id} /> first. Increasing fire-focusing effectiveness for you and your teammates from your stuns: <SpellLink id={SPELLS.CHEAP_SHOT.id} /> and <SpellLink id={SPELLS.KIDNEY_SHOT.id} /> in PvP. </span>, [SPELLS.TANGLED_SHADOW_TALENT.id]: <span>Only choose this talent when you need to slow down your enemy, e.g. in Subtlety Rogue Artifact Challenge. </span>, // lv90 [SPELLS.DARK_SHADOW_TALENT.id]: <span>Core talent for burst-damage build. Increasing burst damage in <SpellLink id={SPELLS.SHADOW_DANCE.id} />. </span>, [SPELLS.ALACRITY_TALENT.id]: <span>Almost not a valid choice. </span>, [SPELLS.ENVELOPING_SHADOWS_TALENT.id]: <span>Slightly increase the coverage time of <SpellLink id={SPELLS.SHADOW_DANCE.id} />. Almost not a valid choice. </span>, // lv100 [SPELLS.MASTER_OF_SHADOWS_TALENT.id]: <span>Almost not a valid choice. </span>, [SPELLS.MARKED_FOR_DEATH_TALENT.id]: <span>Default talent for smooth-damage build. Powerful for questing/soloing.</span>, [SPELLS.DEATH_FROM_ABOVE_TALENT.id]: <span>Default talent in most scenarios including raids and mythic keystone dungeons. Provides high burst damage skill of casting a 50% damage-increased <SpellLink id={SPELLS.EVISCERATE.id} /> after a high-damage AoE. Works perfectly with subtlety rogue's damage increasing during <SpellLink id={SPELLS.SHADOW_DANCE.id} />. </span>, }, // attribution: <span>Parts of the descriptions for talents came from the <a href="http://www.wowhead.com/subtlety-rogue-talent-guide" target="_blank" rel="noopener noreferrer">Subtlety Rogue Wowhead guide</a> by Gray_Hound.</span>, };
app/components/OrderItem.js
nosplashurinal/order-management
import React from 'react'; import PropTypes from 'prop-types'; import styles from '../styles/orderItem.scss'; import { Strings } from '../model/Strings'; import classNames from 'classnames'; import { Link } from 'react-router'; const OrderItem = ({ orderId }) => <Link to={'/order/' + orderId } className={styles.order_item}> <div className={classNames(styles.Rtable, styles.Rtable__10cols)}> <div id={styles.item} className={styles.Rtable_cell}>{Strings.orders.orderById[orderId].sku}</div> <div id={styles.order_no} className={styles.Rtable_cell}>{Strings.orders.orderById[orderId].order_no}</div> <div id={styles.order_type} className={styles.Rtable_cell}>{Strings.orders.orderById[orderId].order_type}</div> <div id={styles.order_date} className={styles.Rtable_cell}>{Strings.orders.orderById[orderId].order_date}</div> <div id={styles.customer_name} className={styles.Rtable_cell}>{Strings.orders.orderById[orderId].customer_name}</div> <div id={styles.email} className={styles.Rtable_cell}>{Strings.orders.orderById[orderId].email}</div> <div id={styles.mobile} className={styles.Rtable_cell}>{Strings.orders.orderById[orderId].mobile}</div> <div id={styles.status} className={styles.Rtable_cell}>{Strings.orders.orderById[orderId].status}</div> <div id={styles.facility} className={styles.Rtable_cell}>{Strings.orders.orderById[orderId].facility}</div> <div id={styles.finance} className={styles.Rtable_cell}>{Strings.orders.orderById[orderId].finance}</div> </div> </Link>; OrderItem.propTypes = { orderId: PropTypes.string }; export default OrderItem;
packages/rmw-shell/src/components/Icons/ReduxIcon.js
TarikHuber/react-most-wanted
import React from 'react' import SvgIcon from '@mui/material/SvgIcon' const GitHubIcon = (props) => { return ( <SvgIcon width={22} height={22} viewBox="0 0 100 100" {...props}> <path d={ 'M65.6 65.4c2.9-.3 5.1-2.8 5-5.8-.1-3-2.6-5.4-5.6-5.4h-.2c-3.1.1-5.5 2.7-5.4 5.8.1 1.5.7 2.8 1.6 3.7-3.4 6.7-8.6 11.6-16.4 15.7-5.3 2.8-10.8 3.8-16.3 3.1-4.5-.6-8-2.6-10.2-5.9-3.2-4.9-3.5-10.2-.8-15.5 1.9-3.8 4.9-6.6 6.8-8-.4-1.3-1-3.5-1.3-5.1-14.5 10.5-13 24.7-8.6 31.4 3.3 5 10 8.1 17.4 8.1 2 0 4-.2 6-.7 12.8-2.5 22.5-10.1 28-21.4z' } /> <path d={ 'M83.2 53c-7.6-8.9-18.8-13.8-31.6-13.8H50c-.9-1.8-2.8-3-4.9-3h-.2c-3.1.1-5.5 2.7-5.4 5.8.1 3 2.6 5.4 5.6 5.4h.2c2.2-.1 4.1-1.5 4.9-3.4H52c7.6 0 14.8 2.2 21.3 6.5 5 3.3 8.6 7.6 10.6 12.8 1.7 4.2 1.6 8.3-.2 11.8-2.8 5.3-7.5 8.2-13.7 8.2-4 0-7.8-1.2-9.8-2.1-1.1 1-3.1 2.6-4.5 3.6 4.3 2 8.7 3.1 12.9 3.1 9.6 0 16.7-5.3 19.4-10.6 2.9-5.8 2.7-15.8-4.8-24.3z' } /> <path d={ 'M32.4 67.1c.1 3 2.6 5.4 5.6 5.4h.2c3.1-.1 5.5-2.7 5.4-5.8-.1-3-2.6-5.4-5.6-5.4h-.2c-.2 0-.5 0-.7.1-4.1-6.8-5.8-14.2-5.2-22.2.4-6 2.4-11.2 5.9-15.5 2.9-3.7 8.5-5.5 12.3-5.6 10.6-.2 15.1 13 15.4 18.3 1.3.3 3.5 1 5 1.5-1.2-16.2-11.2-24.6-20.8-24.6-9 0-17.3 6.5-20.6 16.1-4.6 12.8-1.6 25.1 4 34.8-.5.7-.8 1.8-.7 2.9z' } /> </SvgIcon> ) } export default GitHubIcon
docs/src/examples/elements/Label/Variations/LabelExampleBasic.js
Semantic-Org/Semantic-UI-React
import React from 'react' import { Label } from 'semantic-ui-react' const LabelExampleBasic = () => ( <div> <Label as='a' basic> Basic </Label> <Label as='a' basic pointing> Pointing </Label> <Label as='a' basic image> <img src='/images/avatar/small/elliot.jpg' /> Elliot </Label> <Label as='a' basic color='red' pointing> Red Pointing </Label> <Label as='a' basic color='blue'> Blue </Label> </div> ) export default LabelExampleBasic
src/components/Footer/Footer.js
CrossNJU/Languist
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-2016 Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import React, { Component } from 'react'; import withStyles from 'isomorphic-style-loader/lib/withStyles'; import s from './Footer.scss'; import Link from '../Link'; class Footer extends Component { render() { return ( <div className={s.root}> <div className={s.container}> <span className={s.text}>Made with ♥ by Danni, Ray, Moo &amp; Polaris © 2016 <a href="https://github.com/CrossNJU">Cross</a></span> </div> </div> ); } } export default withStyles(Footer, s);
docs/src/components/Docs/Content/index.js
rhalff/storybook
import React from 'react'; import PropTypes from 'prop-types'; import 'highlight.js/styles/github-gist.css'; import Highlight from '../../Highlight'; import './style.css'; const DocsContent = ({ title, content, editUrl }) => ( <div id="docs-content"> <div className="content"> <h2 className="title">{title}</h2> <p> <a className="edit-link" href={editUrl} target="_blank" rel="noopener noreferrer"> Edit this page </a> </p> <div className="markdown"> <Highlight>{content}</Highlight> </div> </div> </div> ); DocsContent.propTypes = { title: PropTypes.string.isRequired, content: PropTypes.string.isRequired, editUrl: PropTypes.string.isRequired, }; export { DocsContent as default };
webpack/move_to_foreman/components/common/table/components/Table.js
ares/katello
import React from 'react'; import PropTypes from 'prop-types'; import { Table as PfTable } from 'patternfly-react'; import { noop } from 'foremanReact/common/helpers'; import EmptyState from 'foremanReact/components/common/EmptyState'; import Pagination from 'foremanReact/components/Pagination/PaginationWrapper'; import TableBody from './TableBody'; const Table = ({ columns, rows, emptyState, bodyMessage, children, itemCount, pagination, onPaginationChange, ...props }) => { if (rows.length === 0 && bodyMessage === undefined) { return <EmptyState {...emptyState} />; } const shouldRenderPagination = itemCount && pagination; const body = children || [ <PfTable.Header key="header" />, <TableBody key="body" columns={columns} rows={rows} message={bodyMessage} rowKey="id" />, ]; return ( <div> <PfTable.PfProvider columns={columns} className="table-fixed" striped bordered hover {...props} > {body} </PfTable.PfProvider> {shouldRenderPagination && ( <Pagination viewType="table" itemCount={itemCount} pagination={pagination} onChange={onPaginationChange} /> )} </div> ); }; Table.propTypes = { columns: PropTypes.arrayOf(PropTypes.object).isRequired, rows: PropTypes.arrayOf(PropTypes.object).isRequired, emptyState: PropTypes.object, // eslint-disable-line react/forbid-prop-types pagination: PropTypes.object, // eslint-disable-line react/forbid-prop-types bodyMessage: PropTypes.node, children: PropTypes.node, itemCount: PropTypes.number, onPaginationChange: PropTypes.func, }; Table.defaultProps = { emptyState: undefined, pagination: undefined, bodyMessage: undefined, children: undefined, itemCount: undefined, onPaginationChange: noop, }; export default Table;
examples/src/components/CustomOption.js
sarahbkim/react-select-custom
import React from 'react'; import Gravatar from 'react-gravatar'; var Option = React.createClass({ propTypes: { addLabelText: React.PropTypes.string, className: React.PropTypes.string, mouseDown: React.PropTypes.func, mouseEnter: React.PropTypes.func, mouseLeave: React.PropTypes.func, option: React.PropTypes.object.isRequired, renderFunc: React.PropTypes.func }, render () { var obj = this.props.option; var size = 15; var gravatarStyle = { borderRadius: 3, display: 'inline-block', marginRight: 10, position: 'relative', top: -2, verticalAlign: 'middle', }; return ( <div className={this.props.className} onMouseEnter={this.props.mouseEnter} onMouseLeave={this.props.mouseLeave} onMouseDown={this.props.mouseDown} onClick={this.props.mouseDown}> <Gravatar email={obj.email} size={size} style={gravatarStyle} /> {obj.value} </div> ); } }); module.exports = Option;
src/svg-icons/device/signal-cellular-0-bar.js
hai-cea/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceSignalCellular0Bar = (props) => ( <SvgIcon {...props}> <path fillOpacity=".3" d="M2 22h20V2z"/> </SvgIcon> ); DeviceSignalCellular0Bar = pure(DeviceSignalCellular0Bar); DeviceSignalCellular0Bar.displayName = 'DeviceSignalCellular0Bar'; DeviceSignalCellular0Bar.muiName = 'SvgIcon'; export default DeviceSignalCellular0Bar;
fields/types/number/NumberFilter.js
Adam14Four/keystone
import React from 'react'; import { findDOMNode } from 'react-dom'; import { FormField, FormInput, FormRow, FormSelect } from 'elemental'; const MODE_OPTIONS = [ { label: 'Exactly', value: 'equals' }, { label: 'Greater Than', value: 'gt' }, { label: 'Less Than', value: 'lt' }, { label: 'Between', value: 'between' }, ]; function getDefaultValue () { return { mode: MODE_OPTIONS[0].value, value: '', }; } var NumberFilter = React.createClass({ statics: { getDefaultValue: getDefaultValue, }, getDefaultProps () { return { filter: getDefaultValue(), }; }, componentDidMount () { // focus the text input findDOMNode(this.refs.focusTarget).focus(); }, handleChangeBuilder (type) { const self = this; return function handleChange (e) { const { filter, onChange } = self.props; switch (type) { case 'minValue': onChange({ mode: filter.mode, value: { min: e.target.value, max: filter.value.max, }, }); break; case 'maxValue': onChange({ mode: filter.mode, value: { min: filter.value.min, max: e.target.value, }, }); break; case 'value': onChange({ mode: filter.mode, value: e.target.value, }); } }; }, // Update the props with this.props.onChange updateFilter (changedProp) { this.props.onChange({ ...this.props.filter, ...changedProp }); }, // Update the filter mode selectMode (mode) { this.updateFilter({ mode }); // focus on next tick setTimeout(() => { findDOMNode(this.refs.focusTarget).focus(); }, 0); }, renderControls (mode) { let controls; const { field } = this.props; const placeholder = field.label + ' is ' + mode.label.toLowerCase() + '...'; if (mode.value === 'between') { controls = ( <FormRow> <FormField width="one-half" style={{ marginBottom: 0 }}> <FormInput onChange={this.handleChangeBuilder('minValue')} placeholder="Min." ref="focusTarget" type="number" /> </FormField> <FormField width="one-half" style={{ marginBottom: 0 }}> <FormInput onChange={this.handleChangeBuilder('maxValue')} placeholder="Max." type="number" /> </FormField> </FormRow> ); } else { controls = ( <FormField> <FormInput onChange={this.handleChangeBuilder('value')} placeholder={placeholder} ref="focusTarget" type="number" /> </FormField> ); } return controls; }, render () { const { filter } = this.props; const mode = MODE_OPTIONS.filter(i => i.value === filter.mode)[0]; return ( <div> <FormSelect onChange={this.selectMode} options={MODE_OPTIONS} value={mode.value} /> {this.renderControls(mode)} </div> ); }, }); module.exports = NumberFilter;
src/MenuItem.js
IveWong/react-bootstrap
import React from 'react'; import classNames from 'classnames'; import SafeAnchor from './SafeAnchor'; const MenuItem = React.createClass({ propTypes: { header: React.PropTypes.bool, divider: React.PropTypes.bool, href: React.PropTypes.string, title: React.PropTypes.string, target: React.PropTypes.string, onSelect: React.PropTypes.func, eventKey: React.PropTypes.any, active: React.PropTypes.bool, disabled: React.PropTypes.bool }, getDefaultProps() { return { active: false }; }, handleClick(e) { if (this.props.disabled) { e.preventDefault(); return; } if (this.props.onSelect) { e.preventDefault(); this.props.onSelect(this.props.eventKey, this.props.href, this.props.target); } }, renderAnchor() { return ( <SafeAnchor onClick={this.handleClick} href={this.props.href} target={this.props.target} title={this.props.title} tabIndex="-1"> {this.props.children} </SafeAnchor> ); }, render() { let classes = { 'dropdown-header': this.props.header, 'divider': this.props.divider, 'active': this.props.active, 'disabled': this.props.disabled }; let children = null; if (this.props.header) { children = this.props.children; } else if (!this.props.divider) { children = this.renderAnchor(); } return ( <li {...this.props} role="presentation" title={null} href={null} className={classNames(this.props.className, classes)}> {children} </li> ); } }); export default MenuItem;
src/js/discussion/camps/CampParent.js
TTFG-Analytics/commonground
import React from 'react'; import Camp from './Camp'; import AddCamp from './AddCamp'; import CampList from './CampList'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import BackButton from './BackButton'; import FaceBookIntegration from 'FaceBookIntegration'; import ProfileButton from './ProfileButton'; import Navigation from 'Navigation'; import { Link } from 'react-router'; import { Col, Row, Grid } from 'react-bootstrap'; import { clearCamps, clearComments } from './campActions' require('./camp.css') //discussionId is used to associate which camps belong to which discussions class CampParent extends React.Component{ componentDidMount() { FB.getLoginStatus(function(response) { if (response.status === 'connected') { var uid = response.authResponse.userID; var accessToken = response.authResponse.accessToken; } else if (response.status === 'not_authorized') { console.log('user is logged into Facebook but not authenticated'); } else { console.log('user is not logged in to to facebook'); } }); } componentWillUnmount() { this.props.clearCamps() this.props.clearComments() } render(){ var discussionId = this.props.params.discussionId return ( <div> <Navigation /> <h2 className="col-md-offset-2 campText">{this.props.discussions[discussionId].input}</h2> {this.props.user === this.props.discussions[discussionId].user_id && <AddCamp discussionId={discussionId} />} <Col md={10} mdOffset={1}> <h5 id='campInstruction'>Each CommonGround is an opinion or social group that you could identify with. Click on one to expand it and see its comments. Feel free to add your own contribution. </h5> </Col> <br></br> <br></br> <CampList /> </div> ) } } const mapStateToProps = (state) => { return { camps: state.campGet, discussions: state.discussionsGet.discussions, user: state.profileReducer.id } } const mapDispatchToProps = (dispatch) => { return { clearCamps: () => { dispatch(clearCamps()) }, clearComments: () => { dispatch(clearComments()) } } } export default connect(mapStateToProps, mapDispatchToProps)(CampParent)
src/svg-icons/action/schedule.js
w01fgang/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionSchedule = (props) => ( <SvgIcon {...props}> <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/> </SvgIcon> ); ActionSchedule = pure(ActionSchedule); ActionSchedule.displayName = 'ActionSchedule'; ActionSchedule.muiName = 'SvgIcon'; export default ActionSchedule;
markbin/client/components/bins/bins_viewer.js
tpechacek/learn-react-native
import React, { Component } from 'react'; import { markdown } from 'markdown'; class BinsViewer extends Component { render() { const rawHTML = markdown.toHTML(this.props.bin.content); return ( <div className="col-xs-4"> <h5>Output</h5> <div dangerouslySetInnerHTML={{ __html: rawHTML }}> </div> </div> ); } } export default BinsViewer;
src/svg-icons/content/markunread.js
ruifortes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ContentMarkunread = (props) => ( <SvgIcon {...props}> <path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/> </SvgIcon> ); ContentMarkunread = pure(ContentMarkunread); ContentMarkunread.displayName = 'ContentMarkunread'; ContentMarkunread.muiName = 'SvgIcon'; export default ContentMarkunread;
react/CloseIcon/CloseIcon.js
seek-oss/seek-style-guide
import svgMarkup from './CloseIcon.svg'; import React from 'react'; import Icon from '../private/Icon/Icon'; export default function CloseIcon(props) { return <Icon markup={svgMarkup} {...props} />; } CloseIcon.displayName = 'CloseIcon';
examples/src/Examples.js
Amirus/react-autosuggest
require('./Examples.less'); require('./Autosuggest.less'); import React, { Component } from 'react'; import { findDOMNode } from 'react-dom'; import BasicExample from './BasicExample/BasicExample'; import CustomRenderer from './CustomRenderer/CustomRenderer'; import MultipleSections from './MultipleSections/MultipleSections'; import ControlledComponent from './ControlledComponent/ControlledComponent'; import EventsPlayground from './EventsPlayground/EventsPlayground'; import EventsLog from './EventsLog/EventsLog'; export default class Examples extends Component { constructor() { super(); this.examples = [ 'Basic example', 'Custom renderer', 'Multiple sections', 'Controlled Component', 'Events playground' ]; this.eventsPlaceholder = { type: 'placeholder', text: 'Once you interact with the Autosuggest, events will appear here.' }; this.eventQueue = []; this.state = { activeExample: decodeURI(location.hash).split('#')[1] || this.examples[0], events: [this.eventsPlaceholder] }; } changeExample(example) { this.setState({ activeExample: example }); } renderMenu() { return ( <div className="examples__menu" role="menu"> {this.examples.map(example => { const classes = 'examples__menu-item' + (example === this.state.activeExample ? ' examples__menu-item--active' : ''); return ( <div className={classes} key={example} role="menuitem" tabIndex="0" onClick={this.changeExample.bind(this, example)}> {example} </div> ); })} </div> ); } clearEvents() { this.setState({ events: [this.eventsPlaceholder] }); } eventsExist() { return this.state.events[0].type !== 'placeholder'; } renderEventsLog() { if (this.state.activeExample === 'Events playground') { return ( <div className="examples__events-log-wrapper"> { this.eventsExist() && <button onClick={::this.clearEvents}>Clear</button> } <EventsLog ref="eventsLog" events={this.state.events} /> </div> ); } return null; } isEventQueueEmpty() { return this.eventQueue.length === 0; } processEvents() { if (this.isEventQueueEmpty()) { return; } const event = this.eventQueue[0]; this.setState({ events: this.eventsExist() ? this.state.events.concat([event]) : [event] }, () => { this.eventQueue.shift(); this.processEvents(); // Scroll to the bottom findDOMNode(this.refs.eventsLog.refs.eventsLogWrapper).scrollTop = Number.MAX_SAFE_INTEGER; }); } onEventAdded(event) { const eventQueueWasEmpty = this.isEventQueueEmpty(); this.eventQueue.push(event); if (eventQueueWasEmpty) { this.processEvents(); } } focusOn(id) { document.getElementById(id).focus(); } renderExample() { switch (this.state.activeExample) { case 'Basic example': return <BasicExample ref={() => this.focusOn('basic-example')} />; case 'Custom renderer': return <CustomRenderer ref={() => this.focusOn('custom-renderer')} />; case 'Multiple sections': return <MultipleSections ref={() => this.focusOn('multiple-sections')} />; case 'Controlled Component': return <ControlledComponent ref={() => this.focusOn('controlled-component-from')} />; case 'Events playground': return <EventsPlayground onEventAdded={::this.onEventAdded} ref={() => this.focusOn('events-playground')} />; } } render() { return ( <div className="examples"> <div className="examples__column"> {this.renderMenu()} {this.renderEventsLog()} </div> <div className="examples__column"> {this.renderExample()} </div> </div> ); } }
src/links.js
7fffffff/linkgrabber
import chrome from 'chrome'; import React from 'react'; import ReactDOM from 'react-dom'; import LinkList from './components/LinkList'; const target = document.getElementById('LinkList'); function domainPattern(domains) { // ['foo.com', 'bar.com'] // /^(?:[\w-]+\.)*(?:foo\.com|bar\.com)+$/i if (!domains || domains.length <= 0) { return new RegExp('(?!x)x'); // a regex that matches nothing } for (let i = 0; i < domains.length; i++) { domains[i] = domains[i].replace(/\./g, '\\.'); } const s = '^(?:[\\w-]+\\.)*(?:' + domains.join('|') + ')+$'; return new RegExp(s, 'i'); } chrome.tabs.query({active: true, windowId: chrome.windows.WINDOW_ID_CURRENT}, tabs => { chrome.storage.sync.get(null, options => { chrome.runtime.getBackgroundPage(page => { var data = page.tabData[tabs[0].id]; if (data) { document.title = 'Extracted Links for ' + data.source; ReactDOM.render( <LinkList blockPattern={domainPattern(options.blockedDomains)} expired={false} links={data.links} source={data.source} /> , target); } else { ReactDOM.render(<LinkList expired={true} />, target); } }); }); });
src/components/user/Register.js
teamNOne/showdown
import React from 'react'; import Form from '../app/form/Form'; import TextGroup from '../app/form/TextGroup'; import RadioGroup from '../app/form/RadioGroup'; import RadioElement from '../app/form/RadioElement'; import Submit from '../app/form/Submit'; export default class Register extends React.Component { render() { return ( <Form handleSubmit={this.props.handleRegister} title="Register" submitState={this.props.Register.submitState} message={this.props.Register.message}> <TextGroup type="text" label="Username" value={this.props.Register.username} validationState={this.props.Register.usernameValidationState} message={this.props.Register.message} handleChange={this.props.FormActions.inputChange} /> <TextGroup type="password" label="Password" value={this.props.Register.password} validationState={this.props.Register.passwordValidationState} message={this.props.Register.message} handleChange={this.props.FormActions.inputChange} /> <TextGroup type="password" label="Confirm password" name="confirmedPassword" value={this.props.Register.confirmedPassword} validationState={this.props.Register.confirmedPasswordValidationState} message={this.props.Register.message} handleChange={this.props.FormActions.inputChange} /> <TextGroup type="text" label="First name" name="firstName" value={this.props.Register.firstName} validationState={this.props.Register.firstNameValidationState} message={this.props.Register.message} handleChange={this.props.FormActions.inputChange} /> <TextGroup type="text" label="Last name" name="lastName" value={this.props.Register.lastName} validationState={this.props.Register.lastNameValidationState} message={this.props.Register.message} handleChange={this.props.FormActions.inputChange} /> <TextGroup type="number" label="age" value={this.props.Register.age} validationState={this.props.Register.ageValidationState} message={this.props.Register.message} handleChange={this.props.FormActions.inputChange} /> <RadioGroup validationState={ this.props.Register.genderValidationState } message={ this.props.Register.message }> <RadioElement name="gender" value="Male" selectedValue = { this.props.Register.gender } handleChange={ this.props.FormActions.inputChange } /> <RadioElement name="gender" value="Female" selectedValue = { this.props.Register.gender } handleChange={ this.props.FormActions.inputChange } /> </RadioGroup> <Submit type="btn-primary" value="Add" /> </Form> ) } }
src/hoc/withStorage.js
MMMalik/react-show-app
import React, { Component } from 'react'; export default function withStorage(Cmp) { return class WithStorage extends Component { storage = window.localStorage || {}; setItems = (items) => { Object.keys(items).forEach(key => { this.storage[key] = items[key]; }); } getItem = (key) => { return this.storage[key]; } render () { return <Cmp {...this.props} setItems={this.setItems} getItem={this.getItem} />; } }; }
src/routes/Login/components/Login.js
dima-bu/b2b.core
import React from 'react'; import LoginForm from './../../../components/form-login/form-login'; import style from './Login.less'; const Login = props => { const {LogIn, loggedIn, userName, errorMessage} = props; const onSubmitHandler = (credentials) => { LogIn(credentials); }; return ( <div className={style.wrapper}> <div className={style.logo} /> <h1 className={style.title}>Вход в кабинет контрагента</h1> <LoginForm onSubmit={onSubmitHandler} /> {errorMessage && <div className={style.error}>{errorMessage}</div> } </div> ); }; export default Login;