path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
pollard/index.js
spencerliechty/pollard
import React from 'react'; import ReactDOM from 'react-dom'; import App from './containers/App'; ReactDOM.render( <App />, document.getElementById('root') );
soon/react-boilerplate/app/containers/NotFoundPage/index.js
rmevans9/reactotron
/** * NotFoundPage * * This is the page we show when the user visits a url that doesn't have a route */ import React from 'react'; import messages from './messages'; import { FormattedMessage } from 'react-intl'; import H1 from 'components/H1'; export default function NotFound() { return ( <article> <H1> <FormattedMessage {...messages.header} /> </H1> </article> ); }
src/decorators/withViewport.js
juliocanares/react-starter-kit
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */ import React, { Component } from 'react'; // eslint-disable-line no-unused-vars import EventEmitter from 'eventemitter3'; import { canUseDOM } from '../../node_modules/react/lib/ExecutionEnvironment'; let EE; let viewport = {width: 1366, height: 768}; // Default size for server-side rendering const RESIZE_EVENT = 'resize'; function handleWindowResize() { if (viewport.width !== window.innerWidth || viewport.height !== window.innerHeight) { viewport = {width: window.innerWidth, height: window.innerHeight}; EE.emit(RESIZE_EVENT, viewport); } } function withViewport(ComposedComponent) { return class WithViewport extends Component { constructor() { super(); this.state = { viewport: canUseDOM ? {width: window.innerWidth, height: window.innerHeight} : viewport }; } componentDidMount() { if (!EE) { EE = new EventEmitter(); window.addEventListener('resize', handleWindowResize); window.addEventListener('orientationchange', handleWindowResize); } EE.on('resize', this.handleResize, this); } componentWillUnmount() { EE.removeListener(RESIZE_EVENT, this.handleResize, this); if (!EE.listeners(RESIZE_EVENT, true)) { window.removeEventListener('resize', handleWindowResize); window.removeEventListener('orientationchange', handleWindowResize); EE = null; } } render() { return <ComposedComponent {...this.props} viewport={this.state.viewport}/>; } handleResize(value) { this.setState({viewport: value}); } }; } export default withViewport;
pootle/static/js/admin/components/ProjectForm.js
Jobava/pootle
/* * Copyright (C) Pootle contributors. * * This file is a part of the Pootle project. It is distributed under the GPL3 * or later license. See the LICENSE file for a copy of the license and the * AUTHORS file for copyright and authorship information. */ 'use strict'; import React from 'react'; import { FormElement } from 'components/forms'; import { ModelFormMixin } from 'mixins/forms'; import ItemDelete from '../components/ItemDelete'; let ProjectForm = React.createClass({ mixins: [ModelFormMixin], propTypes: { onSuccess: React.PropTypes.func.isRequired, }, fields: ['code', 'fullname', 'checkstyle', 'localfiletype', 'treestyle', 'source_language', 'report_email', 'screenshot_search_prefix', 'disabled'], /* Handlers */ handleSuccess(model) { // Add models at the beginning of the collection. When models exist, // we need to move them to the first position, as Backbone doesn't // honor the `at: <pos>` option in that scenario and there's // no modified time attribute that could be used for sorting. this.props.collection.unshift(model, {merge: true}); this.props.collection.move(model, 0); this.props.onSuccess(model); }, /* Layout */ render() { let model = this.getResource(); let { errors } = this.state; let { formData } = this.state; return ( <form method="post" id="item-form" onSubmit={this.handleFormSubmit}> <div className="fields"> <FormElement autoFocus={true} attribute="code" disabled={model.hasOwnProperty('id')} label={gettext('Code')} handleChange={this.handleChange} formData={formData} errors={errors} /> <FormElement attribute="fullname" label={gettext('Full Name')} handleChange={this.handleChange} formData={formData} errors={errors} /> <FormElement type="select" clearable={false} attribute="checkstyle" options={model.getFieldChoices('checkstyle')} label={gettext('Quality Checks')} handleChange={this.handleChange} formData={formData} errors={errors} /> <FormElement type="select" clearable={false} attribute="localfiletype" options={model.getFieldChoices('localfiletype')} label={gettext('File Type')} handleChange={this.handleChange} formData={formData} errors={errors} /> <FormElement type="select" clearable={false} attribute="treestyle" options={model.getFieldChoices('treestyle')} label={gettext('Project Tree Style')} handleChange={this.handleChange} formData={formData} errors={errors} /> <FormElement type="select" clearable={false} attribute="source_language" options={model.getFieldChoices('source_language')} label={gettext('Source Language')} handleChange={this.handleChange} formData={formData} errors={errors} /> <FormElement attribute="ignoredfiles" label={gettext('Ignore Files')} handleChange={this.handleChange} formData={formData} errors={errors} /> <FormElement type="email" attribute="report_email" label={gettext('String Errors Contact')} handleChange={this.handleChange} formData={formData} errors={errors} /> <FormElement attribute="screenshot_search_prefix" label={gettext('Screenshot Search Prefix')} handleChange={this.handleChange} formData={formData} errors={errors} /> <FormElement type="checkbox" attribute="disabled" label={gettext('Disabled')} handleChange={this.handleChange} formData={formData} errors={errors} /> </div> <div className="buttons"> <input type="submit" className="btn btn-primary" disabled={!this.state.isDirty} value={gettext('Save')} /> {model.id && <ul className="action-links"> <li><a href={model.getAbsoluteUrl()}>{gettext('Overview')}</a></li> <li><a href={model.getLanguagesUrl()}>{gettext('Languages')}</a></li> <li><a href={model.getPermissionsUrl()}>{gettext('Permissions')}</a></li> </ul>} </div> {this.props.onDelete && <div> <p className="divider" /> <div className="buttons"> <ItemDelete item={model} onDelete={this.props.onDelete} /> </div> </div>} </form> ); } }); export default ProjectForm;
node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js
henripal/henripal.github.io
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'));
src/pages/Settings/News/News.js
aggiedefenders/aggiedefenders.github.io
import React, { Component } from 'react'; import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table'; import { Link } from 'react-router-dom'; import _backButton from '../../../assets/img/back_btn_white.png'; import firebase from 'firebase'; var database = firebase.database(); const containerStyle = { backgroundColor: '#2980b9', color: 'white' }; //table function //change cell elements function onAfterSaveCell(row, cellName, cellValue) { var updateRef = database.ref('news/' + row.id); updateRef.update(row); console.log(row) } function onBeforeSaveCell(row, cellName, cellValue) { // You can do any validation on here for editing value, // return false for reject the editing return true; } //table function delete row/s function onAfterDeleteRow(row, rowKeys) { for(var i in row){ console.log(row[i]); var deleteRef = database.ref('news/'+row[i]); deleteRef.remove(); } } //table function const cellEditProp = { mode: 'click', blurToSave: true, beforeSaveCell: onBeforeSaveCell, // a hook for before saving cell afterSaveCell: onAfterSaveCell // a hook for after saving cell }; //table function const selectRowProp = { mode: 'checkbox' }; const options = { afterDeleteRow: onAfterDeleteRow // A hook for after droping rows. }; class News extends Component { constructor(props) { super(props); this.state = { text: '', products: [] }; this.handleChange = this.handleChange.bind(this); this.filesRef = database.ref('news'); } componentDidMount() { this.filesRef.on('value', this.gotData, this.errData); } gotData = (data) => { let newProducts = [] const userdata = data.val(); const keys = Object.keys(userdata); for (let i = 0; i < keys.length; i++) { const k = keys[i]; newProducts.push({ title: userdata[k].title, content: userdata[k].content, id: userdata[k].id, url: userdata[k].url, imgurl: userdata[k].image_url }); } this.setState({ products: newProducts }); } errData = (err) => { console.log(err); } handleClick = (rowKey) => { alert(this.refs.table.getPageByRowKey(rowKey)); } handleChange = (event) => { console.log('change') alert(event.target.value) } render() { return ( <div style={containerStyle} className="pt-card"> <div className="col-lg-12"> <h3> News </h3> <Link style={{color: 'white'}}className="pt-button pt-minimal" to="/settings" aria-label="Account"><img src={_backButton} />Back</Link> </div> <BootstrapTable ref='table' data={this.state.products} pagination={true} search={true} cellEdit={cellEditProp} deleteRow={true} selectRow={selectRowProp} options={options} > <TableHeaderColumn dataField='id' isKey={true} dataSort={true}>ID</TableHeaderColumn> <TableHeaderColumn dataField='title' dataSort={true} onChange={this.handleChange}>Title</TableHeaderColumn> <TableHeaderColumn dataField='content' dataSort={true} onChange={this.handleChange} >Content</TableHeaderColumn> <TableHeaderColumn dataField='url' dataSort={true} onChange={this.handleChange} >Source URL</TableHeaderColumn> </BootstrapTable> </div> ); } } export default News;
client/views/setupWizard/StepHeader.js
iiet/iiet-chat
import { Box } from '@rocket.chat/fuselage'; import React from 'react'; import { useTranslation } from '../../contexts/TranslationContext'; export function StepHeader({ number, title }) { const t = useTranslation(); return <Box is='header' marginBlockEnd='x32'> <Box is='p' fontScale='c1' color='hint'>{t('Step')} {number}</Box> <Box is='h2' fontScale='h1' color='default'>{title}</Box> </Box>; }
tests/baselines/reference/jsxDeclarationsWithEsModuleInteropNoCrash.js
alexeagle/TypeScript
//// [jsxDeclarationsWithEsModuleInteropNoCrash.jsx] /// <reference path="/.lib/react16.d.ts" /> import PropTypes from 'prop-types'; import React from 'react'; const propTypes = { bar: PropTypes.bool, }; const defaultProps = { bar: false, }; function Foo({ bar }) { return <div>{bar}</div>; } Foo.propTypes = propTypes; Foo.defaultProps = defaultProps; export default Foo; //// [jsxDeclarationsWithEsModuleInteropNoCrash.d.ts] /// <reference path="../../../..react16.d.ts" /> export default Foo; declare function Foo({ bar }: { bar: any; }): JSX.Element; declare namespace Foo { export { propTypes }; export { defaultProps }; } declare namespace propTypes { export const bar: PropTypes.Requireable<boolean>; } declare namespace defaultProps { const bar_1: boolean; export { bar_1 as bar }; } import PropTypes from "prop-types";
docs/src/components/Playground/Atoms/Tab/Tab.js
seek-oss/seek-style-guide
import styles from './Tab.less'; import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; export default function Tab({ children, selected }) { return ( <h5 className={classnames({ [styles.root]: true, [styles.selected]: selected })} > {children} </h5> ); } Tab.propTypes = { children: PropTypes.node, selected: PropTypes.bool };
docs/src/pages/premium-themes/onepirate/modules/views/ProductSmokingHero.js
lgollut/material-ui
import React from 'react'; import PropTypes from 'prop-types'; import Button from '@material-ui/core/Button'; import Container from '@material-ui/core/Container'; import { withStyles } from '@material-ui/core/styles'; import Typography from '../components/Typography'; const styles = (theme) => ({ root: { display: 'flex', flexDirection: 'column', alignItems: 'center', marginTop: theme.spacing(9), marginBottom: theme.spacing(9), }, button: { border: '4px solid currentColor', borderRadius: 0, height: 'auto', padding: theme.spacing(2, 5), }, link: { marginTop: theme.spacing(3), marginBottom: theme.spacing(3), }, buoy: { width: 60, }, }); function ProductSmokingHero(props) { const { classes } = props; return ( <Container className={classes.root} component="section"> <Button className={classes.button}> <Typography variant="h4" component="span"> Got any questions? Need help? </Typography> </Button> <Typography variant="subtitle1" className={classes.link}> We are here to help. Get in touch! </Typography> <img src="/static/themes/onepirate/producBuoy.svg" className={classes.buoy} alt="buoy" /> </Container> ); } ProductSmokingHero.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styles)(ProductSmokingHero);
app/javascript/mastodon/components/relative_timestamp.js
foozmeat/mastodon
import React from 'react'; import { injectIntl, defineMessages } from 'react-intl'; import PropTypes from 'prop-types'; const messages = defineMessages({ just_now: { id: 'relative_time.just_now', defaultMessage: 'now' }, seconds: { id: 'relative_time.seconds', defaultMessage: '{number}s' }, minutes: { id: 'relative_time.minutes', defaultMessage: '{number}m' }, hours: { id: 'relative_time.hours', defaultMessage: '{number}h' }, days: { id: 'relative_time.days', defaultMessage: '{number}d' }, }); const dateFormatOptions = { hour12: false, year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit', }; const shortDateFormatOptions = { month: 'numeric', day: 'numeric', }; const SECOND = 1000; const MINUTE = 1000 * 60; const HOUR = 1000 * 60 * 60; const DAY = 1000 * 60 * 60 * 24; const MAX_DELAY = 2147483647; const selectUnits = delta => { const absDelta = Math.abs(delta); if (absDelta < MINUTE) { return 'second'; } else if (absDelta < HOUR) { return 'minute'; } else if (absDelta < DAY) { return 'hour'; } return 'day'; }; const getUnitDelay = units => { switch (units) { case 'second': return SECOND; case 'minute': return MINUTE; case 'hour': return HOUR; case 'day': return DAY; default: return MAX_DELAY; } }; @injectIntl export default class RelativeTimestamp extends React.Component { static propTypes = { intl: PropTypes.object.isRequired, timestamp: PropTypes.string.isRequired, }; state = { now: this.props.intl.now(), }; shouldComponentUpdate (nextProps, nextState) { // As of right now the locale doesn't change without a new page load, // but we might as well check in case that ever changes. return this.props.timestamp !== nextProps.timestamp || this.props.intl.locale !== nextProps.intl.locale || this.state.now !== nextState.now; } componentWillReceiveProps (nextProps) { if (this.props.timestamp !== nextProps.timestamp) { this.setState({ now: this.props.intl.now() }); } } componentDidMount () { this._scheduleNextUpdate(this.props, this.state); } componentWillUpdate (nextProps, nextState) { this._scheduleNextUpdate(nextProps, nextState); } componentWillUnmount () { clearTimeout(this._timer); } _scheduleNextUpdate (props, state) { clearTimeout(this._timer); const { timestamp } = props; const delta = (new Date(timestamp)).getTime() - state.now; const unitDelay = getUnitDelay(selectUnits(delta)); const unitRemainder = Math.abs(delta % unitDelay); const updateInterval = 1000 * 10; const delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder); this._timer = setTimeout(() => { this.setState({ now: this.props.intl.now() }); }, delay); } render () { const { timestamp, intl } = this.props; const date = new Date(timestamp); const delta = this.state.now - date.getTime(); let relativeTime; if (delta < 10 * SECOND) { relativeTime = intl.formatMessage(messages.just_now); } else if (delta < 3 * DAY) { if (delta < MINUTE) { relativeTime = intl.formatMessage(messages.seconds, { number: Math.floor(delta / SECOND) }); } else if (delta < HOUR) { relativeTime = intl.formatMessage(messages.minutes, { number: Math.floor(delta / MINUTE) }); } else if (delta < DAY) { relativeTime = intl.formatMessage(messages.hours, { number: Math.floor(delta / HOUR) }); } else { relativeTime = intl.formatMessage(messages.days, { number: Math.floor(delta / DAY) }); } } else { relativeTime = intl.formatDate(date, shortDateFormatOptions); } return ( <time dateTime={timestamp} title={intl.formatDate(date, dateFormatOptions)}> {relativeTime} </time> ); } }
examples/counter/index.js
tweinfeld/redux
import React from 'react'; import { Provider } from 'react-redux'; import App from './containers/App'; import configureStore from './store/configureStore'; const store = configureStore(); React.render( <Provider store={store}> {() => <App />} </Provider>, document.getElementById('root') );
ui/src/pages/blog/index.js
danielbh/danielhollcraft.com-gatsbyjs
import React from 'react' import Link from 'gatsby-link' import './index.scss' export default ({ data }) => { return ( <section> <div className="container"> <header className="major"> <h2>Blog</h2> </header> {data.allMarkdownRemark.edges.map(({ node }) => ( <section key={node.id} className="blog-preview"> <article > <Link to={node.frontmatter.path}><h3>{node.frontmatter.title}</h3></Link> <h4>{node.frontmatter.date}</h4> <p>{node.excerpt}</p> </article> </section> ))} </div> </section> ) } export const query = graphql` query BlogListQuery { allMarkdownRemark( filter: {fileAbsolutePath: {regex: "/blog/.*\\.md$/"}}, sort: {fields: [frontmatter___date], order: DESC} ) { edges { node { id frontmatter { date title path } excerpt(pruneLength: 300) } } } } `
server/sonar-web/src/main/js/apps/overview/meta/MetaSize.js
lbndev/sonarqube
/* * SonarQube * Copyright (C) 2009-2017 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; import LanguageDistribution from '../../../components/charts/LanguageDistribution'; import { formatMeasure } from '../../../helpers/measures'; import { getMetricName } from '../helpers/metrics'; import SizeRating from '../../../components/ui/SizeRating'; export default class MetaSize extends React.Component { static propTypes = { component: React.PropTypes.object.isRequired, measures: React.PropTypes.array.isRequired }; render() { const ncloc = this.props.measures.find(measure => measure.metric.key === 'ncloc'); const languageDistribution = this.props.measures.find( measure => measure.metric.key === 'ncloc_language_distribution' ); if (ncloc == null || languageDistribution == null) { return null; } return ( <div id="overview-size" className="overview-meta-card"> <div id="overview-ncloc" className="overview-meta-size-ncloc"> <span className="spacer-right"> <SizeRating value={ncloc.value} /> </span> <DrilldownLink component={this.props.component.key} metric="ncloc"> {formatMeasure(ncloc.value, 'SHORT_INT')} </DrilldownLink> <div className="overview-domain-measure-label text-muted">{getMetricName('ncloc')}</div> </div> <div id="overview-language-distribution" className="overview-meta-size-lang-dist"> <LanguageDistribution distribution={languageDistribution.value} /> </div> </div> ); } }
src/decorators/withViewport.js
vishwanatharondekar/resume
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */ import React, { Component } from 'react'; // eslint-disable-line no-unused-vars import EventEmitter from 'eventemitter3'; import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment'; let EE; let viewport = {width: 1366, height: 768}; // Default size for server-side rendering const RESIZE_EVENT = 'resize'; function handleWindowResize() { if (viewport.width !== window.innerWidth || viewport.height !== window.innerHeight) { viewport = {width: window.innerWidth, height: window.innerHeight}; EE.emit(RESIZE_EVENT, viewport); } } function withViewport(ComposedComponent) { return class WithViewport extends Component { constructor() { super(); this.state = { viewport: canUseDOM ? {width: window.innerWidth, height: window.innerHeight} : viewport, }; } componentDidMount() { if (!EE) { EE = new EventEmitter(); window.addEventListener('resize', handleWindowResize); window.addEventListener('orientationchange', handleWindowResize); } EE.on(RESIZE_EVENT, this.handleResize, this); } componentWillUnmount() { EE.removeListener(RESIZE_EVENT, this.handleResize, this); if (!EE.listeners(RESIZE_EVENT, true)) { window.removeEventListener('resize', handleWindowResize); window.removeEventListener('orientationchange', handleWindowResize); EE = null; } } render() { return <ComposedComponent {...this.props} viewport={this.state.viewport}/>; } handleResize(value) { this.setState({viewport: value}); // eslint-disable-line react/no-set-state } }; } export default withViewport;
studio/src/previews/IframeMobilePreview.js
ajmalafif/ajmalafif.com
/* eslint-disable react/no-multi-comp, react/no-did-mount-set-state */ import React from 'react' import PropTypes from 'prop-types' import { format } from 'date-fns' import styles from './IframePreview.module.css' import SanityMobilePreview from 'sanity-mobile-preview' import 'sanity-mobile-preview/dist/index.css?raw' /** * Explore more examples of previews: * https://www.sanity.io/blog/evolve-authoring-experiences-with-views-and-split-panes */ const assemblePostUrl = ({ displayed, options }) => { const { slug } = displayed const { previewURL } = options if (!slug || !previewURL) { console.warn('Missing slug or previewURL', { slug, previewURL }) return '' } const path = `/${slug.current}/` return `${previewURL}/notes${path}` } const IframeMobilePreview = props => { const { options } = props const { displayed } = props.document if (!displayed) { return ( <div className={styles.componentWrapper}> <p>There is no document to preview</p> </div> ) } const url = assemblePostUrl({ displayed, options }) if (!url) { return ( <div className={styles.componentWrapper}> <p>Hmm. Having problems constructing the web front-end URL.</p> </div> ) } return ( <div className={styles.componentWrapper}> <SanityMobilePreview> <div className={styles.iframeContainer}> <iframe src={url} frameBorder={'0'} /> </div> </SanityMobilePreview> </div> ) } IframeMobilePreview.propTypes = { document: PropTypes.object // eslint-disable-line react/forbid-prop-types } IframeMobilePreview.defaultProps = { document: null } export default IframeMobilePreview
src/routes/Charts/ReCharts/components/ChartsGallery.js
taikongfeizhu/webpack-develop-startkit
/** * Created by huangjian on 2017/4/21. */ import React from 'react' import { Row, Col } from 'antd' import { SimpleLineChart, BarChart, RadialBarChart, RadarChart } from 'components/Recharts' import CustomCard from 'components/CustomCard' class ChartsGallery extends React.Component { render () { return ( <div className='gutter-example'> <Row gutter={16}> <Col className='gutter-row' md={24}> <div className='gutter-box'> <CustomCard title='基础线形图'> <SimpleLineChart /> </CustomCard> </div> </Col> </Row> <Row gutter={16}> <Col className='gutter-row' md={24}> <div className='gutter-box'> <CustomCard title='基础线形图'> <BarChart /> </CustomCard> </div> </Col> </Row> <Row gutter={16}> <Col className='gutter-row' md={12}> <div className='gutter-box'> <CustomCard title='基础线形图'> <RadialBarChart /> </CustomCard> </div> </Col> <Col className='gutter-row' md={12}> <div className='gutter-box'> <CustomCard title='基础线形图'> <RadarChart /> </CustomCard> </div> </Col> </Row> </div> ) } } export default ChartsGallery
src/views/components/AudioStream.js
physiii/home-gateway
import React from 'react'; import PropTypes from 'prop-types'; import JSMpeg from '../../lib/jsmpeg/jsmpeg.min.js'; import {connect} from 'react-redux'; import {audioStartStream, audioStopStream, cameraStartAudioRecordingStream, cameraStopAudioRecordingStream} from '../../state/ducks/services-list/operations.js'; import './AudioStream.css'; export class AudioStream extends React.Component { constructor (props) { super(props); this.resourceStreamingStatus = {}; this.canvas = React.createRef(); } componentDidMount () { this.bootstrapPlayer(); if (this.props.autoplay) { this.start(); } } shouldComponentUpdate (nextProps) { const didRecordingChange = (nextProps.recording && nextProps.recording.id) !== (this.props.recording && this.props.recording.id), didAudioChange = nextProps.audioServiceId !== this.props.audioServiceId, didTokenChange = nextProps.streamingToken !== this.props.streamingToken; // Check to see if shouldStream changed and, if so, start or stop the stream. if (!this.props.shouldStream && nextProps.shouldStream) { this.start(); } else if (this.props.shouldStream && !nextProps.shouldStream) { this.stop(); } // Only re-render if the audio or recording changes. This prevents // unnecessary re-bootstrapping of JSMpeg. if (didRecordingChange || didAudioChange) { // Stop the stream for the current recording or audio. this.stop(); return true; } // Update if the token changes so JSMpeg can bootstrap with the new token. if (didTokenChange) { return true; } return false; } componentDidUpdate () { this.bootstrapPlayer(); } componentWillUnmount () { this.stop(); if (this.player) { this.player.destroy(); } } start () { const streamId = this.getStreamIdForCurrentResource(); // Play JSMpeg. Need to match exactly false because of JSMpeg quirks. if (this.player && this.player.isPlaying === false) { this.player.play(); } if (this.resourceStreamingStatus[streamId]) { return; } this.props.startStreaming(); this.resourceStreamingStatus[streamId] = true; } stop () { const streamId = this.getStreamIdForCurrentResource(); // Pause JSMpeg. if (this.player && this.player.isPlaying) { this.player.pause(); } if (!this.resourceStreamingStatus[streamId]) { return; } this.props.stopStreaming(); this.resourceStreamingStatus[streamId] = false; } getStreamIdForCurrentResource () { return this.props.recording ? this.props.recording.id : this.props.audioServiceId; } bootstrapPlayer () { if (this.player) { // this.player.destroy(); } this.player = new JSMpeg.Player( this.props.streamingHost + '?stream_id=' + this.getStreamIdForCurrentResource() + '&stream_token=' + this.props.streamingToken, { canvas: this.canvas.current, disableGl: true } ); if (this.props.shouldStream) { this.start(); } else { this.stop(); } } render () { return ( <canvas className={this.props.className} styleName="canvas" ref={this.canvas} /> ); } } AudioStream.propTypes = { audioServiceId: PropTypes.string.isRequired, recording: PropTypes.object, // TODO: Shape of recording object streamingToken: PropTypes.string, streamingHost: PropTypes.string, shouldStream: PropTypes.bool, // autoplay will start the stream only once when the component mounts. autoplay: PropTypes.bool, // className can be passed in to override the default CSS class. className: PropTypes.string, startStreaming: PropTypes.func.isRequired, stopStreaming: PropTypes.func.isRequired }; export const mapStateToProps = (state) => { const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; return { streamingHost: protocol + '//' + window.location.hostname + ':' + state.config.stream_port + '/stream-relay' }; }, mapDispatchToProps = (dispatch, ownProps) => { return { startStreaming: () => { if (ownProps.recording) { dispatch(cameraStartAudioRecordingStream(ownProps.recording)); } else { dispatch(audioStartStream(ownProps.audioServiceId)); } }, stopStreaming: () => { if (ownProps.recording) { dispatch(cameraStopAudioRecordingStream(ownProps.recording)); } else { dispatch(audioStopStream(ownProps.audioServiceId)); } } }; }; export default connect(mapStateToProps, mapDispatchToProps)(AudioStream);
envkey-react/src/components/env_manager/env_cell/editable_entry_cell.js
envkey/envkey-app
import React from 'react' import EntryCell from './entry_cell' import Editable from './traits/editable' // Make editable entry cell class const EditableEntryCellBase = Editable(EntryCell) export default class EditableEntryCell extends EditableEntryCellBase { _transformInputVal(val){ const res = val.trim() return this.props.app.autoCaps ? res.toUpperCase() : res } _inputPlaceholder(){ return "VARIABLE_NAME" } }
public/src/js/components/workspace/workspace.js
Robertmw/imagistral
/** * * Workspace Component * @parent none * @author Robert P. * */ import React from 'react'; import BaseComponent from '../base-component/base-component'; import {branch} from 'baobab-react/higher-order'; import Classnames from 'classnames'; import * as actions from './actions'; import {engineInit, deleteEngine} from '../../engine/engine'; const displayName = 'Workspace'; class Workspace extends BaseComponent { constructor (props) { super(props); this._bind( '_shouldRenderCanvas', '_openCanvasPopup', '_clearWorkspace'); } _shouldRenderCanvas(props) { if (props.width === null && props.height === null) { return ( <div className="canvas__intro"> <span className="icon-smiley big" /> <div className="canvas__intro__title"> <span>Create a </span> <div className = "canvas__intro__btn" onClick = {this.props.actions.openNewcanvasPopup} > <span className="icon-file" /> <span> new canvas</span> </div> </div> </div> ); } return (<div/>); } _openCanvasPopup(e) { if (this.props.canvas.width === null && this.props.canvas.height === null) { this.props.actions.openNewcanvasPopup(); } } _clearWorkspace() { deleteEngine(); this.props.actions.deleteCanvas(); } render() { const workspace = this.props.workspace; const canvas = this.props.canvas; const canvasClass = Classnames({ 'canvas--sheet': true, 'active': canvas.width !== null && canvas.height !== null }); const createClass = Classnames({ 'settingsEl': true, 'settingsEl--unavailable': canvas.width !== null && canvas.height !== null }); const deleteClass = Classnames({ 'settingsEl': true, 'settingsEl--unavailable': canvas.width === null && canvas.height === null }); const zoomInClass = Classnames({ 'icon-plus': true, 'unavailable': !workspace.zoomIn }); const zoomOutClass = Classnames({ 'icon-minus': true, 'unavailable': !workspace.zoomOut }); const canvasOrNot = this._shouldRenderCanvas(canvas); return ( <section className="workspace"> <section className="settingsBar"> <div className = {createClass} onClick = {this._openCanvasPopup} > <span className="icon-file" /> <p>New canvas</p> </div> <div className = {deleteClass} onClick = {this._clearWorkspace} > <span className="icon-trash" /> <p>Delete canvas</p> </div> <div className="settingsEl settingsEl--zoom"> <span className={zoomOutClass} onClick={this.props.actions.zoomOut} ></span> <span className="icon-magnifier"></span> <span className={zoomInClass} onClick={this.props.actions.zoomIn} ></span> <div className="custom-select"> <label className="current-zoom"> {workspace.zoom + '%'} </label> </div> </div> </section> {canvasOrNot} </section> ); } } export default branch(Workspace, { cursors: { workspace: ['workspace'], canvas: ['canvas'] }, actions: { zoomIn: actions.zoomIn, zoomOut: actions.zoomOut, openNewcanvasPopup: actions.openNewcanvasPopup, deleteCanvas: actions.deleteCanvas } });
app/components/App.js
wee911/polling_app_demo
/** * Created by apple on 5/22/16. */ import React from 'react'; import Footer from './Footer'; import Navbar from './Navbar'; class App extends React.Component { render() { return ( <div> <Navbar history={this.props.history} /> {this.props.children} <Footer /> </div> ); } } export default App;
src/js/components/ItemArticle/index.js
waagsociety/ams.datahub.client
import React from 'react' import { fields } from '../../config' function targetBlank(event) { event.preventDefault() const { target } = event } export default function(metadata) { let { title, description, reference, dspace } = metadata title = title.join('') reference = reference.map((link, i) => { return <a className='primary button' key={i} href='#' onClick={targetBlank} target="_blank"> <i className="fa fa-external-link" aria-hidden="true"></i> View Source </a> }) dspace = dspace.map((link, i) => { return <a className='secondary button' key={i} href='#' onClick={targetBlank} target="_blank"> View in dSpace </a> }) const fieldList = fields.tags.reduce((result, item, index) => { const { key } = item const data = metadata[key] if (data.length) { const list = <li key={index}> <header>{item.name}</header> <ul>{ data.map((item, index) => { return <li key={index}> <a className='tag' href={`#${key}=${item}`}>{item}</a> </li> }) }</ul> </li> result.push(list) } return result }, []) return <div> <header className='datasetheader'> <h1>{title}</h1> </header> <section className='datasetbody'> {reference} {dspace} </section> <section className="datasetinformation"> </section> <footer className='datasetfooter'> <ul className='metadata fields'>{fieldList}</ul> </footer> </div> }
src/svg-icons/social/poll.js
tan-jerene/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let SocialPoll = (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-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"/> </SvgIcon> ); SocialPoll = pure(SocialPoll); SocialPoll.displayName = 'SocialPoll'; SocialPoll.muiName = 'SvgIcon'; export default SocialPoll;
src/js/components/Table/stories/CustomThemed/Custom.js
HewlettPackard/grommet
import React from 'react'; import { Box, Grommet, Table, TableBody, TableCell, TableFooter, TableHeader, TableRow, Text, } from 'grommet'; import { data, columns } from '../data'; const customTheme = { global: { font: { family: 'Helvetica', }, }, table: { body: { align: 'center', pad: { horizontal: 'large', vertical: 'xsmall' }, border: 'horizontal', }, extend: () => `font-family: Arial`, footer: { align: 'start', border: undefined, pad: { horizontal: 'large', vertical: 'small' }, verticalAlign: 'bottom', }, header: { align: 'center', border: 'bottom', fill: 'horizontal', pad: { horizontal: 'large', vertical: 'xsmall' }, verticalAlign: 'bottom', background: { color: 'accent-1', opacity: 'strong', }, }, }, }; export const Custom = () => ( <Grommet theme={customTheme}> <Box align="center" pad="large"> <Table caption="Custom Theme Table"> <TableHeader> <TableRow> {columns.map((c) => ( <TableCell key={c.property} scope="col" align={c.align}> <Text>{c.label}</Text> </TableCell> ))} </TableRow> </TableHeader> <TableBody> {data.map((datum) => ( <TableRow key={datum.id}> {columns.map((c) => ( <TableCell key={c.property} scope={c.dataScope} align={c.align}> <Text>{c.format ? c.format(datum) : datum[c.property]}</Text> </TableCell> ))} </TableRow> ))} </TableBody> <TableFooter> <TableRow> {columns.map((c) => ( <TableCell key={c.property} align={c.align}> <Text>{c.footer}</Text> </TableCell> ))} </TableRow> </TableFooter> </Table> </Box> </Grommet> ); export default { title: 'Visualizations/Table/Custom Themed/Custom', };
Realization/frontend/czechidm-core/src/components/basic/PasswordStrength/PasswordStrength.js
bcvsolutions/CzechIdMng
import React from 'react'; import PropTypes from 'prop-types'; import zxcvbn from 'zxcvbn'; // import AbstractFormComponent from '../AbstractFormComponent/AbstractFormComponent'; import Tooltip from '../Tooltip/Tooltip'; import Icon from '../Icon/Icon'; const INFO_WEAK = 'weak'; const INFO_OKAY = 'okay'; const INFO_STRONG = 'strong'; const INFO_GREAT = 'great'; /** * Component for strength estimator, with string validation from zxcvbn */ class PasswordStrength extends AbstractFormComponent { constructor(props) { super(props); const { initialStrength } = this.props; this.state = { strength: initialStrength, strengthStyle: 'danger', info: 'weak' }; } UNSAFE_componentWillReceiveProps(nextProps) { const { value } = nextProps; this._getStrength(value); } _getStrength(value) { if (value !== null) { const { max } = this.props; const response = zxcvbn(value, ['heslo', 'heslo1', 'heslo123']); // TODO: move to dictionary configuration let strengthStyle = 'danger'; if (response.score > 3) { strengthStyle = 'success'; } else if (response.score > 1) { strengthStyle = 'warning'; } let strength = response.score; // we dont want score for value = "", or null if (value) { strength += 1; } let width; if (strength !== 0) { width = (100 / (max / strength)); } else { width = 0; } let info; let background; if (width >= 75) { info = INFO_GREAT; background = 'green'; } else if (width >= 50) { info = INFO_STRONG; background = 'orange'; } else if (width >= 25) { info = INFO_OKAY; background = 'red'; } else { info = INFO_WEAK; background = 'darkred'; } this.setState({ strength, strengthStyle, width, info, background }); } } render() { const { spanClassName, isTooltip, triggerForTooltip, isIcon, placementForTooltip, opacity, icon, tooltip } = this.props; const { background, info, width } = this.state; return ( <Tooltip trigger={triggerForTooltip} ref="popover" placement={placementForTooltip} value={`${tooltip || this.i18n('content.password.change.passwordChangeTooltip')} ${this.i18n('content.password.strength.' + info)}`} rendered={isTooltip} > <span className={spanClassName} style={{ opacity, paddingBottom: '5px'}}> <Icon icon={icon} showLoading={false} rendered={isIcon} /> <span className="strength-estimator" style={{ width: width + '%', background }}></span> </span> </Tooltip> ); } } PasswordStrength.propTypes = { spanClassName: PropTypes.string, triggerForTooltip: PropTypes.array, placementForTooltip: PropTypes.string, tooltip: PropTypes.string, max: PropTypes.number.isRequired, icon: PropTypes.string, isIcon: PropTypes.bool, isTooltip: PropTypes.bool, initialStrength: PropTypes.number, opacity: PropTypes.number, value: PropTypes.string }; PasswordStrength.defaultProps = { spanClassName: null, triggerForTooltip: ['hover'], placementForTooltip: 'right', initialStrength: 0, isIcon: true, isTooltip: true, opacity: 0.54, icon: 'lock', value: null }; export default PasswordStrength;
examples/huge-apps/components/Dashboard.js
arusakov/react-router
import React from 'react'; import { Link } from 'react-router'; class Dashboard extends React.Component { render () { let { courses } = this.props; return ( <div> <h2>Super Scalable Apps</h2> <p> Open the network tab as you navigate. Notice that only the amount of your app that is required is actually downloaded as you navigate around. Even the route configuration objects are loaded on the fly. This way, a new route added deep in your app will not affect the initial bundle of your application. </p> <h2>Courses</h2>{' '} <ul> {courses.map(course => ( <li key={course.id}> <Link to={`/course/${course.id}`}>{course.name}</Link> </li> ))} </ul> </div> ); } } export default Dashboard;
app/components/Toggle/index.js
7ruth/PadStats2
/** * * LocaleToggle * */ import React from 'react'; import Select from './Select'; import ToggleOption from '../ToggleOption'; function Toggle(props) { let content = (<option>--</option>); // If we have items, render them if (props.values) { content = props.values.map((value) => ( <ToggleOption key={value} value={value} message={props.messages[value]} /> )); } return ( <Select value={props.value} onChange={props.onToggle}> {content} </Select> ); } Toggle.propTypes = { onToggle: React.PropTypes.func, values: React.PropTypes.array, value: React.PropTypes.string, messages: React.PropTypes.object, }; export default Toggle;
src/svg-icons/editor/format-align-justify.js
verdan/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let EditorFormatAlignJustify = (props) => ( <SvgIcon {...props}> <path d="M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"/> </SvgIcon> ); EditorFormatAlignJustify = pure(EditorFormatAlignJustify); EditorFormatAlignJustify.displayName = 'EditorFormatAlignJustify'; EditorFormatAlignJustify.muiName = 'SvgIcon'; export default EditorFormatAlignJustify;
test/demo/ssr/pages/Index.js
picidaejs/picidaejs
import React from 'react' import {Link} from 'react-router' export default () => <div> <h1>Index Pages</h1> <Link to="/other">Link to Other</Link> </div>
app/templates/component_templates/ButtonsExample/index.js
tblazina/analytics_project
/** * * Buttons * */ import React from 'react'; import { FormattedMessage } from 'react-intl'; import messages from './messages'; import styles from './styles.css'; class Buttons extends React.Component { // eslint-disable-line react/prefer-stateless-function render() { return ( <div className={styles.buttons}> <h1>{this.props.value}</h1> <button onClick={this.props.incrementAction}>+</button> <button onClick={this.props.decrementAction}>-</button> </div> ); } } export default Buttons;
src/routes/main/users/create/Create.js
labzero/lunch
import React from 'react'; import withStyles from 'isomorphic-style-loader/lib/withStyles'; import Grid from 'react-bootstrap/lib/Grid'; import s from './Create.scss'; const Create = () => ( <div className={s.root}> <Grid> <h2>Success</h2> <p>User created.</p> </Grid> </div> ); export default withStyles(s)(Create);
src/form/FormLabel.js
kosiakMD/react-native-elements
import PropTypes from 'prop-types'; import React from 'react'; import { StyleSheet, View, Platform, Text as NativeText } from 'react-native'; import colors from '../config/colors'; import fonts from '../config/fonts'; import Text from '../text/Text'; import normalize from '../helpers/normalizeText'; import ViewPropTypes from '../config/ViewPropTypes'; const FormLabel = props => { const { containerStyle, labelStyle, children, fontFamily, ...attributes } = props; return ( <View style={[styles.container, containerStyle && containerStyle]} {...attributes} > <Text style={[ styles.label, labelStyle && labelStyle, fontFamily && { fontFamily }, ]} > {children} </Text> </View> ); }; FormLabel.propTypes = { containerStyle: ViewPropTypes.style, labelStyle: NativeText.propTypes.style, children: PropTypes.any, fontFamily: PropTypes.string, }; const styles = StyleSheet.create({ container: {}, label: { marginLeft: 20, marginRight: 20, marginTop: 15, marginBottom: 1, color: colors.grey3, fontSize: normalize(12), ...Platform.select({ ios: { fontWeight: 'bold', }, android: { ...fonts.android.bold, }, }), }, }); export default FormLabel;
docs/Documentation/BadgePage.js
reactivers/react-mcw
/** * Created by muratguney on 29/03/2017. */ import React from 'react'; import {Card, CardHeader,Badge,Table, TableRow, TableHeaderColumn, TableHeader, TableRowColumn, TableBody} from '../../lib'; import HighLight from 'react-highlight.js' export default class BadgePage extends React.Component { state = {dialog: false}; render() { let document = [ 'import React from "react";', 'import {Badge} from "react-material-design";', '', 'export default class Example extends React.Component {', '', ' render(){', ' return (', ' <div>', ' <Badge iconName="notifications" label="10" ></Badge>', ' <Badge iconName="notifications" label="10" iconSize={40} badgeColor={"purple"} />', ' </div>', ' )', ' }', ' }', ].join('\n'); return ( <Card style={{padding: 8}}> <CardHeader title="Badge"/> <Card shadow={3} style={{padding: 29}}> <div style={{display:"flex"}}> <Badge iconName="notifications" label="10"/> <Badge iconName="notifications" label="10" iconSize={40} badgeColor={"purple"} /> </div> </Card> <pre> <code className="h"> </code> </pre> <HighLight language="javascript"> {document} </HighLight> <CardHeader title="Badge properties"/> <Table> <TableHeader> <TableRow> <TableHeaderColumn>Props</TableHeaderColumn> <TableHeaderColumn>Type</TableHeaderColumn> <TableHeaderColumn>Description</TableHeaderColumn> </TableRow> </TableHeader> <TableBody> <TableRow> <TableRowColumn>iconName</TableRowColumn> <TableRowColumn>String</TableRowColumn> <TableRowColumn>Any material icon for badge.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>label</TableRowColumn> <TableRowColumn>String</TableRowColumn> <TableRowColumn>Badge text.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>badgeColor</TableRowColumn> <TableRowColumn>String</TableRowColumn> <TableRowColumn longText>Color of badge.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>style</TableRowColumn> <TableRowColumn>Object</TableRowColumn> <TableRowColumn longText>Set style of badge.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>badgeStyle</TableRowColumn> <TableRowColumn>Object</TableRowColumn> <TableRowColumn longText>Set style of badge.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>buttonStyle</TableRowColumn> <TableRowColumn>Object</TableRowColumn> <TableRowColumn longText>Style of badge button.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>iconSize</TableRowColumn> <TableRowColumn>Number</TableRowColumn> <TableRowColumn longText>Size of icon.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>onClick</TableRowColumn> <TableRowColumn>Function</TableRowColumn> <TableRowColumn longText>Fire when clicked badge button.</TableRowColumn> </TableRow> </TableBody> </Table> </Card> ) } }
webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/UpdateDialog.js
adamruzicka/katello
import React from 'react'; import PropTypes from 'prop-types'; import { sprintf, translate as __ } from 'foremanReact/common/I18n'; import { MessageDialog } from 'patternfly-react'; import { buildPools } from '../../SubscriptionsTableHelpers'; import { renderTaskStartedToast } from '../../../../../Tasks/helpers'; import { BLOCKING_FOREMAN_TASK_TYPES } from '../../../../SubscriptionConstants'; const UpdateDialog = ({ show, updatedQuantity, updateQuantity, showUpdateConfirm, bulkSearch, organization, task, enableEditing, }) => { const quantityLength = Object.keys(updatedQuantity).length; const confirmEdit = () => { showUpdateConfirm(false); if (quantityLength > 0) { updateQuantity(buildPools(updatedQuantity)) .then(() => bulkSearch({ action: `organization '${organization.owner_details.displayName}'`, result: 'pending', label: BLOCKING_FOREMAN_TASK_TYPES.join(' or '), })) .then(() => renderTaskStartedToast(task)); } enableEditing(false); }; return ( <MessageDialog show={show} title={__('Editing Entitlements')} secondaryContent={ // eslint-disable-next-line react/no-danger <p dangerouslySetInnerHTML={{ __html: sprintf( __("You're making changes to %(entitlementCount)s entitlement(s)"), { entitlementCount: `<b>${quantityLength}</b>`, }, ), }} /> } primaryActionButtonContent={__('Save')} primaryAction={confirmEdit} secondaryActionButtonContent={__('Cancel')} secondaryAction={() => showUpdateConfirm(false)} onHide={() => showUpdateConfirm(false)} />); }; UpdateDialog.propTypes = { show: PropTypes.bool.isRequired, updateQuantity: PropTypes.func.isRequired, updatedQuantity: PropTypes.shape(PropTypes.Object).isRequired, showUpdateConfirm: PropTypes.func.isRequired, bulkSearch: PropTypes.func, organization: PropTypes.shape({ owner_details: PropTypes.shape({ displayName: PropTypes.string, }), }), task: PropTypes.shape({}), enableEditing: PropTypes.func.isRequired, }; UpdateDialog.defaultProps = { task: { humanized: {} }, bulkSearch: undefined, organization: undefined, }; export default UpdateDialog;
src/ShallowTraversal.js
toddw/enzyme
import React from 'react'; import isEmpty from 'lodash/isEmpty'; import isSubset from 'is-subset'; import { coercePropValue, propsOfNode, isSimpleSelector, splitSelector, selectorError, isCompoundSelector, selectorType, AND, SELECTOR, nodeHasType, } from './Utils'; export function childrenOfNode(node) { if (!node) return []; const maybeArray = propsOfNode(node).children; const result = []; React.Children.forEach(maybeArray, child => { if (child !== null && child !== false && typeof child !== 'undefined') { result.push(child); } }); return result; } export function hasClassName(node, className) { const classes = propsOfNode(node).className || ''; return ` ${classes} `.indexOf(` ${className} `) > -1; } export function treeForEach(tree, fn) { if (tree !== null && tree !== false && typeof tree !== 'undefined') { fn(tree); } childrenOfNode(tree).forEach(node => treeForEach(node, fn)); } export function treeFilter(tree, fn) { const results = []; treeForEach(tree, node => { if (fn(node)) { results.push(node); } }); return results; } function pathFilter(path, fn) { return path.filter(tree => treeFilter(tree, fn).length !== 0); } export function pathToNode(node, root) { const queue = [root]; const path = []; const hasNode = (testNode) => node === testNode; while (queue.length) { const current = queue.pop(); const children = childrenOfNode(current); if (current === node) return pathFilter(path, hasNode); path.push(current); if (children.length === 0) { // leaf node. if it isn't the node we are looking for, we pop. path.pop(); } queue.push.apply(queue, children); } return null; } export function parentsOfNode(node, root) { return pathToNode(node, root).reverse(); } export function nodeHasId(node, id) { return propsOfNode(node).id === id; } export function nodeHasProperty(node, propKey, stringifiedPropValue) { const nodeProps = propsOfNode(node); const propValue = coercePropValue(propKey, stringifiedPropValue); const descriptor = Object.getOwnPropertyDescriptor(nodeProps, propKey); if (descriptor && descriptor.get) { return false; } const nodePropValue = nodeProps[propKey]; if (nodePropValue === undefined) { return false; } if (propValue) { return nodePropValue === propValue; } return nodeProps.hasOwnProperty(propKey); } export function nodeMatchesObjectProps(node, props) { return isSubset(propsOfNode(node), props); } export function buildPredicate(selector) { switch (typeof selector) { case 'function': // selector is a component constructor return node => node && node.type === selector; case 'string': if (!isSimpleSelector(selector)) { throw selectorError(selector); } if (isCompoundSelector.test(selector)) { return AND(splitSelector(selector).map(buildPredicate)); } switch (selectorType(selector)) { case SELECTOR.CLASS_TYPE: return node => hasClassName(node, selector.substr(1)); case SELECTOR.ID_TYPE: return node => nodeHasId(node, selector.substr(1)); case SELECTOR.PROP_TYPE: { const propKey = selector.split(/\[([a-zA-Z\-]*?)(=|\])/)[1]; const propValue = selector.split(/=(.*?)\]/)[1]; return node => nodeHasProperty(node, propKey, propValue); } default: // selector is a string. match to DOM tag or constructor displayName return node => nodeHasType(node, selector); } case 'object': if (!Array.isArray(selector) && selector !== null && !isEmpty(selector)) { return node => nodeMatchesObjectProps(node, selector); } throw new TypeError( 'Enzyme::Selector does not support an array, null, or empty object as a selector' ); default: throw new TypeError('Enzyme::Selector expects a string, object, or Component Constructor'); } } export function getTextFromNode(node) { if (node === null || node === undefined) { return ''; } if (typeof node === 'string' || typeof node === 'number') { return String(node); } if (node.type && typeof node.type === 'function') { return `<${node.type.displayName || node.type.name} />`; } return childrenOfNode(node).map(getTextFromNode).join('').replace(/\s+/, ' '); }
client/pages/_app.js
RobinClowers/photo-album
import React from 'react' import App from 'next/app' import Head from 'next/head' import { MuiThemeProvider } from '@material-ui/core/styles' import CssBaseline from '@material-ui/core/CssBaseline' import JssProvider from 'react-jss/lib/JssProvider' import getPageContext from 'client/src/getPageContext' import { setReturnUrl } from 'client/src/urls' import { setCsrfCookie } from 'client/src/cookies' import ReactGA from 'react-ga' const initializeGoogleAnalytics = () => { if (!process.env.GA_TRACKING_ID) { console.log("Google Analytics disabled") return } ReactGA.initialize(process.env.GA_TRACKING_ID, { debug: process.env.DEBUG_GA }) ReactGA.pageview(window.location.pathname + window.location.search) } class MyApp extends App { constructor(props) { super(props) this.pageContext = getPageContext() } componentDidMount() { // Make the CSRF token available setCsrfCookie(this.props.pageProps.csrfToken) setReturnUrl(window.location.pathname) // Remove the server-side injected CSS. const jssStyles = document.querySelector('#jss-server-side') if (jssStyles && jssStyles.parentNode) { jssStyles.parentNode.removeChild(jssStyles) } initializeGoogleAnalytics() } render() { const { Component, pageProps } = this.props return ( <> <Head> <title>Robinʼs Photos</title> </Head> {/* Wrap every page in Jss and Theme providers */} <JssProvider registry={this.pageContext.sheetsRegistry} generateClassName={this.pageContext.generateClassName} > {/* MuiThemeProvider makes the theme available down the React tree thanks to React context. */} <MuiThemeProvider theme={this.pageContext.theme} sheetsManager={this.pageContext.sheetsManager} > {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} <CssBaseline /> {/* Pass pageContext to the _document though the renderPage enhancer to render collected styles on server side. */} <Component pageContext={this.pageContext} {...pageProps} /> </MuiThemeProvider> </JssProvider> </> ) } } export default MyApp
app/javascript/mastodon/features/standalone/public_timeline/index.js
hyuki0000/mastodon
import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import StatusListContainer from '../../ui/containers/status_list_container'; import { refreshPublicTimeline, expandPublicTimeline, } from '../../../actions/timelines'; import Column from '../../../components/column'; import ColumnHeader from '../../../components/column_header'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ title: { id: 'standalone.public_title', defaultMessage: 'A look inside...' }, }); @connect() @injectIntl export default class PublicTimeline extends React.PureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; handleHeaderClick = () => { this.column.scrollTop(); } setRef = c => { this.column = c; } componentDidMount () { const { dispatch } = this.props; dispatch(refreshPublicTimeline()); this.polling = setInterval(() => { dispatch(refreshPublicTimeline()); }, 3000); } componentWillUnmount () { if (typeof this.polling !== 'undefined') { clearInterval(this.polling); this.polling = null; } } handleLoadMore = () => { this.props.dispatch(expandPublicTimeline()); } render () { const { intl } = this.props; return ( <Column ref={this.setRef}> <ColumnHeader icon='globe' title={intl.formatMessage(messages.title)} onClick={this.handleHeaderClick} /> <StatusListContainer timelineId='public' loadMore={this.handleLoadMore} scrollKey='standalone_public_timeline' trackScroll={false} /> </Column> ); } }
src/containers/About.js
roybailey/research-react
import React, { Component } from 'react'; class About extends Component { render() { return ( <h1>{this.props.route.title}</h1> ); } } export default About;
geonode/contrib/monitoring/frontend/src/components/cels/geoserver-status/index.js
kartoza/geonode
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import SelectField from 'material-ui/SelectField'; import MenuItem from 'material-ui/MenuItem'; import AverageCPU from '../../molecules/average-cpu'; import AverageMemory from '../../molecules/average-memory'; import styles from './styles'; import actions from './actions'; const mapStateToProps = (state) => ({ cpu: state.geoserverCpuStatus.response, mem: state.geoserverMemStatus.response, interval: state.interval.interval, timestamp: state.interval.timestamp, services: state.services.hostgeoserver, }); @connect(mapStateToProps, actions) class GeoserverStatus extends React.Component { static propTypes = { cpu: PropTypes.object, getCpu: PropTypes.func.isRequired, getMem: PropTypes.func.isRequired, interval: PropTypes.number, mem: PropTypes.object, resetCpu: PropTypes.func.isRequired, resetMem: PropTypes.func.isRequired, services: PropTypes.array, timestamp: PropTypes.instanceOf(Date), } constructor(props) { super(props); this.state = { host: '', }; this.get = ( host = this.state.host, interval = this.props.interval, ) => { this.props.getCpu(host, interval); this.props.getMem(host, interval); }; this.handleChange = (event, target, host) => { this.setState({ host }); this.get(); }; } componentWillReceiveProps(nextProps) { if (nextProps && nextProps.services && nextProps.timestamp) { let host = nextProps.services[0].name; let firstTime = false; if (this.state.host === '') { firstTime = true; this.setState({ host }); } else { host = this.state.host; } if (firstTime || nextProps.timestamp !== this.props.timestamp) { this.get(host, nextProps.interval); } } } componentWillUnmount() { this.props.resetCpu(); this.props.resetMem(); } render() { let cpu = 0; if (this.props.cpu) { cpu = undefined; const data = this.props.cpu.data.data; if (data.length > 0) { if (data[0].data.length > 0) { const metric = data[0].data[0]; cpu = Math.floor(metric.val); } } } let mem = 0; if (this.props.mem) { mem = undefined; const data = this.props.mem.data.data; if (data.length > 0) { if (data[0].data.length > 0) { const metric = data[0].data[0]; mem = Math.floor(metric.val); } } } const hosts = this.props.services ? this.props.services.map((host) => <MenuItem key={host.name} value={host.name} primaryText={ `${host.name} [${host.host}]` } /> ) : undefined; return this.props.services ? ( <div style={styles.content}> <h5>GeoServer HW Status</h5> <SelectField floatingLabelText="Host" value={this.state.host} onChange={this.handleChange} > {hosts} </SelectField> <div style={styles.geonode}> <AverageCPU cpu={cpu} /> <AverageMemory mem={mem} /> </div> </div> ) : null; } } export default GeoserverStatus;
resources/js/app.js
moeen-basra/laravel-react
/** * First we will load all of this project's JavaScript dependencies which * includes React and other helpers. It's a great starting point while * building robust, powerful web applications using React + Laravel. */ require('./bootstrap'); /** * Next, we will create a fresh React component instance and attach it to * the page. Then, you may begin adding components to this application * or customize the JavaScript scaffolding to fit your unique needs. */ import React from 'react' import { render } from 'react-dom' import { Provider } from 'react-redux' import store from './store' import Routes from './routes' import { authCheck } from './modules/auth/store/actions' store.dispatch(authCheck()) render((<Provider store={store}> <Routes/> </Provider>), document.getElementById('app'), )
src/containers/BooksPage.js
great-design-and-systems/cataloguing-app
import * as actions from '../actions/BookActions'; import * as alertActions from '../actions/NotificationActions'; import * as dialogActions from '../actions/DialogActions'; import * as googleActions from '../actions/GoogleBookActions'; import * as headerActions from '../actions/HeaderActions'; import { BookPreviewFooter, BooksPageBody } from '../components/books/'; import { CancelModalFooter, DeleteModalBody } from '../components/common'; import { Book } from '../api/books/'; import { ConnectedBookPreviewPage } from '../containers/BookPreviewPage'; import { LABEL_AN_ERROR_HAS_OCCURRED, LABEL_ADD_BOOK} from '../labels'; import PropTypes from 'prop-types'; import React from 'react'; import { bindActionCreators } from 'redux'; import { browserHistory } from 'react-router'; import { connect } from 'react-redux'; export class BooksPage extends React.Component { constructor(props) { super(props); this.createBook = this.createNewBook.bind(this); this.onRemove = this.onRemoveBook.bind(this); this.searchSubmit = this.onSearchSubmit.bind(this); this.searchInput = this.onSearchInput.bind(this); this.createGoogleBook = this.createBookFromGoogle.bind(this); this.onPreview = this.previewBook.bind(this); } componentWillMount() { this.props.actions.loadBooks(); this.props.googleActions.getNewestBookCarousel(); this.setHeaders(); } componentDidMount(){ this.setHeaders(); } setHeaders() { const headers = {}; headers[LABEL_ADD_BOOK] = { fontIcon: 'plus', onClick: this.createBook }; this.props.headerActions.setHeaderControls(headers); } createNewBook() { browserHistory.push('books/new'); } onRemoveBook(book) { return new Promise((resolve, reject) => { try { this.props.actions.openDialogConfirmBookCancel({ body: <DeleteModalBody itemName={book[Book.TITLE]}/>, footer: <CancelModalFooter reject={reject} resolve={resolve} confirmCancel={() => { this.props.actions.deleteBook(book[Book.BOOK_ID]); this.props.actions.closeDialog(); }} closeDialog={this.props.actions.closeDialog}/> }); } catch (err) { reject(err); } }); } onSearchSubmit(event) { event.preventDefault(); this.props.googleActions.searchSubmit(); } onSearchInput(event) { this.props.googleActions.searchInput(event.target.value); } createBookFromGoogle(bookId, selfLink) { this.props.googleActions.createNewBookFromGoogle(bookId, selfLink) .then(() => { browserHistory.push('/books/new?bookId=' + bookId); this.props.dialogActions.closeDialog(); }) .catch(err => { this.props.alertActions.alertDanger(err.message); }); } previewBook(book) { this.props.dialogActions.openDialog({ title: book[Book.TITLE], body: <ConnectedBookPreviewPage book={book}/>, footer: <BookPreviewFooter closeDialog={this.props.googleActions.closeDialog} readOnly={true}/> }) .catch(error => { this.props.alertActions.alertDanger(error ? error.message : LABEL_AN_ERROR_HAS_OCCURRED); }); } render() { return (<BooksPageBody books={this.props.books} onRemove={this.onRemove} onPreview={this.onPreview} searchBooks={this.props.actions.searchBooks} createBook={this.createBook} searchSubmit={this.searchSubmit} searchInput={this.searchInput} googleBooks={this.props.googleBooks} dialogActions={this.props.dialogActions} ajaxGlobal={this.props.ajaxGlobal} createGoogleBook={this.createGoogleBook}/>); } } BooksPage.defaultProps = { access: ['admin', 'librarian', 'student'] }; BooksPage.propTypes = { actions: PropTypes.object.isRequired, googleActions: PropTypes.object.isRequired, books: PropTypes.array.isRequired, ajaxGlobal: PropTypes.object.isRequired, googleBooks: PropTypes.object.isRequired, dialogActions: PropTypes.object.isRequired, alertActions: PropTypes.object.isRequired, headerActions: PropTypes.object.isRequired }; function mapStateToProps(state) { return { ajaxGlobal: state.ajaxGlobal, books: state.books, googleBooks: state.googleBooks }; } function mapDispatchToProps(dispatch) { return { actions: bindActionCreators(actions, dispatch), googleActions: bindActionCreators(googleActions, dispatch), dialogActions: bindActionCreators(dialogActions, dispatch), alertActions: bindActionCreators(alertActions, dispatch), headerActions: bindActionCreators(headerActions, dispatch) }; } export const ConnectBookPage = connect( mapStateToProps, mapDispatchToProps )(BooksPage);
packages/material-ui-icons/src/Lens.js
AndriusBil/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let Lens = 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 2z" /> </SvgIcon>; Lens = pure(Lens); Lens.muiName = 'SvgIcon'; export default Lens;
app/imports/client/Pages/Article/Components/Summaries.js
FractalFlows/Emergence
import React from 'react' import { compose, pure } from 'recompose' import { get, find } from 'lodash/fp' import { RaisedButton, } from 'material-ui' // Components import { Panel, PanelHeader, PanelBody, PanelHeaderButton, } from '/imports/client/Components/Panel' import ArticleSummary from './SummaryBar' // Helpers import requireLoginAndGoTo from '/imports/client/Utils/requireLoginAndGoTo' function ArticleSummaries({ user, summaries, articleSlug, }){ return ( <Panel> <PanelHeader title="Summaries"> { !find({authorId: get('_id', user), status: 'enabled'}, summaries) ? ( <PanelHeaderButton data-name="add-summary-btn" onClick={() => requireLoginAndGoTo({ pathname: `/article/summary-upsert/${articleSlug}`, state: { modal: true }, })} > Add summary </PanelHeaderButton> ) : null } </PanelHeader> <PanelBody> { summaries.length > 0 ? summaries.map((summary, i) => <ArticleSummary key={i} summary={summary} articleSlug={articleSlug} user={user} /> ) : ( <div style={{ textAlign: 'center', }} > <RaisedButton label="Create a new summary" onClick={() => requireLoginAndGoTo({ pathname: `/article/summary-upsert/${articleSlug}`, state: { modal: true }, })} primary /> </div> ) } </PanelBody> </Panel> ) } export default compose( pure, )(ArticleSummaries)
src/Main/MonkSpreadsheet.js
hasseboulen/WoWAnalyzer
import React from 'react'; import PropTypes from 'prop-types'; import SPELLS from 'common/SPELLS'; class MonkSpreadsheet extends React.Component { static propTypes = { parser: PropTypes.object.isRequired, }; activeNLCTraits = []; render() { const { parser } = this.props; const abilityTracker = parser.modules.abilityTracker; const getAbility = spellId => abilityTracker.getAbility(spellId); const SGability = getAbility(SPELLS.SHEILUNS_GIFT.id); const SGcasts = SGability.casts || 0; const NLC_TRAITS = [ SPELLS.CHAOTIC_DARKNESS_TRAIT, SPELLS.DARK_SORROWS_TRAIT, SPELLS.INFUSION_OF_LIGHT_TRAIT, SPELLS.LIGHTS_EMBRACE_TRAIT, SPELLS.MURDEROUS_INTENT_TRAIT, SPELLS.REFRACTIVE_SHELL_TRAIT, SPELLS.SECURE_IN_THE_LIGHT_TRAIT, SPELLS.SHADOWBIND_TRAIT, SPELLS.SHOCKLIGHT_TRAIT, SPELLS.TORMENT_THE_WEAK_TRAIT, ]; NLC_TRAITS.forEach(item =>{ if(parser.modules.combatants.selected.traitsBySpellId[item.id] > 0) { this.activeNLCTraits.push(item); } }); const styles = { cellBorder: { borderTop: '.5px solid #dddddd' }, table: { borderBottom: '1px solid #dddddd', borderTop: '1px solid #dddddd', align: 'left', padding: '8px', float: 'left', margin: '2px' }, }; return ( <div> <div style={{ padding: '0px 22px 15px 0px' }}>Please use the below table to populate the Player Log section of the Mistweaver Spreadsheet by Garg. <a href="http://www.peakofserenity.com/mistweaver/spreadsheet/" target="_blank" rel="noopener noreferrer">Link to the sheet</a><br /></div> <div> <table style={styles.table}> <tr><td>Fight Length (Minutes)</td></tr> <tr><td>Fight Length (Seconds)</td></tr> <tr style={styles.cellBorder}><td>Mana Remaining</td></tr> <tr style={styles.cellBorder}><td>Absorbless DTPS</td></tr> <tr style={styles.cellBorder}><td>Thunder Focus Tea Casts</td></tr> <tr><td>Effuse</td></tr> <tr><td>Enveloping Mist</td></tr> <tr><td>Essence Font</td></tr> <tr><td>Renewing Mist</td></tr> <tr><td>Vivify</td></tr> <tr style={styles.cellBorder}><td>Total Uplifting Trance procs</td></tr> <tr><td>Unused UT %</td></tr> <tr style={styles.cellBorder}><td>Mana Tea MP5</td></tr> <tr style={styles.cellBorder}><td>Lifecycles-EnM</td></tr> <tr><td>Lifecycles-Vivify</td></tr> <tr style={styles.cellBorder}><td>SotC Mana Return</td></tr> <tr style={styles.cellBorder}><td>Average SG Stacks</td></tr> <tr style={styles.cellBorder}><td>Effective WoS %</td></tr> <tr style={styles.cellBorder}><td>Targets per Celestial Breath</td></tr> <tr style={styles.cellBorder}><td>The Mists of Sheilun Procs</td></tr> <tr><td>Targets per TMoS</td></tr> <tr style={styles.cellBorder}><td>Effective RJW %</td></tr> <tr style={styles.cellBorder}><td>Dancing Mist Healing</td></tr> <tr style={styles.cellBorder}><td>Mastery per EF</td></tr> <tr style={styles.cellBorder}><td>Targets per Essence Font</td></tr> <tr><td>Targets per Chi Burst</td></tr> <tr style={styles.cellBorder}><td>Misc MP5</td></tr> <tr><td>Misc HPS</td></tr> <tr style={styles.cellBorder}><td>Tier 20 2 Piece MP5</td></tr> <tr style={styles.cellBorder}><td>Tier 20 4 Piece Uptime</td></tr> <tr style={styles.cellBorder}><td>Concordance Uptime</td></tr> <tr style={styles.cellBorder}><td>First NLC Trait</td></tr> <tr><td>Second NLC Trait</td></tr> <tr><td>Third NLC Trait</td></tr> <tr style={styles.cellBorder}><td>Tier 21 2 Piece Tranquil Mists</td></tr> <tr><td>Tier 21 4 piece Average Bolts</td></tr> </table> { // This table is separate to allow for easier copy and pasting of the values from this page into the Mistweaver Spreadsheet. } <table style={styles.table}> <tr><td>{Math.floor(parser.fightDuration / 1000 / 60)}</td></tr> <tr><td>{Math.floor((parser.fightDuration / 1000) % 60)}</td></tr> <tr style={styles.cellBorder}><td>{parser.modules.manaValues.endingMana}</td></tr> <tr style={styles.cellBorder}><td>{(parser.modules.damageTaken.total.regular / parser.fightDuration * 1000).toFixed(2)}</td></tr> <tr style={styles.cellBorder}><td>{parser.modules.thunderFocusTea.castsTft}</td></tr> <tr><td>{((parser.modules.thunderFocusTea.castsTftEff / parser.modules.thunderFocusTea.castsTft) || 0).toFixed(4)}</td></tr> <tr><td>{((parser.modules.thunderFocusTea.castsTftEnm / parser.modules.thunderFocusTea.castsTft) || 0).toFixed(4)}</td></tr> <tr><td>{((parser.modules.thunderFocusTea.castsTftEf / parser.modules.thunderFocusTea.castsTft) || 0).toFixed(4)}</td></tr> <tr><td>{((parser.modules.thunderFocusTea.castsTftRem / parser.modules.thunderFocusTea.castsTft) || 0).toFixed(4)}</td></tr> <tr><td>{((parser.modules.thunderFocusTea.castsTftViv / parser.modules.thunderFocusTea.castsTft) || 0).toFixed(4)}</td></tr> <tr style={styles.cellBorder}><td>{parser.modules.upliftingTrance.UTProcsTotal}</td></tr> <tr><td>{(1 - (parser.modules.upliftingTrance.consumedUTProc / parser.modules.upliftingTrance.UTProcsTotal) || 0).toFixed(4)}</td></tr> <tr style={styles.cellBorder}><td>{(parser.modules.manaTea.manaSavedMT / parser.fightDuration * 1000 * 5).toFixed(0)}</td></tr> <tr style={styles.cellBorder}><td>{(parser.modules.combatants.selected.hasTalent(SPELLS.LIFECYCLES_TALENT.id) && ((parser.modules.lifecycles.castsRedViv / (parser.modules.lifecycles.castsRedViv + parser.modules.lifecycles.castsNonRedViv)).toFixed(4))) || 0}</td></tr> <tr><td>{(parser.modules.combatants.selected.hasTalent(SPELLS.LIFECYCLES_TALENT.id) && ((parser.modules.lifecycles.castsRedEnm / (parser.modules.lifecycles.castsRedEnm + parser.modules.lifecycles.castsNonRedEnm)).toFixed(4))) || 0}</td></tr> <tr style={styles.cellBorder}><td>{parser.modules.spiritOfTheCrane.manaReturnSotc}</td></tr> <tr style={styles.cellBorder}><td>{(parser.modules.sheilunsGift.stacksTotalSG / SGcasts || 0).toFixed(0)}</td></tr> <tr style={styles.cellBorder}><td>{(parser.modules.whispersOfShaohao.countWhispersHeal / ((Math.floor(parser.fightDuration / 10000) + parser.modules.sheilunsGift.countEff))).toFixed(4) || 0}</td></tr> <tr style={styles.cellBorder}><td>{(((parser.modules.celestialBreath.healsCelestialBreath / parser.modules.celestialBreath.procsCelestialBreath) / 3) || 0).toFixed(2)}</td></tr> <tr style={styles.cellBorder}><td>{parser.modules.mistsOfSheilun.procsMistsOfSheilun}</td></tr> <tr><td>{(parser.modules.mistsOfSheilun.healsMistsOfSheilun / parser.modules.mistsOfSheilun.procsMistsOfSheilun).toFixed(2) || 0}</td></tr> <tr style={styles.cellBorder}><td>{((parser.modules.combatants.selected.hasTalent(SPELLS.REFRESHING_JADE_WIND_TALENT.id) && ((parser.modules.refreshingJadeWind.healsRJW / parser.modules.refreshingJadeWind.castRJW) / 78)) || 0).toFixed(4)}</td></tr> <tr style={styles.cellBorder}><td>{parser.modules.renewingMist.dancingMistHeal}</td></tr> <tr style={styles.cellBorder}><td>{(((parser.modules.essenceFontMastery.healEF / 2) / parser.modules.essenceFontMastery.castEF) || 0).toFixed(2)}</td></tr> <tr style={styles.cellBorder}><td>{((parser.modules.essenceFont.targetsEF / parser.modules.essenceFont.castEF) || 0).toFixed(2)}</td></tr> <tr><td>{((parser.modules.chiBurst.targetsChiBurst / parser.modules.chiBurst.castChiBurst) || 0).toFixed(2)}</td></tr> <tr style={styles.cellBorder}><td>{((parser.modules.amalgamsSeventhSpine.manaGained / parser.fightDuration * 1000 * 5) || 0) + ((parser.modules.darkmoonDeckPromises.manaGained / parser.fightDuration * 1000 * 5) || 0)}</td></tr> <tr> <td> {(((parser.modules.prydazXavaricsMagnumOpus.healing || 0) + (parser.modules.velensFutureSight.healing || 0) + (parser.modules.drapeOfShame.healing || 0) + (parser.modules.gnawedThumbRing.healing || 0) + (parser.modules.archiveOfFaith.healing + parser.modules.archiveOfFaith.healingOverTime || 0) + (parser.modules.barbaricMindslaver.healing || 0) + (parser.modules.seaStarOfTheDepthmother.healing || 0) + (parser.modules.deceiversGrandDesign.healing + parser.modules.deceiversGrandDesign.healingAbsorb || 0) + (parser.modules.eithas.healing || 0) + (parser.modules.shelterOfRin.healing || 0) + (parser.modules.doorwayToNowhere.healing || 0) + (parser.modules.ovydsWinterWrap.healing || 0) + (parser.modules.eonarsCompassion.totalHeal || 0) + (parser.modules.highfathersMachinations.healing || 0) + (parser.modules.tarratusKeystone.healing || 0)) / parser.fightDuration * 1000).toFixed(0)} </td> </tr> <tr style={styles.cellBorder}><td>{(parser.modules.t20_2set.manaSaved / parser.fightDuration * 1000 * 5).toFixed(0) || 0}</td></tr> <tr style={styles.cellBorder}><td>{(parser.modules.combatants.selected.getBuffUptime(SPELLS.DANCE_OF_MISTS.id) / parser.fightDuration).toFixed(4) || 0}</td></tr> <tr style={styles.cellBorder}><td>{(parser.modules.combatants.selected.getBuffUptime(SPELLS.CONCORDANCE_OF_THE_LEGIONFALL_INTELLECT.id) / parser.fightDuration).toFixed(4) || 0}</td></tr> <tr style={styles.cellBorder}><td>{(this.activeNLCTraits[0]) ? this.activeNLCTraits[0].name : 'N/A'}</td></tr> <tr><td>{(this.activeNLCTraits[1]) ? this.activeNLCTraits[1].name : 'N/A'}</td></tr> <tr><td>{(this.activeNLCTraits[2]) ? this.activeNLCTraits[2].name : 'N/A'}</td></tr> <tr style={styles.cellBorder}><td>{parser.modules.t21_2set.tranquilMistCount || 0}</td></tr> <tr><td>{parser.modules.t21_4set.averageBoltsPerCast || 0}</td></tr> </table> </div> </div> ); } } export default MonkSpreadsheet;
app/scripts/Mobilization/components/MobilizationList/MobilizationListItemHeader/MobilizationListItemHeaderName.js
igr-santos/bonde-client
import React from 'react' const MobilizationListItemHeaderName = () => ( <div className="list-item-header-name px3 col col-5"> Nome <i className="fa fa-long-arrow-down ml1" /> </div> ) export default MobilizationListItemHeaderName
components/Carousel/ControlledCarousel.js
rdjpalmer/bloom
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import cx from 'classnames'; import BtnContainer from '../BtnContainer/BtnContainer'; import Carousel from './Carousel'; import Icon from '../Icon/Icon'; import IndicatorGroup from '../Indicators/IndicatorGroup'; import ScreenReadable from '../ScreenReadable/ScreenReadable'; import m from '../../globals/modifiers.css'; import css from './ControlledCarousel.css'; import getValidIndex from '../../utils/getValidIndex/getValidIndex'; export default class ControlledCarousel extends Component { static propTypes = { accessibilityNextLabel: PropTypes.string, accessibilityPrevLabel: PropTypes.string, children: PropTypes.node.isRequired, className: PropTypes.string, defaultSlideIndex: PropTypes.number, innerClassName: PropTypes.string, showIndicators: PropTypes.bool, slidesToScroll: PropTypes.number, slidesToShow: PropTypes.number, wrapAround: PropTypes.bool, }; static defaultProps = { accessibilityNextLabel: 'Show next slide', accessibilityPrevLabel: 'Show previous slide', defaultSlideIndex: 0, showIndicators: true, slidesToScroll: 1, slidesToShow: 1, wrapAround: false, }; constructor(props) { super(props); this.state = { lowestVisibleItemIndex: props.defaultSlideIndex || 0 }; } handlePreviousSlide = () => { const { lowestVisibleItemIndex } = this.state; const { slidesToScroll } = this.props; this.goToIndex(lowestVisibleItemIndex - slidesToScroll); } handleNextSlide = () => { const { lowestVisibleItemIndex } = this.state; const { slidesToScroll } = this.props; this.goToIndex(lowestVisibleItemIndex + slidesToScroll); } handleChange = (lowestVisibleItemIndex) => { this.setState({ lowestVisibleItemIndex }); } goToIndex(i) { const { slidesToShow, children } = this.props; const nonEmptyChildren = children.filter(item => item); const lowestVisibleItemIndex = getValidIndex(i, nonEmptyChildren.length, slidesToShow); this.setState({ lowestVisibleItemIndex }); } render() { const { lowestVisibleItemIndex } = this.state; const { accessibilityNextLabel, accessibilityPrevLabel, children, className, innerClassName, showIndicators, slidesToShow, wrapAround, ...rest, } = this.props; const nonEmptyChildren = children.filter(item => item); const prevDisabled = !wrapAround && lowestVisibleItemIndex <= 0; const nextDisabled = !wrapAround && lowestVisibleItemIndex >= nonEmptyChildren.length - slidesToShow; const indicatorCount = wrapAround ? nonEmptyChildren.length : nonEmptyChildren.length - (slidesToShow - 1); return ( <div className={ cx(css.root, className) }> <div className={ innerClassName }> <Carousel slidesToShow={ slidesToShow } lowestVisibleItemIndex={ lowestVisibleItemIndex } wrapAround={ wrapAround } onChange={ this.handleChange } { ...rest } > { nonEmptyChildren } </Carousel> </div> <div className={ css.controls }> <BtnContainer onClick={ this.handlePreviousSlide } className={ cx(css.control, css.prev) } disabled={ prevDisabled } > <Icon name="chevron" /> <ScreenReadable>{ accessibilityPrevLabel }</ScreenReadable> </BtnContainer> <BtnContainer onClick={ this.handleNextSlide } className={ cx(css.control, css.next) } disabled={ nextDisabled } > <Icon name="chevron" /> <ScreenReadable>{ accessibilityNextLabel }</ScreenReadable> </BtnContainer> </div> { showIndicators && ( <IndicatorGroup activeIndicator={ lowestVisibleItemIndex } className={ css.indicators }> { indicator => ( <div> { [...Array(indicatorCount)].map((child, i) => indicator({ i, key: i, className: cx(m.dib, m.mt0, m.mrs, css.indicator), })) } </div> ) } </IndicatorGroup> ) } </div> ); } }
src/routes/appointment/components/CancelSection.js
chunkiat82/rarebeauty-ui
/* eslint-disable css-modules/no-unused-class */ /* eslint-disable react/prop-types */ /** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-present 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. */ // http://www.material-ui.com/#/components/select-field import React from 'react'; import RaisedButton from 'material-ui/RaisedButton'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; import withStyles from 'isomorphic-style-loader/lib/withStyles'; import s from './Appointment.css'; import history from '../../../history'; class AppointmentCancelSection extends React.Component { state = { submitted: false, open: false, }; handleClickOpen = that => { that.setState({ open: true }); }; handleClose = async that => { that.props.showLoading(); that.setState({ submitted: true, }); const results = await that.props.post(); that.props.hideLoading(); if (results.errors) { that.setState({ error: 'Error In Creating Appointment' }); console.error('Error In Creating Appointment'); } else { that.setState({ notify: false }); history.push(`/`); } }; render() { const actions = [ <FlatButton label="No" onClick={() => { this.setState({ open: false }); }} />, <FlatButton label="Yes" primary onClick={() => { this.handleClose(this); }} />, ]; return ( <div> <RaisedButton ref={c => { this.submitBtn = c; }} label={this.props.label} secondary fullWidth disabled={this.state.submitted} onClick={() => { this.handleClickOpen(this); }} /> <Dialog title="Are you sure?" actions={actions} modal open={this.state.open} > Please click yes to delete... </Dialog> </div> ); } } export default withStyles(s)(AppointmentCancelSection);
src/components/header.js
dennyjuw/rice-and-noddle
import React, { Component } from 'react'; import { Link } from 'react-router'; export default class Header extends Component { render() { return ( <header className="header row no-gutter"> <div className="col-xs-12"> <h1 className="margin-b-0"><Link to="/">IdBg</Link></h1> <div className="header-logo"> </div> </div> <div className="col-xs-12"> <nav className="navigation clearfix"> <ul className="list-inline pull-left"> <li><Link to={"/category/electrical-electronics"}>Electrical &amp; Electronics</Link></li> <li><Link to={"/category/travel"}>Travel</Link></li> <li><Link to={"/category/computing"}>Computing</Link></li> <li><Link to={"/category/fashion-apparel"}>Fashion &amp; Apparel</Link></li> <li><Link to={"/category/gaming"}>Gaming</Link></li> <li><Link to={"/category/home-garden"}>Home &amp; Garden</Link></li> <li><Link to={"/category/groceries"}>Groceries</Link></li> <li><Link to={"/category/mobile"}>Mobile</Link></li> </ul> <ul className="list-inline pull-right right-nav"> <li><Link to={"/deal/new"}>&#43; Submit deal</Link></li> </ul> </nav> </div> </header> ); } }
src/shared/components/DemoApp/renderConfig.js
LorbusChris/react-universally
/* flow */ import React from 'react'; import { createRender } from 'found'; import App from './DemoApp'; import Error404 from './Error404'; // This function allows us to // createRender({ renderPending, readyReady, renderError }) export default createRender({ renderError: ({ error }) => ( // eslint-disable-line react/prop-types <App> {error.status === 404 ? <Error404 /> : 'Error'} </App> ), });
src/Components/Loading/index.js
gabriel-lopez-lopez/gll-billin-code-challenge
/** * Componente Loading de la aplicación * */ import React, { Component } from 'react'; import { connect } from 'react-redux'; // Estilos personalizados import './loading.less'; // Exportar y utilizar el nombre de la clase no conectada para los tests export class Loading extends Component { constructor(props) { super(props); } render () { const { spinner } = this.props; let _className = (spinner) ? 'active' : ''; return ( <div id="blockLayout" className={_className}> <div className="css3spinner" /> </div> ); } } // Mapea al estado las props const mapStateToProps = (state) => { return { spinner: state.loading.isLoading && !state.loading.isDisabled }; }; // Mapea la acciones a despachar (Actions cretors) a props const mapDispatchToProps = null; // Utilizar la exportación predeterminada para el componente conectado pra la aplicación export default connect(mapStateToProps, mapDispatchToProps)(Loading);
app/components/CheckOutLogInContainer.js
abdelshok/graceShopper
import React from 'react' import {browserHistory} from 'react-router' export const CheckOutLogin = ({ login }) => ( <div className="log-in-form"> <form onSubmit={evt => { evt.preventDefault() login(evt.target.username.value, evt.target.password.value) browserHistory.goBack() } } > <h1 className="log-in-title">Log In</h1> <input name="username" type="username" /> <input name="password" type="password" /> <input type="submit" value="Login" /> </form> </div> ) import {login} from 'APP/app/reducers/auth' import {connect} from 'react-redux' export default connect( null, {login}, )(CheckOutLogin)
src/routes/Events/containers/EventsContainer.js
cvetanov/EventsClient
import React from 'react'; import EventsList from '../components/EventsList'; export default function EventsContainer(props) { return ( <EventsList /> ) }
src/components/BookTable/BookTable.js
k2data/books-ui
import React from 'react' import { Link } from 'react-router' import R from 'ramda' import { Table } from 'antd' export class BookTable extends React.Component { constructor (props) { super(props) this.columns = [{ title: '序号', key: 'order', width: 50, render: (text, record) => { const index = R.findIndex(R.propEq('id', record.id))(this.props.data) return <span>{index}</span> } }, { title: '书名', dataIndex: 'name', key: 'name', render: (text, record) => <Link to={`books/${record.id}`}>{text}</Link> }, { title: '借书人', dataIndex: 'borrowers', key: 'borrowers', width: 200, render: (borrowers) => { return borrowers && borrowers.map((borrower, index) => { return <span key={index} style={{ paddingRight: '5px' }}> {borrower.name} </span> }) } }, { title: '数量', dataIndex: 'quantity', key: 'quantity', width: 90 }, { title: '剩余', key: 'left', width: 90, render: (text, record) => <span> {record.quantity - (record.borrowers ? record.borrowers.length : 0)} </span> }] } render () { const { data } = this.props const pagination = { total: data.length, showSizeChanger: true, onShowSizeChange: (current, pageSize) => { console.log('Current: ', current, ' PageSize: ', pageSize) }, onChange: (current) => { console.log('Current: ', current) } } return ( <Table rowKey='id' columns={this.columns} dataSource={data} pagination={pagination} /> ) } } BookTable.propTypes = { data: React.PropTypes.array } export default BookTable
src/appbar.js
jyasskin/cxxpoll.bak
// Copyright 2015 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. 'use strict'; import React from 'react'; import { AppBar, FlatButton} from 'material-ui'; import { firebaseRoot } from './config'; let PollAppBar = React.createClass({ getTitle() { if (this.props.title === undefined) { return ''; } else if (this.props.title.hasOwnProperty('.value')) { return this.props.title['.value']; } else { return this.props.title; } }, render() { let auth = this.props.auth; let rightButton; if (auth) { rightButton = <FlatButton label="Logout" onTouchTap={this.onLogout}/> } else { rightButton = <FlatButton label="Login" onTouchTap={this.onLogin}/> } return ( <AppBar title={this.getTitle()} iconElementRight={rightButton} /> ); }, onLogin() { firebaseRoot.authWithOAuthPopup("github", function(error, authData) { if (error) { console.log("Authentication Failed!", error); } else { console.log("Authenticated successfully with payload:", authData); firebaseRoot.child(`users/${authData.uid}/name`).transaction(oldValue => { if (oldValue) { // No need to change it. return undefined; } return authData.github.displayName; }) } }); }, onLogout() { firebaseRoot.unauth(); }, }); export default PollAppBar;
examples/huge-apps/components/App.js
arusakov/react-router
import React from 'react'; import Dashboard from './Dashboard'; import GlobalNav from './GlobalNav'; class App extends React.Component { render() { var courses = COURSES; return ( <div> <GlobalNav /> <div style={{ padding: 20 }}> {this.props.children || <Dashboard courses={courses} />} </div> </div> ); } } export default App;
app/components/IssueIcon/index.js
samanshahmohamadi/react-boilerplate-ballyhoo
import React from 'react'; function IssueIcon(props) { return ( <svg height="1em" width="0.875em" className={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> ); } IssueIcon.propTypes = { className: React.PropTypes.string, }; export default IssueIcon;
src/utils/CustomPropTypes.js
roderickwang/react-bootstrap
import React from 'react'; import warning from 'react/lib/warning'; import childrenToArray from './childrenToArray'; const ANONYMOUS = '<<anonymous>>'; /** * Create chain-able isRequired validator * * Largely copied directly from: * https://github.com/facebook/react/blob/0.11-stable/src/core/ReactPropTypes.js#L94 */ function createChainableTypeChecker(validate) { function checkType(isRequired, props, propName, componentName) { componentName = componentName || ANONYMOUS; if (props[propName] == null) { if (isRequired) { return new Error( `Required prop '${propName}' was not specified in '${componentName}'.` ); } } else { return validate(props, propName, componentName); } } let chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; } function errMsg(props, propName, componentName, msgContinuation) { return `Invalid prop '${propName}' of value '${props[propName]}'` + ` supplied to '${componentName}'${msgContinuation}`; } function createMountableChecker() { function validate(props, propName, componentName) { if (typeof props[propName] !== 'object' || typeof props[propName].render !== 'function' && props[propName].nodeType !== 1) { return new Error( errMsg(props, propName, componentName, ', expected a DOM element or an object that has a `render` method') ); } } return createChainableTypeChecker(validate); } function createKeyOfChecker(obj) { function validate(props, propName, componentName) { let propValue = props[propName]; if (!obj.hasOwnProperty(propValue)) { let valuesString = JSON.stringify(Object.keys(obj)); return new Error( errMsg(props, propName, componentName, `, expected one of ${valuesString}.`) ); } } return createChainableTypeChecker(validate); } function createSinglePropFromChecker(arrOfProps) { function validate(props, propName, componentName) { const usedPropCount = arrOfProps .map(listedProp => props[listedProp]) .reduce((acc, curr) => acc + (curr !== undefined ? 1 : 0), 0); if (usedPropCount > 1) { const [first, ...others] = arrOfProps; const message = `${others.join(', ')} and ${first}`; return new Error( `Invalid prop '${propName}', only one of the following ` + `may be provided: ${message}` ); } } return validate; } function all(propTypes) { if (propTypes === undefined) { throw new Error('No validations provided'); } if (!(propTypes instanceof Array)) { throw new Error('Invalid argument must be an array'); } if (propTypes.length === 0) { throw new Error('No validations provided'); } return function(props, propName, componentName) { for(let i = 0; i < propTypes.length; i++) { let result = propTypes[i](props, propName, componentName); if (result !== undefined && result !== null) { return result; } } }; } function createElementTypeChecker() { function validate(props, propName, componentName) { let errBeginning = errMsg(props, propName, componentName, '. Expected an Element `type`'); if (typeof props[propName] !== 'function') { if (React.isValidElement(props[propName])) { return new Error(errBeginning + ', not an actual Element'); } if (typeof props[propName] !== 'string') { return new Error(errBeginning + ' such as a tag name or return value of React.createClass(...)'); } } } return createChainableTypeChecker(validate); } export default { deprecated(propType, explanation){ return function(props, propName, componentName){ if (props[propName] != null) { warning(false, `"${propName}" property of "${componentName}" has been deprecated.\n${explanation}`); } return propType(props, propName, componentName); }; }, isRequiredForA11y(propType){ return function(props, propName, componentName){ if (props[propName] == null) { return new Error( 'The prop `' + propName + '` is required to make ' + componentName + ' accessible ' + 'for users using assistive technologies such as screen readers `' ); } return propType(props, propName, componentName); }; }, requiredRoles(...roles) { return createChainableTypeChecker( function requiredRolesValidator(props, propName, component) { let missing; let children = childrenToArray(props.children); let inRole = (role, child) => role === child.props.bsRole; roles.every(role => { if (!children.some(child => inRole(role, child))){ missing = role; return false; } return true; }); if (missing) { return new Error(`(children) ${component} - Missing a required child with bsRole: ${missing}. ` + `${component} must have at least one child of each of the following bsRoles: ${roles.join(', ')}`); } }); }, exclusiveRoles(...roles) { return createChainableTypeChecker( function exclusiveRolesValidator(props, propName, component) { let children = childrenToArray(props.children); let duplicate; roles.every(role => { let childrenWithRole = children.filter(child => child.props.bsRole === role); if (childrenWithRole.length > 1){ duplicate = role; return false; } return true; }); if (duplicate) { return new Error( `(children) ${component} - Duplicate children detected of bsRole: ${duplicate}. ` + `Only one child each allowed with the following bsRoles: ${roles.join(', ')}`); } }); }, /** * Checks whether a prop provides a DOM element * * The element can be provided in two forms: * - Directly passed * - Or passed an object that has a `render` method * * @param props * @param propName * @param componentName * @returns {Error|undefined} */ mountable: createMountableChecker(), /** * Checks whether a prop provides a type of element. * * The type of element can be provided in two forms: * - tag name (string) * - a return value of React.createClass(...) * * @param props * @param propName * @param componentName * @returns {Error|undefined} */ elementType: createElementTypeChecker(), /** * Checks whether a prop matches a key of an associated object * * @param props * @param propName * @param componentName * @returns {Error|undefined} */ keyOf: createKeyOfChecker, /** * Checks if only one of the listed properties is in use. An error is given * if multiple have a value * * @param props * @param propName * @param componentName * @returns {Error|undefined} */ singlePropFrom: createSinglePropFromChecker, all };
frontend/node_modules/react-router-dom/es/Link.js
justdotJS/rowboat
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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 invariant from 'invariant'; var isModifiedEvent = function isModifiedEvent(event) { return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); }; /** * The public API for rendering a history-aware <a>. */ var Link = function (_React$Component) { _inherits(Link, _React$Component); function Link() { var _temp, _this, _ret; _classCallCheck(this, Link); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function (event) { if (_this.props.onClick) _this.props.onClick(event); if (!event.defaultPrevented && // onClick prevented default event.button === 0 && // ignore right clicks !_this.props.target && // let browser handle "target=_blank" etc. !isModifiedEvent(event) // ignore clicks with modifier keys ) { event.preventDefault(); var history = _this.context.router.history; var _this$props = _this.props, replace = _this$props.replace, to = _this$props.to; if (replace) { history.replace(to); } else { history.push(to); } } }, _temp), _possibleConstructorReturn(_this, _ret); } Link.prototype.render = function render() { var _props = this.props, replace = _props.replace, to = _props.to, innerRef = _props.innerRef, props = _objectWithoutProperties(_props, ['replace', 'to', 'innerRef']); // eslint-disable-line no-unused-vars invariant(this.context.router, 'You should not use <Link> outside a <Router>'); var href = this.context.router.history.createHref(typeof to === 'string' ? { pathname: to } : to); return React.createElement('a', _extends({}, props, { onClick: this.handleClick, href: href, ref: innerRef })); }; return Link; }(React.Component); Link.propTypes = { onClick: PropTypes.func, target: PropTypes.string, replace: PropTypes.bool, to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired, innerRef: PropTypes.oneOfType([PropTypes.string, PropTypes.func]) }; Link.defaultProps = { replace: false }; Link.contextTypes = { router: PropTypes.shape({ history: PropTypes.shape({ push: PropTypes.func.isRequired, replace: PropTypes.func.isRequired, createHref: PropTypes.func.isRequired }).isRequired }).isRequired }; export default Link;
front-end/src/component/projects/index.js
axelmichael11/website
import './_projects.scss' import React from 'react' import {connect} from 'react-redux' import {Redirect} from 'react-router-dom' // import Unsplash from 'Unsplash-js' import ProjectForm from './project-form.js' class Projects extends React.Component{ constructor(props){ super(props) } render(){ return( <div id="projects-container"> <p className="portfolio-title"> Portfolio </p> <ProjectForm className="project-container" title='Course Review API' description="Java Spring Restful API to create and authenticate users, to add courses and reviews." href="https://github.com/axelmichael11/java_spring_restful_api" skills={["Java 8","Spring", "Hibernate"]} /> <ProjectForm className="project-container" title='Poller' description="Web application allowing users to create an account, submit profile demographic information, post and vote on yes or no questions, and see the results anonymously." href="https://poller-eefdf.firebaseapp.com/" skills={['Oauth', "React", "Material-ui",'Heroku', 'Postgresql','NodeJS']} /> <ProjectForm className="project-container" title=' React-Native' description="This is an introduction portfolio of react native mini projects. Each project highlights a separate feature, including AJAX/http requests, authentication, redux, all with firebase" href="https://github.com/axelmichael11/react-native-demos" skills={['Oauth', "React-Native",'Firebase','Redux']} /> <ProjectForm className="project-container" title='Roomlet' description="This is was a group collaboration to build a front-end for startup Roomlet using React and 0Auth." href="https://github.com/Roomlet" skills={['Oauth', "React", "Mocha","Material-UI"]} /> </div> ) } } export default Projects
src/components/person/PersonalInfo.js
landrysoules/mmdb_front_react
import React from 'react'; const PersonalInfo = ({ data }) => { return ( <div> <div> <h3>Personal Info</h3> </div> <h4>Known for</h4> <div>{data.known_for_department}</div> <h4>Gender</h4> <div>{data.gender === 1 ? 'Female' : 'Male'}</div> <h4>Birthday</h4> <div>{data.birthday}</div> <h4>Place of Birth</h4> <div>{data.place_of_birth}</div> </div> ); }; export default PersonalInfo;
src/client/app/createactions.js
Tzitzian/Oppex
import Component from '../components/component.react'; import React from 'react'; import fetch from 'isomorphic-fetch'; import {createValidate} from '../validate'; import * as authActions from '../auth/actions'; import * as todosActions from '../todos/actions'; const actions = [authActions, todosActions]; export default function createActions(BaseComponent) { return class CreateActions extends Component { static propTypes = { flux: React.PropTypes.object.isRequired, msg: React.PropTypes.object.isRequired } createActions() { const {flux, msg} = this.props; const state = () => flux.state.toObject(); const validate = createValidate(() => msg); return actions.reduce((actions, {create, feature, inject}) => { const dispatch = (action, payload) => flux.dispatch(action, payload, {feature}); const deps = [dispatch, validate, fetch, state]; const args = inject ? inject(...deps) : deps; return {...actions, [feature]: create(...args)}; }, {}); } componentWillMount() { this.actions = this.createActions(); } render() { return <BaseComponent {...this.props} actions={this.actions} />; } }; }
client/modules/users/components/.stories/list.js
kaibagoh/PitchSpot
import React from 'react'; import { storiesOf, action } from '@kadira/storybook'; import { setComposerStub } from 'react-komposer'; import List from '../list.jsx'; storiesOf('users.List', module) .add('default view', () => { return ( <List /> ); })
app/js/account/components/DeleteAccountModal.js
blockstack/blockstack-browser
import PropTypes from 'prop-types' import React from 'react' import Modal from 'react-modal' const DeleteAccountModal = props => ( <Modal className="container-fluid" contentLabel={props.contentLabel} isOpen={props.isOpen} onRequestClose={props.closeModal} portalClassName="delete-account-modal" style={{ overlay: { zIndex: 10 } }} shouldCloseOnOverlayClick={false} > <h3 className="modal-heading">Are you sure you want to reset Blockstack Browser?</h3> <div className="modal-body"> <p> Please make sure you have a written copy of your secret recovery phrase before continuing otherwise you will lose access to this account and any money or IDs associated with it. </p> </div> <div className="delete-account-buttons"> <button className="btn btn-danger btn-block" onClick={props.deleteAccount}> Reset browser </button> <button onClick={props.closeModal} className="btn btn-tertiary btn-block"> Cancel </button> </div> </Modal> ) DeleteAccountModal.propTypes = { isOpen: PropTypes.bool.isRequired, contentLabel: PropTypes.string.isRequired, closeModal: PropTypes.func.isRequired, deleteAccount: PropTypes.func.isRequired } export default DeleteAccountModal
src/components/Content.js
occiware/OCCInterface
import React from 'react'; import { connect } from 'react-redux'; import CodeView from './CodeView.js'; import MessageError from './MessageError.js'; import MessageOk from './MessageOk.js'; import InputCurrentPath from './InputCurrentPath.js'; import Reading from './Reading.js'; import GetButton from './buttons/GetButton.js'; import EditButton from './buttons/EditButton.js'; import ActionButton from './buttons/ActionButton.js'; import DelButton from './buttons/DelButton.js'; import ModelButton from './buttons/ModelButton.js'; import {callAPI} from '../utils.js'; import * as actions from '../actions/actionIndex.js'; class Content extends React.Component{ preventClickEffect = () => { $('.dclink').click((e) => { e.preventDefault(); }); $('.playground').click((e) => { e.preventDefault(); }); } componentDidUpdate = () => { this.preventClickEffect(); } clickLinkPlaygroundEvent = (event) => { event.preventDefault(); var link = event.target.href.replace(window.rootURL, ''); link = link.replace('http://', ''); link = link.replace('https://', ''); //we go to the top when clicking on a playground link this.props.goToTop(); this.clickLinkPlayground(link); } clickLinkPlayground = (link) => { //we delete the error message this.setErrorMessage('', ''); //we delete the ok message this.props.dispatch(actions.setOkMessage('')); //we remove the backendURL of the link link = link.replace(window.backendURL, ''); this.props.dispatch(actions.setCurrentQueryPath(link)); this.props.dispatch(actions.setReadableCode()); callAPI( 'GET', link, (data) => { this.props.dispatch(actions.setCurrentJson(data)); //we go up into the textArea $('.mydata').scrollTop(0); }, (xhr) => { this.setErrorMessage('Impossible to access this resource', xhr.status+' '+xhr.responseText); } ) } setErrorMessage = (simple, detailed) => { this.props.dispatch(actions.setErrorMessage(simple,detailed)); } tools = () => { return { clickLinkPlayground: this.clickLinkPlayground } } render() { var errorMessage = this.props.errorMessage.simple ? <MessageError message={this.props.errorMessage.simple} messageErrorDetails={this.props.errorMessage.detailed}/> : null; var okMessage = this.props.okMessage ? <MessageOk message={this.props.okMessage}/> : null; return ( <div className="twelve wide column ui grid"> <div className="row"> <h2 className="ui header"> <i className="configure icon"></i> <div className="content"> OCCI playground </div> </h2> </div> <div className="ui grid main"> <div className="row ui form"> <div className="field adresseget"> <div className="ui label pointing below"> <p>Target URL</p> </div> <InputCurrentPath /> </div> </div> <div className="row ui centered"> <GetButton setErrorMessage={this.setErrorMessage} /> <EditButton setErrorMessage={this.setErrorMessage} /> <ActionButton setErrorMessage={this.setErrorMessage} /> <DelButton setErrorMessage={this.setErrorMessage} /> <ModelButton setErrorMessage={this.setErrorMessage} /> </div> {okMessage} {errorMessage} <CodeView tools={this.tools}/> <Reading reading={this.props.reading} setErrorMessage={this.setErrorMessage} clickLinkPlaygroundEvent={this.clickLinkPlaygroundEvent} goToTop={this.props.goToTop}/> </div> </div> ); } } const mapStateToProps = (state) => ({ errorMessage: state.errorMessage, okMessage: state.okMessage }) export default Content = connect(mapStateToProps)(Content);
src/svg-icons/image/photo-size-select-small.js
nathanmarks/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImagePhotoSizeSelectSmall = (props) => ( <SvgIcon {...props}> <path d="M23 15h-2v2h2v-2zm0-4h-2v2h2v-2zm0 8h-2v2c1 0 2-1 2-2zM15 3h-2v2h2V3zm8 4h-2v2h2V7zm-2-4v2h2c0-1-1-2-2-2zM3 21h8v-6H1v4c0 1.1.9 2 2 2zM3 7H1v2h2V7zm12 12h-2v2h2v-2zm4-16h-2v2h2V3zm0 16h-2v2h2v-2zM3 3C2 3 1 4 1 5h2V3zm0 8H1v2h2v-2zm8-8H9v2h2V3zM7 3H5v2h2V3z"/> </SvgIcon> ); ImagePhotoSizeSelectSmall = pure(ImagePhotoSizeSelectSmall); ImagePhotoSizeSelectSmall.displayName = 'ImagePhotoSizeSelectSmall'; ImagePhotoSizeSelectSmall.muiName = 'SvgIcon'; export default ImagePhotoSizeSelectSmall;
src/pages/hosana.js
vitorbarbosa19/ziro-online
import React from 'react' import BrandGallery from '../components/BrandGallery' export default () => ( <BrandGallery brand='Hosana' /> )
src/components/hero/info/Abilities.js
DragonLegend/game
import React from 'react'; import capitalize from 'capitalize'; import { connect } from 'react-redux'; import { increaseAbility } from '../../../actions/heroActions'; function select(state) { return { hero: state.hero }; } export default connect(select)(({ hero, dispatch }) => ( <div className="uk-panel uk-panel-box"> <h3 className="uk-panel-title">Abilities</h3> <div className="uk-grid"> {['swords', 'axes', 'knives', 'clubs', 'shields'].map((ability) => { const abilityCap = capitalize(ability); return [ <div className="uk-width-4-10">{abilityCap}</div>, <div className="uk-width-1-10"> {hero[ability]} </div>, <div className="uk-width-1-10"> {hero.numberOfAbilities ? ( <a onClick={() => dispatch(increaseAbility(ability))} className="uk-icon-hover uk-icon-plus-circle" /> ) : null} </div>, ]; })} </div> {hero.numberOfAbilities ? <div className="uk-margin-small-top">To increase: {hero.numberOfAbilities}</div> : null} </div> ));
node_modules/rebass/src/Space.js
HasanSa/hackathon
import React from 'react' import Base from './Base' import config from './config' /** * Inline-block element for adding space between elements */ const Space = ({ x, auto, children, ...props }, { rebass }) => { const { scale } = { ...config, ...rebass } return ( <Base {...props} className='Space' baseStyle={{ display: 'inline-block', flex: auto ? '1 1 auto' : null, width: scale[x] }} /> ) } Space.propTypes = { /** Width of space based on the spacing scale */ x: React.PropTypes.oneOf([1, 2, 3, 4]), /** Sets flex: 1 1 auto */ auto: React.PropTypes.bool } Space.defaultProps = { x: 1 } Space.contextTypes = { rebass: React.PropTypes.object } export default Space
src/svg-icons/action/input.js
jacklam718/react-svg-iconx
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionInput = (props) => ( <SvgIcon {...props}> <path d="M21 3.01H3c-1.1 0-2 .9-2 2V9h2V4.99h18v14.03H3V15H1v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2zM11 16l4-4-4-4v3H1v2h10v3z"/> </SvgIcon> ); ActionInput = pure(ActionInput); ActionInput.displayName = 'ActionInput'; ActionInput.muiName = 'SvgIcon'; export default ActionInput;
packages/material-ui-icons/src/MarkunreadMailbox.js
AndriusBil/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let MarkunreadMailbox = props => <SvgIcon {...props}> <path d="M20 6H10v6H8V4h6V0H6v6H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z" /> </SvgIcon>; MarkunreadMailbox = pure(MarkunreadMailbox); MarkunreadMailbox.muiName = 'SvgIcon'; export default MarkunreadMailbox;
src/browser/me/MePage.js
reedlaw/read-it
// @flow import type { State, User } from '../../common/types'; import React from 'react'; import SignOut from '../auth/SignOut'; import getUserPhotoUrl from '../../common/users/getUserPhotoUrl'; import linksMessages from '../../common/app/linksMessages'; import { Box, Image, Text } from '../../common/components'; import { FormattedMessage } from 'react-intl'; import { Link, Title } from '../components'; import { compose } from 'ramda'; import { connect } from 'react-redux'; const HeaderLink = ({ message, ...props }) => ( <FormattedMessage {...message}> {message => ( <Link paddingHorizontal={0.5} {...props}> {message} </Link> )} </FormattedMessage> ); const Header = () => ( <Box flexDirection="row" marginBottom={1} marginHorizontal={-0.5}> <HeaderLink exact to="/me" message={linksMessages.me} /> <HeaderLink to="/me/profile" message={linksMessages.profile} /> <HeaderLink to="/me/settings" message={linksMessages.settings} /> </Box> ); type MePageProps = { children: any, viewer: ?User, }; const MePage = ({ children, viewer }: MePageProps) => !viewer ? null : <Box> <Title message={linksMessages.me} /> <Header /> {children || <Box> <Text>{viewer.displayName}</Text> <Box marginVertical={1}> <Image src={getUserPhotoUrl(viewer)} size={{ height: 100, width: 100 }} title={viewer.displayName} /> </Box> <Box flexDirection="row"> <SignOut /> </Box> </Box>} </Box>; export default compose( connect((state: State) => ({ viewer: state.users.viewer, })), )(MePage);
react/js/form-validation.js
quiaro/js-playground
import React from 'react'; import ReactDOM from 'react-dom'; import Form from './form/Form'; ReactDOM.render(<Form />, document.getElementById('app'));
app/src/components/Header/index.js
civa86/electrophone
import React from 'react'; import { ActionHandler } from '../../components/ActionHandler'; import icon from '../../../img/icon.png'; const Header = (props) => { const { height, repoUrl, libVersion, actions, linkMode, visiblePanel, numSelectedNodes, synthModules } = props; return ( <div id="header" style={{ height: height }}> <div className="header-top container-fluid"> <div className="logo no-select cursor-default pull-left"> <div className="pull-left icon"> <img src={icon} alt="icon"/> </div> <div className="pull-left"> <span className="capital">E</span>lectro<span className="capital">P</span>hone <span className="version visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline"> {libVersion} </span> </div> </div> <div className="links pull-right"> <a className="link-left" href="./docs" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Documentation"> <i className="ion-ios-book"></i> </a> <a href={repoUrl} target="_blank" data-toggle="tooltip" data-placement="bottom" title="GitHub"> <i className="ion-social-github"></i> </a> </div> </div> <div className="menu"> <ul className="container-fluid no-select"> <li className="pull-left"> <a className="cursor-pointer" onClick={() => actions.launchTutorial()} data-toggle="tooltip" data-placement="bottom" title="Help"> <i className="ion-help-circled"></i> <span className="menu-label hidden-xs">Help</span> </a> </li> <li className="pull-left"> <a className="cursor-pointer" onClick={() => actions.resetApplication()} data-toggle="tooltip" data-placement="bottom" title="Reset"> <i className="ion-android-refresh"></i> <span className="menu-label hidden-xs">Reset</span> </a> </li> <li className="pull-left"> <a className="cursor-pointer" onClick={() => actions.openSaveModal()} data-toggle="tooltip" data-placement="bottom" title="Save"> <i className="ion-android-download"></i> <span className="menu-label hidden-xs">Save</span> </a> </li> <li className="pull-left"> <a className="cursor-pointer" onClick={() => actions.openLoadModal()} data-toggle="tooltip" data-placement="bottom" title="Load"> <i className="ion-android-upload"></i> <span className="menu-label hidden-xs">Load</span> </a> </li> <li className="pull-left dropdown module-builder" data-toggle="tooltip" data-placement="top" title="Create New Modules"> <a className="cursor-pointer dropdown-toggle" role="button" data-toggle="dropdown"> <i className="ion-fork-repo"></i> <span className="menu-label hidden-xs">Add</span> </a> <ul className="dropdown-menu"> {synthModules.map(e => { return ( <li key={e.type}> <a className="cursor-pointer" onClick={() => actions.addSynthModule(e.type)}> {e.type} </a> </li> ); })} </ul> </li> <li className="pull-left" data-toggle="tooltip" data-placement="top" title="Toggle Link Mode (SHIFT)"> <a className={'cursor-pointer' + ((linkMode) ? ' selected' : '')} onClick={() => actions.toggleLinkMode()}> <i className="ion-pull-request"></i> <span className="menu-label hidden-xs">Link</span> </a> </li> <li className="pull-left" style={{ display: (visiblePanel === 'graph' && numSelectedNodes > 0) ? 'block' : 'none' }} data-toggle="tooltip" data-placement="top" title="Delete Selected Nodes"> <a className="cursor-pointer" onClick={() => actions.deleteSynthSelectedNodes()}> <i className="ion-trash-b"></i> <span className="menu-label hidden-xs">Delete</span> <span className="delete-counter" style={{ display: (numSelectedNodes > 1) ? 'inline-block' : 'none' }}>&nbsp; {'(' + numSelectedNodes + ')'} </span> </a> </li> <li className="pull-right last-right-item"> <a className={'cursor-pointer' + ((visiblePanel === 'control') ? ' selected' : '')} onClick={() => actions.setViewPanel('control')} data-toggle="tooltip" data-placement="bottom" title="Control view (TAB)"><i className="ion-levels"></i></a> </li> <li className="pull-right"> <a className={'cursor-pointer' + ((visiblePanel === 'graph') ? ' selected' : '')} onClick={() => actions.setViewPanel('graph')} data-toggle="tooltip" data-placement="bottom" title="Graph view (TAB)"><i className="ion-network"></i></a> </li> </ul> </div> </div> ); }; export default ActionHandler(Header);
src/components/Bookmark/Bookmark.js
filipsuk/eventigoApp
/* @flow */ import React from 'react'; import { StyleSheet, TouchableOpacity } from 'react-native'; import { Icon } from 'react-native-elements'; import { colors } from '../../styles'; type Props = { active: boolean, onPress?: Function, size?: number, containerStyle?: any }; const Bookmark = ({ active, onPress, containerStyle, size }: Props) => { return ( <TouchableOpacity style={[styles.container, containerStyle]} onPress={onPress} > <Icon name={active ? 'ios-bookmark' : 'ios-bookmark-outline'} type="ionicon" color={active ? colors.highlight : colors.dark} size={size} underlayColor="transparent" /> </TouchableOpacity> ); }; const styles = StyleSheet.create({ container: { paddingHorizontal: 20, paddingBottom: 20, zIndex: 99 } }); export default Bookmark;
test/test_helper.js
AnushaBalusu/ReactReduxStarterApp
import _$ from 'jquery'; import React from 'react'; import ReactDOM from 'react-dom'; import TestUtils from 'react-addons-test-utils'; import jsdom from 'jsdom'; import chai, { expect } from 'chai'; import chaiJquery from 'chai-jquery'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import reducers from '../src/reducers'; global.document = jsdom.jsdom('<!doctype html><html><body></body></html>'); global.window = global.document.defaultView; global.navigator = global.window.navigator; const $ = _$(window); chaiJquery(chai, chai.util, $); function renderComponent(ComponentClass, props = {}, state = {}) { const componentInstance = TestUtils.renderIntoDocument( <Provider store={createStore(reducers, state)}> <ComponentClass {...props} /> </Provider> ); return $(ReactDOM.findDOMNode(componentInstance)); } $.fn.simulate = function(eventName, value) { if (value) { this.val(value); } TestUtils.Simulate[eventName](this[0]); }; export {renderComponent, expect};
plum/src/components/invoices/show.js
jbkaplan/plum-app
import React, { Component } from 'react'; import { Text, View, Dimensions, StatusBar, Linking, ScrollView, StyleSheet, TouchableHighlight } from 'react-native'; import Icon from 'react-native-vector-icons/Entypo'; import NavigationBar from 'react-native-navbar'; var InvoiceItem = require('../common/invoiceItem'); var Button = require('../common/button'); module.exports = React.createClass({ getInitialState: function() { return { user: null, price: this.props.price }; }, componentWillMount: function(){ // Rails API call to get current user }, componentDidMount: function(){ }, render: function() { var eventName = this.props.event; const rightButtonConfig = { title: 'Next', handler: () => alert('hello!'), }; const leftButtonConfig = { title: 'Back', tintColor: 'rgba(255,255,255,.9)', handler: () => this.props.navigator.pop(), }; const title = this.props.event + ' Invoice' const titleConfig = { title: title, tintColor: 'rgba(255,255,255,.9)', }; var price = this.props.price String(price).charAt(0) const textIcon = <Text><Icon style={styles.icon} name="paypal" size={15} color="white" /> Pay with PayPal</Text> console.log(this.props.payPalUrl) return ( <View style={styles.container}> <View style={styles.navBar}> <StatusBar barStyle="default" style="default" /> <NavigationBar tintColor='rgba(255,255,255,.1)' title={titleConfig} leftButton={leftButtonConfig} /> </View> <View style={styles.logoText}> <Text style={styles.logo}>plum</Text> </View> <View style={[styles.nameContainer]}> <Text style={styles.invoiceTitle}>Invoice: {eventName}</Text> <Text style={styles.title}>Group: {this.props.group}</Text> </View> {this.showPayPalButton()} </View> ) }, border: function(color) { return { borderColor: color, borderWidth: 4 } }, showPayPalButton: function(){ var price = this.props.price const textIcon = <Text><Icon style={styles.icon} name="paypal" size={15} color="white" /> Pay with PayPal</Text> if (String(price).charAt(0) === '-' ) { return ( <View style={styles.buttonArea}> <View style={[styles.priceContainer]}> <Text style={styles.priceTitleLoss}>${this.props.price}</Text> </View> <View style={styles.button}> <Button text={textIcon} onPress={this._onPressButton} /> </View> </View> ); } else { return ( <View style={styles.profitButtonArea}> <View style={[styles.priceContainer]}> <Text style={styles.title}>Incoming Funds:</Text> <Text style={styles.priceTitleProfit}>${this.props.price}</Text> </View> </View> ); } }, getInvoices: function() { // Get invoices from API CALL }, _onPressButton: function() { var url = this.props.payPalUrl Linking.openURL(url) }, }); var width = Dimensions.get('window').width; var styles = StyleSheet.create({ container: { flex: 1, margin: 20 }, title: { textAlign: 'center', fontSize: 24, color: 'white', fontFamily: 'Avenir-Book', }, invoiceTitle: { textAlign: 'center', fontSize: 32, lineHeight: 34, color: 'white', fontFamily: 'Avenir-Heavy', }, nameContainer: { flex: 2, justifyContent: 'center', alignSelf: 'center', padding: 5, marginTop: 20 }, priceContainer: { justifyContent: 'center', alignSelf: 'center', flex: 1 }, button: { width: width, flex: 7, marginBottom: 50, marginTop: 30, justifyContent: 'center', alignItems: 'flex-start', flexDirection: 'row', alignSelf: 'center' }, navBar: { alignSelf: 'stretch', alignItems: 'stretch', margin: -20, }, priceTitle: { textAlign: 'center', fontSize: 50, color: 'white', fontFamily: 'Avenir-Heavy', }, priceTitleLoss: { textAlign: 'center', fontSize: 50, color: '#E3DABB', fontFamily: 'Avenir-Heavy', }, priceTitleProfit: { textAlign: 'center', fontSize: 50, color: '#6AAAA0', fontFamily: 'Avenir-Heavy', }, logo: { justifyContent: 'center', textAlign: 'center', alignItems: 'center', fontFamily: 'Lobster 1.3', color: 'white', fontSize: 120, padding: 15, }, logoText: { marginTop: 65, flex: 2, width: width - 60, alignItems: 'center', justifyContent: 'center', margin: 20 }, buttonArea: { flex: 3 }, profitButtonArea: { flex: 3, marginBottom: 50 } });
index.ios.js
thomaswright/bayst
import React from 'react'; import { AppRegistry } from 'react-native'; import { Examples } from './source' AppRegistry.registerComponent('bayst', () => Examples);
react-app/src/index.js
tanykim/swimmers-history
import React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; import configureStore from './configureStore'; import App from './containers/App'; import './index.css'; const store = configureStore(); render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') );
src/svg-icons/image/filter-7.js
xmityaz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageFilter7 = (props) => ( <SvgIcon {...props}> <path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zm-8-2l4-8V5h-6v2h4l-4 8h2z"/> </SvgIcon> ); ImageFilter7 = pure(ImageFilter7); ImageFilter7.displayName = 'ImageFilter7'; ImageFilter7.muiName = 'SvgIcon'; export default ImageFilter7;
actor-apps/app-web/src/app/components/modals/MyProfile.react.js
ONode/actor-platform
//import _ from 'lodash'; import React from 'react'; import { KeyCodes } from 'constants/ActorAppConstants'; import MyProfileActions from 'actions/MyProfileActions'; import MyProfileStore from 'stores/MyProfileStore'; import AvatarItem from 'components/common/AvatarItem.react'; import Modal from 'react-modal'; import { Styles, TextField, FlatButton } from 'material-ui'; import ActorTheme from 'constants/ActorTheme'; const ThemeManager = new Styles.ThemeManager(); const getStateFromStores = () => { return { profile: MyProfileStore.getProfile(), name: MyProfileStore.getName(), isOpen: MyProfileStore.isModalOpen(), isNameEditable: false }; }; class MyProfile extends React.Component { static childContextTypes = { muiTheme: React.PropTypes.object }; getChildContext() { return { muiTheme: ThemeManager.getCurrentTheme() }; } constructor(props) { super(props); this.state = getStateFromStores(); this.unsubscribe = MyProfileStore.listen(this.onChange); document.addEventListener('keydown', this.onKeyDown, false); ThemeManager.setTheme(ActorTheme); ThemeManager.setComponentThemes({ button: { minWidth: 60 }, textField: { textColor: 'rgba(0,0,0,.87)', focusColor: '#68a3e7', backgroundColor: 'transparent', borderColor: '#68a3e7', disabledTextColor: 'rgba(0,0,0,.4)' } }); } componentWillUnmount() { this.unsubscribe(); document.removeEventListener('keydown', this.onKeyDown, false); } onClose = () => { MyProfileActions.modalClose(); }; onKeyDown = event => { if (event.keyCode === KeyCodes.ESC) { event.preventDefault(); this.onClose(); } }; onChange = () => { this.setState(getStateFromStores()); }; onNameChange = event => { this.setState({name: event.target.value}); }; onNameSave = () => { MyProfileActions.setName(this.state.name); this.onClose(); }; render() { const isOpen = this.state.isOpen; const profile = this.state.profile; if (profile !== null && isOpen === true) { return ( <Modal className="modal-new modal-new--profile" closeTimeoutMS={150} isOpen={isOpen} style={{width: 340}}> <header className="modal-new__header"> <a className="modal-new__header__icon material-icons">person</a> <h4 className="modal-new__header__title">Profile</h4> <div className="pull-right"> <FlatButton hoverColor="rgba(74,144,226,.12)" label="Done" labelStyle={{padding: '0 8px'}} onClick={this.onNameSave} secondary={true} style={{marginTop: -6}}/> </div> </header> <div className="modal-new__body row"> <AvatarItem image={profile.bigAvatar} placeholder={profile.placeholder} size="big" title={profile.name}/> <div className="col-xs"> <div className="name"> <TextField className="login__form__input" floatingLabelText="Username" fullWidth onChange={this.onNameChange} type="text" value={this.state.name}/> </div> <div className="phone"> <TextField className="login__form__input" disabled floatingLabelText="Phone number" fullWidth type="tel" value={this.state.profile.phones[0].number}/> </div> </div> </div> </Modal> ); } else { return null; } } } export default MyProfile;
src/components/Header/Header.js
chentaixu/react-starter-kit
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */ import React from 'react'; import styles from './Header.css'; import withStyles from '../../decorators/withStyles'; import Link from '../../utils/Link'; import Navigation from '../Navigation'; @withStyles(styles) class Header { render() { return ( <div className="Header"> <div className="Header-container"> <a className="Header-brand" href="/" onClick={Link.handleClick}> <img className="Header-brandImg" src={require('./logo-small.png')} width="38" height="38" alt="React" /> <span className="Header-brandTxt">Your Company</span> </a> <Navigation className="Header-nav" /> <div className="Header-banner"> <h1 className="Header-bannerTitle">React</h1> <p className="Header-bannerDesc">Complex web apps made easy</p> </div> </div> </div> ); } } export default Header;
src/components/Statistic/StatisticIndex.js
DOIS/ecampus.kpi.ua
import React from 'react'; // import { Link } from 'react-router-dom'; const StatisticIndex = () => ( <div className="row"> <div className="col-md-12"> <h1>Статистика</h1> <div className="row"> <div className="col-md-12"> <a className="btn btn-primary btn-lg btn-statistic" role="button" href="https://statistic.ecampus.kpi.ua/zkm.html" > Забезпечення кредитного модуля <i className="fa fa-external-link" /> </a> <a className="btn btn-primary btn-lg btn-statistic" role="button" href="https://statistic.ecampus.kpi.ua/npp.html" > Індивідуальне навантаження викладачів{' '} <i className="fa fa-external-link" /> </a> </div> </div> </div> </div> ); export default StatisticIndex;
prototypes/cra-boilerplate/src/404.js
yldio/joyent-portal
import React from 'react'; import styled, { keyframes } from 'styled-components'; import { theme, H1, H2, H3 } from 'joyent-ui-toolkit'; const neon = keyframes` from { text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #f17, 0 0 70px #f17, 0 0 80px #f17, 0 0 100px #f17, 0 0 150px #f17; } to { text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #f17, 0 0 35px #f17, 0 0 40px #f17, 0 0 50px #f17, 0 0 75px #f17; } `; const Title = styled(H1)` color: ${theme.white}; font-family: 'Monoton'; animation: ${neon} 1.5s ease-in-out infinite alternate; font-size: 7em; margin: 20px 0 40px; &:hover { animation: none; color: ${theme.red}; } `; const Container = styled.main` position: fixed; width: 100%; height: 100%; background-color: rgb(30, 30, 30); display: flex; flex-direction: column; justify-content: center; align-items: center; color: ${theme.white}; text-align: center; `; const Code = styled.code` font-family: 'Roboto Mono'; `; const NotFound = ({ name, route }) => ( <Container> <Title>Not Found</Title> <H2> URL: <Code> {window.location.href}</Code> </H2> <H2> Expected page: <Code>pages/{name}</Code> </H2> <H3> Expected export in <Code>src/routes.js</Code>: <br /> <br /> <br /> <Code>{`export { default as ${route} } from './pages/${name}';`}</Code> </H3> </Container> ); export default NotFound;
src/components/ResizeCircle.js
OssamaZ/canvas-play
import React from 'react'; import { Circle } from 'react-konva'; const ResizeCircle = ({x, y, name, resizeCb}) => <Circle x={x} y={y} radius={4} name={name} fill="#fff" stroke='#2790c3' strokeWidth={1} draggable={true} dragOnTop={false} onDragMove={e => resizeCb(e)} onDragEnd={e => { // Prevents redrawing of the resize circle, and let the redux store update take care of it e.cancelBubble = true }} /> export default ResizeCircle;
src/svg-icons/content/remove.js
rhaedes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ContentRemove = (props) => ( <SvgIcon {...props}> <path d="M19 13H5v-2h14v2z"/> </SvgIcon> ); ContentRemove = pure(ContentRemove); ContentRemove.displayName = 'ContentRemove'; export default ContentRemove;
src/svg-icons/editor/border-color.js
jacklam718/react-svg-iconx
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let EditorBorderColor = (props) => ( <SvgIcon {...props}> <path d="M17.75 7L14 3.25l-10 10V17h3.75l10-10zm2.96-2.96c.39-.39.39-1.02 0-1.41L18.37.29c-.39-.39-1.02-.39-1.41 0L15 2.25 18.75 6l1.96-1.96z"/><path fillOpacity=".36" d="M0 20h24v4H0z"/> </SvgIcon> ); EditorBorderColor = pure(EditorBorderColor); EditorBorderColor.displayName = 'EditorBorderColor'; EditorBorderColor.muiName = 'SvgIcon'; export default EditorBorderColor;
src/client.js
paschcua/erikras
/** * THIS IS THE ENTRY POINT FOR THE CLIENT, JUST LIKE server.js IS THE ENTRY POINT FOR THE SERVER. */ import 'babel-polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import createStore from './redux/create'; import ApiClient from './helpers/ApiClient'; import io from 'socket.io-client'; import {Provider} from 'react-redux'; import { Router, browserHistory } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; import { ReduxAsyncConnect } from 'redux-async-connect'; import useScroll from 'scroll-behavior/lib/useStandardScroll'; import getRoutes from './routes'; const client = new ApiClient(); const _browserHistory = useScroll(() => browserHistory)(); const dest = document.getElementById('content'); const store = createStore(_browserHistory, client, window.__data); const history = syncHistoryWithStore(_browserHistory, store); const ReactGA = require('react-ga'); ReactGA.initialize('UA-6245869-16'); function logPageView() { ReactGA.set({ page: window.location.pathname }); ReactGA.pageview(window.location.pathname); } function initSocket() { const socket = io('', {path: '/ws'}); socket.on('news', (data) => { console.log(data); socket.emit('my other event', { my: 'data from client' }); }); socket.on('msg', (data) => { console.log(data); }); return socket; } global.socket = initSocket(); const component = ( <Router onUpdate={logPageView} render={(props) => <ReduxAsyncConnect {...props} helpers={{client}} filter={item => !item.deferred} /> } history={history}> {getRoutes(store)} </Router> ); ReactDOM.render( <Provider store={store} key="provider"> {component} </Provider>, dest ); if (process.env.NODE_ENV !== 'production') { window.React = React; // enable debugger if (!dest || !dest.firstChild || !dest.firstChild.attributes || !dest.firstChild.attributes['data-react-checksum']) { console.error('Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.'); } } if (__DEVTOOLS__ && !window.devToolsExtension) { const DevTools = require('./containers/DevTools/DevTools'); ReactDOM.render( <Provider store={store} key="provider"> <div> {component} <DevTools /> </div> </Provider>, dest ); }
src/svg-icons/file/folder-open.js
xmityaz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let FileFolderOpen = (props) => ( <SvgIcon {...props}> <path d="M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"/> </SvgIcon> ); FileFolderOpen = pure(FileFolderOpen); FileFolderOpen.displayName = 'FileFolderOpen'; FileFolderOpen.muiName = 'SvgIcon'; export default FileFolderOpen;
src/client/xmls/components/xml-list/list-item.js
jordond/xmlr
import React from 'react' import { observer, PropTypes } from 'mobx-react' import styles from './list-item.css' /** * Renders the individual xml instance * * @param {Object} props - Component props * @param {Object<XMLModel>} props.item - Instance of XMLModel * @returns */ function ListItem({ item }) { return ( <li> <span className={item.selected ? styles.test : {}} onClick={() => item.setSelected()}>{item.displayName}</span> <button className={styles.delete} onClick={() => item.destroy()}><i className="fa fa-remove" /></button> </li> ) } ListItem.propTypes = { item: PropTypes.objectOrObservableObject.isRequired } /** * Exports a ListItem component, that is listening for changes to the XMLStore * @exports ListItem */ export default observer(ListItem)
docs/pages/api-docs/card-media.js
lgollut/material-ui
import React from 'react'; import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; import { prepareMarkdown } from 'docs/src/modules/utils/parseMarkdown'; const pageFilename = 'api/card-media'; const requireRaw = require.context('!raw-loader!./', false, /\/card-media\.md$/); export default function Page({ docs }) { return <MarkdownDocs docs={docs} />; } Page.getInitialProps = () => { const { demos, docs } = prepareMarkdown({ pageFilename, requireRaw }); return { demos, docs }; };
webapp/js/components/utils/IconButtonElement.js
Stevenah/INF5750
import React, { Component } from 'react'; import Theme from 'utils/theme'; import IconButton from 'material-ui/IconButton'; import MoreVertIcon from 'material-ui/svg-icons/navigation/more-vert'; class IconButtonElement extends Component { render() { const { ...props } = this.props; return ( <IconButton {...props} touch tooltipPosition="bottom-left"> <MoreVertIcon color={ Theme.palette.accent3Color } /> </IconButton> ); } } export default IconButtonElement;
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/module.input.js
storybooks/react-storybook
/* eslint-disable */ import React from 'react'; import Button from './Button'; import { storiesOf } from '@storybook/react'; export default { title: 'foo', }; const bar = 1; storiesOf('foo', module).add('bar', () => <Button />);
app/components/material/Material_1.js
tw00089923/kcr_bom
import React from 'react'; import _ from 'lodash'; import dialog from 'electron'; import color from '../../data/color'; import style from './Material.css'; import cx from 'classname'; import Select from 'react-select'; import 'react-select/dist/react-select.css' export default class Matreial_1 extends React.Component { constructor(props) { super(props); this.state = { show_first:false, show_second:false, show_1_1:false, show_1_2:false, index_1_1: "00", index_1_2: "00", index_1_3: "00", index_1_4: "00", index_1_1_1:"00", index_1_1_2:"00", index_1_1_3:"0000", } this.onChange = this.onChange.bind(this); this.show = this.show.bind(this); } show(){ this.setState({show_first:!this.state.show_first}); } onChange(e){ if(e.target.name == "index_1_1"){ console.log(e.target); this.setState({index_1_1:e.target.value}); } if(e.target.name == "index_1_2"){ console.log(e.target); this.setState({index_1_2:e.target.value}); } if(e.target.name == "index_1_3"){ console.log(e.target); this.setState({index_1_3:e.target.value}); } if(e.target.name == "index_1_4"){ console.log(e.target); this.setState({index_1_4:e.target.value}); } if(e.target.name == "index_1_1_1"){ console.log(e.target); this.setState({index_1_1_1:e.target.value}); } if(e.target.name == "index_1_1_2"){ console.log(e.target); this.setState({index_1_1_2:e.target.value}); } if(e.target.name == "index_1_1_3"){ console.log(e.target); this.setState({index_1_1_3:e.target.value}); } } render() { const type =[ {type:"UL1007",number:"00"}, {type:"UL1015",number:"01"}, {type:"UL1430",number:"02"}, {type:"UL1431",number:"03"}, {type:"UL1509",number:"04"}, {type:"UL1672",number:"05"}, {type:"UL1061",number:"06"}, {type:"UL1180",number:"07"}, {type:"UL1617",number:"08"}, {type:"UL1331",number:"09"}, {type:"UL1095",number:"10"}, {type:"UL1533",number:"11"}, {type:"UL1332",number:"12"}, {type:"UL2464",number:"13"}, {type:"UL3239",number:"14"}, {type:"UL1185",number:"15"}, {type:"UL2547",number:"16"}, {type:"UL20267",number:"17"}, {type:"UL2651",number:"18"}, {type:"UL2678",number:"19"}, {type:"UL1180",number:"20"}, {type:"UL1569",number:"21"}, {type:"UL3135",number:"22"}, {type:"PVC",number:"70"}, {type:"其他",number:"99"}, ]; const wire_width =[ "7/0.127", "7/0.16", "11/0.16", "17/0.16", "21/0.18", "34/0.18", "7/0.203", "7/0.254", "26/0.254", "41/0.254", "65/0.254", "104/0.254", "1/0.32", "7/0.32", "1/0.40", "1/0.51", "1/0.64", "1/0.81", "1/1.02", "1/1.29", "7/0.404", "133/0.254", "133/0.455", "1/1.63", "66/0.32", "19/0.16", "63/0.511", "19/0.287", "7/1.0", "19/0.32", "1/1.85", "7/0.45", "30/0.18", "45/0.32","37/0.254","43/0.32" ]; const material_a = _.map(type,(i,value) =>{ return (<option value={type[value].number} key={value} > {type[value].type}</option>); }); const material_b = _.map(Array.from({length:49} ,(v,k)=>(k<10)?'0'+k:k+1) , (i,v)=>{ return (<option value={i} key={v}>{i}</option>); }); const material_c = _.map(color ,(i,v)=>{ return (<option value={color[v].index} key={v}>{color[v].color}({color[v].color_zh}) </option>); }) const material_d =_.map(wire_width,(v,k)=>{ return (<option value={(k>9)?k:"0"+k} key={k}>{wire_width[k]} </option>); }); return ( <div> <h2 className={style.h2}> (1)--電線與電纜-- </h2> <div > <h5><i className={cx({'fa fa-caret-square-o-down':!this.state.show_1_1,'fa fa-caret-square-o-up':this.state.show_1_1})} aria-hidden="true" onClick={()=>{this.setState({show_1_1:!this.state.show_1_1})}}> </i> 1.1整卷 </h5> <table style={{"border":1,"textAlign":"center","display":this.state.show_1_1?"":"none"}}> <thead> <tr> <th>(1)</th> <th>種類</th> <th>號數</th> <th>顏色</th> <th>流水號</th> <th>檢查號</th> </tr> </thead> <tbody> <tr> <td>(1)</td> <td> <select name="index_1_1" id="" onChange={this.onChange}> {material_a} </select> </td> <td> <select name="index_1_2" id="" onChange={this.onChange} > {material_b} </select> </td> <td> <select name="index_1_3" id="" onChange={this.onChange}> {material_c} </select> </td> <td> <select name="index_1_4" id="" onChange={this.onChange}> {material_d} </select> </td> <td>_ </td> </tr> </tbody> </table> <div style={{"textAlign":"center","display":this.state.show_1_1?"":"none"}}> {this.state.show_1_1? `輸出結果 => 1${this.state.index_1_1}${this.state.index_1_2}${this.state.index_1_3}${this.state.index_1_4}_`:null } &nbsp;&nbsp;&nbsp;<i className="fa fa-upload " aria-hidden="true"></i> </div> <h5><i className={cx({'fa fa-caret-square-o-down':!this.state.show_1_2,'fa fa-caret-square-o-up':this.state.show_1_2})} aria-hidden="true" onClick={()=>{this.setState({show_1_2:!this.state.show_1_2})}}> </i> 1.2切斷 </h5> <table style={{"border":1,"textAlign":"center","display":this.state.show_1_2?"":"none"}}> <thead> <tr> <th>(2)</th> <th>種類</th> <th>號數</th> <th>流水號</th> <th>檢查號</th> </tr> </thead> <tbody> <tr> <td>(2)</td> <td> <select name="index_1_1_1" id="" onChange={this.onChange}> {material_a} </select> </td> <td> <select name="index_1_1_2" id="" onChange={this.onChange} > {material_b} </select> </td> <td> <input type="number" maxLength="4" name="index_1_1_3" value={this.state.index_1_1_3} onChange={this.onChange} /> </td> <td>_ </td> </tr> </tbody> </table> <div style={{"textAlign":"center","display":this.state.show_1_2?"":"none"}}> {this.state.show_1_2? `輸出結果 => 1${this.state.index_1_1_1}${this.state.index_1_1_2}${this.state.index_1_1_3}_`:null } &nbsp;&nbsp;&nbsp;<i className="fa fa-upload " aria-hidden="true"></i> </div> </div> </div> ); } }
app/scenes/CounterScene/CounterScene.js
djizco/boilerplate-react-native
import React, { Component } from 'react'; import { View } from 'react-native'; import Counter from '../../components/Counter'; import Increment from '../../components/Increment'; import Decrement from '../../components/Decrement'; import styles from './styles'; export default class CounterScene extends Component { static navigationOptions = { title: 'Counter', }; render() { return ( <View style={styles.container}> <Counter /> <Increment /> <Decrement /> </View> ); } }
src/component/UserDataComponent.js
NHAAHNA/hms
import React from 'react'; import {TableRow} from './TableRowComponent'; class UserDataComponent extends React.Component{ removeThisModal() { this.props.removeModal(); } render(){ return( <div className="container"> <div className="row"> <div className="col-md-10"> <div className="card"> <div className="card-block"> <table className="table table-responsive table-striped table-bordered"> <thead className="thead-inverse"> <tr> <th>Username</th><th>Name</th><th>Email Id</th><th>Contact No.</th> </tr> </thead> <tbody> { this.props.users.map((user, i) => <TableRow key = {i} data = {user} />) } </tbody> </table> </div> </div> </div> </div> <br/> <div className="row"> <div className="col-md-4"></div> <div className="col-md-4"> <input className="btn btn-outline-danger" type="button" defaultValue="Close" onClick={this.removeThisModal.bind(this)}/> </div> <div className="col-md-4"></div> </div> </div> ); } } export default UserDataComponent;
example/examples/MarkerTypes.js
parkling/react-native-maps
import React from 'react'; import { StyleSheet, View, Text, Dimensions, } from 'react-native'; import MapView from 'react-native-maps'; import flagBlueImg from './assets/flag-blue.png'; import flagPinkImg from './assets/flag-pink.png'; const { width, height } = Dimensions.get('window'); const ASPECT_RATIO = width / height; const LATITUDE = 37.78825; const LONGITUDE = -122.4324; const LATITUDE_DELTA = 0.0922; const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO; const SPACE = 0.01; class MarkerTypes extends React.Component { constructor(props) { super(props); this.state = { marker1: true, marker2: false, }; } render() { return ( <View style={styles.container}> <MapView provider={this.props.provider} style={styles.map} initialRegion={{ latitude: LATITUDE, longitude: LONGITUDE, latitudeDelta: LATITUDE_DELTA, longitudeDelta: LONGITUDE_DELTA, }} > <MapView.Marker onPress={() => this.setState({ marker1: !this.state.marker1 })} coordinate={{ latitude: LATITUDE + SPACE, longitude: LONGITUDE + SPACE, }} centerOffset={{ x: -18, y: -60 }} anchor={{ x: 0.69, y: 1 }} image={this.state.marker1 ? flagBlueImg : flagPinkImg} > <Text style={styles.marker}>X</Text> </MapView.Marker> <MapView.Marker onPress={() => this.setState({ marker2: !this.state.marker2 })} coordinate={{ latitude: LATITUDE - SPACE, longitude: LONGITUDE - SPACE, }} centerOffset={{ x: -42, y: -60 }} anchor={{ x: 0.84, y: 1 }} image={this.state.marker2 ? flagBlueImg : flagPinkImg} /> <MapView.Marker onPress={() => this.setState({ marker2: !this.state.marker2 })} coordinate={{ latitude: LATITUDE + SPACE, longitude: LONGITUDE - SPACE, }} centerOffset={{ x: -42, y: -60 }} anchor={{ x: 0.84, y: 1 }} opacity={0.6} image={this.state.marker2 ? flagBlueImg : flagPinkImg} /> </MapView> </View> ); } } MarkerTypes.propTypes = { provider: MapView.ProviderPropType, }; const styles = StyleSheet.create({ container: { ...StyleSheet.absoluteFillObject, justifyContent: 'flex-end', alignItems: 'center', }, map: { ...StyleSheet.absoluteFillObject, }, marker: { marginLeft: 46, marginTop: 33, fontWeight: 'bold', }, }); module.exports = MarkerTypes;
www/src/components/DailySummary.js
savannidgerinel/health
import React from 'react' import math from 'mathjs' import moment from 'moment' import { nub, renderDistance, renderDuration } from '../common' import { TimeDistanceSummary } from './TimeDistanceRow' export class DailySummary extends React.Component { render () { const activities = nub(this.props.tdEntries.map((td) => td.activity)) return <table> <tbody> { activities.map((a) => <TimeDistanceSummary activity={a} entries={this.props.tdEntries} />) } </tbody> </table> } }
jenkins-design-language/src/js/components/material-ui/svg-icons/device/signal-cellular-off.js
alvarolobato/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const DeviceSignalCellularOff = (props) => ( <SvgIcon {...props}> <path d="M21 1l-8.59 8.59L21 18.18V1zM4.77 4.5L3.5 5.77l6.36 6.36L1 21h17.73l2 2L22 21.73 4.77 4.5z"/> </SvgIcon> ); DeviceSignalCellularOff.displayName = 'DeviceSignalCellularOff'; DeviceSignalCellularOff.muiName = 'SvgIcon'; export default DeviceSignalCellularOff;
src/svg-icons/social/group.js
verdan/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let SocialGroup = (props) => ( <SvgIcon {...props}> <path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"/> </SvgIcon> ); SocialGroup = pure(SocialGroup); SocialGroup.displayName = 'SocialGroup'; SocialGroup.muiName = 'SvgIcon'; export default SocialGroup;
app/javascript/mastodon/components/missing_indicator.js
Chronister/mastodon
import React from 'react'; import { FormattedMessage } from 'react-intl'; const MissingIndicator = () => ( <div className='regeneration-indicator missing-indicator'> <div> <div className='regeneration-indicator__figure' /> <div className='regeneration-indicator__label'> <FormattedMessage id='missing_indicator.label' tagName='strong' defaultMessage='Not found' /> <FormattedMessage id='missing_indicator.sublabel' defaultMessage='This resource could not be found' /> </div> </div> </div> ); export default MissingIndicator;