path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
07-formik-example/src/helper.js
iproduct/course-node-express-react
import React from 'react'; export const DisplayFormikState = props => <div style={{ margin: '1rem 0' }}> <h3 style={{ fontFamily: 'monospace' }} /> <pre style={{ background: '#f6f8fa', fontSize: '.65rem', padding: '.5rem', }} > <strong>props</strong> ={' '} {JSON.stringify(props, null, 2)} </pre> </div>; export const MoreResources = props => <div> <hr style={{ margin: '3rem 0' }} /> <h3>More Examples</h3> <ul> <li> <a href="https://codesandbox.io/s/q8yRqQMp" target="_blank" rel="noopener" > Synchronous validation </a> </li> <li> <a href="https://codesandbox.io/s/qJR4ykJk" target="_blank" rel="noopener" > Building your own custom inputs </a> </li> <li> <a href="https://codesandbox.io/s/jRzE53pqR" target="_blank" rel="noopener" > 3rd-party input components: React-select </a> </li> <li> <a href="https://codesandbox.io/s/QW1rqjBLl" target="_blank" rel="noopener" > 3rd-party input components: Draft.js </a> </li> <li> <a href="https://codesandbox.io/s/pgD4DLypy" target="_blank" rel="noopener" > Accessing Lifecyle Methods (resetting a form externally) </a> </li> </ul> <h3 style={{ marginTop: '1rem' }}> Additional Resources </h3> <ul> <li> <a href="https://github.com/jaredpalmer/formik" target="_blank" rel="noopener" > GitHub Repo </a> </li> <li> <a href="https://github.com/jaredpalmer/formik/issues" target="_blank" rel="noopener" > Issues </a> </li> <li> <a href="https://twitter.com/jaredpalmer" target="_blank" rel="noopener" > Twitter (@jaredpalmer) </a> </li> </ul> </div>;
app/components/events/contributions/ContributionList.js
alexko13/block-and-frame
import React, { Component } from 'react'; import Contribution from './ContributionListItem'; import ContributeButton from './ContributeButton'; class ContributionList extends Component { componentDidMount() { $('.message .close').on('click', function () { $(this).closest('.message').transition('fade'); }); } render() { const openContributions = this.props.contributions.reduce((prev, current) => { if (!current.bringer) { return true; } return prev; }, false); return ( <div> {!this.props.isAttending ? <div className={`ui attached ${this.props.msgDivClass} message`}> {/* TODO: add close message behavior */} {this.props.msgDivClass === 'positive' ? <h1>Joined!</h1> : ''} <i className="close icon"></i> <div className="header small"> <p>Let everyone know what you're bringing!</p> <p>Remember to commit to a contribution before joining!</p> </div> <p>Just check the box under a contribution.</p> </div> : null} <div className="ui raised segment"> <div className="ui header medium">{openContributions ? 'Bring Something!' : 'What people are bringing'}</div> {this.props.isAttending && openContributions ? <ContributeButton onClick={this.props.onContributionUpdate} eventId={this.props.eventId} /> : null} <div className="ui divider"></div> <div className="ui two cards"> {this.props.contributions.map((contrib, index) => <Contribution key={index} {...contrib} ref={`contribution-${index}`} _onCheckBoxClick={this.props.onCheckBoxClick} /> )} </div> </div> </div> ); } } module.exports = ContributionList;
src/components/ui/Card.js
yursky/recommend
/** * Cards * <Card></Card> * * React Native Starter App * https://github.com/mcnamee/react-native-starter-app */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Card } from 'react-native-elements'; // Consts and Libs import { AppSizes, AppColors, AppStyles } from '@theme/'; /* Component ==================================================================== */ class CustomCard extends Component { static propTypes = { containerStyle: PropTypes.oneOfType([ PropTypes.array, PropTypes.shape({}), ]), titleStyle: PropTypes.oneOfType([ PropTypes.array, PropTypes.shape({}), ]), } static defaultProps = { containerStyle: [], titleStyle: [], } cardProps = () => { // Defaults const props = { dividerStyle: [{ backgroundColor: AppColors.border, }], ...this.props, containerStyle: [{ backgroundColor: AppColors.cardBackground, borderRadius: AppSizes.borderRadius, borderColor: AppColors.border, }], titleStyle: [ AppStyles.h2, { marginBottom: 15 }, ], }; if (this.props.containerStyle) { props.containerStyle.push(this.props.containerStyle); } if (this.props.titleStyle) { props.titleStyle.push(this.props.titleStyle); } return props; } render = () => <Card {...this.cardProps()} /> } /* Export Component ==================================================================== */ export default CustomCard;
pages/about.js
mmaarrttyy/next-blog
import React from 'react' import Layout from '../components/MyLayout.js' import BasicPage from '../components/BasicPage.js' import Cosmic from '../models/cosmic' export default class About extends React.Component { static async getInitialProps () { return await Cosmic.getPage('about') } render () { const page = this.props.object return <BasicPage page={page} title='About page!!'/> } }
src/components/form/Checkbox.js
ashmaroli/jekyll-admin
import React, { Component } from 'react'; import PropTypes from 'prop-types'; export default class Checkbox extends Component { handleChange(e) { const { onChange } = this.props; onChange(e.target.checked); } render() { const { text, checked } = this.props; return ( <div className="checkbox-container"> {text} <label className="switch"> <input onChange={(e) => this.handleChange(e)} type="checkbox" defaultChecked={checked} ref="checkbox" /> <div className="slider round" /> </label> </div> ); } } Checkbox.propTypes = { text: PropTypes.string.isRequired, checked: PropTypes.bool.isRequired, onChange: PropTypes.func.isRequired };
src/components/pages/lesson/ListView.js
yiweimatou/yishenghoutai
import React from 'react' import { GridList, GridTile } from 'material-ui/GridList' const styles = { img :{ cursor: 'pointer' } } const ListView = ( props ) => { const { list,onClick } = props return ( <GridList padding = { 60 } cols = { 4 } > { list.map( tile => { return <GridTile key = { tile.lid } title = { tile.lname } > <img src = { tile.cover } alt = 'cover' onClick = { ()=>onClick(tile.lid) } style = { styles.img } /> </GridTile> }) } </GridList> ) } ListView.propTypes = { list : React.PropTypes.array.isRequired, onClick : React.PropTypes.func.isRequired } export default ListView
src/App/App.js
amysimmons/a-guide-to-the-care-and-feeding-of-new-devs
import React from 'react'; import Header from '../Header/Header'; import Recommendations from '../Recommendations/Recommendations' import Findings from '../Findings/Findings' import StorySelectors from '../StorySelectors/StorySelectors' import Footer from '../Footer/Footer'; require("./App.css"); var App = React.createClass({ getInitialState(){ let storyData = this.loadData(); let selectedStory = null; let selectedStories = 0; return{ storyData: storyData, selectedStory: selectedStory, selectedStories: selectedStories }; }, loadData(){ return require("json!../Data/stories.json"); }, selectStory(selectedStory){ var selectedStory = selectedStory; var selectedStories = this.state.selectedStories; if (!selectedStory["selected"]) { selectedStories++; selectedStory["selected"] = true; } this.setState({selectedStory:selectedStory, selectedStories:selectedStories}); }, render(){ var storyData = this.state.storyData; var selectedStory = this.state.selectedStory; var selectedStories = this.state.selectedStories; var selectStory = this.selectStory; return ( <div className="app-container"> <Header/> <Findings storyData={storyData}/> <Recommendations/> <StorySelectors storyData={storyData} selectedStory={selectedStory} selectedStories={selectedStories} selectStory={selectStory}/> <Footer/> </div> ) } }); module.exports = App;
src/components/Overlay.js
edauenhauer/google-drive-copy-folder
/** * A static semi-opaque overlay with a spinner and optional message * to indicate loading, processing, or other wait times. */ 'use strict'; import React from 'react'; import Spinner from './icons/Spinner'; import PropTypes from 'prop-types'; export default function Overlay(props) { // fixed position overlay seems to work better with inline styles // credits: //https://css-tricks.com/quick-css-trick-how-to-center-an-object-exactly-in-the-center/ return ( <div> {/* overlay */} <div style={{ position: 'fixed', top: 0, left: 0, width: '100%', height: '100%', backgroundColor: '#fff', opacity: 0.5, zIndex: 1000 }} /> {/* Message */} <div style={{ position: 'fixed', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', opacity: 1, zIndex: 1001, textAlign: 'center', backgroundColor: '#fff', padding: '2em', boxShadow: '0px 0px 20px 0px #bababa' }} > <Spinner width="4em" height="4em" /> <div>{props.label}</div> </div> </div> ); } Overlay.propTypes = { label: PropTypes.string };
examples/search-highlighting/index.js
ashutoshrishi/slate
import { Editor } from 'slate-react' import { Value } from 'slate' import React from 'react' import initialValue from './value.json' /** * The rich text example. * * @type {Component} */ class SearchHighlighting extends React.Component { /** * Deserialize the initial editor value. * * @type {Object} */ state = { value: Value.fromJSON(initialValue), } /** * On change, save the new `value`. * * @param {Change} change */ onChange = ({ value }) => { this.setState({ value }) } /** * On input change, update the decorations. * * @param {Event} event */ onInputChange = event => { const { value } = this.state const string = event.target.value const texts = value.document.getTexts() const decorations = [] texts.forEach(node => { const { key, text } = node const parts = text.split(string) let offset = 0 parts.forEach((part, i) => { if (i != 0) { decorations.push({ anchorKey: key, anchorOffset: offset - string.length, focusKey: key, focusOffset: offset, marks: [{ type: 'highlight' }], }) } offset = offset + part.length + string.length }) }) // setting the `save` option to false prevents this change from being added // to the undo/redo stack and clearing the redo stack if the user has undone // changes. const change = value .change() .setOperationFlag('save', false) .setValue({ decorations }) .setOperationFlag('save', true) this.onChange(change) } /** * Render. * * @return {Element} */ render() { return ( <div> {this.renderToolbar()} {this.renderEditor()} </div> ) } /** * Render the toolbar. * * @return {Element} */ renderToolbar = () => { return ( <div className="menu toolbar-menu"> <div className="search"> <span className="search-icon material-icons">search</span> <input className="search-box" type="search" placeholder="Search the text..." onChange={this.onInputChange} /> </div> </div> ) } /** * Render the Slate editor. * * @return {Element} */ renderEditor = () => { return ( <div className="editor"> <Editor placeholder="Enter some rich text..." value={this.state.value} onChange={this.onChange} renderMark={this.renderMark} spellCheck /> </div> ) } /** * Render a Slate mark. * * @param {Object} props * @return {Element} */ renderMark = props => { const { children, mark } = props switch (mark.type) { case 'highlight': return <span style={{ backgroundColor: '#ffeeba' }}>{children}</span> } } } /** * Export. */ export default SearchHighlighting
components/CellListProvider.js
lodev09/react-native-cell-components
import React from 'react'; import PropTypes from 'prop-types'; import Cell from './Cell'; import SelectList from './SelectList'; import { View, StyleSheet } from 'react-native'; export const CellListItem = function(props) { return <View {...props} />; } class CellListProvider extends React.Component { static propTypes = { ...SelectList.propTypes, itemValidator: PropTypes.string } constructor(props) { super(props); this.state = { source: null, selecting: false } } componentDidUpdate(prevProps, prevState) { if (this.state.selecting !== prevState.selecting) { if (this.state.source && this.state.selecting === true) { this.open(); } } } handleCellListOnPress = (props) => { this.setState({ selecting: true, source: { ...props } // notice: not mutating props }); } renderChildren(children) { return React.Children.map(children, (component, i) => { // null child if (React.isValidElement(component) === false) return component; if (component.type !== CellListItem) { if (React.Children.count(component.props.children) === 0) return component; else { return React.cloneElement( component, {}, this.renderChildren(component.props.children) ); } } return ( <Cell onPress={() => this.handleCellListOnPress(component.props)} {...component.props} /> ); }); } close(callback) { this._selectList.close(callback); } open() { this._selectList.open(); } handleSelectListItemOnPress = (selectedItem, onPressCallback) => { if (!this.state.source) return; this.close(() => { onPressCallback(selectedItem); }); } handleSelectListOnClose = () => { this.setState({ selecting: false, source: null }); } renderSelectList() { if (!this.state.source) return; const { listData, listHeader, listFooter, listPlaceholder, listItemTitle, listItemValue, listItemSubtitle, listItemIcon, listItemValidator, listSection, listSelected, listItemOnPress, icon } = this.state.source; return ( <SelectList {...this.props} modal renderHeader={listHeader} renderFooter={listFooter} ref={component => this._selectList = component} data={listData} itemTitle={listItemTitle} itemValue={listItemValue} itemSubtitle={listItemSubtitle} icon={listItemIcon || icon} itemValidator={listItemValidator} onItemPress={item => this.handleSelectListItemOnPress(item, listItemOnPress)} section={listSection} selected={listSelected} onClose={this.handleSelectListOnClose} placeholder={listPlaceholder} /> ); } render() { return ( <View style={styles.container} > {this.renderSelectList()} {this.renderChildren(this.props.children)} </View> ); } } const styles = StyleSheet.create({ container: { flex: 1 } }); export default CellListProvider;
_older/demos/student_chart/components/select-group/SelectBy.es6.js
widged/SOT-skills-report
import React from 'react'; let {Component} = React; export default class SelectBy extends Component { constructor(props) { super(props); let {onChange} = props; var optionChange = function(event) { onChange(event.target.value); } this.state = {optionChange: optionChange}; } render() { var {lookups, title} = this.props; var {optionChange} = this.state; return ( <select-group> <span class="title">{title}</span> <select onChange={optionChange}> <option value=''></option> {lookups.map(({key, title}) => { return ( <option value={key}>{title}</option> ); })} </select> </select-group> ); } }
src/components/NoMatch.js
chaselden/Local-Vintage-SUVs
import React from 'react' export default function NoMatch () { return ( <div role="warning" className="o-warning"> <p>Can not find the site you are looking for.</p> </div> ) }
src/App.js
barock19/react-hot-boilerplate
import React, { Component } from 'react'; export default class App extends Component { render() { return ( <h1>Hello, world.</h1> ); } }
website-prototyping-tools/playground.js
NevilleS/relay
/** * Copyright (c) 2013-present, 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. */ import 'babel/polyfill'; import React from 'react'; window.React = React; import ReactDOM from 'react-dom'; import RelayPlayground from './RelayPlayground'; import filterObject from 'fbjs/lib/filterObject'; import queryString from 'querystring'; const DEFAULT_CACHE_KEY = 'default'; const IS_TRUSTED = ( ( // Running in an iframe on the Relay website window.self !== window.top && /^https?:\/\/facebook.github.io\//.test(document.referrer) ) || // Running locally /^(127\.0\.0\.1|localhost)/.test(document.location.host) ); let sourceWasInjected = false; function setHash(object) { // Caution: setting it to nothing causes the page to jump to the top, hence /. window.location.hash = queryString.stringify(object) || '/'; } // Don't trust location.hash not to have been unencoded by the browser var hash = window.location.href.split('#')[1]; let queryParams = queryString.parse(hash); let { cacheKey, noCache, } = queryParams; noCache = (noCache !== undefined) && (noCache !== 'false'); if (noCache) { cacheKey = undefined; } else if (!cacheKey) { cacheKey = DEFAULT_CACHE_KEY; } const appSourceCacheKey = `rp-${cacheKey}-source`; const schemaSourceCacheKey = `rp-${cacheKey}-schema`; let initialAppSource; let initialSchemaSource; const storedAppSource = localStorage.getItem(appSourceCacheKey); const storedSchemaSource = localStorage.getItem(schemaSourceCacheKey); if (noCache) { // Use case #1 // We use the noCache param to force a playground to have certain contents. // eg. static example apps initialAppSource = queryParams.source || ''; initialSchemaSource = queryParams.schema || ''; sourceWasInjected = true; queryParams = {}; } else if (cacheKey === DEFAULT_CACHE_KEY) { // Use case #2 // The user loaded the playground without a custom cache key. // Allow code injection via the URL // OR load code from localStorage // OR prime the playground with some default 'hello world' code if (queryParams.source != null) { initialAppSource = queryParams.source; sourceWasInjected = queryParams.source !== storedAppSource; } else if (storedAppSource != null) { initialAppSource = storedAppSource; } else { initialAppSource = require('!raw!./HelloApp'); } if (queryParams.schema != null) { initialSchemaSource = queryParams.schema; sourceWasInjected = queryParams.schema !== storedSchemaSource; } else if (storedSchemaSource != null) { initialSchemaSource = storedSchemaSource; } else { initialSchemaSource = require('!raw!./HelloSchema'); } queryParams = filterObject({ source: queryParams.source, schema: queryParams.schema, }, v => v !== undefined); } else if (cacheKey) { // Use case #3 // Custom cache keys are useful in cases where you want to embed a playground // that features both custom boilerplate code AND saves the developer's // progress, without overwriting the default code cache. eg. a tutorial. if (storedAppSource != null) { initialAppSource = storedAppSource; } else { initialAppSource = queryParams[`source_${cacheKey}`]; if (initialAppSource != null) { sourceWasInjected = true; } } if (storedSchemaSource != null) { initialSchemaSource = storedSchemaSource; } else { initialSchemaSource = queryParams[`schema_${cacheKey}`]; if (initialSchemaSource != null) { sourceWasInjected = true; } } queryParams = {}; } setHash(queryParams); const mountPoint = document.createElement('div'); document.body.appendChild(mountPoint); ReactDOM.render( <RelayPlayground autoExecute={IS_TRUSTED || !sourceWasInjected} initialAppSource={initialAppSource} initialSchemaSource={initialSchemaSource} onSchemaSourceChange={function(source) { localStorage.setItem(schemaSourceCacheKey, source); if (cacheKey === DEFAULT_CACHE_KEY) { queryParams.schema = source; setHash(queryParams); } }} onAppSourceChange={function(source) { localStorage.setItem(appSourceCacheKey, source); if (cacheKey === DEFAULT_CACHE_KEY) { queryParams.source = source; setHash(queryParams); } }} />, mountPoint );
app/components/SignInPage.js
JSSolutions-Academy/newsly
import React from 'react'; const SignInPage = () => ( <div className="card-panel z-depth-4"> <h1>trello common news feed</h1> <h5> <a href="/auth/trello"> sign in with trello </a> </h5> </div> ); export default SignInPage;
src/documentation/Grid/Grid-story.js
wfp/ui
/* eslint-disable no-console */ import React from 'react'; import { storiesOf } from '@storybook/react'; import Link from '../../components/Link'; import Page from '../Page'; storiesOf('Design|Core', module) .addParameters({ options: { showPanel: false, isToolshown: false } }) .add('Grid', () => ( <Page title="Grid system" subTitle="Recommendations for grid system"> <p> The UI Kit doesn't come with a CSS grid system. We recommend the use of a modern flexbox based grid system like{' '} <Link href="http://flexboxgrid.com/">Flexbox Grid</Link>, which is also available as react components. </p> <ul className="wfp--story__list"> <li> <Link href="http://flexboxgrid.com/" target="_blank"> Flexbox Grid </Link>{' '} A grid system based on the flex display property. </li> <li> <Link href="https://roylee0704.github.io/react-flexbox-grid/" target="_blank"> React-FlexBox-Grid </Link>{' '} The React module of Flexbox Grid </li> </ul> </Page> ));
src-client/components/StyleSizeInput.js
ipselon/structor
/* * Copyright 2017 Alexander Pustovalov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { isObject, isString, get, set, debounce, startCase } from 'lodash'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; const unitList = ['px', 'em', '%', 'ex', 'ch', 'rem', 'vw', 'vh', 'cm', 'mm', 'in', 'pt', 'pc']; const getUnitsOfProperty = (propertyValue) => { if (propertyValue) { let checkString; if (isString(propertyValue)) { checkString = propertyValue; } else { checkString = '' + propertyValue; } checkString = checkString.toLowerCase(); let found = unitList.find(u => checkString.indexOf(u) > 0); if (found) { return found; } else { return 'px'; } } return 'px'; }; const getValueOfProperty = (propertyValue) => { if (propertyValue) { let checkValue = parseFloat(propertyValue); if (isFinite(checkValue)) { return checkValue; } } return 0; }; const getStateObject = (valueObject, path) => { let value; if (valueObject && isObject(valueObject)) { value = get(valueObject, path); } let label = path.split('.'); if (label && label.length > 1) { label = startCase(label[1]); } else { label = path.replace('.', ' / '); } return { valueObject: valueObject, label: label, value: getValueOfProperty(value), units: getUnitsOfProperty(value), }; }; const rowContainerStyle = { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', position: 'relative', width: '100%', marginTop: '3px', }; const inputStyle = { height: '1.55em', paddingTop: '2px', paddingBottom: '2px' }; const buttonStyle = { width: '2em', }; const doubleButtonStyle = { width: '4em', }; const checkBoxStyle = {margin: 0}; const labelStyle = {margin: '0px 0px 0px 3px'}; class StyleSizeInput extends Component { constructor (props) { super(props); this.state = getStateObject(props.valueObject, props.path); this.handleChangeInputValue = this.handleChangeInputValue.bind(this); this.handleToggleOption = this.handleToggleOption.bind(this); this.handleToggleFavorite = this.handleToggleFavorite.bind(this); this.handleChangeUnits = this.handleChangeUnits.bind(this); this.changeValueByMouse = this.changeValueByMouse.bind(this); this.changeValue = this.changeValue.bind(this); } componentWillReceiveProps (nextProps) { const {valueObject, path} = nextProps; this.setState(getStateObject(valueObject, path)); } componentDidMount () { this.delayedChangeInputValue = debounce(valueObject => { if (this.props.onChangeValue) { this.props.onChangeValue(valueObject); } }, 1000); } componentWillUnmount () { this.delayedChangeInputValue.cancel; } handleChangeInputValue (e) { const value = e.currentTarget.value; this.setState({value}); this.changeValue(value, this.state.units, true); } handleToggleOption (e) { const {path, onSet} = this.props; const checked = e.currentTarget.checked; onSet(path, checked); } handleToggleFavorite (e) { e.stopPropagation(); e.preventDefault(); const {path, onToggleFavorite} = this.props; onToggleFavorite(path); } handleChangeUnits (e) { const newUnits = e.currentTarget.dataset.units; this.setState({ units: newUnits, }); this.changeValue(this.state.value, newUnits); } handleMouseDown = (direction) => (e) => { e.stopPropagation(); e.preventDefault(); this.setState({isMouseDown: true}); this.changeValueByMouse(direction); }; handleMouseUp = (e) => { e.stopPropagation(); e.preventDefault(); this.setState({isMouseDown: false}); }; changeValueByMouse (direction) { setTimeout(() => { const {value, units} = this.state; let newValue = direction === 'up' ? (value + 1) : (value - 1); this.setState({value: newValue}); this.changeValue(newValue, units); if (this.state.isMouseDown) { this.changeValueByMouse(direction); } }, 200); }; changeValue (newValue, newUnits, delay = false) { const value = getValueOfProperty(newValue); let valueObject = set({}, this.props.path, '' + value + newUnits); if (delay) { this.delayedChangeInputValue(valueObject); } else { this.props.onChangeValue(valueObject); } } render () { const {isSet, isFavorite} = this.props; const {label, units, value} = this.state; return ( <div style={this.props.style}> <div style={rowContainerStyle}> <input type="checkbox" style={checkBoxStyle} checked={isSet} onChange={this.handleToggleOption}/> <div style={{flexGrow: 1}}> <p style={labelStyle}> {isSet ? <strong>{label}</strong> : <span className="text-muted">{label}</span>} </p> </div> <div style={{flexGrow: 0}}> <i className={'fa text-muted ' + (isFavorite ? 'fa-heart' : 'fa-heart-o')} style={{cursor: 'pointer'}} title={isFavorite ? 'Remove from the favorites list' : 'Add to the favorites list'} onClick={this.handleToggleFavorite} /> </div> </div> {isSet && <div style={rowContainerStyle}> <div style={{flexGrow: 2}}> <div style={doubleButtonStyle}> <div className="btn-group"> <button className="btn btn-default btn-xs" style={buttonStyle} onMouseDown={this.handleMouseDown('up')} onMouseUp={this.handleMouseUp} type="button"> <i className="fa fa-plus"/> </button> <button className="btn btn-default btn-xs" style={buttonStyle} onMouseDown={this.handleMouseDown('down')} onMouseUp={this.handleMouseUp} type="button"> <i className="fa fa-minus"/> </button> </div> </div> </div> <div style={{flexGrow: 1}}> <div> <div className="input-group"> <input type="text" style={inputStyle} className="form-control" value={value} onChange={this.handleChangeInputValue}/> <div key="unitsButton" className="input-group-btn" role="group"> <button className="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown"> <span>{units}</span> </button> <ul className="dropdown-menu dropdown-menu-right" role="menu"> {unitList.map((u, index) => { return ( <li key={u + index}> <a href="#" data-units={u} onClick={this.handleChangeUnits}> {u} </a> </li> ); })} </ul> </div> </div> </div> </div> </div> } </div> ); } } StyleSizeInput.propTypes = { valueObject: PropTypes.any.isRequired, path: PropTypes.string.isRequired, isSet: PropTypes.bool.isRequired, onSet: PropTypes.func.isRequired, onChangeValue: PropTypes.func.isRequired, }; StyleSizeInput.defaultProps = { valueObject: null, path: 'style.width', isSet: false, onSet: (path, checked) => { console.log(path, checked); }, onChangeValue: (valueObject) => { console.log(JSON.stringify(valueObject)); }, }; export default StyleSizeInput;
packages/reactor-kitchensink/src/examples/Layouts/vbox/vbox.js
markbrocato/extjs-reactor
import React, { Component } from 'react'; import { Container, Panel, Spacer } from '@extjs/ext-react'; import colors from '../../colors'; export default class VBoxLayoutExample extends Component { render() { const panelProps = { height: 175, margin: '0 0 40 0', defaults: { layout: 'center' } }; return ( <Container padding={Ext.os.is.Phone ? 20 : 30}> <Panel shadow ui="instructions" margin="0 0 40 0"> <div>A <b>vbox</b> layout positions items vertically with optional 'pack', and 'align' configs.</div> </Panel> <div style={styles.heading}>align: 'stretch'</div> <Panel shadow layout="vbox" {...panelProps}> <Container style={colors.card.red} flex={1}>Item 1</Container> <Container style={colors.card.blue} flex={1}>Item 2</Container> <Container style={colors.card.green} flex={1}>Item 3</Container> </Panel> <div style={styles.heading}>align: 'left'</div> <Panel shadow layout={{ type: 'vbox', align: 'left' }} {...panelProps}> <Container style={colors.card.red} flex={1}>Item 1</Container> <Container style={colors.card.blue} flex={1}>Item 2</Container> <Container style={colors.card.green} flex={1}>Item 3</Container> </Panel> <div style={styles.heading}>align: 'right'</div> <Panel shadow layout={{ type: 'vbox', align: 'right' }} {...panelProps}> <Container style={colors.card.red} flex={1}>Item 1</Container> <Container style={colors.card.blue} flex={1}>Item 2</Container> <Container style={colors.card.green} flex={1}>Item 3</Container> </Panel> <div style={styles.heading}>pack: 'start'</div> <Panel shadow layout={{ type: 'vbox', pack: 'start' }} {...panelProps}> <Container style={colors.card.red}>Item 1</Container> <Container style={colors.card.blue}>Item 2</Container> <Container style={colors.card.green}>Item 3</Container> </Panel> <div style={styles.heading}>pack: 'center'</div> <Panel shadow layout={{ type: 'vbox', pack: 'center' }} {...panelProps}> <Container style={colors.card.red}>Item 1</Container> <Container style={colors.card.blue}>Item 2</Container> <Container style={colors.card.green}>Item 3</Container> </Panel> <div style={styles.heading}>pack: 'end'</div> <Panel shadow layout={{ type: 'vbox', pack: 'end' }} {...panelProps}> <Container style={colors.card.red}>Item 1</Container> <Container style={colors.card.blue}>Item 2</Container> <Container style={colors.card.green}>Item 3</Container> </Panel> <div style={styles.heading}>pack: 'space-between'</div> <Panel shadow layout={{ type: 'vbox', pack: 'space-between' }} {...panelProps}> <Container style={colors.card.red}>Item 1</Container> <Container style={colors.card.blue}>Item 2</Container> <Container style={colors.card.green}>Item 3</Container> </Panel> <div style={styles.heading}>pack: 'space-around'</div> <Panel shadow layout={{ type: 'vbox', pack: 'space-around' }} {...panelProps}> <Container style={colors.card.red}>Item 1</Container> <Container style={colors.card.blue}>Item 2</Container> <Container style={colors.card.green}>Item 3</Container> </Panel> </Container> ) } } const styles = { heading: { fontSize: '13px', fontFamily: 'Menlo, Courier', margin: '0 0 8px 0' } }
games/jab/game3/src/scripts/modules/About.js
jabrena/ReactLab
import React from 'react' export default React.createClass({ render() { return ( <div className="row"> <div className="col-xs-12"> <div className="card"> <div className="card-header">About</div> <div className="card-block text-md-center"> <p className="card-text"> Egyptian civilization developed advanced maths in their age. This web application tries to learn some aspects about egyptian maths in a gamified way. </p> <table className="table"> <thead> <tr> <th>Symbol</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td><div className="cssIcon"><span className="oneDigit_1"></span></div></td> <td>1</td> </tr> <tr> <td><div className="cssIcon"><span className="twoDigit_1"></span></div></td> <td>10</td> </tr> <tr> <td><div className="cssIcon"><span className="threeDigit_1"></span></div></td> <td>100</td> </tr> <tr> <td><div className="cssIcon"><span className="fourDigit_1"></span></div></td> <td>1000</td> </tr> <tr> <td><div className="cssIcon"><span className="fifthDigit_1"></span></div></td> <td>10000</td> </tr> <tr> <td><div className="cssIcon"><span className="sixthDigit_1"></span></div></td> <td>100000</td> </tr> <tr> <td><div className="cssIcon"><span className="seventhDigit_1"></span></div></td> <td>1000000</td> </tr> </tbody> </table> </div> </div> </div> </div> ) } })
ui/src/containers/BasicQueryBuilder/Select/Select.js
LearningLocker/learninglocker
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; import Dropdown from '../Dropdown/Dropdown'; const StyledSelect = styled.div` position: relative; cursor: pointer; &:focus { outline: 0; } `; const Content = styled.div` display: flex; flex-direction: row; `; const Value = styled.div` justify-content: flex-start; flex-grow: 1; `; const Indicator = styled.div` margin-left: 2px; justify-content: flex-end; width: 10px; `; class Select extends Component { static propTypes = { value: PropTypes.string, children: PropTypes.node, onSelect: PropTypes.func, } state = { focused: false, } focus = () => { this.setState({ focused: true }); } blur = () => { this.setState({ focused: false }); } render = () => ( <StyledSelect onFocus={this.focus} onBlur={this.blur} tabIndex={0}> <Content className={'btn btn-default btn-xs'}> <Value>{this.props.value}</Value> <Indicator> { this.state.focused ? (<div className="ion-arrow-down-b" />) : (<div className="ion-arrow-up-b" />) } </Indicator> </Content> { this.state.focused && <Dropdown onSelect={this.props.onSelect}> {this.props.children} </Dropdown> } </StyledSelect> ); } export default Select;
node_modules/enzyme/src/ShallowTraversal.js
kaizensauce/campari-app
import React from 'react'; import isEmpty from 'lodash/isEmpty'; import isSubset from 'is-subset'; import { coercePropValue, propsOfNode, splitSelector, isCompoundSelector, selectorType, AND, SELECTOR, nodeHasType, } from './Utils'; export function childrenOfNode(node) { if (!node) return []; const maybeArray = propsOfNode(node).children; const result = []; React.Children.forEach(maybeArray, child => { if (child !== null && child !== false && typeof child !== 'undefined') { result.push(child); } }); return result; } export function hasClassName(node, className) { let classes = propsOfNode(node).className || ''; classes = classes.replace(/\s/g, ' '); return ` ${classes} `.indexOf(` ${className} `) > -1; } export function treeForEach(tree, fn) { if (tree !== null && tree !== false && typeof tree !== 'undefined') { fn(tree); } childrenOfNode(tree).forEach(node => treeForEach(node, fn)); } export function treeFilter(tree, fn) { const results = []; treeForEach(tree, node => { if (fn(node)) { results.push(node); } }); return results; } function pathFilter(path, fn) { return path.filter(tree => treeFilter(tree, fn).length !== 0); } export function pathToNode(node, root) { const queue = [root]; const path = []; const hasNode = (testNode) => node === testNode; while (queue.length) { const current = queue.pop(); const children = childrenOfNode(current); if (current === node) return pathFilter(path, hasNode); path.push(current); if (children.length === 0) { // leaf node. if it isn't the node we are looking for, we pop. path.pop(); } queue.push.apply(queue, children); } return null; } export function parentsOfNode(node, root) { return pathToNode(node, root).reverse(); } export function nodeHasId(node, id) { return propsOfNode(node).id === id; } export function nodeHasProperty(node, propKey, stringifiedPropValue) { const nodeProps = propsOfNode(node); const propValue = coercePropValue(propKey, stringifiedPropValue); const descriptor = Object.getOwnPropertyDescriptor(nodeProps, propKey); if (descriptor && descriptor.get) { return false; } const nodePropValue = nodeProps[propKey]; if (nodePropValue === undefined) { return false; } if (propValue) { return nodePropValue === propValue; } return nodeProps.hasOwnProperty(propKey); } export function nodeMatchesObjectProps(node, props) { return isSubset(propsOfNode(node), props); } export function buildPredicate(selector) { switch (typeof selector) { case 'function': // selector is a component constructor return node => node && node.type === selector; case 'string': if (isCompoundSelector.test(selector)) { return AND(splitSelector(selector).map(buildPredicate)); } switch (selectorType(selector)) { case SELECTOR.CLASS_TYPE: return node => hasClassName(node, selector.substr(1)); case SELECTOR.ID_TYPE: return node => nodeHasId(node, selector.substr(1)); case SELECTOR.PROP_TYPE: { const propKey = selector.split(/\[([a-zA-Z\-]*?)(=|\])/)[1]; const propValue = selector.split(/=(.*?)\]/)[1]; return node => nodeHasProperty(node, propKey, propValue); } default: // selector is a string. match to DOM tag or constructor displayName return node => nodeHasType(node, selector); } case 'object': if (!Array.isArray(selector) && selector !== null && !isEmpty(selector)) { return node => nodeMatchesObjectProps(node, selector); } throw new TypeError( 'Enzyme::Selector does not support an array, null, or empty object as a selector' ); default: throw new TypeError('Enzyme::Selector expects a string, object, or Component Constructor'); } } export function getTextFromNode(node) { if (node === null || node === undefined) { return ''; } if (typeof node === 'string' || typeof node === 'number') { return String(node); } if (node.type && typeof node.type === 'function') { return `<${node.type.displayName || node.type.name} />`; } return childrenOfNode(node).map(getTextFromNode).join('').replace(/\s+/, ' '); }
server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js
vamsirajendra/sonarqube
import d3 from 'd3'; import React from 'react'; import { getMeasuresAndVariations } from '../../../api/measures'; import { DomainTimeline } from '../components/domain-timeline'; import { DomainTreemap } from '../components/domain-treemap'; import { DomainBubbleChart } from '../components/domain-bubble-chart'; import { CoverageSelectionMixin } from '../components/coverage-selection-mixin'; import { getPeriodLabel, getPeriodDate } from './../helpers/periods'; import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin'; import { filterMetrics, filterMetricsForDomains } from '../helpers/metrics'; import { DomainLeakTitle } from '../main/components'; import { CHART_REVERSED_COLORS_RANGE_PERCENT } from '../../../helpers/constants'; import { CoverageMeasuresList } from '../components/coverage-measures-list'; const TEST_DOMAINS = ['Tests', 'Tests (Integration)', 'Tests (Overall)']; export const CoverageMain = React.createClass({ mixins: [TooltipsMixin, CoverageSelectionMixin], getInitialState() { return { ready: false, leakPeriodLabel: getPeriodLabel(this.props.component.periods, this.props.leakPeriodIndex), leakPeriodDate: getPeriodDate(this.props.component.periods, this.props.leakPeriodIndex) }; }, componentDidMount() { this.requestMeasures().then(r => { let measures = this.getMeasuresValues(r, 'value'); let leak = this.getMeasuresValues(r, 'var' + this.props.leakPeriodIndex); this.setState({ ready: true, measures, leak, coverageMetricPrefix: this.getCoverageMetricPrefix(measures) }); }); }, getMeasuresValues (measures, fieldKey) { let values = {}; Object.keys(measures).forEach(measureKey => { values[measureKey] = measures[measureKey][fieldKey]; }); return values; }, getMetricsForDomain() { return this.props.metrics .filter(metric => TEST_DOMAINS.indexOf(metric.domain) !== -1) .map(metric => metric.key); }, getMetricsForTimeline() { return filterMetricsForDomains(this.props.metrics, TEST_DOMAINS); }, getAllMetricsForTimeline() { return filterMetrics(this.props.metrics); }, requestMeasures () { return getMeasuresAndVariations(this.props.component.key, this.getMetricsForDomain()); }, renderLoading () { return <div className="flex-1 text-center"> <i className="spinner spinner-margin"/> </div>; }, renderEmpty() { return <div className="overview-detailed-page"> <div className="page"> <p>{window.t('overview.no_coverage')}</p> </div> </div>; }, renderLegend () { return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>; }, render () { if (!this.state.ready) { return this.renderLoading(); } let treemapScale = d3.scale.linear() .domain([0, 25, 50, 75, 100]) .range(CHART_REVERSED_COLORS_RANGE_PERCENT); let coverageMetric = this.state.coverageMetricPrefix + 'coverage'; let uncoveredLinesMetric = this.state.coverageMetricPrefix + 'uncovered_lines'; if (this.state.measures[coverageMetric] == null) { return this.renderEmpty(); } return <div className="overview-detailed-page"> <div className="overview-cards-list"> <div className="overview-card overview-card-fixed-width"> <div className="overview-card-header"> <div className="overview-title">{window.t('overview.domain.coverage')}</div> {this.renderLegend()} </div> <CoverageMeasuresList {...this.props} {...this.state}/> </div> <div className="overview-card"> <DomainBubbleChart {...this.props} xMetric="complexity" yMetric={coverageMetric} sizeMetrics={[uncoveredLinesMetric]}/> </div> </div> <div className="overview-cards-list"> <div className="overview-card"> <DomainTimeline {...this.props} {...this.state} initialMetric={coverageMetric} metrics={this.getMetricsForTimeline()} allMetrics={this.getAllMetricsForTimeline()}/> </div> <div className="overview-card"> <DomainTreemap {...this.props} sizeMetric="ncloc" colorMetric={coverageMetric} scale={treemapScale}/> </div> </div> </div>; } });
app/components/IndexPage.js
paladinze/testSemantic
'use strict'; import React from 'react'; import { Card, Button, Rating, Icon, Menu, List, Comment,Dimmer, Statistic, Dropdown, Modal, Popup} from 'semantic-ui-react'; import { Header, Container, Divider, Image, Input, Label, Form, Grid, Segment} from 'semantic-ui-react'; import {Progress, Sidebar} from 'semantic-ui-react'; import Ze from './ze'; export default class IndexPage extends React.Component { constructor() { super(); this.state = { visible: true }; } toggleVisibility() { this.setState({ visible: !this.state.visible }) } render() { const items = [ { label: 'Faves', value: '22' }, { label: 'Views', value: '31,200' }, { label: 'Members', value: '22' }, ] const src = 'img/mark-huizinga.jpg' const colors = [ 'red', 'orange', 'yellow', 'olive', 'green', 'teal', 'blue', 'violet', 'purple', 'pink', 'brown', 'grey', 'black', ] const friendOptions = [ { image: 'img/mark-huizinga.jpg', value: 'AL', text: 'Alabama' }] const { visible } = this.state return ( <div className="home"> <div> <Container> <Progress percent={44} color='blue' progress /> <Popup trigger={<Button icon='add' />} content='Add users to your feed' /> <Modal trigger={<Button>Basic Modal</Button>} basic size='small'> <Header icon='archive' content='Archive Old Messages' /> <Modal.Content> <p>Your inbox is getting full, would you like us to enable automatic archiving of old messages?</p> </Modal.Content> <Modal.Actions> <Button basic color='red' inverted> <Icon name='remove' /> No </Button> <Button color='green' inverted> <Icon name='checkmark' /> Yes </Button> </Modal.Actions> </Modal> <Modal trigger={<Button>Show Modal</Button>} closeIcon='close'> <Header icon='archive' content='Archive Old Messages' /> <Modal.Content> <p>Your inbox is getting full, would you like us to enable automatic archiving of old messages?</p> </Modal.Content> <Modal.Actions> <Button color='red'> <Icon name='remove' /> No </Button> <Button color='green'> <Icon name='checkmark' /> Yes </Button> </Modal.Actions> </Modal> <Statistic.Group items={items} color='blue' /> <Comment.Group threaded> <Header as='h3' dividing>Comments</Header> <Comment> <Comment.Avatar as='a' src={src} /> <Comment.Content> <Comment.Author as='a'>Matt</Comment.Author> <Comment.Metadata> <span>Today at 5:42PM</span> </Comment.Metadata> <Comment.Text>How artistic!</Comment.Text> <Comment.Actions> <a>Reply</a> </Comment.Actions> </Comment.Content> </Comment> <Comment> <Comment.Avatar as='a' src={src} /> <Comment.Content> <Comment.Author as='a'>Elliot Fu</Comment.Author> <Comment.Metadata> <span>Yesterday at 12:30AM</span> </Comment.Metadata> <Comment.Text> <p>This has been very useful for my research. Thanks as well!</p> </Comment.Text> <Comment.Actions> <a>Reply</a> </Comment.Actions> </Comment.Content> <Comment.Group> <Comment> <Comment.Avatar as='a' src={src} /> <Comment.Content> <Comment.Author as='a'>Jenny Hess</Comment.Author> <Comment.Metadata> <span>Just now</span> </Comment.Metadata> <Comment.Text>Elliot you are always so right :)</Comment.Text> <Comment.Actions> <a>Reply</a> </Comment.Actions> </Comment.Content> </Comment> </Comment.Group> </Comment> <Comment> <Comment.Avatar as='a' src={src} /> <Comment.Content> <Comment.Author as='a'>Joe Henderson</Comment.Author> <Comment.Metadata> <span>5 days ago</span> </Comment.Metadata> <Comment.Text>Dude, this is awesome. Thanks so much</Comment.Text> <Comment.Actions> <a>Reply</a> </Comment.Actions> </Comment.Content> </Comment> <Form reply onSubmit={e => e.preventDefault()}> <Form.TextArea /> <Button content='Add Reply' labelPosition='left' icon='edit' primary /> </Form> </Comment.Group> <Card.Group> <Card> <Card.Content> <Image floated='right' size='mini' src={src} /> <Card.Header> Steve Sanders </Card.Header> <Card.Meta> Friends of Elliot </Card.Meta> <Card.Description> Steve wants to add you to the group <strong>best friends</strong> </Card.Description> </Card.Content> <Card.Content extra> <div className='ui two buttons'> <Button basic color='green'>Approve</Button> <Button basic color='red'>Decline</Button> </div> </Card.Content> </Card> <Card> <Card.Content> <Image floated='right' size='mini' src={src} /> <Card.Header> Molly Thomas </Card.Header> <Card.Meta> New User </Card.Meta> <Card.Description> Molly wants to add you to the group <strong>musicians</strong> </Card.Description> </Card.Content> <Card.Content extra> <div className='ui two buttons'> <Button basic color='green'>Approve</Button> <Button basic color='red'>Decline</Button> </div> </Card.Content> </Card> <Card> <Card.Content> <Image floated='right' size='mini' src={src} /> <Card.Header> Jenny Lawrence </Card.Header> <Card.Meta> New User </Card.Meta> <Card.Description> Jenny requested permission to view your contact details </Card.Description> </Card.Content> <Card.Content extra> <div className='ui two buttons'> <Button basic color='green'>Approve</Button> <Button basic color='red'>Decline</Button> </div> </Card.Content> </Card> </Card.Group> <Card> <Image src={src} /> <Card.Content> <Card.Header> Matthew </Card.Header> <Card.Meta> <span className='date'> Joined in 2015 </span> </Card.Meta> <Card.Description> Matthew is a musician living in Nashville. </Card.Description> </Card.Content> <Card.Content extra> <a> <Icon name='user' /> 22 Friends </a> </Card.Content> </Card> </Container> <Divider hidden/> <Container> <Button primary>Primary</Button> <Button secondary>Secondary</Button> <Button animated='fade'> <Button.Content visible> Sign-up for a Pro account </Button.Content> <Button.Content hidden> $12.99 a month </Button.Content> </Button> <Button content='Like' icon='heart' label={{ as: 'a', basic: true, pointing: 'right', content: '2,048' }} labelPosition='left' /> <Button color='red' content='Like' icon='heart' label={{ basic: true, color: 'red', pointing: 'left', content: '2,048' }} /> <Button basic color='blue' content='Fork' icon='fork' label={{ as: 'a', basic: true, color: 'blue', pointing: 'left', content: '1,048' }} /> <br></br> <Button basic>Standard</Button> <Button basic color='red'>Red</Button> <Button basic color='orange'>Orange</Button> <Button basic color='yellow'>Yellow</Button> <Button basic color='olive'>Olive</Button> <Button basic color='green'>Green</Button> <Button basic color='teal'>Teal</Button> <Button basic color='blue'>Blue</Button> <Button basic color='violet'>Violet</Button> <Button basic color='purple'>Purple</Button> <Button basic color='pink'>Pink</Button> <Button basic color='brown'>Brown</Button> <Button basic color='grey'>Grey</Button> <Button basic color='black'>Black</Button> <br></br> </Container> <Divider hidden/> <Container> <Button.Group> <Button>Cancel</Button> <Button.Or /> <Button positive>Save</Button> </Button.Group> <Button loading>Loading</Button> <Button basic loading>Loading</Button> <Button loading primary>Loading</Button> <Button loading secondary>Loading</Button> <Button circular color='facebook' icon='facebook' /> <Button circular color='twitter' icon='twitter' /> <Button circular color='linkedin' icon='linkedin' /> <Button circular color='google plus' icon='google plus' /> <Button.Group color='blue'> <Button>One</Button> <Button>Two</Button> <Button>Three</Button> </Button.Group> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa strong.</p> </Container> <Divider hidden/> <Container> <Image src='img/mark-huizinga.jpg' size='small' wrapped label={{ as: 'a', color: 'blue', content: 'Food', icon: 'spoon', ribbon: true }} /> <div> <Image src='img/mark-huizinga.jpg' avatar /> <span>Username</span> </div> <Image.Group size='small'> <Image src={src} /> <Image src={src} /> <Image src={src} /> <Image src={src} /> </Image.Group> <Input loading icon='user' placeholder='Search...' /> <Input error placeholder='Search...' /> <Input disabled placeholder='Search...' /> <Input action={{ color: 'teal', labelPosition: 'right', icon: 'copy', content: 'Copy' }} defaultValue='http://ww.short.url/c0opq' /> <Label as='a' color='blue' image> <img src={src} /> Veronika <Label.Detail>Friend</Label.Detail> </Label> <Label image> <img src={src} /> Nan <Icon name='delete' /> </Label> <Divider hidden/> <Form> <Form.Field inline> <input type='text' placeholder='Username' /> <Label basic color='red' pointing='left'>That name is taken!</Label> </Form.Field> </Form> </Container> <Divider hidden/> <Container> <Grid columns={2}> <Grid.Column> <Segment raised> <Label as='a' color='red' ribbon>Overview</Label> <span>Account Details</span> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa strong. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> <Label as='a' color='blue' ribbon>Community</Label> <span>User Reviews</span> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa strong. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </Segment> </Grid.Column> <Grid.Column> <Segment> <Label as='a' color='orange' ribbon='right'>Specs</Label> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa strong. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> <Label as='a' color='teal' ribbon='right'>Reviews</Label> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa strong. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </Segment> </Grid.Column> </Grid> </Container> <Divider hidden/> <Container> <Grid columns={3}> <Grid.Row> <Grid.Column> <Segment padded> <Label attached='bottom left'>User View</Label> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa strong. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </Segment> </Grid.Column> <Grid.Column> <Segment padded> <Label attached='bottom left'>User View</Label> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa strong. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </Segment> </Grid.Column> <Grid.Column> <Segment padded> <Label attached='bottom left'>User View</Label> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa strong. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </Segment> </Grid.Column> </Grid.Row> </Grid> </Container> <Divider hidden/> <Container> <Menu compact> <Menu.Item as='a'> <Icon name='mail' /> Messages <Label color='red' floating>22</Label> </Menu.Item> <Menu.Item as='a'> <Icon name='users' /> Friends <Label color='teal' floating>22</Label> </Menu.Item> </Menu> <List> <List.Item> <Image avatar src={src} /> <List.Content> <List.Header as='a'>Rachel</List.Header> <List.Description>Last seen watching <a><b>Arrested Development</b></a> just now.</List.Description> </List.Content> </List.Item> <List.Item> <Image avatar src={src} /> <List.Content> <List.Header as='a'>Lindsay</List.Header> <List.Description>Last seen watching <a><b>Bob's Burgers</b></a> 10 hours ago.</List.Description> </List.Content> </List.Item> <List.Item> <Image avatar src={src} /> <List.Content> <List.Header as='a'>Matthew</List.Header> <List.Description>Last seen watching <a><b>The Godfather Part 2</b></a> yesterday.</List.Description> </List.Content> </List.Item> </List> <List horizontal> <List.Item> <Image avatar src={src} /> <List.Content> <List.Header>Tom</List.Header> Top Contributor </List.Content> </List.Item> <List.Item> <Image avatar src={src} /> <List.Content> <List.Header>Christian Rocha</List.Header> Admin </List.Content> </List.Item> <List.Item> <Image avatar src={src} /> <List.Content> <List.Header>Matt</List.Header> Top Rated User </List.Content> </List.Item> </List> <List animated verticalAlign='middle'> <List.Item> <Image avatar src={src} /> <List.Content> <List.Header>Helen</List.Header> </List.Content> </List.Item> <List.Item> <Image avatar src={src} /> <List.Content> <List.Header>Christian</List.Header> </List.Content> </List.Item> <List.Item> <Image avatar src={src} /> <List.Content> <List.Header>Daniel</List.Header> </List.Content> </List.Item> </List> </Container> </div> </div> ); } }
wordpuzzle/src/layout/help.js
prabakaranrvp/CodeGame
/* eslint-disable no-loop-func */ import React from 'react'; import Modal from './modal.js' import '../style/app.scss'; export default class Help extends React.Component { render() { return ( <Modal showClose={true} title="How to Play - Bull Cow" className="how-to-modal" onClose={() => this.props.onHelpClose()}> <article> <p> <strong>Bull</strong> - Tells that the letter in the challenged word matches exactly at the same position. </p> <p> Challenged Word : <strong>COD<span className="red">E</span></strong> </p> <p> Guessed Word : <strong>GAM<span className="red">E</span></strong> </p> <p> The last letter <strong>E</strong> matches exactly at the same place. So, You will get <span className="red">1 Bull, 0 Cow</span> </p> <p> <strong>Cow</strong> - Tells that the letter in the challenged word is present in the guessed word. But that letter is in wrong position. </p> <p> Challenged Word : <strong>COD<span className="red">E</span></strong> </p> <p> Guessed Word : <strong><span className="red">D</span>AWN</strong> </p> <p> The last letter <strong>D</strong> matches, but it is in wrong position. So, You will get <span className="red">0 Bull, 1 Cow</span> </p> </article> </Modal> ); } }
src/index.js
Ricky-Nz/knocknock-web
import React from 'react'; import ReactROM from 'react-dom'; import Relay from 'react-relay'; import { Router, IndexRoute, IndexRedirect, Route, applyRouterMiddleware, hashHistory } from 'react-router'; import useRelay from 'react-router-relay'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import injectTapEventPlugin from 'react-tap-event-plugin'; import Dashboard from './Dashboard'; import UserBrowserPage from './UserBrowserPage'; import WorkerBrowserPage from './WorkerBrowserPage'; import UserDetailPage from './UserDetailPage'; import ClothBrowserPage from './ClothBrowserPage'; import OrderBrowserPage from './OrderBrowserPage'; import OrderDetailPage from './OrderDetailPage'; import TimeSlotPage from './TimeSlotPage'; import AdminBrowserPage from './AdminBrowserPage'; import FactoryBrowserPage from './FactoryBrowserPage'; import PromoCodeBrowserPage from './PromoCodeBrowserPage'; import BannerBrowserPage from './BannerBrowserPage'; import FeedbackBrowserPage from './FeedbackBrowserPage'; import CreditBrowserPage from './CreditBrowserPage'; import AnalyticsPage from './AnalyticsPage'; import HistoryOrderPage from './HistoryOrderPage'; import VoucherBrowserPage from './VoucherBrowserPage'; import { Loading } from './widgets'; // Needed for onTouchTap // Check this repo: // https://github.com/zilverline/react-tap-event-plugin injectTapEventPlugin(); Relay.injectNetworkLayer( new Relay.DefaultNetworkLayer('http://localhost:3000/graphql') ); const App = ({children}) => ( <MuiThemeProvider muiTheme={getMuiTheme()}> <div className='app flex'> {children} </div> </MuiThemeProvider> ); const queries = { viewer: () => Relay.QL` query { viewer } ` }; ReactROM.render( <Router history={hashHistory} render={applyRouterMiddleware(useRelay)} environment={Relay.Store}> <Route path='/' component={App}> <IndexRedirect to="dashboard" /> <Route path='dashboard' component={Dashboard}> <IndexRedirect to="order" /> <Route path='order'> <IndexRedirect to="active" /> <Route path='active' component={OrderBrowserPage} queries={queries} render={({props}) => props ? <OrderBrowserPage {...props}/> : <Loading/>}/> <Route path='history' component={HistoryOrderPage} queries={queries} render={({props}) => props ? <HistoryOrderPage {...props}/> : <Loading/>}/> <Route path='timeslots' component={TimeSlotPage} queries={queries} render={({props}) => props ? <TimeSlotPage {...props}/> : <Loading/>}/> <Route path=':userId/:orderId' component={OrderDetailPage} queries={queries} render={({props}) => props ? <OrderDetailPage {...props}/> : <Loading/>}/> </Route> <Route path='account'> <Route path='client' component={UserBrowserPage} queries={queries} render={({props}) => props ? <UserBrowserPage {...props}/> : <Loading/>}/> <Route path='client/:id' component={UserDetailPage} queries={queries} render={({props}) => props ? <UserDetailPage {...props}/> : <Loading/>}/> <Route path='admin' component={AdminBrowserPage} queries={queries} render={({props}) => props ? <AdminBrowserPage {...props}/> : <Loading/>}/> <Route path='factory' component={FactoryBrowserPage} queries={queries} render={({props}) => props ? <FactoryBrowserPage {...props}/> : <Loading/>}/> <Route path='worker' component={WorkerBrowserPage} queries={queries} render={({props}) => props ? <WorkerBrowserPage {...props}/> : <Loading/>}/> </Route> <Route path='system'> <Route path='dashboard' component={AnalyticsPage} queries={queries} render={({props}) => props ? <AnalyticsPage {...props}/> : <Loading/>}/> <Route path='credit' component={CreditBrowserPage} queries={queries} render={({props}) => props ? <CreditBrowserPage {...props}/> : <Loading/>}/> <Route path='laundry' component={ClothBrowserPage} queries={queries} render={({props}) => props ? <ClothBrowserPage {...props}/> : <Loading/>}/> <Route path='voucher' component={VoucherBrowserPage} queries={queries} render={({props}) => props ? <VoucherBrowserPage {...props}/> : <Loading/>}/> <Route path='promocode' component={PromoCodeBrowserPage} queries={queries} render={({props}) => props ? <PromoCodeBrowserPage {...props}/> : <Loading/>}/> <Route path='appbanner' component={BannerBrowserPage} queries={queries} render={({props}) => props ? <BannerBrowserPage {...props}/> : <Loading/>}/> <Route path='feedback' component={FeedbackBrowserPage} queries={queries} render={({props}) => props ? <FeedbackBrowserPage {...props}/> : <Loading/>}/> </Route> </Route> </Route> </Router>, document.getElementById('root') );
src/components/FormPage.js
PracticasCodesai/ExercisesInputsReact
import React from 'react'; import {connect} from 'react-redux'; import {bindActionCreators} from 'redux'; import * as FormAction from '../actions/FormAction'; import Form from './Form'; class FormPage extends React.Component { constructor(props, context){ super(props, context); this.state = { emails: Object.assign([], this.props.emails) }; } render(){ return ( <Form emails={this.state.emails}/> ); } } function mapStateToProps(state) { return { emails: state.emails }; } function mapDispatchToProps(dispatch) { return { actions: bindActionCreators(FormAction, dispatch) }; } export default connect(mapStateToProps,mapDispatchToProps)(FormPage);
admin/src/components/PopoutPane.js
BlakeRxxk/keystone
import blacklist from 'blacklist'; import classnames from 'classnames'; import React from 'react'; var PopoutPane = React.createClass({ displayName: 'PopoutPane', propTypes: { children: React.PropTypes.node.isRequired, className: React.PropTypes.string, onLayout: React.PropTypes.func }, componentDidMount () { this.props.onLayout && this.props.onLayout(this.getDOMNode().offsetHeight); }, render () { let className = classnames('Popout__pane', this.props.className); let props = blacklist(this.props, 'className', 'onLayout'); return <div className={className} {...props} />; } }); module.exports = PopoutPane;
src/components/Modal/Modal.js
znewton/myxx-client
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import './Modal.scss'; import { addEndEventListener, removeEndEventListener } from '../../lib/Events/Events'; import Positioning from '../../lib/Positioning/Positioning'; export default class Modal extends Component { constructor() { super(); this.state = { origin: null, }; this.name = 'Modal_' + Math.random().toString(36).substring(7) } componentDidMount() { this.setState({ origin: Positioning.updateOriginFromCoordinates(document.querySelector(this.props.bindTo)) }); addEndEventListener(window, 'resize', () => this.setState({ origin: Positioning.updateOriginFromCoordinates(document.querySelector(this.props.bindTo)) }), 100, this.name); } componentWillUnmount() { removeEndEventListener(this.name); } render() { if(this.props.open) { document.body.style.overflow = "hidden"; } else { delete document.body.style.overflow; } return ( <div className={'Modal' + (this.props.open ? ' open' : '' )} style={{ transformOrigin: this.state.origin, }} onClick={(e) => this.props.handleClose(e)} > <div className="modal" onClick={(e) => e.stopPropagation()} > {this.props.header && <div className="header">{this.props.header}</div> } <div className="content">{this.props.children}</div> {this.props.footer && <div className="footer">{this.props.footer}</div> } </div> </div> ); } } Modal.propTypes = { open: PropTypes.bool, bindTo: PropTypes.string.isRequired, header: PropTypes.oneOfType([ PropTypes.string, PropTypes.element, ]), footer: PropTypes.oneOfType([ PropTypes.string, PropTypes.element, ]), handleClose: PropTypes.func.isRequired, } Modal.defaultProps = { open: false, };
src/window/pallet/element/Checkbox.js
unkyulee/control-center
import { ipcRenderer } from 'electron' import React from 'react' import { Checkbox } from 'react-bootstrap' const run = require('../../../control/common/run') export class Element extends React.Component { constructor(props) { super(props) } click = () => { // sends out a message that a button is clicked ipcRenderer.send("element.clicked", this.props.element) } onChange = (e) => { let valueColumnName = "value" if( this.props.element.parameter.valueColumnName ) valueColumnName = this.props.element.parameter.valueColumnName this.props.source.data[e.target.id][valueColumnName] = e.target.checked ipcRenderer.send('source.changed', this.props.source) } defaultFilterFunc = (type, element, arg) => { return arg } render() { try { // get checkbox let checkboxes = [] // find the data match if( this.props.source ) { let titleColumnName = "title" if( this.props.element.parameter.titleColumnName ) titleColumnName = this.props.element.parameter.titleColumnName let valueColumnName = "value" if( this.props.element.parameter.valueColumnName ) valueColumnName = this.props.element.parameter.valueColumnName let idColumnName = "id" if( this.props.element.parameter.idColumnName ) idColumnName = this.props.element.parameter.idColumnName // make table body // loop for each row in data this.props.source.data.forEach( (row, row_number) => { checkboxes.push( <Checkbox key={row_number} id={row_number} checked={row[valueColumnName]} onChange={this.onChange} style={this.props.element.parameter.style}> {row[titleColumnName]} </Checkbox>) }) } // get preRenderFilter let filterFunc = this.defaultFilterFunc if ( this.props.element.parameter.preRenderFilter ) { let script = this.props.parent.scripts[this.props.element.parameter.preRenderFilter] // run script let context = { filterFunc: null } run.run(script.script, context) // update filter func if( context.filterFunc ) filterFunc = context.filterFunc } return ( <div onClick={this.click} style={{"width": "100%"}}> <p style={this.props.element.parameter.headerStyle}> {this.props.element.parameter.header} </p> {checkboxes} </div> ) } catch(err) { return <div>{this.props.element.id} - {err.message} - {err.stack}</div> } } }
src/components/MuiDrawer/MuiDrawer.js
pitLancer/pbdorb
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { withStyles, createStyleSheet } from 'material-ui/styles'; import Drawer from 'material-ui/Drawer'; import Button from 'material-ui/Button'; import List, { ListItem, ListItemIcon, ListItemText } from 'material-ui/List'; import KeyboardArrowRight from 'material-ui-icons/KeyboardArrowRight'; import Divider from 'material-ui/Divider'; import { defineMessages, FormattedMessage } from 'react-intl'; const styleSheet = createStyleSheet({ list: { width: 200, alignSelf: 'center', backgroundColor: 'rgb(0,0,0)', paddingTop: '20vh', }, buttonCategories: { flex: 1, top: '20vh', backgroundColor: 'rgb(30,30,30)', }, buttonRoot: { flex: 1, alignSelf: 'center', color: 'red', maxWidth: '80%', flatAccent: 'red', '&:hover': { backgroundColor: 'rgba(255,0,0,0.12)' } }, arrow: { marginRight: '-10px' }, wrapper: { position: 'relative', width: '80vw', height: '0', top: '14vh', left: '10vw', display: 'flex', flexDirection: 'column', backgroundColor: 'rgb(30,30,30)' } }); const messages = defineMessages({ open: { id: 'muiDrawer.open', defaultMessage: 'Kategorie', description: 'Categories', } }); class MuiDrawer extends Component{ constructor(props){ super(props); this.state = { open: false } } handleOpener = () => { this.setState({ open: !this.state.open }); } getList = (list) => { list.forEach( (listItem) => { console.log( <ListItem button>{listItem}</ListItem>); }) } render() { const classes = this.props.classes; return ( <div className={classes.wrapper}> <Button className={classes.buttonRoot} onClick={this.handleOpener}> <FormattedMessage {...messages.open} /> <KeyboardArrowRight className={classes.arrow}/> </Button> <Drawer anchor="right" open={this.state.open} onRequestClose={this.handleOpener} onClick={this.handleOpener} > <List className={classes.list} > {this.props.list} </List> </Drawer> </div> ) } } export default withStyles(styleSheet)(MuiDrawer);
packages/react-scripts/fixtures/kitchensink/src/index.js
timlogemann/create-react-app
/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; ReactDOM.render(<App />, document.getElementById('root'));
src/components/FetchError.js
chriswitko/idiomatic-redux-app
import React from 'react'; const FetchError = ({ message, onRetry}) => ( <div> <p>Could not fetch todos. {message}</p> <button onClick={onRetry}>Retry</button> </div> ); export default FetchError;
client/src/app/routes/outlook/containers/OutlookReplay.js
zraees/sms-project
import React from 'react' import {OverlayTrigger, Tooltip} from 'react-bootstrap' import {connect} from 'react-redux' import {outlookFetchMeesage} from '../OutlookActions' import Moment from '../../../components/utils/Moment' import HtmlRender from '../../../components/utils/HtmlRender' import Select2 from '../../../components/forms/inputs/Select2' import Summernote from '../../../components/forms/editors/Summernote' class OutlookReplay extends React.Component { state = { cc: false, bcc: false, attachments: false, sending: false, }; currentMessage = null; componentWillUpdate() { if (this.currentMessage != this.props.params.id) { this.props.dispatch(outlookFetchMeesage(this.props.params.id)) this.currentMessage = this.props.params.id } } handleSubmit = (e) => { e.preventDefault(); this.setState({ sending: true }); setTimeout(() => { this.props.router.push('/outlook') }, 1000) } addCarbonCopy = (e) => { e.preventDefault(); this.setState({cc: true}) }; addBlindCarbonCopy = (e) => { e.preventDefault(); this.setState({bcc: true}) }; addAttachments = (e) => { e.preventDefault(); this.setState({attachments: true}) }; render() { const ccTrigger = !this.state.cc ? <em> <OverlayTrigger placement="bottom" overlay={<Tooltip id="cc-tooltip">Carbon Copy</Tooltip>}> <a href="#" onClick={this.addCarbonCopy}>CC</a> </OverlayTrigger> </em> : null; const bccTrigger = !this.state.bcc ? <em> <OverlayTrigger placement="bottom" overlay={<Tooltip id="bcc-tooltip">Blind Carbon Copy</Tooltip>}> <a href="#" onClick={this.addBlindCarbonCopy}>BCC</a> </OverlayTrigger> </em> : null; const message = this.props.message; return ( message.body ? <div className="table-wrap custom-scroll"> <h2 className="email-open-header"> Reply to > {message.subject} <span className="label txt-color-white"> {message.folder}</span> <OverlayTrigger placement="left" overlay={<Tooltip id="print-message-tooltip">Print</Tooltip>}> <a href="#" className="txt-color-darken pull-right"><i className="fa fa-print"/></a> </OverlayTrigger> </h2> <form onSubmit={this.handleSubmit} encType="multipart/form-data" className="form-horizontal"> <div className="inbox-info-bar no-padding"> <div className="row"> <div className="form-group"> <label className="control-label col-md-1"><strong>To</strong></label> <div className="col-md-11"> <Select2 multiple={true} style={{width: '100%'}} data-select-search="true" defaultValue={["IT@smartadmin.com"]}> <option value="sunny.orlaf@smartadmin.com">sunny.orlaf@smartadmin.com </option> <option value="rachael.hawi@smartadmin.com">rachael.hawi@smartadmin.com</option> <option value="michael.safiel@smartadmin.com">michael.safiel@smartadmin.com </option> <option value="alex.jones@infowars.com">alex.jones@infowars.com</option> <option value="oruf.matalla@gmail.com">oruf.matalla@gmail.com</option> <option value="hr@smartadmin.com">hr@smartadmin.com</option> <option value="IT@smartadmin.com">IT@smartadmin.com</option> </Select2> { ccTrigger } </div> </div> </div> </div> { this.state.cc ? <div className="inbox-info-bar no-padding"> <div className="row"> <div className="form-group"> <label className="control-label col-md-1"><strong>CC</strong></label> <div className="col-md-11"> <Select2 multiple={true} style={{width: '100%'}} data-select-search="true"> <option value="sunny.orlaf@smartadmin.com">sunny.orlaf@smartadmin.com </option> <option value="rachael.hawi@smartadmin.com">rachael.hawi@smartadmin.com </option> <option value="michael.safiel@smartadmin.com">michael.safiel@smartadmin.com </option> <option value="alex.jones@infowars.com">alex.jones@infowars.com</option> <option value="oruf.matalla@gmail.com">oruf.matalla@gmail.com</option> <option value="hr@smartadmin.com">hr@smartadmin.com</option> <option value="IT@smartadmin.com">IT@smartadmin.com</option> </Select2> {bccTrigger} </div> </div> </div> </div> : null } {this.state.bcc ? <div className="inbox-info-bar no-padding"> <div className="row"> <div className="form-group"> <label className="control-label col-md-1"><strong>BCC</strong></label> <div className="col-md-11"> <Select2 multiple={true} style={{width: "100%"}} data-select-search="true"> <option value="sunny.orlaf@smartadmin.com">sunny.orlaf@smartadmin.com </option> <option value="rachael.hawi@smartadmin.com">rachael.hawi@smartadmin.com </option> <option value="michael.safiel@smartadmin.com">michael.safiel@smartadmin.com </option> <option value="alex.jones@infowars.com">alex.jones@infowars.com</option> <option value="oruf.matalla@gmail.com">oruf.matalla@gmail.com</option> <option value="hr@smartadmin.com">hr@smartadmin.com</option> <option value="IT@smartadmin.com">IT@smartadmin.com</option> </Select2> </div> </div> </div> </div> : null } <div className="inbox-info-bar no-padding"> <div className="row"> <div className="form-group"> <label className="control-label col-md-1"><strong>Subject</strong></label> <div className="col-md-11"> <input className="form-control" placeholder="Email Subject" type="text"/> <OverlayTrigger placement="bottom" overlay={<Tooltip id="Attachments-tooltip">Attachments</Tooltip>}> <em><a href="#" className="show-next" onClick={this.addAttachments}><i className="fa fa-paperclip fa-lg"/></a></em> </OverlayTrigger> </div> </div> </div> </div> {this.state.attachments ? <div className="inbox-info-bar no-padding "> <div className="row"> <div className="form-group"> <label className="control-label col-md-1"><strong>Attachments</strong></label> <div className="col-md-11"> <input className="form-control fileinput" type="file" multiple="multiple"/> </div> </div> </div> </div> : null } <div className="inbox-message no-padding"> <Summernote id="emailbody"><br /><br /><span>Thanks,</span><br /><strong>John Doe</strong><br /><br /> <div className="email-reply-text"> <p> <span>{message.contact.name}</span> <span className="text-primary"> <span>&lt;</span> <span>{ message.contact.email }</span> <span>&gt;</span> </span><span>to me on</span></p> <Moment date={ message.date } format="LLLL"/> <HtmlRender html={ message.body }/> </div> </Summernote> </div> <div className="inbox-compose-footer"> <button className="btn btn-danger" type="button"> Disregard </button> <button className="btn btn-info" type="button"> Draft </button> {!this.state.sending ? <button onClick={this.handleSubmit} className="btn btn-primary pull-right" type="button"> Send <i className="fa fa-arrow-circle-right fa-lg"/> </button> : <button className="btn btn-primary pull-right" type="button"> <i className="fa fa-refresh fa-spin"/> Sending... </button> } </div> </form> <div className="email-infobox"> <div className="well well-sm well-light"> <h5>Related Invoice</h5> <ul className="list-unstyled"> <li> <i className="fa fa-file fa-fw text-success"/><a href="#"> #4831 - Paid</a> </li> <li> <i className="fa fa-file fa-fw text-danger"/><a href="#"><strong> #4835 - Unpaid</strong></a> </li> </ul> </div> <div className="well well-sm well-light"> <h5>Upcoming Meetings</h5> <p> <span className="label label-success"><i className="fa fa-check"/> <strike>Agenda Review @ 10 AM</strike> </span> </p> <p> <span className="label label-primary"><i className="fa fa-clock-o"/> Client Meeting @ 2:30 PM</span> </p> <p> <span className="label label-warning"><i className="fa fa-clock-o"/> Salary Review @ 4:00 PM</span> </p> </div> <ul className="list-inline"> <li><img src="assets/img/avatars/5.png" alt="me" width="30px"/></li> <li><img src="assets/img/avatars/3.png" alt="me" width="30px"/></li> <li><img src="assets/img/avatars/sunny.png" alt="me" width="30px"/></li> <li><a href="#">1 more</a></li> </ul> </div> </div> : null) } } export default connect((state)=>(state.outlook))(OutlookReplay)
actor-apps/app-web/src/app/components/SidebarSection.react.js
liruqi/actor-platform-v0.9
import React from 'react'; import HeaderSection from 'components/sidebar/HeaderSection.react'; import RecentSection from 'components/sidebar/RecentSection.react'; class SidebarSection extends React.Component { static propTypes = { selectedPeer: React.PropTypes.object }; constructor(props) { super(props); } render() { return ( <aside className="sidebar"> <HeaderSection/> <RecentSection selectedPeer={this.props.selectedPeer}/> </aside> ); } } export default SidebarSection;
docs/src/CodeExample.js
tonylinyy/react-bootstrap
import React from 'react'; export default class CodeExample extends React.Component { render() { return ( <pre className="cm-s-solarized cm-s-light"> <code> {this.props.codeText} </code> </pre> ); } componentDidMount() { if (CodeMirror === undefined) { return; } CodeMirror.runMode( this.props.codeText, this.props.mode, React.findDOMNode(this).children[0] ); } }
example/src/screens/transitions/sharedElementTransitions/Masonry/Item.js
eeynard/react-native-navigation
import React from 'react'; import {StyleSheet, View, Text, Image} from 'react-native'; import {SharedElementTransition} from 'react-native-navigation'; const SHOW_DURATION = 240; const HIDE_DURATION = 200; class Item extends React.Component { static navigatorStyle = { navBarHidden: true, drawUnderNavBar: true }; render() { return ( <View style={styles.container}> <SharedElementTransition sharedElementId={this.props.sharedImageId} showDuration={SHOW_DURATION} hideDuration={HIDE_DURATION} animateClipBounds showInterpolation={{ type: 'linear', easing: 'FastInSlowOut', }} hideInterpolation={{ type: 'linear', easing: 'FastOutSlowIn', }} > <Image style={styles.image} source={this.props.image} /> </SharedElementTransition> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#ffffff', justifyContent: 'center', }, image: { width: 400, height: 400, } }); export default Item;
demo/component/ScatterChart.js
sdoomz/recharts
import React from 'react'; import { ScatterChart, Scatter, CartesianGrid, Tooltip, Legend, XAxis, YAxis, ZAxis, ReferenceLine, ReferenceDot, ReferenceArea } from 'recharts'; import { changeNumberOfData } from './utils'; const data01 = [ { x: 100, y: 200, z: 200 }, { x: 120, y: 100, z: 260 }, { x: 170, y: 300, z: 400 }, { x: 140, y: 250, z: 280 }, { x: 150, y: 400, z: 500 }, { x: 110, y: 280, z: 200 }, ]; const data02 = [ { x: 200, y: 260, z: 240 }, { x: 240, y: 290, z: 220 }, { x: 190, y: 290, z: 250 }, { x: 198, y: 250, z: 210 }, { x: 180, y: 280, z: 260 }, { x: 210, y: 220, z: 230 }, ]; const data03 = [ { x: 10, y: 30 }, { x: 30, y: 200 }, { x: 45, y: 100 }, { x: 50, y: 400 }, { x: 70, y: 150 }, { x: 100, y: 250 }, ]; const data04 = [ { x: 30, y: 20 }, { x: 50, y: 180 }, { x: 75, y: 240 }, { x: 100, y: 100 }, { x: 120, y: 190 }, ]; const initilaState = { data01, data02, data03, data04, }; export default React.createClass({ getInitialState() { return initilaState; }, handleChangeData() { this.setState(() => _.mapValues(initilaState, changeNumberOfData)); }, render () { const { data01, data02, data03, data04 } = this.state; return ( <div className="scatter-charts"> <a href="javascript: void(0);" className="btn update" onClick={this.handleChangeData} > change data </a> <br/> <p>Simple ScatterChart</p> <div className="scatter-chart-wrapper"> <ScatterChart width={400} height={400} margin={{ top: 20, right: 20, bottom: 0, left: 20 }}> <XAxis dataKey="x" name="stature" unit="cm" /> <YAxis dataKey="y" name="weight" unit="kg" /> <Scatter name="A school" data={data01} fill="#ff7300" /> <CartesianGrid /> <Tooltip /> <Legend/> </ScatterChart> </div> <p>ScatterChart of three dimension data</p> <div className="scatter-chart-wrapper"> <ScatterChart width={400} height={400} margin={{ top: 20, right: 20, bottom: 0, left: 20 }}> <XAxis dataKey="x" name="stature" unit="cm" /> <YAxis dataKey="y" name="weight" unit="kg" /> <ZAxis dataKey="z" range={[50, 1200]} name="score" unit="km" /> <CartesianGrid /> <Scatter name="A school" data={data01} fillOpactity={0.3} fill="#ff7300" /> <Scatter name="B school" data={data02} fill="#347300" /> <Tooltip/> <Legend/> <ReferenceArea x1={250} x2={300} alwaysShow /> <ReferenceLine x={159} stroke="red"/> <ReferenceLine y={237.5} stroke="red"/> <ReferenceDot x={170} y={290} r={15} stroke="none" fill="red" isFront/> </ScatterChart> </div> <p>ScatterChart which has joint line</p> <div className="scatter-chart-wrapper"> <ScatterChart width={800} height={400} margin={{ top: 20, right: 20, bottom: 0, left: 20 }}> <XAxis dataKey="x" name="stature" unit="cm" /> <YAxis dataKey="y" name="weight" unit="kg" /> <ZAxis range={[64]} /> <Scatter line lineJointType="monotoneX" shape="wye" legendType="wye" data={data03} fill="#ff7300" /> <Scatter line shape="square" legendType="square" data={data04} fill="#347300" /> <CartesianGrid /> <Tooltip cursor={{ stroke: '#808080', strokeDasharray: '5 5' }}/> <Legend/> </ScatterChart> </div> </div> ); } });
client/src/js/components/chatbox/ChatboxEmojiList.js
abitlog/retube
import React from 'react'; import ChatboxEmojiElement from './ChatboxEmojiElement'; import scrollify from '../HOCs/scrollify'; import * as emojis from '../../utils/emojiShortnames'; class ChatboxEmojiList extends React.Component { static propTypes = { set: React.PropTypes.string.isRequired, onEmojiClick: React.PropTypes.func.isRequired }; constructor(props) { super(props); } shouldComponentUpdate(nextProps) { return nextProps.set !== this.props.set; } render() { const { set, onEmojiClick } = this.props; return ( <div ref={list => this.list = list} className="emoji-bar__list"> { emojis[set].map(shortcode => <ChatboxEmojiElement key={shortcode} shortcode={shortcode} onEmojiClick={onEmojiClick} />) } </div> ); } } export default scrollify(ChatboxEmojiList, { renderRepass: true, styles: { list: { height: "100%" } }, classNames: { list: "scroller", thumb: "scroller__thumb" } });
frontend/src/Settings/Notifications/Notifications/NotificationsConnector.js
Radarr/Radarr
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { deleteNotification, fetchNotifications } from 'Store/Actions/settingsActions'; import createSortedSectionSelector from 'Store/Selectors/createSortedSectionSelector'; import sortByName from 'Utilities/Array/sortByName'; import Notifications from './Notifications'; function createMapStateToProps() { return createSelector( createSortedSectionSelector('settings.notifications', sortByName), (notifications) => notifications ); } const mapDispatchToProps = { fetchNotifications, deleteNotification }; class NotificationsConnector extends Component { // // Lifecycle componentDidMount() { this.props.fetchNotifications(); } // // Listeners onConfirmDeleteNotification = (id) => { this.props.deleteNotification({ id }); }; // // Render render() { return ( <Notifications {...this.props} onConfirmDeleteNotification={this.onConfirmDeleteNotification} /> ); } } NotificationsConnector.propTypes = { fetchNotifications: PropTypes.func.isRequired, deleteNotification: PropTypes.func.isRequired }; export default connect(createMapStateToProps, mapDispatchToProps)(NotificationsConnector);
src/js/components/DataTable/stories/Sized.js
grommet/grommet
import React from 'react'; import { Box, DataTable } from 'grommet'; // Source code for the data can be found here // https://github.com/grommet/grommet/blob/master/src/js/components/DataTable/stories/data.js import { columns, data } from './data'; export const SizedDataTable = () => ( // Uncomment <Grommet> lines when using outside of storybook // <Grommet theme={grommet}> <Box align="center" pad="large"> <DataTable columns={columns} data={data} size="medium" /> </Box> // </Grommet> ); SizedDataTable.storyName = 'Sized'; export default { title: 'Visualizations/DataTable/Sized', };
src/DropdownStateMixin.js
coderstudy/react-bootstrap
import React from 'react'; import domUtils from './utils/domUtils'; import EventListener from './utils/EventListener'; /** * Checks whether a node is within * a root nodes tree * * @param {DOMElement} node * @param {DOMElement} root * @returns {boolean} */ function isNodeInRoot(node, root) { while (node) { if (node === root) { return true; } node = node.parentNode; } return false; } const DropdownStateMixin = { getInitialState() { return { open: false }; }, setDropdownState(newState, onStateChangeComplete) { if (newState) { this.bindRootCloseHandlers(); } else { this.unbindRootCloseHandlers(); } this.setState({ open: newState }, onStateChangeComplete); }, handleDocumentKeyUp(e) { if (e.keyCode === 27) { this.setDropdownState(false); } }, handleDocumentClick(e) { // If the click originated from within this component // don't do anything. // e.srcElement is required for IE8 as e.target is undefined let target = e.target || e.srcElement; if (isNodeInRoot(target, React.findDOMNode(this))) { return; } this.setDropdownState(false); }, bindRootCloseHandlers() { let doc = domUtils.ownerDocument(this); this._onDocumentClickListener = EventListener.listen(doc, 'click', this.handleDocumentClick); this._onDocumentKeyupListener = EventListener.listen(doc, 'keyup', this.handleDocumentKeyUp); }, unbindRootCloseHandlers() { if (this._onDocumentClickListener) { this._onDocumentClickListener.remove(); } if (this._onDocumentKeyupListener) { this._onDocumentKeyupListener.remove(); } }, componentWillUnmount() { this.unbindRootCloseHandlers(); } }; export default DropdownStateMixin;
src/_app/js/entry.js
hhumphrey84/harleystphysio
// import React, { Component } from 'react'; // import {render} from 'react-dom'; // import Hello from './components/Hello'; // // class App extends Component { // render() { // return ( // <Hello /> // ) // } // } // // render(<App />, document.getElementById('root')); const menuBtn = document.getElementById('js-menuBtn'); const menuList = document.getElementById('js-menuList'); const siteHeader = document.getElementById('js-site-header'); function toggleMenu() { menuBtn.classList.toggle('is-active'); menuList.classList.toggle('is-active'); siteHeader.classList.toggle('has-active-menu'); } menuBtn.addEventListener('click', toggleMenu);
src/esm/components/graphics/icons-next/window-edit-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 WindowEditIconNext = function WindowEditIconNext(_ref) { var color = _ref.color, title = _ref.title, props = _objectWithoutPropertiesLoose(_ref, _excluded); return /*#__PURE__*/React.createElement("svg", _extends({ width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, props), title && /*#__PURE__*/React.createElement("title", null, title), /*#__PURE__*/React.createElement("path", { d: "M17.667 0H4.333C3.45 0 2.601.356 1.976.989A3.397 3.397 0 0 0 1 3.375v14.25a3.4 3.4 0 0 0 .976 2.387A3.313 3.313 0 0 0 4.333 21h4.445v-2.25H4.333c-.294 0-.577-.119-.785-.33a1.132 1.132 0 0 1-.326-.795V8.25H21V3.375c0-.895-.351-1.754-.976-2.386A3.313 3.313 0 0 0 17.667 0ZM3.222 3.375c0-.298.117-.585.326-.796.208-.21.49-.329.785-.329H9.89V6H3.222V3.375ZM12.112 6V2.25h5.555c.294 0 .577.119.785.33.209.21.326.497.326.795V6H12.11Z", fill: color }), /*#__PURE__*/React.createElement("path", { d: "m16.973 11.002-5.855 5.856a3.79 3.79 0 0 0-1.118 2.7V23h3.442a3.793 3.793 0 0 0 2.7-1.117l5.856-5.856a3.553 3.553 0 0 0-5.025-5.025Zm3.829 2.515c0 .342-.134.67-.373.916l-5.87 5.87a1.583 1.583 0 0 1-1.117.462h-1.207v-1.207c0-.419.166-.82.462-1.117l5.87-5.87a1.318 1.318 0 0 1 2.235.93v.016Z", fill: color })); }; WindowEditIconNext.propTypes = { color: PropTypes.string, title: PropTypes.string }; WindowEditIconNext.defaultProps = { color: '#222', title: null };
src/main.js
kyoyadmoon/fuzzy-hw1
/** * React Static Boilerplate * https://github.com/kriasoft/react-static-boilerplate * * Copyright ยฉ 2015-present Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ 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 router from './router'; import history from './history'; let routes = require('./routes.json').default; // Loaded with utils/routes-loader.js const container = document.getElementById('container'); function renderComponent(component) { ReactDOM.render(<Provider store={store}>{component}</Provider>, container); } // Find and render a web page matching the current URL path, // if such page is not found then render an error page (see routes.json, core/router.js) function render(location) { router.resolve(routes, location) .then(renderComponent) .catch(error => router.resolve(routes, { ...location, error }).then(renderComponent)); } // Handle client-side navigation by using HTML5 History API // For more information visit https://github.com/ReactJSTraining/history/tree/master/docs#readme history.listen(render); render(history.location); // Eliminates the 300ms delay between a physical tap // and the firing of a click event on mobile browsers // https://github.com/ftlabs/fastclick FastClick.attach(document.body); // Enable Hot Module Replacement (HMR) if (module.hot) { module.hot.accept('./routes.json', () => { routes = require('./routes.json').default; // eslint-disable-line global-require render(history.location); }); }
app/javascript/mastodon/features/ui/util/reduced_motion.js
anon5r/mastonon
// Like react-motion's Motion, but reduces all animations to cross-fades // for the benefit of users with motion sickness. import React from 'react'; import Motion from 'react-motion/lib/Motion'; import PropTypes from 'prop-types'; const stylesToKeep = ['opacity', 'backgroundOpacity']; const extractValue = (value) => { // This is either an object with a "val" property or it's a number return (typeof value === 'object' && value && 'val' in value) ? value.val : value; }; class ReducedMotion extends React.Component { static propTypes = { defaultStyle: PropTypes.object, style: PropTypes.object, children: PropTypes.func, } render() { const { style, defaultStyle, children } = this.props; Object.keys(style).forEach(key => { if (stylesToKeep.includes(key)) { return; } // If it's setting an x or height or scale or some other value, we need // to preserve the end-state value without actually animating it style[key] = defaultStyle[key] = extractValue(style[key]); }); return ( <Motion style={style} defaultStyle={defaultStyle}> {children} </Motion> ); } } export default ReducedMotion;
packages/react/src/components/molecules/SearchBannerForm/SearchBannerForm.stories.js
massgov/mayflower
import React from 'react'; import { StoryPage } from 'StorybookConfig/preview'; import { action } from '@storybook/addon-actions'; import SearchBannerForm from '.'; import SearchBannerFormDocs from './SearchBannerForm.md'; export const SearchBannerFormExample = (args) => <SearchBannerForm {...args} />; SearchBannerFormExample.storyName = 'Default'; SearchBannerFormExample.args = { action: '#', onSubmit: action('Form submitted'), inputText: { hiddenLabel: false, labelText: 'Search terms', required: false, id: 'GUID138490237', name: 'search', type: 'text', width: 0, maxlength: 0, pattern: '', placeholder: 'Search...', errorMsg: '', onChange: action('Text input modified') }, buttonSearch: { classes: [], onClick: action('Search button clicked'), text: 'Search', ariaLabel: 'Search' } }; SearchBannerFormExample.argTypes = { type: { control: { type: 'select', options: ['text', 'email', 'number'] } } }; export default { title: 'molecules/SearchBannerForm', component: SearchBannerForm, parameters: { docs: { page: () => <StoryPage Description={SearchBannerFormDocs} /> } } };
src/index.js
SashaKoro/redux-tic-tac-toe
import React from 'react'; import { render } from 'react-dom'; import App from './components/app'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import reducer from './reducers'; const store = createStore(reducer); render( <Provider store={store}> <App /> </Provider>, document.querySelector('.container') );
quick-bench/src/dialogs/AboutDialog.js
FredTingaud/quick-bench-front-end
import React from 'react'; import { Modal, Button } from 'react-bootstrap'; class AboutDialog extends React.Component { render() { return ( <Modal show={this.props.show} onHide={this.props.onHide} dialogClassName="modal-60w"> <Modal.Header closeButton> <Modal.Title>About Quick Bench</Modal.Title> </Modal.Header> <Modal.Body> <h4>What is Quick Bench?</h4> <p>Quick Bench is a micro benchmarking tool intended to quickly and simply compare the performance of two or more code snippets.</p> <h4>Why display a ratio of (CPU time / Noop time) instead of actual time?</h4> <p>The benchmark runs on a pool of AWS machines whose load is unknown and potentialy next to multiple other benchmarks. Any duration it could output would be meaningless. The fact that a snippet takes 100ms to run in Quick Bench at a given time gives no information whatsoever about what time it will take to run in your application, with your given architecture.</p> <p>Quick Bench can, however, give a reasonably good comparison between two snippets of code run in the same conditions. That is the purpose this tool was created for; removing any units ensures only meaningful comparison.</p> <p>Using a ratio over an empty function also has another advange: if one of your benchmarks runs as fast as Noop after optimisation, the optimizer probably optimized your code away!</p> <h4>Why is the website slow?</h4> <p>This website is free and the costs are covered by myself and the patrons on Patreon. If enough patrons support the project, I will gladly use more powerfull machines in the future. </p> <h4>I found a bug!</h4> <p><a href="https://github.com/FredTingaud/quick-bench-front-end/issues" target="_blank" rel="noopener noreferrer">Please report it here.</a></p> </Modal.Body> <Modal.Footer> <Button onClick={this.props.onHide}>OK</Button> </Modal.Footer> </Modal> ); } } export default AboutDialog;
website/src/pages/components/home/ValueProps2.js
vokal/keystone
import React, { Component } from 'react'; import Container from '../../../../components/Container'; import { Col, Row } from '../../../../components/Grid'; import theme from '../../../../theme'; import { compose } from 'glamor'; import { EntypoTools } from 'react-entypo'; const ValueProp = ({ icon, text, title, text2, marginTop }) => { return ( <div {...compose(styles.base, { marginTop })}> {icon && <i {...compose(styles.icon)}>{icon}</i>} <div {...compose(styles.content)}> <h3 {...compose(styles.title)}>{title}</h3> <p {...compose(styles.text)}>{text}</p> {text2 ? <p {...compose(styles.text)}>{text2}</p> : null} </div> </div> ); }; ValueProp.defaultProps = { marginTop: '4em', }; export default class ValueProps extends Component { render () { return ( <div className={compose(styles.wrapper)}> <Container> <div className={compose(styles.intro)}> <h2 className={compose(styles.heading)}>What you build is up to you.</h2> <p className={compose(styles.subheading)}>There are a lot of frameworks that make decisions for you, and many that take decisions away.<br />Keystone doesn't do that. Use the features that suit you, and replace the ones that don't.</p> </div> <div className={compose(styles.divider)}> <span className={compose(styles.dividerLine)} /> <EntypoTools style={{ width: '60px', height: '60px', margin: '0 2rem' }} /> <span className={compose(styles.dividerLine)} /> </div> <Row small="1" medium="1/2" large="1/4"> <Col> <ValueProp title="Built on Express" text="Keystone can configure Express for you, or you can take over and treat Keystone like any other Express middleware." text2="You can also easily integrate it into an existing Express app." marginTop="1em" /> </Col> <Col> <ValueProp title="Powered by MongoDB" text="Keystone uses Mongoose, the leading ODM for Node.js and MongoDB, and gives you a single place for your schema, validation rules, and logic." text2="Anything you can build with MongoDB, you can build with Keystone." marginTop="1em" /> </Col> <Col> <ValueProp title="Lightweight and flexible" text="Keystone is designed to be as light as you want - you can pick and choose the features you want to include." text2="Create your own routes, your own database schema, and use any template language you like." marginTop="1em" /> </Col> <Col> <ValueProp title="Extendable" text="One of the greatest things about Node.js is the vast number of quality packages available." text2="Keystone is designed to let you use any of them without losing the benefits they provide." marginTop="1em" /> </Col> </Row> </Container> </div> ); } }; const styles = { wrapper: { backgroundColor: theme.color.blue, color: 'white', padding: '4rem 0', }, intro: { textAlign: 'center', }, heading: { fontSize: '2em', color: 'inherit', }, subheading: { fontSize: '1.25em', color: 'rgba(255,255,255,0.75)', }, divider: { display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '3rem 0', }, dividerLine: { flex: 1, height: 1, backgroundColor: 'rgba(255,255,255,0.1)', }, base: { display: 'flex', }, content: { flexGrow: 1, }, icon: { marginRight: '1em', }, title: { color: 'inherit', margin: 0, }, text: { marginTop: '1rem', }, cloud: { width: '200px', height: '170px', color: theme.color.blue, marginTop: '-170px', position: 'absolute', right: '8%', }, rocket: { width: '137px', height: '140px', color: theme.color.blue, marginTop: '-220px', position: 'absolute', left: '8%', }, };
src/BootstrapMixin.js
gianpaj/react-bootstrap
import React from 'react'; import styleMaps from './styleMaps'; import CustomPropTypes from './utils/CustomPropTypes'; const BootstrapMixin = { propTypes: { /** * bootstrap className * @private */ bsClass: CustomPropTypes.keyOf(styleMaps.CLASSES), /** * Style variants * @type {("default"|"primary"|"success"|"info"|"warning"|"danger"|"link")} */ bsStyle: React.PropTypes.oneOf(styleMaps.STYLES), /** * Size variants * @type {("xsmall"|"small"|"medium"|"large"|"xs"|"sm"|"md"|"lg")} */ bsSize: CustomPropTypes.keyOf(styleMaps.SIZES) }, getBsClassSet() { let classes = {}; let bsClass = this.props.bsClass && styleMaps.CLASSES[this.props.bsClass]; if (bsClass) { classes[bsClass] = true; let prefix = bsClass + '-'; let bsSize = this.props.bsSize && styleMaps.SIZES[this.props.bsSize]; if (bsSize) { classes[prefix + bsSize] = true; } if (this.props.bsStyle) { if (styleMaps.STYLES.indexOf(this.props.bsStyle) >= 0) { classes[prefix + this.props.bsStyle] = true; } else { classes[this.props.bsStyle] = true; } } } return classes; }, prefixClass(subClass) { return styleMaps.CLASSES[this.props.bsClass] + '-' + subClass; } }; export default BootstrapMixin;
o2web/source/x_component_appstore_application/src/index.js
o2oa/o2oa
import React from 'react'; import * as ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; import {loadComponent, component} from '@o2oa/component'; loadComponent('appstore.application', (content, cb)=>{ // const root = createRoot(content); // root.render( // <React.StrictMode> // <App/> // </React.StrictMode> // ); component.recordStatus = function(){ return {"appId": this.options.appId,"appName":this.options.appName}; } if (component.status) { component.options.appId = component.status.appId; component.options.appName = component.status.appName; } ReactDOM.render( <React.StrictMode> <App/> </React.StrictMode>, content, cb ); }).then((c)=>{ c.render(); }); // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals();
Libraries/Components/TextInput/TextInput.js
CodeLinkIO/react-native
/** * Copyright (c) 2015-present, 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. * * @providesModule TextInput * @flow */ 'use strict'; const ColorPropType = require('ColorPropType'); const DocumentSelectionState = require('DocumentSelectionState'); const EventEmitter = require('EventEmitter'); const NativeMethodsMixin = require('NativeMethodsMixin'); const Platform = require('Platform'); const React = require('React'); const ReactNative = require('ReactNative'); const StyleSheet = require('StyleSheet'); const Text = require('Text'); const TextInputState = require('TextInputState'); const TimerMixin = require('react-timer-mixin'); const TouchableWithoutFeedback = require('TouchableWithoutFeedback'); const UIManager = require('UIManager'); const View = require('View'); const emptyFunction = require('fbjs/lib/emptyFunction'); const invariant = require('fbjs/lib/invariant'); const requireNativeComponent = require('requireNativeComponent'); const warning = require('fbjs/lib/warning'); const PropTypes = React.PropTypes; const onlyMultiline = { onTextInput: true, children: true, }; if (Platform.OS === 'android') { var AndroidTextInput = requireNativeComponent('AndroidTextInput', null); } else if (Platform.OS === 'ios') { var RCTTextView = requireNativeComponent('RCTTextView', null); var RCTTextField = requireNativeComponent('RCTTextField', null); } type Event = Object; type Selection = { start: number, end?: number, }; const DataDetectorTypes = [ 'phoneNumber', 'link', 'address', 'calendarEvent', 'none', 'all', ]; /** * A foundational component for inputting text into the app via a * keyboard. Props provide configurability for several features, such as * auto-correction, auto-capitalization, placeholder text, and different keyboard * types, such as a numeric keypad. * * The simplest use case is to plop down a `TextInput` and subscribe to the * `onChangeText` events to read the user input. There are also other events, * such as `onSubmitEditing` and `onFocus` that can be subscribed to. A simple * example: * * ```ReactNativeWebPlayer * import React, { Component } from 'react'; * import { AppRegistry, TextInput } from 'react-native'; * * class UselessTextInput extends Component { * constructor(props) { * super(props); * this.state = { text: 'Useless Placeholder' }; * } * * render() { * return ( * <TextInput * style={{height: 40, borderColor: 'gray', borderWidth: 1}} * onChangeText={(text) => this.setState({text})} * value={this.state.text} * /> * ); * } * } * * // App registration and rendering * AppRegistry.registerComponent('AwesomeProject', () => UselessTextInput); * ``` * * Note that some props are only available with `multiline={true/false}`. * Additionally, border styles that apply to only one side of the element * (e.g., `borderBottomColor`, `borderLeftWidth`, etc.) will not be applied if * `multiline=false`. To achieve the same effect, you can wrap your `TextInput` * in a `View`: * * ```ReactNativeWebPlayer * import React, { Component } from 'react'; * import { AppRegistry, View, TextInput } from 'react-native'; * * class UselessTextInput extends Component { * render() { * return ( * <TextInput * {...this.props} // Inherit any props passed to it; e.g., multiline, numberOfLines below * editable = {true} * maxLength = {40} * /> * ); * } * } * * class UselessTextInputMultiline extends Component { * constructor(props) { * super(props); * this.state = { * text: 'Useless Multiline Placeholder', * }; * } * * // If you type something in the text box that is a color, the background will change to that * // color. * render() { * return ( * <View style={{ * backgroundColor: this.state.text, * borderBottomColor: '#000000', * borderBottomWidth: 1 }} * > * <UselessTextInput * multiline = {true} * numberOfLines = {4} * onChangeText={(text) => this.setState({text})} * value={this.state.text} * /> * </View> * ); * } * } * * // App registration and rendering * AppRegistry.registerComponent( * 'AwesomeProject', * () => UselessTextInputMultiline * ); * ``` * * `TextInput` has by default a border at the bottom of its view. This border * has its padding set by the background image provided by the system, and it * cannot be changed. Solutions to avoid this is to either not set height * explicitly, case in which the system will take care of displaying the border * in the correct position, or to not display the border by setting * `underlineColorAndroid` to transparent. * * Note that on Android performing text selection in input can change * app's activity `windowSoftInputMode` param to `adjustResize`. * This may cause issues with components that have position: 'absolute' * while keyboard is active. To avoid this behavior either specify `windowSoftInputMode` * in AndroidManifest.xml ( https://developer.android.com/guide/topics/manifest/activity-element.html ) * or control this param programmatically with native code. * */ const TextInput = React.createClass({ statics: { /* TODO(brentvatne) docs are needed for this */ State: TextInputState, }, propTypes: { ...View.propTypes, /** * Can tell `TextInput` to automatically capitalize certain characters. * * - `characters`: all characters. * - `words`: first letter of each word. * - `sentences`: first letter of each sentence (*default*). * - `none`: don't auto capitalize anything. */ autoCapitalize: PropTypes.oneOf([ 'none', 'sentences', 'words', 'characters', ]), /** * If `false`, disables auto-correct. The default value is `true`. */ autoCorrect: PropTypes.bool, /** * If `false`, disables spell-check style (i.e. red underlines). * The default value is inherited from `autoCorrect`. * @platform ios */ spellCheck: PropTypes.bool, /** * If `true`, focuses the input on `componentDidMount`. * The default value is `false`. */ autoFocus: PropTypes.bool, /** * If `false`, text is not editable. The default value is `true`. */ editable: PropTypes.bool, /** * Determines which keyboard to open, e.g.`numeric`. * * The following values work across platforms: * * - `default` * - `numeric` * - `email-address` * - `phone-pad` */ keyboardType: PropTypes.oneOf([ // Cross-platform 'default', 'email-address', 'numeric', 'phone-pad', // iOS-only 'ascii-capable', 'numbers-and-punctuation', 'url', 'number-pad', 'name-phone-pad', 'decimal-pad', 'twitter', 'web-search', ]), /** * Determines the color of the keyboard. * @platform ios */ keyboardAppearance: PropTypes.oneOf([ 'default', 'light', 'dark', ]), /** * Determines how the return key should look. On Android you can also use * `returnKeyLabel`. * * *Cross platform* * * The following values work across platforms: * * - `done` * - `go` * - `next` * - `search` * - `send` * * *Android Only* * * The following values work on Android only: * * - `none` * - `previous` * * *iOS Only* * * The following values work on iOS only: * * - `default` * - `emergency-call` * - `google` * - `join` * - `route` * - `yahoo` */ returnKeyType: PropTypes.oneOf([ // Cross-platform 'done', 'go', 'next', 'search', 'send', // Android-only 'none', 'previous', // iOS-only 'default', 'emergency-call', 'google', 'join', 'route', 'yahoo', ]), /** * Sets the return key to the label. Use it instead of `returnKeyType`. * @platform android */ returnKeyLabel: PropTypes.string, /** * Limits the maximum number of characters that can be entered. Use this * instead of implementing the logic in JS to avoid flicker. */ maxLength: PropTypes.number, /** * Sets the number of lines for a `TextInput`. Use it with multiline set to * `true` to be able to fill the lines. * @platform android */ numberOfLines: PropTypes.number, /** * When `false`, if there is a small amount of space available around a text input * (e.g. landscape orientation on a phone), the OS may choose to have the user edit * the text inside of a full screen text input mode. When `true`, this feature is * disabled and users will always edit the text directly inside of the text input. * Defaults to `false`. * @platform android */ disableFullscreenUI: PropTypes.bool, /** * If `true`, the keyboard disables the return key when there is no text and * automatically enables it when there is text. The default value is `false`. * @platform ios */ enablesReturnKeyAutomatically: PropTypes.bool, /** * If `true`, the text input can be multiple lines. * The default value is `false`. */ multiline: PropTypes.bool, /** * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced` * The default value is `simple`. * @platform android */ textBreakStrategy: React.PropTypes.oneOf(['simple', 'highQuality', 'balanced']), /** * Callback that is called when the text input is blurred. */ onBlur: PropTypes.func, /** * Callback that is called when the text input is focused. */ onFocus: PropTypes.func, /** * Callback that is called when the text input's text changes. */ onChange: PropTypes.func, /** * Callback that is called when the text input's text changes. * Changed text is passed as an argument to the callback handler. */ onChangeText: PropTypes.func, /** * Callback that is called when the text input's content size changes. * This will be called with * `{ nativeEvent: { contentSize: { width, height } } }`. * * Only called for multiline text inputs. */ onContentSizeChange: PropTypes.func, /** * Callback that is called when text input ends. */ onEndEditing: PropTypes.func, /** * Callback that is called when the text input selection is changed. * This will be called with * `{ nativeEvent: { selection: { start, end } } }`. */ onSelectionChange: PropTypes.func, /** * Callback that is called when the text input's submit button is pressed. * Invalid if `multiline={true}` is specified. */ onSubmitEditing: PropTypes.func, /** * Callback that is called when a key is pressed. * This will be called with `{ nativeEvent: { key: keyValue } }` * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and * the typed-in character otherwise including `' '` for space. * Fires before `onChange` callbacks. * @platform ios */ onKeyPress: PropTypes.func, /** * Invoked on mount and layout changes with `{x, y, width, height}`. */ onLayout: PropTypes.func, /** * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`. * May also contain other properties from ScrollEvent but on Android contentSize * is not provided for performance reasons. */ onScroll: PropTypes.func, /** * The string that will be rendered before text input has been entered. */ placeholder: PropTypes.node, /** * The text color of the placeholder string. */ placeholderTextColor: ColorPropType, /** * If `true`, the text input obscures the text entered so that sensitive text * like passwords stay secure. The default value is `false`. */ secureTextEntry: PropTypes.bool, /** * The highlight and cursor color of the text input. */ selectionColor: ColorPropType, /** * An instance of `DocumentSelectionState`, this is some state that is responsible for * maintaining selection information for a document. * * Some functionality that can be performed with this instance is: * * - `blur()` * - `focus()` * - `update()` * * > You can reference `DocumentSelectionState` in * > [`vendor/document/selection/DocumentSelectionState.js`](https://github.com/facebook/react-native/blob/master/Libraries/vendor/document/selection/DocumentSelectionState.js) * * @platform ios */ selectionState: PropTypes.instanceOf(DocumentSelectionState), /** * The start and end of the text input's selection. Set start and end to * the same value to position the cursor. */ selection: PropTypes.shape({ start: PropTypes.number.isRequired, end: PropTypes.number, }), /** * The value to show for the text input. `TextInput` is a controlled * component, which means the native value will be forced to match this * value prop if provided. For most uses, this works great, but in some * cases this may cause flickering - one common cause is preventing edits * by keeping value the same. In addition to simply setting the same value, * either set `editable={false}`, or set/update `maxLength` to prevent * unwanted edits without flicker. */ value: PropTypes.string, /** * Provides an initial value that will change when the user starts typing. * Useful for simple use-cases where you do not want to deal with listening * to events and updating the value prop to keep the controlled state in sync. */ defaultValue: PropTypes.node, /** * When the clear button should appear on the right side of the text view. * @platform ios */ clearButtonMode: PropTypes.oneOf([ 'never', 'while-editing', 'unless-editing', 'always', ]), /** * If `true`, clears the text field automatically when editing begins. * @platform ios */ clearTextOnFocus: PropTypes.bool, /** * If `true`, all text will automatically be selected on focus. */ selectTextOnFocus: PropTypes.bool, /** * If `true`, the text field will blur when submitted. * The default value is true for single-line fields and false for * multiline fields. Note that for multiline fields, setting `blurOnSubmit` * to `true` means that pressing return will blur the field and trigger the * `onSubmitEditing` event instead of inserting a newline into the field. */ blurOnSubmit: PropTypes.bool, /** * Note that not all Text styles are supported, * see [Issue#7070](https://github.com/facebook/react-native/issues/7070) * for more detail. * * [Styles](docs/style.html) */ style: Text.propTypes.style, /** * The color of the `TextInput` underline. * @platform android */ underlineColorAndroid: ColorPropType, /** * If defined, the provided image resource will be rendered on the left. * @platform android */ inlineImageLeft: PropTypes.string, /** * Padding between the inline image, if any, and the text input itself. * @platform android */ inlineImagePadding: PropTypes.number, /** * Determines the types of data converted to clickable URLs in the text input. * Only valid if `multiline={true}` and `editable={false}`. * By default no data types are detected. * * You can provide one type or an array of many types. * * Possible values for `dataDetectorTypes` are: * * - `'phoneNumber'` * - `'link'` * - `'address'` * - `'calendarEvent'` * - `'none'` * - `'all'` * * @platform ios */ dataDetectorTypes: PropTypes.oneOfType([ PropTypes.oneOf(DataDetectorTypes), PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)), ]), /** * If `true`, caret is hidden. The default value is `false`. */ caretHidden: PropTypes.bool, }, /** * `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We * make `this` look like an actual native component class. */ mixins: [NativeMethodsMixin, TimerMixin], viewConfig: ((Platform.OS === 'ios' && RCTTextField ? RCTTextField.viewConfig : (Platform.OS === 'android' && AndroidTextInput ? AndroidTextInput.viewConfig : {})) : Object), /** * Returns `true` if the input is currently focused; `false` otherwise. */ isFocused: function(): boolean { return TextInputState.currentlyFocusedField() === ReactNative.findNodeHandle(this._inputRef); }, contextTypes: { onFocusRequested: React.PropTypes.func, focusEmitter: React.PropTypes.instanceOf(EventEmitter), }, _inputRef: (undefined: any), _focusSubscription: (undefined: ?Function), _lastNativeText: (undefined: ?string), _lastNativeSelection: (undefined: ?Selection), componentDidMount: function() { this._lastNativeText = this.props.value; if (!this.context.focusEmitter) { if (this.props.autoFocus) { this.requestAnimationFrame(this.focus); } return; } this._focusSubscription = this.context.focusEmitter.addListener( 'focus', (el) => { if (this === el) { this.requestAnimationFrame(this.focus); } else if (this.isFocused()) { this.blur(); } } ); if (this.props.autoFocus) { this.context.onFocusRequested(this); } }, componentWillUnmount: function() { this._focusSubscription && this._focusSubscription.remove(); if (this.isFocused()) { this.blur(); } }, getChildContext: function(): Object { return {isInAParentText: true}; }, childContextTypes: { isInAParentText: React.PropTypes.bool }, /** * Removes all text from the `TextInput`. */ clear: function() { this.setNativeProps({text: ''}); }, render: function() { if (Platform.OS === 'ios') { return this._renderIOS(); } else if (Platform.OS === 'android') { return this._renderAndroid(); } }, _getText: function(): ?string { return typeof this.props.value === 'string' ? this.props.value : ( typeof this.props.defaultValue === 'string' ? this.props.defaultValue : '' ); }, _setNativeRef: function(ref: any) { this._inputRef = ref; }, _renderIOS: function() { var textContainer; var props = Object.assign({}, this.props); props.style = [styles.input, this.props.style]; if (props.selection && props.selection.end == null) { props.selection = {start: props.selection.start, end: props.selection.start}; } if (!props.multiline) { if (__DEV__) { for (var propKey in onlyMultiline) { if (props[propKey]) { const error = new Error( 'TextInput prop `' + propKey + '` is only supported with multiline.' ); warning(false, '%s', error.stack); } } } textContainer = <RCTTextField ref={this._setNativeRef} {...props} onFocus={this._onFocus} onBlur={this._onBlur} onChange={this._onChange} onSelectionChange={this._onSelectionChange} onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue} text={this._getText()} />; } else { var children = props.children; var childCount = 0; React.Children.forEach(children, () => ++childCount); invariant( !(props.value && childCount), 'Cannot specify both value and children.' ); if (childCount >= 1) { children = <Text style={props.style}>{children}</Text>; } if (props.inputView) { children = [children, props.inputView]; } textContainer = <RCTTextView ref={this._setNativeRef} {...props} children={children} onFocus={this._onFocus} onBlur={this._onBlur} onChange={this._onChange} onContentSizeChange={this.props.onContentSizeChange} onSelectionChange={this._onSelectionChange} onTextInput={this._onTextInput} onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue} text={this._getText()} dataDetectorTypes={this.props.dataDetectorTypes} onScroll={this._onScroll} />; } return ( <TouchableWithoutFeedback onLayout={props.onLayout} onPress={this._onPress} rejectResponderTermination={true} accessible={props.accessible} accessibilityLabel={props.accessibilityLabel} accessibilityTraits={props.accessibilityTraits} testID={props.testID}> {textContainer} </TouchableWithoutFeedback> ); }, _renderAndroid: function() { const props = Object.assign({}, this.props); props.style = [this.props.style]; props.autoCapitalize = UIManager.AndroidTextInput.Constants.AutoCapitalizationType[this.props.autoCapitalize]; var children = this.props.children; var childCount = 0; React.Children.forEach(children, () => ++childCount); invariant( !(this.props.value && childCount), 'Cannot specify both value and children.' ); if (childCount > 1) { children = <Text>{children}</Text>; } if (props.selection && props.selection.end == null) { props.selection = {start: props.selection.start, end: props.selection.start}; } const textContainer = <AndroidTextInput ref={this._setNativeRef} {...props} mostRecentEventCount={0} onFocus={this._onFocus} onBlur={this._onBlur} onChange={this._onChange} onSelectionChange={this._onSelectionChange} onTextInput={this._onTextInput} text={this._getText()} children={children} disableFullscreenUI={this.props.disableFullscreenUI} textBreakStrategy={this.props.textBreakStrategy} onScroll={this._onScroll} />; return ( <TouchableWithoutFeedback onLayout={this.props.onLayout} onPress={this._onPress} accessible={this.props.accessible} accessibilityLabel={this.props.accessibilityLabel} accessibilityComponentType={this.props.accessibilityComponentType} testID={this.props.testID}> {textContainer} </TouchableWithoutFeedback> ); }, _onFocus: function(event: Event) { if (this.props.onFocus) { this.props.onFocus(event); } if (this.props.selectionState) { this.props.selectionState.focus(); } }, _onPress: function(event: Event) { if (this.props.editable || this.props.editable === undefined) { this.focus(); } }, _onChange: function(event: Event) { // Make sure to fire the mostRecentEventCount first so it is already set on // native when the text value is set. if (this._inputRef) { this._inputRef.setNativeProps({ mostRecentEventCount: event.nativeEvent.eventCount, }); } var text = event.nativeEvent.text; this.props.onChange && this.props.onChange(event); this.props.onChangeText && this.props.onChangeText(text); if (!this._inputRef) { // calling `this.props.onChange` or `this.props.onChangeText` // may clean up the input itself. Exits here. return; } this._lastNativeText = text; this.forceUpdate(); }, _onSelectionChange: function(event: Event) { this.props.onSelectionChange && this.props.onSelectionChange(event); if (!this._inputRef) { // calling `this.props.onSelectionChange` // may clean up the input itself. Exits here. return; } this._lastNativeSelection = event.nativeEvent.selection; if (this.props.selection || this.props.selectionState) { this.forceUpdate(); } }, componentDidUpdate: function () { // This is necessary in case native updates the text and JS decides // that the update should be ignored and we should stick with the value // that we have in JS. const nativeProps = {}; if (this._lastNativeText !== this.props.value && typeof this.props.value === 'string') { nativeProps.text = this.props.value; } // Selection is also a controlled prop, if the native value doesn't match // JS, update to the JS value. const {selection} = this.props; if (this._lastNativeSelection && selection && (this._lastNativeSelection.start !== selection.start || this._lastNativeSelection.end !== selection.end)) { nativeProps.selection = this.props.selection; } if (Object.keys(nativeProps).length > 0 && this._inputRef) { this._inputRef.setNativeProps(nativeProps); } if (this.props.selectionState && selection) { this.props.selectionState.update(selection.start, selection.end); } }, _onBlur: function(event: Event) { this.blur(); if (this.props.onBlur) { this.props.onBlur(event); } if (this.props.selectionState) { this.props.selectionState.blur(); } }, _onTextInput: function(event: Event) { this.props.onTextInput && this.props.onTextInput(event); }, _onScroll: function(event: Event) { this.props.onScroll && this.props.onScroll(event); }, }); var styles = StyleSheet.create({ input: { alignSelf: 'stretch', }, }); module.exports = TextInput;
app/router.js
spasovski/shield-studies-client
import React from 'react'; import {Router, Route, browserHistory} from 'react-router'; // Layouts import MainLayout from './components/layouts/main-layout'; // Pages import StudyListContainer from './components/containers/study-list-container'; import SignIn from './components/views/sign-in'; import StudyDetailsContainer from './components/containers/study-details-container'; function requireAuth(nextState, replace) { if (!localStorage.user_token) { replace({ pathname: '/signin', state: {nextPathname: nextState.location.pathname} }); } } export default ( <Router history={browserHistory}> <Route component={MainLayout}> <Route path="/" component={StudyListContainer} name="home" onEnter={requireAuth} /> <Route path="/studies" onEnter={requireAuth}> <Route path=":studyId" component={StudyDetailsContainer} /> </Route> <Route path="/signin" component={SignIn} /> </Route> </Router> );
index.android.js
Capoeira-Bordeaux/GingaOctet
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Image, Text, View } from 'react-native'; export default class GingaOctet extends Component { render() { return ( <Image source={require('./assets/images/background.png')} style={styles.container}> <Text style={styles.welcome}> Welcome to React Native! </Text> <Text style={styles.instructions}> To get started, edit index.android.js </Text> <Text style={styles.instructions}> Double tap R on your keyboard to reload,{'\n'} Shake or press menu button for dev menu </Text> </Image> ); } } const styles = StyleSheet.create({ backgroundImage: { flex: 1, width: null, height: null, resizeMode: 'cover', // 'stretch' backgroundColor: 'transparent', }, container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, }, }); AppRegistry.registerComponent('GingaOctet', () => GingaOctet);
src/browser/offline/OfflinePage.js
VigneshRavichandran02/3io
/* @flow */ import type { State } from '../../common/types'; import React from 'react'; import linksMessages from '../../common/app/linksMessages'; import { PageHeader, Pre, Title, View } from '../app/components'; import { connect } from 'react-redux'; const OfflinePage = ({ online }) => ( <View> <Title message={linksMessages.offline} /> <PageHeader heading="Offline" /> <Pre> state.app.online: {online.toString()} </Pre> </View> ); OfflinePage.propTypes = { online: React.PropTypes.bool.isRequired, }; export default connect( (state: State) => ({ online: state.app.online, }), )(OfflinePage);
modules/IndexRedirect.js
meraki/react-router
import React from 'react' import warning from './warning' import invariant from 'invariant' import Redirect from './Redirect' import { falsy } from './PropTypes' const { string, object } = React.PropTypes /** * An <IndexRedirect> is used to redirect from an indexRoute. */ const IndexRedirect = React.createClass({ statics: { createRouteFromReactElement(element, parentRoute) { /* istanbul ignore else: sanity check */ if (parentRoute) { parentRoute.indexRoute = Redirect.createRouteFromReactElement(element) } else { warning( false, 'An <IndexRedirect> does not make sense at the root of your route config' ) } } }, propTypes: { to: string.isRequired, query: object, state: object, onEnter: falsy, children: falsy }, /* istanbul ignore next: sanity check */ render() { invariant( false, '<IndexRedirect> elements are for router configuration only and should not be rendered' ) } }) export default IndexRedirect
docs/src/layouts/wrapper.js
adrianleb/nuclear-js
import React from 'react' import { BASE_URL } from '../globals' const PRISM_PATH = BASE_URL + 'assets/js/prism.js' const CSS_PATH = BASE_URL + 'assets/css/output.css' const JS_PATH = BASE_URL + 'app.js' const GA_SCRIPT = `(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-64060472-1', 'auto'); ga('send', 'pageview');` export default React.createClass({ render() { let pageTitle = "NuclearJS" if (this.props.title) { pageTitle += " | " + this.props.title } return ( <html lang="en"> <head> <meta httpEquiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/> <title>{pageTitle}</title> <link href={CSS_PATH} type="text/css" rel="stylesheet" media="screen,projection"/> <script src="//cdn.optimizely.com/js/3006700484.js"></script> <script dangerouslySetInnerHTML={{__html: GA_SCRIPT}}></script> </head> <body> {this.props.children} <script src={PRISM_PATH}></script> <script src={JS_PATH}></script> </body> </html> ) } })
Auth/website/src/pages/FAQ.js
awslabs/aws-serverless-workshops
/* * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. This file 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 SiteNav from '../components/SiteNav'; import SiteFooter from '../components/SiteFooter'; import '../css/main.css'; const FAQ = () => { return ( <div className="page-faq"> <header className="site-header"> <div className="site-logo">Wild Rydes</div> <div className="row column medium-8 large-6 xlarge-5 xxlarge-4"> <h1 className="title">Frequently Asked Questions</h1> </div> <SiteNav/> </header> <section className="faq-list"> <div className="row column medium-10 large-8 xxlarge-6"> <dl> <dt>Q: Why should I use this app?</dt> <dd>A: Unicorns are faster, safer, and more reliable. In recent times, their numbers have grown significantly, reaching a scale that makes it finally possible to harness them for mass transportation at an affordable cost.</dd> <dt>Q: How do you recruit the unicorns? How can I know that my unicorn is trustworthy?</dt> <dd>A: Our unicorns are recruited from only the most humane and highest standard unicorn farms. Our unicorns are grass-fed, free range creatures raised on vegan, non-GMO diets. These unicorns are also completely safe because unicorns have infallible morality and judgment.</dd> <dt>Q: How do I request a unicorn?</dt> <dd>A: Simply download our app, then tap a button to begin. Your unicorn will arrive shortly.</dd> <dt>Q: How much does it cost?</dt> <dd>A: Since Wild Rydes is a marketplace for flight-based transportation, the price you pay is based on factors such as distance and availability of unicorns. You set the maximum price youโ€™re willing to pay for a given ryde and then Wild Rydes matches you with a unicorn thatโ€™s willing to accept your price.</dd> <dt>Q: How does it work?</dt> <dd>A: Our product is powered by a complex algorithm which efficiently matches idle unicorns with ryders based on factors such as proximity and shortest time-to-destination. The system is built on a serverless architecture, which makes running and scaling our backend services simple and cost-effective, allowing us to reliably serve the needs of Wild Rydesโ€™ ever growing user base.</dd> <dt>Q: What if I have a complaint about my unicorn?</dt> <dd>A: Wild Rydes is a customer obsessed company. We value each customer and want to ensure a positive experience. Therefore, weโ€™ve staffed our customer service team with serverless chatbots that are available 24/7 to assist you.</dd> <dt>Q: How do I cancel my ride?</dt> <dd>A: Tap the โ€œCancel Rydeโ€ button in the Wild Rydes app.</dd> <dt>Q: Can I use Wild Rydes internationally?</dt> <dd>A: Yes, you can use Wild Rydes in most countries except for Antarctica, Cuba, Sudan, Iran, North Korea, Syria and any other country designated by the United States Treasury's Office of Foreign Assets Control.</dd> <dt>Q: How do I pay for my ryde?</dt> <dd>A: After creating a Wild Rydes account, fill in your payment method such as credit card, debit card, Bitcoin wallet, or Vespene gas repository. After you complete your Ryde, you will automatically be charged the fare.</dd> <dt>Q: How many passengers can my unicorn take?</dt> <dd>A: The number of passengers on a single ryde depends on the size of your unicorn. Most unicorns can take one passenger per ryde. You can also request a large size unicorn which can take up to two passengers. If you select Sleigh version, you can take up to 4 passengers.</dd> <dt>Q: What if I lose an item during my ryde?</dt> <dd>A: Unfortunately, itโ€™s unlikely we can retrieve your lost item if it has fallen off the unicorn during your ryde.</dd> <dt>Q: How do I share my route information with someone else?</dt> <dd>A: During your ryde, you can share your route and ETA with someone else using the Wild Rydes app. Simply tap the โ€œShare Routeโ€ button and select a contact. Soon, theyโ€™ll be able to watch the status of your ryde.</dd> <dt>Q: How do I rate my unicorn?</dt> <dd>A: After your ryde completes, you have the option to rate your unicorn on the app. Our unicorns are customer obsessed and strive for 5 star ratings. Your feedback helps us improve our service!</dd> <dt>Q: What if my unicorn doesnโ€™t match the photo in the app?</dt> <dd>A: The unicorn photo in your app should match the unicorn that arrives to pick you up. If they do not match, then Wild Rydes recommends that you do not board the unicorn. You should then immediately report the imposter unicorn to Wild Rydes.</dd> <dt>Q: Can I use Concur with Wild Rydes?</dt> <dd>A: Yes, you can connect your Concur profile to the Wild Rydes app so you can track business trips made on Wild Rydes.</dd> <dt>Q: Can I request a specific unicorn?</dt> <dd>A: While we do not allow requesting specific unicorns, you can choose the type and size of unicorn using the app.</dd> <dt>Q: Why do you charge a service fee?</dt> <dd>A: The service fee is a fixed charge added to every ryde. This helps us pay for our on-going maintenance and operating costs required to run the service and tend to our unicorn herd.</dd> </dl> </div> </section> <SiteFooter/> </div> ); }; export default FAQ;
src/javascript/components/component.js
rahulharinkhede2013/xigro-dashboard
import React from 'react'; import {bindActionCreators} from 'redux'; import {connect} from 'react-redux'; import {buttonClick} from './../action/simpleAction.js'; class SimpleComponent extends React.Component { constructor(props) { super(props); this.onLike = this.onLike.bind(this); this.onUnLike = this.onUnLike.bind(this); } onLike() { this.props.buttonClick(1); } onUnLike() { this.props.buttonClick(-1); } render() { let disabled = this.props.likeUnlike == 0; return ( <div> <h4> Number of Likes to this project </h4> <h4 className="margin-top-10"> Like : <span className="red"> {this.props.likeUnlike ? this.props.likeUnlike : 0} </span> {disabled} </h4> <div className="margin-top-10"> <button className="btn pull-left" onClick={this.onLike}> Like </button> <button className="btn pull-left" onClick={this.onUnLike} disabled={disabled}>Unlike</button> </div> </div> ); } } function mapStateToProps(state) { return { likeUnlike: state.likeUnlike }; } function matchDispatchToProps(dispatch) { return bindActionCreators({buttonClick: buttonClick}, dispatch); } export default connect(mapStateToProps, matchDispatchToProps)(SimpleComponent);
dashboard-ui/app/components/dashboardproject/dashboardproject.js
CloudBoost/cloudboost
'use strict'; import React from 'react'; import Projecthead from './projecthead'; import Projectscontainer from './projectscontainer'; import Footer from '../footer/footer'; const Dashboardproject = React.createClass({ render: function () { return ( <div> <div className='dashproject app-dashproject' id='app-dashproject'> <div> <Projecthead /> <Projectscontainer /> </div> </div> <Footer id='app-footer' /> </div> ); } }); export default Dashboardproject;
client/src/components/NotFound/index.js
dotkom/super-duper-fiesta
import React from 'react'; const NotFound = () => ( <div> <h1>Denne siden eksisterer ikke</h1> </div> ); export default NotFound;
src/carousel.js
beni55/nuka-carousel
'use strict'; import React from 'react'; import tweenState from 'react-tween-state'; import decorators from './decorators'; import assign from 'object-assign'; import ExecutionEnvironment from 'exenv'; React.initializeTouchEvents(true); const addEvent = function(elem, type, eventHandle) { if (elem == null || typeof (elem) === 'undefined') { return; } if (elem.addEventListener) { elem.addEventListener(type, eventHandle, false); } else if (elem.attachEvent) { elem.attachEvent('on' + type, eventHandle); } else { elem['on'+type] = eventHandle; } }; const removeEvent = function(elem, type, eventHandle) { if (elem == null || typeof (elem) === 'undefined') { return; } if (elem.removeEventListener) { elem.removeEventListener(type, eventHandle, false); } else if (elem.detachEvent) { elem.detachEvent('on' + type, eventHandle); } else { elem['on'+type] = null; } }; const Carousel = React.createClass({ displayName: 'Carousel', mixins: [tweenState.Mixin], propTypes: { cellAlign: React.PropTypes.oneOf(['left', 'center', 'right']), cellSpacing: React.PropTypes.number, data: React.PropTypes.func, decorators: React.PropTypes.array, dragging: React.PropTypes.bool, easing: React.PropTypes.string, edgeEasing: React.PropTypes.string, framePadding: React.PropTypes.string, initialSlideHeight: React.PropTypes.number, initialSlideWidth: React.PropTypes.number, slidesToShow: React.PropTypes.number, slidesToScroll: React.PropTypes.oneOfType([ React.PropTypes.number, React.PropTypes.oneOf(['auto']) ]), slideWidth: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.number ]), speed: React.PropTypes.number, vertical: React.PropTypes.bool, width: React.PropTypes.string }, getDefaultProps() { return { cellAlign: 'left', cellSpacing: 0, data: function() {}, decorators: decorators, dragging: true, easing: 'easeOutCirc', edgeEasing: 'easeOutElastic', framePadding: '0px', slidesToShow: 1, slidesToScroll: 1, slideWidth: 1, speed: 500, vertical: false, width: '100%' } }, getInitialState() { return { currentSlide: 0, dragging: false, frameWidth: 0, left: 0, top: 0, slideCount: 0, slideWidth: 0, slidesToScroll: this.props.slidesToScroll } }, componentWillMount() { this.setInitialDimensions(); }, componentDidMount() { this.setDimensions(); this.bindEvents(); this.setExternalData(); }, componentWillReceiveProps(nextProps) { this.setDimensions(); }, componentWillUnmount() { this.unbindEvents(); }, render() { var self = this; var children = React.Children.count(this.props.children) > 1 ? this.formatChildren(this.props.children) : this.props.children; return ( <div className={['slider', this.props.className || ''].join(' ')} ref="slider" style={assign(this.getSliderStyles(), this.props.style || {})}> <div className="slider-frame" ref="frame" style={this.getFrameStyles()} {...this.getTouchEvents()} {...this.getMouseEvents()} onClick={this.handleClick}> <ul className="slider-list" ref="list" style={this.getListStyles()}> {children} </ul> </div> {this.props.decorators ? this.props.decorators.map(function(Decorator, index) { return ( <div style={assign(self.getDecoratorStyles(Decorator.position), Decorator.style || {})} className={'slider-decorator-' + index} key={index}> <Decorator.component currentSlide={self.state.currentSlide} slideCount={self.state.slideCount} frameWidth={self.state.frameWidth} slideWidth={self.state.slideWidth} slidesToScroll={self.state.slidesToScroll} cellSpacing={self.props.cellSpacing} slidesToShow={self.props.slidesToShow} nextSlide={self.nextSlide} previousSlide={self.previousSlide} goToSlide={self.goToSlide} /> </div> ) }) : null} <style type="text/css" dangerouslySetInnerHTML={{__html: self.getStyleTagStyles()}}/> </div> ) }, // Touch Events touchObject: {}, getTouchEvents() { var self = this; return { onTouchStart(e) { self.touchObject = { startX: event.touches[0].pageX, startY: event.touches[0].pageY } }, onTouchMove(e) { var direction = self.swipeDirection( self.touchObject.startX, e.touches[0].pageX, self.touchObject.startY, e.touches[0].pageY ); if (direction !== 0) { e.preventDefault(); } self.touchObject = { startX: self.touchObject.startX, startY: self.touchObject.startY, endX: e.touches[0].pageX, endY: e.touches[0].pageY, length: Math.round(Math.sqrt(Math.pow(e.touches[0].pageX - self.touchObject.startX, 2))), direction: direction } self.setState({ left: self.props.vertical ? 0 : (self.state.slideWidth * self.state.currentSlide + (self.touchObject.length * self.touchObject.direction)) * -1, top: self.props.vertical ? (self.state.slideWidth * self.state.currentSlide + (self.touchObject.length * self.touchObject.direction)) * -1 : 0 }); }, onTouchEnd(e) { self.handleSwipe(e); }, onTouchCancel(e) { self.handleSwipe(e); } } }, clickSafe: true, getMouseEvents() { var self = this; if (this.props.dragging === false) { return null; } return { onMouseDown(e) { self.touchObject = { startX: e.clientX, startY: e.clientY }; self.setState({ dragging: true }); }, onMouseMove(e) { if (!self.state.dragging) { return; } var direction = self.swipeDirection( self.touchObject.startX, e.clientX, self.touchObject.startY, e.clientY ); if (direction !== 0) { e.preventDefault(); } var length = self.props.vertical ? Math.round(Math.sqrt(Math.pow(e.clientY - self.touchObject.startY, 2))) : Math.round(Math.sqrt(Math.pow(e.clientX - self.touchObject.startX, 2))) self.touchObject = { startX: self.touchObject.startX, startY: self.touchObject.startY, endX: e.clientX, endY: e.clientY, length: length, direction: direction }; self.setState({ left: self.props.vertical ? 0 : self.getTargetLeft(self.touchObject.length * self.touchObject.direction), top: self.props.vertical ? self.getTargetLeft(self.touchObject.length * self.touchObject.direction) : 0 }); }, onMouseUp(e) { if (!self.state.dragging) { return; } self.handleSwipe(e); }, onMouseLeave(e) { if (!self.state.dragging) { return; } self.handleSwipe(e); } } }, handleClick(e) { if (this.clickSafe === true) { e.preventDefault(); e.stopPropagation(); e.nativeEvent.stopPropagation(); } }, handleSwipe(e) { if (typeof (this.touchObject.length) !== 'undefined' && this.touchObject.length > 44) { this.clickSafe = true; } else { this.clickSafe = false; } if (this.touchObject.length > (this.state.slideWidth / this.props.slidesToShow) / 5) { if (this.touchObject.direction === 1) { if (this.state.currentSlide >= React.Children.count(this.props.children) - this.state.slidesToScroll) { this.animateSlide(tweenState.easingTypes[this.props.edgeEasing]); } else { this.nextSlide(); } } else if (this.touchObject.direction === -1) { if (this.state.currentSlide <= 0) { this.animateSlide(tweenState.easingTypes[this.props.edgeEasing]); } else { this.previousSlide(); } } } else { this.goToSlide(this.state.currentSlide); } this.touchObject = {}; this.setState({ dragging: false }); }, swipeDirection(x1, x2, y1, y2) { var xDist, yDist, r, swipeAngle; xDist = x1 - x2; yDist = y1 - y2; r = Math.atan2(yDist, xDist); swipeAngle = Math.round(r * 180 / Math.PI); if (swipeAngle < 0) { swipeAngle = 360 - Math.abs(swipeAngle); } if ((swipeAngle <= 45) && (swipeAngle >= 0)) { return 1; } if ((swipeAngle <= 360) && (swipeAngle >= 315)) { return 1; } if ((swipeAngle >= 135) && (swipeAngle <= 225)) { return -1; } if (this.props.vertical === true) { if ((swipeAngle >= 35) && (swipeAngle <= 135)) { return 1; } else { return -1; } } return 0; }, // Action Methods goToSlide(index) { var self = this; if (index >= React.Children.count(this.props.children) || index < 0) { return; } this.setState({ currentSlide: index }, function() { self.animateSlide(); self.setExternalData(); }); }, nextSlide() { var self = this; if ((this.state.currentSlide + this.state.slidesToScroll) >= React.Children.count(this.props.children)) { return; } this.setState({ currentSlide: this.state.currentSlide + this.state.slidesToScroll }, function() { self.animateSlide(); self.setExternalData(); }); }, previousSlide() { var self = this; if ((this.state.currentSlide - this.state.slidesToScroll) < 0) { return; } this.setState({ currentSlide: this.state.currentSlide - this.state.slidesToScroll }, function() { self.animateSlide(); self.setExternalData(); }); }, // Animation animateSlide(easing, duration, endValue) { this.tweenState(this.props.vertical ? 'top' : 'left', { easing: easing || tweenState.easingTypes[this.props.easing], duration: duration || this.props.speed, endValue: endValue || this.getTargetLeft() }); }, getTargetLeft(touchOffset) { var offset; switch (this.props.cellAlign) { case 'left': { offset = 0; offset -= this.props.cellSpacing * (this.state.currentSlide); break; } case 'center': { offset = (this.state.frameWidth - this.state.slideWidth) / 2; offset -= this.props.cellSpacing * (this.state.currentSlide); break; } case 'right': { offset = this.state.frameWidth - this.state.slideWidth; offset -= this.props.cellSpacing * (this.state.currentSlide); break; } } if (this.props.vertical) { offset = offset / 2; } offset -= touchOffset || 0; return ((this.state.slideWidth * this.state.currentSlide) - offset) * -1; }, // Bootstrapping bindEvents() { var self = this; if (ExecutionEnvironment.canUseDOM) { addEvent(window, 'resize', self.onResize); addEvent(document, 'readystatechange', self.onReadyStateChange); } }, onResize() { this.setDimensions(); }, onReadyStateChange(event) { this.setDimensions(); }, unbindEvents() { var self = this; if (ExecutionEnvironment.canUseDOM) { removeEvent(window, 'resize', self.onResize); removeEvent(document, 'readystatechange', self.onReadyStateChange); } }, formatChildren(children) { var self = this; return React.Children.map(children, function(child, index) { return <li className="slider-slide" style={self.getSlideStyles()} key={index}>{child}</li> }); }, setInitialDimensions() { var self = this, slideWidth, frameHeight, slideHeight; slideWidth = this.props.vertical ? (this.props.initialSlideHeight || 0) : (this.props.initialSlideWidth || 0); slideHeight = this.props.initialSlideHeight ? this.props.initialSlideHeight * this.props.slidesToShow : 0; frameHeight = slideHeight + ((this.props.cellSpacing / 2) * (this.props.slidesToShow - 1)); this.setState({ frameWidth: this.props.vertical ? frameHeight : '100%', slideCount: React.Children.count(this.props.children), slideWidth: slideWidth }, function() { self.setLeft(); self.setExternalData(); }); }, setDimensions() { var self = this, slideWidth, slidesToScroll, firstSlide, frame, frameWidth, frameHeight, slideHeight; slidesToScroll = this.props.slidesToScroll; frame = React.findDOMNode(this.refs.frame); firstSlide = frame.childNodes[0].childNodes[0]; if (firstSlide) { firstSlide.style.height = 'auto'; slideHeight = firstSlide.offsetHeight * this.props.slidesToShow; } else { slideHeight = 100; } if (typeof this.props.slideWidth !== 'number') { slideWidth = parseInt(this.props.slideWidth); } else { if (this.props.vertical) { slideWidth = (slideHeight / this.props.slidesToShow) * this.props.slideWidth; } else { slideWidth = (frame.offsetWidth / this.props.slidesToShow) * this.props.slideWidth; } } if (!this.props.vertical) { slideWidth -= this.props.cellSpacing * ((100 - (100 / this.props.slidesToShow)) / 100); } frameHeight = slideHeight + ((this.props.cellSpacing / 2) * (this.props.slidesToShow - 1)); frameWidth = this.props.vertical ? frameHeight : frame.offsetWidth; if (this.props.slidesToScroll === 'auto') { slidesToScroll = Math.floor(frameWidth / (slideWidth + this.props.cellSpacing)); } this.setState({ frameWidth: frameWidth, slideCount: React.Children.count(this.props.children), slideWidth: slideWidth, slidesToScroll: slidesToScroll, left: this.props.vertical ? 0 : this.getTargetLeft(), top: this.props.vertical ? this.getTargetLeft() : 0 }, function() { self.setLeft() }); }, setLeft() { this.setState({ left: this.props.vertical ? 0 : this.getTargetLeft(), top: this.props.vertical ? this.getTargetLeft() : 0 }) }, // Data setExternalData() { if (this.props.data) { this.props.data(); } }, // Styles getListStyles() { var listWidth = this.state.slideWidth * React.Children.count(this.props.children); var spacingOffset = this.props.cellSpacing * React.Children.count(this.props.children); return { position: 'relative', display: 'block', top: this.getTweeningValue('top'), left: this.getTweeningValue('left'), margin: this.props.vertical ? (this.props.cellSpacing / 2) * -1 + 'px 0px' : '0px ' + (this.props.cellSpacing / 2) * -1 + 'px', padding: 0, height: this.props.vertical ? listWidth + spacingOffset : 'auto', width: this.props.vertical ? 'auto' : listWidth + spacingOffset, cursor: this.state.dragging === true ? 'pointer' : 'inherit', transform: 'translate3d(0, 0, 0)', WebkitTransform: 'translate3d(0, 0, 0)', boxSizing: 'border-box', MozBoxSizing: 'border-box' } }, getFrameStyles() { return { position: 'relative', display: 'block', overflow: 'hidden', height: this.props.vertical ? this.state.frameWidth || 'initial' : 'auto', margin: this.props.framePadding, padding: 0, transform: 'translate3d(0, 0, 0)', WebkitTransform: 'translate3d(0, 0, 0)', boxSizing: 'border-box', MozBoxSizing: 'border-box' } }, getSlideStyles() { return { display: this.props.vertical ? 'block' : 'inline-block', listStyleType: 'none', verticalAlign: 'top', width: this.props.vertical ? '100%' : this.state.slideWidth, height: 'auto', boxSizing: 'border-box', MozBoxSizing: 'border-box', marginLeft: this.props.vertical ? 'auto' : this.props.cellSpacing / 2, marginRight: this.props.vertical ? 'auto' : this.props.cellSpacing / 2, marginTop: this.props.vertical ? this.props.cellSpacing / 2 : 'auto', marginBottom: this.props.vertical ? this.props.cellSpacing / 2 : 'auto' } }, getSliderStyles() { return { position: 'relative', display: 'block', width: this.props.width, height: 'auto', boxSizing: 'border-box', MozBoxSizing: 'border-box', visibility: this.state.slideWidth ? 'visible' : 'hidden' } }, getStyleTagStyles() { return '.slider-slide > img {width: 100%; display: block;}' }, getDecoratorStyles(position) { switch (position) { case 'TopLeft': { return { position: 'absolute', top: 0, left: 0 } } case 'TopCenter': { return { position: 'absolute', top: 0, left: '50%', transform: 'translateX(-50%)', WebkitTransform: 'translateX(-50%)' } } case 'TopRight': { return { position: 'absolute', top: 0, right: 0 } } case 'CenterLeft': { return { position: 'absolute', top: '50%', left: 0, transform: 'translateY(-50%)', WebkitTransform: 'translateY(-50%)' } } case 'CenterCenter': { return { position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%,-50%)', WebkitTransform: 'translate(-50%, -50%)' } } case 'CenterRight': { return { position: 'absolute', top: '50%', right: 0, transform: 'translateY(-50%)', WebkitTransform: 'translateY(-50%)' } } case 'BottomLeft': { return { position: 'absolute', bottom: 0, left: 0 } } case 'BottomCenter': { return { position: 'absolute', bottom: 0, left: '50%', transform: 'translateX(-50%)', WebkitTransform: 'translateX(-50%)' } } case 'BottomRight': { return { position: 'absolute', bottom: 0, right: 0 } } default: { return { position: 'absolute', top: 0, left: 0 } } } } }); Carousel.ControllerMixin = { getInitialState() { return { carousels: {} } }, setCarouselData(carousel) { var data = this.state.carousels; data[carousel] = this.refs[carousel]; this.setState({ carousels: data }); } } export default Carousel;
src/browser/screens/home.js
nullstyle/wallet-one
import React from 'react'; import { connect } from 'react-redux'; import { AppBar, Tabs, Tab, FloatingActionButton, } from 'material-ui'; import AddIcon from "material-ui/lib/svg-icons/content/add" import palette from 'b:palette'; import { AccountName, AccountMenu, BalancesTab, HistoryTab, Loading, SendForm, } from "b:components"; import {loadAccount, loadAccountSummary} from 'b:actions/index' const style = { backgroundColor: palette.main, }; const addGatewayStyle = { position: 'absolute', backgroundColor: palette.secondaryButton, bottom: 24, left: 24, }; class Home extends React.Component { render() { let {accounts, dispatch, summaries} = this.props; let summary = summaries.byAddress[accounts.current]; if (!summary) { dispatch(loadAccountSummary({address: accounts.current})); return <Loading /> } return <div> <AppBar title={accounts.current} style={style} onLeftIconButtonTouchTap={() => this.handleNavOpen()} /> <Tabs tabItemContainerStyle={style}> <Tab label="Balances"><BalancesTab summary={summary} /></Tab> <Tab label="History"><HistoryTab history={history} /></Tab> </Tabs> {this.props.children} <FloatingActionButton style={addGatewayStyle} backgroundColor={palette.secondaryButton}> <AddIcon /> </FloatingActionButton> <AccountMenu ref={m => this._menu = m} accounts={accounts} onSelect={m => dispatch(loadAccount(m))} /> <SendForm /> </div>; } handleNavOpen() { this._menu.toggle(); } } function select(state) { return state; } export default connect(select)(Home);
src/routes/Counter/components/Counter.js
pptang/ggm
import React from 'react' export const Counter = (props) => ( <div style={{ margin: '0 auto' }} > <h2>Counter: {props.counter}</h2> <button className='btn btn-default' onClick={props.increment}> Increment </button> {' '} <button className='btn btn-default' onClick={props.doubleAsync}> Double (Async) </button> </div> ) Counter.propTypes = { counter : React.PropTypes.number.isRequired, doubleAsync : React.PropTypes.func.isRequired, increment : React.PropTypes.func.isRequired } export default Counter
src/names/selected/toolbarActions/DeleteButton.js
VasilyShelkov/ClientRelationshipManagerUI
import React from 'react'; import IconButton from 'material-ui/IconButton'; import DeleteName from 'material-ui/svg-icons/action/delete'; import { red500 } from 'material-ui/styles/colors'; export default ({ removeNameAction }) => ( <IconButton id="deleteName" touch onClick={removeNameAction}> <DeleteName color={red500} /> </IconButton> );
src/svg-icons/hardware/desktop-windows.js
jacklam718/react-svg-iconx
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let HardwareDesktopWindows = (props) => ( <SvgIcon {...props}> <path d="M21 2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h7v2H8v2h8v-2h-2v-2h7c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H3V4h18v12z"/> </SvgIcon> ); HardwareDesktopWindows = pure(HardwareDesktopWindows); HardwareDesktopWindows.displayName = 'HardwareDesktopWindows'; HardwareDesktopWindows.muiName = 'SvgIcon'; export default HardwareDesktopWindows;
src/containers/DevTools/DevTools.js
dumbNickname/oasp4js-goes-react
import React from 'react'; import { createDevTools } from 'redux-devtools'; import LogMonitor from 'redux-devtools-log-monitor'; import DockMonitor from 'redux-devtools-dock-monitor'; export default createDevTools( <DockMonitor toggleVisibilityKey="ctrl-Q" changePositionKey="ctrl-M"> <LogMonitor /> </DockMonitor> );
rojak-ui-web/src/app/utils/Container.js
pyk/rojak
import React from 'react' import { push } from 'redux-router' import Navbar from './Navbar' import { setKeyword, setScreenExpanded } from '../root/actions' import { connect } from 'react-redux' class Container extends React.Component { static propTypes = { children: React.PropTypes.any, root: React.PropTypes.object.isRequired, router: React.PropTypes.object.isRequired, setScreenExpanded: React.PropTypes.func.isRequired, setKeyword: React.PropTypes.func.isRequired, push: React.PropTypes.func.isRequired } componentDidMount () { const { router, setKeyword } = this.props if (router.params.keyword) { setKeyword(this.props.params.keyword) } } componentWillReceiveProps (nextProps) { const { root, router, setKeyword } = this.props if (root.keyword !== nextProps.root.keyword) { this.checkExpandedState(nextProps.root.keyword) this.updateRoute(nextProps.root.keyword) } if (nextProps.router.params.keyword !== router.params.keyword) { setKeyword(nextProps.router.params.keyword || '') } } checkExpandedState (keyword) { const { setScreenExpanded } = this.props setScreenExpanded(!!keyword.trim()) } updateRoute (keyword) { const { push } = this.props let pathname = `/search/${keyword}` // if keyword is empty, change route to home if (keyword.trim().length === 0) { pathname = '' } push(pathname) } render () { const { root, children } = this.props const expandedClass = root.expanded ? 'expanded' : '' return ( <div id="container" className={`rojakContainer ${expandedClass}`}> <NavbarWrapper expanded={root.expanded} /> {children} </div> ) } } function NavbarWrapper ({ expanded }) { if (expanded) return null return <Navbar /> } export default connect(({ root, router }) => ({ root, router }), { setScreenExpanded, setKeyword, push })(Container)
src/svg-icons/editor/format-bold.js
manchesergit/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let EditorFormatBold = (props) => ( <SvgIcon {...props}> <path d="M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"/> </SvgIcon> ); EditorFormatBold = pure(EditorFormatBold); EditorFormatBold.displayName = 'EditorFormatBold'; EditorFormatBold.muiName = 'SvgIcon'; export default EditorFormatBold;
docs/src/app/components/pages/components/IconButton/ExampleTouch.js
matthewoates/material-ui
import React from 'react'; import IconButton from 'material-ui/IconButton'; import ActionGrade from 'material-ui/svg-icons/action/grade'; const IconButtonExampleTouch = () => ( <div> <IconButton tooltip="bottom-right" touch={true} tooltipPosition="bottom-right"> <ActionGrade /> </IconButton> <IconButton tooltip="bottom-center" touch={true} tooltipPosition="bottom-center"> <ActionGrade /> </IconButton> <IconButton tooltip="bottom-left" touch={true} tooltipPosition="bottom-left"> <ActionGrade /> </IconButton> <IconButton tooltip="top-right" touch={true} tooltipPosition="top-right"> <ActionGrade /> </IconButton> <IconButton tooltip="top-center" touch={true} tooltipPosition="top-center"> <ActionGrade /> </IconButton> <IconButton tooltip="top-left" touch={true} tooltipPosition="top-left"> <ActionGrade /> </IconButton> </div> ); export default IconButtonExampleTouch;
app/javascript/client_messenger/styles/styled.js
michelson/chaskiq
import styled from '@emotion/styled' import { keyframes } from '@emotion/core' import React from 'react' import StyledFrame from '../styledFrame' import { darken } from 'polished' import { textColor } from './utils' import tw from 'twin.macro' export const mainColor = '#0a1a27' // "#42a5f5"; const rotate = keyframes` from { transform: rotate(-45deg); //transform: scale(0.5); translateY(-30); } to { transform: rotate(0deg); //transform: scale(1); transform: translateY(-8px); } ` const appear = keyframes` from { transform: translateY(1000px); opacity: 0; } to { transform: translateY(0); opacity: 1; } ` export const Bounce = keyframes` 0%, 80%, 100% { -webkit-transform: scale(0); transform: scale(0); } 40% { -webkit-transform: scale(1.0); transform: scale(1.0); } ` export const FadeInBottom = keyframes` 0% { -webkit-transform: translateY(50px); transform: translateY(50px); opacity: 0; } 100% { -webkit-transform: translateY(0); transform: translateY(0); opacity: 1; } ` export const FadeInRight = keyframes` 0% { transform: translateX(50px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } ` export const FadeOutBottom = keyframes` 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(50px); opacity: 0; } ` export const FadeOutRight = keyframes` 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(50px); opacity: 0; } ` export const Container = styled.div` animation: ${appear} 0.6s cubic-bezier(0.390, 0.575, 0.565, 1.000) both; ${ (props) => props.isMobile ? `min-height: 250px; box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px; opacity: 1; z-index: 100000; width: 100%; height: 100%; max-height: none; top: 0px; left: 0px; right: 0px; bottom: 0px; position: fixed; overflow: hidden; border-radius: 0px;` : `z-index: 2147483000; position: fixed; bottom: 91px; right: 20px; width: 376px; min-height: 250px; max-height: 704px; box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px; opacity: 1; height: calc(100% - 120px); border-radius: 8px; overflow: hidden;` } ` export const AssigneeStatus = styled.span` font-size: 11px; color: ${(props) => textColor(props.theme.palette.primary)}; ` export const AssigneeStatusWrapper = styled.span` display: flex; flex-flow: column; align-items: start; justify-content: center; margin-left: 10px; p{ margin: 0px 0px 6px 0px; } ` export const ShowMoreWrapper = styled.div` z-index: 10000; position: absolute; width: 315px; display: flex; justify-content: space-between; ${(props) => FadeBottomAnimation(props)} button { padding: 9px; box-shadow: -1px 1px 1px #00000036; border-radius: 11px; background: #a6aeceaa; border: none; color: white; cursor: pointer; } button.close{ } ` export const DisabledElement = styled.div` padding: 1.2em !important; ${() => tw`w-full p-4 flex justify-center text-sm font-light`} ` export const SuperDuper = styled('div')` /* display: block; overflow: scroll; border: 0px; z-index: 10000; position: absolute; width: 100%; margin: 0px auto; height: 415px; bottom: 83px; @media (min-width: 320px) and (max-width: 480px) { display: block; overflow: scroll; border: 0px; z-index: 1000000000; position: absolute; width: 100%; margin: 0px auto; height: 102vh; bottom: -6px; width: calc(100vw + 20px); left: -12px; } */ width: 100%; height: 100%; position: absolute; ` export const Overflow = styled.div` z-index: 9900000; position: fixed; width: 545px; height: 100vh; bottom: 0px; right: 0px; content: ""; pointer-events: none; background: radial-gradient(at right bottom,rgba(29,39,54,0.16) 9%,rgba(0, 0, 0, 0) 72%); ` export const UserAutoMessageStyledFrame = styled(StyledFrame)` display: block; border: 0px; z-index: 1000; width: 350px; position: absolute; ${(props) => { return props.isMinimized ? 'height: 73px;' : 'height: 70vh;' }} ${(props) => { return props.theme.isMessengerActive ? ` bottom: 49px; right: 6px; ` : ` bottom: 0px; right: 0px; ` }} ` export const UserAutoMessageStyledFrameDis = styled(({ isMinimized, ...rest }) => ( <StyledFrame {...rest}/> ))` display: block; border: 0px; z-index: 1000; width: 350px; position: absolute; ${(props) => { return props.isMinimized ? 'height: 73px;' : 'height: 70vh;' }} ${(props) => { return props.theme.isMessengerActive ? ` bottom: 77px; right: 17px; ` : ` bottom: 0px; right: 0px; ` }} /* box-shadow: 1px 1px 100px 2px rgba(0,0,0,0.22); */ ` export const CloseButtonWrapper = styled.div` position: absolute; right: 21px; z-index: 30000; top: 29px; button { border: none; background: transparent; cursor: pointer; } ` export const SuperFragment = styled.div` -webkit-box-pack: start; -ms-flex-pack: start; justify-content: flex-start; overflow: hidden; position: absolute; bottom: 0; left: 0; right: 0; top: 0; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; font-family: "Inter", Helvetica, Arial, sans-serif, "Apple Color Emoji"; .fade-in-bottom { -webkit-animation: ${FadeInBottom} 0.6s cubic-bezier(0.390, 0.575, 0.565, 1.000) both; animation: ${FadeInBottom} 0.6s cubic-bezier(0.390, 0.575, 0.565, 1.000) both; } .fade-in-right { animation: ${FadeInRight} 0.6s cubic-bezier(0.390, 0.575, 0.565, 1.000) both; } .fade-out-bottom { animation: ${FadeOutBottom} 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; } .fade-out-right { animation: ${FadeOutRight} 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; } } ` export const FadeRightAnimation = (props) => { return props.in === 'in' ? `animation: ${FadeInRight.name} 0.6s cubic-bezier(0.390, 0.575, 0.565, 1.000) both; ` : `animation: ${FadeOutRight.name} 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;` } export const FadeBottomAnimation = (props) => { return props.in === 'in' ? `animation: ${FadeInBottom.name} 0.6s cubic-bezier(0.390, 0.575, 0.565, 1.000) both;` : `animation: ${FadeOutBottom.name} 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;` } export const MessageSpinner = styled.div` display: inline-block; padding: 15px 20px; font-size: 14px; color: #ccc; border-radius: 30px; line-height: 1.25em; font-weight: 200; opacity: 0.2; margin: 0; width: 80px; text-align: center; & > div { width: 10px; height: 10px; border-radius: 100%; display: inline-block; -webkit-animation: ${Bounce} 1.4s infinite ease-in-out both; animation: ${Bounce} 1.4s infinite ease-in-out both; background: rgba(0,0,0,1); } .bounce1 { -webkit-animation-delay: -0.32s; animation-delay: -0.32s; } .bounce2 { -webkit-animation-delay: -0.16s; animation-delay: -0.16s; } ` export const UserAutoMessageFlex = styled(({ isMinimized, ...rest }) => ( <div {...rest} /> ))` display: flex; flex-direction: column; ${(props) => { return props.isMinimized ? 'height: 70vh;' : 'height: 92vh;' }} justify-content: space-between; ` export const MessageCloseBtn = styled.a` position: absolute; right: 8px; display: inline-block; padding: 4px; background: #73737394; border-radius: 3px; font-size: 0.8em; -webkit-text-decoration: none; -webkit-text-decoration: none; text-decoration: none; float: right; color: white; text-transform: uppercase; font-weight: 100; ` export const ConversationEventContainer = styled.div` border-radius: 7px; background: gold; display: flex; justify-content: center; margin: 6px 4.2em; padding: .7em; font-size: .8em; //box-shadow: 0 4px 15px 0 rgba(0,0,0,.1), 0 1px 2px 0 rgba(141, 171, 181, 0.63); box-shadow: 0 4px 15px 0 rgba(0,0,0,.1), 0 1px 2px 0 rgba(0,0,0,.1); ${ (props) => { return props.isInline ? 'box-shadow: 0 4px 15px 0 rgba(0, 0, 0, 0.36), 0 1px 2px 0 rgba(0, 0, 0, 0.61)' : '' } } ` export const AppPackageBlockContainer = styled.div` padding-top: 1em; padding-bottom: 1em; border-radius: 7px; //display: flex; //justify-content: center; margin: .7em; //border: 1px solid #e3e7e8; background: #fff; ${(props) => props.isHidden ? 'display:none;' : ''} box-shadow: 0 4px 15px 0 rgba(0,0,0,.1), 0 1px 2px 0 rgba(0,0,0,.1); fieldset{ width:100%; } p { font-size: 0.8em; font-weight: 300; color: gray; line-height: 1.4em; } .form-group{ //margin-bottom: 1rem; } form.form { display: flex; align-items: center; flex-wrap: wrap; .form-group { display: flex; flex-direction: column; &.error{ input { border: 1px solid red; } } .errors { font-size: 0.7em; color: red; margin-left: 4px; } } label { margin: 3px; display: inline-block; margin-bottom: .5rem; } input { margin: 3px; display: block; padding: .375rem .75rem; font-size: 1rem; line-height: 1.5; color: #495057; background-color: #fff; background-clip: padding-box; border: 1px solid #ced4da; border-radius: .25rem; transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out; } button:not(:disabled):not(.disabled) { cursor: pointer; } [type=reset], [type=submit], button, html [type=button] { -webkit-appearance: button; } .elementsContainer{ display:flex; flex-direction: column; } button.tuti { color: #fff; background-color: #007bff; border-color: #007bff; display: inline-block; font-weight: 400; text-align: left; white-space: break-word; vertical-align: middle; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid transparent; padding: .375rem .75rem; font-size: 1rem; line-height: 1.5; border-radius: .25rem; transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; } } ` export const AppPackageBlockButtonItem = styled.div` ${() => tw`flex justify-end mx-4 my-1.5 `} ` export const AppPackageBlockTextItem = styled.div` ${() => tw`text-right mx-4 my-1.5 text-sm text-gray-400 font-light`} a{ ${() => tw`text-sm text-gray-600 font-normal hover:text-gray-900`} } ` export const UserAutoMessage = styled.div` box-shadow: -1px 3px 3px 3px rgba(158,191,208,0.09); border: 1px solid #f3f0f0; height: 100vh; width: 96vw; overflow: scroll; border-radius: 5px; background: #fff; /* -webkit-flex: 1; */ -ms-flex: 1; /* flex: 1; */ /* align-self: end; */ margin-bottom: 10px; ` export const UserAutoMessageBlock = styled.div` height: 16px; width: 96vw; background: transparent; margin-bottom: 10px; ` export const AvatarSection = styled.div` /* stylelint-disable value-no-vendor-prefix */ -ms-grid-row: 1; -ms-grid-column: 1; /* stylelint-enable */ grid-area: avatar-area; margin-right: 8px; ` export const EditorSection = styled.div` /* stylelint-disable value-no-vendor-prefix */ -ms-grid-row: 1; -ms-grid-column: 2; /* stylelint-enable */ grid-area: editor-area; ${(props) => ( props.isInline ? ` height: 69vh; overflow: auto;` : '' )} ` export const InlineConversationWrapper = styled.div` border: 1px solid red; ` export const EditorWrapper = styled.div` width: 376px; position: fixed; right: 14px; bottom: 14px; z-index: 90000000000000000; @media screen and (min-width: 320px) and (max-width: 480px) { width: 100%; right: 0px; bottom: 0px; } .inline-frame { z-index: 10000000; position: absolute; bottom: 89px; width: 335px; right: 20px; border: none; //@media screen and (min-width: 1024px) and (max-width: 1280px) { //max-height: 73vh !important; min-height: 174px; //} //@media screen and (min-width: 781px) and (max-width: 1024px) { // height: 50vw !important; //} //@media screen and (min-width: 320px) and (max-width: 780px) { // height: 100vw !important; //} } ` export const EditorActions = styled.div` box-sizing: border-box; -webkit-box-pack: end; justify-content: flex-end; -webkit-box-align: center; align-items: center; display: flex; padding: 12px 1px; ` export const CommentsWrapper = styled.div` ${(props) => ( props.isInline ? 'padding-bottom: 0px;' : 'padding-bottom: 105px;' )} flex-grow: 1; flex-shrink: 0; justify-content: space-between; overflow-anchor: none; height: auto; font-family: "Inter", Helvetica, arial, sans-serif; ${(props) => (props.isReverse ? ` flex-direction : column-reverse;` : ` flex-direction: column; ` )} display: flex; ` export const CommentsItem = styled.div` padding: 12px; /* background-color: #ccc; */ border-bottom: 1px solid #ececec; cursor: pointer; &:hover{ background: aliceblue; border-bottom: 1px solid #ececec; } transition: all 0.4s ease-out; ${(props) => props.displayOpacity ? 'opacity: 1;' : 'opacity: 0;' } ` export const Prime = styled.div` position: relative; display: block; width: 54px; height: 54px; border-radius: 50%; text-align: center; margin: 0 0; box-shadow: 0 0 4px rgba(0,0,0,.14), 0 4px 8px rgba(0,0,0,.28); cursor: pointer; transition: all .1s ease-out; position: relative; z-index: 998; //overflow: hidden; color: ${(props) => textColor(props.theme.palette.secondary)}; background: ${(props) => props.theme.palette.secondary}; float: right; //margin: 14px 27px; margin: 16px 8px; animation: ${rotate} 0.3s cubic-bezier(0.390, 0.575, 0.565, 1.000) both; ` export const FooterAckInline = styled.div` width: 100%; padding-top: 4em; text-align: center; display:flex; justify-content: center; a { display: flex; align-items: center; font-size: 0.8em; color: #727272; text-decoration: none; padding: 5px 11px 5px 11px; &:hover { color: #727272; background-color: #f7f7f7; border-radius: 20px; } img { width: 16px; height: 16px; margin-right: 9px; } } ` export const FooterAck = styled(FooterAckInline)` position: absolute; width: 100%; bottom: 0px; z-index: 1000; padding: 3px 0px 4px 0px; box-shadow: 0px -2px 18px #38383840; background: white; ` export const CountBadge = styled.div` ${() => tw`h-6 w-6 rounded-full text-white text-center p-1 absolute bg-red-600 text-xs`} ${(props) => props.section === 'home' ? `top: 42px; left: 15px;` : '' } top: 0px; left: -8px; ${(props) => props.section === 'conversation' ? 'top: 13px;left: 7px;' : ''} ${(props) => props.section === 'conversations' ? 'top: 13px;left: 7px;' : ''} } ` export const Header = styled(({ isMobile, ...rest }) => (<div {...rest}></div>))` height: 75px; position: relative; min-height: 75px; background: ${(props) => props.theme.palette.primary}; background: linear-gradient(135deg, ${(props) => props.theme.palette.primary} 0%,${(props) => darken(0.2, props.theme.palette.primary)} 100%); color: ${(props) => textColor(props.theme.palette.primary)}; -webkit-transition: height 160ms ease-out; transition: height 160ms ease-out; &:before{ content: ""; top: 0px; left: 0px; bottom: 0px; right: 0px; position: absolute; ${(props) => { return props.theme.palette.pattern ? ` opacity: 0.38; background-image: url(${props.theme.palette.pattern}); ` : '' }} background-size: 610px 610px, cover; pointer-events: none; } ` export const Body = styled.div` position: relative; -webkit-box-flex: 1; -ms-flex: 1; flex: 1; background-color: #fff; -webkit-box-shadow: inset 0 21px 4px -20px rgba(0,0,0,.2); box-shadow: inset 0 21px 4px -20px rgba(0,0,0,.2); ` export const Footer = styled.div` z-index: 100000; text-align: center; position: absolute; bottom: 0; left: 0; right: 0; border-radius: 0 0 6px 6px; height: 90px; /*pointer-events: none;*/ background: -webkit-gradient(linear,left bottom,left top,from(#fff),to(rgba(255,255,255,0))); background: linear-gradient(0deg,#fff,rgba(255,255,255,0)); height: 38px; margin: 25px 0 0px 0px; font-size: .8em; color: gray; padding: 11px 0px 0px 0px; &.inline{ ${(props) => !props.isInputEnabled ? 'height: 0px;' : ''} background: transparent; bottom: 9px; textarea { border-radius: 8px !important; box-shadow: 4px 4px 1px #00000061; bottom: -2px; left: 8px; width: 96%; } input[type="file"]{ display: none; } } ` export const ConversationsFooter = styled.div` z-index: 100000; text-align: center; position: absolute; bottom: 0; left: 0; right: 0; border-radius: 0 0 6px 6px; height: 90px; pointer-events: none; background: -webkit-gradient(linear,left bottom,left top,from(#fff),to(rgba(255,255,255,0))); background: linear-gradient(0deg,#fff,rgba(255,255,255,0)); } ` export const UserAutoChatAvatar = styled.div` display:flex; align-items: center; span{ font-size: 0.8rem; margin-left: 10px; color: #b1b1b1; } img { width: 40px; height: 40px; background: white; text-align: center; border-radius: 50%; } ` export const ReadIndicator = styled.div` position: absolute; width: 10px; height: 10px; background-color: red; left: 3px; top: 20px; border-radius: 50%; ` export const MessageItem = styled.div` position: relative; //max-width: ${(props) => (props.messageSourceType === 'UserAutoMessage' ? '86%' : '60%')}; min-width: 25%; display: block; word-wrap: break-word; -webkit-animation: zoomIn .5s cubic-bezier(.42, 0, .58, 1); animation: zoomIn .5s cubic-bezier(.42, 0, .58, 1); clear: both; z-index: 999; margin: .7em 0; font-size: 15px; &.admin { align-self: flex-start; display: flex; flex-direction: row; .message-content-wrapper { background: #fff; padding: 16px; margin: 8px 13px 0px 5px; border-radius: 6px; min-width: 80px; line-height: 1.5; position: relative; border-radius: 5px 5px 5px 0px; box-shadow: 0 4px 15px 0 rgba(0,0,0,.1), 0 1px 2px 0 rgba(0,0,0,.1); ${ (props) => { return props.isInline ? 'box-shadow: 0 4px 15px 0 rgba(0, 0, 0, 0.36), 0 1px 2px 0 rgba(0, 0, 0, 0.61)' : '' } } } .text{ p{ color: #000; } } } &.user { .message-content-wrapper { background: linear-gradient(135deg, ${(props) => props.theme.palette.primary} 0%,${(props) => darken(0.2, props.theme.palette.primary)} 100%); color: ${(props) => textColor(props.theme.palette.primary)}; min-width: 80px; padding: 16px; margin: 5px; margin-right: 10px; border-radius: 6px; min-width: 80px; box-shadow: 0 4px 15px 0 rgba(0,0,0,.1), 0 1px 2px 0 rgba(0,0,0,.1); ${ (props) => { return props.isInline ? 'box-shadow: 0 4px 15px 0 rgba(0, 0, 0, 0.36), 0 1px 2px 0 rgba(0, 0, 0, 0.61)' : '' } } line-height: 1.5; height: 100%; position: relative; border-radius: 5px 5px 0px 5px; } // hack on image from user, not use position absolute .graf-image { position: inherit !important; } ${(props) => (props.messageSourceType === 'UserAutoMessage' ? ` align-self: center; border: 1px solid #f1f0f0; ` : ` align-self: flex-end; //background: ${mainColor}; //margin-right: 20px; //float: right; display: flex; flex-direction: row-reverse; `)} a{ color: white; } color: #eceff1; .text{ p{ color: #fff; } } } .text{ margin-bottom: 1em; color: #eceff1; p{ font-size: 0.86rem; margin: 0px; padding: 0px; } } .status { display: flex; justify-content: flex-end; color: #b1afaf; font-size: 10px; text-align: right; } ` export const HeaderOption = styled.div` //float: left; font-size: 15px; list-style: none; position: relative; height: 100%; width: 100%; text-align: relative; margin-right: 10px; letter-spacing: 0.5px; font-weight: 400; display: flex; align-items: center; ${(props) => FadeRightAnimation(props)} ` export const HeaderTitle = styled.span` ${() => tw`space-y-2`} .title{ //font-size: 2em; //font-weight: bold; //margin: 0em 0.2em; ${() => tw`text-3xl antialiased font-bold`} } p.tagline{ //margin: 0.6em 0.3em; //line-height: 1.6em; ${() => tw`text-sm antialiased font-light mb-3`} } /*${(props) => FadeRightAnimation(props)}*/ ` export const HeaderAvatar = styled.div` display: flex; align-items: center; flex: 0 0 auto; align-self: center; //margin-left: 15px; color: ${(props) => textColor(props.theme.palette.primary)}; img { width: 40px; height: 40px; text-align: center; border-radius: 50%; } div{ display: flex; flex-flow: column; margin-left: .6em; p { padding: 0px; margin: 0px; } } ` export const ChatAvatar = styled.div` //left: -52px; //background: rgba(0, 0, 0, 0.03); //position: absolute; //top: 0; align-self: flex-end; img { width: 40px; height: 40px; background: white; text-align: center; border-radius: 50%; } ` export const AnchorButton = styled.a` text-decoration: none; background-color: ${(props) => props.theme.palette.secondary}; box-shadow: 0 4px 12px rgba(0,0,0,.1); height: 40px; color: ${(props) => textColor(props.theme.palette.secondary)} !important; font-size: 13px; line-height: 14px; pointer-events: auto; cursor: pointer; border-radius: 40px; display: inline-flex; align-items: center; padding: 0 24px; display: inline-flex; align-items: center; ` export const NewConvoBtnContainer = styled.div` position: absolute; bottom: 77px; width: 100%; padding: 0 37px; display:flex; justify-content: center; ` // ${(props) => FadeBottomAnimation(props)} export const NewConvoBtn = styled(AnchorButton)` ` export const ConversationSummary = styled.div` display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; align-content: stretch; position: relative; padding: 6px; ` export const ConversationSummaryAvatar = styled.div` flex: 0 0 auto; align-self: flex-end; margin-left: 15px; img { width: 40px; height: 40px; background: white; text-align: center; border-radius: 50%; } ` export const ConversationSummaryBody = styled.div` flex: 1; padding-left: 16px; ` export const ConversationSummaryBodyMeta = styled.div` display: flex; justify-content: space-between; margin-bottom: 8px; ` export const ConversationSummaryBodyItems = styled.div` display: flex; font-size: 12px; .you{ margin-right:5px; } ` export const ConversationSummaryBodyContent = styled.div` color: #969696; -webkit-box-flex: 1; -ms-flex: 1; flex: 1; //padding-left: 16px; font-weight: 300; p { margin: 0px; } ` export const Autor = styled.div` font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8b8b8b; ` export const Hint = styled.p` /* padding: 29px; color: rgb(136, 136, 136); background: #f9f9f9; margin: 0px; height: 100%;*/ ${() => tw`text-sm leading-5 text-gray-500 h-full p-8 bg-gray-100`} ` export const SpinnerAnim = keyframes` to {transform: rotate(360deg);} ` export const Spinner = styled.div` &:before { content: ''; box-sizing: border-box; //position: absolute; //top: 50%; //left: 50%; width: 20px; height: 20px; //margin-top: -10px; //margin-left: -10px; border-radius: 50%; border: 2px solid #ccc; border-top-color: #000; animation: ${SpinnerAnim} .6s linear infinite; display:inline-block; } `
src/components/Post.js
nickeblewis/walkapp
/** * Single Post item */ import React from 'react' import { graphql } from 'react-apollo' import gql from 'graphql-tag' import { Grid, Thumbnail, Col, Row, Button, Jumbotron } from 'react-bootstrap' class Post extends React.Component { static propTypes = { post: React.PropTypes.object, mutate: React.PropTypes.func, refresh: React.PropTypes.func, } render () { return ( <Col xs={6} md={4}> <Thumbnail src={this.props.post.imageUrl} alt="242x200"> <h3>Thumbnail label</h3> <p>{this.props.post.description}</p> <p> <Button bsStyle="primary">Button</Button>&nbsp; <Button bsStyle="default">Button</Button> <span className='red f6 pointer dim' onClick={this.handleDelete}>Delete</span> </p> </Thumbnail> </Col> ) } handleDelete = () => { this.props.mutate({variables: {id: this.props.post.id}}) .then(this.props.refresh) } } const deleteMutation = gql` mutation deletePost($id: ID!) { deletePost(id: $id) { id } } ` const PostWithMutation = graphql(deleteMutation)(Post) export default PostWithMutation
src/routes/login/index.js
kuao775/mandragora
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright ยฉ 2014-present Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import React from 'react'; import Layout from '../../components/Layout'; import Login from './Login'; const title = 'Log In'; function action() { return { chunks: ['login'], title, component: ( <Layout> <Login title={title} /> </Layout> ), }; } export default action;
src/search/facet-box/facet-data.js
asimsir/focus-components
import React from 'react'; import builder from 'focus-core/component/builder'; import {ArgumentInvalidException} from 'focus-core/exception'; import numberFormatter from 'focus-core/definition/formatter/number'; const FacetData = { getDefaultProps() { return ({ type: 'text' }); }, /** * Display name. */ displayName: 'FacetData', /** * Render the component. * @returns {XML} Html code of the component. */ render() { return( <div data-focus='facet-data' onClick={this._selectFacetData}> {this._renderData()} </div> ); }, /** * Render the data. * @returns {string} Html generated code. */ _renderData() { if(this.props.type == 'text') { return `${this.props.data.label} (${numberFormatter.format(this.props.data.count)})`; } throw new ArgumentInvalidException('Unknown property type : ' + this.props.type); }, /** * Facet selection action handler. * @returns {function} the facet selection handler. */ _selectFacetData() { return this.props.selectHandler(this.props.dataKey, this.props.data); } }; module.exports = builder(FacetData);
examples/todos-with-undo/index.js
camsong/redux
import React from 'react' import { render } from 'react-dom' import { createStore } from 'redux' import { Provider } from 'react-redux' import App from './containers/App' import todoApp from './reducers' const store = createStore(todoApp) const rootElement = document.getElementById('root') render( <Provider store={store}> <App /> </Provider>, rootElement )
src/svg-icons/image/transform.js
ichiohta/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageTransform = (props) => ( <SvgIcon {...props}> <path d="M22 18v-2H8V4h2L7 1 4 4h2v2H2v2h4v8c0 1.1.9 2 2 2h8v2h-2l3 3 3-3h-2v-2h4zM10 8h6v6h2V8c0-1.1-.9-2-2-2h-6v2z"/> </SvgIcon> ); ImageTransform = pure(ImageTransform); ImageTransform.displayName = 'ImageTransform'; ImageTransform.muiName = 'SvgIcon'; export default ImageTransform;
components/Deck/ContentModulesPanel/ContentQuestionsPanel/ExamAnswersItem.js
slidewiki/slidewiki-platform
import React from 'react'; import PropTypes from 'prop-types'; import selectExamAnswer from '../../../../actions/questions/selectExamAnswer'; import { defineMessages } from 'react-intl'; class ExamAnswersItem extends React.Component { handleOnChange() { if (!this.props.showCorrectAnswers) { this.context.executeAction(selectExamAnswer, { questionIndex: this.props.originalQIndex, answerIndex: this.props.index, selected: this.refs[this.props.name].checked }); } } render() { const form_messages = defineMessages({ answer_correct: { id: 'ExamAnswersItem.form.answer_correct', defaultMessage: 'your answer was correct', }, answer_not_selected: { id: 'ExamAnswersItem.form.answer_not_selected', defaultMessage: 'the correct answer which you did not select', }, answer_incorrect: { id: 'ExamAnswersItem.form.answer_incorrect', defaultMessage: 'your answer was incorrect', } }); const answer = this.props.answer; const name = this.props.name; const showCorrectAnswers = this.props.showCorrectAnswers; if (answer.selectedAnswer === undefined) { answer.selectedAnswer = false; } let answerIcon = (<i className="icon" />); if (showCorrectAnswers) { if (answer.correct && answer.selectedAnswer) { answerIcon = (<i className="checkmark icon teal" aria-label={this.context.intl.formatMessage(form_messages.answer_correct)} />); } else if (answer.correct && !answer.selectedAnswer) { answerIcon = (<i className="checkmark icon red" aria-label={this.context.intl.formatMessage(form_messages.answer_not_selected)} />); } else if (!answer.correct && answer.selectedAnswer) { answerIcon = (<i className="delete icon red" aria-label={this.context.intl.formatMessage(form_messages.answer_incorrect)} />); } } let inputCheckbox = (showCorrectAnswers) ? (<input type="checkbox" ref={name} name={name} id={name} checked={answer.selectedAnswer} />) : (<input type="checkbox" ref={name} name={name} id={name} onChange={this.handleOnChange.bind(this)} />); return ( <div className="field"> <div className="ui checkbox"> {inputCheckbox} <label htmlFor={name}> {answerIcon} {answer.answer} </label> </div> </div> ); } } ExamAnswersItem.contextTypes = { executeAction: PropTypes.func.isRequired, intl: PropTypes.object.isRequired }; export default ExamAnswersItem;
src/components/organisms/Footer/_stories.js
ygoto3/artwork-manager
import React from 'react'; import { Footer } from './index'; module.exports = stories => ( stories .chapter('Footer') .addWithInfo( 'normal', 'Application\'s footer', () => ( <Footer /> ) ) );
client/src/components/GalleryItem/draggable.js
open-sausages/silverstripe-assets-gallery
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { DragSource } from 'react-dnd'; import { getEmptyImage } from 'react-dnd-html5-backend'; export default function draggable(type) { const spec = { canDrag(props) { return props.canDrag; }, beginDrag(props) { const { id } = props.item; if (typeof props.onDrag === 'function') { props.onDrag(true, id); } const selected = props.selectedFiles.concat([]); if (!selected.includes(id)) { selected.push(id); } return { selected, props }; }, endDrag(props) { const { id } = props.item; if (typeof props.onDrag === 'function') { props.onDrag(false, id); } }, }; const collect = (connect, monitor) => ({ connectDragPreview: connect.dragPreview(), connectDragSource: connect.dragSource(), isDragging: monitor.isDragging(), }); // eslint-disable-next-line new-cap const dragItem = DragSource(type, spec, collect); return (Item) => { class DraggableItem extends Component { componentDidMount() { // Use empty image as a drag preview so browsers don't draw it // and we can draw whatever we want on the custom drag layer instead. this.props.connectDragPreview(getEmptyImage(), { // IE fallback: specify that we'd rather screenshot the node // when it already knows it's being dragged so we can hide it with CSS. captureDraggingState: true, }); } render() { const { connectDragSource } = this.props; const item = <Item {...this.props} />; if (typeof item.type === 'string') { return connectDragSource(item); } return connectDragSource(<div className="gallery-item__draggable">{ item }</div>); } } DraggableItem.propTypes = { connectDragSource: PropTypes.func.isRequired, connectDragPreview: PropTypes.func.isRequired, item: PropTypes.shape({ id: PropTypes.number.isRequired, }).isRequired, onDrag: PropTypes.func, selectedFiles: PropTypes.arrayOf(PropTypes.number), }; return dragItem(DraggableItem); }; }
Practicas/TicTac2/componentes/Game.js
tonkyfiero/React_Ejercicios
/* *Importacion de Modulos */ import React from 'react'; import Tablero from './Tablero.js'; export default class Game extends React.Component{ constructor(props){ super(props); this.state={ arreglo:Array(9).fill(null), siguienteLugar:0, isXNext:true } } handleClick(i){ alert(i); /*Matriz de matrices*/ //let historia=this.state.historia.slice(0,this.state.siguienteLugar+1); let arr=this.state.arreglo; //let current =historia[historia.length-1]; //let squares=current.squared.slice(); arr[i]=this.state.isXNext?'X':'O'; if (arr[i]) { return; } this.setState({ arreglo:arr, isXNext: ! this.state.isXNext }); } render(){ //const currentSquare=this.state.historia[this.state.siguienteLugar]; return( <div> <Tablero square={this.state.arreglo} onMouse={(i)=>this.handleClick(i)} /> </div> ) } } function calcularGanador(square) { let decision=[ [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [2,4,6] ]; for (let i = 0; i <decision.length; i++){ const[a,b,c]=decision[i]; if (square[a] && square[a]===square[b] && square[a] ===square[c]) { return square[a]; } } return null; }
src/components/charts/charts/lib/tooltip.js
noahehall/udacity-corporate-dashboard
import React from 'react'; import * as d3 from 'd3'; export class ToolTip extends React.Component { constructor (props) { super(props); } componentDidMount () { // single tooltip used for all charts const appToolTip = d3 .select('body') .append('section') .style('background', 'black') .style('border', '2px red dashed') .style('borderRadius', '4px') .style('opacity', 0) .style('padding', '10px') .style('position', 'absolute'); // this needs to be inside somed3Component.on() mouseover & click const appToolTipTransition = d3 .transition() .duration(250) .delay(100) .ease(d3.easePolyIn); try{ appToolTip .transition(appToolTipTransition) .style('opacity', 1) .style('color', 'white') .style('left', `${d3.event.pageX}px`) .style('top', `${d3.event.pageY}px`); } catch (err) { // do nothing on err when too many interrupts of transitions } appToolTip .html(d); // this needs to be inside somed3Component.on() mouseout try { // eslintignore if too many transitions, will throw err, read https://github.com/d3/d3-transition#the-life-of-a-transition appToolTip .transition(appToolTipTransition) .style('opacity', 0); } catch (err) { appFuncs.console('dir')(err); } } } /* // single tooltip used for all charts const appToolTip = d3.select(`#${this.props.id}-tooltip`); // consoles the data associated with the specific bar barChart.on('click', (d) => appFuncs.console('dir')(d)); // changes fill color on mouseover barChart.on('mouseover', function (d) { // eslint-disable-line const barColor = this.style.fill; // eslint-disable-line const thisItem = d3.select(this) .style('opacity', 0.7) .style('fill', 'green'); // transition on const appToolTipTransitionOn = d3 .transition() .duration(250) .delay(100) .ease(d3.easePolyIn); // transition off const appToolTipTransitionOff = d3 .transition() .duration(100) .delay(100) .ease(d3.easePolyIn); try{ appToolTip .transition(appToolTipTransitionOn) .style('opacity', 1) .style('color', 'white') .style('left', `${d3.event.pageX}px`) .style('top', `${d3.event.pageY}px`); } catch (err) { appFuncs.console('dir')(err); } appToolTip .html(d); thisItem.on('mouseout', function () { // eslint-disable-line thisItem .style('opacity', 1) .style('fill', barColor); try { // eslintignore if too many transitions, will throw err, read https://github.com/d3/d3-transition#the-life-of-a-transition d3.interrupt(appToolTip, appToolTipTransitionOn); if (appToolTip.style('opacity')) appToolTip .transition(appToolTipTransitionOff) .style('opacity', 0); } catch (err) { appFuncs.console('dir')(err); } }); }); */
monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js
guardicore/monkey
import React from 'react'; import {Button, Card} from 'react-bootstrap'; import {cloneDeep} from 'lodash'; import {getDefaultPaneParams, InfoPane, WarningType} from './InfoPane'; import {MasterCheckbox, MasterCheckboxState} from './MasterCheckbox'; import ChildCheckboxContainer from './ChildCheckbox'; import {getFullDefinitionByKey} from './JsonSchemaHelpers'; function AdvancedMultiSelectHeader(props) { const { title, onCheckboxClick, checkboxState, hideReset, onResetClick } = props; return ( <Card.Header className="d-flex justify-content-between"> <MasterCheckbox title={title} onClick={onCheckboxClick} checkboxState={checkboxState}/> <Button className={'reset-safe-defaults'} type={'reset'} variant={'warning'} hidden={hideReset} onClick={onResetClick}> Reset to safe defaults </Button> </Card.Header> ); } class AdvancedMultiSelect extends React.Component { constructor(props) { super(props); this.defaultValues = props.schema.default; this.infoPaneRefString = props.schema.items.$ref; this.registry = props.registry; this.enumOptions = props.options.enumOptions.sort(this.compareOptions); this.state = { masterCheckboxState: this.getMasterCheckboxState(props.value), hideReset: this.getHideResetState(props.value), infoPaneParams: getDefaultPaneParams( this.infoPaneRefString, this.registry, this.isUnsafeOptionSelected(props.value) ) }; } // Sort options alphabetically. "Unsafe" options float to the top so that they // do not get selected and hidden at the bottom of the list. compareOptions = (a, b) => { // Apparently, you can use additive operators with boolean types. Ultimately, // the ToNumber() abstraction operation is called to convert the booleans to // numbers: https://tc39.es/ecma262/#sec-tonumeric if (this.isSafe(a.value) - this.isSafe(b.value) !== 0) { return this.isSafe(a.value) - this.isSafe(b.value); } return a.value.localeCompare(b.value); } onMasterCheckboxClick = () => { if (this.state.masterCheckboxState === MasterCheckboxState.ALL) { var newValues = []; } else { newValues = this.enumOptions.map(({value}) => value); } this.props.onChange(newValues); this.setMasterCheckboxState(newValues); this.setHideResetState(newValues); this.setPaneInfoToDefault(this.isUnsafeOptionSelected(newValues)); } onChildCheckboxClick = (value) => { let selectValues = this.getSelectValuesAfterClick(value); this.props.onChange(selectValues); this.setMasterCheckboxState(selectValues); this.setHideResetState(selectValues); } getSelectValuesAfterClick(clickedValue) { const valueArray = cloneDeep(this.props.value); if (valueArray.includes(clickedValue)) { return valueArray.filter(e => e !== clickedValue); } else { valueArray.push(clickedValue); return valueArray; } } setMasterCheckboxState(selectValues) { let newState = this.getMasterCheckboxState(selectValues); if (newState != this.state.masterCheckboxState) { this.setState({masterCheckboxState: newState}); } } getMasterCheckboxState(selectValues) { if (selectValues.length === 0) { return MasterCheckboxState.NONE; } if (selectValues.length !== this.enumOptions.length) { return MasterCheckboxState.MIXED; } return MasterCheckboxState.ALL; } onResetClick = () => { this.props.onChange(this.defaultValues); this.setHideResetState(this.defaultValues); this.setMasterCheckboxState(this.defaultValues); this.setPaneInfoToDefault(this.isUnsafeOptionSelected(this.defaultValues)); } setHideResetState(selectValues) { this.setState(() => ({ hideReset: this.getHideResetState(selectValues) })); } getHideResetState(selectValues) { return !(this.isUnsafeOptionSelected(selectValues)) } isUnsafeOptionSelected(selectValues) { return !(selectValues.every((value) => this.isSafe(value))); } isSafe = (itemKey) => { return getFullDefinitionByKey(this.infoPaneRefString, this.registry, itemKey).safe; } setPaneInfo = (itemKey) => { let definitionObj = getFullDefinitionByKey(this.infoPaneRefString, this.registry, itemKey); this.setState( { infoPaneParams: { title: definitionObj.title, content: definitionObj.info, link: definitionObj.link, warningType: this.isSafe(itemKey) ? WarningType.NONE : WarningType.SINGLE } } ); } setPaneInfoToDefault(isUnsafeOptionSelected) { this.setState(() => ({ infoPaneParams: getDefaultPaneParams( this.props.schema.items.$ref, this.props.registry, isUnsafeOptionSelected ) })); } render() { const { autofocus, id, multiple, required, schema, value } = this.props; return ( <div className={'advanced-multi-select'}> <AdvancedMultiSelectHeader title={schema.title} onCheckboxClick={this.onMasterCheckboxClick} checkboxState={this.state.masterCheckboxState} hideReset={this.state.hideReset} onResetClick={this.onResetClick}/> <ChildCheckboxContainer id={id} multiple={multiple} required={required} autoFocus={autofocus} isSafe={this.isSafe} onPaneClick={this.setPaneInfo} onCheckboxClick={this.onChildCheckboxClick} selectedValues={value} enumOptions={this.enumOptions}/> <InfoPane title={this.state.infoPaneParams.title} body={this.state.infoPaneParams.content} link={this.state.infoPaneParams.link} warningType={this.state.infoPaneParams.warningType}/> </div> ); } componentDidUpdate(_prevProps) { this.setMasterCheckboxState(this.props.value); } } export default AdvancedMultiSelect;
src/search/SearchBar.js
carab/Pinarium
import React from 'react'; import {observer} from 'mobx-react-lite'; import {Fade} from '@material-ui/core'; import SearchForm from './SearchForm'; import uiStore from '../stores/ui'; function SearchBar() { const {open} = uiStore.searchBar; return ( <Fade in={open} mountOnEnter unmountOnExit> <SearchForm /> </Fade> ); } export default observer(SearchBar);
src/components/rutas/routeDirection.js
ebenezer-unitec/ReactNativeSBO
import React from 'react'; import { Text, View, TouchableOpacity, Dimensions, Image } from 'react-native'; import styles from '../../themes/styles'; import mystyles from './styles'; import{ Container, Header, Title, Button } from 'native-base'; import { Actions } from 'react-native-router-flux'; import { Row, Grid } from "react-native-easy-grid"; const deviceWidth = Dimensions.get('window').width; class RouteDirection extends React.Component { constructor(props){ super(props) } HandleButton(id, direction, name){ this.props.navigator.push({ name: 'routePlate', passProps:{ rutaId: id, routeDirection: direction, routeName:name, } }); } render(){ return ( <Container> <Header style={styles.navBar}> <Button transparent onPress={() => this.props.reset(this.props.navigation.key)}> <Text style={{fontWeight:'800', color:'#FFF'}}>{'Salir'}</Text> </Button> <Title style={styles.navBarTitle}>{'Direcciรณn'}</Title> </Header> <View style={[{alignItems:'center'},mystyles.container]}> <Grid> <Row style={mystyles.rowBuses}> <TouchableOpacity style={{width: deviceWidth}} onPress={this.HandleButton.bind(this, this.props.rutaId, "entrada",this.props.routeName )}> <Image source={require('../../imgs/bus_entrance.png')} style={mystyles.myBusEntrance}></Image> <Text style={mystyles.text}> Entrada </Text> </TouchableOpacity> </Row> <Row style={mystyles.rowBuses}> <TouchableOpacity style={{width: deviceWidth}} onPress={this.HandleButton.bind(this, this.props.rutaId, "salida", this.props.routeName)}> <Image source={require('../../imgs/bus_exit2.png')} style={mystyles.myBusEntrance}></Image> <Text style={mystyles.text}> Salida </Text> </TouchableOpacity> </Row> </Grid> </View> </Container> ); } } export default RouteDirection;
app/App.js
gammapy/web-experiments
import React, { Component } from 'react'; import { Col } from 'react-bootstrap'; import Navbar from './components/Navbar'; import LeftPane from './components/LeftPane'; import Content from './components/Content'; import Footer from './components/Footer'; import ImageView from './components/ImageView'; import gll from '../data/data.json!json'; function getParameterByName(name, url) { if (!url) url = window.location.href; url = url.toLowerCase(); // This is just to avoid case sensitiveness name = name.replace(/[\[\]]/g, "\\$&").toLowerCase();// This is just to avoid case sensitiveness for query parameter name var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); } function updateQueryStringParameter(uri, key, value) { var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); var separator = uri.indexOf('?') !== -1 ? "&" : "?"; if (uri.match(re)) { return uri.replace(re, '$1' + key + "=" + value + '$2'); } else { return uri + separator + key + "=" + value; } } export default class App extends Component { constructor() { super(); const cat = getParameterByName('cat'); const source = getParameterByName('source'); this.state = { route: window.location.hash.substr(1) || null, catalog: cat, sourceName: source ? { value: source } : null, }; // Need to manually bind `this` in ES6 class methods this.sourceNameChange = this.sourceNameChange.bind(this); this.router = this.router.bind(this); this.setRoute = this.setRoute.bind(this); this.data = JSON.parse(gll); // If more catalogs, we can have a dynamic array this.catalog = '2fhl'; } setRoute(route) { this.setState({ route, }); } /** * Changes sourceName state whenever called */ sourceNameChange(e) { const cat = e.label.slice(0, e.label.indexOf(' ')); console.log(cat); const source = e.value; let newURI = updateQueryStringParameter(window.location.href, 'cat', cat); newURI = updateQueryStringParameter(newURI, 'source', source); window.history.pushState({ path: newURI }, '', newURI); this.setState({ sourceName: e, }); } // This is the router which decides on how to // route the application logic depending on the URL. router() { switch (this.state.route) { case 'image': return <ImageView />; default: return ( <div style={{ marginTop: '80px' }}> <Col md={2} className="sidebar"> <LeftPane catalog={this.catalog} data={this.data} sourceName={this.state.sourceName} sourceNameChange={this.sourceNameChange} /> </Col> <Col md={8} mdOffset={3}> <Content sourceName={this.state.sourceName} data={this.data}/> </Col> </div> ); } } render() { return ( <div className="app"> <Navbar setRoute={this.setRoute}/> {this.router()} <Footer/> </div> ); } }
lib/components/tab.js
bekher/hyperterm
import React from 'react'; import Component from '../component'; export default class Tab extends Component { constructor () { super(); this.hover = this.hover.bind(this); this.blur = this.blur.bind(this); this.handleClick = this.handleClick.bind(this); this.state = { hovered: false }; } hover () { this.setState({ hovered: true }); } blur () { this.setState({ hovered: false }); } handleClick (event) { const isLeftClick = event.nativeEvent.which === 1; const isMiddleClick = event.nativeEvent.which === 2; if (isLeftClick) { this.props.isActive ? null : this.props.onSelect(); } else if (isMiddleClick) { this.props.onClose(); } } template (css) { const { isActive, isFirst, isLast, borderColor, hasActivity } = this.props; const { hovered } = this.state; return <li onMouseEnter={ this.hover } onMouseLeave={ this.blur } onClick={ this.props.onClick } style={{ borderColor }} className={ css( 'tab', isFirst && 'first', isActive && 'active', hasActivity && 'hasActivity' ) }> { this.props.customChildrenBefore } <span className={ css( 'text', isLast && 'textLast', isActive && 'textActive' ) } onClick={ this.handleClick }> <span className={ css('textInner') }> { this.props.text } </span> </span> <i className={ css( 'icon', hovered && 'iconHovered' ) } onClick={ this.props.onClose }> <svg className={ css('shape') }> <use xlinkHref='./dist/assets/icons.svg#close'></use> </svg> </i> { this.props.customChildren } </li>; } styles () { return { tab: { color: '#ccc', listStyleType: 'none', flexGrow: 1, position: 'relative', ':hover': { color: '#ccc' } }, first: { marginLeft: process.platform === 'darwin' ? 76 : 0 }, active: { color: '#fff', ':before': { position: 'absolute', content: '" "', borderBottom: '1px solid #000', display: 'block', left: '0px', right: '0px', bottom: '-1px' }, ':hover': { color: '#fff' } }, hasActivity: { color: '#50E3C2', ':hover': { color: '#50E3C2' } }, text: { transition: 'color .2s ease', height: '34px', display: 'block', width: '100%', position: 'relative', borderLeft: '1px solid transparent', borderRight: '1px solid transparent', overflow: 'hidden' }, textInner: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, textAlign: 'center' }, textLast: { borderRightWidth: 0 }, textActive: { borderColor: 'inherit' }, icon: { transition: `opacity .2s ease, color .2s ease, transform .25s ease, background-color .1s ease`, pointerEvents: 'none', position: 'absolute', right: '7px', top: '10px', display: 'inline-block', width: '14px', height: '14px', borderRadius: '100%', color: '#e9e9e9', opacity: 0, transform: 'scale(.95)', ':hover': { backgroundColor: 'rgba(255,255,255, .13)', color: '#fff' }, ':active': { backgroundColor: 'rgba(255,255,255, .1)', color: '#909090' } }, iconHovered: { opacity: 1, transform: 'none', pointerEvents: 'all' }, shape: { position: 'absolute', left: '4px', top: '4px', width: '6px', height: '6px', verticalAlign: 'middle', fill: 'currentColor' } }; } }
src/helpers/connectData.js
melodylu/react-redux-universal-hot-example
import React, { Component } from 'react'; import hoistStatics from 'hoist-non-react-statics'; /* Note: When this decorator is used, it MUST be the first (outermost) decorator. Otherwise, we cannot find and call the fetchData and fetchDataDeffered methods. */ export default function connectData(fetchData, fetchDataDeferred) { return function wrapWithFetchData(WrappedComponent) { class ConnectData extends Component { render() { return <WrappedComponent {...this.props} />; } } ConnectData.fetchData = fetchData; ConnectData.fetchDataDeferred = fetchDataDeferred; return hoistStatics(ConnectData, WrappedComponent); }; }
src/components/Buttons.js
VERSAYANA/simple-todo
import React, { Component } from 'react'; import { NativeModules, LayoutAnimation, View, Text, TouchableNativeFeedback, DatePickerAndroid, Alert } from 'react-native'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import style from './style/Buttons'; const { UIManager } = NativeModules; UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true); export default class Buttons extends React.Component { showDatePicker = async (id, options) => { try { const { action, year, month, day } = await DatePickerAndroid.open( options ); if (action !== DatePickerAndroid.dismissedAction) { const { dateTodo } = this.props; dateTodo(new Date(year, month, day).toDateString(), id); } } catch ({ code, message }) { console.warn('Cannot open date picker', message); } }; render() { const { id, note, date, list, deleteTodo, dateTodo, textMode, viewAdditionalNote, showListSelector } = this.props; let calendarIcon = ''; if (date) { calendarIcon = ( <Icon name="calendar-blank" size={18} color="rgba(255, 255, 255, 0.75)" /> ); } else { calendarIcon = ( <Icon name="calendar-plus" size={18} color="rgba(255, 255, 255, 0.75)" /> ); } let noteIcon = ''; if (note) { noteIcon = ( <Icon name="note-outline" size={18} color="rgba(255, 255, 255, 0.75)" /> ); } else { noteIcon = ( <Icon name="note-plus-outline" size={18} color="rgba(255, 255, 255, 0.75)" /> ); } return ( <View style={style.row}> <TouchableNativeFeedback onPress={() => Alert.alert( `Delete To-Do`, null, [ { text: 'CANCEL' }, { text: 'DELETE', onPress: () => { LayoutAnimation.easeInEaseOut(); deleteTodo(id); } } ] )} > <View style={style.container}> <Icon name="delete" size={18} color="rgba(255, 255, 255, 0.75)" /> <Text style={style.text}>Delete</Text> </View> </TouchableNativeFeedback> <TouchableNativeFeedback onPress={() => showListSelector(list, id)}> <View style={style.container}> <Icon name="view-list" size={18} color="rgba(255, 255, 255, 0.75)" /> <Text style={style.text}>List</Text> </View> </TouchableNativeFeedback> <TouchableNativeFeedback onPress={() => { if (!date) { this.showDatePicker(id, {}); } else { Alert.alert(`Date`, `${date}`, [ { text: 'CANCEL' }, { text: 'Remove', onPress: () => { dateTodo(false, id); } }, { text: 'Change', onPress: () => { this.showDatePicker(id, { date: new Date(date) }); } } ]); } }} > <View style={style.container}> {calendarIcon} <Text style={style.text}>Date</Text> </View> </TouchableNativeFeedback> <TouchableNativeFeedback onPress={() => { viewAdditionalNote(id, note); }} > <View style={style.container}> {noteIcon} <Text style={style.text}>Note</Text> </View> </TouchableNativeFeedback> <TouchableNativeFeedback onPress={() => { textMode(id); }} > <View style={style.container}> <Icon name="pencil" size={18} color="rgba(255, 255, 255, 0.75)" /> <Text style={style.text}>Edit</Text> </View> </TouchableNativeFeedback> </View> ); } }
src/Map.js
dronesmith/Dronesmith-Ground-Control
import React, { Component } from 'react'; import L from 'leaflet'; import 'leaflet-rotatedmarker/leaflet.rotatedMarker'; import 'leaflet/dist/leaflet.css'; // import '../lib/mq-routing.js'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import Nav from './Nav'; import GroundControlApi from './GroundControlApi'; import ReactInterval from 'react-interval'; // store the map configuration properties in an object, // we could also move this to a separate file & import it if desired. let config = {}; config.params = { center: [47.655769,8.538503], zoomControl: false, zoom: 16, maxZoom: 19, minZoom: 11, scrollwheel: false, legends: true, infoControl: false, attributionControl: true }; config.tileLayer = { uri: 'http://{s}.tile.osm.org/{z}/{x}/{y}.png', params: { minZoom: 11, attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>', id: '', accessToken: '' } }; class Map extends Component { constructor(props) { super(props); this.state = { map: null, tileLayer: null, geojsonLayer: null, geojson: null }; this._mapNode = null; this.updateMap = this.updateMap.bind(this); } componentDidMount() { // code to run just after the component "mounts" / DOM elements are created // create the Leaflet map object if (!this.state.map) this.init(this._mapNode); } componentDidUpdate(prevProps, prevState) { // code to run when the component receives new props or state } componentWillUnmount() { // code to run just before unmounting the component // this destroys the Leaflet map object & related event listeners this.state.map.remove(); } updateMap(e) { } addGeoJSONLayer(geojson) { // create a native Leaflet GeoJSON SVG Layer to add as an interactive overlay to the map // an options object is passed to define functions for customizing the layer const geojsonLayer = L.geoJson(geojson, { onEachFeature: this.onEachFeature, pointToLayer: this.pointToLayer, filter: this.filterFeatures }); // add our GeoJSON layer to the Leaflet map object geojsonLayer.addTo(this.state.map); // store the Leaflet GeoJSON layer in our component state for use later this.setState({ geojsonLayer }); // fit the geographic extent of the GeoJSON layer within the map's bounds / viewport this.zoomToFeature(geojsonLayer); } zoomToFeature(target) { // pad fitBounds() so features aren't hidden under the Filter UI element var fitBoundsParams = { paddingTopLeft: [200,10], paddingBottomRight: [10,10] }; // set the map's center & zoom so that it fits the geographic extent of the layer this.state.map.fitBounds(target.getBounds(), fitBoundsParams); } init(id) { if (this.state.map) return; // this function creates the Leaflet map object and is called after the Map component mounts let map = L.map(id, config.params); let droneIcon = L.divIcon({className: 'chevron'}); this.droneMarker = L.marker([0,0], {rotationAngle: 0, icon: droneIcon}); this.droneMarker.addTo(map); map.on('click', (e) => { console.log(e); GroundControlApi.commandRequest('goto', {lat: e.latlng.lat, lon: e.latlng.lng}) }) this.flightLatLngs = []; this.flightPath = L.polyline(this.flightLatLngs, {color: 'red'}).addTo(map); L.control.scale({ position: "bottomright"}).addTo(map); L.control.zoom({ position: "bottomleft"}).addTo(map); // a TileLayer is used as the "basemap" map.addLayer(MQ.mapLayer()); // const tileLayer = L.tileLayer(config.tileLayer.uri, config.tileLayer.params).addTo(map); // set our state to include the tile layer this.setState({ map }); } render() { return ( <div id="mapUI"> <ReactInterval timeout={2000} enabled={true} callback={() => { GroundControlApi .telemRequest('position') .then((value) => { // this.state.map.options.flyTo(value.Latitude, value.Longitude) let ll = new L.LatLng(value.Latitude, value.Longitude); this.flightLatLngs.push(ll); console.log(this.state); this.state.map.panTo(ll); this.flightPath.setLatLngs(this.flightLatLngs); this.droneMarker.setLatLng(ll); this.droneMarker.setRotationAngle(value.Heading); // if (MQ) { // console.log(MQ, MQ.routing.directions()); // } }) }} /> <MuiThemeProvider> <div> <Nav /> </div> </MuiThemeProvider> <div style={{'marginTop': '-65px', 'position': 'static'}} ref={(node) => this._mapNode = node} id="map" /> </div> ); } } export default Map;
src/specimens/SawarabiGothic.js
googlefonts/japanese
import React from 'react'; import Section from '../components/Section'; class SpecimenSawarabi extends React.Component { render() { return ( <div> <Section maxWidth={ 2 }> <div className="h3 sm-h4 md-h2 lg-h1 line-height-4 white"> <div className="border-bottom border-yellow border-medium"> <p className="wf-sawarabigothic">ไพ็„ถใจใ—ใฆ้€Ÿๅบฆใ‚’ๅข—ใ—ใชใŒใ‚‰้€ฒใ‚€ใซใคใ‚Œใฆใ€ๅคœใจๆ—ฅไธญใฎๅˆ‡ใ‚Šๆ›ฟใ‚ใ‚ŠใŒๆ›–ๆ˜งใซใชใ‚Šใ€ไธ€็ถšใใฎ็ฐ่‰ฒใซใชใฃใŸใ€‚็ฉบใฏๆทฑใ„้’่‰ฒใงๅค•ๆšฎใ‚Œๆ™‚ใฎใ‚ˆใ†ใชๆ˜Žใ‚‹ใ„ๅ…‰ใง็…งใ‚‰ใ•ใ‚Œใฆใ„ใ‚‹ใ€‚ๆ€ฅใซ็พใ‚Œใ‚‹ๅคช้™ฝใฏใใ‚‰ใ‚ใๅ††ๅผงใฎๅฝขใ‚’ใ—ใŸๅ…‰ใฎ็ญ‹ใจใชใฃใŸใ€‚ๆœˆใฏใŠใผใ‚ใ’ใซๆบใ‚‰ใๅธฏใจใชใ‚Šใ€ๆ˜Ÿใฏ่ฆ‹ใˆใชใ‹ใฃใŸใ€‚ใŸใ ใ€ๆ™‚ๆŠ˜้’ใ„็ฉบใซๆ˜Žใ‚‹ใ็žฌใๅ††ใŒ่ฆ‹ใˆใŸใ€‚</p> </div> </div> </Section> </div> ); } } export default SpecimenSawarabi;
public/admin/components/sysUser/UserModal.js
dreamllq/koa-web-framework
/** * Created by lvliqi on 2017/5/3. */ import React from 'react' import {Form, Modal, Input} from 'antd' const FormItem = Form.Item; const formItemLayout = { labelCol: { span: 6, }, wrapperCol: { span: 14, }, }; export default Form.create()( ({ visible, title, onCancel, onOk, confirmLoading, item, form: { getFieldDecorator, validateFields, getFieldsValue } }) => { function handleOk() { validateFields((errors) => { if (errors) { return } const data = { ...getFieldsValue(), }; onOk(data) }) } const modelProps = { visible, title, onCancel, width: 800, onOk: handleOk, confirmLoading }; return <Modal {...modelProps}> <Form> <FormItem label="็”จๆˆทๅ" hasFeedback {...formItemLayout}> { getFieldDecorator('account', { initialValue: item.account || '', rules: [ { required: true, message: '็”จๆˆทๅๆœชๅกซๅ†™' }, { min: 6, max: 15, message: '็”จๆˆทๅ(6~15ไฝ)' } ] })(<Input/>) } </FormItem> <FormItem label="ๅฏ†็ " hasFeedback {...formItemLayout}> { getFieldDecorator('password')(<Input type="password"/>) } </FormItem> </Form> </Modal> })
src/modules/auth/routes.js
xangxiong/xim-js
import React from 'react'; import { Route } from 'react-router-dom'; import Login from './components/login'; import Logout from './components/logout'; import css from './auth.css'; export default [ <Route path="/login" key="login" component={Login} />, <Route path="/logout" key="logout" component={Logout} /> ];
src/pages/404.js
5minreact/5minreact.audio
import React from 'react'; import styled from 'styled-components'; import H2 from '../components/H2'; const Wrapper = styled.div` text-align: center; `; function NotFound() { return ( <Wrapper> <H2>Sorry, that page was not found.</H2> </Wrapper> ); } export default NotFound;
debugger/function-tree-debugger/src/components/Debugger/Signals/Signal/Action/index.js
idream3/cerebral
import './styles.css' import React from 'react' import Inspector from '../../../Inspector' import Service from './Service' function Action ({action, execution, children, onMutationClick, onActionClick}) { function getActionName () { var regex = /\(([^()]+)\)/ var match = regex.exec(action.name) return { name: match ? action.name.substr(0, match.index).trim() : action.name.trim(), params: match ? match[1] : null } } function getLineNumber () { const variable = action.error.name === 'TypeError' && action.error.message.match(/'(.*?)'/) ? action.error.message.match(/'(.*?)'/)[1] : action.error.message.split(' ')[0] const lines = action.error.stack.split('\n') return lines.reduce((lineNumber, line, index) => { if (lineNumber === -1 && line.indexOf(variable) >= 0) { return index + 1 } return lineNumber }, -1) } function renderActionTitle () { const actionName = getActionName() return ( <div className='action-actionTitle'> {actionName.name} {actionName.params ? <span className='action-actionNameParams'>{actionName.params}</span> : null} </div> ) } return ( <div className={action.error ? 'action action-actionError' : 'action'}> <div className={action.error ? 'action-actionErrorHeader' : 'action-actionHeader'} onClick={() => onActionClick(action)}> {action.error ? <i className='icon icon-warning' /> : null} {action.isAsync ? <i className='icon icon-asyncAction' /> : null} {renderActionTitle()} </div> {action.error ? ( <div className='action-error'> <strong>{action.error.name}</strong> : {action.error.message} <pre data-line={getLineNumber()}> <code className='language-javascript' dangerouslySetInnerHTML={{__html: action.error.stack.split('\n').filter((line) => line.trim() !== '').join('\n')}} /></pre> </div> ) : null} {!action.error && execution ? ( <div> <div className='action-actionInput'> <div className='action-inputLabel'>Input:</div> <div className='action-inputValue'><Inspector value={execution.payload} /></div> </div> <div className='action-services'> {execution.data.filter(data => data.type !== 'mutation').map((service, index) => <Service service={service} key={index} />)} </div> {execution.output ? ( <div className='action-actionInput'> <div className='action-inputLabel'>Output:</div> <div className='action-inputValue'><Inspector value={execution.output} /></div> </div> ) : null} {children} </div> ) : null} </div> ) } export default Action
src/containers/People/People.js
rasvaan/digibird_client
import React, { Component } from 'react'; import { Banner, Footer } from 'components'; import Helmet from 'react-helmet'; export default class People extends Component { render() { const styles = require('./People.scss'); return ( <div> <Helmet title="People"/> <Banner title="People" image="people" /> <div className={`${styles.persons} container`}> <div className="row"> <div className="col-sm-6 col-md-4 person"> <div className="well"> <img src="img/pictures/chris.png" className={`${styles.picture} img-responsive`}></img> <h3>Chris Dijkshoorn</h3> <a href="http://chrisdijkshoorn.nl">Website</a> <p>c.r.dijkshoorn@vu.nl</p> <div className={styles.logoContainer}> <a href="http://vu.nl/en/"> <img src="img/logos/vu.png" className={`${styles.logo} img-responsive`}> </img> </a> </div> </div> </div> <div className="col-sm-6 col-md-4 person"> <div className="well"> <img src="img/pictures/cristina.jpg" className={`${styles.picture} img-responsive`}></img> <h3>Cristina Bucur</h3> <a href="https://www.researchgate.net/profile/Cristina_Iulia_Bucur">Website</a> <p>cristina.bucur@student.vu.nl</p> <div className={styles.logoContainer}> <a href="http://vu.nl/en/"> <img src="img/logos/vu.png" className={`${styles.logo} img-responsive`}> </img> </a> </div> </div> </div> <div className="col-sm-6 col-md-4 person"> <div className="well"> <img src="img/pictures/lora.jpg" className={`${styles.picture} img-responsive`}></img> <h3>Lora Aroyo</h3> <a href="http://www.cs.vu.nl/~laroyo/">Website</a> <p>lora.aroyo@vu.nl</p> <div className={styles.logoContainer}> <a href="http://vu.nl/en/"> <img src="img/logos/vu.png" className={`${styles.logo} img-responsive`}> </img> </a> </div> </div> </div> <div className="col-sm-6 col-md-4 person"> <div className="well"> <img src="img/pictures/maarten.jpg" className={`${styles.picture} img-responsive`}></img> <h3>Maarten Brinkerink</h3> <a href="http://www.beeldengeluid.nl/kennis/experts/maarten-brinkerink">Website</a> <p>mbrinkerink@beeldengeluid.nl</p> <div className={styles.logoContainer}> <a href="http://www.beeldengeluid.nl/en"> <img src="img/logos/sound_and_vision.png" className={`${styles.logo} img-responsive`}> </img> </a> </div> </div> </div> <div className="col-sm-6 col-md-4 person"> <div className="well"> <img src="img/pictures/sander.jpg" className={`${styles.picture} img-responsive`}></img> <h3>Sander Pieterse</h3> <a href="https://www.linkedin.com/in/smpieterse">Website</a> <p>sander@xeno-canto.org</p> <div className={styles.logoContainer}> <a href="http://www.xeno-canto.org"> <img src="img/logos/xeno-canto.png" className={`${styles.logo} img-responsive`}> </img> </a> </div> </div> </div> <div className="col-sm-6 col-md-4 person"> <div className="well"> <img src="img/pictures/maartenh.jpg" className={`${styles.picture} img-responsive`}></img> <h3>Maarten Heerlien</h3> <a href="https://www.linkedin.com/in/maarten-heerlien-0b11b4a">Website</a> <p>maarten.heerlien@naturalis.nl</p> <div className={styles.logoContainer}> <a href="http://www.naturalis.nl/en/"> <img src="img/logos/naturalis.png" className={`${styles.logo} img-responsive`}> </img> </a> </div> </div> </div> </div> </div> <Footer /> </div> ); } }
scr-app/src/components/GraphicalQuery.js
tlatoza/SeeCodeRun
import React from 'react'; import PropTypes from 'prop-types'; import {withStyles} from '@material-ui/core/styles'; import Fab from '@material-ui/core/Fab'; // import Checkbox from '@material-ui/core/Checkbox'; // import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'; // import CheckBoxIcon from '@material-ui/icons/CheckBox'; import {VisualQueryManager} from '../containers/Pastebin'; import {getVisualIdsFromRefs} from "../containers/GraphicalMapper"; export const buttonAnimationId = `scr-a-buttonGraphicalHighLight-${Date.now()}`; const styles = theme => ({ '@global': { [`@keyframes ${buttonAnimationId}`]: { '0%': {backgroundColor: theme.palette.background.default, color: theme.palette.secondary.main}, '100%': {backgroundColor: theme.palette.secondary.main, color: theme.palette.background.default}, }, }, buttonRoot: { border: `1px solid ${theme.palette.background.default}`, boxShadow: 'unset', minHeight: 'unset', minWidth: 'unset', margin: '0', paddingLeft: theme.spacing(0.5), paddingRight: theme.spacing(0.5), height: 14, fontSize: 10, lineHeight: 1, }, buttonRootSelected: { border: `1px solid ${theme.palette.secondary.main}`, backgroundColor: theme.palette.background.default, zIndex: theme.zIndex.tooltip, color: theme.palette.secondary.main, boxShadow: 'unset', minHeight: 'unset', minWidth: 'unset', margin: '0', paddingLeft: theme.spacing(1), paddingRight: theme.spacing(1), height: 14, fontSize: 10, lineHeight: 1, }, buttonRootHovered: { border: `1px solid ${theme.palette.secondary.main}`, zIndex: theme.zIndex.tooltip, animation: `${buttonAnimationId} 0.75s 0.75s infinite`, boxShadow: 'unset', minHeight: 'unset', minWidth: 'unset', margin: '0', paddingLeft: theme.spacing(1), paddingRight: theme.spacing(1), height: 14, fontSize: 10, lineHeight: 1, }, size: { marginLeft: theme.spacing(0.5), width: 12, height: 12, }, checkbox: { fontSize: 12, }, checkboxSelected: { animation: `${buttonAnimationId} 0.75s 0.75s infinite`, fontSize: 12, }, }); class GraphicalQuery extends React.Component { state = { isHovered: false, }; render() { const {classes, outputRefs, visualIds, selected, color, ...rest} = this.props; const {isHovered} = this.state; return <div onMouseEnter={() => this.setState({isHovered: true})} onMouseLeave={() => this.setState({isHovered: false})} > <Fab color={color || 'secondary'} variant="extended" aria-label={`visual element number ${visualIds}`} elevation={0} className={isHovered ? classes.buttonRootHovered : selected ? classes.buttonRootSelected : classes.buttonRoot} onClick={() => { VisualQueryManager.onChange(outputRefs, visualIds, 'click'); }} onMouseEnter={() => { VisualQueryManager.onChange(outputRefs, visualIds, 'mouseenter'); }} onMouseLeave={() => { VisualQueryManager.onChange(outputRefs, visualIds, 'mouseleave'); }} {...rest} > {`${visualIds}`} {/*{(isHovered || selected) && <Checkbox*/} {/*className={classes.size}*/} {/*icon={<CheckBoxOutlineBlankIcon*/} {/*className={selected ? classes.checkboxSelected : classes.checkbox}/>}*/} {/*checkedIcon={<CheckBoxIcon className={selected ? classes.checkboxSelected : classes.checkbox}/>}*/} {/*value={`${visualIds}`}*/} {/*checked={selected}*/} {/*/>}*/} </Fab> </div>; } } GraphicalQuery.propTypes = { classes: PropTypes.object.isRequired, outputRefs: PropTypes.array.isRequired, visualIds: PropTypes.array.isRequired, selected: PropTypes.bool, color: PropTypes.string, }; export default withStyles(styles)(GraphicalQuery);
index.ios.js
nasgul/uwc2016teamSpring
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View } from 'react-native'; export default class todo extends Component { render() { return ( <View style={styles.container}> <Text style={styles.welcome}> Welcome to React Native! </Text> <Text style={styles.instructions}> To get started, edit index.ios.js </Text> <Text style={styles.instructions}> Press Cmd+R to reload,{'\n'} Cmd+D or shake for dev menu </Text> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, }, }); AppRegistry.registerComponent('todo', () => todo);
teletobit/src/components/Base/Header/UserMenu.js
edenpark/teletobit
import React from 'react'; import { Link } from 'react-router'; import { Icon } from 'semantic-ui-react'; import EyeCatchy from 'components/Common/EyeCatchy'; import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; import Dimmer from 'components/Common/Dimmer'; const UserMenu = ({profile, visible, onHide, onLogOut}) => { return( <ReactCSSTransitionGroup transitionName={{ enter: 'flipInX', leave: 'flipOutX' }} transitionEnterTimeout={500} transitionLeaveTimeout={500} > { visible && ( <EyeCatchy onHide={onHide}> <div className="user-menu-wrapper"> <div className="user-menu"> <div className="menu-item"> <Link to={`/profile/${profile.get('username')}`} onClick={onHide}> <div className="menu-name"> <Icon name="user"/><span><b>@{profile.get('username')}</b></span> <div className="description">๋‚˜์˜ <b>ํ† ๋น—</b></div> </div> </Link> </div> <div className="menu-item" onClick={onLogOut}> <div className="menu-name"> <Icon name="power"/><span>๋กœ๊ทธ์•„์›ƒ</span> </div> </div> { profile.get('permission') && <div className="menu-item"> <div className="menu-name"> <Link to='/admin' onClick={onHide}> <Icon name="setting"/><span>๊ด€๋ฆฌ์ž ํŽ˜์ด์ง€</span> </Link> </div> </div> } </div> </div> </EyeCatchy> ) } { visible && <Dimmer onClick={onHide} /> } </ReactCSSTransitionGroup> ); }; export default UserMenu;
src/components/common/inputs/TextArea.js
securely-app/web
import React from 'react'; import styled from 'styled-components'; const TextArea = props => <StyledTextArea onChange={props.onChange} />; export default TextArea; const StyledTextArea = styled.textarea` box-sizing: border-box; border-radius: 8px; width: 100%; border: none; margin: 12px auto; display: block; min-height: 200px; padding: 18px; font-size: 15px; transition: ease .2s all; font-family: 'Work Sans', sans-serif; &:active, &:focus { box-shadow: 1px 8px 12px rgba(0, 0, 0, .2), 1px 10px 18px rgba(0, 0, 0, .12); transition: ease .2s all; outline: none; border: none; } `;
examples/persist-react/src/index.js
rematch/rematch
import React from 'react' import ReactDOM from 'react-dom' import { Provider } from 'react-redux' import { init } from '@rematch/core' import Spinner from 'react-spinkit' import createPersistPlugin, { getPersistor } from '@rematch/persist' import { PersistGate } from 'redux-persist/es/integration/react' import storage from 'redux-persist/lib/storage' import * as models from './models' import App from './App' const persistPlugin = createPersistPlugin({ key: 'root', storage, version: 2, whitelist: ['persisted'], }) const store = init({ models, plugins: [persistPlugin], }) ReactDOM.render( <React.StrictMode> <Provider store={store}> <PersistGate loading={<Spinner />} persistor={getPersistor()}> <App /> </PersistGate> </Provider> </React.StrictMode>, document.getElementById('root') )