path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
pkg/interface/dbug/src/index.js
urbit/urbit
import React from 'react'; import ReactDOM from 'react-dom'; import { Root } from '/components/root'; import { api } from '/api'; import { store } from '/store'; import { subscription } from "/subscription"; api.setAuthTokens({ ship: window.ship }); window.urb = new window.channel(); subscription.start(); ReactDOM.render(( <Root /> ), document.querySelectorAll("#root")[0]);
src/svg-icons/action/note-add.js
tan-jerene/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionNoteAdd = (props) => ( <SvgIcon {...props}> <path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z"/> </SvgIcon> ); ActionNoteAdd = pure(ActionNoteAdd); ActionNoteAdd.displayName = 'ActionNoteAdd'; ActionNoteAdd.muiName = 'SvgIcon'; export default ActionNoteAdd;
imports/ui/components/AuthenticatedNavigation/Menu.js
haraneesh/mydev
// import React, { Component } from 'react'; import React, { useState, useEffect } from 'react'; import { Button, Row } from 'react-bootstrap'; import PropTypes from 'prop-types'; /* export default class Menu extends Component { constructor(props) { super(props); this.state = { visible: false, }; this.show = this.show.bind(this); this.hide = this.hide.bind(this); } */ const Menu = (props) => { const [isMenuVisible, setMenuVisibility] = useState(false); useEffect(() => { setMenuVisibility(false); }, []); const hide = () => { setMenuVisibility(false); document.removeEventListener('click', hide); }; const show = () => { if (!isMenuVisible) { document.addEventListener('click', hide); } setMenuVisibility(true); }; const menuVisible = isMenuVisible ? 'visible' : ''; // this.state.visible ? 'visible ' : ''; return ( <Row className="pull-right"> <span id="profileIcon" style={{ marginTop: '2.4rem', marginRight: '15px', float: 'left', fontSize: '1.25em', display: 'block', }} > <a onClick={() => { props.history.push('/profile'); }} href="#"> <i className="fas fa-user" style={{ color: '#522E23' }} /> </a> </span> <div className="menu-expand-button"> <Button type="button" bsStyle="link" onClick={show}> <span className={`icon-bar top-bar ${menuVisible}`} /> <span className={`icon-bar middle-bar ${menuVisible}`} /> <span className={`icon-bar bottom-bar ${menuVisible}`} /> </Button> </div> <div className="menu" style={{ display: (isMenuVisible) ? 'block' : 'none' }}> <div className={menuVisible + props.alignment} style={{ zIndex: 1100 }}> {props.children} </div> </div> </Row> ); }; export default Menu; Menu.propTypes = { alignment: PropTypes.string.isRequired, children: PropTypes.object.isRequired, history: PropTypes.object.isRequired, };
WasteAppMini/js/components/recipe/cheese.js
airien/workbits
import React, { Component } from 'react'; import { Image,View, ListView,BackAndroid } from 'react-native'; import { connect } from 'react-redux'; import { actions } from 'react-native-navigation-redux-helpers'; import { Container, Header, Title, Content, Button, Icon, Card, CardItem, Text, Thumbnail, DeckSwiper } from 'native-base'; var menuItems = require('../../data/sidebar.json'); import myTheme from '../../themes/base-theme'; import { openDrawer } from '../../actions/drawer'; var recipes = require('../../data/ost.json'); var recipeItems = require('../../data/menurecipes.json'); import styles from './styles'; import Hyperlink from 'react-native-hyperlink' import Images from '../../../assets/images'; import DynamicView from '../dynamicview/'; import AndroidBackButton from "react-native-android-back-button" const { replaceAt, } = actions; class Cheese extends Component { constructor(props) { super(props); this.state = { recipe: 0 }; } static propTypes = { openDrawer: React.PropTypes.func, replaceAt: React.PropTypes.func, navigation: React.PropTypes.shape({ key: React.PropTypes.string, }), } replaceAt(route) { this.props.replaceAt('cheese', { key: route }, this.props.navigation.key); } render() { return ( <Container theme={myTheme} style={styles.container}> <AndroidBackButton onPress={() => {this.replaceAt("recipe"); }} /> <Header> <Title>{recipeItems.cheese}</Title> <Button transparent onPress={this.props.openDrawer}> <Icon name="ios-menu" /> </Button> </Header> <Content padder> <DynamicView data={recipes.texts} name="cheese" /> </Content> </Container> ); } } function bindAction(dispatch) { return { openDrawer: () => dispatch(openDrawer()), replaceAt: (routeKey, route, key) => dispatch(replaceAt(routeKey, route, key)), }; } const mapStateToProps = state => ({ navigation: state.cardNavigation, }); export default connect(mapStateToProps, bindAction)(Cheese);
src/components/EditGearForm.js
tommydx/front2
import React, { Component } from 'react'; import axios from 'axios'; import { browserHistory } from 'react-router'; class EditGearForm extends Component { constructor(props) { super(props); this.state = { name: "", item_category: "", item: "", manufacturer: "", year: "", serial_number: "", condition: "", description: "", photo_1: "", photo_2: "", photo_3: "", user_id: 0 }; this.handleChange = this.handleChange.bind(this); } componentDidMount() { console.log('=========>',this.state) axios .get(`http://localhost:8080/users/${window.localStorage.user_id}/gear/${this.props.gear_id}`, { headers: { 'Authorization': window.localStorage.getItem('token') } }) .then((response) => { const gearData = response.data; console.log('======>2',gearData) this.setState({ gearData}); }) .catch((err) => { console.log(err); }); } handleSubmit(event) { event.preventDefault(); axios .put(`http://localhost:8080/users/${window.localStorage.user_id}/gear/${this.props.gear_id}`, { gear: this.state }, { headers: { 'Authorization': window.localStorage.getItem('token') } }) .then(() => { browserHistory.push(`/gear/${this.props.userId}/gear/${this.props.gearId}`); }) .catch((err) => { console.log(err); }); } // VALUE MUST BE EQUAL TO THE STATE OF THE COMPONENT YOU ARE IN WHEN TAKING DATA FROM INPUT FIELDS (HOISTED STATE) ---- CAN NOT DO THIS WITH PROPS - USE PLACEHOLDER handleChange(event) { this.setState({ [event.target.name]: event.target.value }); } render() { return( <div className='edit-gear-form-contain'> <div className='edit-gear-form-inputs'> <form onSubmit={this.handleSubmit.bind(this)}> <div> <div className='formLabel'> Name </div> <span> <input onChange={this.handleChange} name='name' type='text' placeholder={this.props.gearData.name}/> </span> </div> <div> <div className='formLabel'> Item Category </div> <span> <input onChange={this.handleChange} name='item_category' type='text' placeholder={this.props.gearData.item_category}/> </span> </div> <div> <div className='formLabel'> Item </div> <span> <input onChange={this.handleChange} name='item' type='text' placeholder={this.props.gearData.item}/> </span> </div> <div> <div className='formLabel'> Manufacturer </div> <span> <input onChange={this.handleChange} name='manufacturer' type='text' placeholder={this.props.gearData.manufacturer}/> </span> </div> <div> <div className='formLabel'> Year </div> <span> <input onChange={this.handleChange} name='year' type='text' placeholder={this.props.gearData.year}/> </span> </div> <div> <div className='formLabel'> Serial Number </div> <span> <input onChange={this.handleChange} name='serial_number' type='text' placeholder={this.props.gearData.serial_number}/> </span> </div> <div> <div className='formLabel'> Condition </div> <span> <input onChange={this.handleChange} name='condition' type='text' placeholder={this.props.gearData.condition}/> </span> </div> <div> <div className='formLabel'> Description </div> <span> <input onChange={this.handleChange} name='description' type='text' placeholder={this.props.gearData.description}/> </span> </div> <div> <div className='formLabel'> Add Photo </div> <span> <input onChange={this.handleChange} name='photo_1' type='text' placeholder={this.props.gearData.photo_1}/> </span> </div> <div> <div className='formLabel'> Add Photo </div> <span> <input onChange={this.handleChange} name='photo_2' type='text' placeholder={this.props.gearData.photo_2}/> </span> </div> <div> <div className='formLabel'> Add Photo </div> <span> <input onChange={this.handleChange} name='photo_3' type='text' placeholder={this.props.gearData.photo_3}/> </span> </div> <div className='hidden-ui'> <input onChange={this.handleChange} name='user_id' type='text' placeholder={this.props.gearData.user_id} /> </div> <div className=''> <button type='submit' className='edit-gear-button button'>Update Item</button> </div> </form> </div> <div className='gear-photos'> <img src={`${this.state.photo_1}`} width='100%'/> <img src={`${this.state.photo_2}`} width='100%'/> <img src={`${this.state.photo_3}`} width='100%'/> </div> </div> ); } } export default EditGearForm;
src/index.js
dkryaklin/aviasales_test
import React from 'react'; import ReactDOM from 'react-dom'; import App from './components/App'; import './css/index.css'; import './css/media.css'; ReactDOM.render( <App />, document.getElementById('root') );
src/Portal.js
cesarandreu/react-overlays
import React from 'react'; import mountable from 'react-prop-types/lib/mountable'; import ownerDocument from './utils/ownerDocument'; import getContainer from './utils/getContainer'; /** * The `<Portal/>` component renders its children into a new "subtree" outside of current component hierarchy. * You can think of it as a declarative `appendChild()`, or jQuery's `$.fn.appendTo()`. * The children of `<Portal/>` component will be appended to the `container` specified. */ let Portal = React.createClass({ displayName: 'Portal', propTypes: { /** * A Node, Component instance, or function that returns either. The `container` will have the Portal children * appended to it. */ container: React.PropTypes.oneOfType([ mountable, React.PropTypes.func ]) }, componentDidMount() { this._renderOverlay(); }, componentDidUpdate() { this._renderOverlay(); }, componentWillUnmount() { this._unrenderOverlay(); this._unmountOverlayTarget(); }, _mountOverlayTarget() { if (!this._overlayTarget) { this._overlayTarget = document.createElement('div'); this.getContainerDOMNode() .appendChild(this._overlayTarget); } }, _unmountOverlayTarget() { if (this._overlayTarget) { this.getContainerDOMNode() .removeChild(this._overlayTarget); this._overlayTarget = null; } }, _renderOverlay() { let overlay = !this.props.children ? null : React.Children.only(this.props.children); // Save reference for future access. if (overlay !== null) { this._mountOverlayTarget(); this._overlayInstance = React.render(overlay, this._overlayTarget); } else { // Unrender if the component is null for transitions to null this._unrenderOverlay(); this._unmountOverlayTarget(); } }, _unrenderOverlay() { if (this._overlayTarget) { React.unmountComponentAtNode(this._overlayTarget); this._overlayInstance = null; } }, render() { return null; }, getMountNode(){ return this._overlayTarget; }, getOverlayDOMNode() { if (!this.isMounted()) { throw new Error('getOverlayDOMNode(): A component must be mounted to have a DOM node.'); } if (this._overlayInstance) { if (this._overlayInstance.getWrappedDOMNode) { return this._overlayInstance.getWrappedDOMNode(); } else { return React.findDOMNode(this._overlayInstance); } } return null; }, getContainerDOMNode() { return getContainer(this.props.container, ownerDocument(this).body); } }); export default Portal;
app/components/ShowJob/index.js
dijahmac/JobWeasel-FrontEnd
/** * * ShowJob * */ import React from 'react'; import './style.css'; import './styleM.css'; export default class ShowJob extends React.PureComponent { constructor(props) { super(props); this.state = { job: {}, links: [] } } componentWillMount() { this.getJob(this.props.jobId); this.getLinks(this.props.jobId); } getJob = (id) => { let url = "http://localhost:8000/api/showJob/" + id; let _this = this; fetch(url, {method: 'GET'}).then( function(response) { return response.json(); } ).then( function(json) { _this.setState({ job: json.job }); console.log("showJob"); console.log(json.job); }.bind(this) ); } getLinks = (id) => { let url = "http://localhost:8000/api/getJobLinks/" + id; let _this = this; fetch(url, {method: 'GET'}).then( function(response) { return response.json(); } ).then( function(json) { _this.setState({ links: json.links }); console.log(url); console.log(json.links); }.bind(this) ); } renderJob = (job) => { return ( <div className="jobSection"> {this.renderField("Name", job.name)} {this.renderField("Location", job.location)} {this.renderField("Description", job.description)} {this.renderField("Budget", job.budget)} {this.renderField("Workers Needed", job.workers_needed)} {this.renderField("Start Date", job.start_date)} {this.renderField("Time Frame", job.time_frame)} {this.renderField("Posted on", job.created_at)} </div> ); } renderField = (name, value) => { return ( <div className="jobField panel"> <div className="jobField label">{name}:</div> <div className="jobField value"> {value} </div> </div> ); } renderLinks = () => { return ( <div className="linksSection"> <div className="links panel"> <div className="links label">Links:</div> <div className="links value"> {this.state.links.map((link, index) => ( <div className="userLink" key={index}> <a href={link.url}>{link.text}</a> </div> ))} </div> </div> </div> ); } render() { let job = ""; let links = ""; if (this.state.job !== {}) { job = this.renderJob(this.state.job); } if (this.state.links !== []) { links = this.renderLinks(); } return ( <div className="job"> {job} {links} </div> ); } } ShowJob.contextTypes = { router: React.PropTypes.object };
app/config/routes.js
khaiphan/react-server-boilerplate
import React from 'react'; import { Router, Route, IndexRoute } from 'react-router'; import App from '../components/App'; import Main from '../components/Main'; import Home from '../components/Home'; import User from '../components/User'; export default( <Router> <Route component={Main}> <Route path='/' component={Home} /> <Route path='/user' component={User} /> </Route> </Router> );
packages/react/src/components/organisms/TabContainer/context.js
massgov/mayflower
import React from 'react'; // Used by @Organisms/TabContainer and Tab to share data. const TabContext = React.createContext({ activeTab: null, activeContent: null, setActiveTab: () => {} }); export default TabContext;
pages/designs/signinform/components/form.js
DarcyChan/darcychan.com
import React from 'react'; import { Motion, spring } from 'react-motion'; export default class Form extends React.Component { render() { const { formRef, activeRef, info, isActive, isSubmitted, motion, reverse, onSwitch, onSubmit, onFormRest, children, ...props } = this.props; const dir = reverse ? 1 : -1; return ( <Motion style={{ opacity: spring(isActive && !isSubmitted ? 1 : 0, motion), position: spring(isActive ? 0 : dir * 100, motion) }} onRest={() => onFormRest()} > {({ opacity, position }) => ( <div className={`form-container${isActive ? ' active' : ''}${reverse ? ' reverse' : ''}${isSubmitted ? ' submitted' : ''}`} {...props} style={{ left: `${position}%`, opacity: opacity, visibility: opacity > 0 ? 'visible' : 'hidden', transform: opacity < 1 && opacity > 0 ? 'translateZ(0)' : 'none' }} ref={formRef} > <Motion style={{ position: spring( isSubmitted ? dir * 100 : 0, motion ) }} > {({ position }) => ( <div className="form-content form-content-active" style={{ left: `${position}%` }} ref={activeRef} > {info && info.activeTitle && ( <h1 className="form-title"> {info.activeTitle} </h1> )} {info && info.activeDesc && <p>{info.activeDesc}</p>} <form onSubmit={onSubmit}>{children}</form> </div> )} </Motion> <Motion style={{ position: spring( isSubmitted ? dir * -100 : 0, motion ) }} > {({ position }) => ( <div className="form-content form-content-default" style={{ left: `${position}%` }} > {info && info.defaultTitle && ( <h1 className="form-title"> {info.defaultTitle} </h1> )} {info && info.defaultDesc && ( <p>{info.defaultDesc}</p> )} {info && info.toggleText && ( <button type="button" onClick={onSwitch} > {info.toggleText} </button> )} </div> )} </Motion> </div> )} </Motion> ); } }
src/components/common/svg-icons/editor/format-align-center.js
abzfarah/Pearson.NAPLAN.GnomeH
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let EditorFormatAlignCenter = (props) => ( <SvgIcon {...props}> <path d="M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"/> </SvgIcon> ); EditorFormatAlignCenter = pure(EditorFormatAlignCenter); EditorFormatAlignCenter.displayName = 'EditorFormatAlignCenter'; EditorFormatAlignCenter.muiName = 'SvgIcon'; export default EditorFormatAlignCenter;
docs/src/pages/elements/NavigationPage.js
gocreating/react-tocas
import React from 'react'; import DemoPageLayout from '../../utils/DemoPageLayout'; import CardList from '../../utils/CardList'; let NavigationPage = () => ( <DemoPageLayout title="Elements" description="Uncategorized elements" > <CardList title="Elements" cards={[{ to: '/elements/button', title: 'Button', meta: '<Button />, <Buttons />', description: 'Clickable and feedback related component', symbol: <i className="icon hand pointer" />, }, { to: '/elements/container', title: 'Container', meta: '<Container />', description: 'Centralize text content especially in high display resolution', symbol: <i className="icon resize horizontal" />, }, { to: '/elements/header', title: 'Header', meta: '<Header />', description: 'To separate text content', symbol: <i className="icon header" />, }, { to: '/elements/icon', title: 'Icon', meta: '<Icon />, <Icons />', description: '', symbol: <i className="icon smile" />, }, { to: '/elements/image', title: 'Image', meta: '<Image />, <Images />', description: '', symbol: <i className="icon picture" />, }, { to: '/elements/slate', title: 'Slate', meta: '<Slate />', description: 'Multi-functional block like header container, placeholder or uploading area', symbol: <i className="icon square" />, }, { to: '/elements/segment', title: 'Segment', meta: '<Segment />, <Segments />', description: 'To wrap text', symbol: <i className="icon content" />, }]} /> </DemoPageLayout> ); export default NavigationPage;
src/components/TodoApp/Header.js
Capgemini/react-scaffold
import React, { Component } from 'react'; import TodoActions from '../../actions/TodoActions'; import TodoTextInput from './TodoTextInput'; export default class Header extends Component { /** * Event handler called within TodoTextInput. * Defining this here allows TodoTextInput to be used in multiple places * in different ways. * @param {string} text */ onSave(text) { if (text.trim()){ TodoActions.create(text); } } render() { return ( <header id="header"> <h2>Todo app</h2> <TodoTextInput id="new-todo" placeholder="What needs to be done?" onSave={this.onSave} /> </header> ); } }
src/svg-icons/maps/local-shipping.js
kittyjumbalaya/material-components-web
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let MapsLocalShipping = (props) => ( <SvgIcon {...props}> <path d="M20 8h-3V4H3c-1.1 0-2 .9-2 2v11h2c0 1.66 1.34 3 3 3s3-1.34 3-3h6c0 1.66 1.34 3 3 3s3-1.34 3-3h2v-5l-3-4zM6 18.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm13.5-9l1.96 2.5H17V9.5h2.5zm-1.5 9c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"/> </SvgIcon> ); MapsLocalShipping = pure(MapsLocalShipping); MapsLocalShipping.displayName = 'MapsLocalShipping'; MapsLocalShipping.muiName = 'SvgIcon'; export default MapsLocalShipping;
features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/source/src/app/components/Apis/Details/Resources/Resources.js
abimarank/carbon-apimgt
/* * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you 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. */ import React from 'react' import { Input, Icon, Checkbox, Button, Card, Tag, Form } from 'antd'; import { Row, Col } from 'antd'; import Api from '../../../../data/api' import Resource from './Resource' const CheckboxGroup = Checkbox.Group; class Resources extends React.Component{ constructor(props){ super(props); this.state ={ tmpMethods:[], tmpResourceName: '', paths:{}, swagger:{} }; this.api = new Api(); this.api_uuid = props.match.params.api_uuid; this.addResources = this.addResources.bind(this); this.onChange = this.onChange.bind(this); this.onChangeInput = this.onChangeInput.bind(this); this.updatePath = this.updatePath.bind(this); this.updateResources = this.updateResources.bind(this); } componentDidMount() { let promised_api = this.api.getSwagger(this.api_uuid); promised_api.then((response) => { this.setState({swagger:response.obj}); if(response.obj.paths !== undefined ){ this.setState({paths:response.obj.paths}) } }).catch(error => { if (process.env.NODE_ENV !== "production") console.log(error); let status = error.status; if (status === 404) { this.setState({notFound: true}); } else if (status === 401) { this.setState({isAuthorize: false}); let params = qs.stringify({reference: this.props.location.pathname}); this.props.history.push({pathname: "/login", search: params}); } }); } onChange(checkedValues) { console.log('checked = ', checkedValues); this.setState({tmpMethods:checkedValues}); } onChangeInput(e) { console.log('checked = ', e.target.value); this.setState({tmpResourceName:e.target.value}); } addResources(){ const defaultGet = { description:'description', produces:'application/xml,application/json', consumes:'application/xml,application/json', parameters:[], responses: { 200: { "description": "" } } }; const defaultPost = { description: 'description', produces: 'application/xml,application/json', consumes: 'application/xml,application/json', responses: { 200: { "description": "" } }, parameters: [ { name: "Payload", description: "Request Body", required: false, in: "body", schema: { type: "object", properties: { payload: { type: "string" } } } } ] }; let pathValue = {}; this.state.tmpMethods.map( (method ) => { switch (method) { case "GET" : pathValue["GET"] = defaultGet; break; case "POST" : pathValue["POST"] = defaultPost; } }); let tmpPaths = this.state.paths; tmpPaths[this.state.tmpResourceName] = pathValue; this.setState({paths:tmpPaths}); } updatePath(path,method,value) { let tmpPaths = this.state.paths; tmpPaths[path][method] = value; this.setState({paths:tmpPaths}); } updateResources(){ let tmpSwagger = this.state.swagger; tmpSwagger.paths = this.state.paths; this.setState({api:tmpSwagger}); let promised_api = this.api.updateSwagger(this.api_uuid, this.state.swagger); promised_api.then((response) => { }).catch(error => { if (process.env.NODE_ENV !== "production") console.log(error); let status = error.status; if (status === 404) { this.setState({notFound: true}); } else if (status === 401) { this.setState({isAuthorize: false}); let params = qs.stringify({reference: this.props.location.pathname}); this.props.history.push({pathname: "/login", search: params}); } }); } render(){ const selectBefore = ( <span>/SwaggerPetstore/1.0.0</span> ); const plainOptions = ['GET','POST','PUT','DELETE','PATCH','HEAD','OPTIONS']; let paths = this.state.paths; return ( <div> <h2>Resources</h2> <Card title="Add Resource For Path" style={{ width: "100%",marginBottom:20 }}> <Row type="flex" justify="start"> <Col span={4}>URL Pattern</Col> <Col span={20}> <Input addonBefore={selectBefore} onChange={this.onChangeInput} defaultValue="" /> <div style={{marginTop:20}}> <CheckboxGroup options={plainOptions} onChange={this.onChange} /> </div> <div style={{marginTop:20}}> <Button type="primary" onClick={this.addResources}>Add Resources to Path</Button> </div> </Col> </Row> </Card> { Object.keys(paths).map( (key) => { let path = paths[key]; let that = this; return ( Object.keys(path).map( (innerKey) => { return <Resource path={key} method={innerKey} methodData={path[innerKey]} updatePath={that.updatePath} /> }) ); } ) } <input type="button" onClick={this.updateResources} value="Save"/> </div> ) } } export default Resources
src/svg-icons/device/battery-charging-60.js
matthewoates/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceBatteryCharging60 = (props) => ( <SvgIcon {...props}> <path fillOpacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V11h3.87L13 7v4h4V5.33C17 4.6 16.4 4 15.67 4z"/><path d="M13 12.5h2L11 20v-5.5H9l1.87-3.5H7v9.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V11h-4v1.5z"/> </SvgIcon> ); DeviceBatteryCharging60 = pure(DeviceBatteryCharging60); DeviceBatteryCharging60.displayName = 'DeviceBatteryCharging60'; DeviceBatteryCharging60.muiName = 'SvgIcon'; export default DeviceBatteryCharging60;
indico/web/client/js/jquery/widgets/jinja/duration_widget.js
ThiefMaster/indico
// This file is part of Indico. // Copyright (C) 2002 - 2021 CERN // // Indico is free software; you can redistribute it and/or // modify it under the terms of the MIT License; see the // LICENSE file for more details. import React from 'react'; import ReactDOM from 'react-dom'; import {WTFDurationField} from 'indico/react/components'; window.setupDurationWidget = function setupDurationWidget({fieldId, required, disabled}) { // Make sure the results dropdown is displayed above the dialog. const field = $(`#${fieldId}`); field.closest('.ui-dialog-content').css('overflow', 'inherit'); field.closest('.exclusivePopup').css('overflow', 'inherit'); ReactDOM.render( <WTFDurationField timeId={`${fieldId}-timestorage`} required={required} disabled={disabled} />, document.getElementById(fieldId) ); };
lib/ui/src/components/preview/preview.stories.js
storybooks/react-storybook
import React from 'react'; import { storiesOf } from '@storybook/react'; import { types } from '@storybook/addons'; import { Preview } from './preview'; export const previewProps = { id: 'string', api: { on: () => {}, emit: () => {}, off: () => {}, }, storyId: 'string', path: 'string', viewMode: 'story', location: {}, baseUrl: 'http://example.com', queryParams: {}, getElements: type => type === types.TAB ? [ { id: 'notes', type: types.TAB, title: 'Notes', route: ({ storyId }) => `/info/${storyId}`, // todo add type match: ({ viewMode }) => viewMode === 'info', // todo add type render: () => null, }, ] : [], options: { isFullscreen: false, isToolshown: true, }, actions: {}, }; storiesOf('UI/Preview/Preview', module) .addParameters({ component: Preview, }) .add('no tabs', () => <Preview {...previewProps} getElements={() => []} />) .add('with tabs', () => <Preview {...previewProps} />);
assets/jqwidgets/demos/react/app/complexinput/validation/app.js
juannelisalde/holter
import React from 'react'; import ReactDOM from 'react-dom'; import JqxComplexInput from '../../../jqwidgets-react/react_jqxcomplexinput.js'; import JqxButton from '../../../jqwidgets-react/react_jqxbuttons.js'; class App extends React.Component { componentDidMount() { this.refs.myButton.on('click', () => { this.refs.myComplexInput.value('11- 2ii'); }); } render() { return ( <div> <JqxComplexInput ref='myComplexInput' width={250} height={25} value={'15 + 7.2i'} spinButtons={false} /> <JqxButton style={{ marginTop: 20 }} ref='myButton' width={200} value='Set wrong value: "11- 2ii"' /> </div> ) } } ReactDOM.render(<App />, document.getElementById('app'));
src/TabBar.js
LHoin/react-native-router-redux-plus
import React, { Component } from 'react'; import Tabs from 'react-native-tabs'; import { Image, StyleSheet, Text, View } from 'react-native'; const onSelect = props => el => { props.actions.changeTab({ from: props.activeTab, name: el.props.name, navigator: props.navigator, }); return { selectionColor: props.tabStyles.tint || '#037AFF', }; }; const imageStyle = props => ({ height: 25, resizeMode: 'contain', tintColor: props.selectionColor || '#929292', width: 30, }); const tabBarStyle = props => ({ backgroundColor: props.tabStyles.barTint || '#F9F9F9', borderTopColor: '#D8D8D8', borderTopWidth: 1, }); const tabContainerStyle = () => ({ alignItems: 'center', justifyContent: 'center', }); const textStyle = props => ({ color: props.selectionColor || '#929292', fontSize: 10, letterSpacing: 0.2, marginBottom: 2, marginTop: 4, }); class TabBarIcon extends Component { render() { const { name, tabItem } = this.props; return ( <View name={name} style={tabContainerStyle()}> {tabItem.icon && <Image source={tabItem.icon} style={imageStyle(this.props)} /> } {tabItem.title && <Text style={textStyle(this.props)}>{tabItem.title}</Text> } </View> ); } } export default class TabBar extends Component { constructor(props){ super(props); this.state = {}; } render() { const { tabs } = this.props; const tabBarItems = Object.keys(tabs).map(tabName => { const tab = tabs[tabName]; const tabItem = tab.tabItem || {}; return ( <TabBarIcon key={tabName} name={tabName} tabItem={tabItem} tabStyles={this.props.tabStyles} /> ); }); return ( <Tabs activeOpacity={1.0} onSelect={onSelect(this.props)} selected={this.props.activeTab} style={tabBarStyle(this.props)} > {tabBarItems} </Tabs> ); } }
src/components/Alert.js
Grilados/site
import React, { Component } from 'react'; import './css/Alert.css'; export class Alert extends Component { render() { return( <div className="alert"> <div className="text-center title"> {this.props.title} </div> <div className="text-center body"> {this.props.body} </div> </div> ) } }
src/components/Router/TabIcon/index.js
topguru/React-Equiaction
import React from 'react'; import {Text, View, Image} from 'react-native'; import { Scene, Router, Actions, TabBar } from 'react-native-router-flux'; import { images } from '../../../theme'; import styles from './style'; const HomeTabIcon = (props) => ( <View style={styles.tabIconView}> <Image source={props.selected ? images.HomeActive: images.HomeInactive} /> <Text style={{ fontSize: 11, color: props.selected ? 'blue': 'black'}} >{props.title}</Text> </View> ); const CataTabIcon = (props) => ( <View style={styles.tabIconView}> <Image source={props.selected ? images.CatalogueActive: images.CatalogueInactive} /> <Text style={{ fontSize: 11, color: props.selected ? 'blue': 'black'}} >{props.title}</Text> </View> ); const AdsTabIcon = (props) => ( <View style={styles.tabIconView}> <Image source={props.selected ? images.AdsActive: images.AdsInactive} /> <Text style={{ fontSize: 11, color: props.selected ? 'blue': 'black'}} >{props.title}</Text> </View> ); const FavTabIcon = (props) => ( <View style={styles.tabIconView}> <Image source={props.selected ? images.FavoriteActive: images.FavoriteInactive} /> <Text style={{ fontSize: 11, color: props.selected ? 'blue': 'black'}} >{props.title}</Text> </View> ); const ProTabIcon = (props) => ( <View style={styles.tabIconView}> <Image source={props.selected ? images.ProfileActive: images.ProfileInactive} /> <Text style={{ fontSize: 11, color: props.selected ? 'blue': 'black'}} >{props.title}</Text> </View> ); export {HomeTabIcon , CataTabIcon , AdsTabIcon , FavTabIcon , ProTabIcon};
example/TestLibQuickblox/IndicatorDialog.js
ttdat89/react-native-video-quickblox
/** * Created by Dat Tran on 1/25/17. */ import React from 'react' import {View, Text, StyleSheet, Modal, TouchableOpacity} from 'react-native' import Spinner from 'react-native-spinkit' import PropTypes from 'prop-types' export default class IndicatorDialog extends React.Component { static propTypes = { message: PropTypes.string.isRequired, } constructor(props) { super(props); this.state = { modalVisible: true } } render() { const {message, showGlobalIndicator} = this.props; return ( <View> <Modal animationType='fade' transparent={true} visible={true} onRequestClose={() => { console.log('android click back') }}> <View style={[styles.container, {backgroundColor: 'rgba(0, 0, 0, 0.2)'}]}> <View style={[styles.innerContainer]}> <Spinner isVisible={true} size={60} type='ThreeBounce' color='#4286f4'/> <Text>{message}</Text> </View> </View> </Modal> </View> ); } } var styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20, }, innerContainer: { borderRadius: 10, alignItems: 'center', backgroundColor: '#fff', paddingBottom: 20, width: 280 }, row: { alignItems: 'center', flex: 1, flexDirection: 'row', marginBottom: 20, }, rowTitle: { flex: 1, fontWeight: 'bold', }, button: { borderRadius: 5, flex: 1, height: 44, alignSelf: 'stretch', justifyContent: 'center', overflow: 'hidden', }, buttonText: { fontSize: 18, margin: 5, textAlign: 'center', color: 'white' }, modalButton: { borderRadius: 4, marginTop: 10, padding: 4, backgroundColor: 'orange' }, });
src/svg-icons/action/pregnant-woman.js
barakmitz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionPregnantWoman = (props) => ( <SvgIcon {...props}> <path d="M9 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zm7 9c-.01-1.34-.83-2.51-2-3 0-1.66-1.34-3-3-3s-3 1.34-3 3v7h2v5h3v-5h3v-4z"/> </SvgIcon> ); ActionPregnantWoman = pure(ActionPregnantWoman); ActionPregnantWoman.displayName = 'ActionPregnantWoman'; ActionPregnantWoman.muiName = 'SvgIcon'; export default ActionPregnantWoman;
app/components/Keys/Add.js
soosgit/vessel
// @flow import React, { Component } from 'react'; import { Redirect } from 'react-router'; import { Button, Divider, Grid, Header, Segment } from 'semantic-ui-react'; import KeysGenerate from './Generate'; import KeysImport from './Import'; import KeysLogin from './Login'; import KeysCreate from './Create'; export default class Welcome extends Component { state = { importMethod: false } handleMethodChange = (e, props) => this.setState({ importMethod: props.value }) handleMethodReset = (e, props) => this.setState({ importMethod: false }) render() { let display = ( <Segment.Group> <Segment padded> <Header> Import a steemit.com account <Header.Subheader> By using your steemit.com username and password, your private keys can be derived and imported into your wallet. </Header.Subheader> </Header> <Button color="green" size="large" onClick={this.handleMethodChange} value="login-steemit" > Import a steemit.com account </Button> </Segment> <Segment padded> <Header> Import a private key <Header.Subheader> Any type of private key can be imported into your wallet, granting different levels of permission based on the key used. </Header.Subheader> </Header> <Button color="green" size="large" onClick={this.handleMethodChange} value="import-private-key" > Import a private key </Button> </Segment> <Segment padded> <Header> Experimental - Generate New Private Keys <Header.Subheader> For advanced users. Create a new set of public and private keys for a new Steem account. These <strong>public</strong> keys can then be given to another user or service allowing the creation of an account. </Header.Subheader> </Header> <Button color="black" size="large" onClick={this.handleMethodChange} value="generate-private-key" > Generate new private keys </Button> </Segment> </Segment.Group> ); switch (this.state.importMethod) { case 'import-private-key': display = ( <KeysImport handleMethodReset={this.handleMethodReset} {...this.props} /> ); break; case 'login-steemit': display = ( <KeysLogin handleMethodReset={this.handleMethodReset} {...this.props} /> ); break; case 'generate-private-key': display = ( <KeysGenerate handleMethodReset={this.handleMethodReset} {...this.props} /> ); break; default: { break; } } return display; } }
node_modules/react-router/es6/IndexLink.js
igMartin/Redux-Tinder
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; }; import React from 'react'; import Link from './Link'; /** * An <IndexLink> is used to link to an <IndexRoute>. */ var IndexLink = React.createClass({ displayName: 'IndexLink', render: function render() { return React.createElement(Link, _extends({}, this.props, { onlyActiveOnIndex: true })); } }); export default IndexLink;
packages/core/__deprecated__/Grid/index.js
romelperez/arwes
import React from 'react'; import withStyles from '../tools/withStyles'; import Grid from './Grid'; import styles from './styles'; const GridWithStyles = withStyles(styles)(Grid); export const Row = props => <GridWithStyles row {...props} />; export const Col = props => <GridWithStyles col {...props} />; export default GridWithStyles;
src/svg-icons/av/mic-none.js
lawrence-yu/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvMicNone = (props) => ( <SvgIcon {...props}> <path d="M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm-1.2-9.1c0-.66.54-1.2 1.2-1.2.66 0 1.2.54 1.2 1.2l-.01 6.2c0 .66-.53 1.2-1.19 1.2-.66 0-1.2-.54-1.2-1.2V4.9zm6.5 6.1c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"/> </SvgIcon> ); AvMicNone = pure(AvMicNone); AvMicNone.displayName = 'AvMicNone'; AvMicNone.muiName = 'SvgIcon'; export default AvMicNone;
examples/flux-utils-todomvc/js/app.js
kiopl/flux
/** * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */ 'use strict'; import React from 'react'; import TodoApp from './components/TodoApp.react'; React.render(<TodoApp />, document.getElementById('todoapp'));
src/Slider/index.js
szchenghuang/react-mdui
'use strict'; import React from 'react'; import PropTypes from 'prop-types'; import ClassNames from 'classnames'; import mdui from '../index'; class Slider extends React.Component { componentDidMount() { mdui.updateSliders( this.root ); } render() { const { className, step, min, max, value, discrete, disabled, onChange, ...restProps } = this.props; const clx = ClassNames({ ...( className && { [ className ]: true } ), 'mdui-slider': true, 'mdui-slider-discrete': discrete }); const props = { ...restProps, className: clx, ref: node => this.root = node }; const childProps = { type: 'range', step, min, max, value, ...( disabled && { disabled: true } ), onChange: event => onChange( event.target.value ) }; return ( <label { ...props }> <input { ...childProps } /> </label> ); } } Slider.propTypes = { style: PropTypes.object, className: PropTypes.string, step: PropTypes.number, min: PropTypes.number, max: PropTypes.number, value: PropTypes.number, discrete: PropTypes.any, disabled: PropTypes.any, onChange: PropTypes.func }; Slider.defaultProps = { step: 1, min: 0, max: 100, onChange: () => {} }; export default Slider;
packages/material-ui-icons/src/ExitToApp.js
cherniavskii/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <g><path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" /></g> , 'ExitToApp');
app/src/components/achievements/AchievementsOverview.js
kort/kort-native
import React, { Component } from 'react'; import { View, ListView, RefreshControl } from 'react-native'; import { connect } from 'react-redux'; import _ from 'lodash'; import I18n from 'react-native-i18n'; import AchievementItem from './AchievementItem'; import { downloadAchievements, clearErrorMsg } from '../../actions/AchievementsActions'; import { forceViewUpdateAchievements } from '../../actions/NavigationActions'; import { Spinner, Popup } from '../common'; class AchievementsOverview extends Component { componentWillMount() { this.props.downloadAchievements(false, this.props.user.id); } componentWillReceiveProps(nextProps) { if (nextProps.updateAchievementsView) { this.props.downloadAchievements(false, this.props.user.id); this.props.forceViewUpdateAchievements(false); } } onAccept() { this.props.clearErrorMsg(); } onRefresh() { this.props.downloadAchievements(true, this.props.user.id); } renderRow(rowData) { if (_.isEmpty(rowData)) { return <View style={styles.itemStyle} />; } return <AchievementItem achievement={rowData} />; } renderSpinner() { if (this.props.downloading) { return ( <Spinner size='large' style={styles.spinnerStyle} /> ); } return null; } render() { return ( <View style={styles.bgColor}> {this.renderSpinner()} <ListView contentContainerStyle={styles.list} dataSource={this.props.dataSource} renderRow={(rowData) => this.renderRow(rowData)} initialListSize={15} enableEmptySections refreshControl={ <RefreshControl refreshing={this.props.loading} onRefresh={this.onRefresh.bind(this)} colors={['#202931', 'white']} tintColor='white' />} /> <Popup visible={this.props.errorMsg !== null} onAccept={this.onAccept.bind(this)} message={I18n.t('error_message_bad_connectivity')} /> </View> ); } } const styles = { bgColor: { backgroundColor: '#202931', flex: 1, paddingTop: 60, paddingBottom: 50, }, list: { paddingTop: 10, paddingBottom: 10, justifyContent: 'center', flexDirection: 'row', flexWrap: 'wrap', }, itemStyle: { margin: 5, height: 100, width: 100 }, spinnerStyle: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, justifyContent: 'center', alignItems: 'center' } }; const dataSource = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2, }); const mapStateToProps = ({ achievementsReducer, authReducer, navigationReducer }) => { const { user } = authReducer; const { achievements, loading, downloading, errorMsg } = achievementsReducer; const { updateAchievementsView } = navigationReducer; return { dataSource: dataSource.cloneWithRows(achievements), loading, downloading, errorMsg, user, updateAchievementsView }; }; export default connect(mapStateToProps, { downloadAchievements, clearErrorMsg, forceViewUpdateAchievements })(AchievementsOverview);
client/src/index.js
ASU-CodeDevils/DemonHacks2017
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import registerServiceWorker from './registerServiceWorker'; ReactDOM.render(<App />, document.getElementById('root')); registerServiceWorker();
src/index.js
Gertrido/test-task-hypermethod
import React from 'react' import {render} from 'react-dom' import {Provider} from 'react-redux' import configureStore from './store/configureStore' import App from './containers/App' const store = configureStore() render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') )
test/js/AR/arNodeTest.js
viromedia/viro
/** * Copyright (c) 2017-present, Viro Media, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View } from 'react-native'; import { ViroARScene, ViroARPlane, ViroMaterials, ViroImage, ViroARPlaneSelector, ViroQuad, ViroConstants, ViroARNode, ViroBox, } from 'react-viro'; import TimerMixin from 'react-timer-mixin'; var createReactClass = require('create-react-class'); var testARScene = createReactClass({ mixins: [TimerMixin], getInitialState: function() { return { text : "not tapped", visible: true, everythingVisible: false, success: false, video : "", } }, render: function() { return ( <ViroARScene > <ViroARNode position={[0,0,-1]} onDrag={()=>{}}> <ViroBox position={[0,.13,0]} scale={[.2,.2,.2]} /> <ViroImage rotation={[-90,0,0]} scale={[.3,.3,.3]} source={require('./res/dark_circle_shadow.png')}/> </ViroARNode> </ViroARScene> ); }, }); const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#FFFFFF', }, welcome: { fontSize: 13, textAlign: 'center', color: '#ffffff', margin: 2, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, }, }); ViroMaterials.createMaterials({ blue: { shininess: 2.0, lightingModel: "Lambert", diffuseColor: "#0000ff" }, black: { shininess: 2.0, lightingModel: "Lambert", diffuseColor: "#000000" }, red: { shininess: 2.0, lightingModel: "Constant", diffuseColor: "#ff0000" }, green: { shininess: 2.0, lightingModel: "Constant", diffuseColor: "#00ff00" }, }); module.exports = testARScene;
src/index.js
JonKruger/openspaces-react
/* eslint-disable import/default */ import React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; import { Router, browserHistory } from 'react-router'; import routes from './routes'; import configureStore from './app/store/configureStore'; require('./favicon.ico'); // Tell webpack to load favicon.ico import './app/styles/styles.scss'; // Yep, that's right. You can import SASS/CSS files too! Webpack will run the associated loader and plug this into the page. import { syncHistoryWithStore } from 'react-router-redux'; // import {loadSessionListData} from './actions/SessionActions'; const store = configureStore(); // Create an enhanced history that syncs navigation events with the store const history = syncHistoryWithStore(browserHistory, store); render( <Provider store={store}> <Router history={history} routes={routes} /> </Provider>, document.getElementById('app') );
src/layouts/index.js
adrienlozano/stephaniewebsite
import React from 'react'; import Header from '~/components/header'; import Footer from '~/components/footer'; import { setDisplayName, compose, defaultProps } from 'recompose'; import { injectGlobal } from 'styled-components' import Head from 'react-helmet'; import { ThemeProvider } from 'styled-components'; import { Flex } from 'rebass'; import { Provider } from 'rebass'; import 'normalize.css'; import "react-responsive-carousel/lib/styles/carousel.css"; import 'mdi/css/materialdesignicons.css'; import 'typeface-roboto-slab'; import 'typeface-roboto'; import theme from "~/app/theme"; injectGlobal` * { box-sizing: border-box; } body, html, #PhenomicRoot, #PhenomicRoot > div { height: 100%; } ` const Body = ({children}) => (<div>{children}</div>); var Layout = ({children}) =>{ return ( <Provider theme={theme}> <Head> <script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script> </Head> <div style={{height: "100%" }}> <Header/> <Body>{children()}</Body> <Footer/> </div> </Provider> ); } var enhance = compose( setDisplayName('Layout') ); export default enhance(Layout); export { Layout };
definitions/npm/@kadira/storybook_v1.x.x/test_storybook_v1.x.x.js
mkscrg/flow-typed
// @flow import React from 'react'; import { action, storiesOf } from '@kadira/storybook'; storiesOf('div', module) .add('empty', () => ( <div onClick={action('click')} /> )) // $ExpectError .aad('empty', () => ( <div /> ));
src/containers/camper.js
chrischavarro/CamperLeaderboard
import React from 'react'; export default (props) => { return ( <tr> <td>{props.index+1}</td> <td> <img src={props.data.img} className="camperAvatar" /> <a href={props.data.camperURL}>{props.data.username}</a> </td> <td>{props.data.recent}</td> <td>{props.data.alltime}</td> </tr> ) }
src/esm/components/graphics/icons-next/people-icon-next/index.js
KissKissBankBank/kitten
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; var _excluded = ["color", "title"]; import React from 'react'; import PropTypes from 'prop-types'; export var PeopleIconNext = function PeopleIconNext(_ref) { var color = _ref.color, title = _ref.title, props = _objectWithoutPropertiesLoose(_ref, _excluded); return /*#__PURE__*/React.createElement("svg", _extends({ width: "10", height: "12", fill: "none", viewBox: "0 0 10 12", xmlns: "http://www.w3.org/2000/svg" }, props), title && /*#__PURE__*/React.createElement("title", null, title), /*#__PURE__*/React.createElement("path", { fill: color, fillRule: "evenodd", d: "M5 6a3 3 0 100-6 3 3 0 000 6zm0 6c2.761 0 5-.714 5-.714C10 8.919 7.761 7 5 7s-5 1.919-5 4.286c0 0 2.239.714 5 .714z", clipRule: "evenodd" })); }; PeopleIconNext.propTypes = { color: PropTypes.string, title: PropTypes.string }; PeopleIconNext.defaultProps = { color: '#222', title: null };
stories/Slider/index.js
nirhart/wix-style-react
import React from 'react'; import {storiesOf} from '@kadira/storybook'; import Markdown from '../utils/Components/Markdown'; import CodeExample from '../utils/Components/CodeExample'; import Readme from '../../src/Slider/README.md'; import ExampleStandard from './ExampleStandard'; import ExampleStandardRaw from '!raw!./ExampleStandard'; import ExampleControlled from './ExampleControlled'; import ExampleControlledRaw from '!raw!./ExampleControlled'; import ExampleRtl from './ExampleRtl'; import ExampleRtlRaw from '!raw!./ExampleRtl'; storiesOf('Core', module) .add('Slider', () => ( <div> <Markdown source={Readme}/> <h1>Usage examples</h1> <CodeExample title="Standard" code={ExampleStandardRaw}> <ExampleStandard/> </CodeExample> <CodeExample title="Standard RTL" code={ExampleRtlRaw}> <ExampleRtl/> </CodeExample> <CodeExample title="Controlled input" code={ExampleControlledRaw}> <ExampleControlled/> </CodeExample> </div> ));
src/components/fragment/Header/index.js
luanhaipeng/coolpeng-react
import React from 'react' import './index.less' import {Link} from 'react-router' export default class Header extends React.Component { constructor(props) { super(props) } renderRightLogin(){ const {user} = this.props; var userInfo = user.user; if(userInfo && user.isLogged){ return ( <div> 欢迎您:{userInfo.nickname} &nbsp;<span onClick={this.props.onClickLogout}>退出</span> </div> ); } return ( <div> <span>注册</span>&nbsp;/&nbsp; <span onClick={this.props.onClickLogin}>登录</span> </div>); } render() { return ( <div className='ant-layout-header'> <div className='page-content'> <h1 className="my-logo float-l" > <Link to="/home"> <span className="text">coolpeng</span> </Link> </h1> <Link to="/home"> home </Link> &nbsp;&nbsp;&nbsp; <Link to="/daohang"> daohang </Link> <div className="float-l"> </div> <div className="float-r login-btn"> {this.renderRightLogin()} </div> <div className="clear"></div> </div> </div> ) } }
example/screens/TrumpSortScreen.js
GantMan/useless-things
import React from 'react' import { StyleSheet, Text, View } from 'react-native' import { TrumpSort } from 'useless-things' const LENGTH = 15 const randomArray = () => [...new Array(LENGTH)] .map(() => Math.round(Math.random() * 99)) export default class App extends React.Component { render () { const currentArray = randomArray() return ( <View style={styles.container}> <Text style={styles.title}>Examples of Trump Sort</Text> <Text style={styles.thing}>Trump Sort Random Array</Text> <Text style={styles.text}> Random Array: {'\n' + currentArray + '\n\n'} Trump Sorted: {TrumpSort(currentArray) + '\n'} </Text> <Text style={[styles.title, {backgroundColor: 'rgba(0,0,0,0.4)'}]} onPress={() => this.forceUpdate()}> YUGE TRUMP SORT </Text> </View> ) } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#333', alignItems: 'center', justifyContent: 'center' }, title: { fontSize: 20, fontWeight: 'bold', color: 'red', padding: 10 }, thing: { fontSize: 18, color: '#fff', paddingTop: 40 }, text: { color: '#ccc' } })
es/Input/InputAdornment.js
uplevel-technology/material-ui-next
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; } import React from 'react'; import classNames from 'classnames'; import Typography from '../Typography'; import withStyles from '../styles/withStyles'; export const styles = theme => ({ root: { 'label + div > &': { marginTop: -theme.spacing.unit * 2, height: 26 } }, positionStart: { marginRight: theme.spacing.unit }, positionEnd: { marginLeft: theme.spacing.unit } }); class InputAdornment extends React.Component { render() { const _props = this.props, { children, component: Component, classes, className, disableTypography, position } = _props, other = _objectWithoutProperties(_props, ['children', 'component', 'classes', 'className', 'disableTypography', 'position']); return React.createElement( Component, _extends({ className: classNames(classes.root, { [classes.positionStart]: position === 'start', [classes.positionEnd]: position === 'end' }, className) }, other), typeof children === 'string' && !disableTypography ? React.createElement( Typography, { color: 'secondary' }, children ) : children ); } } InputAdornment.defaultProps = { component: 'div', disableTypography: false }; export default withStyles(styles, { name: 'MuiInputAdornment' })(InputAdornment);
packages/callout/src/js/react.js
govau/uikit
/*! [replace-name] v[replace-version] */ /*************************************************************************************************************************************************************** * * Callout function * * Use callout to notify and alert users of important snippets of information. * **************************************************************************************************************************************************************/ import React from 'react'; import PropTypes from 'prop-types'; // The following line will be replaced automatically with generic imports for the ES5 pipeline. // You can safely ignore this bit if you use this module with pancake // // [replace-imports] /** * Default callout * * @param {string} title - The title of the header * @param {string} level - The tag level (<h1/> <h2/> etc), default: '1' * @param {boolean} srOnlyTitle - Title is visible to screen readers only * @param {boolean} dark - Add the dark variation class, optional * @param {boolean} alt - Add the alt variation class, optional * @param {string} children - Anything inside * @param {string} className - An additional class, optional * @param {object} attributeOptions - Any other attribute options */ export const AUcallout = ({ title, level, srOnlyTitle, dark, alt, description, children, className = '', ...attributeOptions }) => { const HeadingTag = `h${ level }`; return ( <section className={ `au-callout ${ className }${ dark ? ' au-callout--dark' : '' }${ alt ? ' au-callout--alt' : '' }` } { ...attributeOptions } > <HeadingTag children={ title } className={ `au-callout__heading${ srOnlyTitle ? ' au-callout__heading--sronly' : '' }` } /> { children } </section> ) }; AUcallout.propTypes = { title: PropTypes.string.isRequired, level: PropTypes.number, srOnlyTitle: PropTypes.bool, dark: PropTypes.bool, alt: PropTypes.bool, children: PropTypes.node.isRequired, className: PropTypes.string, }; AUcallout.defaultProps = { level: 2, srOnlyTitle: false, }; /** * Calendar callout * * @param {string} title - The title of the header * @param {string} level - The tag level (<h1/> <h2/> etc), default: '1' * @param {boolean} srOnlyTitle - Title is visible to screen readers only * @param {boolean} dark - Add the dark variation class, optional * @param {boolean} alt - Add the alt variation class, optional * @param {string} subline - The subline of the event, optional * @param {string} datetime - The datetime of the event as ISO datetime * @param {string} time - The time that appears on the page * @param {string} name - The name of the event, optional * @param {string} className - An additional class, optional * @param {object} attributeOptions - Any other attribute options */ export const AUcalloutCalendar = ({ title, level, srOnlyTitle, dark, alt, subline, datetime, time, name, className = '', ...attributeOptions }) => { const HeadingTag = `h${ level }`; return ( <section className={ `au-callout au-callout--calendar-event ${ className }${ dark ? ' au-callout--dark' : '' }${ alt ? ' au-callout--alt' : '' }` } { ...attributeOptions } > <HeadingTag children={ title } className={ `au-callout__heading${ srOnlyTitle ? ' au-callout__heading--sronly' : '' }` } /> { subline && <p className="au-callout--calendar-event__lede">{ subline }</p> } <time className="au-callout--calendar-event__time" dateTime={ new Date( datetime ).toJSON() }>{ time }</time> { name && <span className="au-callout--calendar-event__name">{ name }</span> } </section> ) } AUcalloutCalendar.propTypes = { title: PropTypes.string.isRequired, level: PropTypes.number, srOnlyTitle: PropTypes.bool, dark: PropTypes.bool, alt: PropTypes.bool, subline: PropTypes.string, datetime: PropTypes.string.isRequired, time: PropTypes.string.isRequired, name: PropTypes.string, className: PropTypes.string, }; AUcalloutCalendar.defaultProps = { level: 2, srOnlyTitle: true, };
src/svg-icons/content/markunread.js
w01fgang/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ContentMarkunread = (props) => ( <SvgIcon {...props}> <path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/> </SvgIcon> ); ContentMarkunread = pure(ContentMarkunread); ContentMarkunread.displayName = 'ContentMarkunread'; ContentMarkunread.muiName = 'SvgIcon'; export default ContentMarkunread;
components/TodoForm.js
bobbyangelov/3things
import React from 'react'; import ReactDOM from 'react-dom'; class TodoForm extends React.Component { constructor() { super(); this.state = { text: '' }; } handleSubmit(e) { e.preventDefault(); this.props.addItem(this.refs.todoField.value); this.setState({text: ''}); this.refs.todoField.value = ''; } handleChange(e) { this.setState({ text: e.target.value }) } isDisabled() { return this.props.items.length > 2 || !this.state.text.length ? true : false } render() { const disabled = this.isDisabled(); return ( <div> <form onSubmit={this.handleSubmit.bind(this)} className="form-inline"> <input type="text" ref="todoField" onChange={this.handleChange.bind(this)} /> <input type="submit" value="+ Add" className="btn btn-primary" disabled={disabled}/> </form> </div> ); } } export default TodoForm
src/app/routes.js
mischlecht/HackWeekend2017-react-app
import React from 'react'; import { Route, IndexRoute } from 'react-router'; import App from './app.jsx'; import HomeController from '../home/home.controller.jsx'; import ImagesController from '../images/images.controller.jsx'; import NotFoundPage from '../shared/components/not-found-page.jsx'; export default ( <Route path="/" component={App}> <IndexRoute component={HomeController}/> <Route path="images" component={ImagesController}/> <Route path="*" component={NotFoundPage}/> </Route> );
tests/react_modules/es6class-proptypes-module.js
samwgoldman/flow
/* @flow */ import React from 'react'; import type {Node} from 'react'; class Hello extends React.Component<{name: string}> { defaultProps = {}; propTypes = { name: React.PropTypes.string.isRequired, }; render(): Node { return <div>{this.props.name}</div>; } } module.exports = Hello;
src/svg-icons/editor/insert-link.js
lawrence-yu/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let EditorInsertLink = (props) => ( <SvgIcon {...props}> <path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/> </SvgIcon> ); EditorInsertLink = pure(EditorInsertLink); EditorInsertLink.displayName = 'EditorInsertLink'; EditorInsertLink.muiName = 'SvgIcon'; export default EditorInsertLink;
examples/gatsby/src/pages/index.js
cherniavskii/material-ui
import React from 'react'; import PropTypes from 'prop-types'; import Button from 'material-ui/Button'; import Dialog, { DialogTitle, DialogContent, DialogContentText, DialogActions, } from 'material-ui/Dialog'; import Typography from 'material-ui/Typography'; import { withStyles } from 'material-ui/styles'; import withRoot from '../withRoot'; const styles = theme => ({ root: { textAlign: 'center', paddingTop: theme.spacing.unit * 20, }, }); class Index extends React.Component { state = { open: false, }; handleClose = () => { this.setState({ open: false, }); }; handleClick = () => { this.setState({ open: true, }); }; render() { const { classes } = this.props; const { open } = this.state; return ( <div className={classes.root}> <Dialog open={open} onClose={this.handleClose}> <DialogTitle>Super Secret Password</DialogTitle> <DialogContent> <DialogContentText>1-2-3-4-5</DialogContentText> </DialogContent> <DialogActions> <Button color="primary" onClick={this.handleClose}> OK </Button> </DialogActions> </Dialog> <Typography variant="display1" gutterBottom> Material-UI </Typography> <Typography variant="subheading" gutterBottom> example project </Typography> <Button variant="raised" color="secondary" onClick={this.handleClick}> Super Secret Password </Button> </div> ); } } Index.propTypes = { classes: PropTypes.object.isRequired, }; export default withRoot(withStyles(styles)(Index));
lib/components/Voter.js
pguth/puddin
import React from 'react' export default class Voter extends React.Component { onUpvote(e) { this.props.onVote(1) } onDownvote(e) { this.props.onVote(-1) } render() { return <div className="voter"> {this.props.vote > 0 ? <div className="up-vote" /> : null} {this.props.vote === 0 ? <div className="up-vote clickable" onClick={this.onUpvote.bind(this)} /> : null} <div className="count">{this.props.count}</div> {this.props.vote === 0 ? <div className="down-vote clickable" onClick={this.onDownvote.bind(this)} /> : null} {this.props.vote < 0 ? <div className="down-vote" /> : null} </div> } }
src/svg-icons/social/plus-one.js
ArcanisCz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let SocialPlusOne = (props) => ( <SvgIcon {...props}> <path d="M10 8H8v4H4v2h4v4h2v-4h4v-2h-4zm4.5-1.92V7.9l2.5-.5V18h2V5z"/> </SvgIcon> ); SocialPlusOne = pure(SocialPlusOne); SocialPlusOne.displayName = 'SocialPlusOne'; SocialPlusOne.muiName = 'SvgIcon'; export default SocialPlusOne;
src/docs/Docs.js
thomashoggard/ps-react-tom
import React from 'react'; import Navigation from './Navigation'; import ComponentPage from './ComponentPage'; import componentData from '../../config/componentData'; export default class Docs extends React.Component { constructor(props) { super(props); this.state = { route: window.location.hash.substr(1) }; } componentDidMount() { window.addEventListener('hashchange', () => { this.setState({route: window.location.hash.substr(1)}) }) } render() { const {route} = this.state; const component = route ? componentData.filter( component => component.name === route)[0] : componentData[0]; return ( <div> <Navigation components={componentData.map(component => component.name)} /> <ComponentPage component={component} /> </div> ) } }
Examples/src/components/InputExamples.js
sitb-software/ReactNativeComponents
import React from 'react'; import { View } from 'react-native'; import AbstractComponent from './AbstractComponent'; import Input from 'react-native-components/form/Input'; import Button from 'react-native-components/bootstrap/Button'; let dataSource = [ { placeholder: 'Default Input', }, { placeholder: 'Custom Style', style: { height: 30, borderRadius: 5, }, }, { placeholder: 'Icon Input', before: 'user', after: 'plus', style: { height: 30, borderRadius: 5, }, }, { placeholder: 'Input with Button', after: ( <Button beforeIcon="search" bsStyle="link" style={{ justifyContent: 'center', alignItems: 'center', width: 30 }} /> ), }, { placeholder: 'secureTextEntry', secureTextEntry: true, }, ]; /** * @author 田尘殇Sean([email protected]) * @date 16/5/5 */ class InputExamples extends AbstractComponent { constructor(props) { super(props, dataSource); } renderRow(input) { return ( <View style={{ marginTop: 10 }}> <Input {...input} /> </View> ); } } export default InputExamples;
src/components/sourcetree/original/SourcetreeOriginal.js
fpoumian/react-devicon
import React from 'react' import PropTypes from 'prop-types' import SVGDeviconInline from '../../_base/SVGDeviconInline' import iconSVG from './SourcetreeOriginal.svg' /** SourcetreeOriginal */ function SourcetreeOriginal({ width, height, className }) { return ( <SVGDeviconInline className={'SourcetreeOriginal' + ' ' + className} iconSVG={iconSVG} width={width} height={height} /> ) } SourcetreeOriginal.propTypes = { className: PropTypes.string, width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), } export default SourcetreeOriginal
src/index.js
ambershen/ambershen.github.io
import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter } from 'react-router-dom'; import App from './components/App'; ReactDOM.render( <BrowserRouter> <App /> </BrowserRouter>, document.getElementById('root'), );
src/SplitButton.js
JimiHFord/react-bootstrap
import React from 'react'; import BootstrapMixin from './BootstrapMixin'; import Button from './Button'; import Dropdown from './Dropdown'; import SplitToggle from './SplitToggle'; class SplitButton extends React.Component { render() { let { children, title, onClick, target, href, // bsStyle is validated by 'Button' component bsStyle, // eslint-disable-line ...props } = this.props; let { disabled } = props; let button = ( <Button onClick={onClick} bsStyle={bsStyle} disabled={disabled} target={target} href={href} > {title} </Button> ); return ( <Dropdown {...props}> {button} <SplitToggle aria-label={title} bsStyle={bsStyle} disabled={disabled} /> <Dropdown.Menu> {children} </Dropdown.Menu> </Dropdown> ); } } SplitButton.propTypes = { ...Dropdown.propTypes, ...BootstrapMixin.propTypes, /** * @private */ onClick() {}, target: React.PropTypes.string, href: React.PropTypes.string, /** * The content of the split button. */ title: React.PropTypes.node.isRequired }; SplitButton.defaultProps = { disabled: false, dropup: false, pullRight: false }; SplitButton.Toggle = SplitToggle; export default SplitButton;
src/components/widgets/RichTextEditorToolbox.js
rsamec/react-designer
import React from 'react'; import _ from 'lodash'; const TooltipStyle = { position: 'absolute', padding: '0 5px' }; const TooltipInnerStyle = { padding: '3px 8px', color: '#fff', textAlign: 'center', borderRadius: 3, backgroundColor: '#000', opacity: .75 }; const TooltipArrowStyle = { position: 'absolute', width: 0, height: 0, borderRightColor: 'transparent', borderLeftColor: 'transparent', borderTopColor: 'transparent', borderBottomColor: 'transparent', borderStyle: 'solid', opacity: .75 }; const PlacementStyles = { left: { tooltip: {marginLeft: -3, padding: '0 5px'}, arrow: { right: 0, marginTop: -5, borderWidth: '5px 0 5px 5px', borderLeftColor: '#000' } }, right: { tooltip: {marginRight: 3, padding: '0 5px'}, arrow: {left: 0, marginTop: -5, borderWidth: '5px 5px 5px 0', borderRightColor: '#000'} }, top: { tooltip: {marginTop: -3, padding: '5px 0'}, arrow: {bottom: 0, marginLeft: -5, borderWidth: '5px 5px 0', borderTopColor: '#000'} }, bottom: { tooltip: {marginBottom: 3, padding: '5px 0'}, arrow: {top: 0, marginLeft: -5, borderWidth: '0 5px 5px', borderBottomColor: '#000'} } }; export default class ToolTip extends React.Component { render() { let placementStyle = PlacementStyles[this.props.placement]; let { style, arrowOffsetLeft: left = placementStyle.arrow.left, arrowOffsetTop: top = placementStyle.arrow.top} = this.props; let tooltipStyle = _.extend({},TooltipStyle,placementStyle.tooltip,style); let tooltipArrowStyle = _.extend({},TooltipArrowStyle,placementStyle.arrow,{left:left,top:top}); return ( <div style={tooltipStyle}> <div style={tooltipArrowStyle}/> <div style={TooltipInnerStyle}> { this.props.children } </div> </div> ); } }
src/main.js
denn1s/nanoreno
import 'babel-polyfill' import 'whatwg-fetch' import React from 'react' import ReactDOM from 'react-dom' import FastClick from 'fastclick' import { Provider } from 'react-redux' import store from './store' import history from './history' import Scene from './Scene' import Start from './Start' import Credits from './Credits' import MainGame from './MainGame' // let routes = require('./scenes.json').default const container = document.getElementById('container') function renderComponent(component) { ReactDOM.render(<Provider store={store}>{component}</Provider>, container) } function render(location) { console.log(location.pathname) return renderComponent(<MainGame />) // router.resolve(routes, location) // .then(renderComponent) // .catch(error => router.resolve(routes, { ...location, error }).then(renderComponent)) } history.listen(render) render(history.location) FastClick.attach(document.body) /* if (module.hot) { module.hot.accept('./scenes.json', () => { routes = require('./scenes.json').default render(history.location) }) } */
src/components/board/Table.js
josephquested/plainscreen
import React from 'react' import Row from './Row' import Cell from './Cell' export default React.createClass({ generateTable: function () { let rows = new Array(Number(this.props.height)).fill() rows = rows.map((row, index) => { return <Row gameState={this.props.gameState} id={index} width={this.props.width} key={index}/> }) return ( <tbody> {rows} </tbody> ) }, render () { return ( <table id={this.props.id}> {this.generateTable()} </table> ) } })
geonode/monitoring/frontend/monitoring/src/components/organisms/ws-analytics/index.js
francbartoli/geonode
/* ######################################################################### # # Copyright (C) 2019 OSGeo # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### */ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import HoverPaper from '../../atoms/hover-paper'; import HR from '../../atoms/hr'; import WSServiceSelect from '../../molecules/ws-service-select'; import ResponseTime from '../../cels/response-time'; import Throughput from '../../cels/throughput'; import ErrorsRate from '../../cels/errors-rate'; import { getCount, getTime } from '../../../utils'; import styles from './styles'; import actions from './actions'; const mapStateToProps = (state) => ({ errors: state.wsErrorSequence.response, interval: state.interval.interval, responseTimes: state.wsServiceData.response, responses: state.wsResponseSequence.response, selected: state.wsService.service, throughputs: state.wsThroughputSequence.throughput, timestamp: state.interval.timestamp, }); @connect(mapStateToProps, actions) class WSAnalytics extends React.Component { static propTypes = { errors: PropTypes.object, getErrors: PropTypes.func.isRequired, getResponseTimes: PropTypes.func.isRequired, getResponses: PropTypes.func.isRequired, getThroughputs: PropTypes.func.isRequired, interval: PropTypes.number, resetErrors: PropTypes.func.isRequired, resetResponseTimes: PropTypes.func.isRequired, resetResponses: PropTypes.func.isRequired, resetThroughputs: PropTypes.func.isRequired, responseTimes: PropTypes.object, responses: PropTypes.object, selected: PropTypes.string, throughputs: PropTypes.object, timestamp: PropTypes.instanceOf(Date), } constructor(props) { super(props); this.get = ( service = this.props.selected, interval = this.props.interval, ) => { this.props.getResponses(service, interval); this.props.getResponseTimes(service, interval); this.props.getThroughputs(service, interval); this.props.getErrors(service, interval); }; this.reset = () => { this.props.resetResponses(); this.props.resetResponseTimes(); this.props.resetThroughputs(); this.props.resetErrors(); }; } componentWillMount() { if (this.props.timestamp && this.props.selected) { this.get(); } } componentWillReceiveProps(nextProps) { if (nextProps && nextProps.selected && nextProps.timestamp) { if ((nextProps.timestamp !== this.props.timestamp) || (nextProps.selected !== this.props.selected)) { this.get(nextProps.selected, nextProps.interval); } } } componentWillUnmount() { this.reset(); } render() { let responseData = []; let throughputData = []; let errorRateData = []; let averageResponseTime = 0; let maxResponseTime = 0; if (this.props.responseTimes) { const data = this.props.responseTimes.data.data; if (data.length > 0) { if (data[0].data.length > 0) { const metric = data[0].data[0]; maxResponseTime = Math.floor(metric.max); averageResponseTime = Math.floor(metric.val); } } } responseData = getTime(this.props.responses); throughputData = getCount(this.props.throughputs); errorRateData = getCount(this.props.errors); return ( <HoverPaper style={styles.content}> <h3>W*S Analytics</h3> <WSServiceSelect /> <ResponseTime average={averageResponseTime} max={maxResponseTime} data={responseData} /> <HR /> <Throughput data={throughputData} /> <HR /> <ErrorsRate data={errorRateData} /> </HoverPaper> ); } } export default WSAnalytics;
packages/type/examples/styled-components/src/App.js
carbon-design-system/carbon-components
import { display04 } from '@carbon/type'; import React, { Component } from 'react'; import styled from 'styled-components'; import logo from './logo.svg'; import './App.css'; const Title = styled.h1(display04); class App extends Component { render() { return ( <div className="App"> <header className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <Title> Hello world!{' '} <span aria-label="waving" role="img"> 👋 </span> </Title> <p> Edit <code>src/App.js</code> and save to reload. </p> <a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer"> Learn React </a> </header> </div> ); } } export default App;
docs/src/app/pages/components/PanelGroup/ExamplePanelGroupMultiStep.js
GetAmbassador/react-ions
import React from 'react' import {PanelGroup, Panel, PanelHeader, PanelContent} from 'react-ions/lib/components/PanelGroup' import Badge from 'react-ions/lib/components/Badge' import style from './style.scss' const content = { lorum1: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vehicula finibus purus, in ultrices mi ullamcorper in. Vestibulum porta varius sem, eu consectetur dui. Aliquam erat volutpat. Aliquam fringilla ullamcorper faucibus. Praesent purus lacus, interdum ac augue in, accumsan lacinia lorem. Nam pharetra lacus nisl, quis sagittis justo scelerisque ac. Phasellus euismod risus sit amet quam finibus, id sodales lectus scelerisque. Sed rhoncus magna neque, sed vulputate augue lobortis pharetra. Praesent placerat dui vitae fermentum tristique. Ut lobortis lacus scelerisque justo porta, quis porta nunc faucibus. Mauris ornare sem vel ornare ullamcorper. Nam tincidunt lacus ut varius faucibus. Maecenas varius lacus eget nisl condimentum, sed commodo justo euismod. Curabitur at justo quam.', lorum2: 'Sed rhoncus magna neque, sed vulputate augue lobortis pharetra. Praesent placerat dui vitae fermentum tristique.', lorum3: 'Ut lobortis lacus scelerisque justo porta, quis porta nunc faucibus. Mauris ornare sem vel ornare ullamcorper. Nam tincidunt lacus ut varius faucibus. Maecenas varius lacus eget nisl condimentum, sed commodo justo euismod. Curabitur at justo quam.', lorum4: 'Maecenas sit amet tellus vitae nisl gravida consectetur in vitae nibh. Quisque bibendum consectetur sagittis. Cras nec mauris maximus, egestas magna eget, vehicula ligula. Duis vestibulum leo at nisl placerat, euismod posuere ante accumsan. Vivamus gravida velit eu accumsan vulputate. Maecenas risus neque, mollis mollis est sit amet, porta feugiat nisi. Praesent maximus ut ante vel aliquet. Nunc mattis pharetra tellus, non volutpat lorem. Vestibulum odio arcu, laoreet a mi non, bibendum eleifend lorem. Nunc turpis lectus, malesuada id augue non, lacinia tristique orci. In fermentum, nibh id venenatis iaculis, lorem ipsum faucibus enim, vitae tincidunt lorem nunc eu tortor. Vestibulum gravida augue risus, non rhoncus velit feugiat vel. Vestibulum imperdiet velit a ligula eleifend rutrum. Vestibulum consequat, arcu sed aliquam pretium, metus metus consectetur lectus, in rutrum tellus metus a felis. Praesent lacus justo, pretium ac lacinia eu, luctus quis nisl.' } const ExamplePanelGroupMultiStep = () => ( <div> <PanelGroup accordion={true} optClass='multi-step'> <Panel> <PanelHeader title='What will your survey look like for each channel?' contextNode={<Badge text='1' />} toggleIcon={{name: 'md-keyboard-down', size: '14'}} /> <PanelContent optClass={style['rating-specific']}> <p className={style.paragraph}>{content.lorum1}</p> </PanelContent> </Panel> <Panel> <PanelHeader title='What happens after a user submits their response?' contextNode={<Badge text='2' />} toggleIcon={{name: 'md-keyboard-down', size: '14'}} /> <PanelContent> <p className={style.paragraph}>{content.lorum2}</p> </PanelContent> </Panel> <Panel> <PanelHeader title='Who should we send this survey to?' contextNode={<Badge text='3' />} toggleIcon={{name: 'md-keyboard-down', size: '14'}} /> <PanelContent> <p className={style.paragraph}>{content.lorum3}</p> </PanelContent> </Panel> <Panel> <PanelHeader title='Who should we not send this survey to?' contextNode={<Badge text='4' />} toggleIcon={{name: 'md-keyboard-down', size: '14'}} /> <PanelContent> <p className={style.paragraph}>{content.lorum4}</p> </PanelContent> </Panel> <Panel> <PanelHeader title='Where should we send survey notifications?' contextNode={<Badge text='5' />} toggleIcon={{name: 'md-keyboard-down', size: '14'}} /> <PanelContent> <p className={style.paragraph}>{content.lorum1}</p> </PanelContent> </Panel> </PanelGroup> </div> ) export default ExamplePanelGroupMultiStep
node_modules/@material-ui/styles/esm/styled/styled.js
pcclarke/civ-techs
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; import React from 'react'; import clsx from 'clsx'; import warning from 'warning'; import PropTypes from 'prop-types'; import { chainPropTypes, getDisplayName } from '@material-ui/utils'; import hoistNonReactStatics from 'hoist-non-react-statics'; import makeStyles from '../makeStyles'; function omit(input, fields) { var output = {}; Object.keys(input).forEach(function (prop) { if (fields.indexOf(prop) === -1) { output[prop] = input[prop]; } }); return output; } // styled-components's API removes the mapping between components and styles. // Using components as a low-level styling construct can be simpler. function styled(Component) { var componentCreator = function componentCreator(style) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var name = options.name, stylesOptions = _objectWithoutProperties(options, ["name"]); if (process.env.NODE_ENV !== 'production' && Component === undefined) { throw new Error(['You are calling styled(Component)(style) with an undefined component.', 'You may have forgotten to import it.'].join('\n')); } var classNamePrefix = name; if (process.env.NODE_ENV !== 'production' && !name) { // Provide a better DX outside production. classNamePrefix = getDisplayName(Component); process.env.NODE_ENV !== "production" ? warning(typeof classNamePrefix === 'string', ['Material-UI: the component displayName is invalid. It needs to be a string.', "Please fix the following component: ".concat(Component, ".")].join('\n')) : void 0; } var stylesOrCreator = typeof style === 'function' ? function (theme) { return { root: function root(props) { return style(_extends({ theme: theme }, props)); } }; } : { root: style }; var useStyles = makeStyles(stylesOrCreator, _extends({ Component: Component, name: name || Component.displayName, classNamePrefix: classNamePrefix }, stylesOptions)); var filterProps; var propTypes = {}; if (style.filterProps) { filterProps = style.filterProps; delete style.filterProps; } /* eslint-disable react/forbid-foreign-prop-types */ if (style.propTypes) { propTypes = style.propTypes; delete style.propTypes; } /* eslint-enable react/forbid-foreign-prop-types */ var StyledComponent = React.forwardRef(function StyledComponent(props, ref) { var children = props.children, classNameProp = props.className, clone = props.clone, ComponentProp = props.component, other = _objectWithoutProperties(props, ["children", "className", "clone", "component"]); var classes = useStyles(props); var className = clsx(classes.root, classNameProp); if (clone) { return React.cloneElement(children, { className: clsx(children.props.className, className) }); } var spread = other; if (filterProps) { spread = omit(spread, filterProps); } if (typeof children === 'function') { return children(_extends({ className: className }, spread)); } var FinalComponent = ComponentProp || Component; return React.createElement(FinalComponent, _extends({ ref: ref, className: className }, spread), children); }); process.env.NODE_ENV !== "production" ? StyledComponent.propTypes = _extends({ /** * A render function or node. */ children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), /** * @ignore */ className: PropTypes.string, /** * If `true`, the component will recycle it's children DOM element. * It's using `React.cloneElement` internally. */ clone: chainPropTypes(PropTypes.bool, function (props) { if (props.clone && props.component) { return new Error('You can not use the clone and component properties at the same time.'); } return null; }), /** * The component used for the root node. * Either a string to use a DOM element or a component. */ component: PropTypes.elementType }, propTypes) : void 0; if (process.env.NODE_ENV !== 'production') { StyledComponent.displayName = "Styled(".concat(classNamePrefix, ")"); } hoistNonReactStatics(StyledComponent, Component); return StyledComponent; }; return componentCreator; } export default styled;
responsive-visualizations-with-react/presentation.js
okonet/slides
import React, { Component } from 'react'; import Deck from "components/Deck.react"; import Slide from "components/Slide.react"; import Code from "components/Code.react"; import DocumentTitle from "react-document-title"; import demo1 from 'babel!./examples/demo1'; import demo1Code from 'raw!./examples/demo1'; import demo2 from 'babel!./examples/demo2'; import demo2Code from 'raw!./examples/demo2'; import demo3 from 'babel!./examples/demo3'; import demo3Code from 'raw!./examples/demo3'; import demo3ExplicitCode from 'raw!./examples/demo3-explicit'; import demoSvg from 'babel!./examples/demo-svg'; import demoSvgCode from 'raw!./examples/demo-svg'; import demoHtml from 'babel!./examples/demo-html'; import demoHtmlCode from 'raw!./examples/demo-html'; import demoCss from 'babel!./examples/demo-css'; import demoCssCode from 'raw!./examples/demo-css'; import "css/theme.css"; const TOPIC = 'Responsive Visualizations with React'; const SPEAKER = (<span>by <a href="http://okonet.ru">Andrey Okonetchnikov</a></span>) import 'prismjs/components/prism-json' import 'prismjs/components/prism-jsx' import 'style!css!prismjs/themes/prism-solarizedlight.css' export default () => <DocumentTitle title={TOPIC}> <Deck> <header className="caption"> <h1>{TOPIC}</h1> <p>{SPEAKER}</p> </header> <Slide className="cover-me"> <h2>{TOPIC}</h2> <p>{SPEAKER}</p> </Slide> <Slide> <div className="profile"> <img className="profile__photo" src="https://pbs.twimg.com/profile_images/678903331176214528/TQTdqGwD.jpg" alt="Andrey Okonetchnikov" /> <div className="profile__data"> <h2>Andrey Okonetchnikov</h2> <h3>Front-end Engineer</h3> <ul> <li><a href="https://twitter.com/okonetchnikov">@okonetchnikov</a></li> <li><a href="http://okonet.ru">okonet.ru</a></li> <li><a href="github.com/okonet">github.com/okonet</a></li> </ul> </div> </div> </Slide> <Slide className="picture"> <div className="place text-centered"> <h2> <a href="http://status.postmarkapp.com" className="link">http://status.postmarkapp.com</a> </h2> </div> <img src={require('./assets/status-responsive.gif')} alt="" className="cover" /> </Slide> <Slide> <h2>Simple chart</h2> {demo1} </Slide> <Slide className="code_small"> <h2>Simple chart</h2> <Code code={demo1Code} lang="jsx" /> </Slide> <Slide className="code_small"> <h2>Resizeable chart?</h2> <Code code={demo2Code} lang="jsx" /> </Slide> <Slide> <h2>Resizeable chart?</h2> {demo2} </Slide> <Slide> <h2 className="place emoji">🙄</h2> </Slide> <Slide> <h2 className="shout shrink">Let&rsquo;s fix it!</h2> </Slide> <Slide> <div className="place"> <Code code="npm install react-container-dimensions" lang="bash"></Code> </div> </Slide> <Slide className="code_small"> <h2>Before</h2> <Code code={demo2Code} lang="jsx" /> </Slide> <Slide className="code_small"> <h2>After</h2> <Code code={demo3Code} lang="jsx" /> </Slide> <Slide> <h2>Resizeable chart!</h2> {demo3} </Slide> <Slide> <h2 className="place emoji">🙌</h2> </Slide> <Slide className="code_small"> <h2>Implicit props</h2> <Code code={demo3Code} lang="jsx" /> </Slide> <Slide className="code_small"> <h2>Explicit props</h2> <Code code={demo3ExplicitCode} lang="jsx" /> </Slide> <Slide> <h2 className="shout shrink">Let&rsquo;s get creative!</h2> </Slide> <Slide className="code_small"> <h2>Math based on container dimensions</h2> <Code code={demoSvgCode} lang="jsx" /> </Slide> <Slide> <h2>Math based on container dimensions</h2> {demoSvg} </Slide> <Slide className="code_small"> <h2>Works with any element</h2> <Code code={demoHtmlCode} lang="jsx" /> </Slide> <Slide> <h2>Works with any element</h2> {demoHtml} </Slide> <Slide className="code_small"> <h2>Reacts on any CSS change</h2> <Code code={demoCssCode} lang="jsx" /> </Slide> <Slide> <h2>Reacts on any CSS change</h2> {demoCss} </Slide> <Slide> <p className="place emoji">😎</p> </Slide> <Slide> <h2>How does it work?</h2> <ol> <li>Uses <a hred="https://github.com/wnr/element-resize-detector">element-resize-detector</a> under the hood</li> <li>Doesn&rsquo;t create a <code>div</code> element between components</li> <li>Updates even on CSS changes</li> <li>Just wrap a component that accepts <code>width</code> and <code>height</code></li> <li>Or use a function that returns a component</li> <li>Higher-Order Component? (send me your PR!)</li> </ol> </Slide> <Slide> <div className="place text-centered"> <h2> <a href="https://github.com/okonet/react-container-dimensions" className="link">react-container-dimensions</a> </h2> <h3>🍴 or 🌟 it on GitHub</h3> </div> </Slide> <Slide> <h2 className="shout shrink">Breaking news!</h2> </Slide> <Slide className="picture"> <h2>Pictures</h2> <img src={require('./assets/twitter-conv.png')} alt="" className="cover" /> </Slide> <Slide> <h2>Bad news for <code>this.findDOMNode()</code></h2> <figure> <blockquote> <p>We think leaking internal details (state or DOM) should be explicit. Coupling should be intentional or it's easy to break.</p> </blockquote> <figcaption>Dan Abramov</figcaption> </figure> </Slide> <Slide> <h2>Bad news for <code>this.findDOMNode()</code></h2> <figure> <blockquote> <p>There are almost no situations where you’d want to use findDOMNode() over callback refs. We want to deprecate it eventually (not right now) because it blocks certain improvements in React in the future.</p> </blockquote> <figcaption>Dan Abramov</figcaption> </figure> </Slide> <Slide> <div className="place text-centered"> <h2> <a href="https://github.com/yannickcr/eslint-plugin-react/issues/678" className="link">https://github.com/yannickcr/eslint-plugin-react/issues/678</a> </h2> </div> </Slide> <Slide> <h2 className="shout shrink">Expect some API changes</h2> </Slide> <Slide> <h2 className="shout shrink">Thank you!</h2> </Slide> <Slide> <div className="profile"> <img className="profile__photo" src="https://pbs.twimg.com/profile_images/678903331176214528/TQTdqGwD.jpg" alt="Andrey Okonetchnikov" /> <div className="profile__data"> <h2>Andrey Okonetchnikov</h2> <h3>Front-end Engineer</h3> <ul> <li><a href="https://twitter.com/okonetchnikov">@okonetchnikov</a></li> <li><a href="http://okonet.ru">okonet.ru</a></li> <li><a href="github.com/okonet">github.com/okonet</a></li> </ul> </div> </div> </Slide> </Deck> </DocumentTitle>
src/svg-icons/action/all-out.js
xmityaz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionAllOut = (props) => ( <SvgIcon {...props}> <path d="M16.21 4.16l4 4v-4zm4 12l-4 4h4zm-12 4l-4-4v4zm-4-12l4-4h-4zm12.95-.95c-2.73-2.73-7.17-2.73-9.9 0s-2.73 7.17 0 9.9 7.17 2.73 9.9 0 2.73-7.16 0-9.9zm-1.1 8.8c-2.13 2.13-5.57 2.13-7.7 0s-2.13-5.57 0-7.7 5.57-2.13 7.7 0 2.13 5.57 0 7.7z"/> </SvgIcon> ); ActionAllOut = pure(ActionAllOut); ActionAllOut.displayName = 'ActionAllOut'; ActionAllOut.muiName = 'SvgIcon'; export default ActionAllOut;
src/views/HomeView.js
mjosh954/mtg-toolbox
import React from 'react'; import { connect } from 'react-redux'; import { Link } from 'react-router'; // import Paper from 'material-ui/lib/paper'; import FlatButton from 'material-ui/lib/flat-button'; import CardTitle from 'material-ui/lib/card/card-title'; import GitHubForkRibbon from 'react-github-fork-ribbon'; import Dice from '../components/Dice'; export class HomeView extends React.Component { render () { return ( <div style={{width: '100%', padding: '50px'}}> <GitHubForkRibbon href='https://github.com/mjosh954/mtg-toolbox' target='_blank' position='right' color='black'>Fork me on Github</GitHubForkRibbon> <div style={{textAlign: 'center', margin: '20px'}}> <img src={require('../assets/magic_elements.png')} /> <CardTitle title='MTG Toolbox' subtitle='A kit for all your MTG game needs.' /> <FlatButton containerElement={<Link to='/game' />} style={{width: '150px'}} linkButton label='Game Counter' /> <div style={{marginTop: '10px'}}> <Dice buttonWidth='150' style={{marginTop: '5px'}} /> </div> <div style={{marginTop: '10px'}}> <FlatButton containerElement={<Link to='/draft/signup' />} style={{width: '150px'}} linkButton label='Draft Signup' /> </div> </div> </div> ); } } export default connect()(HomeView);
src/components/Root/index.js
Apozhidaev/ergonode.com
import React, { Component } from 'react'; import moment from 'moment'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import { search, showMore } from 'store/app/book/root/actions'; import { navigate } from 'store/services/history/actions'; import Layout from '../Layout'; import StatePanel from '../StatePanel'; import ProgressBar from '../ProgressBar'; class Root extends Component { constructor(props) { super(props); this.handleChange = this.handleChange.bind(this); this.clear = this.clear.bind(this); this.create = this.create.bind(this); } handleChange(event) { const { onSearch } = this.props; onSearch(event.target.value); } clear() { const { onSearch } = this.props; onSearch(''); } create() { const { onNavigate } = this.props; onNavigate({ path: '/new' }); } render() { const { root, storageFetching, onShowMore } = this.props; const slots = root.displaySlots.map(slot => (<Link key={slot.id.toString()} to={`/slot/${slot.id}`} className="list-group-item list-group-item-action flex-column align-items-start" > <div className="d-flex w-100 justify-content-between"> {slot.content ? <h5 className="mb-1">{slot.summary}</h5> : <div>{slot.summary}</div>} <small>{moment(slot.creation).format('L')}</small> </div> {slot.content && <pre className="mb-1">{slot.content.encrypted ? <em className="text-warning">information is encrypted</em> : slot.content.value}</pre>} </Link>)); return ( <Layout> <div className="row"> <div className="col"> <div className="btn-toolbar justify-content-between" role="toolbar"> <div className="btn-group my-2" role="group" /> <div className="btn-group my-2" role="group"> <button type="button" className="btn btn-outline-success" onClick={this.create}> new </button> </div> </div> </div> </div> <div className="row mb-3"> <div className="col-md-2"> <StatePanel /> </div> <div className="col-md-10"> <div className="row"> <div className="col"> <div className="input-group my-2"> <input type="text" className="form-control" placeholder="search..." value={root.searchQuery} onChange={this.handleChange} /> {root.searchQuery && <span className="input-group-btn"> <button type="button" className="btn btn-secondary" onClick={this.clear} > &times; </button> </span>} </div> </div> </div> <div className="row"> <div className="col"> <ProgressBar progress={storageFetching && !slots.length && !root.searchQuery} /> <div className="list-group"> {!slots.length && root.searchQuery && <p className="p-2">slot not found</p>} {slots} </div> {root.canMore && <div className="d-flex justify-content-center"> <button type="button" className="btn btn-outline-info my-2" onClick={onShowMore} > more... </button> </div> } </div> </div> </div> </div> </Layout> ); } } const mapStateToProps = state => ({ root: state.app.book.root, storageFetching: state.services.sso.storageFetching, }); const mapDispatchToProps = ({ onSearch: search, onNavigate: navigate, onShowMore: showMore, }); export default connect(mapStateToProps, mapDispatchToProps)(Root);
src/Table.js
sheep902/react-bootstrap
import React from 'react'; import classNames from 'classnames'; const Table = React.createClass({ propTypes: { striped: React.PropTypes.bool, bordered: React.PropTypes.bool, condensed: React.PropTypes.bool, hover: React.PropTypes.bool, responsive: React.PropTypes.bool }, getDefaultProps() { return { bordered: false, condensed: false, hover: false, responsive: false, striped: false }; }, render() { let classes = { 'table': true, 'table-striped': this.props.striped, 'table-bordered': this.props.bordered, 'table-condensed': this.props.condensed, 'table-hover': this.props.hover }; let table = ( <table {...this.props} className={classNames(this.props.className, classes)}> {this.props.children} </table> ); return this.props.responsive ? ( <div className="table-responsive"> {table} </div> ) : table; } }); export default Table;
front/src/components/App/Video/index.js
MichaelKostin/mars-rover
import React, { Component } from 'react'; import WebSocketSignalingChannel from '../../../rwsClient/WebSocketSignalingChannel'; import './style.css'; export default class Video extends Component { constructor(props) { super(props); this.video = null; this.connect = null; this.disconnect = null; this.client = null; } componentDidMount() { this.client = new WebSocketSignalingChannel(this.connect, this.disconnect, this.video); } render() { return ( <section> <video ref={(videoRef) => this.video = videoRef} autoPlay playsInline controls muted width="100%" height="384" /> <div className="web-rtc-controls"> <button ref={(connectRef) => this.connect = connectRef}>Connect</button> <button ref={(disconnectRef) => this.disconnect = disconnectRef}>Disconnect</button> </div> </section> ) } }
docs/src/examples/elements/Loader/Variations/LoaderExampleInlineCentered.js
Semantic-Org/Semantic-UI-React
import React from 'react' import { Loader } from 'semantic-ui-react' const LoaderExampleInlineCentered = () => <Loader active inline='centered' /> export default LoaderExampleInlineCentered
ui/src/components/SmallSpinner/index.js
LearningLocker/learninglocker
import React from 'react'; import styled from 'styled-components'; import { rotation } from 'ui/utils/styled/animations'; const SmallSpinner = styled.div` height: 1.5em; width: 1.5em; margin: auto; animation: ${rotation} .6s infinite linear; border-left: 4px solid rgba(245, 170, 53, 0.15); border-right: 4px solid rgba(245, 170, 53, 0.15); border-bottom: 4px solid rgba(245, 170, 53, 0.15); border-top: 4px solid rgba(245, 170, 53, 0.8); border-radius: 100%; `; const smallSpinner = () => (<SmallSpinner />); export default smallSpinner;
client/src/MagicModeMarker.js
jghibiki/Doc
import React from 'react'; import AllInclusiveIcon from '@material-ui/icons/AllInclusive'; import Chip from '@material-ui/core/Chip'; import Avatar from '@material-ui/core/Avatar'; import MagicModeMarkerDialog from './MagicModeMarkerDialog.js' const MagicModeMarker = (props) => { const [dialogOpen, setDialogOpen] = React.useState(false); const [video, setVideo] = React.useState(props.video || null); const handleOpen = () => { setDialogOpen(true) } const handleClose = () => { setDialogOpen(false) } if(video !== null){ return ( <div> <Chip avatar={<Avatar><AllInclusiveIcon/></Avatar>} onClick={handleOpen} label="Magic Mode" /> <MagicModeMarkerDialog open={dialogOpen} onClose={handleClose} video={video}/> </div> ) } else{ return ( <div> <Chip avatar={<Avatar><AllInclusiveIcon/></Avatar>} label="Magic Mode" /> </div> ) } } export default MagicModeMarker
app/containers/LinkFormContainer/index.js
GeertHuls/react-async-saga-example
/* * * LinkFormContainer * */ import React from 'react'; import { connect } from 'react-redux'; import selectLinkFormContainer from './selectors'; import LinkForm from '../../components/LinkForm'; import { addLink, addLinkCancelled } from './actions'; export class LinkFormContainer extends React.Component { // eslint-disable-line react/prefer-stateless-function render() { return ( <LinkForm {...this.props} /> ); } } const mapStateToProps = selectLinkFormContainer(); function mapDispatchToProps(dispatch) { return { addLink: (link) => dispatch(addLink(link)), addLinkCancelled: () => dispatch(addLinkCancelled()), }; } export default connect(mapStateToProps, mapDispatchToProps)(LinkFormContainer);
app/scripts/routes.js
shawnrmoss/rsk
import React from 'react'; import { Router, Route } from 'react-router'; import createHistory from 'history/lib/createHashHistory' import App from './pages/app.jsx'; import Home from './pages/home.jsx'; import Info from './pages/info.jsx'; import NotFound from './pages/notFound.jsx'; import Login from './pages/Login/Login.jsx'; import {requireAuthentication} from './components/AuthenticatedComponent/AuthenticatedComponent.jsx'; const routes = ( <Router history={createHistory()}> <Route component={ Login } name="Login" path="Login"/> <Route path='/' component={ requireAuthentication(App) }> <Route path='info' component={ Info } /> <Route path='home' component={ Home } /> <Route path='*' component={NotFound}/> </Route> </Router> ); export default routes;
examples/js/style/table-class-table.js
echaouchna/react-bootstrap-tab
/* eslint max-len: 0 */ /* eslint no-unused-vars: 0 */ import React from 'react'; import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table'; const products = []; function addProducts(quantity) { const startId = products.length; for (let i = 0; i < quantity; i++) { const id = startId + i; products.push({ id: id, name: 'Item name ' + id, price: 2100 + i }); } } addProducts(5); export default class TableClassTable extends React.Component { render() { return ( <BootstrapTable data={ products } insertRow exportCSV tableHeaderClass='my-header-class' tableBodyClass='my-body-class' containerClass='my-container-class' tableContainerClass='my-table-container-class' headerContainerClass='my-header-container-class' bodyContainerClass='my-body-container-class'> <TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn> <TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn> <TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> </BootstrapTable> ); } }
client/src/components/layout/Header.js
anarinya/feedback-panda-server
import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import { connect } from 'react-redux'; import { Checkout } from '../billing'; class Header extends Component { renderContent() { const { auth } = this.props; const { credits } = auth || 0; switch (auth) { case false: // Not logged in return <li><a href="/auth/google">Login with Google</a></li>; case null: // Unknown authentication state return; default: // Logged in return [ <li key="1"><Checkout /></li>, <li className="credits" key="2">Credits: { credits }</li>, <li key="3"><a href="/api/logout">Logout</a></li> ]; } } render() { const { auth } = this.props; return ( <div className="Header"> <nav> <div className="nav-wrapper cyan lighten-2"> <Link className="left" to={ auth ? '/surveys' : '/' }> <span className="logo"></span> </Link> <ul id="nav-mobile" className="right"> { this.renderContent() } </ul> </div> </nav> </div> ); } } const mapStateToProps = ({ auth }) => ({ auth }); export default connect(mapStateToProps)(Header);
js/components/blocks/EmptyUserBlock.js
Sacret/githubify
'use strict'; import React from 'react'; /** * Empty user block contains message and links */ const EmptyUserBlock = React.createClass({ render() { return ( <div className="empty-user-block"> <div className="empty-user-block-content text-center"> <h3> Github user {this.props.uname} doesn't exist </h3> { this.props.info && this.props.info.login ? <p>You can visit <a href={this.props.info.login}>your page</a></p> : <p>You can visit <a href="/">home page</a></p> } </div> </div> ); } }); export default EmptyUserBlock;
src/Badge.js
kwnccc/react-bootstrap
import React from 'react'; import ValidComponentChildren from './utils/ValidComponentChildren'; import classNames from 'classnames'; const Badge = React.createClass({ propTypes: { pullRight: React.PropTypes.bool }, getDefaultProps() { return { pullRight: false }; }, hasContent() { return ValidComponentChildren.hasValidComponent(this.props.children) || (React.Children.count(this.props.children) > 1) || (typeof this.props.children === 'string') || (typeof this.props.children === 'number'); }, render() { let classes = { 'pull-right': this.props.pullRight, 'badge': this.hasContent() }; return ( <span {...this.props} className={classNames(this.props.className, classes)}> {this.props.children} </span> ); } }); export default Badge;
components/Tutorial/Article.stories.js
cofacts/rumors-site
import React from 'react'; import Article from './Article'; import { withKnobs, text, select } from '@storybook/addon-knobs'; export default { title: 'Tutorial/Article', component: 'Article', decorators: [withKnobs], }; export const Normal = () => ( <div style={{ padding: '20px' }}> <Article label={text('label', '1')} theme={select('theme', ['yellow', 'blue'], 'yellow')} title={text( 'title', '先看看別人是怎麼查核,從複核別人的查核回應開始吧!' )} subTitle={text( 'subTitle', '想寫出好的查核訊息前,先看看別人是怎麼查核的吧!' )} content={text( 'content', '「Cofacts 真的假的」上的訊息查核,是由世界各地的網友編輯,無償自主查核貢獻的喔!但是編輯們的查核成果,不見得就是正確完整的呢!因此,需要網友編輯們來覆核評價,協助篩選出好的查核結果。新手編輯們,也可以從中學習別人是怎麼查核闢謠呢!' )} subContent={[ { title: '尋找需要被覆核的回應', content: [ { type: 'text', data: `「最新查核」會列出其他志工編輯查核回應,以下不同篩選能幫你篩選出—— 「還未有效查核」:目前還沒有使用者覺得好的可疑訊息,推薦使用。 「熱門回報」:目前很多使用者想問真假的可疑訊息。 「熱門討論」:目前很多編輯查核回應的可疑訊息。 `, }, { type: 'image', data: 'https://fakeimg.pl/400x300/', }, { type: 'text', data: `「最新查核」會列出其他志工編輯查核回應,以下不同篩選能幫你篩選出—— 「還未有效查核」:目前還沒有使用者覺得好的可疑訊息,推薦使用。 「熱門回報」:目前很多使用者想問真假的可疑訊息。 「熱門討論」:目前很多編輯查核回應的可疑訊息。`, }, { type: 'image', data: 'https://fakeimg.pl/400x300/', }, ], }, { title: '尋找需要被覆核的回應', content: [ { type: 'text', data: `「最新查核」會列出其他志工編輯查核回應,以下不同篩選能幫你篩選出—— 「還未有效查核」:目前還沒有使用者覺得好的可疑訊息,推薦使用。 「熱門回報」:目前很多使用者想問真假的可疑訊息。 「熱門討論」:目前很多編輯查核回應的可疑訊息。 `, }, { type: 'image', data: 'https://fakeimg.pl/400x300/', }, { type: 'text', data: `「最新查核」會列出其他志工編輯查核回應,以下不同篩選能幫你篩選出—— 「還未有效查核」:目前還沒有使用者覺得好的可疑訊息,推薦使用。 「熱門回報」:目前很多使用者想問真假的可疑訊息。 「熱門討論」:目前很多編輯查核回應的可疑訊息。`, }, { type: 'image', data: 'https://fakeimg.pl/400x300/', }, ], }, ]} /> </div> );
examples/composable-components/redux/src/composable-component/index.js
Mercateo/component-check
import React, { Component } from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import DynamicComponent from '../dynamic-component'; import * as actionCreators from '../action-creators'; import styles from './composable-component.css'; class ComposableComponent extends Component { render() { const { seconds, actions: { addSecond, removeSecond, incrementSecond } } = this.props; return ( <div className={styles.container}> <button onClick={() => addSecond()}>Add dynamic component</button> <hr /> {seconds.map((second, index) => ( <div key={index}> <DynamicComponent index={index} second={second} incrementSecond={incrementSecond} /> <button onClick={() => removeSecond(index)}>Remove dynamic component</button> {index + 1 !== seconds.length ? <hr /> : null} </div> ))} </div> ); } } function mapStateToProps(state) { return { seconds: state.seconds }; } function mapDispatchToProps(dispatch) { return { actions: bindActionCreators(actionCreators, dispatch) }; } export default connect(mapStateToProps, mapDispatchToProps)(ComposableComponent);
node_modules/react-headroom/www/html.js
aimanaiman/supernomadfriendsquad
import React from 'react' import DocumentTitle from 'react-document-title' import { prefixLink } from 'gatsby-helpers' import { GoogleFont, TypographyStyle } from 'typography-react' import typography from './utils/typography' const BUILD_TIME = new Date().getTime() module.exports = React.createClass({ render () { return ( <html lang="en"> <head> <title>React Headroom</title> <meta charSet="utf-8" /> <meta httpEquiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=5.0" /> <GoogleFont typography={typography} /> <TypographyStyle typography={typography} /> </head> <body> <div id="react-mount" dangerouslySetInnerHTML={{ __html: this.props.body }} /> <script src={prefixLink(`/bundle.js?t=${BUILD_TIME}`)} /> </body> </html> ) }, })
app/src/components/content/UserPage/GroupStatus/index.js
ouxu/NEUQ-OJ
/** * Created by out_xu on 17/5/16. */ import React from 'react' import { Card, Table } from 'antd' import './index.less' const GroupStatus = (props) => { const columns = [ { title: 'avatar', dataIndex: 'avatar', width: 48 }, { title: 'content', dataIndex: 'content', render: (record, index) => <div /> } ] return ( <Card bordered={false} className='group-status'> <Table columns={columns} pagination={false} showHeader={false} rowKey={(record, key) => key} /> </Card> ) } export default GroupStatus
app/src/containers/Library.js
wtfil/google-music-unofficial-client
import React from 'react'; import {connect} from 'react-redux'; import {loadPlaylists} from '../actions'; import Row from '../components/Row'; @connect(state => state) export default class Library extends React.Component { static onEnter(dispatch) { return dispatch(loadPlaylists()); } render() { const {music} = this.props; return <div> <h5>My Playlists</h5> <Row items={music.playlists} imageField="suggestedPlaylistArtUrl" nameField="title" basePath="playlists" /> </div>; } }
docs/app/Examples/collections/Grid/Variations/GridStretchedExample.js
jamiehill/stardust
import React from 'react' import { Grid, Segment } from 'stardust' const { Column, Row } = Grid const GridStretchedExample = () => ( <Grid columns={3} divided> <Row stretched> <Column> <Segment>1</Segment> </Column> <Column> <Segment>1</Segment> <Segment>2</Segment> </Column> <Column> <Segment>1</Segment> <Segment>2</Segment> <Segment>3</Segment> </Column> </Row> </Grid> ) export default GridStretchedExample
docs/src/app/components/pages/components/Card/ExampleWithAvatar.js
w01fgang/material-ui
import React from 'react'; import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card'; import FlatButton from 'material-ui/FlatButton'; const CardExampleWithAvatar = () => ( <Card> <CardHeader title="URL Avatar" subtitle="Subtitle" avatar="images/jsa-128.jpg" /> <CardMedia overlay={<CardTitle title="Overlay title" subtitle="Overlay subtitle" />} > <img src="images/nature-600-337.jpg" /> </CardMedia> <CardTitle title="Card title" subtitle="Card subtitle" /> <CardText> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi. Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque. Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. </CardText> <CardActions> <FlatButton label="Action1" /> <FlatButton label="Action2" /> </CardActions> </Card> ); export default CardExampleWithAvatar;
assets/js/components/Truncate.js
mlapierre/Winds
import React from 'react' var Entities = require('html-entities').AllHtmlEntities, entities = new Entities(), normalizeWhitespace = require('normalize-html-whitespace') const truncate = (text, length = 15) => { if (text.length < length) return text return text.substring(0, length) + '...' } export default props => ( <span> {truncate(entities.decode(normalizeWhitespace(props.children)), props.limit)} </span> )
app/containers/LanguageProvider/index.js
keithalpichi/NobleNote
/* * * LanguageProvider * * this component connects the redux state language locale to the * IntlProvider component and i18n messages (loaded from `app/translations`) */ import React from 'react'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { IntlProvider } from 'react-intl'; import { makeSelectLocale } from './selectors'; export class LanguageProvider extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function render() { return ( <IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}> {React.Children.only(this.props.children)} </IntlProvider> ); } } LanguageProvider.propTypes = { locale: React.PropTypes.string, messages: React.PropTypes.object, children: React.PropTypes.element.isRequired, }; const mapStateToProps = createSelector( makeSelectLocale(), (locale) => ({ locale }) ); function mapDispatchToProps(dispatch) { return { dispatch, }; } export default connect(mapStateToProps, mapDispatchToProps)(LanguageProvider);
src/components/FlashMessage/index.js
iris-dni/iris-frontend
import React from 'react'; import styles from './flash-message.scss'; const TIMEOUT = 2000; const FlashMessage = React.createClass({ beginTimeout () { const duration = this.props.duration || TIMEOUT; return setTimeout(() => this.props.hideFlashMessage(), duration); }, componentDidMount () { this.timeoutId = this.beginTimeout(); }, componentWillReceiveProps (nextProps) { if (nextProps.text && this.props.text !== nextProps.text) { clearTimeout(this.timeoutId); this.timeoutId = this.beginTimeout(); } }, render () { return ( <strong className={styles[this.props.modifier || 'default']} role='alert'> {this.props.children || this.props.text} </strong> ); } }); export default FlashMessage;
stories/Breadcrubms/ExampleWithOnClick.js
skyiea/wix-style-react
import React from 'react'; import styles from './ExampleBreadcrumbs.scss'; import Breadcrumbs from '../../src/Breadcrumbs/Breadcrumbs'; const items = [{id: '1', value: 'first item'}, {id: '2', value: 'second item'}, {id: '3', value: 'third item'}]; export default () => <div> <div className={`${styles.onGrayBackground} ${styles.exampleWrapper}`}> <Breadcrumbs dataHook={'story-breadcrumbs-onclick'} items={items} onClick={item => { alert(`clicked element is: ${JSON.stringify(item)}`); }} /> </div> </div>;
components/preview/preview.js
DarcyChan/darcychan.com
/* Preview Component. The preview link component with a preview image, name, and category of the project. */ // External components import React from 'react'; import { Link } from 'react-router'; import { prefixLink } from 'gatsby-helpers'; // Internal components import { Icon, Glyph, Image } from 'components/common'; export default class Preview extends React.Component { render() { const { page, ...props } = this.props; return ( <div className="preview"> <Link className="preview-link" to={prefixLink(page.data.path)} {...props} > <span className="preview-image-wrapper" style={{ backgroundColor: page.data.bgColor }} > <Image className="preview-image" src={ page.data.preview ? prefixLink( `${page.data.path}images/${page.data .preview}` ) : prefixLink( `${page.data.path}images/preview.png` ) } alt={page.data.title} width={500} height={500} /> </span> <span className="preview-info"> <span className="preview-subtitle"> {page.data.category} </span> <span className="preview-title"> <span className="preview-title-label"> {page.data.title} </span> <Icon glyph={Glyph.ArrowRight} className="preview-title-arrow" /> </span> </span> </Link> </div> ); } }
docs/src/stories/CustomWidths.js
byumark/react-table
/* eslint-disable import/no-webpack-loader-syntax */ import React from 'react' import _ from 'lodash' import namor from 'namor' import ReactTable from '../../../lib/index' class Story extends React.PureComponent { render () { const data = _.map(_.range(5553), d => { return { firstName: namor.generate({ words: 1, numLen: 0 }), lastName: namor.generate({ words: 1, numLen: 0 }), age: Math.floor(Math.random() * 30) } }) const columns = [{ Header: 'Name', columns: [{ Header: 'First Name', accessor: 'firstName', maxWidth: 200 }, { Header: 'Last Name', id: 'lastName', accessor: d => d.lastName, width: 300 }] }, { Header: 'Info', columns: [{ Header: 'Age', accessor: 'age', minWidth: 400 }] }] return ( <div> <div className='table-wrap'> <ReactTable className='-striped -highlight' data={data} columns={columns} defaultPageSize={10} /> </div> <div style={{textAlign: 'center'}}> <br /> <em>Tip: Hold shift when sorting to multi-sort!</em> </div> </div> ) } } // Source Code const CodeHighlight = require('./components/codeHighlight').default const source = require('!raw!./CustomWidths') export default () => ( <div> <Story /> <CodeHighlight>{() => source}</CodeHighlight> </div> )
src/js/components/Calendar/stories/SundayFirstDay.js
HewlettPackard/grommet
import React from 'react'; import { Box, Calendar, Grommet } from 'grommet'; import { grommet } from 'grommet/themes'; // When the first day of the month is Sunday, and the request of firstDayOfWeek // is Monday, we are verifing we are not missing a week, issue 3253. export const SundayFirstDayCalendar = () => ( <Grommet theme={grommet}> <Box align="center" pad="large"> <Calendar firstDayOfWeek={1} date={new Date(2019, 8, 2).toISOString()} /> </Box> </Grommet> ); SundayFirstDayCalendar.storyName = '1st on Sunday'; export default { title: `Visualizations/Calendar/1st on Sunday`, };
app/components/AssignedProblem.js
jmpressman/REACTO-platform
import React from 'react'; import { connect } from 'react-redux'; import Carousel from 'nuka-carousel'; const AssignedProblem = (props) => { console.log('PROBLEM PROPS', props); const assignedProblem = props.assignedProblem; return ( <div className="col-lg-10"> <h3>{assignedProblem.name}</h3> <text>{assignedProblem.prompt}</text> <div> <iframe className="col-lg-10" src={assignedProblem.solution_slide} width="576" height="420" scrolling="no" frameBorder="0" allowFullScreen></iframe> </div> </div> ) } const mapStateToProps = (state) => { return { user: state.auth, assignedProblem: state.problem.assignedProblem } } export default connect (mapStateToProps, null)(AssignedProblem); /* <Carousel> { assignedProblem.solution_slide && assignedProblem.solution_slide.map((slide, idx) => { return <text key={idx}>{slide}</text> }) } </Carousel> */
app/javascript/mastodon/features/followers/index.js
tootsuite/mastodon
import React from 'react'; import { connect } from 'react-redux'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { debounce } from 'lodash'; import LoadingIndicator from '../../components/loading_indicator'; import { lookupAccount, fetchAccount, fetchFollowers, expandFollowers, } from '../../actions/accounts'; import { FormattedMessage } from 'react-intl'; import AccountContainer from '../../containers/account_container'; import Column from '../ui/components/column'; import HeaderContainer from '../account_timeline/containers/header_container'; import ColumnBackButton from '../../components/column_back_button'; import ScrollableList from '../../components/scrollable_list'; import MissingIndicator from 'mastodon/components/missing_indicator'; import TimelineHint from 'mastodon/components/timeline_hint'; const mapStateToProps = (state, { params: { acct, id } }) => { const accountId = id || state.getIn(['accounts_map', acct]); if (!accountId) { return { isLoading: true, }; } return { accountId, remote: !!(state.getIn(['accounts', accountId, 'acct']) !== state.getIn(['accounts', accountId, 'username'])), remoteUrl: state.getIn(['accounts', accountId, 'url']), isAccount: !!state.getIn(['accounts', accountId]), accountIds: state.getIn(['user_lists', 'followers', accountId, 'items']), hasMore: !!state.getIn(['user_lists', 'followers', accountId, 'next']), isLoading: state.getIn(['user_lists', 'followers', accountId, 'isLoading'], true), blockedBy: state.getIn(['relationships', accountId, 'blocked_by'], false), }; }; const RemoteHint = ({ url }) => ( <TimelineHint url={url} resource={<FormattedMessage id='timeline_hint.resources.followers' defaultMessage='Followers' />} /> ); RemoteHint.propTypes = { url: PropTypes.string.isRequired, }; export default @connect(mapStateToProps) class Followers extends ImmutablePureComponent { static propTypes = { params: PropTypes.shape({ acct: PropTypes.string, id: PropTypes.string, }).isRequired, accountId: PropTypes.string, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, hasMore: PropTypes.bool, isLoading: PropTypes.bool, blockedBy: PropTypes.bool, isAccount: PropTypes.bool, remote: PropTypes.bool, remoteUrl: PropTypes.string, multiColumn: PropTypes.bool, }; _load () { const { accountId, isAccount, dispatch } = this.props; if (!isAccount) dispatch(fetchAccount(accountId)); dispatch(fetchFollowers(accountId)); } componentDidMount () { const { params: { acct }, accountId, dispatch } = this.props; if (accountId) { this._load(); } else { dispatch(lookupAccount(acct)); } } componentDidUpdate (prevProps) { const { params: { acct }, accountId, dispatch } = this.props; if (prevProps.accountId !== accountId && accountId) { this._load(); } else if (prevProps.params.acct !== acct) { dispatch(lookupAccount(acct)); } } handleLoadMore = debounce(() => { this.props.dispatch(expandFollowers(this.props.accountId)); }, 300, { leading: true }); render () { const { accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, remote, remoteUrl } = this.props; if (!isAccount) { return ( <Column> <MissingIndicator /> </Column> ); } if (!accountIds) { return ( <Column> <LoadingIndicator /> </Column> ); } let emptyMessage; if (blockedBy) { emptyMessage = <FormattedMessage id='empty_column.account_unavailable' defaultMessage='Profile unavailable' />; } else if (remote && accountIds.isEmpty()) { emptyMessage = <RemoteHint url={remoteUrl} />; } else { emptyMessage = <FormattedMessage id='account.followers.empty' defaultMessage='No one follows this user yet.' />; } const remoteMessage = remote ? <RemoteHint url={remoteUrl} /> : null; return ( <Column> <ColumnBackButton multiColumn={multiColumn} /> <ScrollableList scrollKey='followers' hasMore={hasMore} isLoading={isLoading} onLoadMore={this.handleLoadMore} prepend={<HeaderContainer accountId={this.props.accountId} hideTabs />} alwaysPrepend append={remoteMessage} emptyMessage={emptyMessage} bindToDocument={!multiColumn} > {blockedBy ? [] : accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />, )} </ScrollableList> </Column> ); } }
NewsDemoNavTab/Component/ZPFind.js
HAPENLY/ReactNative-Source-code-Demo
/** * Created by zhaopengsong on 2016/12/13. */ /** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View } from 'react-native'; var ZPFind = React.createClass({ render() { return ( <View style={styles.container}> <Text style={styles.welcome}> 发现1111 </Text> </View> ); }, }); const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, }); module.exports = ZPFind;
examples/src/components/MultiSelectField.js
webcoding/react-select
import React from 'react'; import Select from 'react-select'; function logChange() { console.log.apply(console, [].concat(['Select value changed:'], Array.prototype.slice.apply(arguments))); } var MultiSelectField = React.createClass({ displayName: 'MultiSelectField', propTypes: { label: React.PropTypes.string, }, getInitialState () { return { disabled: false, value: [] }; }, handleSelectChange (value, values) { logChange('New value:', value, 'Values:', values); this.setState({ value: value }); }, toggleDisabled (e) { this.setState({ 'disabled': e.target.checked }); }, render () { var ops = [ { label: 'Chocolate', value: 'chocolate' }, { label: 'Vanilla', value: 'vanilla' }, { label: 'Strawberry', value: 'strawberry' }, { label: 'Caramel', value: 'caramel' }, { label: 'Cookies and Cream', value: 'cookiescream' }, { label: 'Peppermint', value: 'peppermint' } ]; return ( <div className="section"> <h3 className="section-heading">{this.props.label}</h3> <Select multi={true} disabled={this.state.disabled} value={this.state.value} placeholder="Select your favourite(s)" options={ops} onChange={this.handleSelectChange} /> <div className="checkbox-list"> <label className="checkbox"> <input type="checkbox" className="checkbox-control" checked={this.state.disabled} onChange={this.toggleDisabled} /> <span className="checkbox-label">Disabled</span> </label> </div> </div> ); } }); module.exports = MultiSelectField;
stories/Button.js
schneckentempo/ClicksAndImpressions
import React from 'react'; const buttonStyles = { border: '1px solid #eee', borderRadius: 3, backgroundColor: '#FFFFFF', cursor: 'pointer', fontSize: 15, padding: '3px 10px', margin: 10, }; const Button = ({ children, onClick }) => ( <button style={buttonStyles} onClick={onClick} > {children} </button> ); Button.propTypes = { children: React.PropTypes.string.isRequired, onClick: React.PropTypes.func, }; export default Button;