path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
src/components/common/svg-icons/hardware/tablet-android.js
abzfarah/Pearson.NAPLAN.GnomeH
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let HardwareTabletAndroid = (props) => ( <SvgIcon {...props}> <path d="M18 0H6C4.34 0 3 1.34 3 3v18c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V3c0-1.66-1.34-3-3-3zm-4 22h-4v-1h4v1zm5.25-3H4.75V3h14.5v16z"/> </SvgIcon> ); HardwareTabletAndroid = pure(HardwareTabletAndroid); HardwareTabletAndroid.displayName = 'HardwareTabletAndroid'; HardwareTabletAndroid.muiName = 'SvgIcon'; export default HardwareTabletAndroid;
src/components/Contentful/News/presenter.js
ndlib/usurper
// Presenter component for a Page content type from Contentful import React from 'react' import PropTypes from 'prop-types' import 'static/css/global.css' import LibMarkdown from 'components/LibMarkdown' import Related from '../Related' import Image from 'components/Image' import Link from 'components/Interactive/Link' import Librarians from 'components/Librarians' import PageTitle from 'components/Layout/PageTitle' import SearchProgramaticSet from 'components/SearchProgramaticSet' import { formatDate } from 'shared/DateLibs.js' import ShareLinks from 'components/Interactive/ShareLinks' import OpenGraph from 'components/OpenGraph' import Canonical from 'components/Canonical' const PagePresenter = ({ entry }) => ( <article className='container-fluid content-area news-article' itemScope itemType='http://schema.org/NewsArticle' itemProp='mainEntity' > {entry.fields.shortDescription && (<meta name='description' content={entry.fields.shortDescription} />)} <PageTitle title={entry.fields.title} itemProp='headline' classes='col-md-8 col-sm-8'> <div className='tagline news col-md-12'> {entry.fields.author && <div className='author'>{'By ' + entry.fields.author}</div>} {entry.fields.publishedDate && ( <div className={'published' + (entry.fields.author ? ' separator' : '')}> {formatDate(entry.fields.publishedDate)} </div> )} <ShareLinks className='separator' title={entry.fields.title} /> </div> </PageTitle> {entry.fields.canonicalUrl && ( <Canonical url={entry.fields.canonicalUrl} /> )} <OpenGraph title={entry.fields.title} description={entry.fields.shortDescription} image={entry.fields.image} /> <SearchProgramaticSet open={false} /> <div className='row'> <main className='col-md-8 col-sm-8 article'> <Image cfImage={entry.fields.image} className='news cover' itemProp='image' width={747} /> <LibMarkdown itemProp='articleBody'>{entry.fields.content}</LibMarkdown> <LibMarkdown className='contactNews'>{entry.fields.contactUsPubInfo}</LibMarkdown> <Related className='p-resources' title='Resources' showImages={false}> {entry.fields.relatedResources} </Related> <Link to='/news' className='newsEventsLink' arrow>View All News</Link> </main> <aside className='col-md-4 col-sm-4 right news'> <Librarians netids={entry.fields.contactPeople} /> <Related className='p-pages' title='Related Pages' showImages={false}>{entry.fields.relatedPages}</Related> </aside> </div> </article> ) PagePresenter.propTypes = { entry: PropTypes.object.isRequired, } export default PagePresenter
src/svg-icons/action/settings-input-svideo.js
pancho111203/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionSettingsInputSvideo = (props) => ( <SvgIcon {...props}> <path d="M8 11.5c0-.83-.67-1.5-1.5-1.5S5 10.67 5 11.5 5.67 13 6.5 13 8 12.33 8 11.5zm7-5c0-.83-.67-1.5-1.5-1.5h-3C9.67 5 9 5.67 9 6.5S9.67 8 10.5 8h3c.83 0 1.5-.67 1.5-1.5zM8.5 15c-.83 0-1.5.67-1.5 1.5S7.67 18 8.5 18s1.5-.67 1.5-1.5S9.33 15 8.5 15zM12 1C5.93 1 1 5.93 1 12s4.93 11 11 11 11-4.93 11-11S18.07 1 12 1zm0 20c-4.96 0-9-4.04-9-9s4.04-9 9-9 9 4.04 9 9-4.04 9-9 9zm5.5-11c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm-2 5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z"/> </SvgIcon> ); ActionSettingsInputSvideo = pure(ActionSettingsInputSvideo); ActionSettingsInputSvideo.displayName = 'ActionSettingsInputSvideo'; ActionSettingsInputSvideo.muiName = 'SvgIcon'; export default ActionSettingsInputSvideo;
upgrade-guides/v0.12-v0.13/es5/src/components/Layout.js
lore/lore
/** * This component is intended to reflect the high level structure of your application, * and render any components that are common across all views, such as the header or * top-level navigation. All other components should be rendered by route handlers. **/ import React from 'react'; import PropTypes from 'prop-types'; import createReactClass from 'create-react-class'; import logo from '../../assets/images/logo.png'; export default createReactClass({ displayName: 'Layout', render() { return ( <div> <div className="header"> <div className="container"> <div className="title"> <img className="logo" src={logo} /> <h1> Welcome to Lore! </h1> <h3> You're looking at <code>src/components/Layout.js</code> </h3> </div> </div> </div> <div className="main"> <div className="container"> <ul> <li> <div> <h3>Getting Started</h3> <p>Edit this file and the page will automatically reload to display changes.</p> </div> </li> <li> <div> <h3>New to Lore?</h3> <p>Learn how to use it by following the <a target="_blank" href="http://www.lorejs.org/quickstart/">quickstart</a>.</p> </div> </li> </ul> </div> </div> </div> ); } });
node_modules/rc-time-picker/es/TimePicker.js
prodigalyijun/demo-by-antd
import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _createClass from 'babel-runtime/helpers/createClass'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Trigger from 'rc-trigger'; import Panel from './Panel'; import placements from './placements'; import moment from 'moment'; function noop() {} function refFn(field, component) { this[field] = component; } var Picker = function (_Component) { _inherits(Picker, _Component); function Picker(props) { _classCallCheck(this, Picker); var _this = _possibleConstructorReturn(this, (Picker.__proto__ || Object.getPrototypeOf(Picker)).call(this, props)); _initialiseProps.call(_this); _this.saveInputRef = refFn.bind(_this, 'picker'); _this.savePanelRef = refFn.bind(_this, 'panelInstance'); var defaultOpen = props.defaultOpen, defaultValue = props.defaultValue, _props$open = props.open, open = _props$open === undefined ? defaultOpen : _props$open, _props$value = props.value, value = _props$value === undefined ? defaultValue : _props$value; _this.state = { open: open, value: value }; return _this; } _createClass(Picker, [{ key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { var value = nextProps.value, open = nextProps.open; if ('value' in nextProps) { this.setState({ value: value }); } if (open !== undefined) { this.setState({ open: open }); } } }, { key: 'setValue', value: function setValue(value) { if (!('value' in this.props)) { this.setState({ value: value }); } this.props.onChange(value); } }, { key: 'getFormat', value: function getFormat() { var _props = this.props, format = _props.format, showHour = _props.showHour, showMinute = _props.showMinute, showSecond = _props.showSecond, use12Hours = _props.use12Hours; if (format) { return format; } if (use12Hours) { var fmtString = [showHour ? 'h' : '', showMinute ? 'mm' : '', showSecond ? 'ss' : ''].filter(function (item) { return !!item; }).join(':'); return fmtString.concat(' a'); } return [showHour ? 'HH' : '', showMinute ? 'mm' : '', showSecond ? 'ss' : ''].filter(function (item) { return !!item; }).join(':'); } }, { key: 'getPanelElement', value: function getPanelElement() { var _props2 = this.props, prefixCls = _props2.prefixCls, placeholder = _props2.placeholder, disabledHours = _props2.disabledHours, disabledMinutes = _props2.disabledMinutes, disabledSeconds = _props2.disabledSeconds, hideDisabledOptions = _props2.hideDisabledOptions, allowEmpty = _props2.allowEmpty, showHour = _props2.showHour, showMinute = _props2.showMinute, showSecond = _props2.showSecond, defaultOpenValue = _props2.defaultOpenValue, clearText = _props2.clearText, addon = _props2.addon, use12Hours = _props2.use12Hours; return React.createElement(Panel, { clearText: clearText, prefixCls: prefixCls + '-panel', ref: this.savePanelRef, value: this.state.value, onChange: this.onPanelChange, onClear: this.onPanelClear, defaultOpenValue: defaultOpenValue, showHour: showHour, showMinute: showMinute, showSecond: showSecond, onEsc: this.onEsc, allowEmpty: allowEmpty, format: this.getFormat(), placeholder: placeholder, disabledHours: disabledHours, disabledMinutes: disabledMinutes, disabledSeconds: disabledSeconds, hideDisabledOptions: hideDisabledOptions, use12Hours: use12Hours, addon: addon }); } }, { key: 'getPopupClassName', value: function getPopupClassName() { var _props3 = this.props, showHour = _props3.showHour, showMinute = _props3.showMinute, showSecond = _props3.showSecond, use12Hours = _props3.use12Hours, prefixCls = _props3.prefixCls; var popupClassName = this.props.popupClassName; // Keep it for old compatibility if ((!showHour || !showMinute || !showSecond) && !use12Hours) { popupClassName += ' ' + prefixCls + '-panel-narrow'; } var selectColumnCount = 0; if (showHour) { selectColumnCount += 1; } if (showMinute) { selectColumnCount += 1; } if (showSecond) { selectColumnCount += 1; } if (use12Hours) { selectColumnCount += 1; } popupClassName += ' ' + prefixCls + '-panel-column-' + selectColumnCount; return popupClassName; } }, { key: 'setOpen', value: function setOpen(open) { var _props4 = this.props, onOpen = _props4.onOpen, onClose = _props4.onClose; if (this.state.open !== open) { if (!('open' in this.props)) { this.setState({ open: open }); } if (open) { onOpen({ open: open }); } else { onClose({ open: open }); } } } }, { key: 'focus', value: function focus() { this.picker.focus(); } }, { key: 'render', value: function render() { var _props5 = this.props, prefixCls = _props5.prefixCls, placeholder = _props5.placeholder, placement = _props5.placement, align = _props5.align, disabled = _props5.disabled, transitionName = _props5.transitionName, style = _props5.style, className = _props5.className, getPopupContainer = _props5.getPopupContainer, name = _props5.name, autoComplete = _props5.autoComplete; var _state = this.state, open = _state.open, value = _state.value; var popupClassName = this.getPopupClassName(); return React.createElement( Trigger, { prefixCls: prefixCls + '-panel', popupClassName: popupClassName, popup: this.getPanelElement(), popupAlign: align, builtinPlacements: placements, popupPlacement: placement, action: disabled ? [] : ['click'], destroyPopupOnHide: true, getPopupContainer: getPopupContainer, popupTransitionName: transitionName, popupVisible: open, onPopupVisibleChange: this.onVisibleChange }, React.createElement( 'span', { className: prefixCls + ' ' + className, style: style }, React.createElement('input', { className: prefixCls + '-input', ref: this.saveInputRef, type: 'text', placeholder: placeholder, name: name, readOnly: true, onKeyDown: this.onKeyDown, disabled: disabled, value: value && value.format(this.getFormat()) || '', autoComplete: autoComplete }), React.createElement('span', { className: prefixCls + '-icon' }) ) ); } }]); return Picker; }(Component); Picker.propTypes = { prefixCls: PropTypes.string, clearText: PropTypes.string, value: PropTypes.object, defaultOpenValue: PropTypes.object, disabled: PropTypes.bool, allowEmpty: PropTypes.bool, defaultValue: PropTypes.object, open: PropTypes.bool, defaultOpen: PropTypes.bool, align: PropTypes.object, placement: PropTypes.any, transitionName: PropTypes.string, getPopupContainer: PropTypes.func, placeholder: PropTypes.string, format: PropTypes.string, showHour: PropTypes.bool, showMinute: PropTypes.bool, showSecond: PropTypes.bool, style: PropTypes.object, className: PropTypes.string, popupClassName: PropTypes.string, disabledHours: PropTypes.func, disabledMinutes: PropTypes.func, disabledSeconds: PropTypes.func, hideDisabledOptions: PropTypes.bool, onChange: PropTypes.func, onOpen: PropTypes.func, onClose: PropTypes.func, addon: PropTypes.func, name: PropTypes.string, autoComplete: PropTypes.string, use12Hours: PropTypes.bool }; Picker.defaultProps = { clearText: 'clear', prefixCls: 'rc-time-picker', defaultOpen: false, style: {}, className: '', popupClassName: '', align: {}, defaultOpenValue: moment(), allowEmpty: true, showHour: true, showMinute: true, showSecond: true, disabledHours: noop, disabledMinutes: noop, disabledSeconds: noop, hideDisabledOptions: false, placement: 'bottomLeft', onChange: noop, onOpen: noop, onClose: noop, addon: noop, use12Hours: false }; var _initialiseProps = function _initialiseProps() { var _this2 = this; this.onPanelChange = function (value) { _this2.setValue(value); }; this.onPanelClear = function () { _this2.setValue(null); _this2.setOpen(false); }; this.onVisibleChange = function (open) { _this2.setOpen(open); }; this.onEsc = function () { _this2.setOpen(false); _this2.focus(); }; this.onKeyDown = function (e) { if (e.keyCode === 40) { _this2.setOpen(true); } }; }; export default Picker;
src/containers/Location/index.js
TUIHackfridays/tuise-poc
import React from 'react' const Location = () => <div> The location page </div> const styles = { } export default Location
src/components/topic/words/InfluentialWordsContainer.js
mitmedialab/MediaCloud-Web-Tools
import PropTypes from 'prop-types'; import React from 'react'; import { connect } from 'react-redux'; import { injectIntl, FormattedMessage } from 'react-intl'; import { Grid, Row, Col } from 'react-flexbox-grid/lib'; import Word2VecTimespanPlayerContainer from './Word2VecTimespanPlayerContainer'; import WordCloudComparisonContainer from './WordCloudComparisonContainer'; import FociWordComparison from './FociWordComparison'; import TopicPageTitle from '../TopicPageTitle'; const localMessages = { title: { id: 'topic.influentialWords.title', defaultMessage: 'Influential Words' }, intro: { id: 'topic.influentialWords.intro', defaultMessage: 'This screen lets you compare the words most used within this Timespan to the words used with this Subtopic. The words on the left are the most used in this Timespan. Those on the right are the most used within this Subtopic (if one is set, otherwise they are the most used in the whole snapshot).' }, }; const InfluentialWordsContainer = props => ( <Grid> <TopicPageTitle value={localMessages.title} /> <Row> <Col lg={12} md={12} sm={12}> <h1><FormattedMessage {...localMessages.title} /></h1> <p><FormattedMessage {...localMessages.intro} /></p> </Col> </Row> <FociWordComparison filters={props.filters} topicId={props.topicId} /> <WordCloudComparisonContainer /> <Word2VecTimespanPlayerContainer /> </Grid> ); InfluentialWordsContainer.propTypes = { // from compositional chain intl: PropTypes.object.isRequired, // from state topicId: PropTypes.number.isRequired, filters: PropTypes.object.isRequired, }; const mapStateToProps = state => ({ filters: state.topics.selected.filters, topicId: state.topics.selected.id, }); export default connect(mapStateToProps)( injectIntl( InfluentialWordsContainer ) );
src/js/containers/GalleryContainer.js
sdeleon28/react-fullscreen-gallery
import React from 'react'; import Gallery from '../components/Gallery'; const pt = React.PropTypes; class GalleryContainer extends React.Component { constructor() { super(); this.onImageSelected = this.onImageSelected.bind(this); this.state = { selectedImageIndex: 0, }; } onImageSelected(selectedImageIndex) { this.setState({ selectedImageIndex }); } render() { const images = this.props.images.map((image, index) => ({ ...image, index, selected: index === this.state.selectedImageIndex, })); const selectedImage = images.filter(image => image.selected)[0]; const { imageUrl, title } = selectedImage; return ( <Gallery imageUrl={imageUrl} title={title} images={images} onImageSelected={this.onImageSelected} /> ); } } GalleryContainer.propTypes = { images: pt.arrayOf(pt.shape({ imageUrl: pt.string.isRequired, thumbnailUrl: pt.string.isRequired, title: pt.string, alt: pt.string, })), }; export default GalleryContainer;
information/blendle-frontend-react-source/app/modules/timeline/components/FollowChannels.js
BramscoChill/BlendleParser
import React from 'react'; import PropTypes from 'prop-types'; import { translate, translateElement, getIso639_1 as getLang } from 'instances/i18n'; import classNames from 'classnames'; import Link from 'components/Link'; import ChannelName from 'components/ChannelName'; import Auth from 'controllers/auth'; import ChannelsStore from 'stores/ChannelsStore'; import ChannelActions from 'actions/ChannelActions'; import { STATUS_OK } from 'app-constants'; export default class TimelineNavigation extends React.Component { static propTypes = { onClose: PropTypes.func.isRequired, onChange: PropTypes.func, }; constructor() { super(); this.state = { channels: ChannelsStore.getState().channels, }; } componentWillMount() { ChannelsStore.listen(this._onStoreChange); } componentWillUnmount() { ChannelsStore.unlisten(this._onStoreChange); } _onStoreChange = (storeState) => { this.setState({ channels: storeState.channels }); }; _onChannelClick(channel, ev) { ChannelActions.followChannel(Auth.getId(), channel.id, !channel.get('following')); ev.stopPropagation(); ev.preventDefault(); if (this.props.onChange) { this.props.onChange(); } } _onContainerClick(ev) { ev.stopPropagation(); } _renderChannel(channel) { const className = classNames({ 'v-channel': true, 'v-channel-name': true, channel: true, [`channel-${channel.id}`]: true, 'l-following': channel.get('following'), }); return ( <li> <ChannelName onClick={this._onChannelClick.bind(this, channel)} className={className} channel={channel} /> </li> ); } _renderRequestChannel() { let url = 'https://blendle.typeform.com/to/duv5p9'; if (getLang() === 'nl') { url = 'https://blendle.typeform.com/to/Ar9GBY'; } return ( <li> <Link href={url} className="v-channel channel suggest-channel" target="_blank"> {translate('channels.suggest')} </Link> </li> ); } render() { if (this.state.channels.status !== STATUS_OK) { return null; } return ( <div className="channel-overlay" onClick={this.props.onClose}> <div className="v-channels" onClick={this._onContainerClick}> <a className="v-close-button" onClick={this.props.onClose} /> <h1>{translateElement('timeline.channel.title', [Auth.getUser().getFirstName()])}</h1> <ul> {this.state.channels.data.map(this._renderChannel.bind(this))} {this._renderRequestChannel()} </ul> </div> </div> ); } } // WEBPACK FOOTER // // ./src/js/app/modules/timeline/components/FollowChannels.js
motion-test/src/motionCustom.js
wandarkaf/React-Bible
import React, { Component } from 'react'; import {Motion, spring, presets} from 'react-motion'; class MotionCustom extends Component { render(){ return ( <Motion defaultStyle={{ y: 500, z: 4 }} style={{ y: spring(100, presets.wobbly), z: spring(1, presets.wobbly), }}> {obj => { let style= { transform: `translate(100px, ${obj.y}px) scale(${obj.z})`, border: '1px solid red', width: '100px', height: '100px', backgroundColor: '#b00b00', } return <div style={style} className="block"></div> }} </Motion> ) } } export default MotionCustom;
packages/icons/src/md/maps/LocalDrink.js
suitejs/suitejs
import React from 'react'; import IconBase from '@suitejs/icon-base'; function MdLocalDrink(props) { return ( <IconBase viewBox="0 0 48 48" {...props}> <path d="M6 4h36l-4.03 36.47A3.994 3.994 0 0 1 34 44H14c-2.05 0-3.74-1.54-3.97-3.53L6 4zm18 34c3.31 0 6-2.69 6-6 0-4-6-10.8-6-10.8S18 28 18 32c0 3.31 2.69 6 6 6zm12.65-22l.89-8H10.47l.88 8h25.3z" /> </IconBase> ); } export default MdLocalDrink;
components/BottomNavigation.js
BDE-ESIEE/mobile
'use strict'; import React from 'react'; import ScrollableTabView from 'react-native-scrollable-tab-view'; import {DefaultRenderer} from 'react-native-router-flux'; import TabBar from './TabBar'; class BottomNavigation extends React.Component { render () { const props = this.props; return ( <ScrollableTabView tabBarPosition='bottom' locked={true} renderTabBar={() => <TabBar />} > { props.navigationState.children.map(el => { return ( <DefaultRenderer navigationState={el} onNavigate={props.onNavigate} key={el.key} {...el} tabLabel={el.title} /> ); }) } </ScrollableTabView> ); } } module.exports = BottomNavigation;
src/components/RayGunComponent.js
pacmessica/worms-copy
import React from 'react'; class RayGunComponent extends React.Component { constructor() { super(); } gunStyle() { return { position: "fixed", width: "5px", height: "5px", backgroundColor: "black", left: this.props.x + 5 + "px", top: this.props.y + "px" }; } render() { console.log(this.props.x) return ( <div style={this.gunStyle()}> </div> ); } } export default RayGunComponent;
examples/src/app.js
mrcodemonkey/react-autosuggest
require('./app.less'); import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import Badges from './Badges/Badges'; import Examples from './Examples'; import Footer from './Footer/Footer'; import ForkMeOnGitHub from './ForkMeOnGitHub/ForkMeOnGitHub'; import TrackLinks from './TrackLinks/TrackLinks'; class App extends Component { render() { return ( <TrackLinks> <h1>react-autosuggest</h1> <Badges /> <Examples /> <Footer /> <ForkMeOnGitHub user="moroshko" repo="react-autosuggest" /> </TrackLinks> ); } } ReactDOM.render(<App />, document.getElementById('app'));
lib/ui/src/modules/ui/components/layout/index.js
bigassdragon/storybook
import PropTypes from 'prop-types'; import React from 'react'; import USplit from './usplit'; import Dimensions from './dimensions'; import SplitPane from 'react-split-pane'; const rootStyle = { height: '100vh', backgroundColor: '#F7F7F7', }; const leftPanelStyle = leftPanelOnTop => ({ width: '100%', display: 'flex', flexDirection: leftPanelOnTop ? 'column' : 'row', alignItems: 'stretch', paddingRight: leftPanelOnTop ? 10 : 0, }); const downPanelStyle = downPanelInRight => ({ display: 'flex', flexDirection: downPanelInRight ? 'row' : 'column', alignItems: 'stretch', width: '100%', height: '100%', padding: downPanelInRight ? '5px 10px 10px 0' : '0px 10px 10px 0', boxSizing: 'border-box', }); const resizerCursor = isVert => (isVert ? 'col-resize' : 'row-resize'); const storiesResizerStyle = (showLeftPanel, leftPanelOnTop) => ({ cursor: showLeftPanel ? resizerCursor(!leftPanelOnTop) : undefined, height: leftPanelOnTop ? 10 : 'auto', width: leftPanelOnTop ? '100%' : 10, zIndex: 1, }); const addonResizerStyle = (showDownPanel, downPanelInRight) => ({ cursor: showDownPanel ? resizerCursor(downPanelInRight) : undefined, height: downPanelInRight ? '100%' : 10, width: downPanelInRight ? 10 : '100%', zIndex: 1, }); const contentPanelStyle = (downPanelInRight, leftPanelOnTop) => ({ position: 'absolute', boxSizing: 'border-box', width: '100%', height: '100%', padding: downPanelInRight ? '10px 2px 10px 0' : '10px 10px 2px 0', paddingTop: leftPanelOnTop ? 0 : 10, }); const normalPreviewStyle = { width: '100%', height: '100%', backgroundColor: '#FFF', border: '1px solid #ECECEC', borderRadius: 4, }; const fullScreenPreviewStyle = { position: 'fixed', left: '0px', right: '0px', top: '0px', zIndex: 1, backgroundColor: '#FFF', height: '100%', width: '100%', border: 0, margin: 0, padding: 0, overflow: 'hidden', }; const onDragStart = function() { document.body.classList.add('dragging'); }; const onDragEnd = function() { document.body.classList.remove('dragging'); }; const defaultSizes = { addonPanel: { down: 200, right: 400, }, storiesPanel: { left: 250, top: 400, }, }; const saveSizes = sizes => { try { localStorage.setItem('panelSizes', JSON.stringify(sizes)); return true; } catch (e) { return false; } }; const getSavedSizes = sizes => { try { const panelSizes = localStorage.getItem('panelSizes'); if (panelSizes) { return JSON.parse(panelSizes); } saveSizes(sizes); return sizes; } catch (e) { saveSizes(sizes); return sizes; } }; class Layout extends React.Component { constructor(props) { super(props); this.layerSizes = getSavedSizes(defaultSizes); this.state = { previewPanelDimensions: { height: 0, width: 0, }, }; this.onResize = this.onResize.bind(this); } componentDidMount() { window.addEventListener('resize', this.onResize); } componentWillUnmount() { window.removeEventListener('resize', this.onResize); } onResize(pane, mode) { return size => { this.layerSizes[pane][mode] = size; saveSizes(this.layerSizes); const { clientWidth, clientHeight } = this.previewPanelRef; this.setState({ previewPanelDimensions: { width: clientWidth, height: clientHeight, }, }); }; } render() { const { goFullScreen, showLeftPanel, showDownPanel, downPanelInRight, downPanel, leftPanel, preview, } = this.props; const { previewPanelDimensions } = this.state; const leftPanelOnTop = false; let previewStyle = normalPreviewStyle; if (goFullScreen) { previewStyle = fullScreenPreviewStyle; } const sizes = getSavedSizes(this.layerSizes); const leftPanelDefaultSize = !leftPanelOnTop ? sizes.storiesPanel.left : sizes.storiesPanel.top; const downPanelDefaultSize = !downPanelInRight ? sizes.addonPanel.down : sizes.addonPanel.right; const addonSplit = downPanelInRight ? 'vertical' : 'horizontal'; const storiesSplit = leftPanelOnTop ? 'horizontal' : 'vertical'; return ( <div style={rootStyle}> <SplitPane split={storiesSplit} allowResize={showLeftPanel} minSize={150} maxSize={-400} size={showLeftPanel ? leftPanelDefaultSize : 1} defaultSize={leftPanelDefaultSize} resizerStyle={storiesResizerStyle(showLeftPanel, leftPanelOnTop)} onDragStarted={onDragStart} onDragFinished={onDragEnd} onChange={this.onResize('storiesPanel', leftPanelOnTop ? 'top' : 'left')} > {showLeftPanel ? <div style={leftPanelStyle(leftPanelOnTop)}> <div style={{ flexGrow: 1, height: '100%' }}> {leftPanel()} </div> <USplit shift={5} split={storiesSplit} /> </div> : <div />} <SplitPane split={addonSplit} allowResize={showDownPanel} primary="second" minSize={downPanelInRight ? 200 : 100} maxSize={-200} size={showDownPanel ? downPanelDefaultSize : 1} defaultSize={downPanelDefaultSize} resizerStyle={addonResizerStyle(showDownPanel, downPanelInRight)} onDragStarted={onDragStart} onDragFinished={onDragEnd} onChange={this.onResize('addonPanel', downPanelInRight ? 'right' : 'down')} > <div style={contentPanelStyle(downPanelInRight, leftPanelOnTop)}> <div style={previewStyle} ref={ref => { this.previewPanelRef = ref; }} > {preview()} </div> <Dimensions {...previewPanelDimensions} /> </div> {showDownPanel ? <div style={downPanelStyle(downPanelInRight)}> <USplit shift={-5} split={addonSplit} /> {downPanel()} </div> : <div />} </SplitPane> </SplitPane> </div> ); } } Layout.propTypes = { showLeftPanel: PropTypes.bool.isRequired, showDownPanel: PropTypes.bool.isRequired, goFullScreen: PropTypes.bool.isRequired, leftPanel: PropTypes.func.isRequired, preview: PropTypes.func.isRequired, downPanel: PropTypes.func.isRequired, downPanelInRight: PropTypes.bool.isRequired, }; export default Layout;
src/components/Github/Feed/DetailPush.js
jseminck/react-native-github-feed
import React from 'react'; import { Text, View, Image, ScrollView, ListView } from 'react-native'; import moment from 'moment'; export default class DetailComment extends React.Component { static propTypes = { eventDetail: React.PropTypes.object.isRequired } constructor(props) { super(props); const dataSource = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); this.state = { dataSource: dataSource.cloneWithRows(this.props.eventDetail.payload.commits) }; } render() { return ( <ScrollView> <View style={styles.container}> <Image source={{uri : this.props.eventDetail.actor.avatar_url}} style={styles.image} /> <Text style={styles.name}> {moment(this.props.eventDetail.created_at).fromNow()} </Text> <Text> {this.props.eventDetail.actor.login} pushed to </Text> <Text> {this.props.eventDetail.payload.ref.replace('refs/heads/', '')} </Text> <Text> at {this.props.eventDetail.repo.name} </Text> {this.renderCommits()} </View> </ScrollView> ); } renderCommits() { return ( <View style={styles.container}> <Text style={styles.name}> {this.props.eventDetail.payload.commits.length} commit(s) </Text> <ListView enableEmptySections={true} dataSource={this.state.dataSource} renderRow={this.renderRow} /> </View> ); } renderRow(rowData) { return ( <View style={styles.issueContainer}> <Text style={styles.issueTitle}> {rowData.sha.substring(1, 6)} - {rowData.message} </Text> </View> ); } } const styles = { container: { justifyContent: 'flex-start', alignItems: 'center', flex: 1 }, image: { borderRadius: 100, height: 200, width: 200 }, name: { marginTop: 20, fontSize: 24 }, issueContainer: { marginTop: 20, marginBottom: 20, marginLeft: 10, marginRight: 10, padding: 20, backgroundColor: '#45698F', justifyContent: 'flex-start', alignItems: 'center' }, issueTitle: { color: 'white', fontWeight: 'bold' }, issueBody: { color: 'white', marginTop: 5 } };
src/containers/Asians/TabControls/PreliminaryRounds/CreateRooms/8_VenuePreview/index.js
westoncolemanl/tabbr-web
import React from 'react' import withStyles from 'material-ui/styles/withStyles' import Typography from 'material-ui/Typography' import VenueTable from './VenueTable' import Navigation from './Navigation' const styles = theme => ({ root: { [theme.breakpoints.down('sm')]: { paddingLeft: theme.spacing.unit, paddingRight: theme.spacing.unit }, [theme.breakpoints.between('sm', 'lg')]: { paddingLeft: theme.spacing.unit * 4, paddingRight: theme.spacing.unit * 4 }, [theme.breakpoints.up('lg')]: { paddingLeft: theme.spacing.unit * 8, paddingRight: theme.spacing.unit * 8 } } }) export default withStyles(styles)(({ round, roomsDraft, onChange, onBack, onNext, classes, minimumRelevantAdjudicatorPoint }) => <div className={classes.root} > <Typography variant={'display4'} > {'Adjust venues'} </Typography> <Typography variant={'display1'} gutterBottom > {'Drag and drop venues to move them around'} </Typography> <VenueTable round={round} roomsDraft={roomsDraft} onChange={onChange} minimumRelevantAdjudicatorPoint={minimumRelevantAdjudicatorPoint} /> <Navigation onBack={onBack} onNext={onNext} /> </div> )
app/index.js
Onra/inspiringquote
import React from 'react'; import ReactDOM from 'react-dom'; import Home from './components/Home'; import './styles/stylesheet.scss'; document.addEventListener('DOMContentLoaded', () => { ReactDOM.render(<Home />, document.getElementById('root')); });
src/scenes/home/landing/landing.js
sethbergman/operationcode_frontend
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import ReactModal from 'react-modal'; import FontAwesomeIcon from '@fortawesome/react-fontawesome'; import { faTimes } from '@fortawesome/fontawesome-free-solid'; import Hero from './hero/hero'; import Membership from './membership/membership'; import MoreInformation from './moreInformation/moreInformation'; import SuccessStories from './successStories/successStories'; import Partners from './partners/partners'; import Donate from '../../../shared/components/donate/donate'; import Join from '../../../shared/components/join/join'; import EmailSignup from './emailSignup/emailSignup'; import styles from './landing.css'; class Landing extends Component { state = { showModal: false }; componentDidMount() { // Uncomment in order to render landing screen pop-up when desired // this.toggleModal(); } toggleModal = () => { this.setState({ showModal: !this.state.showModal }); }; render() { return ( <div className={styles.landing}> {/* Modal only rendered when this.toggleModal() is uncommented in componentDidMount() */} <ReactModal isOpen={this.state.showModal} onRequestClose={this.toggleModal} contentLabel="None" className={styles.landingModal} > <FontAwesomeIcon icon={faTimes} size="4x" className={styles.landingModal_CloseButton} onClick={this.toggleModal} /> <div className={styles.landingModal_Content}> <h3>Pop-up Title</h3> <p>Content</p> </div> </ReactModal> <Hero /> <Membership /> <MoreInformation /> <SuccessStories /> <Partners /> <Donate /> <Join /> <EmailSignup sendNotification={this.props.sendNotification} /> </div> ); } } Landing.propTypes = { sendNotification: PropTypes.func.isRequired }; export default Landing;
src/svg-icons/file/cloud-upload.js
ngbrown/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let FileCloudUpload = (props) => ( <SvgIcon {...props}> <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"/> </SvgIcon> ); FileCloudUpload = pure(FileCloudUpload); FileCloudUpload.displayName = 'FileCloudUpload'; FileCloudUpload.muiName = 'SvgIcon'; export default FileCloudUpload;
src/components/RecurrencePicker/RecurrencePicker.js
F-Ruxton/taskata
import React, { Component } from 'react'; // import moment from 'moment'; // import 'moment-recur'; // import { find, chunk, map, remove, isEmpty } from 'lodash'; import { find, chunk, map } from 'lodash'; import './RecurrencePicker.css'; import SimpleSelectWrapper from '../SimpleSelectWrapper/SimpleSelectWrapper'; import SingleDatePickerWrapper from '../SingleDatePickerWrapper/SingleDatePickerWrapper'; const RecurrenceTypeSelect = ({ name, value, handleChange, optionsType, placeholder }) => { const options = { shortLabelOptions: [ { value: 'day', label: 'Daily' }, { value: 'week', label: 'Weekly' }, { value: 'month', label: 'Monthly' }, ], longLabelOptions: [ // { value: 'none', label: 'None' }, { value: 'day', label: 'Every Day' }, { value: 'week', label: 'Every Week' }, { value: 'month', label: 'Every Month' }, { value: 'weekdays', label: 'Weekdays' }, { value: 'weekends', label: 'Weekends' }, { value: 'custom', label: 'Custom...' } ] }; return ( <SimpleSelectWrapper value={value} name={name} handleChange={handleChange} options={options[optionsType]} placeholder={placeholder || 'Every...'} clearable={false} /> ); } const PickerTable = ({name, options, values, numRows, handleUpdate}) => { let toCells = (value, key) => ( <td key={key} onClick={e => handleUpdate({ name, value })} style={{padding: 3, border: '1px solid #bfbfbf'}} className={!!find(values, v => v===value) ? 'picked' : '' } > { value } </td> ); let cells = map(options, toCells); let rows = chunk(cells, Math.ceil(cells.length / numRows)); return ( <div style={{ margin: 5 }}> <table style={{borderCollapse: 'collapse'}}> <tbody> {map(rows, (row, key) => <tr key={key}>{row}</tr>)} </tbody> </table> </div> ); } class CustomRecurrencePicker extends Component { render() { let dayOptions = [ 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ]; let weekOptions = ['0','1','2','3']; let monthDayOptions = [] for(let i=1 ; i<32; i++){ monthDayOptions.push(i.toString()) }; let monthOptions = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; let { customRecurrenceType, values, handleUpdate, handleUpdateValue } = this.props; let { recurrenceInterval, days, weeks, monthDays, months } = values; let recurrencePickerElement; switch(customRecurrenceType){ case 'day': recurrencePickerElement = ( <div style={{textAlign: 'left'}}> Every <input type="number" style={{marginLeft: 3, width: 34, height:20, fontSize: 16}} value={recurrenceInterval} min='1' name='recurrenceInterval' onChange={handleUpdateValue} /> day(s) </div> ); break; case 'week': recurrencePickerElement = ( <div> <div style={{ display: 'flex', alignItems: 'center', marginBottom: -4, paddingLeft: 3}}> <div> Weeks of each month: </div> <PickerTable handleUpdate={handleUpdateValue} name='weeks' values={weeks} options={weekOptions} numRows={1} /> </div> <PickerTable handleUpdate={handleUpdateValue} name='days' values={days} options={dayOptions} numRows={1} /> </div> ); break; case 'month': recurrencePickerElement = ( <div style={{display: 'flex'}}> <div> <PickerTable handleUpdate={handleUpdateValue} name='monthDays' values={monthDays} options={monthDayOptions} numRows={5} /> </div> <div> <PickerTable handleUpdate={handleUpdateValue} name='months' values={months} options={monthOptions} numRows={3} /> </div> </div> ); break; default: } return ( <div style={{marginBottom: -6}}> <div style={{display: 'flex'}}> <span style={{width: 100}}> <RecurrenceTypeSelect name='customRecurrenceType' value={customRecurrenceType} handleChange={handleUpdate} optionsType='shortLabelOptions' placeholder='Frequency...' /> </span> </div> <div style={{textAlign: 'left'}}> {recurrencePickerElement} </div> </div> ); } } class RecurrencePicker extends Component { render() { const { recurrence, recurrenceData, updateRecurrenceData, updateRecurrenceDataValue } = this.props; const { recurrenceType, customRecurrenceType, values } = recurrenceData; return ( <div style={{ padding: '15px 10px 8px 10px' }}> <div style={{display: 'flex'}}> <div style={{width: 125, marginRight: 5}}> <RecurrenceTypeSelect name='recurrenceType' value={recurrenceType} handleChange={updateRecurrenceData} optionsType='longLabelOptions' /> </div> <div> <SingleDatePickerWrapper monthFormat="MMM YY" isDayHighlighted={day => recurrence && recurrence.matches && recurrence.matches(day)} daySize={20} readOnly placeholder='Preview' hideKeyboardShortcutsPanel keepOpenOnDateSelect /> </div> </div> { recurrenceType === 'custom' ? <div style={{marginTop: 10}}> <CustomRecurrencePicker values={values} handleUpdate={updateRecurrenceData} handleUpdateValue={updateRecurrenceDataValue} customRecurrenceType={customRecurrenceType} /> </div> : <div style={{display: 'none'}}/> } </div> ); } } export default RecurrencePicker;
src/components/Last/Last.stories.js
joshwcomeau/react-collection-helpers
import React from 'react'; import { storiesOf } from '@kadira/storybook'; import Last from '../Last'; import Sort from '../Sort'; storiesOf('Last', module) .add('default (1 item)', () => ( <Last collection={['Apple', 'Banana', 'Carrot']}> {item => <div>{item}</div>} </Last> )) .add('last 3 of 4 items', () => ( <Last collection={['Apple', 'Banana', 'Carrot', 'Dragonfruit']} num={3}> {item => <div>{item}</div>} </Last> )) .add('composed with Sort', () => { const collection = [ { id: 'a', name: 'Apple', price: 5 }, { id: 'b', name: 'Banana', price: 10.25 }, { id: 'c', name: 'Carrot', price: 4.50 }, { id: 'd', name: 'Dragonfruit', price: 7.50 }, { id: 'e', name: 'Eggplant', price: 12.75 }, ]; return ( <Sort collection={collection} comparator="price"> <Last num={2}> {item => <div>{item.name} - {item.price}</div>} </Last> </Sort> ); });
src/components/projectManageIndex/projectManageIndex.js
wengyian/project-manager-system
/** * Created by 51212 on 2017/4/10. */ import React, { Component } from 'react'; import {BrowserRouter as Router, Route, browserHistory, Switch} from 'react-router-dom'; import Header from '../Header/Header'; //import ProjectManage from '../projectManage/projectManage'; //import TextTable from '../textTable/textTable'; import { Icon, Tabs } from 'antd'; import ProjectManageFirstView from '../projectManageFirstView/projectManageFirstView'; import ProjectInfo from '../projectInfo/projectInfo'; require('./projectManageIndex.scss'); const TabPane = Tabs.TabPane; const TabExtraContent = <div className="project-tabExtraContent"><span className="search"><Icon type="search" />查询</span><span className="add"><Icon type="plus" />新增</span></div>; class ProjectManageIndex extends Component{ constructor(props){ super(props); } render(){ return ( <div> <Header {...this.props}></Header> <Tabs type="card" className="project-tabs" tabBarExtraContent={TabExtraContent}> <TabPane tab="项目管理" key="project-manage"> <Router> <div> <Route exact path="/projectManageIndex" component={ProjectManageFirstView}></Route> <Route path="/projectManageIndex/projectInfo" component={ProjectInfo}></Route> </div> </Router> </TabPane> <TabPane tab="员工管理" key="employee-manage">2</TabPane> <TabPane tab="设置" key="settings">3</TabPane> </Tabs> </div> ) } } export default ProjectManageIndex;
src/parser/warrior/fury/modules/spells/Recklessness.js
ronaldpereira/WoWAnalyzer
import React from 'react'; import Analyzer from 'parser/core/Analyzer'; import Events from 'parser/core/Events'; import SPELLS from 'common/SPELLS'; import RESOURCE_TYPES from 'game/RESOURCE_TYPES'; import { SELECTED_PLAYER } from 'parser/core/EventFilter'; import StatisticBox from 'interface/others/StatisticBox'; import { formatPercentage, formatThousands } from 'common/format'; import SpellIcon from 'common/SpellIcon'; class Recklessness extends Analyzer { reckRageGen = 0; totalRageGen = 0; reckDamage = 0; constructor(...args) { super(...args); this.addEventListener(Events.energize.by(SELECTED_PLAYER).to(SELECTED_PLAYER), this.onPlayerEnergize); this.addEventListener(Events.damage.by(SELECTED_PLAYER), this.onPlayerDamage); } onPlayerEnergize(event) { const resource = event.classResources && event.classResources.find(classResources => classResources.type === RESOURCE_TYPES.RAGE.id); if (!resource) return; if (this.selectedCombatant.hasBuff(SPELLS.RECKLESSNESS.id)) { this.reckRageGen += event.resourceChange / 2; } this.totalRageGen += event.resourceChange; } onPlayerDamage(event) { if (this.selectedCombatant.hasBuff(SPELLS.RECKLESSNESS.id)) { this.reckDamage += event.amount; } } get ratioReckRageGen() { return this.reckRageGen / this.totalRageGen; } get reckDPS() { return this.owner.getPercentageOfTotalDamageDone(this.reckDamage); } statistic() { return ( <StatisticBox icon={<SpellIcon id={SPELLS.RECKLESSNESS.id} />} label="Recklessness" value={`${this.reckRageGen} extra rage generated`} tooltip={<><strong>{formatPercentage(this.ratioReckRageGen)}%</strong> of your rage and <strong>{formatPercentage(this.reckDPS)}% ({formatThousands(this.reckDamage)}) </strong> of your damage was generated during Recklessness.</>} /> ); } } export default Recklessness;
src/js/components/settings/Global.js
barumel/ultritium-radio-player
import React from 'react'; import { Panel } from 'react-bootstrap'; import { SettingsPanel } from './panel/Panel'; import { SettingsPanelHeader } from './panel/Header'; import { SettingsFormGlobal } from './form/Global'; export class GlobalSettings extends SettingsPanel { constructor() { super(); this.state = { collapsed: true, locked: true, title: 'Global Settings' }; } render() { const header = (<SettingsPanelHeader title={this.state.title} locked={this.state.locked} lock={this.lock.bind(this)} toggle={this.toggle.bind(this)}> </SettingsPanelHeader> ); return( <Panel header={header} collapsible={true} expanded={!this.state.collapsed}> <SettingsFormGlobal locked={this.state.locked}></SettingsFormGlobal> </Panel> ); } }
docs/app/Examples/elements/List/Variations/ListExampleCelled.js
mohammed88/Semantic-UI-React
import React from 'react' import { Image, List } from 'semantic-ui-react' const ListExampleCelled = () => ( <List celled> <List.Item> <Image avatar src='http://semantic-ui.com/images/avatar/small/helen.jpg' /> <List.Content> <List.Header>Snickerdoodle</List.Header> An excellent companion </List.Content> </List.Item> <List.Item> <Image avatar src='http://semantic-ui.com/images/avatar/small/daniel.jpg' /> <List.Content> <List.Header>Poodle</List.Header> A poodle, its pretty basic </List.Content> </List.Item> <List.Item> <Image avatar src='http://semantic-ui.com/images/avatar/small/daniel.jpg' /> <List.Content> <List.Header>Paulo</List.Header> He's also a dog </List.Content> </List.Item> </List> ) export default ListExampleCelled
packages/icons/src/md/av/LibraryAdd.js
suitejs/suitejs
import React from 'react'; import IconBase from '@suitejs/icon-base'; function MdLibraryAdd(props) { return ( <IconBase viewBox="0 0 48 48" {...props}> <path d="M8 12H4v28c0 2.21 1.79 4 4 4h28v-4H8V12zm32-8c2.21 0 4 1.79 4 4v24c0 2.21-1.79 4-4 4H16c-2.21 0-4-1.79-4-4V8c0-2.21 1.79-4 4-4h24zm-2 18v-4h-8v-8h-4v8h-8v4h8v8h4v-8h8z" /> </IconBase> ); } export default MdLibraryAdd;
src/Container.js
thebritican/react-router-relay
import React from 'react'; import StaticContainer from 'react-static-container'; import getParamsForRoute from './getParamsForRoute'; import RootComponent from './RootComponent'; import RouteAggregator from './RouteAggregator'; export default class Container extends React.Component { static displayName = 'ReactRouterRelay.Container'; static propTypes = { Component: React.PropTypes.func.isRequired, }; static contextTypes = { routeAggregator: React.PropTypes.instanceOf(RouteAggregator), }; render() { const {routeAggregator} = this.context; if (!routeAggregator) { return <RootComponent {...this.props} />; } const {Component, ...routerProps} = this.props; const {route} = routerProps; const {queries} = route; if (!queries) { return <Component {...routerProps} />; } const params = getParamsForRoute(routerProps); const {fragmentPointers, failure} = routeAggregator.getData(route, queries, params); let shouldUpdate = true; let element; // This is largely copied from RelayRootContainer#render. if (failure) { const {renderFailure} = route; if (renderFailure) { const [error, retry] = failure; element = renderFailure(error, retry); } else { element = null; } } else if (fragmentPointers) { const data = {...routerProps, ...params, ...fragmentPointers}; const {renderFetched} = route; if (renderFetched) { element = renderFetched(data); } else { element = <Component {...data} />; } } else { const {renderLoading} = route; if (renderLoading) { element = renderLoading(); } else { element = undefined; } if (element === undefined) { element = null; shouldUpdate = false; } } return ( <StaticContainer shouldUpdate={shouldUpdate}> {element} </StaticContainer> ); } }
frontend/src/common/InputEmail.js
Ormabe/tuesday
import React from 'react'; import TextField from 'material-ui/TextField'; import { green800, grey800, orange800 } from 'material-ui/styles/colors'; const InputEmail = ({ name, label, value, onChange, errorText }) => { const { floatingLabelFocusStyle, floatingLabelStyle, underlineStyle, errorStyle } = styles; return( <TextField name={name} type="email" value={value} onChange={onChange} errorText={errorText} errorStyle={errorStyle} floatingLabelText={label} underlineStyle={underlineStyle} floatingLabelStyle={floatingLabelStyle} floatingLabelFocusStyle={floatingLabelFocusStyle} /> ); }; const styles = { underlineStyle: { borderColor: grey800, }, floatingLabelStyle: { color: grey800, }, floatingLabelFocusStyle: { color: green800, }, errorStyle: { color: orange800 } }; export { InputEmail };
app/javascript/mastodon/main.js
riku6460/chikuwagoddon
import * as registerPushNotifications from './actions/push_notifications'; import { default as Mastodon, store } from './containers/mastodon'; import React from 'react'; import ReactDOM from 'react-dom'; import ready from './ready'; const perf = require('./performance'); function main() { perf.start('main()'); if (window.history && history.replaceState) { const { pathname, search, hash } = window.location; const path = pathname + search + hash; if (!(/^\/web[$/]/).test(path)) { history.replaceState(null, document.title, `/web${path}`); } } ready(() => { const mountNode = document.getElementById('mastodon'); const props = JSON.parse(mountNode.getAttribute('data-props')); ReactDOM.render(<Mastodon {...props} />, mountNode); if (process.env.NODE_ENV === 'production') { // avoid offline in dev mode because it's harder to debug require('offline-plugin/runtime').install(); store.dispatch(registerPushNotifications.register()); } perf.stop('main()'); }); } export default main;
docs/pages/api-docs/breadcrumbs.js
lgollut/material-ui
import React from 'react'; import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; import { prepareMarkdown } from 'docs/src/modules/utils/parseMarkdown'; const pageFilename = 'api/breadcrumbs'; const requireRaw = require.context('!raw-loader!./', false, /\/breadcrumbs\.md$/); export default function Page({ docs }) { return <MarkdownDocs docs={docs} />; } Page.getInitialProps = () => { const { demos, docs } = prepareMarkdown({ pageFilename, requireRaw }); return { demos, docs }; };
resources/assets/js/components/admin/LateralMenu.js
jrm2k6/i-heart-reading
import React, { Component } from 'react'; import { browserHistory } from 'react-router'; export default class LateralMenu extends Component { constructor(props) { super(props); this.state = { activeTab: null, randomBackgroundColor: this.getRandomColor() }; } getRandomColor() { return `rgb(${this.getRandomInt(1, 256)}, ${this.getRandomInt(1, 256)}, ${this.getRandomInt(1, 256)})`; } getClassnameItem(name) { let className = 'menu-item'; if (this.state.activeTab === name) { className += ' active'; } return className; } handleClickMenu(tabName) { switch (tabName) { case 'home': browserHistory.push('/admin'); break; case 'dashboard': window.location.replace('/app'); break; case 'logout': window.location.replace('/logout'); break; default: browserHistory.push('/admin'); break; } this.setState({ activeTab: tabName }); } getRandomInt(min, max) { return Math.floor(Math.random() * (max - min)) + min; } render() { const { user } = this.props; let name = null; let role = null; let firstLetter = null; if (user) { name = user.name; role = user.role.charAt(0).toUpperCase() + user.role.slice(1); firstLetter = user.name.charAt(0); } return ( <div className='ihr-lateral-menu'> <div className='logo-container'> <img src='/images/logos/i-heart-reading-logo.png' /> </div> <div className='profile-container'> <div className='profile-avatar'> <div className='profile' style={{ backgroundColor: this.state.randomBackgroundColor }}> {firstLetter} </div> </div> <div className='profile-short-description'> <span className='profile-name'>{name}</span> <span className='profile-title'>{role}</span> </div> </div> <div className='menu-container' > <div className={this.getClassnameItem('home')} onClick={() => { this.handleClickMenu('home');}} > <i className='material-icons'>home</i><span>Home</span> </div> <div className={this.getClassnameItem('dashboard')} onClick={() => { this.handleClickMenu('dashboard');}} > <i className='material-icons'>dashboard</i><span>Dashboard</span> </div> <div className={this.getClassnameItem('logout')} onClick={() => { this.handleClickMenu('logout');}} > <i className='material-icons'>exit_to_app</i><span>Log Out</span> </div> <div className='separator-container'> <hr className='separator' /> </div> </div> </div> ); } }
src/components/Calendar/Calendar.js
nambawan/g-old
import React from 'react'; import PropTypes from 'prop-types'; import withStyles from 'isomorphic-style-loader/withStyles'; import { defineMessages } from 'react-intl'; import InfiniteCalendar, { withRange, Calendar as CalendarWithRange, } from 'react-infinite-calendar'; import s from './Calendar.css'; /* eslint-disable */ const messages = defineMessages({ blank: { id: 'calendar.blank', defaultMessage: 'No date set', description: 'Blank calendar', }, todayShort: { id: 'calendar.today.short', defaultMessage: 'Today', description: 'Today', }, todayLong: { id: 'calendar.today.long', defaultMessage: 'Today', description: 'Today', }, }); const months = { 'de-DE': 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split( '_', ), 'it-IT': 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split( '_', ), }; const monthsShort = { 'de-DE': 'Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), 'it-IT': 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), }; const weekdaysShort = { 'de-DE:': 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), 'it-IT': 'dom_lun_mar_mer_gio_ven_sab'.split('_'), }; const weekdays = { 'de-DE': 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), 'it-IT': 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split('_'), }; const format = { 'de-DE': 'dddd,MM.YYYY', 'it-IT': 'D MMMM YYYY', }; class Calendar extends React.Component { static propTypes = { lang: PropTypes.string.isRequired, intl: PropTypes.shape({ 'calendar.blank': PropTypes.string, }).isRequired, }; static locales = { 'de-DE': require('date-fns/locale/de'), 'it-IT': require('date-fns/locale/it'), }; render() { throw Error('Not finished'); const today = new Date(); const lastWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7); const { lang, intl } = this.props; const localizedWeekdays = weekdaysShort[this.props.lang]; return ( <InfiniteCalendar Component={withRange(CalendarWithRange)} theme={{ selectionColor: 'rgb(146, 118, 255)', textColor: { default: '#333', active: '#FFF', }, weekdayColor: 'rgb(146, 118, 255)', headerColor: 'rgb(127, 95, 251)', floatingNav: { background: 'rgba(81, 67, 138, 0.96)', color: '#FFF', chevron: '#FFA726', }, }} onSelect={function(date) { console.log(`You selected: ${JSON.stringify(date)}`); }} width={380} height={400} selected={new Date()} locale={{ locale: Calendar.locales[this.props.lang], headerFormat: 'dddd, D MMM', weekdays: localizedWeekdays, blank: 'Nothing selected', todayLabel: { long: 'Today', short: 'Today', }, }} /> ); } } /* eslint-enable */ export default withStyles(s)(Calendar);
src/components/Feedback/Feedback.js
vbauerster/react-starter-kit
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */ import React from 'react'; import styles from './Feedback.less'; import withStyles from '../../decorators/withStyles'; @withStyles(styles) class Feedback { render() { return ( <div className="Feedback"> <div className="Feedback-container"> <a className="Feedback-link" href="https://gitter.im/kriasoft/react-starter-kit">Ask a question</a> <span className="Feedback-spacer">|</span> <a className="Feedback-link" href="https://github.com/kriasoft/react-starter-kit/issues/new">Report an issue</a> </div> </div> ); } } export default Feedback;
src/view/UIElement/iconfont/index.js
fishmankkk/mircowater2.0
import React from 'react' import { Iconfont } from 'components' import { Table, Row, Col, Icon } from 'antd' import styles from './index.less' import './emoji' const colorfulIcons = ['boluo', 'baixiangguo', 'chengzi', 'boluomei', 'caomei', 'dayouzi', 'chelizi', 'fanqie', 'hamigua', 'ganlan', 'juzi', 'heimei', 'huolongguo', 'hongmei', 'lizi', 'lanmei', 'mangguo', 'mihoutao', 'longyan', 'mugua', 'lizi1', 'ningmeng'] const flatIcons = ['home', 'user', 'timelimit', 'shopcart', 'message', 'remind', 'service', 'shop', 'sweep', 'express', 'payment', 'search', 'feedback', 'pencil', 'setting', 'refund', 'delete', 'star', 'heart', 'share', 'location', 'console'] const localSVGIcons = ['vomiting', 'smirking', 'surprised', 'unamused', 'zombie', 'tired', 'tongue', 'wink'] const localRequireSVGIcons = [ require('../../../svg/cute/congratulations.svg'), require('../../../svg/cute/cry.svg'), require('../../../svg/cute/kiss.svg'), require('../../../svg/cute/leisurely.svg'), require('../../../svg/cute/notice.svg'), require('../../../svg/cute/proud.svg'), require('../../../svg/cute/shy.svg'), require('../../../svg/cute/sweat.svg'), require('../../../svg/cute/think.svg'), ] const IcoPage = () => (<div className="content-inner"> <Icon type="star-oo" /> <h2 style={{ margin: '16px 0' }}>Colorful Icon</h2> <ul className={styles.list}> {colorfulIcons.map(item => (<li key={item}> <Iconfont className={styles.icon} colorful type={item} /> <span className={styles.name}>{item}</span> </li>))} </ul> <h2 style={{ margin: '16px 0' }}>Flat Icon</h2> <ul className={styles.list}> {flatIcons.map(item => (<li key={item}> <Iconfont className={styles.icon} type={item} /> <span className={styles.name}>{item}</span> </li>))} </ul> <h2 style={{ margin: '16px 0' }}>Local SVG</h2> <ul className={styles.list}> {localSVGIcons.map(item => (<li key={item}> <Iconfont className={styles.icon} colorful type={item} /> <span className={styles.name}>{item}</span> </li>))} </ul> <h2 style={{ margin: '16px 0' }}>Local Require SVG</h2> <ul className={styles.list}> {localRequireSVGIcons.map(item => (<li key={item.default.id}> <Iconfont className={styles.icon} colorful type={item.default.id} /> <span className={styles.name}>{item.default.id}</span> </li>))} </ul> <h2 style={{ margin: '16px 0' }}>API</h2> <Row> <Col lg={18} md={24}> <Table rowKey={(record, key) => key} pagination={false} bordered scroll={{ x: 800 }} columns={[ { title: 'Property', dataIndex: 'props', }, { title: 'Description', dataIndex: 'desciption', }, { title: 'Type', dataIndex: 'type', }, { title: 'Default', dataIndex: 'default', }, ]} dataSource={[ { props: 'type', desciption: 'icon type', type: 'String', default: '-', }, { props: 'colorful', desciption: "to set the SVG has 'symbol element'", type: 'Bool', default: 'false', }]} /> </Col> </Row> <h2 style={{ margin: '16px 0' }}>Thanks</h2> <div style={{ margin: '16px 0', lineHeight: 2 }}> <p> <a href="http://www.iconfont.cn/user/detail?uid=116813">何阿酥</a> colorful fruit icon <a href="http://www.iconfont.cn/collections/detail?cid=4014" target="_blank" rel="noopener noreferrer"> http://www.iconfont.cn/collections/detail?cid=4014</a> </p> <p> <a href="http://www.iconfont.cn/user/detail?uid=496384">ColinXu</a> colorful &apos;tsundere&apos; emoji icon <a href="http://www.iconfont.cn/collections/detail?cid=4116" target="_blank" rel="noopener noreferrer"> http://www.iconfont.cn/collections/detail?cid=4116</a> </p> <p> <a href="http://www.iconfont.cn/user/detail?uid=116813">咕噜小莫莫</a> colorful &apos;face cute&apos; emoji icon <a href="http://www.iconfont.cn/collections/detail?cid=4268" target="_blank" rel="noopener noreferrer"> http://www.iconfont.cn/collections/detail?cid=4268</a> </p> </div> </div>) export default IcoPage
src/js/app.js
dockpit/dockpit
import React from 'react' import Router from 'react-router' import { Route, DefaultRoute } from 'react-router' import App from './views/App.jsx' import Daily from './views/Daily.jsx' var routes = ( <Route handler={App}> <DefaultRoute handler={Daily}/> </Route> ); Router.run(routes, Router.HashLocation, (Root) => { React.render(<Root/>, document.body); });
admin/client/App/components/Navigation/Mobile/index.js
cermati/keystone
/** * The mobile navigation, displayed on screens < 768px */ import React from 'react'; import Transition from 'react-addons-css-transition-group'; import MobileSectionItem from './SectionItem'; const ESCAPE_KEY_CODE = 27; const MobileNavigation = React.createClass({ displayName: 'MobileNavigation', propTypes: { brand: React.PropTypes.string, currentListKey: React.PropTypes.string, currentSectionKey: React.PropTypes.string, sections: React.PropTypes.array.isRequired, signoutUrl: React.PropTypes.string, }, getInitialState () { return { barIsVisible: false, }; }, // Handle showing and hiding the menu based on the window size when // resizing componentDidMount () { this.handleResize(); window.addEventListener('resize', this.handleResize); }, componentWillUnmount () { window.removeEventListener('resize', this.handleResize); }, handleResize () { this.setState({ barIsVisible: window.innerWidth < 768, }); }, // Toggle the menu toggleMenu () { this[this.state.menuIsVisible ? 'hideMenu' : 'showMenu'](); }, // Show the menu showMenu () { this.setState({ menuIsVisible: true, }); // Make the body unscrollable, so you can only scroll in the menu document.body.style.overflow = 'hidden'; document.body.addEventListener('keyup', this.handleEscapeKey, false); }, // Hide the menu hideMenu () { this.setState({ menuIsVisible: false, }); // Make the body scrollable again document.body.style.overflow = null; document.body.removeEventListener('keyup', this.handleEscapeKey, false); }, // If the escape key was pressed, hide the menu handleEscapeKey (event) { if (event.which === ESCAPE_KEY_CODE) { this.hideMenu(); } }, renderNavigation () { if (!this.props.sections || !this.props.sections.length) return null; return this.props.sections.map((section) => { // Get the link and the classname const href = section.lists[0].external ? section.lists[0].path : `${Keystone.adminPath}/${section.lists[0].path}`; const className = (this.props.currentSectionKey && this.props.currentSectionKey === section.key) ? 'MobileNavigation__section is-active' : 'MobileNavigation__section'; // Render a SectionItem return ( <MobileSectionItem key={section.key} className={className} href={href} lists={section.lists} currentListKey={this.props.currentListKey} onClick={this.toggleMenu} > {section.label} </MobileSectionItem> ); }); }, // Render a blockout renderBlockout () { if (!this.state.menuIsVisible) return null; return <div className="MobileNavigation__blockout" onClick={this.toggleMenu} />; }, // Render the sidebar menu renderMenu () { if (!this.state.menuIsVisible) return null; return ( <nav className="MobileNavigation__menu"> <div className="MobileNavigation__sections"> {this.renderNavigation()} </div> </nav> ); }, render () { if (!this.state.barIsVisible) return null; return ( <div className="MobileNavigation"> <div className="MobileNavigation__bar"> <button type="button" onClick={this.toggleMenu} className="MobileNavigation__bar__button MobileNavigation__bar__button--menu" > <span className={'MobileNavigation__bar__icon octicon octicon-' + (this.state.menuIsVisible ? 'x' : 'three-bars')} /> </button> <span className="MobileNavigation__bar__label"> {this.props.brand} </span> <a href={this.props.signoutUrl} className="MobileNavigation__bar__button MobileNavigation__bar__button--signout" > <span className="MobileNavigation__bar__icon octicon octicon-sign-out" /> </a> </div> <div className="MobileNavigation__bar--placeholder" /> <Transition transitionName="MobileNavigation__menu" transitionEnterTimeout={260} transitionLeaveTimeout={200} > {this.renderMenu()} </Transition> <Transition transitionName="react-transitiongroup-fade" transitionEnterTimeout={0} transitionLeaveTimeout={0} > {this.renderBlockout()} </Transition> </div> ); }, }); module.exports = MobileNavigation;
snippets/camunda-tasklist-examples/camunda-react-app/src/components/forms/invoice/newTask.js
camunda/camunda-consulting
import React from 'react' import { Field, reduxForm } from 'redux-form' const SimpleForm = props => { const { handleSubmit, pristine, reset, submitting } = props return ( <form onSubmit={handleSubmit}> <div> <label>First Name</label> <div> <Field name="firstName" component="input" type="text" placeholder="First Name" /> </div> </div> <div> <label>Last Name</label> <div> <Field name="lastName" component="input" type="text" placeholder="Last Name" /> </div> </div> <div> <label>Email</label> <div> <Field name="email" component="input" type="email" placeholder="Email" /> </div> </div> <div> <label>Sex</label> <div> <label> <Field name="sex" component="input" type="radio" value="male" />{' '} Male </label> <label> <Field name="sex" component="input" type="radio" value="female" />{' '} Female </label> </div> </div> <div> <label>Favorite Color</label> <div> <Field name="favoriteColor" component="select"> <option /> <option value="ff0000">Red</option> <option value="00ff00">Green</option> <option value="0000ff">Blue</option> </Field> </div> </div> <div> <label htmlFor="employed">Employed</label> <div> <Field name="employed" id="employed" component="input" type="checkbox" /> </div> </div> <div> <label>Notes</label> <div> <Field name="notes" component="textarea" /> </div> </div> <div> <button type="submit" disabled={pristine || submitting}> Submit </button> <button type="button" disabled={pristine || submitting} onClick={reset}> Clear Values </button> </div> </form> ) } export default reduxForm({ form: 'simple' // a unique identifier for this form })(SimpleForm)
docs/app/Examples/elements/Button/Variations/ButtonExampleColored.js
aabustamante/Semantic-UI-React
import React from 'react' import { Button } from 'semantic-ui-react' const ButtonExampleColored = () => ( <div> <Button color='red'>Red</Button> <Button color='orange'>Orange</Button> <Button color='yellow'>Yellow</Button> <Button color='olive'>Olive</Button> <Button color='green'>Green</Button> <Button color='teal'>Teal</Button> <Button color='blue'>Blue</Button> <Button color='violet'>Violet</Button> <Button color='purple'>Purple</Button> <Button color='pink'>Pink</Button> <Button color='brown'>Brown</Button> <Button color='grey'>Grey</Button> <Button color='black'>Black</Button> </div> ) export default ButtonExampleColored
src/components/Spinner.js
robertkirsz/magic-cards-manager
import React from 'react' import styled from 'styled-components' import { AbsoluteFullSize } from 'styled' import { spinAnimation } from 'styled/animations' const SpinnerContainer = styled.div` position: relative; width: 100px; height: 100px; margin: 100px auto; animation: ${spinAnimation(0)} 2s linear infinite; ` const SpinnerLayer = styled(AbsoluteFullSize)` transform: rotate(${props => props.rotation}deg); ` const SpinnerDot = styled.span` position: relative; display: block; width: 20px; height: 20px; margin: 0 auto; border-radius: 50%; background: ${props => props.color}; transform: rotate(${props => -props.rotation}deg); animation: ${props => spinAnimation(-props.rotation)} 2s linear infinite reverse; &::after { content: ""; display: block; position: absolute; top: 3px; right: 2px; width: 8px; height: 8px; background: radial-gradient(circle at center, white 0%, transparent 100%); border-radius: 50%; } ` const spinnerDots = [ { color: '#f0f2c0', rotation: 0 }, { color: '#b5cde3', rotation: 75 }, { color: '#aca29a', rotation: 145 }, { color: '#db8664', rotation: 215 }, { color: '#93b483', rotation: 285 } ] const Spinner = () => ( <SpinnerContainer> { spinnerDots.map(({ color, rotation }) => ( <SpinnerLayer key={color} rotation={rotation}> <SpinnerDot color={color} rotation={rotation} /> </SpinnerLayer> )) } </SpinnerContainer> ) export default Spinner
src/Zdd.js
lincolnphu/zzdi
import React, { Component } from 'react'; import Info from './Info'; require("./style.scss"); require('es6-promise').polyfill(); require('fetch-ie8'); export default class Zdd extends Component { constructor(props){ super(props); this.state = { name:'lincolnphu', url:'https://ws.audioscrobbler.com/2.0/?method=', api:'6510c6b46fd1c71571bc40ee7037e1a9', fetchnumber:'8', tracks:[], page:1, json:null, windowWidth:window.innerWidth, }; this.refresh = this.refresh.bind(this); this.handleResize = this.handleResize.bind(this); } handleResize(e){ this.setState({windowWidth:window.innerWidth}); } componentDidMount() { this.fetchData(); window.addEventListener('scroll',this.refresh); window.addEventListener('resize',this.handleResize); } componentWillMount() { window.removeEventListener('scroll', this.refresh) window.removeEventListener('resize',this.handleResize); } fetchData(){ const {name,url,api,fetchnumber,page} = this.state, fetchUrl = url+'user.getrecenttracks'+'&user='+name+'&api_key='+api+'&format=json&limit='+fetchnumber; fetch(fetchUrl) .then((response)=> response.json()) .then((json)=> { this.setState({ tracks:json.recenttracks.track, json:json, }); }) } refresh(e){ if ((window.innerHeight + document.documentElement.scrollTop) >= (e.target.body.scrollHeight-10)||(window.innerHeight + window.scrollY) >= (e.target.body.scrollHeight-10)){ const {name,url,api,tracks,fetchnumber,page} = this.state; const pages = page + 1, fetchUrl = url+'user.getrecenttracks'+'&user='+name+'&api_key='+api+'&format=json&limit=3'+'&page='+pages; fetch(fetchUrl) .then((response)=> response.json()) .then((json)=>{ const newf = json.recenttracks.track, newtracks = tracks.concat(newf); this.setState({ tracks:newtracks, page:pages, json:json, }) }) } } render() { if(this.state.json){ return( <div > <Info onScroll={this.refresh} tracks={this.state.tracks}/> </div> ) } return ( <div>Loading....</div> ); } }
server/server.js
sethkaufee/TherapyApp
import Express from 'express'; import compression from 'compression'; import mongoose from 'mongoose'; import bodyParser from 'body-parser'; import path from 'path'; import bcrypt from 'bcryptjs'; import IntlWrapper from '../client/modules/Intl/IntlWrapper'; // Webpack Requirements import webpack from 'webpack'; import config from '../webpack.config.dev'; import webpackDevMiddleware from 'webpack-dev-middleware'; import webpackHotMiddleware from 'webpack-hot-middleware'; // Initialize the Express App const app = new Express(); // Run Webpack dev server in development mode if (process.env.NODE_ENV === 'development') { const compiler = webpack(config); app.use(webpackDevMiddleware(compiler, { noInfo: true, publicPath: config.output.publicPath })); app.use(webpackHotMiddleware(compiler)); mongoose.set('debug', true); } // React And Redux Setup import { configureStore } from '../client/store'; import { Provider } from 'react-redux'; import React from 'react'; import { renderToString } from 'react-dom/server'; import { match, RouterContext } from 'react-router'; import Helmet from 'react-helmet'; // Import required modules import routes from '../client/routes'; import { fetchComponentData } from './util/fetchData'; import posts from './routes/post.routes'; import search from './routes/therapst.routes'; import events from './routes/event.routes'; // import users from './routes/user.routes'; // import auth from './routes/auth.routes'; // import routes from './routes/index.route'; import dummyData from './dummyData'; import serverConfig from './config'; // Set native promises as mongoose promise mongoose.Promise = global.Promise; // MongoDB Connection mongoose.connect(serverConfig.mongoURL, (error) => { if (error) { console.error('Please make sure Mongodb is installed and running!'); // eslint-disable-line no-console throw error; } // feed some dummy data in DB. dummyData(); }); // Apply body Parser and server public assets and routes app.use(compression()); app.use(bodyParser.json({ limit: '20mb' })); app.use(bodyParser.urlencoded({ limit: '20mb', extended: false })); app.use(Express.static(path.resolve(__dirname, '../dist/client'))); app.use('/api', posts); app.use('/api', search); app.use('/api', events); // app.use('/api', users); // app.use('/api', auth); // Render Initial HTML const renderFullPage = (html, initialState) => { const head = Helmet.rewind(); // Import Manifests const assetsManifest = process.env.webpackAssets && JSON.parse(process.env.webpackAssets); const chunkManifest = process.env.webpackChunkAssets && JSON.parse(process.env.webpackChunkAssets); return ` <!doctype html> <html> <head> ${head.base.toString()} ${head.title.toString()} ${head.meta.toString()} ${head.link.toString()} ${head.script.toString()} ${process.env.NODE_ENV === 'production' ? `<link rel='stylesheet' href='${assetsManifest['/app.css']}' />` : ''} <link href='https://fonts.googleapis.com/css?family=Lato:400,300,700' rel='stylesheet' type='text/css'/> <!--<link rel="shortcut icon" href="http://res.cloudinary.com/hashnode/image/upload/v1455629445/static_imgs/mern/mern-favicon-circle-fill.png" type="image/png" />--> <link rel="shortcut icon" href="http://therapist-kiosk.s3-website-us-west-1.amazonaws.com/static/img/icons/favicon-16x16.png" type="image/ico" /> </head> <body> <div id="root">${process.env.NODE_ENV === 'production' ? html : `<div>${html}</div>`}</div> <script> window.__INITIAL_STATE__ = ${JSON.stringify(initialState)}; ${process.env.NODE_ENV === 'production' ? `//<![CDATA[ window.webpackManifest = ${JSON.stringify(chunkManifest)}; window.webpackManifest = ${JSON.stringify(chunkManifest)}; //]]>` : ''} </script> <script src='${process.env.NODE_ENV === 'production' ? assetsManifest['/vendor.js'] : '/vendor.js'}'></script> <script src='${process.env.NODE_ENV === 'production' ? assetsManifest['/app.js'] : '/app.js'}'></script> </body> </html> `; }; const renderError = err => { const softTab = '&#32;&#32;&#32;&#32;'; const errTrace = process.env.NODE_ENV !== 'production' ? `:<br><br><pre style="color:red">${softTab}${err.stack.replace(/\n/g, `<br>${softTab}`)}</pre>` : ''; return renderFullPage(`Server Error${errTrace}`, {}); }; // Server Side Rendering based on routes matched by React-router. app.use((req, res, next) => { match({ routes, location: req.url }, (err, redirectLocation, renderProps) => { if (err) { return res.status(500).end(renderError(err)); } if (redirectLocation) { return res.redirect(302, redirectLocation.pathname + redirectLocation.search); } if (!renderProps) { return next(); } const store = configureStore(); return fetchComponentData(store, renderProps.components, renderProps.params) .then(() => { const initialView = renderToString( <Provider store={store}> <IntlWrapper> <RouterContext {...renderProps} /> </IntlWrapper> </Provider> ); const finalState = store.getState(); res .set('Content-Type', 'text/html') .status(200) .end(renderFullPage(initialView, finalState)); }) .catch((error) => next(error)); }); }); // start app app.listen(serverConfig.port, (error) => { if (!error) { console.log(`MERN is running on port: ${serverConfig.port}! Build something amazing!`); // eslint-disable-line } }); export default app;
app/react-icons/fa/compass.js
scampersand/sonos-front
import React from 'react'; import IconBase from 'react-icon-base'; export default class FaCompass extends React.Component { render() { return ( <IconBase viewBox="0 0 40 40" {...this.props}> <g><path d="m17.3 24.3l5.7-2.9-5.7-2.8v5.7z m8.6-13.2v12.1l-11.5 5.7v-12.1z m6.4 8.9q0-3.3-1.6-6.1t-4.5-4.4-6.1-1.6-6 1.6-4.5 4.4-1.6 6.1 1.6 6.1 4.4 4.4 6.1 1.6 6.1-1.6 4.5-4.4 1.6-6.1z m5 0q0 4.7-2.3 8.6t-6.3 6.2-8.6 2.3-8.6-2.3-6.2-6.2-2.3-8.6 2.3-8.6 6.2-6.2 8.6-2.3 8.6 2.3 6.3 6.2 2.3 8.6z"/></g> </IconBase> ); } }
src/app/core/atoms/icon/icons/plus.js
blowsys/reservo
import React from 'react'; const Plus = (props) => <svg {...props} viewBox="0 0 24 24"><g><g><polygon points="13 11 13 6 11 6 11 11 6 11 6 13 11 13 11 18 13 18 13 13 18 13 18 11 13 11"/></g></g></svg>; export default Plus;
stories/Grid.js
abouthiroppy/scuba
import React from 'react'; import { storiesOf } from '@kadira/storybook'; import Container, { Grid, Cell } from '../src'; const styles = { container: { width : '80%', margin : 30, padding: 30, border : '1px solid #333' }, cell: { background: '#777' } }; storiesOf('Grid', module).add('list', () => ( <div style={styles.container}> <Container> <Grid responsive={false}> <Cell ratio={1 / 2} margin="10px" > <div style={styles.cell}>Cell-1/2</div> </Cell> <Cell margin="10px"> <div style={styles.cell}>Cell-auto</div> </Cell> <Cell margin="10px"> <div style={styles.cell}>Cell-auto</div> </Cell> </Grid> <h3 style={{ marginTop: 30 }}>Responsive</h3> <Grid style={{ marginTop: 30 }}> <Cell offset={1 / 2} > <div style={styles.cell}>Cell-offset-1/2</div> </Cell> </Grid> <Grid style={{ marginTop: 30 }}> <Cell ratio={1 / 3} margin="10px" > <div style={styles.cell}>Cell-1/3</div> </Cell> <Cell margin="10px"> <div style={styles.cell}>Cell-auto</div> </Cell> <Cell ratio={1 / 4} margin="10px" > <div style={styles.cell}>Cell-1/4</div> </Cell> </Grid> <Grid style={{ marginTop: 30 }} align="bottom" > <Cell ratio={1 / 3} margin="10px" > <div style={styles.cell}>Cell-1/3</div> </Cell> <Cell margin="10px"> <div style={styles.cell}> h<br /> e<br /> l<br /> l<br /> o<br /> </div> </Cell> <Cell margin="10px" ratio={1 / 4} > <div style={styles.cell}>Cell-1/4</div> </Cell> </Grid> <Grid style={{ marginTop: 30 }}> <Cell ratio={1 / 3} align="center" margin="10px" > <div style={styles.cell}>Cell-1/3</div> </Cell> <Cell> <div style={styles.cell}> h<br /> e<br /> l<br /> l<br /> o<br /> </div> </Cell> <Cell ratio={1 / 4} align="bottom" margin="10px" > <div style={styles.cell}>Cell-1/4</div> </Cell> </Grid> </Container> </div> ));
app/test/setup.js
nhtera/react-starter
import React from 'react'; // eslint-disable-line no-unused-vars import chai, { expect } from 'chai'; import sinonChai from 'sinon-chai'; import sinon from 'sinon'; import chaiAsPromised from 'chai-as-promised'; import chaiEnzyme from 'chai-enzyme'; import { jsdom } from 'jsdom'; chai.use(sinonChai); chai.use(chaiAsPromised); chai.use(chaiEnzyme()); global.document = jsdom(''); global.window = document.defaultView; global.navigator = { userAgent: 'browser' }; global.React = React; global.expect = expect; global.sinon = sinon; global.fdescribe = (...args) => describe.only(...args); global.fit = (...args) => it.only(...args); window.matchMedia = window.matchMedia || function matchMedia() { return { matches: () => {}, addListener: () => {}, removeListener: () => {}, }; };
docs/src/app/components/pages/components/Badge/Page.js
spiermar/material-ui
import React from 'react'; import Title from 'react-title-component'; import CodeExample from '../../../CodeExample'; import PropTypeDescription from '../../../PropTypeDescription'; import MarkdownElement from '../../../MarkdownElement'; import badgeReadmeText from './README'; import BadgeExampleSimple from './ExampleSimple'; import badgeExampleSimpleCode from '!raw!./ExampleSimple'; import BadgeExampleContent from './ExampleContent'; import badgeExampleContentCode from '!raw!./ExampleContent'; import badgeCode from '!raw!material-ui/Badge/Badge'; const descriptions = { simple: 'Two examples of badges containing text, using primary and secondary colors. ' + 'The badge is applied to its children - an icon for the first example, and an ' + '[Icon Button](/#/components/icon-button) with tooltip for the second.', further: 'Badges containing an [Icon Button](/#/components/icon-button) and text, ' + 'applied to an icon, and text.', }; const BadgePage = () => ( <div> <Title render={(previousTitle) => `Badge - ${previousTitle}`} /> <MarkdownElement text={badgeReadmeText} /> <CodeExample title="Simple examples" description={descriptions.simple} code={badgeExampleSimpleCode} > <BadgeExampleSimple /> </CodeExample> <CodeExample title="Further examples" description={descriptions.further} code={badgeExampleContentCode} > <BadgeExampleContent /> </CodeExample> <PropTypeDescription code={badgeCode} /> </div> ); export default BadgePage;
index.android.js
ChenLi0830/RN-Auth
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View } from 'react-native'; import App from './src/App'; AppRegistry.registerComponent('RN_Auth', () => App);
blueocean-material-icons/src/js/components/svg-icons/communication/import-export.js
kzantow/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const CommunicationImportExport = (props) => ( <SvgIcon {...props}> <path d="M9 3L5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3z"/> </SvgIcon> ); CommunicationImportExport.displayName = 'CommunicationImportExport'; CommunicationImportExport.muiName = 'SvgIcon'; export default CommunicationImportExport;
springboot/GReact/src/main/resources/static/app/routes/forms/jcrop/components/FieldInput.js
ezsimple/java
import React from 'react' import {connect} from 'react-redux' import {cropFieldChange} from '../actions/crop' import Field from './Field' const mapStateToProps = (state, ownProps)=> { return { field: ownProps.field, value: state.crop[ownProps.field] } }; const mapDispatchToProps = (dispatch, ownProps) =>({ onFieldChange: value => { dispatch(cropFieldChange(ownProps.field, value)) } }); const FieldInput = connect(mapStateToProps, mapDispatchToProps)(Field) export default FieldInput
src/scripts/components/avatar/Avatar.component.story.js
kodokojo/kodokojo-ui-commons
/** * Kodo Kojo - Software factory done right * Copyright © 2017 Kodo Kojo ([email protected]) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react' import { storiesOf, action } from '@kadira/storybook' // contexte import configureStore from '../../store/configureStore' // component to story import Avatar from './Avatar.component' const initialState = {} const store = configureStore(initialState) storiesOf('Avatar', module) .add('default', () => ( <Avatar store={store} > AL </Avatar> ))
fields/types/textarea/TextareaFilter.js
geminiyellow/keystone
import _ from 'underscore'; import classNames from 'classnames'; import React from 'react'; import { FormField, FormInput, FormSelect } from 'elemental'; const CONTROL_OPTIONS = [ { label: 'Matches', value: 'matches' }, { label: 'Contains', value: 'contains' }, { label: 'Begins with', value: 'beginsWith' }, { label: 'Ends with', value: 'endsWith' }, { label: 'Is', value: 'is' }, { label: 'Is not', value: 'isNot' } ]; var TextareaFilter = React.createClass({ getInitialState () { return { modeValue: CONTROL_OPTIONS[0].value, // 'matches' modeLabel: CONTROL_OPTIONS[0].label, // 'Matches' value: '' }; }, componentDidMount () { // focus the text input React.findDOMNode(this.refs.input).focus(); }, toggleMode (mode) { // TODO: implement w/o underscore this.setState({ modeValue: mode, modeLabel: _.findWhere(CONTROL_OPTIONS, { value: mode }).label }); // focus the text input after a mode selection is made React.findDOMNode(this.refs.input).focus(); }, renderMode () { // JM: this toggle looks good but is very limited // restricted to the width of the popup (wrapping looks terrible) // no support for multi selection // i've opted for a simple select // @jedwatson thoughts? let containClass = classNames('popout__toggle__action', { 'is-selected': this.state.mode === 'partial' }); let matchClass = classNames('popout__toggle__action', { 'is-selected': this.state.mode === 'match' }); return ( <div className="popout__toggle"> <span className="popout__toggle__item"> <button type="button" onClick={() => { this.toggleMode('partial'); }} className={containClass}>Contains</button> </span> <span className="popout__toggle__item"> <button type="button" onClick={() => { this.toggleMode('match'); }} className={matchClass}>Matches</button> </span> </div> ); }, render () { let { field } = this.props; let { modeLabel, modeValue } = this.state; let placeholder = field.label + ' ' + modeLabel.toLowerCase() + '...'; return ( <div> <FormSelect options={CONTROL_OPTIONS} onChange={this.toggleMode} value={modeValue} /> <FormField> <FormInput ref="input" placeholder={placeholder} /> </FormField> </div> ); } }); module.exports = TextareaFilter;
src/svg-icons/notification/network-check.js
tan-jerene/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NotificationNetworkCheck = (props) => ( <SvgIcon {...props}> <path d="M15.9 5c-.17 0-.32.09-.41.23l-.07.15-5.18 11.65c-.16.29-.26.61-.26.96 0 1.11.9 2.01 2.01 2.01.96 0 1.77-.68 1.96-1.59l.01-.03L16.4 5.5c0-.28-.22-.5-.5-.5zM1 9l2 2c2.88-2.88 6.79-4.08 10.53-3.62l1.19-2.68C9.89 3.84 4.74 5.27 1 9zm20 2l2-2c-1.64-1.64-3.55-2.82-5.59-3.57l-.53 2.82c1.5.62 2.9 1.53 4.12 2.75zm-4 4l2-2c-.8-.8-1.7-1.42-2.66-1.89l-.55 2.92c.42.27.83.59 1.21.97zM5 13l2 2c1.13-1.13 2.56-1.79 4.03-2l1.28-2.88c-2.63-.08-5.3.87-7.31 2.88z"/> </SvgIcon> ); NotificationNetworkCheck = pure(NotificationNetworkCheck); NotificationNetworkCheck.displayName = 'NotificationNetworkCheck'; NotificationNetworkCheck.muiName = 'SvgIcon'; export default NotificationNetworkCheck;
node_modules/@material-ui/styles/es/StylesProvider/StylesProvider.js
pcclarke/civ-techs
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; import React from 'react'; import PropTypes from 'prop-types'; import warning from 'warning'; import { exactProp } from '@material-ui/utils'; import createGenerateClassName from '../createGenerateClassName'; import { create } from 'jss'; import jssPreset from '../jssPreset'; // Default JSS instance. const jss = create(jssPreset()); // Use a singleton or the provided one by the context. // // The counter-based approach doesn't tolerate any mistake. // It's much safer to use the same counter everywhere. const generateClassName = createGenerateClassName(); // Exported for test purposes export const sheetsManager = new Map(); const defaultOptions = { disableGeneration: false, generateClassName, jss, sheetsCache: null, sheetsManager, sheetsRegistry: null }; export const StylesContext = React.createContext(defaultOptions); let injectFirstNode; function StylesProvider(props) { const { children, injectFirst } = props, localOptions = _objectWithoutPropertiesLoose(props, ["children", "injectFirst"]); const outerOptions = React.useContext(StylesContext); const context = _extends({}, outerOptions, localOptions); process.env.NODE_ENV !== "production" ? warning(typeof window !== 'undefined' || context.sheetsManager, 'Material-UI: you need to use the ServerStyleSheets API when rendering on the server.') : void 0; process.env.NODE_ENV !== "production" ? warning(!context.jss.options.insertionPoint || !injectFirst, 'Material-UI: you cannot use a custom insertionPoint and <StylesContext injectFirst> at the same time.') : void 0; process.env.NODE_ENV !== "production" ? warning(!injectFirst || !localOptions.jss, 'Material-UI: you cannot use the jss and injectFirst props at the same time.') : void 0; if (!context.jss.options.insertionPoint && injectFirst && typeof window !== 'undefined') { if (!injectFirstNode) { const head = document.head; injectFirstNode = document.createComment('mui-inject-first'); head.insertBefore(injectFirstNode, head.firstChild); } context.jss = create({ plugins: jssPreset().plugins, insertionPoint: injectFirstNode }); } return React.createElement(StylesContext.Provider, { value: context }, children); } process.env.NODE_ENV !== "production" ? StylesProvider.propTypes = { /** * Your component tree. */ children: PropTypes.node.isRequired, /** * You can disable the generation of the styles with this option. * It can be useful when traversing the React tree outside of the HTML * rendering step on the server. * Let's say you are using react-apollo to extract all * the queries made by the interface server-side - you can significantly speed up the traversal with this prop. */ disableGeneration: PropTypes.bool, /** * JSS's class name generator. */ generateClassName: PropTypes.func, /** * By default, the styles are injected last in the <head> element of the page. * As a result, they gain more specificity than any other style sheet. * If you want to override Material-UI's styles, set this prop. */ injectFirst: PropTypes.bool, /** * JSS's instance. */ jss: PropTypes.object, /** * @ignore */ serverGenerateClassName: PropTypes.func, /** * @ignore * * Beta feature. * * Cache for the sheets. */ sheetsCache: PropTypes.object, /** * @ignore * * The sheetsManager is used to deduplicate style sheet injection in the page. * It's deduplicating using the (theme, styles) couple. * On the server, you should provide a new instance for each request. */ sheetsManager: PropTypes.object, /** * @ignore * * Collect the sheets. */ sheetsRegistry: PropTypes.object } : void 0; if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== "production" ? StylesProvider.propTypes = exactProp(StylesProvider.propTypes) : void 0; } StylesProvider.defaultProps = { disableGeneration: false, injectFirst: false }; export default StylesProvider;
packages/strapi-admin/files/public/app/components/LeftMenuLinkContainer/index.js
lucusteen/strap
/** * * LeftMenuLinkContainer * */ import React from 'react'; import LeftMenuLink from 'components/LeftMenuLink'; import styles from './styles.scss'; class LeftMenuLinkContainer extends React.Component { // eslint-disable-line react/prefer-stateless-function render() { // List of links let links = this.props.plugins.valueSeq().map((plugin) => ( <LeftMenuLink key={plugin.get('id')} icon={plugin.get('icon') || 'fa-plug'} label={plugin.get('name')} destination={`/plugins/${plugin.get('id')}`} leftMenuLinks={plugin.get('leftMenuLinks')} /> )); // Check if the plugins list is empty or not if (!links.size) { links = <span className={styles.noPluginsInstalled}>No plugins installed yet.</span>; } return ( <div className={styles.leftMenuLinkContainer}> <p className={styles.title}>Plugins</p> <ul className={styles.list}> {links} </ul> <p className={styles.title}>General</p> <ul className={styles.list}> <LeftMenuLink icon="fa-cubes" label="List plugins" destination="/list-plugins" /> <LeftMenuLink icon="fa-download" label="Install new plugin" destination="/install-plugin" /> <LeftMenuLink icon="fa-gear" label="Configuration" destination="/configuration" /> </ul> </div> ); } } LeftMenuLinkContainer.propTypes = { plugins: React.PropTypes.object, params: React.PropTypes.object, }; export default LeftMenuLinkContainer;
src/routes/admin/Admin.js
binyuace/vote
/** * 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 PropTypes from 'prop-types'; import withStyles from 'isomorphic-style-loader/lib/withStyles'; import s from './Admin.css'; class Admin extends React.Component { static propTypes = { title: PropTypes.string.isRequired, }; render() { return ( <div className={s.root}> <div className={s.container}> <h1> {this.props.title} </h1> <p>...</p> </div> </div> ); } } export default withStyles(s)(Admin);
src/common-ui/components/IndexDropdownNewRow.js
WorldBrain/WebMemex
import React from 'react' import PropTypes from 'prop-types' import IndexDropdownRow from './IndexDropdownRow' const IndexDropdownNewRow = ({ value, isNew = true, ...props }) => ( <IndexDropdownRow {...props} value={<span>{value}</span>} isNew /> ) IndexDropdownNewRow.propTypes = { value: PropTypes.string.isRequired, isNew: PropTypes.bool, } export default IndexDropdownNewRow
src/app/development/trc/PermitTypeCards.js
cityofasheville/simplicity2
import React from 'react'; import PermitTypeCard from './PermitTypeCard'; import { trcProjectTypes } from './textContent'; const PermitTypeCards = () => { let cardWidth = '40%'; if (window.innerWidth < 500) { cardWidth = '90%'; } return ( <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'stretch', flexWrap: 'wrap', }} > {Object.keys(trcProjectTypes).map(type => ( <div style={{ width: cardWidth, flexGrow: 1, margin: '0.25em', top: '0px', }} className={type} key={`card-${type}`} > <PermitTypeCard type={type} /> </div> ))} </div> ); }; export default PermitTypeCards;
src/App.js
kade042/flux-bank-account-app
import React, { Component } from 'react'; import { render } from 'react-dom'; import { Container } from 'flux/utils'; import BankRewardsStore from './BankRewardsStore'; import BankBalanceStore from './BankBalanceStore'; import BankActions from './BankActions'; class App extends Component { constructor() { super(...arguments); BankActions.createAccount(); } deposit() { BankActions.depositIntoAccount(Number(this.refs.amount.value)); this.refs.amount.value = ''; } withdrew() { BankActions.withdrewFromAccount(Number(this.refs.amount.value)); this.refs.amount.value = ''; } render() { return ( <div> <header>FluxTrust Bank</header> <h1>Your balance is $ {(this.state.balance).toFixed(2)}</h1> <h2>Your Points Rewards Tier is {this.state.rewardsTier}</h2> <div className='atm'> <input type='text' placeholder='Enter Amount' ref='amount' /> <br /> <button onClick={this.withdrew.bind(this)}>Withdrew</button> <button onClick={this.deposit.bind(this)}>Deposit</button> </div> </div> ); } } App.getStores = ()=>([BankBalanceStore, BankRewardsStore]); App.calculateState = (prevState) => ({ balance: BankBalanceStore.getState(), rewardsTier: BankRewardsStore.getState(), }); const AppContainer = Container.create(App); render(<AppContainer />, document.getElementById('root'));
src/components/ProductForm.js
ihenvyr/react-parse
import React from 'react'; import Grid from 'grid-styled'; import Input from './Input'; import Textarea from './Textarea'; import Select from './Select'; import Label from './Label'; import Button from './Button'; const ProductForm = ({ brands, children, create, update, cancel, router }) => { const onSubmit = (event) => { event.preventDefault(); if (create) { create({ name: event.target.name.value, brand_id: event.target.brand.value, size: event.target.size.value, color: event.target.color.value, quantity: parseInt(event.target.quantity.value || 0), cost: parseFloat(event.target.cost.value || 0), price: parseFloat(event.target.price.value || 0), categories: event.target.categories.value, images: event.target.images.files, description: event.target.description.value, }).then(() => { router.push('/products'); }); } if (update) { update(); } }; return ( <form onSubmit={onSubmit}> <Grid lg={4/12}> <Label htmlFor="name">name</Label> <Input id="name" type="text" name="name" placeholder=""/> </Grid> <Grid lg={2/12}> <Label htmlFor="brand">brand</Label> <Select id="brand" name="brand"> { Object.keys(brands).map(id => <option value={id} key={id}>{brands[id].name}</option>) } </Select> </Grid> <Grid lg={2/12}> <Label htmlFor="size">size</Label> <Input id="size" type="text" name="size" placeholder=""/> </Grid> <Grid lg={2/12}> <Label htmlFor="color">color</Label> <Input id="color" type="text" name="color" placeholder=""/> </Grid> <Grid lg={2/12}> <Label htmlFor="quantity">quantity</Label> <Input id="quantity" type="number" name="quantity" placeholder=""/> </Grid> <Grid lg={2/12}> <Label htmlFor="cost">cost</Label> <Input id="cost" type="number" name="cost" placeholder=""/> </Grid> <Grid lg={2/12}> <Label htmlFor="price">price</Label> <Input id="price" type="number" name="price" placeholder=""/> </Grid> <Grid lg={4/12}> <Label htmlFor="categories">categories</Label> <Select id="categories" name="categories"> <option value=""></option> </Select> </Grid> <Grid lg={2/12}> <Label htmlFor="images">images</Label> <input id="images" type="file" name="images" multiple="multiple"/> </Grid> <Grid lg={12/12}> <Label htmlFor="description">description</Label> <Textarea id="description" name="description" rows="5" placeholder=""/> </Grid> <Grid lg={2/12}> <p>{children}</p> </Grid> <Grid lg={2/12}> <p><Button block type="Button" onClick={cancel}>Cancel</Button></p> </Grid> </form> ); }; ProductForm.propTypes = { children: React.PropTypes.node.isRequired, create: React.PropTypes.func, update: React.PropTypes.func, cancel: React.PropTypes.func, }; ProductForm.defaultProps = { cancel: () => {}, }; export default ProductForm;
packages/lore-react-forms-material-ui/src/fields/string.js
lore/lore-forms
import React from 'react'; import _ from 'lodash'; import { Field } from 'lore-react-forms'; import { TextField } from 'material-ui'; export default function(form, props, name) { return ( <Field name={name}> {(field) => { return ( <TextField name={field.name} value={field.value} onChange={field.onChange} onFocus={field.onFocus} onBlur={field.onBlur} errorText={field.touched && field.error} style={{ width: '100%' }} {...props} /> ) }} </Field> ); }
src/router.js
HuangXingBin/goldenEast
import React from 'react'; import { Router, Route, browserHistory, IndexRedirect, IndexRoute, hashHistory, Redirect } from 'react-router'; //首页,数据总览 import HomeContainer from './components/containers/home-container'; //用户列表 import UserListContainer from './components/containers/user-list-container'; import UserDetailContainer from './components/containers/user-detail-container'; // 红包列表 import HongBaoListContainer from './components/containers/hongbao-list-container'; // Layouts import MainLayout from './components/layouts/main-layout'; // Route base import { routeBase } from './appConstants/urlConfig'; // 交易列表 // 川商大盘交易列表 import ChuanShangBoardMarketContainer from './components/containers/chuan-shang-board-market-container'; // 深文所大盘 import ShenWenSuoBoardMarketContainer from './components/containers/shen-wen-suo-board-market-container'; import TradingParticularsContainer from './components/containers/trading-particulars-container'; // 深文所微盘 import ShenWenSuoMicroBoardContainer from './components/containers/shen-wen-suo-micro-board-container'; // 吉商微盘 import jiShangMicroBoardContainer from './components/containers/ji-shang-micro-board-container'; // 粤国际微盘 import yueGuoJiMicroBoardContainer from './components/containers/yue-guo-ji-micro-board-container'; //川商邮币卡 import ChuanShangPostCardContainer from './components/containers/chuan-shang-post-card-container'; //吉商邮币卡 import JiShangPostCardContainer from './components/containers/ji-shang-post-card-container'; // 佣金列表 // 大盘佣金列表 import BoardMarketBrokerageContainer from './components/containers/board-market-brokerage-container'; // 微盘佣金列表 import MicroBoardBrokerageContainer from './components/containers/micro-board-brokerage-container'; // 邮币卡佣金列表 import PostCardBrokerageContainer from './components/containers/post-card-brokerage-container'; // 大盘个人佣金详情列表 import BoardMarketBrokerageGainDetailsContainer from './components/containers/board-market-brokerage-gain-details-container'; // 微盘个人佣金详情列表 import MicroBoardBrokerageGainDetailsContainer from './components/containers/micro-board-brokerage-gain-details-container'; // 邮币卡佣金佣金详情列表 import PostCardBrokerageGainDetailsContainer from './components/containers/board-market-brokerage-gain-details-container'; // 信息资产列表 import InfoAssetAllotListContainer from './components/containers/info-asset-allot-list-container'; // 已获信息资产列表 import GainInfoAssetAllotListContainer from './components/containers/gain-info-asset-allot-list-container'; // 设置权限页面 import setAuthorizationView from './components/views/set-follower-authorization'; // 居间商已授权用户(包括小金和客服) import AuthorUserListContainer from './components/containers/author-user-list-container'; // 居间商已授权用户(包括小金和客服) import AllotUserListContainer from './components/containers/allot-user-list-container'; //当月注册量与激活量 import RegisterActiveContainer from './components/containers/register-active-container'; //下载中心 import DownloadContainer from './components/containers/download-list-container'; import ShenWenSuoVoucherContainer from './components/containers/shen-wen-suo-voucher-container'; //名下用户信息 import UnderUserTreeContainer from './components/containers/under-user-tree-container'; import UnderUserContainer from './components/containers/under-user-container'; //获得当前代理商旗下的某个代理商本月的手续费详情列表 import JjsCurrentPoundageContainer from './components/containers/jjs-current-poundage-detail'; //获得当前代理商旗下的某个代理商上月的手续费详情列表 import JjsLastPoundageContainer from './components/containers/jjs-last-poundage-detail'; //开户进度 import OpenAccountProgressContainer from './components/containers/open-account-progress-container'; //太平洋保险 import TaiPingYangInsuranceContainer from './components/containers/insurance/taipingyang-insurance-container'; export default ( <Router history={hashHistory}> <Route path={routeBase} component={MainLayout} > <IndexRedirect to={routeBase + 'home'} /> <Route breadcrumbName="数据总览" path={routeBase + 'home'} component={HomeContainer} /> <Route name="user_list" breadcrumbName="用户列表" path={routeBase + 'user_list'} component={UserListContainer} > <Route breadcrumbName="个人详情" path="user_detail/:userId" component={UserDetailContainer} /> </Route> <Route name="hongbao_list" breadcrumbName="红包列表" path={routeBase + 'hongbao_list'} component={HongBaoListContainer} > </Route> <Route breadcrumbName="名下用户信息" path={routeBase + 'under_user_tree'} component={UnderUserTreeContainer} /> <Route breadcrumbName="名下用户信息" path={routeBase + 'under_user_tree'} component={UnderUserTreeContainer} > <Route breadcrumbName="个人详情" path="user_detail/:userId" component={UserDetailContainer} /> </Route> <Route breadcrumbName="一度人脉列表" path={routeBase + 'under_user'} component={UnderUserContainer} /> <Route breadcrumbName="旗下代理商数据" path={routeBase + 'register_active'} component={RegisterActiveContainer}> <Route breadcrumbName="当月手续费详情" path='current_poundage/:jjsid' component={JjsCurrentPoundageContainer}/> <Route breadcrumbName="上月手续费详情" path='last_poundage/:jjsid' component={JjsLastPoundageContainer}/> </Route> <Route name="allot_user_list" breadcrumbName="分配用户权限" path={routeBase + 'allot_user_list'} component={AllotUserListContainer} > <Route breadcrumbName="权限设置" path="set_authorization/:userSn" component={setAuthorizationView} /> </Route> <Route name="author_user_list" breadcrumbName="已授权用户列表" path={routeBase + 'author_user_list'} component={AuthorUserListContainer} > <Route breadcrumbName="个人详情" path="author_user_detail/:userSn" component={UserDetailContainer} /> <Route breadcrumbName="权限设置" path="set_authorization/:userSn" component={setAuthorizationView} /> </Route> {/*交易列表*/} <Route breadcrumbName="川商大盘交易列表" path={routeBase + 'chuan_shang_board_market'} component={ChuanShangBoardMarketContainer} > <Route breadcrumbName="个人交易详情" path="trading_particulars/:marketName/:userSn" component={TradingParticularsContainer} /> </Route> <Route breadcrumbName="深文所大盘交易列表" path={routeBase + 'shen_wen_suo_board_market'} component={ShenWenSuoBoardMarketContainer} > <Route breadcrumbName="个人交易详情" path="trading_particulars/:marketName/:userSn" component={TradingParticularsContainer} /> </Route> <Route breadcrumbName="深文所微盘交易列表" path={routeBase + 'shenwensuo_wp'} component={ShenWenSuoMicroBoardContainer} > <Route breadcrumbName="个人交易详情" path="trading_particulars/:marketName/:userSn" component={TradingParticularsContainer} /> </Route> <Route breadcrumbName="吉商微盘交易列表" path={routeBase + 'jishang_wp'} component={jiShangMicroBoardContainer} > <Route breadcrumbName="个人交易详情" path="trading_particulars/:marketName/:userSn" component={TradingParticularsContainer} /> </Route> <Route breadcrumbName="粤国际微盘交易列表" path={routeBase + 'yueguoji_wp'} component={yueGuoJiMicroBoardContainer} > <Route breadcrumbName="个人交易详情" path="trading_particulars/:marketName/:userSn" component={TradingParticularsContainer} /> </Route> <Route breadcrumbName="川商邮币卡交易列表" path={routeBase + 'chuan_shang_post_card'} component={ChuanShangPostCardContainer} > <Route breadcrumbName="个人交易详情" path="trading_particulars/:marketName/:userSn" component={TradingParticularsContainer} /> </Route> <Route breadcrumbName="吉商邮币卡交易列表" path={routeBase + 'ji_shang_post_card'} component={JiShangPostCardContainer} > <Route breadcrumbName="个人交易详情" path="trading_particulars/:marketName/:userSn" component={TradingParticularsContainer} /> </Route> <Route breadcrumbName="太平洋保险交易列表" path={routeBase + 'taipingyang_insurance'} component={TaiPingYangInsuranceContainer} /> {/*佣金列表*/} <Route name="board_market_brokerage" breadcrumbName="大盘佣金列表" path={routeBase + 'board_market_brokerage'} component={BoardMarketBrokerageContainer} > <Route breadcrumbName="佣金获得详情" path="board_market_brokerage_gain_details/:details/:transactionStart/:transactionEnd" component={BoardMarketBrokerageGainDetailsContainer} /> </Route> <Route name="wp_brokerage" breadcrumbName="微盘佣金列表" path={routeBase + 'wp_brokerage'} component={MicroBoardBrokerageContainer} > <Route breadcrumbName="佣金获得详情" path="wp_brokerage_gain_details/:details2/:transactionStart2/:transactionEnd2" component={MicroBoardBrokerageGainDetailsContainer} /> </Route> <Route breadcrumbName="邮币卡佣金列表" path={routeBase + 'post_card_brokerage'} component={PostCardBrokerageContainer} > <Route breadcrumbName="佣金获得详情" path="post_card_brokerage_gain_details/:details3" component={PostCardBrokerageGainDetailsContainer} /> </Route> <Route path={routeBase + 'set_authorization'} component={setAuthorizationView} /> <Route breadcrumbName="大盘、邮币卡开户进度" path={routeBase + 'open_account_progress'} component={OpenAccountProgressContainer} /> <Route breadcrumbName="信息资产列表" path={routeBase + 'info_asset_allot_list'} component={InfoAssetAllotListContainer} /> <Route breadcrumbName="已获得信息资产列表" path={routeBase + 'gain_info_asset_allot_list'} component={GainInfoAssetAllotListContainer} /> <Route breadcrumbName="深文所入金送体验券列表" path={routeBase + 'shen_wen_suo_voucher_list'} component={ShenWenSuoVoucherContainer} /> <Route breadcrumbName="下载中心" path={routeBase + 'download_center_list'} component={DownloadContainer} /> </Route> </Router> )
src/main/Main.js
corbig/AfterWorkManager
import React, { Component } from 'react'; //import logo from './logo.svg'; //import './App.css'; import AppToolbar from '../header/AppToolbar' import getMuiTheme from 'material-ui/styles/getMuiTheme' import AutoComplete from 'material-ui/AutoComplete'; import injectTapEventPlugin from 'react-tap-event-plugin'; import Divider from 'material-ui/Divider'; import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card'; import Paper from 'material-ui/Paper'; import Subheader from 'material-ui/Subheader'; import MapsLocalDrink from 'material-ui/svg-icons/maps/local-drink'; import AWThumb from './components/AWThumb' import { connect } from 'react-redux' import { changeCurrentSoiree } from './actions/main-actions.js'; import { browserHistory } from 'react-router'; import { push } from 'react-router-redux' import AWAddSoiree from './components/AWAddSoiree.js' import RaisedButton from 'material-ui/RaisedButton'; import Delete from 'material-ui/svg-icons/action/delete'; import Search from 'material-ui/svg-icons/action/search'; const searchStyle = { marginTop : 50, width: "60%", position:'relative', left:'18%', fontSize: 20 } const dividerStyle = { marginTop : 70, textAlign : 'left' } const cardStyle = { maxHeight: 300, maxWidth: 300, margin: 'auto', textAlign: 'center', display: 'inline-block', } const recentlyStyle = { display: "flex", /* contexte sur le parent */ marginTop : 10 } const deleteStyle = { position : 'relative', float : 'right', bottom: 40, right : 10 } const mapStateToProps = (store) => { return { soirees : store.mainState.soirees } } const mapDispatchToProps = (dispatch) => { return { changeSoiree : (index)=>{ dispatch(changeCurrentSoiree(index)); dispatch(push('/board')); } } } export class Main extends React.Component { constructor(props) { super(props); this.state = { delete : false, searchText : "" }; console.log(this.state.searchText) } enableDelete = () => { this.setState({delete : true}); } disableDelete = () => { this.setState({delete : false}); } componentWillMount(){ this.props.setCurrentPage("main") } handleUpdateInput = (searchText) =>{ this.setState({searchText}) } render() { return ( <div> <img src={require("../images/AfterWork.png")} style={{width:350,height:300,marginTop:50,position:'relative', left:'40%'}}/> <p className="App-intro"> <AutoComplete textFieldStyle = {searchStyle} style={searchStyle} hintText="Rechercher une soirée ..." dataSource = {[]} onUpdateInput={this.handleUpdateInput} /> <Search style={{width:60,height:60,float:'left',position :'relative',left:'29%',top:'100'}}/> <div style={dividerStyle}> <Subheader><h4> <img src={require("../images/coupe_de_champ.png")} style={{width:27,height:37}}/> Prochaines soirées</h4> </Subheader> { this.state.delete ? <RaisedButton icon = {<Delete/>} secondary={true} style = {deleteStyle} onTouchTap = {this.disableDelete}/> : <RaisedButton icon = {<Delete/>} primary={true} style = {deleteStyle} onTouchTap = {this.enableDelete}/> } <Divider inset={false} /> </div> <div style={recentlyStyle}> { this.props.soirees.map((soiree,index)=> (this.state.searchText === "" || soiree.title.toLowerCase().includes(this.state.searchText.toLowerCase())) ? <AWThumb {...soiree} index = {index} changeSoiree = {this.props.changeSoiree} delete = {this.state.delete} /> : null ) } </div> </p> <AWAddSoiree/> </div> ); } } export default connect(mapStateToProps,mapDispatchToProps)(Main)
src/browser/auth/Social.js
robinpokorny/este
// @flow import type { State } from '../../common/types'; import React from 'react'; import buttonsMessages from '../../common/app/buttonsMessages'; import { FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { signIn } from '../../common/auth/actions'; import { Box, Button, } from '../app/components'; type SocialProps = { formDisabled: boolean, signIn: typeof signIn, }; const Social = ({ formDisabled, signIn }: SocialProps) => ( <Box> <Button disabled={formDisabled} onClick={() => signIn('facebook')} primary > <FormattedMessage {...buttonsMessages.facebookSignIn} /> </Button> </Box> ); export default connect( (state: State) => ({ formDisabled: state.auth.formDisabled, }), { signIn }, )(Social);
src/svg-icons/device/screen-lock-portrait.js
rscnt/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceScreenLockPortrait = (props) => ( <SvgIcon {...props}> <path d="M10 16h4c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1v-1c0-1.11-.9-2-2-2-1.11 0-2 .9-2 2v1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1zm.8-6c0-.66.54-1.2 1.2-1.2.66 0 1.2.54 1.2 1.2v1h-2.4v-1zM17 1H7c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 18H7V5h10v14z"/> </SvgIcon> ); DeviceScreenLockPortrait = pure(DeviceScreenLockPortrait); DeviceScreenLockPortrait.displayName = 'DeviceScreenLockPortrait'; export default DeviceScreenLockPortrait;
src/svg-icons/notification/power.js
pradel/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NotificationPower = (props) => ( <SvgIcon {...props}> <path d="M16.01 7L16 3h-2v4h-4V3H8v4h-.01C7 6.99 6 7.99 6 8.99v5.49L9.5 18v3h5v-3l3.5-3.51v-5.5c0-1-1-2-1.99-1.99z"/> </SvgIcon> ); NotificationPower = pure(NotificationPower); NotificationPower.displayName = 'NotificationPower'; export default NotificationPower;
node_modules/bs-recipes/recipes/webpack.react-transform-hmr/app/js/main.js
daychen/niceday
import React from 'react'; // It's important to not define HelloWorld component right in this file // because in that case it will do full page reload on change import HelloWorld from './HelloWorld.jsx'; React.render(<HelloWorld />, document.getElementById('react-root'));
src/Parser/Hunter/Survival/CONFIG.js
hasseboulen/WoWAnalyzer
import React from 'react'; import { Putro } from 'CONTRIBUTORS'; import SPECS from 'common/SPECS'; import Wrapper from 'common/Wrapper'; import Warning from 'common/Alert/Warning'; import CombatLogParser from './CombatLogParser'; import CHANGELOG from './CHANGELOG'; export default { // The people that have contributed to this spec recently. People don't have to sign up to be long-time maintainers to be included in this list. If someone built a large part of the spec or contributed something recently to that spec, they can be added to the contributors list. contributors: [Putro], // The WoW client patch this spec was last updated to be fully compatible with. patchCompatibility: '7.3.5', // Explain the status of this spec's analysis here. Try to mention how complete it is, and perhaps show links to places users can learn more. // If this spec's analysis does not show a complete picture please mention this in the `<Warning>` component. description: ( <Wrapper> Hey, I've been hard at work to make this analyzer as good as I can. You'll notice a lot of things are still missing, and these will be included as time passes as I work on getting everything in this analyzer module up to scratch. <br /> I hope that the suggestions and statistics will be helpful in improving your overall performance. Try and focus on improving only a few things at a time, until those become ingrained in your muscle memory so as to not be concentrating on many different things. <br /><br /> If you want to learn more about Survival Hunters, join the Hunter community on the Trueshot Lodge discord: <a href="https://discordapp.com/invite/trueshot" target="_blank" rel="noopener noreferrer">https://discordapp.com/invite/trueshot</a>. The <kbd>#Survival</kbd> channel has a lot of helpful people, and if you post your logs in <kbd>#log-reviews</kbd>, you can expect to get some good pointers for improvement from the community. The <kbd>#Survival</kbd> channel is also a great place to post feedback for this analyzer, as I'll be very likely to see it there. <br /><br />The best guide available currently is the guide on <a href="https://www.icy-veins.com/wow/survival-hunter-pve-dps-guide">Icy-Veins</a>. It is maintained by Azortharion, one of the best hunters in the world, and it is constantly fact-checked by community-members, and improved upon on an almost weekly basis.<br /><br /> <Warning> This spec's analysis isn't complete yet. What we do show should be good to use, but it does not show the complete picture.<br /> If there is something missing, incorrect, or inaccurate, please report it on <a href="https://github.com/WoWAnalyzer/WoWAnalyzer/issues/new">GitHub</a> or contact us on <a href="https://discord.gg/AxphPxU">Discord</a>. </Warning> </Wrapper> ), // A recent example report to see interesting parts of the spec. Will be shown on the homepage. // exampleReport: '/report/72t9vbcAqdpVRfBQ/12-Mythic+Garothi+Worldbreaker+-+Kill+(6:15)/Maxweii', // Don't change anything below this line; // The current spec identifier. This is the only place (in code) that specifies which spec this parser is about. spec: SPECS.SURVIVAL_HUNTER, // The contents of your changelog. changelog: CHANGELOG, // The CombatLogParser class for your spec. parser: CombatLogParser, // The path to the current directory (relative form project root). This is used for generating a GitHub link directly to your spec's code. path: __dirname, };
src/parser/shaman/elemental/modules/talents/EarthenRage.js
fyruna/WoWAnalyzer
import React from 'react'; import SPELLS from 'common/SPELLS'; import SpellIcon from 'common/SpellIcon'; import { formatNumber, formatPercentage } from 'common/format'; import Analyzer from 'parser/core/Analyzer'; import StatisticBox, { STATISTIC_ORDER } from 'interface/others/StatisticBox'; class EarthenRage extends Analyzer { damageGained = 0; constructor(...args) { super(...args); this.active = this.selectedCombatant.hasTalent(SPELLS.EARTHEN_RAGE_TALENT.id); } on_byPlayer_damage(event) { if (event.ability.guid !== SPELLS.EARTHEN_RAGE_DAMAGE.id) { return; } this.damageGained += event.amount; } get damagePercent() { return this.owner.getPercentageOfTotalDamageDone(this.damageGained); } get damagePerSecond() { return this.damageGained / (this.owner.fightDuration / 1000); } statistic() { return ( <StatisticBox icon={<SpellIcon id={SPELLS.EARTHEN_RAGE_TALENT.id} />} value={`${formatPercentage(this.damagePercent)} %`} label="Of total damage" tooltip={`Contributed ${formatNumber(this.damagePerSecond)} DPS (${formatNumber(this.damageGained)} total damage).`} /> ); } statisticOrder = STATISTIC_ORDER.OPTIONAL; } export default EarthenRage;
src/svg-icons/action/settings-input-hdmi.js
rscnt/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionSettingsInputHdmi = (props) => ( <SvgIcon {...props}> <path d="M18 7V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v3H5v6l3 6v3h8v-3l3-6V7h-1zM8 4h8v3h-2V5h-1v2h-2V5h-1v2H8V4z"/> </SvgIcon> ); ActionSettingsInputHdmi = pure(ActionSettingsInputHdmi); ActionSettingsInputHdmi.displayName = 'ActionSettingsInputHdmi'; export default ActionSettingsInputHdmi;
example/webpack-2/client/components/App.js
iansinnott/react-static-webpack-plugin
import React from 'react'; import { Link, IndexLink } from 'react-router'; import classnames from 'classnames/bind'; // Using CSS Modules so we assign the styles to a variable import s from './App.styl'; const cx = classnames.bind(s); import logo from './react-logo.png'; // Favicon link is in the template, this just makes webpack package it up for us import './favicon.ico'; export class Home extends React.Component { render() { return ( <div className={cx('testableModuleClassName')}> <div className={cx('siteTitle')}> <img src={logo} alt='React Logo' /> <h1>React Static Boilerplate</h1> </div> <p>Why React static?</p> <ul> <li><span className={s.hl}>Dev</span> friendly</li> <li><span className={cx('hl')}>User</span> friendly</li> <li><span className={cx('hl')}>SEO</span> friendly</li> </ul> </div> ); } } export class About extends React.Component { render() { return ( <div className={cx('page')}> <div className={cx('siteTitle')}> <h1>About Page</h1> </div> <p>Welcome to the about page...</p> </div> ); } } export class NotFound extends React.Component { render() { return ( <div className={cx('page')}> <h4>Not found</h4> </div> ); } } /** * NOTE: As of 2015-11-09 react-transform does not support a functional * component as the base compoenent that's passed to ReactDOM.render, so we * still use createClass here. */ export class App extends React.Component { static propTypes = { children: React.PropTypes.node, } render() { return ( <div className={cx('App')}> <nav className={cx('nav')}> <IndexLink to='/' activeClassName={cx('active')}>Home</IndexLink> <Link to='/about' activeClassName={cx('active')}>About</Link> </nav> {this.props.children} </div> ); } }
app/app/components/UrlGenerator/CampaignsSelect.js
lycha/masters-thesis
import React from 'react'; class CampaignsSelect extends React.Component { constructor(props) { super(props); this.displayName = 'CampaignsSelect'; } handleChange(e) { this.props.setCampaign(e.target.value); } render() { return ( <select required ref="utm_campaign" className="form-control" id="campaign" name="campaign" onChange={(e) => this.handleChange(e)}> <option value="">- choose campaign -</option> {this.props.campaigns.map((campaign, index)=>{ return ( <option value={campaign.slug} key={index}>{campaign.name}</option> ) })} </select> ); } } export default CampaignsSelect;
project/react-ant-multi-pages/src/pages/index/containers/AssetMgmt/Add/index.js
FFF-team/generator-earth
import React from 'react' import moment from 'moment' import { DatePicker, Button, Form, Input, Col } from 'antd' import BaseContainer from 'ROOT_SOURCE/base/BaseContainer' import request from 'ROOT_SOURCE/utils/request' import { mapMoment } from 'ROOT_SOURCE/utils/fieldFormatter' import Rules from 'ROOT_SOURCE/utils/validateRules' const FormItem = Form.Item export default Form.create()(class extends BaseContainer { /** * 提交表单 */ submitForm = (e) => { e && e.preventDefault() const { form } = this.props form.validateFieldsAndScroll(async (err, values) => { if (err) { return; } // 提交表单最好新一个事务,不受其他事务影响 await this.sleep() let _formData = { ...form.getFieldsValue() } // _formData里的一些值需要适配 _formData = mapMoment(_formData, 'YYYY-MM-DD HH:mm:ss') // action await request.post('/asset/addAsset', _formData) // 提交后返回list页 this.props.history.push(`${this.context.CONTAINER_ROUTE_PREFIX}/list`) }) } render() { let { form } = this.props let { getFieldDecorator } = form return ( <div className="ui-background"> <Form layout="inline" onSubmit={this.submitForm}> <FormItem label="资产方名称"> {getFieldDecorator('assetName', { rules: [{ required: true }] })(<Input/>)} </FormItem> <FormItem label="签约主体"> {getFieldDecorator('contract', { rules: [{ required: true }] })(<Input/>)} </FormItem> <FormItem label="签约时间"> {getFieldDecorator('contractDate', { rules: [{ type: 'object', required: true }] })(<DatePicker showTime format='YYYY年MM月DD HH:mm:ss' style={{ width: '100%' }}/>)} </FormItem> <FormItem label="联系人"> {getFieldDecorator('contacts')(<Input/>)} </FormItem> <FormItem label="联系电话" hasFeedback> {getFieldDecorator('contactsPhone', { rules: [{ pattern: Rules.phone, message: '无效' }] })(<Input maxLength="11"/>)} </FormItem> <FormItem> <Button type="primary" htmlType="submit"> 提交 </Button> </FormItem> <FormItem> <Button type="primary" onClick={e => window.history.back()}> 取消/返回 </Button> </FormItem> </Form> </div> ) } })
node_modules/react-bootstrap/es/HelpBlock.js
chenjic215/search-doctor
import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React from 'react'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var HelpBlock = function (_React$Component) { _inherits(HelpBlock, _React$Component); function HelpBlock() { _classCallCheck(this, HelpBlock); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } HelpBlock.prototype.render = function render() { var _props = this.props, className = _props.className, props = _objectWithoutProperties(_props, ['className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = getClassSet(bsProps); return React.createElement('span', _extends({}, elementProps, { className: classNames(className, classes) })); }; return HelpBlock; }(React.Component); export default bsClass('help-block', HelpBlock);
src/svg-icons/device/bluetooth-searching.js
barakmitz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceBluetoothSearching = (props) => ( <SvgIcon {...props}> <path d="M14.24 12.01l2.32 2.32c.28-.72.44-1.51.44-2.33 0-.82-.16-1.59-.43-2.31l-2.33 2.32zm5.29-5.3l-1.26 1.26c.63 1.21.98 2.57.98 4.02s-.36 2.82-.98 4.02l1.2 1.2c.97-1.54 1.54-3.36 1.54-5.31-.01-1.89-.55-3.67-1.48-5.19zm-3.82 1L10 2H9v7.59L4.41 5 3 6.41 8.59 12 3 17.59 4.41 19 9 14.41V22h1l5.71-5.71-4.3-4.29 4.3-4.29zM11 5.83l1.88 1.88L11 9.59V5.83zm1.88 10.46L11 18.17v-3.76l1.88 1.88z"/> </SvgIcon> ); DeviceBluetoothSearching = pure(DeviceBluetoothSearching); DeviceBluetoothSearching.displayName = 'DeviceBluetoothSearching'; DeviceBluetoothSearching.muiName = 'SvgIcon'; export default DeviceBluetoothSearching;
app/javascript/mastodon/features/ui/components/media_modal.js
pixiv/mastodon
import React from 'react'; import ReactSwipeableViews from 'react-swipeable-views'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import Video from '../../video'; import ExtendedVideoPlayer from '../../../components/extended_video_player'; import classNames from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; import IconButton from '../../../components/icon_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImageLoader from './image_loader'; const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, previous: { id: 'lightbox.previous', defaultMessage: 'Previous' }, next: { id: 'lightbox.next', defaultMessage: 'Next' }, }); @injectIntl export default class MediaModal extends ImmutablePureComponent { static propTypes = { media: ImmutablePropTypes.list.isRequired, index: PropTypes.number.isRequired, onClose: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; state = { index: null, navigationHidden: false, }; handleSwipe = (index) => { this.setState({ index: index % this.props.media.size }); } handleNextClick = () => { this.setState({ index: (this.getIndex() + 1) % this.props.media.size }); } handlePrevClick = () => { this.setState({ index: (this.props.media.size + this.getIndex() - 1) % this.props.media.size }); } handleChangeIndex = (e) => { const index = Number(e.currentTarget.getAttribute('data-index')); this.setState({ index: index % this.props.media.size }); } handleKeyUp = (e) => { switch(e.key) { case 'ArrowLeft': this.handlePrevClick(); break; case 'ArrowRight': this.handleNextClick(); break; } } componentDidMount () { window.addEventListener('keyup', this.handleKeyUp, false); } componentWillUnmount () { window.removeEventListener('keyup', this.handleKeyUp); } getIndex () { return this.state.index !== null ? this.state.index : this.props.index; } toggleNavigation = () => { this.setState(prevState => ({ navigationHidden: !prevState.navigationHidden, })); }; render () { const { media, intl, onClose } = this.props; const { navigationHidden } = this.state; const index = this.getIndex(); let pagination = []; const leftNav = media.size > 1 && <button tabIndex='0' className='media-modal__nav media-modal__nav--left' onClick={this.handlePrevClick} aria-label={intl.formatMessage(messages.previous)}><i className='fa fa-fw fa-chevron-left' /></button>; const rightNav = media.size > 1 && <button tabIndex='0' className='media-modal__nav media-modal__nav--right' onClick={this.handleNextClick} aria-label={intl.formatMessage(messages.next)}><i className='fa fa-fw fa-chevron-right' /></button>; if (media.size > 1) { pagination = media.map((item, i) => { const classes = ['media-modal__button']; if (i === index) { classes.push('media-modal__button--active'); } return (<li className='media-modal__page-dot' key={i}><button tabIndex='0' className={classes.join(' ')} onClick={this.handleChangeIndex} data-index={i}>{i + 1}</button></li>); }); } const content = media.map((image) => { const width = image.getIn(['meta', 'original', 'width']) || null; const height = image.getIn(['meta', 'original', 'height']) || null; if (image.get('type') === 'image') { return ( <ImageLoader previewSrc={image.get('preview_url')} src={image.get('url')} width={width} height={height} alt={image.get('description')} key={image.get('url')} onClick={this.toggleNavigation} /> ); } else if (image.get('type') === 'video') { const { time } = this.props; return ( <Video preview={image.get('preview_url')} src={image.get('url')} width={image.get('width')} height={image.get('height')} startTime={time || 0} onCloseVideo={onClose} detailed description={image.get('description')} key={image.get('url')} /> ); } else if (image.get('type') === 'gifv') { return ( <ExtendedVideoPlayer src={image.get('url')} muted controls={false} width={width} height={height} key={image.get('preview_url')} alt={image.get('description')} onClick={this.toggleNavigation} /> ); } return null; }).toArray(); // you can't use 100vh, because the viewport height is taller // than the visible part of the document in some mobile // browsers when it's address bar is visible. // https://developers.google.com/web/updates/2016/12/url-bar-resizing const swipeableViewsStyle = { width: '100%', height: '100%', }; const containerStyle = { alignItems: 'center', // center vertically }; const navigationClassName = classNames('media-modal__navigation', { 'media-modal__navigation--hidden': navigationHidden, }); return ( <div className='modal-root__modal media-modal'> <div className='media-modal__closer' role='presentation' onClick={onClose} > <ReactSwipeableViews style={swipeableViewsStyle} containerStyle={containerStyle} onChangeIndex={this.handleSwipe} onSwitching={this.handleSwitching} index={index} > {content} </ReactSwipeableViews> </div> <div className={navigationClassName}> <IconButton className='media-modal__close' title={intl.formatMessage(messages.close)} icon='times' onClick={onClose} size={40} /> {leftNav} {rightNav} <ul className='media-modal__pagination'> {pagination} </ul> </div> </div> ); } }
src/svg-icons/communication/comment.js
hwo411/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let CommunicationComment = (props) => ( <SvgIcon {...props}> <path d="M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4-.01-18zM18 14H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"/> </SvgIcon> ); CommunicationComment = pure(CommunicationComment); CommunicationComment.displayName = 'CommunicationComment'; CommunicationComment.muiName = 'SvgIcon'; export default CommunicationComment;
node_modules/react-native/Libraries/Image/Image.ios.js
Helena-High/school-app
/** * 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 Image * @flow */ 'use strict'; const EdgeInsetsPropType = require('EdgeInsetsPropType'); const ImageResizeMode = require('ImageResizeMode'); const ImageSourcePropType = require('ImageSourcePropType'); const ImageStylePropTypes = require('ImageStylePropTypes'); const NativeMethodsMixin = require('react/lib/NativeMethodsMixin'); const NativeModules = require('NativeModules'); const PropTypes = require('react/lib/ReactPropTypes'); const React = require('React'); const ReactNativeViewAttributes = require('ReactNativeViewAttributes'); const StyleSheet = require('StyleSheet'); const StyleSheetPropType = require('StyleSheetPropType'); const flattenStyle = require('flattenStyle'); const requireNativeComponent = require('requireNativeComponent'); const resolveAssetSource = require('resolveAssetSource'); const ImageViewManager = NativeModules.ImageViewManager; /** * A React component for displaying different types of images, * including network images, static resources, temporary local images, and * images from local disk, such as the camera roll. * * This example shows both fetching and displaying an image from local storage as well as on from * network. * * ```ReactNativeWebPlayer * import React, { Component } from 'react'; * import { AppRegistry, View, Image } from 'react-native'; * * class DisplayAnImage extends Component { * render() { * return ( * <View> * <Image * source={require('./img/favicon.png')} * /> * <Image * style={{width: 50, height: 50}} * source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}} * /> * </View> * ); * } * } * * // App registration and rendering * AppRegistry.registerComponent('DisplayAnImage', () => DisplayAnImage); * ``` * * You can also add `style` to an image: * * ```ReactNativeWebPlayer * import React, { Component } from 'react'; * import { AppRegistry, View, Image, StyleSheet} from 'react-native'; * * const styles = StyleSheet.create({ * stretch: { * width: 50, * height: 200 * } * }); * * class DisplayAnImageWithStyle extends Component { * render() { * return ( * <View> * <Image * style={styles.stretch} * source={require('./img/favicon.png')} * /> * </View> * ); * } * } * * // App registration and rendering * AppRegistry.registerComponent( * 'DisplayAnImageWithStyle', * () => DisplayAnImageWithStyle * ); * ``` * * ### GIF and WebP support on Android * * By default, GIF and WebP are not supported on Android. * * You will need to add some optional modules in `android/app/build.gradle`, depending on the needs of your app. * * ``` * dependencies { * // If your app supports Android versions before Ice Cream Sandwich (API level 14) * compile 'com.facebook.fresco:animated-base-support:0.11.0' * * // For animated GIF support * compile 'com.facebook.fresco:animated-gif:0.11.0' * * // For WebP support, including animated WebP * compile 'com.facebook.fresco:animated-webp:0.11.0' * compile 'com.facebook.fresco:webpsupport:0.11.0' * * // For WebP support, without animations * compile 'com.facebook.fresco:webpsupport:0.11.0' * } * ``` * * Also, if you use GIF with ProGuard, you will need to add this rule in `proguard-rules.pro` : * ``` * -keep class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl { * public AnimatedFactoryImpl(com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory, com.facebook.imagepipeline.core.ExecutorSupplier); * } * ``` * */ const Image = React.createClass({ propTypes: { /** * > `ImageResizeMode` is an `Enum` for different image resizing modes, set via the * > `resizeMode` style property on `Image` components. The values are `contain`, `cover`, * > `stretch`, `center`, `repeat`. */ style: StyleSheetPropType(ImageStylePropTypes), /** * The image source (either a remote URL or a local file resource). * * This prop can also contain several remote URLs, specified together with * their width and height and potentially with scale/other URI arguments. * The native side will then choose the best `uri` to display based on the * measured size of the image container. */ source: ImageSourcePropType, /** * A static image to display while loading the image source. * * - `uri` - a string representing the resource identifier for the image, which * should be either a local file path or the name of a static image resource * (which should be wrapped in the `require('./path/to/image.png')` function). * - `width`, `height` - can be specified if known at build time, in which case * these will be used to set the default `<Image/>` component dimensions. * - `scale` - used to indicate the scale factor of the image. Defaults to 1.0 if * unspecified, meaning that one image pixel equates to one display point / DIP. * - `number` - Opaque type returned by something like `require('./image.jpg')`. * * @platform ios */ defaultSource: PropTypes.oneOfType([ // TODO: Tooling to support documenting these directly and having them display in the docs. PropTypes.shape({ uri: PropTypes.string, width: PropTypes.number, height: PropTypes.number, scale: PropTypes.number, }), PropTypes.number, ]), /** * When true, indicates the image is an accessibility element. * @platform ios */ accessible: PropTypes.bool, /** * The text that's read by the screen reader when the user interacts with * the image. * @platform ios */ accessibilityLabel: PropTypes.string, /** * blurRadius: the blur radius of the blur filter added to the image * @platform ios */ blurRadius: PropTypes.number, /** * When the image is resized, the corners of the size specified * by `capInsets` will stay a fixed size, but the center content and borders * of the image will be stretched. This is useful for creating resizable * rounded buttons, shadows, and other resizable assets. More info in the * [official Apple documentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/index.html#//apple_ref/occ/instm/UIImage/resizableImageWithCapInsets). * * @platform ios */ capInsets: EdgeInsetsPropType, /** * Determines how to resize the image when the frame doesn't match the raw * image dimensions. * * - `cover`: Scale the image uniformly (maintain the image's aspect ratio) * so that both dimensions (width and height) of the image will be equal * to or larger than the corresponding dimension of the view (minus padding). * * - `contain`: Scale the image uniformly (maintain the image's aspect ratio) * so that both dimensions (width and height) of the image will be equal to * or less than the corresponding dimension of the view (minus padding). * * - `stretch`: Scale width and height independently, This may change the * aspect ratio of the src. * * - `repeat`: Repeat the image to cover the frame of the view. The * image will keep it's size and aspect ratio. (iOS only) */ resizeMode: PropTypes.oneOf(['cover', 'contain', 'stretch', 'repeat', 'center']), /** * A unique identifier for this element to be used in UI Automation * testing scripts. */ testID: PropTypes.string, /** * Invoked on mount and layout changes with * `{nativeEvent: {layout: {x, y, width, height}}}`. */ onLayout: PropTypes.func, /** * Invoked on load start. * * e.g., `onLoadStart={(e) => this.setState({loading: true})}` */ onLoadStart: PropTypes.func, /** * Invoked on download progress with `{nativeEvent: {loaded, total}}`. * @platform ios */ onProgress: PropTypes.func, /** * Invoked on load error with `{nativeEvent: {error}}`. * @platform ios */ onError: PropTypes.func, /** * Invoked when load completes successfully. */ onLoad: PropTypes.func, /** * Invoked when load either succeeds or fails. */ onLoadEnd: PropTypes.func, }, statics: { resizeMode: ImageResizeMode, /** * Retrieve the width and height (in pixels) of an image prior to displaying it. * This method can fail if the image cannot be found, or fails to download. * * In order to retrieve the image dimensions, the image may first need to be * loaded or downloaded, after which it will be cached. This means that in * principle you could use this method to preload images, however it is not * optimized for that purpose, and may in future be implemented in a way that * does not fully load/download the image data. A proper, supported way to * preload images will be provided as a separate API. * * @param uri The location of the image. * @param success The function that will be called if the image was sucessfully found and width * and height retrieved. * @param failure The function that will be called if there was an error, such as failing to * to retrieve the image. * * @returns void * * @platform ios */ getSize: function( uri: string, success: (width: number, height: number) => void, failure: (error: any) => void, ) { ImageViewManager.getSize(uri, success, failure || function() { console.warn('Failed to get size for image: ' + uri); }); }, /** * Prefetches a remote image for later use by downloading it to the disk * cache * * @param url The remote location of the image. * * @return The prefetched image. */ prefetch(url: string) { return ImageViewManager.prefetchImage(url); }, }, mixins: [NativeMethodsMixin], /** * `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We * make `this` look like an actual native component class. */ viewConfig: { uiViewClassName: 'UIView', validAttributes: ReactNativeViewAttributes.UIView }, render: function() { const source = resolveAssetSource(this.props.source) || { uri: undefined, width: undefined, height: undefined }; let sources; let style; if (Array.isArray(source)) { style = flattenStyle([styles.base, this.props.style]) || {}; sources = source; } else { const {width, height, uri} = source; style = flattenStyle([{width, height}, styles.base, this.props.style]) || {}; sources = [source]; if (uri === '') { console.warn('source.uri should not be an empty string'); } } const resizeMode = this.props.resizeMode || (style || {}).resizeMode || 'cover'; // Workaround for flow bug t7737108 const tintColor = (style || {}).tintColor; // Workaround for flow bug t7737108 if (this.props.src) { console.warn('The <Image> component requires a `source` property rather than `src`.'); } return ( <RCTImageView {...this.props} style={style} resizeMode={resizeMode} tintColor={tintColor} source={sources} /> ); }, }); const styles = StyleSheet.create({ base: { overflow: 'hidden', }, }); const RCTImageView = requireNativeComponent('RCTImageView', Image); module.exports = Image;
1-live-timeline-post/js/components/SubLayout.js
melvinodsa/my-react-experiments
import React from 'react'; class SubLayout extends React.Component { render() { var classNames = ""; if(this.props.extraclass instanceof Array) { this.props.extraclass.forEach(function(item) { classNames += " " + item; }); } return ( <div className={'sub-layout' + classNames}> <h1>{this.props.title}</h1> {this.props.children} </div> ); } } export default SubLayout;
src/parser/deathknight/blood/modules/spells/azeritetraits/EternalRuneWeapon.js
ronaldpereira/WoWAnalyzer
import React from 'react'; import SPELLS from 'common/SPELLS'; import { formatPercentage } from 'common/format'; import { calculateAzeriteEffects } from 'common/stats'; import RESOURCE_TYPES from 'game/RESOURCE_TYPES'; import Analyzer from 'parser/core/Analyzer'; import TraitStatisticBox, { STATISTIC_ORDER } from 'interface/others/TraitStatisticBox'; import StatTracker from 'parser/shared/modules/StatTracker'; const DANCING_RUNE_WEAPON_BONUS_DURATION_PER_TRAIT = 0.5; const MAX_DANCING_RUNE_WEAPON_BONUS_DURATION = 5; const eternalRuneWeaponStats = traits => Object.values(traits).reduce((obj, rank) => { const [strength] = calculateAzeriteEffects(SPELLS.ETERNAL_RUNE_WEAPON.id, rank); obj.strength += strength; obj.traits += 1; return obj; }, { strength: 0, traits: 0, }); /** * Eternal Rune Weapon * Gain x strength while Dancing Rune Weapon is up * Every rune spend during DRW extends it's duration by .5sec up to a max of 5sec * * The strength and bonus duration stacks with multiple traits while the 5sec cap remains the same * one trait would provide 100 strength & .5sec per rune up to 5sec * two traits would provide 200 strength & 1sec per rune up to 5sec * * Example report: https://www.warcraftlogs.com/reports/kmtH7VRnJ4fAhg6M/#fight=46&source=7 * Example report: https://www.warcraftlogs.com/reports/fCBX6HMK372AZxzp/#fight=62&source=20 (with two ERW traits) */ class EternalRuneWeapon extends Analyzer { static dependencies = { statTracker: StatTracker, }; strength = 0; traits = 0; bonusDurations = []; constructor(...args) { super(...args); this.active = this.selectedCombatant.hasTrait(SPELLS.ETERNAL_RUNE_WEAPON.id); if (!this.active) { return; } const { strength, traits } = eternalRuneWeaponStats(this.selectedCombatant.traitsBySpellId[SPELLS.ETERNAL_RUNE_WEAPON.id]); this.strength = strength; this.traits = traits; this.statTracker.add(SPELLS.ETERNAL_RUNE_WEAPON_BUFF.id, { strength, }); } on_byPlayer_cast(event) { if (event.ability.guid === SPELLS.DANCING_RUNE_WEAPON.id) { this.bonusDurations.push([]); return; } if (!this.selectedCombatant.hasBuff(SPELLS.ETERNAL_RUNE_WEAPON_BUFF.id)) { return; } if (!event.classResources) { return; } event.classResources .filter(resource => resource.type === RESOURCE_TYPES.RUNES.id) .forEach(({ amount, cost }) => { const runeCost = cost || 0; if (runeCost <= 0) { return; } if (this.bonusDurations.length === 0) { this.bonusDurations.push([]); } this.bonusDurations[this.bonusDurations.length - 1].push(DANCING_RUNE_WEAPON_BONUS_DURATION_PER_TRAIT * this.traits * runeCost); }); } get uptime() { return this.selectedCombatant.getBuffUptime(SPELLS.ETERNAL_RUNE_WEAPON_BUFF.id) / this.owner.fightDuration; } get averageStrength() { return (this.strength * this.uptime).toFixed(0); } get wastedBonusDuration() { let totalTime = 0; this.bonusDurations.forEach(elem => { totalTime += elem.reduce((a, b) => a + b, 0); }); return totalTime - this.totalBonusDuration; } get totalBonusDuration() { let totalTime = 0; this.bonusDurations.forEach(elem => { totalTime += elem.reduce((a, b) => a + b <= MAX_DANCING_RUNE_WEAPON_BONUS_DURATION ? a + b : MAX_DANCING_RUNE_WEAPON_BONUS_DURATION, 0); }); return totalTime; } get averageDancingRuneWeaponBonusDuration() { return ((this.totalBonusDuration / this.bonusDurations.length) || 0).toFixed(1); } statistic() { return ( <TraitStatisticBox position={STATISTIC_ORDER.OPTIONAL()} trait={SPELLS.ETERNAL_RUNE_WEAPON.id} value={( <> {this.averageStrength} average Strength <br /> {this.averageDancingRuneWeaponBonusDuration} sec average bonus duration </> )} tooltip={( <> {SPELLS.ETERNAL_RUNE_WEAPON.name} grants <strong>{this.strength} strength</strong> while active and an uptime of {formatPercentage(this.uptime)} %.<br /> You extended {SPELLS.DANCING_RUNE_WEAPON.name} on <strong>average by {this.averageDancingRuneWeaponBonusDuration} seconds</strong> ({this.totalBonusDuration} sec total bonus duration over {this.bonusDurations.length} casts)<br /> You wasted {this.wastedBonusDuration} seconds worth of bonus duration by reaching the 5 sec cap. </> )} /> ); } } export default EternalRuneWeapon;
src/client/scenes/Guild/ChannelList/index.js
kettui/webcord-web-app
import React, { Component } from 'react'; import { observer, inject } from 'mobx-react'; import CSSTransitionGroup from 'react-addons-css-transition-group' import { Button, Item, Segment, Sidebar } from 'semantic-ui-react'; import Channels from './Channels'; import VoiceChannelInfo from './VoiceChannelInfo'; import { Slide } from 'components/'; import scss from './channel-list.scss'; const ChannelList = ({ navStore: { guild, guild: { name, }, channel, } }) => ( <Sidebar.Pushable as={Segment} className={scss['wrapper']} basic> <Segment className={scss['top-section']}> <Item className={scss['name']}>{ name }</Item> </Segment> <Channels guild={guild} channel={channel} /> <VoiceChannelInfo guild={guild} /> </Sidebar.Pushable> ); export default inject('navStore')(observer(ChannelList));
assets/jqwidgets/jqwidgets-react/react_jqxinput.js
juannelisalde/holter
/* jQWidgets v4.5.4 (2017-June) Copyright (c) 2011-2017 jQWidgets. License: http://jqwidgets.com/license/ */ import React from 'react'; const JQXLite = window.JQXLite; export default class JqxInput extends React.Component { componentDidMount() { let options = this.manageAttributes(); this.createComponent(options); this.val(this.props.value); }; manageAttributes() { let properties = ['disabled','dropDownWidth','displayMember','height','items','minLength','maxLength','opened','placeHolder','popupZIndex','query','renderer','rtl','searchMode','source','theme','valueMember','width','value']; let options = {}; for(let item in this.props) { if(item === 'settings') { for(let itemTwo in this.props[item]) { options[itemTwo] = this.props[item][itemTwo]; } } else { if(properties.indexOf(item) !== -1) { options[item] = this.props[item]; } } } return options; }; createComponent(options) { if(!this.style) { for (let style in this.props.style) { JQXLite(this.componentSelector).css(style, this.props.style[style]); } } if(this.props.className !== undefined) { let classes = this.props.className.split(' '); for (let i = 0; i < classes.length; i++ ) { JQXLite(this.componentSelector).addClass(classes[i]); } } if(!this.template) { JQXLite(this.componentSelector).html(this.props.template); } JQXLite(this.componentSelector).jqxInput(options); }; setOptions(options) { JQXLite(this.componentSelector).jqxInput('setOptions', options); }; getOptions() { if(arguments.length === 0) { throw Error('At least one argument expected in getOptions()!'); } let resultToReturn = {}; for(let i = 0; i < arguments.length; i++) { resultToReturn[arguments[i]] = JQXLite(this.componentSelector).jqxInput(arguments[i]); } return resultToReturn; }; on(name,callbackFn) { JQXLite(this.componentSelector).on(name,callbackFn); }; off(name) { JQXLite(this.componentSelector).off(name); }; disabled(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('disabled', arg) } else { return JQXLite(this.componentSelector).jqxInput('disabled'); } }; dropDownWidth(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('dropDownWidth', arg) } else { return JQXLite(this.componentSelector).jqxInput('dropDownWidth'); } }; displayMember(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('displayMember', arg) } else { return JQXLite(this.componentSelector).jqxInput('displayMember'); } }; height(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('height', arg) } else { return JQXLite(this.componentSelector).jqxInput('height'); } }; items(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('items', arg) } else { return JQXLite(this.componentSelector).jqxInput('items'); } }; minLength(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('minLength', arg) } else { return JQXLite(this.componentSelector).jqxInput('minLength'); } }; maxLength(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('maxLength', arg) } else { return JQXLite(this.componentSelector).jqxInput('maxLength'); } }; opened(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('opened', arg) } else { return JQXLite(this.componentSelector).jqxInput('opened'); } }; placeHolder(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('placeHolder', arg) } else { return JQXLite(this.componentSelector).jqxInput('placeHolder'); } }; popupZIndex(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('popupZIndex', arg) } else { return JQXLite(this.componentSelector).jqxInput('popupZIndex'); } }; query(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('query', arg) } else { return JQXLite(this.componentSelector).jqxInput('query'); } }; renderer(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('renderer', arg) } else { return JQXLite(this.componentSelector).jqxInput('renderer'); } }; rtl(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('rtl', arg) } else { return JQXLite(this.componentSelector).jqxInput('rtl'); } }; searchMode(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('searchMode', arg) } else { return JQXLite(this.componentSelector).jqxInput('searchMode'); } }; source(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('source', arg) } else { return JQXLite(this.componentSelector).jqxInput('source'); } }; theme(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('theme', arg) } else { return JQXLite(this.componentSelector).jqxInput('theme'); } }; valueMember(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('valueMember', arg) } else { return JQXLite(this.componentSelector).jqxInput('valueMember'); } }; width(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('width', arg) } else { return JQXLite(this.componentSelector).jqxInput('width'); } }; value(arg) { if (arg !== undefined) { JQXLite(this.componentSelector).jqxInput('value', arg) } else { return JQXLite(this.componentSelector).jqxInput('value'); } }; destroy() { JQXLite(this.componentSelector).jqxInput('destroy'); }; focus() { JQXLite(this.componentSelector).jqxInput('focus'); }; selectAll() { JQXLite(this.componentSelector).jqxInput('selectAll'); }; val(value) { if (value !== undefined) { JQXLite(this.componentSelector).jqxInput('val', value) } else { return JQXLite(this.componentSelector).jqxInput('val'); } }; render() { let id = 'jqxInput' + JQXLite.generateID(); this.componentSelector = '#' + id; return ( <input type='text' id={id}></input> ) }; };
src/widget/Text.js
dudongge/DDGMeiTuan
/** * Copyright (c) 2017-present, dudongge * All rights reserved. * * https://github.com/dudongge/DDGMeiTuan * copyright by dudodongge */ import React from 'react'; import ReactNative, { StyleSheet, Dimensions, Text ,ReactElement} from 'react-native'; import color from './color' export function HeadingBig({style, ...props}: Object): ReactElement { return <Text style={[styles.h0, style]} {...props} /> } export function Heading1({style, ...props}: Object): ReactElement { return <Text style={[styles.h1, style]} {...props} /> } export function Heading2({style, ...props}: Object): ReactElement { return <Text style={[styles.h2, style]} {...props} /> } export function Paragraph({style, ...props}: Object): ReactElement { return <Text style={[styles.p, style]} {...props} /> } export function Tip({style, ...props}: Object): ReactElement { return <Text style={[styles.tip, style]} {...props} /> } const styles = StyleSheet.create({ h0: { fontSize: 40, color: color.theme, }, h1: { fontSize: 15, fontWeight: 'bold', color: '#222222', }, h2: { fontSize: 14, color: '#222222', }, p: { fontSize: 13, color: '#777777', }, tip: { fontSize: 13, color: '#999999' } });
packages/ui-toolkit/src/styleguide/sectionHeading.js
geek/joyent-portal
import React from 'react'; import styled from 'styled-components'; import cx from 'classnames'; import Styled from 'react-styleguidist/lib/rsg-components/Styled'; import remcalc from 'remcalc'; const styles = ({ color, fontFamily, fontSize }) => ({ heading: { margin: remcalc(24), marginLeft: 0, color: color.base, fontFamily: fontFamily.base, fontWeight: 'normal' }, heading1: { fontSize: remcalc(36) }, heading2: { fontSize: remcalc(30) }, heading3: { fontSize: remcalc(26) }, heading4: { fontSize: remcalc(24) }, heading5: { fontSize: remcalc(24) }, heading6: { fontSize: remcalc(18) } }); const Link = styled.a` color: ${props => props.theme.text}; text-decoration: none; `; function HeadingRenderer({ classes, level, children, ...props }) { const Tag = `h${level}`; const headingClasses = cx(classes.heading, classes[`heading${level}`]); const Heading = level === 1 ? null : ( <Tag {...props} className={headingClasses}> {children} </Tag> ); return Heading; } const Heading = Styled(styles)(HeadingRenderer); export default ({ classes, children, toolbar, id, href, depth, deprecated }) => { const headingLevel = Math.min(6, depth); return ( <div> <Heading level={headingLevel} id={id}> <Link href={href}>{children}</Link> </Heading> {/* <div className={classes.toolbar}>{toolbar}</div> */} </div> ); };
src/routes/admin/Components/CKEditor/index.js
luanlv/comhoavang
/* global CKEDITOR */ import React from 'react'; import {Modal, Form, Input, Icon, Tooltip, Button, Switch, DatePicker, Select, Row, Col, Card, Tabs, Affix, message} from 'antd'; import ReactResizeDetector from 'react-resize-detector'; import VisibilitySensor from 'react-visibility-sensor' import ImageSelect from '../ImageSelect' class CKEditor extends React.Component { constructor(props) { super(props); this.state = { oldEditorSize: 0, isEndEditor: false, showModalSelectImage: false, selectImageType: '', } this.elementName = "editor_" + this.props.id; this.componentDidMount = this.componentDidMount.bind(this); } showModalSelectImage = (type) => { this.setState(prev => { return { ...prev, modalSelectImage: true, selectImageType: type } }); } handleOk = (e) => { console.log(e); this.setState({ modalSelectImage: false, }); } handleCancel = (e) => { this.setState({ modalSelectImage: false, }); } handleSelectImage(img){ this.setState(prevState => { return { ...prevState, modalSelectImage: false, } }) this.editor.insertHtml( '<p style="text-align:center"><img alt="eS9cTTQzZT-3.jpg" src="' + '/image/' + img.name + '" /></p><br/>' ); } render() { return ( <div> <Row> <Col className="padding-5"> <span id="addImage" style={{marginRight: 10}} onClick={() => this.showModalSelectImage('editor')} /> </Col> <Col> <ReactResizeDetector handleWidth handleHeight onResize={(w, h) => { let diff = h - this.state.oldEditorSize if(this.state.isEndEditor && diff > 0) { var y = $(window).scrollTop(); $(window).scrollTop(y + diff); } this.setState({ oldEditorSize: h }) }} /> <div id="toolbarLocation" /> <textarea name={this.elementName} defaultValue={this.props.value} /> <div style={{height: 20}} /> <VisibilitySensor onChange={(isVisible) => { this.setState({ isEndEditor: !isVisible }) }} /> </Col> <Col> <Modal style={{top: 30}} width="90%" title="Basic Modal" visible={this.state.modalSelectImage} onOk={this.handleOk} onCancel={this.handleCancel} > <ImageSelect handleSelect={(img) => this.handleSelectImage(img)} /> </Modal> </Col> </Row> </div> ); } componentDidMount() { let configuration = { // removePlugins : 'magicline', extraPlugins : 'autogrow,image2,sharedspace,colorbutton,justify,font', uploadUrl: '/upload/imageCKEditor', disallowedContent : 'img{width,height}', sharedSpaces: { top: 'toolbarLocation' } } this.editor = CKEDITOR.replace(this.elementName, configuration); CKEDITOR.instances[this.elementName].on("change", function () { let data = CKEDITOR.instances[this.elementName].getData(); this.props.onChange(data); }.bind(this)); CKEDITOR.on('instanceReady', function(ev) { ev.editor.focus() }); $("#toolbarLocation").sticky({topSpacing:0}); this.editor.addCommand("mySimpleCommand", { // create named command exec: function(edt) { $( "#addImage" ).trigger( "click" ) } }); this.editor.ui.addButton('SuperButton', { // add new button and bind our command label: "Click me", command: 'mySimpleCommand', toolbar: 'insert', icon: '/assets/add-image.png' }); } componentWillUnmount() { console.log('destroy') this.editor.destroy() } } export {CKEditor as default};
src/svg-icons/action/flight-land.js
rscnt/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionFlightLand = (props) => ( <SvgIcon {...props}> <path d="M2.5 19h19v2h-19zm7.18-5.73l4.35 1.16 5.31 1.42c.8.21 1.62-.26 1.84-1.06.21-.8-.26-1.62-1.06-1.84l-5.31-1.42-2.76-9.02L10.12 2v8.28L5.15 8.95l-.93-2.32-1.45-.39v5.17l1.6.43 5.31 1.43z"/> </SvgIcon> ); ActionFlightLand = pure(ActionFlightLand); ActionFlightLand.displayName = 'ActionFlightLand'; export default ActionFlightLand;
web/react/app.js
tribou/near-earth-asteroids
import React from 'react'; import ReactDOM from 'react-dom'; import Index from './components/Index.jsx'; import '../styles/app.scss'; // Render the React Index into DOM at #app ReactDOM.render( React.createElement(Index), document.getElementById('app') );
hbw/app/javascript/packs/hbw/components/shared/element/icon.js
latera/homs
import React from 'react'; const HydraIcon = () => ( <svg className="hbw-icon-svg" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="241.667px" height="235.5px" viewBox="0 0 241.667 235.5" enableBackground="new 0 0 241.667 235.5"> <path className="hbw-icon-svg-path" fillRule="evenodd" clipRule="evenodd" fill="#fff" d="M234.784,61.563c1.813,7.728-1.417,15.498-4.867,22.728c-3.307,6.928-7.986,13.285-13.592,18.822 c-6.42,6.34-13.518,11.819-21.663,15.438c-9.061,4.02-18.448,7.645-28.637,7.521 c-6.161-0.068-12.348-0.292-18.462-0.982c-3.209-0.363-6.371-1.69-9.405-2.953c-4.578-1.899-8.994-2.459-12.332,2.634 c-2.816,4.301-6.283,8.18-9.007,12.527c-1.476,2.36-1.769,5.433-3,7.991c-3.527,7.318-4.02,15.071-3.274,22.924 c0.33,3.491,1.54,6.903,2.445,10.322c0.38,1.433,1.158,2.775,1.496,4.216c1.958,8.333,7.248,14.495,14.038,18.797 c5.849,3.707,12.695,5.973,19.991,4.119c4.886-1.238,7.152-5.397,9.763-9.143c4.081-5.845,9.392-9.642,16.736-9.628 c1.422,0,3.494,0.637,4.075,1.662c0.574,1.01-0.016,3.085-0.718,4.337c-1.166,2.086-2.867,3.858-4.271,5.814 c-0.931,1.295-1.948,2.597-2.554,4.052c-1.251,3.014,0.208,5.035,3.484,4.824c3.645-0.238,7.284-0.637,10.909-1.096 c2.312-0.298,4.425-0.28,5.538,2.199c1.082,2.409-0.004,4.195-1.848,5.707c-2.374,1.95-4.664,4.017-7.11,5.864 c-3.602,2.725-7.822,3.394-12.227,3.828c-3.249,0.313-6.509,1.273-9.589,2.423c-11.303,4.206-22.334,3.91-33.84,0.106 c-11.454-3.796-19.927-11.073-26.761-20.39c-3.298-4.501-5.046-10.151-7.477-15.289 c-0.243-0.513-0.288-1.121-0.53-1.633c-6.466-13.666-5.644-28.097-3.379-42.308 c1.144-7.183,4.183-14.139,7.792-20.77c4.855-8.92,11.089-16.516,18.437-23.33 c2.44-2.263,2.432-4.956,1.706-7.934c-2.555-10.478-8.086-19.178-15.872-26.4 c-12.561-11.649-27.284-16.79-44.383-14.025c-4.891,0.79-8.719,3.803-12.546,6.689 c-1.272,0.956-2.253,2.305-3.518,3.273c-3.321,2.547-3.746,5.832-2.649,9.567 c0.161,0.551,0.297,1.156,0.624,1.601c4.591,6.265,3.696,12.723,0.532,19.152c-0.696,1.413-2.002,3.232-3.27,3.455 c-1.241,0.214-3.215-1.053-4.112-2.249c-1.631-2.167-2.767-4.729-3.993-7.183c-2.011-4.021-4.394-4.459-7.2-0.894 c-1.442,1.832-2.142,4.238-3.385,6.256c-0.966,1.569-1.975,3.596-3.464,4.229c-2.161,0.912-3.738-1.117-5.022-2.764 c-3.752-4.814-3.691-14.253-0.51-19.53c2.887-4.793,5.669-9.781,7.516-15.032c1.752-4.974,4.958-8.77,8.036-12.677 c5.517-7.002,13.06-11.46,21.052-14.968c6.708-2.943,14.02-3.366,21.225-3.081c5.921,0.231,12.02,0.545,17.658,2.164 c6.712,1.931,13.239,4.603,19.423,8.254c8.035,4.746,14.814,10.749,20.751,17.765c3.364,3.974,6.998,7.902,8.526,13.135 c0.064,0.221,0.14,0.459,0.28,0.63c5.008,6.144,5.46,13.975,7.703,21.134c1.194,3.818,3.747,6.322,7.468,7.451 c10.065,3.042,20.054,2.778,29.942-0.95c5.235-1.975,10.668-3.583,14.937-7.426c3.798-3.412,7.819-6.717,10.964-10.691 c3.153-3.989,5.537-8.642,7.906-13.185c2.939-5.643,2.783-11.759,0.293-17.335c-4.079-9.143-4.374-9.008-14.009-11.232 c-6.235-1.433-10.722-5.518-14.648-10.208c-2.232-2.665-0.163-6.585,3.371-6.554c3.303,0.029,6.602,0.68,9.906,0.747 c1.561,0.04,3.695-0.134,4.581-1.117c1.52-1.69,0.748-3.967-0.58-5.699c-1.602-2.096-3.551-3.932-5.024-6.106 c-0.893-1.32-2.063-3.868-1.546-4.444c1.214-1.348,3.308-2.38,5.148-2.579c6.141-0.662,10.657,3.167,14.761,6.838 c2.713,2.427,4.228,6.191,6.355,9.304c2.381,3.484,4.945,6.857,7.24,10.401c1.347,2.077,2.373,4.375,3.447,6.62 c0.441,0.922,0.492,2.032,0.95,2.946C234.781,46.719,235.347,53.639,234.784,61.563z"/> </svg> ); export default HydraIcon;
src/layouts/CoreLayout.js
mastermind1981/react-redux-starter-kit
import React from 'react'; import 'styles/core.scss'; export default class CoreLayout extends React.Component { static propTypes = { children : React.PropTypes.element } constructor () { super(); } render () { return ( <div className='page-container'> <div className='view-container'> {this.props.children} </div> </div> ); } }
docs/src/app/components/pages/components/TextField/ExampleError.js
pancho111203/material-ui
import React from 'react'; import TextField from 'material-ui/TextField'; const TextFieldExampleError = () => ( <div> <TextField hintText="Hint Text" errorText="This field is required" /><br /> <TextField hintText="Hint Text" errorText="The error text can be as long as you want, it will wrap." /><br /> <TextField hintText="Hint Text" errorText="This field is required" floatingLabelText="Floating Label Text" /><br /> <TextField hintText="Message Field" errorText="This field is required." floatingLabelText="MultiLine and FloatingLabel" multiLine={true} rows={2} /><br /> </div> ); export default TextFieldExampleError;
src/components/books/edit-page/BookInformation.js
great-design-and-systems/cataloguing-app
import { ImageUpload, SearchSelector, TextInput } from '../../common/'; import { LABEL_AUTHOR, LABEL_BOOK_COVER, LABEL_EDITION, LABEL_ISBN_10, LABEL_ISBN_13, LABEL_NUMBER_OF_PAGES, LABEL_PUBLISHED_DATE, LABEL_PUBLISHER, LABEL_SERIES_TITLE, LABEL_SUB_TITLE, LABEL_TITLE, MESSAGE_AUTHOR_REQUIRED, MESSAGE_ISBN_REQUIRED, MESSAGE_PUBLISHED_DATE_REQUIRED, MESSAGE_PUBLISHER_REQUIRED, MESSAGE_TITLE_REQUIRED } from '../../../labels/'; import { Book } from '../../../api/books/Book'; import PropTypes from 'prop-types'; import React from 'react'; export const BookInformation = ({ onChange, managedBook }) => { return (<span> <div className="col-sm-12 col-md-3"> <ImageUpload value={managedBook[Book.IMAGE_URL]} name={Book.IMAGE_URL} label={LABEL_BOOK_COVER} /> </div> <div className={managedBook.update ? 'col-sm-5 col-md-9' : 'col-sm-12 col-md-9'}> <TextInput invalid={managedBook.invalidField === Book.TITLE} label={LABEL_TITLE} name={Book.TITLE} required={true} message={MESSAGE_TITLE_REQUIRED} value={managedBook[Book.TITLE]} /> <TextInput invalid={managedBook.invalidField === Book.ISBN13} message={MESSAGE_ISBN_REQUIRED} label={LABEL_ISBN_13} name={Book.ISBN13} required={true} value={managedBook[Book.ISBN13]} /> <TextInput invalid={managedBook.invalidField === Book.ISBN10} message={MESSAGE_ISBN_REQUIRED} label={LABEL_ISBN_10} name={Book.ISBN10} required={true} value={managedBook[Book.ISBN10]} /> <TextInput invalid={managedBook.invalidField === Book.PUBLISHER} message={MESSAGE_PUBLISHER_REQUIRED} label={LABEL_PUBLISHER} name={Book.PUBLISHER} required={true} value={managedBook[Book.PUBLISHER]} /> <SearchSelector required={true} invalid={managedBook.invalidField === Book.AUTHOR} message={MESSAGE_AUTHOR_REQUIRED} value={managedBook[Book.AUTHOR]} multiple={true} options={[]} label={LABEL_AUTHOR} name={Book.AUTHOR} labelKey="label" onChange={(name, value) => { onChange({ name, value }); }} /> <TextInput invalid={managedBook.invalidField === Book.PUBLISHED_DATE} message={MESSAGE_PUBLISHED_DATE_REQUIRED} label={LABEL_PUBLISHED_DATE} name={Book.PUBLISHED_DATE} required={true} value={managedBook[Book.PUBLISHED_DATE]} /> </div> {managedBook.update && <div className="col-sm-5 col-md-12"> <TextInput label={LABEL_SUB_TITLE} name={Book.SUB_TITLE} value={managedBook[Book.SUB_TITLE]} /> <TextInput label={LABEL_SERIES_TITLE} name={Book.SERIES_TITLE} value={managedBook[Book.SERIES_TITLE]} /> <TextInput type="number" label={LABEL_NUMBER_OF_PAGES} name={Book.NUMBER_OF_PAGES} value={managedBook[Book.NUMBER_OF_PAGES]} /> <TextInput label={LABEL_EDITION} name={Book.EDITION} value={managedBook[Book.EDITION]} /> </div>} </span>); }; BookInformation.propTypes = { onChange: PropTypes.func.isRequired, managedBook: PropTypes.object.isRequired };
docs/app/src/pages/guides/Etc.js
tercenya/compendium
import React from 'react'; import { CodeExample, CondLang, NavMain, PageHeader, PageFooter, A } from '../../components'; const Overview = (props) => { return ( <div> <NavMain activePage="guides" /> <PageHeader title="The remainder" subTitle="A survey of the other APIs" /> <div className="container compendium-container"> <div className="row"> <div className="col-md-12" role="main"> <div className="compendium-section"> <h2>Other JSON Endpoints</h2> <p> Riot has several more collections of endpoints which we have not yet covered. Here is a brief overview of what else is currently available. </p> <ul> <li> <dl> <dt><A href="https://developer.riotgames.com/api/methods#!/1077">Champion</A></dt> <dd>Provides details as to which champions are available for free play this week, disabled in ranked queues, or able to participate in bot matches.</dd> </dl> </li> <li> <dl> <dt><A href="https://developer.riotgames.com/api/methods#!/977">Featured Games</A></dt> <dd> Returns a list of "featured games", similar to what you see in the bottom right-hand corner of the LoL Client. This is one of the few ways to find arbitrary games, but it you cannot aggressively datamine it - the list only updates every so often. </dd> </dl> </li> <li> <dl> <dt><A href="https://developer.riotgames.com/api/methods#!/985">League</A></dt> <dd> Here you can look up a summoner's current league or league teams. You can also get a list of Summoners who are in the Master or Challenger ranks. This is one of the few places you can datamine a list of summoners, if you are looking for large quantities of data. There may be a guide on this in the near future. </dd> </dl> </li> <li> <dl> <dt><A href="https://developer.riotgames.com/api/methods#!/908">Status</A></dt> <dd>Returns the current status of various systems, and known outages.</dd> </dl> </li> <li> <dl> <dt><A href="https://developer.riotgames.com/api/methods#!/1080">Stats</A></dt> <dd> Returns large quantities of stastical informaiton about a summoner's play, by season and game type. Fields include things like total games, largest killing streak, etc. </dd> </dl> </li> </ul> <h2>Other APIs</h2> <ul> <li> <dl> <dt><A href="https://developer.riotgames.com/docs/item-sets">Item Sets</A></dt> <dd> These documents describe how to build files that provide item sets for champions in the game. These JSON files can be installed on your client, to supplement the in-game item set collections. </dd> </dl> </li> <li> <dl> <dt><A href="https://developer.riotgames.com/docs/spectating-games">Spectating Games</A></dt> <dd> By using the <A href='/guides/current-game/'>Current Game API</A>, you can fetch an encryption key, then pass it on the command-line to the LoL client to watch a currently running game in spectator mode. </dd> </dl> </li> <li> <dl> <dt><A href="https://developer.riotgames.com/docs/tournaments-api">Tournament API</A></dt> <dd> Allows you to create custom tournamnet codes. This is also has JSON API endpoint, but unlike the other APIs that are "read-only", several of these endpoints require the use of an HTTP <i>POST</i> rather than a <i>GET</i>, in order to "upload" data to Riot. Tournament registration is a multi-step process. Riot can also send <i>you</i> data at the completion of a tournament game, which requires you to run a API endpoint of your own on your server. </dd> </dl> </li> </ul> </div> </div> </div> </div> </div> ); }; export default Overview;
app/components/Currency.js
schwuk/fx_u_like
import React from 'react'; import CurrencyAmount from '../containers/CurrencyAmount'; import CurrencyChooser from '../containers/CurrencyChooser'; export default class Currency extends React.Component { render() { const direction = this.props.direction; const id = "currency_" + direction; return ( <fieldset id={id}> <legend>Convert {direction}:</legend> <CurrencyAmount direction={direction} /> <CurrencyChooser direction={direction} /> </fieldset> ); } }
src/components/common/svg-icons/device/signal-cellular-null.js
abzfarah/Pearson.NAPLAN.GnomeH
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceSignalCellularNull = (props) => ( <SvgIcon {...props}> <path d="M20 6.83V20H6.83L20 6.83M22 2L2 22h20V2z"/> </SvgIcon> ); DeviceSignalCellularNull = pure(DeviceSignalCellularNull); DeviceSignalCellularNull.displayName = 'DeviceSignalCellularNull'; DeviceSignalCellularNull.muiName = 'SvgIcon'; export default DeviceSignalCellularNull;
src/pages/blog.js
prodigygod0209/prodigygod0209.github.io
import React from 'react'; import Link from 'gatsby-link'; import Helmet from 'react-helmet'; import styled , { injectGlobal, keyframes } from 'styled-components'; // import '../css/index.css'; // add some style if you want! import Header from '../components/header.js' import PostCard from '../components/post-card.js' import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import AppBarExampleIconButton from "../components/nav.js" const Container = styled.div` min-width: 100%; min-height: 100vh ; background-color: #fafbfc; overflow: hidden; position: relative; ` const Main = styled.div` display: flex; justify-content: center; flex-direction: row; overflow: hidden; ` export default function Index({ data }) { const { edges: posts } = data.allMarkdownRemark; return ( <MuiThemeProvider> <Container className="container-fluid"> <Header title="Back To Home" path = "/"/> <Main> <div className="col-md-6"> {posts .filter(post => post.node.frontmatter.title.length > 0 ) .map(({ node: post }) => { return ( <PostCard key = {post.id} title = {post.frontmatter.title} date = {post.frontmatter.date} excerpt = {post.excerpt} path = { post.frontmatter.path } /> ) }) } </div> </Main> <footer> <p>Designed by Kai — 2017 ©</p> </footer> </Container> </MuiThemeProvider> ) } export const pageQuery = graphql` query IndexQuery { allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date]}){ edges { node{ excerpt(pruneLength: 250) id frontmatter { title date(formatString: "MMMM DD, YYYY") path } } } } } `
examples/gh-pages/components/Intro.js
broucz/react-inline-grid
import React, { Component } from 'react'; import { Row, Cell } from 'react-inline-grid'; import { COLOR } from '../constants'; import Box from './Box'; const { gray, primary } = COLOR; class Intro extends Component { render() { return ( <div> <Row> <Cell is="3 tablet-4 phone-4"><Box color={gray}/></Cell> <Cell is="3 tablet-4 phone-4"><Box color={gray}/></Cell> <Cell is="3 tablet-6 phone-4"><Box color={gray}/></Cell> <Cell is="3 tablet-2 phone-4"><Box color={primary}/></Cell> <Cell is="4 tablet-8 phone-2"><Box size="big" color={gray}/></Cell> <Cell is="4 tablet-8 phone-2"><Box size="big" color={gray}/></Cell> <Cell is="4 tablet-8"><Box size="big" color={primary}/></Cell> <Cell is="6 tablet-4"><Box size="huge" color={gray}/></Cell> <Cell is="4"><Box size="huge" color={gray}/></Cell> <Cell is="2 tablet-8 phone-4"><Box size="huge" color={primary}/></Cell> </Row> </div> ); } } export default Intro;
app/components/TouchableItem/index.android.js
JSSolutions/Perfi
import T from 'prop-types'; import React from 'react'; import { TouchableNativeFeedback, TouchableOpacity, Platform, View, } from 'react-native'; const noop = () => {}; const Button = ({ onPress = noop, onLongPress = noop, onLayout = noop, children, rippleColor, style, backgroundType, borderless = false, ...props }) => { if (Platform.Version < 21) { return ( <TouchableOpacity onLongPress={onLongPress} onLayout={onLayout} onPress={onPress} style={style} {...props} > {children} </TouchableOpacity> ); } return ( <TouchableNativeFeedback onLongPress={onLongPress} onLayout={onLayout} onPress={onPress} {...props} background={backgroundType ? TouchableNativeFeedback[backgroundType]() : TouchableNativeFeedback.Ripple(rippleColor, borderless)} > {style ? ( <View style={style}> {children} </View> ) : ( children )} </TouchableNativeFeedback> ); }; Button.defaultProps = { onPress: noop, onLongPress: noop, onLayout: noop, rippleColor: '#d5d3d5', }; Button.propTypes = { onPress: T.func, children: T.any, style: T.any, onLongPress: T.func, onLayout: T.func, rippleColor: T.string, backgroundType: T.string, borderless: T.bool, }; export default Button;
app/jsx/blueprint_courses/components/CourseFilter.js
djbender/canvas-lms
/* * Copyright (C) 2017 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ import I18n from 'i18n!blueprint_settingsCourseFilter' import React from 'react' import PropTypes from 'prop-types' import {TextInput} from '@instructure/ui-forms' import {ScreenReaderContent} from '@instructure/ui-a11y' import {Flex} from '@instructure/ui-layout' import CanvasSelect from 'jsx/shared/components/CanvasSelect' import propTypes from '../propTypes' const {func} = PropTypes const MIN_SEACH = 3 // min search term length for API export default class CourseFilter extends React.Component { static propTypes = { onChange: func, onActivate: func, terms: propTypes.termList.isRequired, subAccounts: propTypes.accountList.isRequired } static defaultProps = { onChange: () => {}, onActivate: () => {} } constructor(props) { super(props) this.state = { isActive: false, search: '', term: '', subAccount: '' } } componentDidUpdate(prevProps, prevState) { if ( prevState.search !== this.state.search || prevState.term !== this.state.term || prevState.subAccount !== this.state.subAccount ) { this.props.onChange(this.state) } } onChange = () => { this.setState({ search: this.getSearchText() }) } getSearchText() { const searchText = this.searchInput.value.trim().toLowerCase() return searchText.length >= MIN_SEACH ? searchText : '' } handleFocus = () => { if (!this.state.isActive) { this.setState( { isActive: true }, () => { this.props.onActivate() } ) } } handleBlur = () => { // the timeout prevents the courses from jumping between open between and close when you tab through the form elements setTimeout(() => { if (this.state.isActive) { const search = this.searchInput.value const isEmpty = !search if (isEmpty && !this.wrapper.contains(document.activeElement)) { this.setState({ isActive: false }) } } }, 0) } render() { const termOptions = [ <CanvasSelect.Option key="all" id="all" value=""> {I18n.t('Any Term')} </CanvasSelect.Option>, ...this.props.terms.map(term => ( <CanvasSelect.Option key={term.id} id={term.id} value={term.id}> {term.name} </CanvasSelect.Option> )) ] const subAccountOptions = [ <CanvasSelect.Option key="all" id="all" value=""> {I18n.t('Any Sub-Account')} </CanvasSelect.Option>, ...this.props.subAccounts.map(account => ( <CanvasSelect.Option key={account.id} id={account.id} value={account.id}> {account.name} </CanvasSelect.Option> )) ] return ( <div className="bca-course-filter" ref={c => { this.wrapper = c }} > <Flex wrapItems> <Flex.Item grow padding="0 x-small x-small 0"> <TextInput ref={c => { this.searchInput = c }} type="search" onChange={this.onChange} onFocus={this.handleFocus} onBlur={this.handleBlur} placeholder={I18n.t('Search by title, short name, or SIS ID')} label={<ScreenReaderContent>{I18n.t('Search Courses')}</ScreenReaderContent>} /> </Flex.Item> <Flex.Item padding="0 x-small x-small 0"> <CanvasSelect id="termsFilter" key="terms" value={this.state.term} onChange={(e, value) => this.setState({term: value})} label={<ScreenReaderContent>{I18n.t('Select Term')}</ScreenReaderContent>} > {termOptions} </CanvasSelect> </Flex.Item> <Flex.Item padding="0 0 x-small 0"> <CanvasSelect id="subAccountsFilter" key="subAccounts" value={this.state.subAccount} onChange={(e, value) => this.setState({subAccount: value})} label={<ScreenReaderContent>{I18n.t('Select Sub-Account')}</ScreenReaderContent>} > {subAccountOptions} </CanvasSelect> </Flex.Item> </Flex> </div> ) } }
app/components/presentation/PasswordChangeForm.js
PHPiotr/phpiotr4
import React from 'react'; import Button from 'material-ui/Button'; import {FormControl} from 'material-ui/Form'; import Input, {InputLabel, InputAdornment} from 'material-ui/Input'; import IconButton from 'material-ui/IconButton'; import Visibility from 'material-ui-icons/Visibility'; import VisibilityOff from 'material-ui-icons/VisibilityOff'; import {withStyles} from 'material-ui/styles'; import {formStyles as styles} from '../../utils/styles'; const PasswordChangeForm = (props) => { const handleSubmit = event => props.handleSubmit(event, props.token); return ( <form className={props.classes.root} onSubmit={handleSubmit}> <FormControl component="fieldset"> <FormControl className={props.classes.formControl}> <InputLabel htmlFor="current-password">{`Current password: ${(props.passwordChangeInputErrors.currentPassword && props.passwordChangeInputErrors.currentPassword.message) || ''}`}</InputLabel> <Input id="current-password" name="currentPassword" type={props.showCurrentPassword ? 'text' : 'password'} onChange={props.handleChange} onFocus={props.handleFocus} value={props.currentPassword} error={!!((props.passwordChangeInputErrors.currentPassword && props.passwordChangeInputErrors.currentPassword.message))} endAdornment={ <InputAdornment position="end"> <IconButton onClick={props.handleClickToggleCurrentPassword}> {props.showCurrentPassword ? <VisibilityOff /> : <Visibility />} </IconButton> </InputAdornment> } /> </FormControl> <FormControl className={props.classes.formControl}> <InputLabel htmlFor="new-password">{`New password: ${(props.passwordChangeInputErrors.password && props.passwordChangeInputErrors.password.message) || ''}`}</InputLabel> <Input id="new-password" name="password" type={props.showPassword ? 'text' : 'password'} onChange={props.handleChange} onFocus={props.handleFocus} value={props.password} error={!!((props.passwordChangeInputErrors.password && props.passwordChangeInputErrors.password.message))} endAdornment={ <InputAdornment position="end"> <IconButton onClick={props.handleClickToggleNewPassword}> {props.showPassword ? <VisibilityOff /> : <Visibility />} </IconButton> </InputAdornment> } /> </FormControl> <FormControl className={props.classes.formControl}> <InputLabel htmlFor="new-password-repeat">{`Repeat new password: ${(props.passwordChangeInputErrors.repeatPassword && props.passwordChangeInputErrors.repeatPassword.message) || ''}`}</InputLabel> <Input id="new-password-repeat" name="repeatPassword" type={props.showRepeatPassword ? 'text' : 'password'} onChange={props.handleChange} onFocus={props.handleFocus} value={props.repeatPassword} error={!!((props.passwordChangeInputErrors.repeatPassword && props.passwordChangeInputErrors.repeatPassword.message))} endAdornment={ <InputAdornment position="end"> <IconButton onClick={props.handleClickToggleRepeatNewPassword}> {props.showRepeatPassword ? <VisibilityOff /> : <Visibility />} </IconButton> </InputAdornment> } /> </FormControl> <FormControl className={props.classes.formControl}> <Button variant="raised" color="primary" type="submit">Change</Button> </FormControl> </FormControl> </form> ); }; export default withStyles(styles)(PasswordChangeForm);
src/svg-icons/av/branding-watermark.js
nathanmarks/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvBrandingWatermark = (props) => ( <SvgIcon {...props}> <path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16h-9v-6h9v6z"/> </SvgIcon> ); AvBrandingWatermark = pure(AvBrandingWatermark); AvBrandingWatermark.displayName = 'AvBrandingWatermark'; AvBrandingWatermark.muiName = 'SvgIcon'; export default AvBrandingWatermark;