path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
app/components/login/LoginController.js
jefferchang/reactApp
/** * Created by jeffer on 2016/4/2. */ import './../../less/login.less'; import React from 'react' import LoginStore from './../../stores/LoginStore'; import {Panel,Grid,Col,Row, Input,Button ,ButtonToolbar} from 'react-bootstrap'; import { browserHistory, Router, Route, Link} from 'react-router' var styles = {}; styles.container={ padding: 11, fontWeight: 220 } var LoginController = React.createClass( { /* contextTypes: { router: React.PropTypes.object },*/ getInitialState:function() { return { disabled: true, style: null }; }, resetValidation: function () { this.setState({ disabled: true, style: null }); }, validationState :function() { let length = this.refs.email.getValue().length; let style = 'success'; let disabled = style !== 'success'; return { style, disabled }; }, handleChange: function (){ this.setState( this.validationState() ); }, handleSubmit(event) { event.preventDefault() var vm=this; const email = this.refs.email.value const pass = this.refs.pass.value const { location } = this.props //this.context.router.replace('m_index') LoginStore.login(email, pass).then(function (response) { response.json().then(json => { if(json){ window.location.href= "/"; } return true; }) }, function (response) { response.json().then(json => { console.log(json[0].text); }) }) }, render: function() { return ( <div> <form onSubmit={this.handleSubmit}> <div className="form-horizontal" > <Input type="text" label="用户名:" labelClassName="col-xs-4" className="input-lg" wrapperClassName="col-xs-4" ref="email" onChange={this.handleChange} /> <Input type="password" label="密码:" labelClassName="col-xs-4" className="input-lg" wrapperClassName="col-xs-4" ref="pass" /> <Input type="checkbox" label="记住密码" wrapperClassName="col-xs-offset-4 col-xs-4" /> <Grid> <Row className="show-grid"> <Col sm={12} md={5} > <Button className="pull-right" type="submit" bsStyle="primary" value="submit" disabled={this.state.disabled} >登录</Button> </Col> <Col sm={12} md={1}> <Button className="pull-right" type="reset" bsStyle="default" onClick={this.resetValidation} >重置</Button> </Col> </Row> </Grid> </div> </form> </div> ) } }) module.exports = LoginController
lib/client/js/components/notifications-container.js
Bornholm/yasp
/* jshint esnext: true, node: true */ 'use strict'; import React from 'react'; import { translate } from 'react-i18next'; class NotificationsContainer extends React.Component { constructor() { super(); this.state = { timeoutId: false }; this.handleTick = this.handleTick.bind(this); this.handleNotificationClose = this.handleNotificationClose.bind(this); } /* jshint ignore:start */ render() { let t = this.props.t; let notifications = this.props.notifications || []; let alerts = notifications.map((n, i) => { return ( <div key={'notification-'+i} className={'alert alert-'+n.type}> <button type="button" className="close" onClick={this.handleNotificationClose} data-notification-index={i}> <span aria-hidden="true">&times;</span> </button> {n.message} </div> ); }).reverse(); return ( <div {...this.props}> {alerts} </div> ); } /* jshint ignore:end */ componentWillMount() { this.startTimer(); } componentWillUnmount() { this.stopTimer(); } componentDidUpdate() { let notifications = this.props.notifications; if(!notifications || notifications.length === 0) return; if(!this.isTimerRunning()) this.startTimer(); } isTimerRunning() { return !!this.state.timeoutId; } startTimer() { if(this.state.timeoutId) this.stopTimer(); let timeoutId = setTimeout(this.handleTick, this.props.delay || 10000); this.setState({timeoutId}); } stopTimer() { let timeoutId = this.state.timeoutId; if(timeoutId) clearTimeout(this.state.timeoutId); this.setState({timeoutId: false}); } handleTick() { let notifications = this.props.notifications; if(!notifications || notifications.length === 0) return; notifications.shift(); this.forceUpdate(); if(notifications.length > 0) this.startTimer(); } handleNotificationClose(evt) { let notificationIndex = evt.target.dataset.notificationIndex; let notifications = this.props.notifications; notifications.splice(+notificationIndex, 1); this.forceUpdate(); } } export default translate(['notifications', 'errors'])(NotificationsContainer);
lib/new-project-template/new-project/src/components/App.js
markmarcelo/reactide
import React, { Component } from 'react'; class App extends Component { constructor() { super(); this.state = { count: 0 } this.clickHandler = this.clickHandler.bind(this); } clickHandler() { this.setState({ count: ++this.state.count }) } render() { return ( <div className="App"> <div className="App-header"> <h2 onClick={this.clickHandler}>Welcome to REACTIDE dudes</h2> <h3>{this.state.count}</h3> </div> </div> ); } } export default App;
src/ListItem/__tests__/ListItem_test.js
react-fabric/react-fabric
import React from 'react' import { render, mount } from 'enzyme' import test from 'tape' import ListItem from '..' import ListItemAction from '../ListItemAction.js' test('ListItem', t => { t.ok(ListItem, 'export') t.equal(ListItem.Action, ListItemAction, '.Action export') t.equal(ListItem.displayName, 'FabricComponent(ListItem)') t.end() }) test('ListItem#render - simple', t => { const container = render( <ListItem primaryText="Foo" /> ).contents() t.assert(container.is('li.ms-ListItem', 'container')) t.assert(container.is('[data-fabric="ListItem"]'), 'data-fabric') t.equal(container.find('.ms-ListItem-primaryText').text(), 'Foo') t.end() }) test('ListItem#render - with actions', t => { const wrapper = render( <ListItem primaryText="Foo"> <ListItem.Action glyph="star" /> <ListItem.Action glyph="pinLeft" /> <ListItem.Action glyph="trash" /> </ListItem> ) t.equal(wrapper.find('.ms-ListItem-actions').children().length, 3) t.end() }) test('ListItem#render - simple', t => { const container = render( <ListItem primaryText="Foo" /> ).contents() t.assert(container.is('li.ms-ListItem', 'container')) t.assert(container.is('[data-fabric="ListItem"]'), 'data-fabric') t.equal(container.find('.ms-ListItem-primaryText').text(), 'Foo') t.end() }) test('ListItem#render - DOM', t => { t.plan(4) const handlers = [ (checked) => t.equal(checked, true), (checked) => t.equal(checked, false), ] const wrappers = [ mount(<ListItem selectable checked={false} onChange={handlers[0]} />), mount(<ListItem selectable checked onChange={handlers[1]} />) ] const selectionTargets = wrappers.map(wrapper => ( wrapper.find('.ms-ListItem-selectionTarget') )) selectionTargets.forEach(selectionTarget => { t.equal(selectionTarget.length, 1) selectionTarget.simulate('click') }) })
app/javascript/mastodon/features/list_editor/components/account.js
danhunsaker/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { makeGetAccount } from '../../../selectors'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Avatar from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; import IconButton from '../../../components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import { removeFromListEditor, addToListEditor } from '../../../actions/lists'; const messages = defineMessages({ remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' }, add: { id: 'lists.account.add', defaultMessage: 'Add to list' }, }); const makeMapStateToProps = () => { const getAccount = makeGetAccount(); const mapStateToProps = (state, { accountId, added }) => ({ account: getAccount(state, accountId), added: typeof added === 'undefined' ? state.getIn(['listEditor', 'accounts', 'items']).includes(accountId) : added, }); return mapStateToProps; }; const mapDispatchToProps = (dispatch, { accountId }) => ({ onRemove: () => dispatch(removeFromListEditor(accountId)), onAdd: () => dispatch(addToListEditor(accountId)), }); export default @connect(makeMapStateToProps, mapDispatchToProps) @injectIntl class Account extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, intl: PropTypes.object.isRequired, onRemove: PropTypes.func.isRequired, onAdd: PropTypes.func.isRequired, added: PropTypes.bool, }; static defaultProps = { added: false, }; render () { const { account, intl, onRemove, onAdd, added } = this.props; let button; if (added) { button = <IconButton icon='times' title={intl.formatMessage(messages.remove)} onClick={onRemove} />; } else { button = <IconButton icon='plus' title={intl.formatMessage(messages.add)} onClick={onAdd} />; } return ( <div className='account'> <div className='account__wrapper'> <div className='account__display-name'> <div className='account__avatar-wrapper'><Avatar account={account} size={36} /></div> <DisplayName account={account} /> </div> <div className='account__relationship'> {button} </div> </div> </div> ); } }
spec/components/dropdown.js
VACO-GitHub/vaco-components-library
import React from 'react'; import Dropdown from '../../components/dropdown'; import style from '../style'; const countries = [ { value: 'EN-gb', label: 'England', img: 'http://' }, { value: 'ES-es', label: 'Spain', img: 'http://' }, { value: 'TH-th', label: 'Thailand', img: 'http://' }, { value: 'EN-en', label: 'USA', img: 'http://' }, { value: 'FR-fr', label: 'France', img: 'http://' } ]; class DropdownTest extends React.Component { state = { dropdown4: 'TH-th' }; handleChange = (dropdown, value) => { const newState = {}; newState[dropdown] = value; this.setState(newState); }; customDropdownItem (data) { return ( <div className={style.dropdownTemplate}> <img className={style.dropdownTemplateImage} src={data.img} /> <div className={style.dropdownTemplateContent}> <strong>{data.label}</strong> <small>{data.value}</small> </div> </div> ); } render () { return ( <section> <h5>Dropdown</h5> <p>lorem ipsum...</p> <Dropdown label="Country" ref="dropdown1" onChange={this.handleChange.bind(this, 'dropdown1')} source={countries} template={this.customDropdownItem} value={this.state.dropdown1} /> <Dropdown label="Country" ref="dropdown4" onChange={this.handleChange.bind(this, 'dropdown4')} source={countries} value={this.state.dropdown4} /> <Dropdown disabled ref="dropdown3" label="Country" onChange={this.handleChange.bind(this, 'dropdown3')} source={countries} /> <Dropdown label="Country" ref="dropdown5" onChange={this.handleChange.bind(this, 'dropdown5')} source={countries} required /> </section> ); } } export default DropdownTest;
src/form/FormInput.js
martinezguillaume/react-native-elements
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { Animated, Easing, TextInput, StyleSheet, Platform, Dimensions, Text as NativeText, } from 'react-native'; import colors from '../config/colors'; import normalize from '../helpers/normalizeText'; import ViewPropTypes from '../config/ViewPropTypes'; const { width } = Dimensions.get('window'); class FormInput extends Component { constructor(props) { super(props); this.shake = this.shake.bind(this); } componentWillMount() { this.shakeAnimationValue = new Animated.Value(0); this.props.shake && this.shake(); } componentWillReceiveProps(nextProps) { nextProps.shake && this.props.shake !== nextProps.shake && this.shake(); } getRef = () => { return this.input || this.refs[this.props.textInputRef]; }; getRefHandler = () => { if (this.props.textInputRef) { if (typeof this.props.textInputRef === 'function') { return input => { this.input = input; this.props.textInputRef(input); }; } else { return this.props.textInputRef; } } else { return input => (this.input = input); } }; focus() { this.getRef() && this.getRef().focus(); } blur() { this.getRef() && this.getRef().blur(); } clearText() { this.getRef() && this.getRef().clear(); } shake() { const { shakeAnimationValue } = this; shakeAnimationValue.setValue(0); Animated.timing(shakeAnimationValue, { duration: 375, toValue: 3, ease: Easing.bounce, }).start(); } render() { const { containerStyle, inputStyle, containerRef, normalizeFontSize, ...attributes } = this.props; const translateX = this.shakeAnimationValue.interpolate({ inputRange: [0, 0.5, 1, 1.5, 2, 2.5, 3], outputRange: [0, -15, 0, 15, 0, -15, 0], }); return ( <Animated.View ref={containerRef} style={[ styles.container, containerStyle && containerStyle, { transform: [{ translateX }], }, ]} > <TextInput {...attributes} ref={this.getRefHandler()} style={[ styles.input, { fontSize: normalizeFontSize ? normalize(14) : 14 }, inputStyle && inputStyle, ]} /> </Animated.View> ); } } FormInput.propTypes = { containerStyle: ViewPropTypes.style, inputStyle: NativeText.propTypes.style, // Deprecated textInputRef: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), // Deprecated containerRef: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), normalizeFontSize: PropTypes.bool, shake: PropTypes.oneOfType([ PropTypes.string, PropTypes.bool, PropTypes.object, PropTypes.number, PropTypes.array, ]), }; FormInput.defaultProps = { normalizeFontSize: true, }; const styles = StyleSheet.create({ container: { marginLeft: 15, marginRight: 15, ...Platform.select({ ios: { borderBottomColor: colors.grey4, borderBottomWidth: 1, marginLeft: 20, marginRight: 20, }, }), }, input: { ...Platform.select({ android: { minHeight: 46, width: width - 30, }, ios: { minHeight: 36, width: width, }, }), // breaks tests - fix before release // Invariant Violation: Invalid undefined `width` of type `string` // supplied to `StyleSheet input`, expected `number`. // width: '100%', color: colors.grey3, }, }); export default FormInput;
client/node_modules/uu5g03/dist-node/bricks/accordion.js
UnicornCollege/ucl.itkpd.configurator
import React from 'react'; import {BaseMixin, ElementaryMixin, ColorSchemaMixin, ContentMixin, Tools} from '../common/common.js'; import Panel from './panel.js'; import './accordion.less'; export const Accordion = React.createClass({ //@@viewOn:mixins mixins: [ BaseMixin, ElementaryMixin, ColorSchemaMixin, ContentMixin ], //@@viewOff:mixins //@@viewOn:statics statics: { tagName: 'UU5.Bricks.Accordion', classNames: { main: 'uu5-bricks-accordion panel-group' }, defaults: { childTagName: 'UU5.Bricks.Panel' }, warnings: { unsupportedType: 'Type %s of parameter %s is not supported. Allowed types are: %s.' } }, //@@viewOff:statics //@@viewOn:propTypes propTypes: { panels: React.PropTypes.arrayOf(React.PropTypes.object), onClickNotCollapseOthers: React.PropTypes.bool, glyphiconExpanded: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.object ]), glyphiconCollapsed: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.object ]), onClick: React.PropTypes.func, allowTags: React.PropTypes.array }, //@@viewOff:propTypes //@@viewOn:getDefaultProps getDefaultProps: function () { return { panels: null, glyphiconExpanded: null, glyphiconCollapsed: null, onClickNotCollapseOthers: false, onClick: null, allowTags: [] }; }, //@@viewOff:getDefaultProps //@@viewOn:standardComponentLifeCycle //@@viewOff:standardComponentLifeCycle //@@viewOn:interface getPanelById: function (panelId) { return this.getRenderedChildById(panelId); }, getPanelByName: function (panelName) { return this.getRenderedChildByName(panelName); }, getPanels: function () { return this.getRenderedChildren(); }, eachPanel: function (callback) { var panels = this.getPanels(); for (var i = 0; i < panels.length; i++) { var result = callback(panels[i], i); if (result === false) { break; } } return this; }, eachPanelByIds: function (ids, callback) { for (var i = 0; i < ids.length; i++) { var result = callback(this.getPanelById(ids[i]), i); if (result === false) { break; } } return this; }, eachPanelByNames: function (names, callback) { for (var i = 0; i < names.length; i++) { var result = callback(this.getPanelByName(names[i]), i); if (result === false) { break; } } return this; }, expandPanelById: function (panelId, setStateCallback) { this._eachPanelByIdWithCallback(panelId, setStateCallback, function (panel, i, newSetStateCallback) { panel.expand(newSetStateCallback); }); return this; }, expandPanelByName: function (panelName, setStateCallback) { this._eachPanelByNameWithCallback(panelName, setStateCallback, function (panel, i, newSetStateCallback) { panel.expand(newSetStateCallback); }); return this; }, collapsePanelById: function (panelId, setStateCallback) { this._eachPanelByIdWithCallback(panelId, setStateCallback, function (panel, i, newSetStateCallback) { panel.collapse(newSetStateCallback); }); return this; }, collapsePanelByName: function (panelName, setStateCallback) { this._eachPanelByNameWithCallback(panelName, setStateCallback, function (panel, i, newSetStateCallback) { panel.collapse(newSetStateCallback); }); return this; }, togglePanelById: function (panelId, setStateCallback) { this._eachPanelByIdWithCallback(panelId, setStateCallback, function (panel, i, newSetStateCallback) { panel.toggle(newSetStateCallback); }); return this; }, togglePanelByName: function (panelName, setStateCallback) { this._eachPanelByNameWithCallback(panelName, setStateCallback, function (panel, i, newSetStateCallback) { panel.toggle(newSetStateCallback); }); return this; }, expandAll: function (setStateCallback) { this._eachPanelWithCallback(setStateCallback, function (panel, i, newSetStateCallback) { panel.expand(newSetStateCallback); }); return this; }, collapseAll: function (setStateCallback) { this._eachPanelWithCallback(setStateCallback, function (panel, i, newSetStateCallback) { panel.collapse(newSetStateCallback); }); return this; }, toggleAll: function (setStateCallback) { this._eachPanelWithCallback(setStateCallback, function (panel, i, newSetStateCallback) { panel.toggle(newSetStateCallback); }); return this; }, shouldCollapseOthers: function () { return !this.props.onClickNotCollapseOthers; }, collapseOthers: function (panelId, setStateCallback) { var panels = this.getPanels(); var counter = 0; panels.forEach(function (panel) { panel.getId() !== panelId && panel.isExpandable() && counter++; }); var newSetStateCallback = Tools.buildCounterCallback(setStateCallback, counter); panels.forEach(function (panel) { panel.getId() !== panelId && panel.isExpandable() && panel.collapse(newSetStateCallback); }); return this; }, //@@viewOff:interface //@@viewOn:overridingMethods shouldChildRender_: function (child) { var childTagName = Tools.getChildTagName(child); var childTagNames = this.props.allowTags.concat(this.getDefault().childTagName); return childTagNames.indexOf(childTagName) > -1; }, expandChildProps_: function (child, i) { var newChildProps = Tools.mergeDeep({}, child.props); var onClick = newChildProps.onClick || this.props.onClick; newChildProps.onClick = this.shouldCollapseOthers() ? (panel)=> { (panel && panel.isExpanded()) ? this.collapseOthers(panel.getId(), () => onClick && onClick(panel)) : child.props.onClick ? child.props.onClick(panel) : this.props.onClick ? this.props.onClick(panel) : null } : child.props.onClick || this.props.onClick; newChildProps.glyphiconExpanded = newChildProps.glyphiconExpanded || this.props.glyphiconExpanded; newChildProps.glyphiconCollapsed = newChildProps.glyphiconCollapsed || this.props.glyphiconCollapsed; newChildProps.colorSchema = newChildProps.colorSchema || this.props.colorSchema; return newChildProps; }, //@@viewOff:overridingMethods //@@viewOn:componentSpecificHelpers _getValuesAsArray: function (value, name) { var values = []; if (typeof value === 'string') { values = [value]; } else if (Array.isArray(value)) { values = value; } else { this.showWarning('unsupportedType', [typeof value, name, 'string, array']); } return values }, _eachPanelWithCallback: function (setStateCallback, callback) { var panels = this.getPanels(); var newSetStateCallback = Tools.buildCounterCallback(setStateCallback, panels.length); for (var i = 0; i < panels.length; i++) { var result = callback(panels[i], i, newSetStateCallback); if (result === false) { break; } } return this; }, _eachPanelByIdWithCallback: function (panelId, setStateCallback, callback) { var ids = this._getValuesAsArray(panelId, 'panelId'); var newSetStateCallback = Tools.buildCounterCallback(setStateCallback, ids.length); this.eachPanelByIds(ids, function (panel, i) { return callback(panel, i, newSetStateCallback); }); return this; }, _eachPanelByNameWithCallback: function (panelName, setStateCallback, callback) { var names = this._getValuesAsArray(panelName, 'panelName'); var newSetStateCallback = Tools.buildCounterCallback(setStateCallback, names.length); this.eachPanelByNames(names, function (panel, i) { return callback(panel, i, newSetStateCallback); }); return this; }, //@@viewOff:componentSpecificHelpers //Render _buildChildren: function () { var childrenProps = {}; if (this.props.panels) { childrenProps.content = {tag: this.getDefault().childTagName, propsArray: this.props.panels}; } else if (this.props.children) { childrenProps.children = this.props.children; } else { childrenProps.content = <Panel />; } return this.buildChildren(childrenProps); }, //@@viewOn:render render: function () { return ( <div {...this.buildMainAttrs()}> {this._buildChildren()} {this.getDisabledCover()} </div> ); } //@@viewOff:render }); export default Accordion;
app/containers/Wantplus.js
suyiya/wantplus-react-native
/** * Created by SUYIYA on 16/8/28. */ 'use strict'; import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Navigator, Text, View, TouchableOpacity, Platform, Image } from 'react-native'; import SplashPage from './Splash'; export default class Wantplus extends Component { constructor() { super(); } render() { var defaultName = 'Splash'; var defaultComponent = SplashPage; return ( <Navigator initialRoute={{name: defaultName, component: defaultComponent}} configureScene={(route) => { return Navigator.SceneConfigs.PushFromRight; }} renderScene={(route, navigator) => { let Component = route.component; return <Component {...route.params} navigator={navigator}/> }} //sceneStyle={{paddingTop: (Platform.OS === 'android' ? 66 : 64)}} //navigationBar={this._renderNavBar()} /> ); } }
1l_React_ET_Lynda/Ex_Files_React_EssT/Ch02/02_07/start/src/lib.js
yevheniyc/Autodidact
import React from 'react' import text from './titles.json' export const hello = ( <h1 id='title' className='header' style={{backgroundColor: 'purple', color: 'yellow'}}> {text.hello} </h1> ) export const goodbye = ( <h1 id='title' className='header' style={{backgroundColor: 'yellow', color: 'purple'}}> {text.goodbye} </h1> )
app/src/containers/DevTools.js
civa86/web-synth
import React from 'react'; import { createDevTools } from 'redux-devtools'; import LogMonitor from 'redux-devtools-log-monitor'; import DockMonitor from 'redux-devtools-dock-monitor'; export default createDevTools( <DockMonitor toggleVisibilityKey='ctrl-h' changePositionKey='ctrl-q' defaultIsVisible={false}> <LogMonitor /> </DockMonitor> );
frontend/src/App.js
4devs/symfony-react
import React, { Component } from 'react'; import { Provider } from 'react-redux'; import { ConnectedRouter } from 'react-router-redux'; import Root from './components/Root'; import store from './redux'; import history from './history'; import './config'; class App extends Component { render() { return ( <Provider store={store}> <ConnectedRouter history={history}> <Root /> </ConnectedRouter> </Provider> ); } } export default App;
docs/src/examples/views/Statistic/Variations/StatisticExampleColored.js
Semantic-Org/Semantic-UI-React
import React from 'react' import { Statistic } from 'semantic-ui-react' const StatisticExampleColored = () => ( <Statistic.Group> <Statistic color='red'> <Statistic.Value>27</Statistic.Value> <Statistic.Label>red</Statistic.Label> </Statistic> <Statistic color='orange'> <Statistic.Value>8'</Statistic.Value> <Statistic.Label>orange</Statistic.Label> </Statistic> <Statistic color='yellow'> <Statistic.Value>28</Statistic.Value> <Statistic.Label>yellow</Statistic.Label> </Statistic> <Statistic color='olive'> <Statistic.Value>7'</Statistic.Value> <Statistic.Label>olive</Statistic.Label> </Statistic> <Statistic color='green'> <Statistic.Value>14</Statistic.Value> <Statistic.Label>green</Statistic.Label> </Statistic> <Statistic color='teal'> <Statistic.Value>82</Statistic.Value> <Statistic.Label>teal</Statistic.Label> </Statistic> <Statistic color='blue'> <Statistic.Value>1'</Statistic.Value> <Statistic.Label>blue</Statistic.Label> </Statistic> <Statistic color='violet'> <Statistic.Value>22</Statistic.Value> <Statistic.Label>violet</Statistic.Label> </Statistic> <Statistic color='purple'> <Statistic.Value>23</Statistic.Value> <Statistic.Label>purple</Statistic.Label> </Statistic> <Statistic color='pink'> <Statistic.Value>15</Statistic.Value> <Statistic.Label>pink</Statistic.Label> </Statistic> <Statistic color='brown'> <Statistic.Value>36</Statistic.Value> <Statistic.Label>brown</Statistic.Label> </Statistic> <Statistic color='grey'> <Statistic.Value>49</Statistic.Value> <Statistic.Label>grey</Statistic.Label> </Statistic> </Statistic.Group> ) export default StatisticExampleColored
packages/react-scripts/fixtures/kitchensink/src/features/syntax/CustomInterpolation.js
TryKickoff/create-kickoff-app
/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; const styled = ([style]) => style .trim() .split(/\s*;\s*/) .map(rule => rule.split(/\s*:\s*/)) .reduce((rules, rule) => ({ ...rules, [rule[0]]: rule[1] }), {}); function load() { return [ { id: 1, name: '1' }, { id: 2, name: '2' }, { id: 3, name: '3' }, { id: 4, name: '4' }, ]; } export default class extends Component { static propTypes = { onReady: PropTypes.func.isRequired, }; constructor(props) { super(props); this.state = { users: [] }; } async componentDidMount() { const users = load(); this.setState({ users }); } componentDidUpdate() { this.props.onReady(); } render() { const veryInlineStyle = styled` background: palevioletred; color: papayawhip; `; return ( <div id="feature-custom-interpolation"> {this.state.users.map(user => ( <div key={user.id} style={veryInlineStyle}> {user.name} </div> ))} </div> ); } }
components/Footer/Footer.js
zaneriley/personal-site
/** * React Static Boilerplate * https://github.com/kriasoft/react-static-boilerplate * * Copyright © 2015-present Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import React from 'react'; import Link from '../Link'; import LinkExternal from '../LinkExternal'; import SocialIcons from '../SocialIcons'; import g from '../../src/styles/grid.css'; import s from './Footer.css'; import iconDribbble from '../../src/assets/images/dribbble.svg'; import iconGithub from '../../src/assets/images/github.svg'; import iconCodepen from '../../src/assets/images/codepen.svg'; import iconTwitter from '../../src/assets/images/twitter.svg'; import iconAngellist from '../../src/assets/images/angellist.svg'; import iconLinkedIn from '../../src/assets/images/linkedin.svg'; function Footer() { return ( <footer className={`${g.gMarginTopLarge}`}> <div className={`${g.maxWidth}`}> <h2 className={`${g.g9m} ${g.g6l} ${s.mail}`}><a href="mailto:hello@zaneriley.com">hello@zaneriley.com</a></h2> <SocialIcons className={`${g.g9m} ${g.g6l}`}/> <p className={`${g.g9m} ${g.g6l}`}>Type is set in Maria and GT America. Site built with React, Post-CSS and Webpack. View it on <LinkExternal href="https://github.com/zaneriley/personal-site">Github</LinkExternal>.</p> <div className={`${g.textCenter}`}> <p><small>Copyright © 2014 - {new Date().getFullYear()} Zane Riley</small></p> </div> </div> </footer> ); } export default Footer;
blog-post-4/src/www/js/event-demo.js
DevelopIntelligenceBoulder/react-flux-blog
'use strict'; import React from 'react'; // eslint-disable-line no-unused-vars import ReactDOM from 'react-dom'; import EventDemo from './components/event-demo'; // eslint-disable-line no-unused-vars ReactDOM.render(<EventDemo />, document.querySelector('main'));
docs/src/app/pages/components/Input/ExampleInputCopy.js
GetAmbassador/react-ions
import React from 'react' import Input from 'react-ions/lib/components/Input' import EnhanceWithCopy from 'react-ions/lib/components/EnhanceWithCopy' export default EnhanceWithCopy(Input)
src/editor/components/SitemapNode.js
bfncs/linopress
import React from 'react'; import PropTypes from 'prop-types'; const SitemapNode = ({ sitemap, baseUrl, parentPath = '' }) => ( <ul> {sitemap.map(item => { const itemPath = `${parentPath}/${item.name}`.replace(/\/+/, '/'); return ( <li key={itemPath}> {item.name} {item.isNode && <span> <a href={`${baseUrl}${itemPath}`} target="_blank" rel="noopener noreferrer" > 👁 </a> <a href={`/editor?site=${itemPath}`}>🖉</a> </span>} {item.children && <SitemapNode sitemap={item.children} baseUrl={baseUrl} parentPath={itemPath} />} </li> ); })} </ul> ); SitemapNode.propTypes = { sitemap: PropTypes.arrayOf(PropTypes.object), baseUrl: PropTypes.string.isRequired, parentPath: PropTypes.string, }; export default SitemapNode;
src/index.js
stephanechorne/minimal-react-app
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; ReactDOM.render(<App/>, document.getElementById('root'));
App/Navigation/ReduxNavigation.js
samuraitruong/react-native-fx260
import React from 'react' import * as ReactNavigation from 'react-navigation' import { connect } from 'react-redux' import AppNavigation from './AppNavigation' // here is our redux-aware our smart component function ReduxNavigation (props) { const { dispatch, nav } = props const navigation = ReactNavigation.addNavigationHelpers({ dispatch, state: nav }) return <AppNavigation navigation={navigation} /> } const mapStateToProps = state => ({ nav: state.nav }) export default connect(mapStateToProps)(ReduxNavigation)
src/components/Outro.js
mirego/mirego-open-web
import React from 'react'; import styled from '@emotion/styled'; const Content = styled.div` margin: 0 0 100px; text-align: center; color: #666; p { margin-bottom: 6px; } @media (prefers-color-scheme: dark) { & { color: #aaa; } } `; export default () => ( <Content> <p>We’ve been developing open source software since 2012 and have contributed to dozens of projects.</p> <p>That means we unfortunately cannot list them all on this page.</p> <p> Take a look at our{' '} <a target="_blank" rel="noopener noreferrer" href="https://github.com/mirego"> GitHub profile </a>{' '} to learn more. </p> <p> Also, we’re <a href="https://life.mirego.com/en/available-positions">hiring</a>! </p> </Content> );
js/screens/WebViewPage.js
msbu-tech/msbu-tech-anywhere
import React, { Component } from 'react'; import { Text, View, ScrollView, TouchableOpacity, StyleSheet, AlertIOS, WebView, Dimensions, Platform } from 'react-native'; const SCREEN_WIDTH = Dimensions.get('window').width; const SCREEN_HEIGHT = Dimensions.get('window').height; const NAVIGATION_BAR_HEIGHT = 80; const returnButton = Platform.OS == 'ios' ? { leftButtons: [{ title: 'Close', id: 'close', icon: require('../assets/img/icon_back_normal.png') }] } : {}; export default class WebViewPage extends Component { static navigatorButtons = returnButton; constructor(props) { super(props); this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this)); } onNavigatorEvent(event) { if (event.id == 'close') { this.props.navigator.dismissModal(); } } _handleNavigationstateChange(info) { if(info.title && info.url.indexOf(info.title) < 0) { this.props.navigator.setTitle({ title: info.title }); } } renderError() { return ( <View style={styles.container}> <Text style={styles.title}>Error</Text> </View> ); } render() { return ( <View style={styles.container}> <WebView style={styles.webview} renderError={this.renderError.bind(this)} automaticallyAdjustContentInsets={true} mediaPlaybackRequiresUserAction={true} scalesPageToFit={false} javaScriptEnabled={true} domStorageEnabled={true} decelerationRate="normal" source={{uri: this.props.link}} onNavigationStateChange={this._handleNavigationstateChange.bind(this)}> </WebView> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', backgroundColor: 'white', justifyContent: 'center' }, title: { textAlign: 'center', fontSize: 18, marginBottom: 10, marginTop: 10, fontWeight: '500' }, webview: { width: SCREEN_WIDTH, height: Platform.OS == 'ios' ? SCREEN_HEIGHT : SCREEN_HEIGHT - NAVIGATION_BAR_HEIGHT } });
bear-api-koa/client/src/index.js
thoughtbit/node-web-starter
import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import configureStore from '~/store/configureStore'; import Provider from './Provider'; const store = configureStore(); ReactDOM.render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') );
app/components/campaign/push.js
imankit/dashboard-ui
/** * Created by Darkstar on 11/29/2016. */ import React from 'react'; import {connect} from 'react-redux'; import Toolbar from '../toolbar/toolbar.js'; import Footer from '../footer/footer.jsx'; import {showAlert, sendPushCampaign} from '../../actions'; import RaisedButton from 'material-ui/RaisedButton'; import Notifications from 'material-ui/svg-icons/alert/add-alert'; import FilterIcon from 'material-ui/svg-icons/content/filter-list'; import SelectAudience from './selectAudience' export class PushCampaign extends React.Component { constructor(props) { super(props) this.state = { message: '', title: '', progress: false, query: null, totalAudience: 0, os: [], channels: [] } } static get contextTypes() { return {router: React.PropTypes.object.isRequired} } componentWillMount() { // redirect if active app not found if (!this.props.appData.viewActive) { this.context.router.push('/') } else { let query = new CB.CloudQuery("Device") query.find().then((data) => { this.setState({totalAudience: data.length}) }, (err) => { console.log(err) }) } } sendPushCampaign() { if (this.state.message) { this.setState({progress: true}) let messageObject = { message: this.state.message, title: this.state.title || '' } sendPushCampaign(messageObject, this.state.query).then(() => { this.setState({progress: false}) showAlert('success', "Push Campaign Success") }, (err) => { this.setState({progress: false}) let error = err.response.data || 'No users found' if (err.response.status == 500) { error = "Server Error" } showAlert('error', error) }) } else showAlert('error', "Please enter a message.") } buildQuery(query, os, channels) { this.setState({query: query, os: os, channels: channels}) if (query) { query.find().then((data) => { this.setState({totalAudience: data.length}) }, (err) => { console.log(err) showAlert('error', "Select Audience Error") }) } } changeHandler(which, e) { this.state[which] = e.target.value this.setState(this.state) } render() { return ( <div id="" style={{ backgroundColor: '#FFF' }}> <div className="cache campaign"> <div className="" style={{ width: '100%' }}> <div className="flex-general-column-wrapper-center" style={{ width: '100%', marginTop: 20 }}> <div style={{ width: '100%' }} className="solo-horizontal-center"> <span style={{ color: '#169CEE', fontSize: 24, fontWeight: 700 }}>Create an push campaign</span> </div> <div style={{ width: '100%' }} className="solo-horizontal-center"> <span style={{ color: '#4F4F4F', fontSize: 14 }}>The best campaigns use short and direct messaging.</span> </div> <div className="push-box" style={{ marginTop: 15 }}> <div style={{ width: '100%', height: 100, backgroundColor: '#F7F7F7', borderBottom: '1px solid #C4C2C2' }}> <div style={{ width: '100%', height: '100%' }} className="flex-general-row-wrapper"> <div style={{ width: '40%', height: '100%', padding: 35 }}> <span style={{ color: '#353446', fontSize: 16, fontWeight: 700 }}>Title</span> </div> <div className="solo-vertical-center" style={{ width: '60%', height: '100%', backgroundColor: 'white', padding: 10 }}> <input type="text" className="emailinputcampaign" placeholder="Your notification title" style={{ width: '100%', height: 40, fontSize: 16, paddingLeft: 4 }} value={this.state.title} onChange={this.changeHandler.bind(this, 'title')}/> </div> </div> </div> <div style={{ width: '100%', height: 100, backgroundColor: '#F7F7F7' }}> <div style={{ width: '100%', height: '100%' }} className="flex-general-row-wrapper"> <div style={{ width: '40%', height: '100%', padding: 35 }}> <span style={{ color: '#353446', fontSize: 16, fontWeight: 700 }}>Message</span> </div> <div className="solo-vertical-center" style={{ width: '60%', height: '100%', backgroundColor: 'white', padding: 10 }}> <textarea rows={10} cols={90} style={{ height: '100%', border: 0, fontSize: 16, resize: 'none' }} placeholder="Your notification message" className="emailtextareacampaign" value={this.state.message} onChange={this.changeHandler.bind(this, 'message')}/> </div> </div> </div> </div> <div style={{ width: '100%' }} className="solo-horizontal-center"> <span style={{ color: '#169CEE', fontSize: 24, fontWeight: 700, marginTop: "20px" }}>Target your audience</span> </div> <div style={{ width: '100%' }} className="solo-horizontal-center"> <span style={{ color: '#4F4F4F', fontSize: 14 }}>Send to everyone, or use an audience to target the right users.</span> </div> <div className="audiencecontainerpush"> <div className="topdiv"> <span className="leftspanaud"> <i className="fa fa-hashtag icon" aria-hidden="true"></i>Channels</span> <span className="rightspanaud"> {this.state.channels.length > 0 ? this.state.channels.map((x, i) => <span key={i} className="channelslist">{x}</span>) : <span className="channelslist">All Channels</span> } </span> </div> <div className="bottomdiv"> <span className="leftspanaud"> <i className="fa fa-apple icon" aria-hidden="true"></i>OS</span> <span className="rightspanaud"> {this.state.os.length > 0 && this.state.os.length < 6 ? this.state.os.map((x, i) => <span key={i} className="channelslist">{x}</span>) : <span className="channelslist">All OS</span> } </span> </div> <span className="audsize">AUDIENCE SIZE - {this.state.totalAudience}</span> <SelectAudience buildQuery={this.buildQuery.bind(this)}/> </div> <div style={{ width: '100%', height: 50, marginTop: 15, marginBottom: 40 }}> <div style={{ width: '100%', height: '100%' }} className="flex-general-column-wrapper-center"> <div className="solo-vertical-center" style={{ height: '100%' }}> <RaisedButton label="Send campaign" labelPosition="before" primary={true} className="emailcampbtn" disabled={this.state.progress} onClick={this.sendPushCampaign.bind(this)}/> </div> </div> </div> </div> </div> </div> </div> ); } } const mapStateToProps = (state) => { return {appData: state.manageApp} } const mapDispatchToProps = (dispatch) => { return {} } export default connect(mapStateToProps, mapDispatchToProps)(PushCampaign);
src/components/topic/banner/leading-image.js
twreporter/twreporter-react
import PropTypes from 'prop-types' import React from 'react' import constPropTypes from '../../../constants/prop-types' import styled from 'styled-components' import { replaceGCSUrlOrigin } from '@twreporter/core/lib/utils/storage-url-processor' import { getSrcSet } from '../../../utils/img' // lodash import get from 'lodash/get' const _ = { get, } const FullScreenContainer = styled.figure` width: 100vw; height: ${props => props.viewportHeight}; ` const ImgPlaceholder = styled.img` display: ${props => (props.toShow ? 'block' : 'none')}; filter: blur(30px); object-fit: cover; opacity: 1; position: absolute; width: 100%; height: 100%; ` const StyledPicture = styled.picture` display: block; position: relative; width: 100%; height: 100%; ` const StyledImg = styled.img` position: absolute; width: 100%; height: 100%; object-fit: cover; opacity: ${props => (props.toShow ? '1' : '0')}; transition: opacity 1s; ` const ImgFallback = styled.div` width: 100%; height: 100%; background-size: cover; background-image: ${props => { return `url(${_.get(props, 'url')})` }}; background-position: center center; ` class LeadingImage extends React.PureComponent { constructor(props) { super(props) this.state = { isObjectFit: true, isLoaded: false, toShowPlaceholder: true, } this.onLoad = this._onLoad.bind(this) this._imgNode = null this._isMounted = false } componentDidMount() { this.setState({ isObjectFit: 'objectFit' in _.get(document, 'documentElement.style'), }) this._isMounted = true // Check if img is already loaded, and cached on the browser. // If cached, React.img won't trigger onLoad event. // Hence, we need to trigger re-rendering. if (this._imgNode) { this.onLoad() } } componentWillUnmount() { this._isMounted = false this._imgNode = null } _onLoad() { // Progressive image // Let user see the blur image, // and slowly make the blur image clearer // in order to make sure users see the blur image, // delay the clear image rendering setTimeout(() => { if (this._isMounted) { this.setState({ isLoaded: true, }) } }, 1500) setTimeout(() => { if (this._isMounted) { this.setState({ toShowPlaceholder: false, }) } }, 3000) } render() { const { isLoaded, isObjectFit, toShowPlaceholder } = this.state const { alt, imgSet, portraitImgSet, viewportHeight } = this.props const imgJSX = isObjectFit ? ( <StyledPicture> <meta itemProp="url" content={replaceGCSUrlOrigin(_.get(imgSet, 'desktop.url'))} /> <meta itemProp="description" content={alt} /> <ImgPlaceholder src={replaceGCSUrlOrigin(_.get(imgSet, 'tiny.url'))} toShow={toShowPlaceholder} /> <source media={'(orientation: portrait)'} srcSet={getSrcSet(portraitImgSet)} /> <source srcSet={getSrcSet(imgSet)} /> <StyledImg alt={alt} ref={node => { this._imgNode = node }} onLoad={this.onLoad} src={replaceGCSUrlOrigin(_.get(imgSet, 'tablet.url'))} toShow={isLoaded} /> </StyledPicture> ) : ( <ImgFallback url={replaceGCSUrlOrigin(_.get(imgSet, 'desktop.url'))} /> ) return ( <FullScreenContainer viewportHeight={viewportHeight} itemProp="image" itemScop itemType="http://schema.org/ImageObject" > {imgJSX} </FullScreenContainer> ) } } LeadingImage.defaultProps = { alt: '', imgSet: {}, portraitImgSet: {}, viewportHeight: '100vh', } LeadingImage.propTypes = { alt: PropTypes.string, imgSet: constPropTypes.imgSet, portraitImgSet: constPropTypes.imgSet, viewportHeight: PropTypes.string, } export default LeadingImage
src/components/Footer.js
RcrsvSquid/rcrsvsquid.github.io
import React from 'react' import styled from 'styled-components' import SocialIcon from './SocialIcon' import { BackgroundImg, Button, Card, Input, SplitSection, TextArea, } from './index' import { Center, Rounded, Thirds, ZDepth1 } from './mixins' export default ({ siteMetadata }) => ( <Footer> <h1>Sidney Wijngaarde</h1> <SocialIconWrap> <SocialIcon link={siteMetadata.pinterest} img={require('../assets/pinterest.png')} /> <SocialIcon link={siteMetadata.twitter} img={require('../assets/twitter.png')} /> <SocialIcon link={siteMetadata.github} img={require('../assets/github.png')} /> <SocialIcon link={siteMetadata.linkedin} img={require('../assets/linkedin.png')} /> <SocialIcon link={siteMetadata.email} img={require('../assets/gmail.png')} /> </SocialIconWrap> </Footer> ) const Footer = styled.footer` min-height: 10vh; display: flex; align-items: center; justify-content: space-between; padding: 20px 2.5vw; flex-flow: column wrap; h1 { text-align: center; opacity: 0.2; width: 100%; margin-bottom: 10px; font-family: 'Roboto Slab', serif; } // pure-md @media screen and (min-width: 48em) { } ` const SocialIconWrap = styled.div` height: 100%; display: flex; align-items: center; justify-content: flex-end; width: 100%; img { height: 50px!important; } // pure-md @media screen and (min-width: 48em) { width: 50%; img { height: 50px!important; } } //pure-lg @media screen and (min-width: 64em) { width: 35%; } `
src/SettingsItemAppConnect/index.js
christianalfoni/ducky-components
import SocialConnect from '../SocialConnect'; import Typography from '../Typography'; import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import styles from './styles.css'; function SettingsItemAppConnect(props) { return ( <div className={classNames(styles.wrapper, {[props.className]: props.className})}> <div> <SocialConnect connected={props.connected} socialMedia={props.socialMedia} /> </div> <div className={styles.composite}> { props.connected ? <Typography className={styles.typoNormal} onClick={props.onClick} size={'caption2Normal'} > {'Koblet til som '}<b>{props.userName}</b> </Typography> : <Typography className={styles.typoStrong} onClick={props.onClick} size={'caption2Strong'} > {'Koble til med '}{props.socialMedia.toLowerCase()} </Typography> } { props.connected ? <Typography className={styles.typoStrong} size={'caption2Strong'} > {'Koble fra'} </Typography> : <Typography className={styles.typoNormal} size={'caption2Normal'} > {'Importer dine kontakter'} </Typography> } </div> </div> ); } SettingsItemAppConnect.propTypes = { className: PropTypes.string, connected: PropTypes.bool, onClick: PropTypes.func, socialMedia: PropTypes.oneOf(['facebook', 'twitter', 'google+', 'instagram']), userName: PropTypes.string }; export default SettingsItemAppConnect;
src/components/common/Icon.js
mark4carter/react-hrtbus
import React from 'react' import Radium from 'radium' class Icon extends React.Component { render() { let height = this.props.height || '48px', width = this.props.width || '48px', source = this.props.source return ( <img src={`${source}.png`} width={width} height={height} /> ); } } export default Icon
lib/types/Geometry.js
Kitware/in-situ-data-viewer
import CollapsibleElement from 'paraviewweb/src/React/Widgets/CollapsibleWidget'; import CompositeControl from 'paraviewweb/src/React/Widgets/CompositePipelineWidget'; import CompositePipelineModel from 'paraviewweb/src/Common/State/PipelineState'; import contains from 'mout/src/array/contains'; import GeometryBuilder from 'paraviewweb/src/Rendering/Geometry/ThreeGeometryBuilder'; import GeometryDataModel from 'paraviewweb/src/IO/Core/GeometryDataModel'; import LookupTableManagerWidget from 'paraviewweb/src/React/CollapsibleControls/LookupTableManagerControl'; import QueryDataModelWithExplorationWidget from 'paraviewweb/src/React/CollapsibleControls/QueryDataModelControl'; import React from 'react'; export default function build({ basepath, viewer, dataType }) { // Can we handle the data if (!contains(dataType, 'geometry')) { return false; } const pipelineModel = new CompositePipelineModel( viewer.queryDataModel.originalData ); const geometryDataModel = new GeometryDataModel(basepath); const lutMgr = viewer.config.lookupTableManager; viewer.ui = 'GeometryViewer'; viewer.allowMagicLens = false; viewer.geometryBuilder = new GeometryBuilder( lutMgr, geometryDataModel, pipelineModel, viewer.queryDataModel ); viewer.menuAddOn = [ <LookupTableManagerWidget key="LookupTableManagerWidget" field={lutMgr.getActiveField()} lookupTableManager={lutMgr} />, <CollapsibleElement title="Pipeline" key="CompositeControl_parent"> <CompositeControl key="CompositeControl" model={pipelineModel} /> </CollapsibleElement>, <QueryDataModelWithExplorationWidget key="QueryDataModel" handleExploration model={viewer.queryDataModel} />, ]; return true; }
pages/slides.js
dabbott/react-native-express
import React from 'react' import SpectacleSlideshow from '../components/SpectacleSlideshow' const introSlides = require('!!babel-loader!spectacle-mdx-loader!../slides/index.mdx') const slides = introSlides.default.map((slide, index) => { return { sectionName: ``, SlideComponent: slide, NotesComponent: introSlides.notes[index], } }) export default () => <SpectacleSlideshow slides={slides} />
src/svg-icons/notification/phone-in-talk.js
barakmitz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NotificationPhoneInTalk = (props) => ( <SvgIcon {...props}> <path d="M20 15.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.59l2.2-2.21c.28-.26.36-.65.25-1C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zM19 12h2c0-4.97-4.03-9-9-9v2c3.87 0 7 3.13 7 7zm-4 0h2c0-2.76-2.24-5-5-5v2c1.66 0 3 1.34 3 3z"/> </SvgIcon> ); NotificationPhoneInTalk = pure(NotificationPhoneInTalk); NotificationPhoneInTalk.displayName = 'NotificationPhoneInTalk'; NotificationPhoneInTalk.muiName = 'SvgIcon'; export default NotificationPhoneInTalk;
examples/with-jsconfig-paths/src/client.js
jaredpalmer/razzle
import React from 'react'; import { hydrate } from 'react-dom'; import App from './App'; hydrate(<App />, document.getElementById('root')); if (module.hot) { module.hot.accept(); }
src/routes/config/tvbrand/List.js
china2008qyj/DVA-DEMO
import React from 'react' import PropTypes from 'prop-types' import { Table, Modal } from 'antd' import styles from './List.less' import classnames from 'classnames' import AnimTableBody from '../../../components/DataTable/AnimTableBody' import { DropOption } from 'components' import { Link } from 'dva/router' const confirm = Modal.confirm; const List = ({ onDeleteItem, onEditItem,isMotion, location, ...tableProps }) => { const handleMenuClick = (record, e) => { if (e.key === '1') { onEditItem(record) } else if (e.key === '2') { confirm({ title: '您确定要删除该电视品牌吗?', onOk () { onDeleteItem(record.id) }, }) } }; const columns = [ { title: '家电品牌', dataIndex: 'brandName', key: 'brandName', }, { title: '频道管理', dataIndex: 'bid', key: 'bid', render: (text, record) => <Link to={`/config/tvbrand/${record.id}`}>打开频道管理</Link>, }, { title: 'Operation', key: 'operation', width: 100, render: (text, record) => { return <DropOption onMenuClick={e => handleMenuClick(record, e)} menuOptions={[{ key: '1', name: '编 辑'}, { key: '2', name: '删 除'}]} /> }, }, ]; const getBodyWrapperProps = { page: location.query.page, current: tableProps.pagination.current, }; const getBodyWrapper = body => { return isMotion ? <AnimTableBody {...getBodyWrapperProps} body={body} /> : body }; return ( <div> <Table {...tableProps} className={classnames({ [styles.table]: true, [styles.motion]: isMotion })} bordered scroll={{ x: 1250 }} columns={columns} simple rowKey={record => record.id} getBodyWrapper={getBodyWrapper} /> </div> ) }; // List.propTypes = { // onDeleteItem: PropTypes.func, // onEditItem: PropTypes.func, // isMotion: PropTypes.bool, // location: PropTypes.object, // }; export default List
src/components/wallet/WalletUnlock.js
whphhg/vcash-ui
import React from 'react' import { translate } from 'react-i18next' import { action, computed, extendObservable, reaction } from 'mobx' import { inject, observer } from 'mobx-react' /** Ant Design */ import Button from 'antd/lib/button' import Input from 'antd/lib/input' import message from 'antd/lib/message' import Modal from 'antd/lib/modal' import Tooltip from 'antd/lib/tooltip' @translate(['common']) @inject('rpc', 'wallet') @observer class WalletUnlock extends React.Component { constructor(props) { super(props) this.t = props.t this.rpc = props.rpc this.wallet = props.wallet this.walletPassphrase = this.walletPassphrase.bind(this) /** Errors that will be shown to the user. */ this.errShow = ['ppIncorrect'] /** Extend the component with observable properties. */ extendObservable(this, { passphrase: '', rpcError: '', modalVisible: false }) /** Clear previous RPC error on passphrase change. */ this.ppReaction = reaction( () => this.passphrase, passphrase => { if (this.rpcError !== '') this.setProps({ rpcError: '' }) }, { name: 'WalletUnlock: passphrase changed, clearing previous RPC error.' } ) /** Clear passphrase when the modal gets hidden. */ this.modalReaction = reaction( () => this.modalVisible, modalVisible => { if (modalVisible === false) { if (this.passphrase !== '') this.setProps({ passphrase: '' }) } }, { name: 'WalletUnlock: modal toggled, clearing previous passphrase.' } ) } /** Dispose of reactions on component unmount. */ componentWillUnmount() { this.ppReaction() this.modalReaction() } /** * Get present error or empty string if none. * @function errorStatus * @return {string} Error status. */ @computed get errorStatus() { if (this.passphrase.length < 1) return 'emptyField' if (this.rpcError !== '') return this.rpcError return '' } /** * Set observable properties. * @function setProps * @param {object} props - Key value combinations. */ @action setProps = props => { Object.keys(props).forEach(key => (this[key] = props[key])) } /** * Toggle modal visibility. * @function toggleModal */ @action toggleModal = () => { this.modalVisible = !this.modalVisible } /** * Unlock the wallet. * @function walletPassphrase */ async walletPassphrase() { const res = await this.rpc.walletPassphrase(this.passphrase) if ('result' in res === true) { this.wallet.updateLockStatus() this.toggleModal() message.success(this.t('unlocked')) } if ('error' in res === true) { switch (res.error.code) { case -14: return this.setProps({ rpcError: 'ppIncorrect' }) } } } render() { /** Do not render if the wallet is unlocked. */ if (this.wallet.isLocked === false) return null return ( <div> <Modal footer={null} onCancel={this.toggleModal} title={this.t('unlock')} visible={this.modalVisible === true} > <Input onChange={e => this.setProps({ passphrase: e.target.value })} onPressEnter={this.walletPassphrase} placeholder={this.t('ppDesc')} style={{ width: '100%', margin: '0 0 5px 0' }} type="password" value={this.passphrase} /> <div className="flex-sb"> <p className="red"> {this.errShow.includes(this.errorStatus) === true && this.t(this.errorStatus)} </p> <Button disabled={this.errorStatus !== ''} onClick={this.walletPassphrase} > {this.t('unlock')} </Button> </div> </Modal> <Tooltip placement="bottomRight" title={this.t('locked')}> <Button className="flex" onClick={this.toggleModal}> <i className="material-icons md-19">lock</i> </Button> </Tooltip> </div> ) } } export default WalletUnlock
test/multi-section/AutosuggestApp.js
JacksonKearl/react-autosuggest-ie11-compatible
import React, { Component } from 'react'; import sinon from 'sinon'; import Autosuggest from '../../src/Autosuggest'; import languages from './languages'; import { escapeRegexCharacters } from '../../demo/src/components/utils/utils.js'; const getMatchingLanguages = value => { const escapedValue = escapeRegexCharacters(value.trim()); const regex = new RegExp('^' + escapedValue, 'i'); return languages .map(section => { return { title: section.title, languages: section.languages.filter(language => regex.test(language.name) ) }; }) .filter(section => section.languages.length > 0); }; let app = null; export const getSuggestionValue = sinon.spy(suggestion => { return suggestion.name; }); export const renderSuggestion = sinon.spy(suggestion => { return <span>{suggestion.name}</span>; }); const alwaysTrue = () => true; export const onChange = sinon.spy((event, { newValue }) => { app.setState({ value: newValue }); }); export const onBlur = sinon.spy(); export const onSuggestionsFetchRequested = sinon.spy(({ value }) => { app.setState({ suggestions: getMatchingLanguages(value) }); }); export const onSuggestionsClearRequested = sinon.spy(() => { app.setState({ suggestions: [] }); }); export const onSuggestionSelected = sinon.spy(); export const onSuggestionHighlighted = sinon.spy(); export const renderSectionTitle = sinon.spy(section => { return <strong>{section.title}</strong>; }); export const getSectionSuggestions = sinon.spy(section => { return section.languages; }); let highlightFirstSuggestion = false; export const setHighlightFirstSuggestion = value => { highlightFirstSuggestion = value; }; export default class AutosuggestApp extends Component { constructor() { super(); app = this; this.state = { value: '', suggestions: [] }; } onClearMouseDown = event => { event.preventDefault(); this.setState({ value: '', suggestions: getMatchingLanguages('') }); }; render() { const { value, suggestions } = this.state; const inputProps = { value, onChange, onBlur }; return ( <div> <button onMouseDown={this.onClearMouseDown}>Clear</button> <Autosuggest multiSection={true} suggestions={suggestions} onSuggestionsFetchRequested={onSuggestionsFetchRequested} onSuggestionsClearRequested={onSuggestionsClearRequested} onSuggestionSelected={onSuggestionSelected} onSuggestionHighlighted={onSuggestionHighlighted} getSuggestionValue={getSuggestionValue} renderSuggestion={renderSuggestion} inputProps={inputProps} shouldRenderSuggestions={alwaysTrue} renderSectionTitle={renderSectionTitle} getSectionSuggestions={getSectionSuggestions} highlightFirstSuggestion={highlightFirstSuggestion} /> </div> ); } }
client/containers/HomeContainer.js
jacquesuys/HireOrbit
import React, { Component } from 'react'; import Home from '../components/Home'; import { connect } from 'react-redux'; import { updateCurrentSearch, updateCurrentQuery } from '../actions'; class HomeContainer extends Component { render() { return ( <Home {...this.props}/> ); } } export default connect(null, { updateCurrentSearch, updateCurrentQuery })(HomeContainer);
src/Card/ButtonHeader/ButtonHeader.driver.js
skyiea/wix-style-react
import React from 'react'; import ReactDOM from 'react-dom'; const buttonHeaderDriverFactory = ({element, wrapper, component}) => { const title = element.querySelector('[data-hook="title"]'); const subtitle = element.querySelector('[data-hook="subtitle"]'); return { exists: () => !!element, title: () => title && title.innerHTML, subtitle: () => subtitle && subtitle.innerHTML, element: () => element, buttonDataHook: () => 'button', setProps: props => { const ClonedWithProps = React.cloneElement(component, Object.assign({}, component.props, props), ...(component.props.children || [])); ReactDOM.render(<div ref={r => element = r}>{ClonedWithProps}</div>, wrapper); } }; }; export default buttonHeaderDriverFactory;
app/components/ReplyCard.js
nantaphop/redd
import React from 'react' import Card, { CardActions, CardContent, CardMedia } from 'material-ui/Card'; import Typography from 'material-ui/Typography' import IconButton from 'material-ui/IconButton' import DateIcon from 'material-ui-icons/Timer' import PersonIcon from 'material-ui-icons/Person' import LabelIcon from 'material-ui-icons/Label' import { withTheme } from 'material-ui/styles'; import ArrowUpIcon from 'material-ui-icons/ArrowUpward' import ArrowDownIcon from 'material-ui-icons/ArrowDownward' import ChatIcon from 'material-ui-icons/Forum' import ExpandLess from 'material-ui-icons/ExpandLess' import ExpandMore from 'material-ui-icons/ExpandMore' import styled, { css } from 'styled-components' import { compose, lifecycle, setDisplayName, withStateHandlers } from 'recompose' import { inject, observer } from 'mobx-react' import moment from 'moment' import LineEllipsis from 'react-lines-ellipsis' import Collapse from 'material-ui/transitions/Collapse'; import ContentBody from './ContentBody' type ReplyCardProps = { reply: object } const enhance = compose( inject('subredditStore'), inject('submissionStore'), lifecycle({ }), setDisplayName('ReplyCard'), withTheme(), observer, ) const ReplyCard = styled(Card) ` margin-bottom: 1px; padding-bottom: 8px; width: 100%; ` const Contents = styled(CardContent) ` padding: 0px 1px 16px 16px !important; :last-child{ padding-bottom: 0px !important; } ` const IconStyle = css` width: 12px !important; height: 12px !important; margin-right: 4px; ` const _DateIcon = styled(DateIcon) ` ${IconStyle} ` const _PersonIcon = styled(PersonIcon) ` ${IconStyle} margin-left: 4px; ` const _LabelIcon = styled(LabelIcon) ` ${IconStyle} margin-left: 4px; ` const MetaRow = styled(Typography) ` display: flex !important; font-size: 10px !important; align-items: center; height: 48px; ` const SelfText = styled(Typography).attrs({ type: 'caption', }) ` word-break: break-word; margin-top: 8px !important; ` const ActionBar = styled.div` display: flex; align-items: center; ` const StatContainer = styled.div` display: flex; flex-direction: column; flex: 1; ` const Image = styled(CardMedia) ` height: 300px; ` const RepliesContainer = styled(Collapse) ` padding: 2px; ` const renderReply = (props, reply) => ( <ReplyCard key={reply.name} raised elevation={1} > <Contents> <MetaRow type="caption"> <_DateIcon /> {moment(reply.created_utc * 1000).fromNow()} <_PersonIcon /> {reply.author.name} <_LabelIcon /> {reply.score} <IconButton onClick={reply.handleUpvote} color={reply.likes === true ? 'accent' : undefined}> <ArrowUpIcon /> </IconButton> <IconButton onClick={reply.handleDownvote} color={reply.likes === false ? 'accent' : undefined} > <ArrowDownIcon /> </IconButton> { reply.replies.length ? <IconButton onClick={props.submissionStore.handleToggleReply(reply.name)}> { !props.submissionStore.collapseReplies.has(reply.name) ? <ExpandLess /> : <ExpandMore /> } </IconButton> : null } </MetaRow> { reply.body_html && <ContentBody html={reply.body_html} /> } {/* <CardActions disableActionSpacing> <Typography type="body1">{submission.score || '0'}</Typography> <IconButton> <ArrowUpIcon /> </IconButton> <IconButton> <ArrowDownIcon /> </IconButton> <Typography type="body1">{submission.num_comments || '0'}</Typography> <IconButton> <ChatIcon /> </IconButton> </CardActions> */} {reply.replies && <RepliesContainer in={!props.submissionStore.collapseReplies.has(reply.name)} transitionDuration="auto"> {reply.replies.map(r => renderReply(props, r))} </RepliesContainer> } </Contents> </ReplyCard > ) export default enhance((props: ReplyCardProps) => { let { reply } = props let preview return renderReply(props, reply) }) // Sample Submission Item /** * { "subreddit_id": "t5_2qh17", "approved_at_utc": null, "banned_by": null, "removal_reason": null, "link_id": "t3_76j1iz", "likes": null, "user_reports": [], "saved": false, "id": "doeimc8", "banned_at_utc": null, "gilded": 0, "archived": false, "report_reasons": null, "author": "spilk", "can_mod_post": false, "ups": 464, "parent_id": "t3_76j1iz", "score": 464, "approved_by": null, "downs": 0, "body": "10BASE-Tea", "edited": false, "author_flair_css_class": null, "collapsed": false, "is_submitter": false, "collapsed_reason": null, "body_html": "<div class=\"md\"><p>10BASE-Tea</p>\n</div>", "stickied": false, "can_gild": true, "subreddit": "geek", "score_hidden": false, "subreddit_type": "public", "name": "t1_doeimc8", "created": 1508114485, "author_flair_text": null, "created_utc": 1508085685, "subreddit_name_prefixed": "r/geek", "controversiality": 0, "depth": 0, "mod_reports": [], "num_reports": null, "distinguished": null, "replies": [ { "subreddit_id": "t5_2qh17", "approved_at_utc": null, "banned_by": null, "removal_reason": null, "link_id": "t3_76j1iz", "likes": null, "replies": [], "user_reports": [], "saved": false, "id": "doejumn", "banned_at_utc": null, "gilded": 0, "archived": false, "report_reasons": null, "author": "codepoet", "can_mod_post": false, "ups": 43, "parent_id": "t1_doeimc8", "score": 43, "approved_by": null, "downs": 0, "body": "Sigh. Take your damned upvote. (Bravo.)", "edited": false, "author_flair_css_class": null, "collapsed": false, "is_submitter": false, "collapsed_reason": null, "body_html": "<div class=\"md\"><p>Sigh. Take your damned upvote. (Bravo.)</p>\n</div>", "stickied": false, "can_gild": true, "subreddit": "geek", "score_hidden": false, "subreddit_type": "public", "name": "t1_doejumn", "created": 1508115991, "author_flair_text": null, "created_utc": 1508087191, "subreddit_name_prefixed": "r/geek", "controversiality": 0, "depth": 1, "mod_reports": [], "num_reports": null, "distinguished": null }, { "subreddit_id": "t5_2qh17", "approved_at_utc": null, "banned_by": null, "removal_reason": null, "link_id": "t3_76j1iz", "likes": null, "replies": [], "user_reports": [], "saved": false, "id": "doeu00g", "banned_at_utc": null, "gilded": 0, "archived": false, "report_reasons": null, "author": "aerger", "can_mod_post": false, "ups": 7, "parent_id": "t1_doeimc8", "score": 7, "approved_by": null, "downs": 0, "body": "I hoped to find this here. And I did. Nice.", "edited": false, "author_flair_css_class": null, "collapsed": false, "is_submitter": false, "collapsed_reason": null, "body_html": "<div class=\"md\"><p>I hoped to find this here. And I did. Nice.</p>\n</div>", "stickied": false, "can_gild": true, "subreddit": "geek", "score_hidden": false, "subreddit_type": "public", "name": "t1_doeu00g", "created": 1508126536, "author_flair_text": null, "created_utc": 1508097736, "subreddit_name_prefixed": "r/geek", "controversiality": 0, "depth": 1, "mod_reports": [], "num_reports": null, "distinguished": null }, { "subreddit_id": "t5_2qh17", "approved_at_utc": null, "banned_by": null, "removal_reason": null, "link_id": "t3_76j1iz", "likes": null, "replies": [], "user_reports": [], "saved": false, "id": "dof3vvy", "banned_at_utc": null, "gilded": 0, "archived": false, "report_reasons": null, "author": "ditrone", "can_mod_post": false, "ups": 6, "parent_id": "t1_doeimc8", "score": 6, "approved_by": null, "downs": 0, "body": "Thats the U.S. version, the UK is on 10GBase-tea", "edited": false, "author_flair_css_class": null, "collapsed": false, "is_submitter": false, "collapsed_reason": null, "body_html": "<div class=\"md\"><p>Thats the U.S. version, the UK is on 10GBase-tea</p>\n</div>", "stickied": false, "can_gild": true, "subreddit": "geek", "score_hidden": false, "subreddit_type": "public", "name": "t1_dof3vvy", "created": 1508137942, "author_flair_text": null, "created_utc": 1508109142, "subreddit_name_prefixed": "r/geek", "controversiality": 0, "depth": 1, "mod_reports": [], "num_reports": null, "distinguished": null }, { "subreddit_id": "t5_2qh17", "approved_at_utc": null, "banned_by": null, "removal_reason": null, "link_id": "t3_76j1iz", "likes": null, "replies": [], "user_reports": [], "saved": false, "id": "dofbisw", "banned_at_utc": null, "gilded": 0, "archived": false, "report_reasons": null, "author": "_Noah271", "can_mod_post": false, "ups": 1, "parent_id": "t1_doeimc8", "score": 1, "approved_by": null, "downs": 0, "body": "Sounds like Comcast's backbone! ", "edited": false, "author_flair_css_class": null, "collapsed": false, "is_submitter": false, "collapsed_reason": null, "body_html": "<div class=\"md\"><p>Sounds like Comcast&#39;s backbone! </p>\n</div>", "stickied": false, "can_gild": true, "subreddit": "geek", "score_hidden": false, "subreddit_type": "public", "name": "t1_dofbisw", "created": 1508147790, "author_flair_text": null, "created_utc": 1508118990, "subreddit_name_prefixed": "r/geek", "controversiality": 0, "depth": 1, "mod_reports": [], "num_reports": null, "distinguished": null } ], } * */
app/viewControllers/infoPages/NewsletterPage.js
Evyy/cffs-ui
'use strict'; import React from 'react'; import {Link} from 'react-router'; import InfoPage from './InfoPage'; import NewsletterSubscribeForm from '../../forms/NewsletterSubscribeForm'; class NewsletterPage extends React.Component { constructor (props) { super(props); } render () { return ( <InfoPage className="newsletter-page" headImage="/images/cookbook.jpg" title="Newsletter"> <NewsletterSubscribeForm /> </InfoPage> ); } } export default NewsletterPage;
js/actions/FortranCompileActions.js
Sable/McLab-Web
import AT from '../constants/AT'; import Dispatcher from '../Dispatcher'; import FortranCompileConfigStore from '../stores/FortranCompileConfigStore'; import React from 'react'; import request from 'superagent'; import TerminalActions from './TerminalActions'; import OnLoadActions from './OnLoadActions'; function beginCompilation() { const mainFile = FortranCompileConfigStore.getMainFilePath(); const arg = FortranCompileConfigStore.getArgumentList().get(0, null); TerminalActions.println( "Sent request to server for compilation." + " Compiled files should be ready in a few seconds." ); const postArg = arg ? { numRows: arg.numRows, numCols: arg.numCols, realComplex: arg.realComplex.key, mlClass: arg.mlClass.key } : null; // ffs fix the workspace hack const postBody = { mainFile: mainFile.substring(10), arg: postArg }; const baseURL = window.location.origin; const sessionID = OnLoadActions.getSessionID(); request.post(baseURL + '/compile/mc2for/') .set({'SessionID': sessionID}) .send(postBody) .end((err, res) =>{ if (err) { try { const msg = JSON.parse(res.text).msg; TerminalActions.printerrln(msg); } catch (e) { TerminalActions.printerrln( <div> { "Failed to compile :( " } { "This could be due to a network issue. " } { "If you believe this is a bug please open an issue " } <a href="https://github.com/Sable/McLab-Web/issues">here</a> { " or send us an email."} </div> ); } } else { const package_path = JSON.parse(res.text)['package_path']; const path_to_print = `${baseURL}/files/download/${sessionID}/${package_path}`; TerminalActions.println( <div>Compilation complete! {' '} <a href={path_to_print}> Click here to download the compiled package </a> </div> ); } } ); } export default { beginCompilation }
admin/client/Signin/components/Brand.js
ONode/keystone
/** * Renders a logo, defaulting to the Keystone logo if no brand is specified in * the configuration */ import React from 'react'; const Brand = function (props) { // Default to the KeystoneJS logo let logo = { src: `${Keystone.adminPath}/images/logo.png`, width: 205, height: 68 }; if (props.logo) { // If the logo is set to a string, it's a direct link logo = typeof props.logo === 'string' ? { src: props.logo } : props.logo; // Optionally one can specify the logo as an array, also stating the // wanted width and height of the logo // TODO: Deprecate this if (Array.isArray(logo)) { logo = { src: logo[0], width: logo[1], height: logo[2] }; } } return ( <div className="auth-box__col"> <div className="auth-box__brand"> <a href="/" className="auth-box__brand__logo"> <img src={logo.src} width={logo.width ? logo.width : null} height={logo.height ? logo.height : null} alt={props.brand} /> </a> </div> </div> ); }; module.exports = Brand;
frontend/src/components/artists/index.js
rossnomann/playlog
import React from 'react'; import {Link} from 'react-router-dom'; import {createSelector} from 'reselect'; import {actions} from '../../redux'; import {formatDate} from '../../utils'; import {Catalog, createListContainer} from '../shared/catalog'; import ProgressBar from '../shared/progress-bar'; import './index.css'; const dataSelector = createSelector( state => state.artists, data => { if (data.loaded && data.success) { const maxPlays = Math.max(...data.payload.items.map(item => item.plays)); data.payload.items = data.payload.items.map(item => ({ id: item.id, name: item.name, plays: item.plays, firstPlay: formatDate(item.firstPlay), lastPlay: formatDate(item.lastPlay), playsPercent: Math.round(item.plays * 100 / maxPlays) })); } return data; } ); const ListContainer = createListContainer(dataSelector, actions.artistsRequest); const FILTERS = [ {type: 'search', name: 'name', label: 'NAME'}, { type: 'group', name: 'first_play_group', label: 'FIRST PLAY', items: [ {type: 'date', name: 'first_play_gt', label: 'SINCE'}, {type: 'date', name: 'first_play_lt', label: 'UNTIL'} ] }, { type: 'group', name: 'last_play_group', label: 'LAST PLAY', items: [ {type: 'date', name: 'last_play_gt', label: 'SINCE'}, {type: 'date', name: 'last_play_lt', label: 'UNTIL'} ] }, { type: 'group', name: 'order_group', label: 'ORDER', items: [ { type: 'switch', name: 'order_field', label: 'FIELD', options: ['name', 'plays', 'first_play', 'last_play'], initialValue: 'name' }, { type: 'switch', name: 'order_direction', label: 'DIRECTION', options: ['asc', 'desc'], initialValue: 'asc' } ] } ]; const renderItem = ({id, name, plays, firstPlay, lastPlay, playsPercent}) => ( <div key={id} className="artists-item"> <div className="artists-item-data"> <div className="artists-item-data-name"> <Link to={`/artists/${id}`}>{name}</Link> </div> <div className="artists-item-data-period">{firstPlay} &mdash; {lastPlay}</div> </div> <div className="artists-item-bar"> <ProgressBar percent={playsPercent}> {plays} </ProgressBar> </div> </div> ); const Artists = () => ( <Catalog container={ListContainer} filters={FILTERS} renderItem={renderItem} /> ); export default Artists;
packages/mineral-ui-icons/src/IconFormatTextdirectionRToL.js
mineral-ui/mineral-ui
/* @flow */ import React from 'react'; import Icon from 'mineral-ui/Icon'; import type { IconProps } from 'mineral-ui/Icon/types'; /* eslint-disable prettier/prettier */ export default function IconFormatTextdirectionRToL(props: IconProps) { const iconProps = { rtl: false, ...props }; return ( <Icon {...iconProps}> <g> <path d="M10 10v5h2V4h2v11h2V4h2V2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4zm-2 7v-3l-4 4 4 4v-3h12v-2H8z"/> </g> </Icon> ); } IconFormatTextdirectionRToL.displayName = 'IconFormatTextdirectionRToL'; IconFormatTextdirectionRToL.category = 'editor';
packages/ringcentral-widgets-docs/src/app/pages/Components/ConversationsPanel/Demo.js
ringcentral/ringcentral-js-widget
import React from 'react'; // eslint-disable-next-line import ConversationsPanel from 'ringcentral-widgets/components/ConversationsPanel'; const props = {}; props.currentLocale = 'en-US'; props.goToComposeText = () => null; props.markMessage = () => null; props.readMessage = () => null; props.unmarkMessage = () => null; props.showConversationDetail = () => null; props.onClickToDial = () => null; props.onViewContact = () => null; props.onCreateContact = () => null; props.loadNextPage = () => null; props.brand = 'RingCentral'; props.textUnreadCounts = 1; props.voiceUnreadCounts = 0; props.faxUnreadCounts = 0; props.conversations = [ { id: 1, conversationId: '1', subject: 'subject text', correspondents: [ { phoneNumber: '123456789', }, ], correspondentMatches: [], conversationMatches: [], unreadCounts: 0, type: 'SMS', creationTime: '2018-01-17T08:59:02.000Z', }, { id: 2, conversationId: '2', subject: 'subject text2', correspondents: [ { phoneNumber: '123456788', }, ], correspondentMatches: [], conversationMatches: [], unreadCounts: 1, type: 'SMS', creationTime: '2018-01-16T08:59:02.000Z', }, ]; props.countryCode = 'US'; props.areaCode = '657'; props.typeFilter = 'All'; props.dateTimeFormatter = ({ utcTimestamp }) => { const time = new Date(utcTimestamp); return `${time.getMonth() + 1}/${time.getDate()}/${time.getFullYear()}`; }; /** * A example of `ConversationsPanel` */ const ConversationsPanelDemo = () => ( <div style={{ position: 'relative', height: '500px', width: '300px', border: '1px solid #f3f3f3', }} > <ConversationsPanel {...props} /> </div> ); export default ConversationsPanelDemo;
src/components/Results.js
Ntobon/dm_react_app
import React from 'react'; import Panel from 'react-bootstrap/lib/Panel'; import Col from 'react-bootstrap/lib/Col'; import Row from 'react-bootstrap/lib/Row'; import UserModal from './UserModal'; class Results extends React.Component { constructor(props) { super(props); this.state = { showInfo : false }; } handleClick() { this.setState({ showInfo:true }); } hideModal(){ this.setState({ showInfo:false }); } render() { var modal=""; if(this.state.showInfo){ modal=<UserModal user={this.props.user} callbackDismiss={this.hideModal.bind(this)} visible={this.state.showInfo}/> } return ( <Col className="user-profile-container" onClick={this.handleClick.bind(this)} sm={6} md={3}> <div className="profile-image" onClick={this.handleClick.bind(this)}> <img src={this.props.user.profile_image_url}/> </div> <div className="short-info"> {this.props.user.name} </div> {modal} </Col> ); } } export default Results;
src/components/03-organisms/Agenda/index.js
buildit/bookit-web
import React from 'react' import PropTypes from 'prop-types' import momentPropTypes from 'react-moment-proptypes' import roomTimelineNames from '../../01-atoms/RoomTimelineNames' import timelineLabelList from '../../01-atoms/TimelineLabelList' import CurrentTimeIndicator from '../../01-atoms/CurrentTimeIndicator' import RoomTimeline from '../../02-molecules/RoomTimeline' import USER_SHAPE from '../../../models/user' import styles from './styles.scss' export const renderRoomTimelines = (rooms, meetings, user, populateMeetingCreateForm, meetingFormIsActive) => rooms.map(room => ( <RoomTimeline key={room.name} user={user} meetings={meetings.filter(meeting => meeting.roomId === room.id)} room={{ email: room.id, name: room.name, }} populateMeetingCreateForm={populateMeetingCreateForm} meetingFormIsActive={meetingFormIsActive} /> )) const Agenda = ({ meetings, rooms, user, populateMeetingCreateForm, meetingFormIsActive }) => ( <div className={styles.agenda}> <div className={styles.column}> { roomTimelineNames(rooms) } </div> <div className={[styles.column, styles.timeline].join(' ')} id="timelines"> { timelineLabelList() } { renderRoomTimelines(rooms, meetings, user, populateMeetingCreateForm, meetingFormIsActive) } <CurrentTimeIndicator /> </div> </div> ) Agenda.propTypes = { populateMeetingCreateForm: PropTypes.func.isRequired, user: USER_SHAPE, meetings: PropTypes.arrayOf( PropTypes.shape({ id: PropTypes.string.isRequired, title: PropTypes.string.isRequired, start: momentPropTypes.momentObj.isRequired, end: momentPropTypes.momentObj.isRequired, duration: PropTypes.number.isRequired, isOwnedByUser: PropTypes.bool.isRequired, owner: PropTypes.shape({ name: PropTypes.string.isRequired, email: PropTypes.string.isRequired, }).isRequired, roomName: PropTypes.string.isRequired, roomId: PropTypes.string.isRequired, }) ).isRequired, rooms: PropTypes.arrayOf( PropTypes.shape({ name: PropTypes.string.isRequired, id: PropTypes.string.isRequired, }).isRequired ).isRequired, meetingFormIsActive: PropTypes.bool.isRequired, } export default Agenda
real_estate_agency/react_ui/src/index.js
Dybov/real_estate_agency
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import registerServiceWorker from './registerServiceWorker'; import ResaleDetailed from './resale/ResaleDetailed'; import renderReplace from './dom-render-replace'; import ru from 'react-intl/locale-data/ru'; import { IntlProvider, addLocaleData } from 'react-intl'; import YandexMapPicker from './map/yandex-map-picker'; if (window.apartment !== undefined){ addLocaleData([...ru]); var App = () => ( <IntlProvider locale="ru"> <ResaleDetailed/> </IntlProvider> ) renderReplace( <App />, document.getElementById("sticky-resale") ) } else if (window.coordinate_widgets){ let widgets = window.coordinate_widgets Array.prototype.forEach.call( document.getElementsByClassName('coordinate-widget'), function(el, idx) { ReactDOM.render( <YandexMapPicker djangowidget={widgets[idx]}/>, el ) } ) } registerServiceWorker();
packages/starter-scripts/fixtures/kitchensink/src/features/webpack/SvgInCss.js
chungchiehlun/create-starter-app
import React from 'react'; import './assets/svg.css'; export default () => <div id="feature-svg-in-css" />;
lib/manager/components/LabelAssignerModal.js
conveyal/datatools-manager
import React from 'react' import { Modal, Button } from 'react-bootstrap' // @flow import LabelAssigner from '../components/LabelAssigner' import type { FeedSource, Project } from '../../types' type Props = { feedSource: FeedSource, project: Project, }; type State = { showModal: boolean, }; export default class LabelEditorModal extends React.Component<Props, State> { state = { showModal: false }; close = () => { this.setState({ showModal: false }) }; // Used in the ref open = () => { this.setState({ showModal: true }) }; // Used in the ref ok = () => { this.close() }; render () { const { Body, Header, Title, Footer } = Modal const { feedSource, project } = this.props return ( <Modal show={this.state.showModal} onHide={this.close}> <Header> <Title>{`Add Labels to ${feedSource.name}`}</Title> </Header> <Body> <LabelAssigner feedSource={feedSource} project={project} /> </Body> <Footer> <Button data-test-id='label-assigner-done-button' onClick={this.close} > Done </Button> </Footer> </Modal> ) } }
src/svg-icons/device/screen-rotation.js
hwo411/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceScreenRotation = (props) => ( <SvgIcon {...props}> <path d="M16.48 2.52c3.27 1.55 5.61 4.72 5.97 8.48h1.5C23.44 4.84 18.29 0 12 0l-.66.03 3.81 3.81 1.33-1.32zm-6.25-.77c-.59-.59-1.54-.59-2.12 0L1.75 8.11c-.59.59-.59 1.54 0 2.12l12.02 12.02c.59.59 1.54.59 2.12 0l6.36-6.36c.59-.59.59-1.54 0-2.12L10.23 1.75zm4.6 19.44L2.81 9.17l6.36-6.36 12.02 12.02-6.36 6.36zm-7.31.29C4.25 19.94 1.91 16.76 1.55 13H.05C.56 19.16 5.71 24 12 24l.66-.03-3.81-3.81-1.33 1.32z"/> </SvgIcon> ); DeviceScreenRotation = pure(DeviceScreenRotation); DeviceScreenRotation.displayName = 'DeviceScreenRotation'; DeviceScreenRotation.muiName = 'SvgIcon'; export default DeviceScreenRotation;
imports/ui/components/StaticCertificate/StaticCertificate.js
jamiebones/Journal_Publication
import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router'; import { Row, Col, FormGroup, ControlLabel, Panel , Form , FormControl, Button , Label , Well , Image , Table} from 'react-bootstrap'; import { Bert } from 'meteor/themeteorchef:bert'; import { Meteor } from 'meteor/meteor'; import moment from 'moment'; import { GetNameFromUserId , Capitalize , sumMeUp , getCommision , capAllFirstLetter} from '../../../modules/utilities'; import { StripHtml } from '../../../modules/utilities2'; import InlineCss from 'react-inline-css'; import fs from 'fs'; const StaticCertificate = ({ paper , editionName , journalName , logo , background , signature }) => ( <InlineCss stylesheet={` .container-fluid { padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; } .row { margin-right: -15px; margin-left: -15px; } .container:before, .container:after, .container-fluid:before, .container-fluid:after, .row:before, .row:after, { display: table; content: " "; } .container:after, .container-fluid:after, .row:after, { clear: both; } .center-block { display: block; margin-right: auto; margin-left: auto; } .pull-right { float: right !important; } .pull-left { float: left !important; } .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { position: relative; min-height: 1px; padding-right: 15px; padding-left: 15px; } .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { float: left; } .col-xs-12 { width: 100%; } .col-xs-11 { width: 91.66666667%; } .col-xs-10 { width: 83.33333333%; } .col-xs-9 { width: 75%; } .col-xs-8 { width: 66.66666667%; } .col-xs-7 { width: 58.33333333%; } .col-xs-6 { width: 50%; } .col-xs-5 { width: 41.66666667%; } .col-xs-4 { width: 33.33333333%; } .col-xs-3 { width: 25%; } .col-xs-2 { width: 16.66666667%; } .col-xs-1 { width: 8.33333333%; } .col-xs-pull-12 { right: 100%; } .col-xs-pull-11 { right: 91.66666667%; } .col-xs-pull-10 { right: 83.33333333%; } .col-xs-pull-9 { right: 75%; } .col-xs-pull-8 { right: 66.66666667%; } .col-xs-pull-7 { right: 58.33333333%; } .col-xs-pull-6 { right: 50%; } .col-xs-pull-5 { right: 41.66666667%; } .col-xs-pull-4 { right: 33.33333333%; } .col-xs-pull-3 { right: 25%; } .col-xs-pull-2 { right: 16.66666667%; } .col-xs-pull-1 { right: 8.33333333%; } .col-xs-pull-0 { right: auto; } .col-xs-push-12 { left: 100%; } .col-xs-push-11 { left: 91.66666667%; } .col-xs-push-10 { left: 83.33333333%; } .col-xs-push-9 { left: 75%; } .col-xs-push-8 { left: 66.66666667%; } .col-xs-push-7 { left: 58.33333333%; } .col-xs-push-6 { left: 50%; } .col-xs-push-5 { left: 41.66666667%; } .col-xs-push-4 { left: 33.33333333%; } .col-xs-push-3 { left: 25%; } .col-xs-push-2 { left: 16.66666667%; } .col-xs-push-1 { left: 8.33333333%; } .col-xs-push-0 { left: auto; } .col-xs-offset-12 { margin-left: 100%; } .col-xs-offset-11 { margin-left: 91.66666667%; } .col-xs-offset-10 { margin-left: 83.33333333%; } .col-xs-offset-9 { margin-left: 75%; } .col-xs-offset-8 { margin-left: 66.66666667%; } .col-xs-offset-7 { margin-left: 58.33333333%; } .col-xs-offset-6 { margin-left: 50%; } .col-xs-offset-5 { margin-left: 41.66666667%; } .col-xs-offset-4 { margin-left: 33.33333333%; } .col-xs-offset-3 { margin-left: 25%; } .col-xs-offset-2 { margin-left: 16.66666667%; } .col-xs-offset-1 { margin-left: 8.33333333%; } .col-xs-offset-0 { margin-left: 0; } @media (min-width: 768px) { .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { float: left; } .col-sm-12 { width: 100%; } .col-sm-11 { width: 91.66666667%; } .col-sm-10 { width: 83.33333333%; } .col-sm-9 { width: 75%; } .col-sm-8 { width: 66.66666667%; } .col-sm-7 { width: 58.33333333%; } .col-sm-6 { width: 50%; } .col-sm-5 { width: 41.66666667%; } .col-sm-4 { width: 33.33333333%; } .col-sm-3 { width: 25%; } .col-sm-2 { width: 16.66666667%; } .col-sm-1 { width: 8.33333333%; } .col-sm-pull-12 { right: 100%; } .col-sm-pull-11 { right: 91.66666667%; } .col-sm-pull-10 { right: 83.33333333%; } .col-sm-pull-9 { right: 75%; } .col-sm-pull-8 { right: 66.66666667%; } .col-sm-pull-7 { right: 58.33333333%; } .col-sm-pull-6 { right: 50%; } .col-sm-pull-5 { right: 41.66666667%; } .col-sm-pull-4 { right: 33.33333333%; } .col-sm-pull-3 { right: 25%; } .col-sm-pull-2 { right: 16.66666667%; } .col-sm-pull-1 { right: 8.33333333%; } .col-sm-pull-0 { right: auto; } .col-sm-push-12 { left: 100%; } .col-sm-push-11 { left: 91.66666667%; } .col-sm-push-10 { left: 83.33333333%; } .col-sm-push-9 { left: 75%; } .col-sm-push-8 { left: 66.66666667%; } .col-sm-push-7 { left: 58.33333333%; } .col-sm-push-6 { left: 50%; } .col-sm-push-5 { left: 41.66666667%; } .col-sm-push-4 { left: 33.33333333%; } .col-sm-push-3 { left: 25%; } .col-sm-push-2 { left: 16.66666667%; } .col-sm-push-1 { left: 8.33333333%; } .col-sm-push-0 { left: auto; } .col-sm-offset-12 { margin-left: 100%; } .col-sm-offset-11 { margin-left: 91.66666667%; } .col-sm-offset-10 { margin-left: 83.33333333%; } .col-sm-offset-9 { margin-left: 75%; } .col-sm-offset-8 { margin-left: 66.66666667%; } .col-sm-offset-7 { margin-left: 58.33333333%; } .col-sm-offset-6 { margin-left: 50%; } .col-sm-offset-5 { margin-left: 41.66666667%; } .col-sm-offset-4 { margin-left: 33.33333333%; } .col-sm-offset-3 { margin-left: 25%; } .col-sm-offset-2 { margin-left: 16.66666667%; } .col-sm-offset-1 { margin-left: 8.33333333%; } .col-sm-offset-0 { margin-left: 0; } } @media (min-width: 992px) { .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { float: left; } .col-md-12 { width: 100%; } .col-md-11 { width: 91.66666667%; } .col-md-10 { width: 83.33333333%; } .col-md-9 { width: 75%; } .col-md-8 { width: 66.66666667%; } .col-md-7 { width: 58.33333333%; } .col-md-6 { width: 50%; } .col-md-5 { width: 41.66666667%; } .col-md-4 { width: 33.33333333%; } .col-md-3 { width: 25%; } .col-md-2 { width: 16.66666667%; } .col-md-1 { width: 8.33333333%; } .col-md-pull-12 { right: 100%; } .col-md-pull-11 { right: 91.66666667%; } .col-md-pull-10 { right: 83.33333333%; } .col-md-pull-9 { right: 75%; } .col-md-pull-8 { right: 66.66666667%; } .col-md-pull-7 { right: 58.33333333%; } .col-md-pull-6 { right: 50%; } .col-md-pull-5 { right: 41.66666667%; } .col-md-pull-4 { right: 33.33333333%; } .col-md-pull-3 { right: 25%; } .col-md-pull-2 { right: 16.66666667%; } .col-md-pull-1 { right: 8.33333333%; } .col-md-pull-0 { right: auto; } .col-md-push-12 { left: 100%; } .col-md-push-11 { left: 91.66666667%; } .col-md-push-10 { left: 83.33333333%; } .col-md-push-9 { left: 75%; } .col-md-push-8 { left: 66.66666667%; } .col-md-push-7 { left: 58.33333333%; } .col-md-push-6 { left: 50%; } .col-md-push-5 { left: 41.66666667%; } .col-md-push-4 { left: 33.33333333%; } .col-md-push-3 { left: 25%; } .col-md-push-2 { left: 16.66666667%; } .col-md-push-1 { left: 8.33333333%; } .col-md-push-0 { left: auto; } .col-md-offset-12 { margin-left: 100%; } .col-md-offset-11 { margin-left: 91.66666667%; } .col-md-offset-10 { margin-left: 83.33333333%; } .col-md-offset-9 { margin-left: 75%; } .col-md-offset-8 { margin-left: 66.66666667%; } .col-md-offset-7 { margin-left: 58.33333333%; } .col-md-offset-6 { margin-left: 50%; } .col-md-offset-5 { margin-left: 41.66666667%; } .col-md-offset-4 { margin-left: 33.33333333%; } .col-md-offset-3 { margin-left: 25%; } .col-md-offset-2 { margin-left: 16.66666667%; } .col-md-offset-1 { margin-left: 8.33333333%; } .col-md-offset-0 { margin-left: 0; } } @media (min-width: 1200px) { .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { float: left; } .col-lg-12 { width: 100%; } .col-lg-11 { width: 91.66666667%; } .col-lg-10 { width: 83.33333333%; } .col-lg-9 { width: 75%; } .col-lg-8 { width: 66.66666667%; } .col-lg-7 { width: 58.33333333%; } .col-lg-6 { width: 50%; } .col-lg-5 { width: 41.66666667%; } .col-lg-4 { width: 33.33333333%; } .col-lg-3 { width: 25%; } .col-lg-2 { width: 16.66666667%; } .col-lg-1 { width: 8.33333333%; } .col-lg-pull-12 { right: 100%; } .col-lg-pull-11 { right: 91.66666667%; } .col-lg-pull-10 { right: 83.33333333%; } .col-lg-pull-9 { right: 75%; } .col-lg-pull-8 { right: 66.66666667%; } .col-lg-pull-7 { right: 58.33333333%; } .col-lg-pull-6 { right: 50%; } .col-lg-pull-5 { right: 41.66666667%; } .col-lg-pull-4 { right: 33.33333333%; } .col-lg-pull-3 { right: 25%; } .col-lg-pull-2 { right: 16.66666667%; } .col-lg-pull-1 { right: 8.33333333%; } .col-lg-pull-0 { right: auto; } .col-lg-push-12 { left: 100%; } .col-lg-push-11 { left: 91.66666667%; } .col-lg-push-10 { left: 83.33333333%; } .col-lg-push-9 { left: 75%; } .col-lg-push-8 { left: 66.66666667%; } .col-lg-push-7 { left: 58.33333333%; } .col-lg-push-6 { left: 50%; } .col-lg-push-5 { left: 41.66666667%; } .col-lg-push-4 { left: 33.33333333%; } .col-lg-push-3 { left: 25%; } .col-lg-push-2 { left: 16.66666667%; } .col-lg-push-1 { left: 8.33333333%; } .col-lg-push-0 { left: auto; } .col-lg-offset-12 { margin-left: 100%; } .col-lg-offset-11 { margin-left: 91.66666667%; } .col-lg-offset-10 { margin-left: 83.33333333%; } .col-lg-offset-9 { margin-left: 75%; } .col-lg-offset-8 { margin-left: 66.66666667%; } .col-lg-offset-7 { margin-left: 58.33333333%; } .col-lg-offset-6 { margin-left: 50%; } .col-lg-offset-5 { margin-left: 41.66666667%; } .col-lg-offset-4 { margin-left: 33.33333333%; } .col-lg-offset-3 { margin-left: 25%; } .col-lg-offset-2 { margin-left: 16.66666667%; } .col-lg-offset-1 { margin-left: 8.33333333%; } .col-lg-offset-0 { margin-left: 0; } } .identifier{ font-size: 16px; } .sign { background: url(signboard.gif) no-repeat; width: 100%; background-size: 250px 290px; /* background-size: 50px; */ position: fixed; bottom: 50px; left: 70%; padding-top: 180px; } .signature { background: url(signature.jpg) no-repeat; width: 100%; background-size: 120px 70px; /* background-size: 50px; */ position: fixed; bottom: 50px; left: 75%; padding-top: 100px; } .text-left { text-align: left; } .text-right { text-align: right; } .text-center { text-align: center; } .text-justify { text-align: justify; } .text-nowrap { white-space: nowrap; } .text-lowercase { text-transform: lowercase; } .text-uppercase { text-transform: uppercase; } .text-capitalize { text-transform: capitalize; } .text-muted { color: #777; } .text-primary { color: #337ab7; } a.text-primary:hover, a.text-primary:focus { color: #286090; } .text-success { color: #3c763d; } a.text-success:hover, a.text-success:focus { color: #2b542c; } .text-info { color: #31708f; } a.text-info:hover, a.text-info:focus { color: #245269; } .text-warning { color: #8a6d3b; } a.text-warning:hover, a.text-warning:focus { color: #66512c; } .text-danger { color: #a94442; } a.text-danger:hover, a.text-danger:focus { color: #843534; } img { vertical-align: middle; } .img-responsive, .thumbnail > img, .thumbnail a > img, .carousel-inner > .item > img, .carousel-inner > .item > a > img { display: block; max-width: 100%; height: auto; } .img-rounded { border-radius: 6px; } .img-thumbnail { display: inline-block; max-width: 100%; height: auto; padding: 4px; line-height: 1.42857143; background-color: #fff; border: 1px solid #ddd; border-radius: 4px; -webkit-transition: all .2s ease-in-out; -o-transition: all .2s ease-in-out; transition: all .2s ease-in-out; } .img-circle { border-radius: 50%; } .journalName{ padding:5px; font-size: 30px; color:#8CD0E9; } .certBody{ font-size : 35px; padding-top : 80px; line-height : 50px; } body{ background-repeat:no-repeat; background-position: center center; background-image:url(${background}); min-height:100%; } * { box-sizing: border-box; } .marginBottom{ position : fixed; bottom : 20px } .marginBottom2{ position : fixed; bottom : 10px } body { margin: 10px; background-color:#ffffff; } `}> <div className="container-fluid"> <div className="row"> <div className="col-xs-4"> </div> <div className="col-xs-4 col-xs-offset-4"> <p className="journalName text-center"> {journalName} </p> </div> </div> <div className="row"> <div className="col-xs-12"> <p className="certBody"> This certificate is hereby given to &nbsp; {paper && paper.authors && paper.authors.map(({title , firstname , surname } , index )=>{ return ( <span key={index} className=""> { paper.authors.length == 2 ? ( <span> { paper.authors.length - 1 === index ? <span>&nbsp; and </span> : ""} {title} {firstname} {surname} </span> ) : ""} { paper.authors.length > 2 ? ( <span> { index > 0 && index < paper.authors.length - 1 ? <span>&nbsp; ,</span> : ""} { paper.authors.length - 1 === index ? <span>&nbsp; and </span> : ""} {title} {firstname} {surname} </span> ) : ""} { paper.authors.length == 1 ? ( <span> {title} {firstname} {surname} </span> ) : ""} </span> ) })} &nbsp; in recognition of the publication of the Manuscript entitled <span><b>{paper && StripHtml(paper.title)}</b></span> <span>&nbsp;published in {journalName} &nbsp;</span> <span>{editionName}</span> </p> </div> </div> <div className="row"> <div className="col-xs-3 col-xs-offset-9 marginBottom"> <img src={signature} className="img img-responsive"/> </div> </div> <div className="row"> <div className="col-xs-12 marginBottom2"> <p>Verify Certificate On : <span className="text-info text-center"> <b>{ Meteor.absoluteUrl(`verify_paper/${paper && paper._id}`)}</b></span> </p> </div> </div> </div> </InlineCss> ) StaticCertificate.propTypes = { }; export default StaticCertificate;
src/svg-icons/notification/phone-in-talk.js
jacklam718/react-svg-iconx
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NotificationPhoneInTalk = (props) => ( <SvgIcon {...props}> <path d="M20 15.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.59l2.2-2.21c.28-.26.36-.65.25-1C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zM19 12h2c0-4.97-4.03-9-9-9v2c3.87 0 7 3.13 7 7zm-4 0h2c0-2.76-2.24-5-5-5v2c1.66 0 3 1.34 3 3z"/> </SvgIcon> ); NotificationPhoneInTalk = pure(NotificationPhoneInTalk); NotificationPhoneInTalk.displayName = 'NotificationPhoneInTalk'; NotificationPhoneInTalk.muiName = 'SvgIcon'; export default NotificationPhoneInTalk;
src/components/Gauges/Gauges.js
Zoomdata/nhtsa-dashboard-2.2
import styles from './Gauges.css'; import React from 'react'; import Gauge from '../Gauge/Gauge'; import { connect } from 'react-redux'; const mapStateToProps = (state) => { return { metricData: state.chartData.metricData.data, metricTotalsData: state.chartData.metricTotalsData.data } }; const Gauges = ({ metricData, metricTotalsData, }) => { return ( <div className={styles.root} > <Gauge id="crashes-gauge" name="CRASHES" data={metricData} max={metricTotalsData} /> <Gauge id="injuries-gauge" name="INJURIES" data={metricData} max={metricTotalsData} /> <Gauge id="fires-gauge" name="FIRES" data={metricData} max={metricTotalsData} /> <Gauge id="speed-gauge" name="AVG. SPEED" data={metricData} max={metricTotalsData} /> </div> ) }; export default connect(mapStateToProps)(Gauges);
collect-webapp/frontend/src/security/pages/UserDetailsPage.js
openforis/collect
import React from 'react' import PropTypes from 'prop-types' import { Alert, Button, Col, Form, FormGroup, Label, Input, Row } from 'reactstrap' import { connect } from 'react-redux' import { SimpleFormItem } from 'common/components/Forms' import * as UsersActions from 'actions/users' import ServiceFactory from 'services/ServiceFactory' import AbstractItemDetailsPage from 'common/components/AbstractItemDetailsPage' import User from 'model/User' class UserDetailsPage extends AbstractItemDetailsPage { static propTypes = { user: PropTypes.object.isRequired, } constructor(props) { super(props) this.validateForm = this.validateForm.bind(this) } getInitialState() { let s = super.getInitialState() s = {...s, newItem: true, id: null, username: '', rawPassword: '', retypedPassword: '', role: 'ENTRY', enabled: false, } return s } updateStateFromProps(props) { this.setState({ newItem: ! props.user.id, id: props.user.id, username: props.user.username, rawPassword: '', retypedPassword: '', role: props.user.role, enabled: props.user.enabled, errorFeedback: [], alertMessageOpen: false }) } extractFormObject() { return { id: this.state.id, username: this.state.username, rawPassword: this.state.rawPassword, retypedPassword: this.state.retypedPassword, enabled: this.state.enabled, role: this.state.role } } handleSaveBtnClick() { let formObject = this.extractFormObject() ServiceFactory.userService.save(formObject).then(this.handleSaveResponse) } validateForm() { let formObject = this.extractFormObject() ServiceFactory.userService.validate(formObject).then(this.handleValidateResponse) } handleSaveResponse(res) { super.updateStateFromResponse(res) if (res.statusOk) { this.setState({ newItem: false, id: res.form.id }) this.props.dispatch(UsersActions.receiveUser(res.form)) } } render() { return ( <div> <Form> <SimpleFormItem fieldId='username' fieldState={this.getFieldState('username')} errorFeedback={this.state.errorFeedback['username']} label='user.username'> <Input type="text" name="username" id="username" value={this.state.username} readOnly={! this.state.newItem} state={this.getFieldState('username')} onBlur={e => this.validateForm()} onChange={(event) => this.setState({...this.state, username: event.target.value})} /> </SimpleFormItem> <SimpleFormItem fieldId='enabled' fieldState={this.getFieldState('enabled')} errorFeedback={this.state.errorFeedback['enabled']} label='user.enabled'> <FormGroup check> <Label check> <Input type="checkbox" name="enabled" id="enabled" checked={this.state.enabled} state={this.getFieldState('enabled')} onBlur={e => this.validateForm()} onChange={(event) => this.setState({...this.state, enabled: event.target.checked})} /> </Label> </FormGroup> </SimpleFormItem> <SimpleFormItem fieldId='roleSelect' fieldState={this.getFieldState('role')} errorFeedback={this.state.errorFeedback['role']} label='user.role'> <Input type="select" name="role" id="roleSelect" onChange={(event) => this.setState({...this.state, role: event.target.value})} onBlur={e => this.validateForm()} state={this.getFieldState('role')} value={this.state.role}> {Object.keys(User.ROLE).map(role => <option key={role} value={role}>{role}</option>)} </Input> </SimpleFormItem> <SimpleFormItem fieldId='rawPassword' fieldState={this.getFieldState('rawPassword')} errorFeedback={this.state.errorFeedback['rawPassword']} label='user.rawPassword'> <Input type="password" name="rawPassword" id="rawPassword" value={this.state.rawPassword} state={this.getFieldState('rawPassword')} onBlur={e => this.validateForm()} onChange={(event) => this.setState({...this.state, rawPassword: event.target.value})} /> </SimpleFormItem> <SimpleFormItem fieldId='retypedPassword' fieldState={this.getFieldState('retypedPassword')} errorFeedback={this.state.errorFeedback['retypedPassword']} label='user.retypedPassword'> <Input type="password" name="retypedPassword" id="retypedPassword" value={this.state.retypedPassword} state={this.getFieldState('retypedPassword')} onBlur={e => this.validateForm()} onChange={(event) => this.setState({...this.state, retypedPassword: event.target.value})} /> </SimpleFormItem> <Row> <Col> <Alert color={this.state.alertMessageColor} isOpen={this.state.alertMessageOpen}> {this.state.alertMessageText} </Alert> </Col> </Row> <FormGroup check row> <Col sm={{ size: 12, offset: 5 }}> <Button color="primary" onClick={this.handleSaveBtnClick}>Save</Button> </Col> </FormGroup> </Form> </div> ) } } function mapStateToProps(state) { return {} } export default connect(mapStateToProps)(UserDetailsPage)
src/components/Match.js
enzoborgfrantz/goeuro-swiper-web
import React from 'react'; import styled from 'styled-components'; import Button from './Button'; import { getSearchOptions } from '../data/searchOptions'; const ModalWrapper = styled.div` width:100%; height: 150%; display: block; position: absolute; top: 0; left: 0; background-color: rgba(0, 0, 0, 0.5); `; const MatchModalStyled = styled.div` display: flex; flex-direction: column; position: fixed; background-color:white; top: 50px; width: 550px; transform: translate(-50%, 0); height: 400px; left: 50%; justify-content: center; align-items: center; font-family: Roboto; border-radius: 5px; @media (max-width: 500px) { width: 350px; } `; const HeartIcon = styled.div` background-image: url('${props => props.url}'); height: 35px; background-repeat: no-repeat; width: 36px; background-size: contain; `; const Description = styled.div` ${''/* height: 100px; */} background-color: #efeff0; width: 100%; padding: 20px 0; text-align: center; `; const ItalicHeader = styled.h2` font-style: italic; color: #2a84b7; font-family: Roboto; `; const BookButton = Button.extend` color:white; border-radius: 4px; box-shadow: inset 0 -2px 0 0 rgba(0,0,0,.15); background-color: #f7a600; width: 120px; height: 30px; cursor: pointer; font-family: Roboto; &:hover{ background-color: #f9bb3c; } &:active{ background-color: #f49414; }; margin-top: 10px; `; const CloseButton = Button.extend` position: absolute; top: 5px; right: 5px; font-family: Roboto; font-size: 24px; color: #999999; background-color: transparent; `; const redirectToSearch = (depPos, arrPos) => { const url = 'https://www.goeuro.com/GoEuroAPI/rest/api/v5/searches'; const options = ({ headers: { 'Content-Type': 'application/json' }, method: 'POST', body: JSON.stringify(getSearchOptions(depPos, arrPos)) }); fetch(url, options) .then(r => r.json()) .then((d) => { const deeplink = `https://www.goeuro.com/travel-search2/results/${d.searchId}/train`; // console.log(deeplink); window.location.replace(deeplink); }, ); }; const YouLiked = styled.p` font-size: 17px; color: #878787; font-family: Roboto; font-weight: 100; text-align: center; padding: 0 20px; `; const CityName = styled.div` flex: 1; color: #262626; text-align: left; margin-left: 20px; `; const Price = styled.div` flex: 1; font-weight: lighter; text-align: right; margin-right: 20px; `; const Duration = styled.div` font-family: Arial; font-size: 14px; color: #999999; text-align: left; margin-left: 20px; `; const DescriptionTop = styled.div` display: flex; flex-direction: row; margin-bottom: 10px; `; const MatchModal = ({ cityName, price, duration, deeplink, closeModal }) => ( <ModalWrapper> <MatchModalStyled> <CloseButton onClick={closeModal}>×</CloseButton> <HeartIcon url={'https://maxcdn.icons8.com/office/PNG/512/Gaming/hearts-512.png'} /> <ItalicHeader>Its a match!</ItalicHeader> <YouLiked>You liked {cityName}, you wanna book a ticket?</YouLiked> <Description> <DescriptionTop> <CityName>{cityName}</CityName> <Price>from {price}</Price> </DescriptionTop> <Duration>{duration}</Duration> </Description> <BookButton onClick={() => { redirectToSearch(376946, 376217); }}>Book me</BookButton> </MatchModalStyled> </ModalWrapper> ); module.exports = MatchModal;
app/components/Atoms/UserImage/UserImage.js
shibe97/worc
import React from 'react'; import styles from './userImage.css'; export default ({ url = '' }) => ( <img className={styles.userImage} src={url} alt="profile" /> );
hw5/src/components/article/searchBar.js
yusong-shen/comp531-web-development
/** * Created by yusong on 10/23/16. */ import React, { Component } from 'react'; import { connect } from 'react-redux' import { Field, reduxForm } from 'redux-form'; import * as ArticleActions from '../../actions/articleActions' class SearchBar extends Component { handleFormSubmit = (values) => { const keyword = values.keyword || '' this.props.setKeyword(keyword) } render() { return ( <form onSubmit={this.props.handleSubmit(this.handleFormSubmit)}> <div> <Field name="keyword" component="input" type="text" placeholder="Search..."/> <button type="submit">Search</button> </div> </form> ); } } // Decorate the form component SearchBar = reduxForm({ form: 'searchBar' // a unique name for this form })(SearchBar); export default connect(null, ArticleActions)(SearchBar)
node_modules/react-bootstrap/es/ControlLabel.js
hsavit1/gosofi_webpage
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 PropTypes from 'prop-types'; import warning from 'warning'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var propTypes = { /** * Uses `controlId` from `<FormGroup>` if not explicitly specified. */ htmlFor: PropTypes.string, srOnly: PropTypes.bool }; var defaultProps = { srOnly: false }; var contextTypes = { $bs_formGroup: PropTypes.object }; var ControlLabel = function (_React$Component) { _inherits(ControlLabel, _React$Component); function ControlLabel() { _classCallCheck(this, ControlLabel); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } ControlLabel.prototype.render = function render() { var formGroup = this.context.$bs_formGroup; var controlId = formGroup && formGroup.controlId; var _props = this.props, _props$htmlFor = _props.htmlFor, htmlFor = _props$htmlFor === undefined ? controlId : _props$htmlFor, srOnly = _props.srOnly, className = _props.className, props = _objectWithoutProperties(_props, ['htmlFor', 'srOnly', 'className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; process.env.NODE_ENV !== 'production' ? warning(controlId == null || htmlFor === controlId, '`controlId` is ignored on `<ControlLabel>` when `htmlFor` is specified.') : void 0; var classes = _extends({}, getClassSet(bsProps), { 'sr-only': srOnly }); return React.createElement('label', _extends({}, elementProps, { htmlFor: htmlFor, className: classNames(className, classes) })); }; return ControlLabel; }(React.Component); ControlLabel.propTypes = propTypes; ControlLabel.defaultProps = defaultProps; ControlLabel.contextTypes = contextTypes; export default bsClass('control-label', ControlLabel);
app/packs/src/components/research_plan/ResearchPlanDetailsField.js
ComPlat/chemotion_ELN
/* eslint-disable react/prefer-stateless-function */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Button, ButtonGroup, Row, Col, ControlLabel, Tooltip, OverlayTrigger, DropdownButton, MenuItem } from 'react-bootstrap'; import ResearchPlanDetailsDragSource from './ResearchPlanDetailsDragSource'; import ResearchPlanDetailsDropTarget from './ResearchPlanDetailsDropTarget'; import ResearchPlanDetailsFieldRichText from './ResearchPlanDetailsFieldRichText'; import ResearchPlanDetailsFieldKetcher from './ResearchPlanDetailsFieldKetcher'; import ResearchPlanDetailsFieldImage from './ResearchPlanDetailsFieldImage'; import ResearchPlanDetailsFieldTable from './ResearchPlanDetailsFieldTable'; import ResearchPlanDetailsFieldSample from './ResearchPlanDetailsFieldSample'; import ResearchPlanDetailsFieldReaction from './ResearchPlanDetailsFieldReaction'; import CustomTextEditor from '../common/CustomTextEditor'; export default class ResearchPlanDetailsField extends Component { render() { const { field, index, disabled, onChange, onDrop, onDelete, onExport, update, edit, tableIndex, onCopyToMetadata, isNew, copyableFields } = this.props; let label; let component; const metadataTooltipText = 'Copy field content to Metadata'; switch (field.type) { case 'richtext': label = field?.title; component = (<ResearchPlanDetailsFieldRichText key={field.id} field={field} index={index} disabled={disabled} onChange={onChange.bind(this)} edit={edit} />); break; case 'ketcher': label = 'Ketcher schema'; component = (<ResearchPlanDetailsFieldKetcher key={field.id} field={field} index={index} disabled={disabled} onChange={onChange.bind(this)} edit={edit} />); break; case 'image': label = 'Image'; component = (<ResearchPlanDetailsFieldImage key={field.id} field={field} index={index} disabled={disabled} onChange={onChange.bind(this)} edit={edit} />); break; case 'table': field.value.columns.forEach((item)=> { item.editor = CustomTextEditor return item; }); label = 'Table'; component = (<ResearchPlanDetailsFieldTable key={field.id} field={field} index={index} disabled={disabled} onChange={onChange.bind(this)} onExport={onExport} update={update} edit={edit} tableIndex={tableIndex} />); break; case 'sample': label = 'Sample'; component = (<ResearchPlanDetailsFieldSample key={field.id} field={field} index={index} disabled={disabled} onChange={onChange.bind(this)} edit={edit} />); break; case 'reaction': label = 'Reaction'; component = (<ResearchPlanDetailsFieldReaction key={field.id} field={field} index={index} disabled={disabled} onChange={onChange.bind(this)} edit={edit} />); break; default: label = ''; component = <div />; } let dropTarget; let fieldHeader; let copyToMetadataButton = ''; let className = 'research-plan-field'; if (edit) { dropTarget = ( <Col md={12}> <ResearchPlanDetailsDropTarget index={index} /> </Col> ); if (field.type === 'richtext') { copyToMetadataButton = ( <OverlayTrigger placement="top" delayShow={500} overlay={<Tooltip id="metadataTooltip">{metadataTooltipText}</Tooltip>} > <ButtonGroup className="pull-right"> <DropdownButton id="copyMetadataButton" title="" className="fa fa-laptop" bsStyle="info" bsSize="xsmall" pullRight disabled={isNew} > <li role="presentation" className="">Copy to Metadata field:</li> <li role="separator" className="divider" /> { copyableFields.map(element => ( <MenuItem key={element.fieldName} onClick={() => onCopyToMetadata(field.id, element.fieldName)} > {element.title} </MenuItem> )) } </DropdownButton> </ButtonGroup> </OverlayTrigger> ); } fieldHeader = ( <div className="research-plan-field-header"> {/* TODO: make label editable */} <ControlLabel>{label}</ControlLabel> <Button className="pull-right" bsStyle="danger" bsSize="xsmall" onClick={() => onDelete(field.id)}> <i className="fa fa-times" /> </Button> {copyToMetadataButton} <ResearchPlanDetailsDragSource index={index} onDrop={onDrop.bind(this)} /> </div> ); } else { className += ' static'; } return ( <Row> {dropTarget} <Col md={12}> <div className={className}> {fieldHeader} {component} </div> </Col> </Row> ); } } ResearchPlanDetailsField.propTypes = { field: PropTypes.object, index: PropTypes.number, disabled: PropTypes.bool, onChange: PropTypes.func, onDrop: PropTypes.func, onDelete: PropTypes.func, onExport: PropTypes.func, onCopyToMetadata: PropTypes.func, isNew: PropTypes.bool, copyableFields: PropTypes.arrayOf(PropTypes.object), update: PropTypes.bool, edit: PropTypes.bool };
src/app/components/Button/Button.js
ericvandevprod/redux-d3
import React from 'react'; import { Button } from 'react-toolbox/lib/button'; import theme from './Button.css'; const ButtonComponent = () => ( <div> <Button theme={theme} icon="youtube_searched_for" label="Search" type="submit" raised accent /> </div> ); export default ButtonComponent;
examples/huge-apps/routes/Course/routes/Assignments/components/Sidebar.js
kurayama/react-router
/*globals COURSES:true */ import React from 'react' import { Link } from 'react-router' class Sidebar extends React.Component { render() { let { assignments } = COURSES[this.props.params.courseId] return ( <div> <h3>Sidebar Assignments</h3> <ul> {assignments.map(assignment => ( <li key={assignment.id}> <Link to={`/course/${this.props.params.courseId}/assignments/${assignment.id}`}> {assignment.title} </Link> </li> ))} </ul> </div> ) } } export default Sidebar
client/src/components/NotFoundPage.js
dragonq29/mini-bat
import React from 'react'; import { Link } from 'react-router'; const NotFoundPage = () => { return ( <div> <h4> 404 Page Not Found </h4> <Link to="/"> Go back to homepage </Link> </div> ); }; export default NotFoundPage;
src/Components/modules/Resume.js
nockgish/gish
// modules/Resume.js import React from 'react' import render from 'react-dom' class Resume extends React.Component { constructor(props) { super(props); this.state = { shouldChangeBackground: true }; } componentDidMount() { if(this.state.shouldChangeBackground){ setTimeout(function() { this.resume.style.cssText = "opacity: 1"; }, 10); document.getElementById('nav').childNodes[0].childNodes[0].style.cssText = "color: rgb(255, 255, 255) !important"; document.getElementById('nav').childNodes[1].childNodes[0].style.cssText = "color: rgb(255, 255, 255) !important"; document.getElementById('ngish-name').style.cssText = "color: rgb(255, 255, 255) !important"; console.warn(document.getElementById('changeback').childNodes[0]); console.warn(document.getElementById('changeback').childNodes[1]); document.getElementById('changeback').childNodes[1].style.cssText = "transform: translate3d(-200vw, 0vw, 0)"; document.getElementById('changeback').childNodes[2].style.cssText = "transform: translate3d(0,0vw,0)"; document.querySelector('.portlink').style.cssText = "border-right: 2px rgb(0, 0, 0) solid;" this.setState({shouldChangeBackground: false}); } } render() { return <div ref={ (node) => {this.resume = node;}} id="resume"> <section id="skills_and_links"> <div className="sl-bit"> <h2>skills</h2> <ul> <li>Vanilla Javascript, React, jQuery</li> <li>CSS, SASS, HTML, HAML</li> <li>UI & UX Design</li> <li>Adobe Photoshop, Illustrator, InDesign</li> </ul> </div> <div className="sl-bit"> <h2>links</h2> <ul> <a href="http://codepen.io/nockgish" target="_blank"><li>codepen.io/nockgish</li></a> <a href="http://github.com/nockgish" target="_blank"><li>github.com/nockgish</li></a> <a href="http://linkedin.com/in/ngish" target="_blank"><li>linkedin.com/in/ngish</li></a> </ul> </div> </section> <section id="jobs"> <div id="job3rd" className="a_job"> <ul className="date__place__title"> <li>February 2014 - December 2016</li> <li>Complex Networks, New York, NY</li> <li>Web Developer</li> </ul> <ul> <li>Researched and developed new ad concepts and modes of customer interactions</li> <li>Realized ad creative as fully formed campaigns, while providing design input to create more engaging experiences</li> <li>Re-faced internal system for working with 3rd party publisher requests</li> <li>Provided UI/UX and design guidance and input for internal and client facing products</li> </ul> </div> <div id="job2nd" className="a_job"> <ul className="date__place__title"> <li>April 2010 - January 2014</li> <li>East Baton Rouge Parish Library</li> <li>Front-End Web Developer</li> </ul> <ul> <li>Designed and Developed new library website</li> <li>Re-organized site content and structure inline with strategy of the organization and its various departments</li> <li>Maintained website daily with graphics, website copy, and mini-sites</li> <li>Collaborated with various in-house departments and groups on projects and mini-sites</li> <li>Worked with city stakeholders to create concepts for Open Cities project</li> <li>Developed Mobile First framework for Open Cities project for Baton Rouge</li> </ul> </div> <div id="job1st" className="a_job"> <ul className="date__place__title"> <li>April 2008 - 2010</li> <li>IEM, Inc. | Baton Rouge, LA</li> <li>Researcher</li> </ul> <ul> <li>Performed research and document management in Human Resources, Library Division, and for Legal Counsel</li> <li>Organized and directed move of the company Library location</li> <li>Researched for and worked with local, state, and national clients</li> <li>Qualified for User Interface Designer position in the company</li> </ul> </div> </section> <section id="educate"> <h2>education</h2> <div id="degree2nd" className="a_degree"> <ul> <li>Masters in Library and Information Science (MLIS)<br/> (2006 - 2008)</li> <li>Louisiana State University</li> </ul> </div> <div id="degree1st" className="a_degree"> <ul> <li>Bachelor of Arts in Music Composition (BA)</li> <li>Minor in German Language & Literature <br/> (2000 - 2006)</li> <li>Louisiana State University</li> </ul> </div> </section> </div> } } /* you could ref your skill set in resume as pertaining to how you learned and when IMPORTANT */ export default Resume;
react/gameday2/components/embeds/EmbedRtmp.js
jaredhasenklein/the-blue-alliance
/* global videojs */ import React from 'react' import { webcastPropType } from '../../utils/webcastUtils' export default class EmbedHtml5 extends React.Component { static propTypes = { webcast: webcastPropType.isRequired, } componentDidMount() { videojs(this.props.webcast.id, { width: '100%', height: '100%', autoplay: true, }) } render() { const src = `rtmp://${this.props.webcast.channel}&${this.props.webcast.file}` return ( <video controls id={this.props.webcast.id} className="video-js vjs-default-skin" > <source src={src} type="rtmp/mp4" /> </video> ) } }
src/svg-icons/image/hdr-weak.js
lawrence-yu/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageHdrWeak = (props) => ( <SvgIcon {...props}> <path d="M5 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm12-2c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z"/> </SvgIcon> ); ImageHdrWeak = pure(ImageHdrWeak); ImageHdrWeak.displayName = 'ImageHdrWeak'; ImageHdrWeak.muiName = 'SvgIcon'; export default ImageHdrWeak;
src/svg-icons/maps/traffic.js
verdan/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let MapsTraffic = (props) => ( <SvgIcon {...props}> <path d="M20 10h-3V8.86c1.72-.45 3-2 3-3.86h-3V4c0-.55-.45-1-1-1H8c-.55 0-1 .45-1 1v1H4c0 1.86 1.28 3.41 3 3.86V10H4c0 1.86 1.28 3.41 3 3.86V15H4c0 1.86 1.28 3.41 3 3.86V20c0 .55.45 1 1 1h8c.55 0 1-.45 1-1v-1.14c1.72-.45 3-2 3-3.86h-3v-1.14c1.72-.45 3-2 3-3.86zm-8 9c-1.11 0-2-.9-2-2s.89-2 2-2c1.1 0 2 .9 2 2s-.89 2-2 2zm0-5c-1.11 0-2-.9-2-2s.89-2 2-2c1.1 0 2 .9 2 2s-.89 2-2 2zm0-5c-1.11 0-2-.9-2-2 0-1.11.89-2 2-2 1.1 0 2 .89 2 2 0 1.1-.89 2-2 2z"/> </SvgIcon> ); MapsTraffic = pure(MapsTraffic); MapsTraffic.displayName = 'MapsTraffic'; MapsTraffic.muiName = 'SvgIcon'; export default MapsTraffic;
src/js/components/ui/LeftPanel/LeftPanel.js
nekuno/client
import PropTypes from 'prop-types'; import React, { Component } from 'react'; import styles from './LeftPanel.scss'; export default class LeftPanel extends Component { static propTypes = { isOpen : PropTypes.bool, handleClickClose: PropTypes.func.isRequired }; handleClickClose() { this.props.handleClickClose(); } render() { const {isOpen, children} = this.props; return ( <div className={styles.leftPanelWrapper}> <div className={styles.leftPanelAbsoluteWrapper}> <div className={isOpen ? styles.open + ' ' + styles.leftPanel : styles.leftPanel}> <div className={styles.content}> {children} </div> </div> <div className={isOpen ? styles.open + ' ' + styles.outsideWrapper : styles.outsideWrapper} onClick={this.handleClickClose.bind(this)}></div> </div> </div> ); } }
src/routes/privacy/index.js
siddhant3s/crunchgraph
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-2016 Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import React from 'react'; import Layout from '../../components/Layout'; import Page from '../../components/Page'; export default { path: '/privacy', async action() { const data = await new Promise((resolve) => { require.ensure([], require => { resolve(require('./privacy.md')); }, 'privacy'); }); return { title: data.title, component: <Layout><Page {...data} /></Layout>, }; }, };
docs/src/components/Demo/EditorConvertToJSON/index.js
jpuri/react-draft-wysiwyg
/* @flow */ import React, { Component } from 'react'; import { convertFromRaw } from 'draft-js'; import { Editor } from 'react-draft-wysiwyg'; import Codemirror from 'react-codemirror'; const content = {"entityMap":{},"blocks":[{"key":"637gr","text":"Initialized from content state.","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}]}; class EditorConvertToJSON extends Component { constructor(props) { super(props); const contentState = convertFromRaw(content); this.state = { contentState, } } onContentStateChange: Function = (contentState) => { this.setState({ contentState, }); }; render() { const { contentState } = this.state; return ( <div className="demo-section"> <h3>2. Uncontrolled editor component with conversion of content from and to JSON (RawDraftContentState)</h3> <div className="demo-section-wrapper"> <div className="demo-editor-wrapper"> <Editor defaultContentState={content} wrapperClassName="demo-wrapper" editorClassName="demo-editor" onContentStateChange={this.onContentStateChange} /> <textarea disabled className="demo-content no-focus" value={JSON.stringify(contentState, null, 4)} /> </div> <Codemirror value={ 'import React, { Component } from \'react\';\n' + 'import { convertFromRaw } from \'draft-js\';\n' + 'import { Editor } from \'react-draft-wysiwyg\';\n' + '\n\n' + 'const content = {"entityMap":{},"blocks":[{"key":"637gr","text":"Initialized from content state.","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}]};\n' + '\n' + 'class EditorConvertToJSON extends Component {\n' + ' constructor(props) {\n' + ' super(props);\n' + ' const contentState = convertFromRaw(content);\n' + ' this.state = {\n' + ' contentState,\n' + ' }\n' + ' }\n' + '\n' + ' onContentStateChange: Function = (contentState) => {\n' + ' this.setState({\n' + ' contentState,\n' + ' });\n' + ' };\n' + '\n' + ' render() {\n' + ' const { contentState } = this.state;\n' + ' return (\n' + ' <div>\n' + ' <Editor\n' + ' wrapperClassName="demo-wrapper"\n' + ' editorClassName="demo-editor"\n' + ' onContentStateChange={this.onContentStateChange}\n' + ' />\n' + ' <textarea\n' + ' disabled\n' + ' value={JSON.stringify(contentState, null, 4)}\n' + ' />\n' + ' </div>\n' + ' );\n' + ' }\n' + '}' } options={{ lineNumbers: true, mode: 'jsx', readOnly: true, }} /> </div> </div> ); } } export default EditorConvertToJSON;
src/plugins/blaze/components/tree/node-prop-type.js
thebakeryio/meteor-devtools
import React from 'react'; const NodeType = React.PropTypes.shape({ _id: React.PropTypes.string.isRequired, name: React.PropTypes.string.isRequired, data: React.PropTypes.object, isExpanded: React.PropTypes.bool.isRequired, children: React.PropTypes.arrayOf(NodeType), }).isRequired; export default NodeType;
react/features/base/react/components/native/Image.js
bgrozev/jitsi-meet
// @flow import React, { Component } from 'react'; import { Image } from 'react-native'; /** * The type of the React {@code Component} props of {@link Image}. */ type Props = { /** * The ImageSource to be rendered as image. */ src: Object, /** * The component's external style */ style: Object }; /** * A component rendering aN IMAGE. * * @extends Component */ export default class ImageImpl extends Component<Props> { /** * Implements React's {@link Component#render()}. * * @inheritdoc * @returns {ReactElement} */ render() { return ( <Image source = { this.props.src } style = { this.props.style } /> ); } }
modules/Link.js
calebmichaelsanchez/react-router
import React from 'react' import warning from 'warning' const { bool, object, string, func } = React.PropTypes function isLeftClickEvent(event) { return event.button === 0 } function isModifiedEvent(event) { return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) } function isEmptyObject(object) { for (const p in object) if (object.hasOwnProperty(p)) return false return true } /** * A <Link> is used to create an <a> element that links to a route. * When that route is active, the link gets an "active" class name * (or the value of its `activeClassName` prop). * * For example, assuming you have the following route: * * <Route path="/posts/:postID" component={Post} /> * * You could use the following component to link to that route: * * <Link to={`/posts/${post.id}`} /> * * Links may pass along location state and/or query string parameters * in the state/query props, respectively. * * <Link ... query={{ show: true }} state={{ the: 'state' }} /> */ const Link = React.createClass({ contextTypes: { history: object }, propTypes: { activeStyle: object, activeClassName: string, onlyActiveOnIndex: bool.isRequired, to: string.isRequired, query: object, state: object, onClick: func }, getDefaultProps() { return { onlyActiveOnIndex: false, className: '', style: {} } }, handleClick(event) { let allowTransition = true, clickResult if (this.props.onClick) clickResult = this.props.onClick(event) if (isModifiedEvent(event) || !isLeftClickEvent(event)) return if (clickResult === false || event.defaultPrevented === true) allowTransition = false event.preventDefault() if (allowTransition) this.context.history.pushState(this.props.state, this.props.to, this.props.query) }, componentWillMount() { warning( this.context.history, 'A <Link> should not be rendered outside the context of history ' + 'some features including real hrefs, active styling, and navigation ' + 'will not function correctly' ) }, render() { const { history } = this.context const { activeClassName, activeStyle, onlyActiveOnIndex, to, query, state, onClick, ...props } = this.props props.onClick = this.handleClick // Ignore if rendered outside the context // of history, simplifies unit testing. if (history) { props.href = history.createHref(to, query) if (activeClassName || (activeStyle != null && !isEmptyObject(activeStyle))) { if (history.isActive(to, query, onlyActiveOnIndex)) { if (activeClassName) props.className += props.className === '' ? activeClassName : ` ${activeClassName}` if (activeStyle) props.style = { ...props.style, ...activeStyle } } } } return React.createElement('a', props) } }) export default Link
frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-sys-notification-dialog.js
miurahr/seahub
import React from 'react'; import PropTypes from 'prop-types'; import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Form, FormGroup, Input } from 'reactstrap'; import { gettext } from '../../../utils/constants'; const propTypes = { toggle: PropTypes.func.isRequired, addNotification: PropTypes.func.isRequired }; class SysAdminAddSysNotificationDialog extends React.Component { constructor(props) { super(props); this.state = { value: '', isSubmitBtnActive: false }; } handleChange = (e) => { const value = e.target.value; this.setState({ value: value, isSubmitBtnActive: value.trim() != '' }); } handleSubmit = () => { this.toggle(); this.props.addNotification(this.state.value.trim()); } toggle = () => { this.props.toggle(); } render() { return ( <Modal isOpen={true} toggle={this.toggle}> <ModalHeader toggle={this.toggle}>{gettext('Add new notification')}</ModalHeader> <ModalBody> <Form> <FormGroup> <Input type="textarea" value={this.state.value} onChange={this.handleChange} /> </FormGroup> </Form> </ModalBody> <ModalFooter> <Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button> <Button color="primary" onClick={this.handleSubmit} disabled={!this.state.isSubmitBtnActive}>{gettext('Submit')}</Button> </ModalFooter> </Modal> ); } } SysAdminAddSysNotificationDialog.propTypes = propTypes; export default SysAdminAddSysNotificationDialog;
docs/src/app/components/pages/components/RefreshIndicator/ExampleReady.js
ArcanisCz/material-ui
import React from 'react'; import RefreshIndicator from 'material-ui/RefreshIndicator'; const style = { container: { position: 'relative', }, refresh: { display: 'inline-block', position: 'relative', }, }; const RefreshIndicatorExampleSimple = () => ( <div style={style.container}> <RefreshIndicator percentage={30} size={40} left={10} top={0} status="ready" style={style.refresh} /> <RefreshIndicator percentage={60} size={50} left={65} top={0} status="ready" style={style.refresh} /> <RefreshIndicator percentage={80} size={60} left={120} top={0} color="red" status="ready" style={style.refresh} /> <RefreshIndicator percentage={100} size={70} left={175} top={0} color="red" // Overridden by percentage={100} status="ready" style={style.refresh} /> </div> ); export default RefreshIndicatorExampleSimple;
frontend/js/components/pages/register.js
skeswa/equitize
import React from 'react'; import {Navigation, Link} from 'react-router'; import PublicPageMixin from '../../mixins/publicpage'; const Register = React.createClass({ mixins: [ PublicPageMixin ], render: () => { return ( <div> <h1>register</h1> </div> ); } }); export default Register;
components/Deck/ContentPanel/SlideModes/SlideViewPanel/SlideViewPanel.js
slidewiki/slidewiki-platform
import PropTypes from 'prop-types'; import React from 'react'; import {connectToStores} from 'fluxible-addons-react'; import SlideContentView from './SlideContentView'; import SlideViewStore from '../../../../../stores/SlideViewStore'; import DeckTreeStore from '../../../../../stores/DeckTreeStore'; import SlideEditStore from '../../../../../stores/SlideEditStore'; import setDocumentTitle from '../../../../../actions/setDocumentTitle'; class SlideViewPanel extends React.Component { constructor(props) { super(props); this.currentID; this.slideContentView = ''; } componentDidMount(){ this.setTitle(); } componentWillReceiveProps(nextProps) { if (this.props.SlideViewStore.content !== nextProps.SlideViewStore.content) { this.slideContentView = ''; this.forceUpdate(); } } componentWillMount(){ const selector = this.props.selector || this.props.DeckTreeStore.selector; if (selector && this.currentID !== selector.sid) { this.slideContentView = ''; this.currentID = selector.sid; this.forceUpdate(); } } componentDidUpdate(){ const selector = this.props.selector || this.props.DeckTreeStore.selector; if (selector && this.currentID !== selector.sid) { this.setTitle(); this.slideContentView = ''; this.currentID = selector.sid; } } componentWillUnmount() { } setTitle() { const deckTitle = this.props.DeckTreeStore.deckTree.get('title'); const slideTitle = this.props.SlideEditStore.title; this.context.executeAction(setDocumentTitle, { title: `${deckTitle} | ${slideTitle}` }); } render() { const selector = this.props.selector || this.props.DeckTreeStore.selector; let deckTheme = selector && selector.theme; if (!deckTheme) { // we need to locate the slide in the DeckTreeStore.flatTree and find the theme from there let treeNode = this.props.DeckTreeStore.flatTree .find((node) => node.get('id') === this.props.SlideViewStore.slideId && node.get('type') === 'slide'); if (treeNode) { deckTheme = treeNode.get('theme'); } else { // pick theme from deck root as a last resort deckTheme = this.props.DeckTreeStore.theme; } } if (this.currentID === selector.sid && this.props.SlideViewStore.slideId) { let hideSpeakerNotes = true; if (this.props.SlideViewStore.speakernotes !== '' && this.props.SlideViewStore.speakernotes !== ' '){hideSpeakerNotes = false;} this.slideContentView = ( <div className="ui bottom attached segment"> <SlideContentView content={this.props.SlideViewStore.content} speakernotes={this.props.SlideViewStore.speakernotes} hideSpeakerNotes={hideSpeakerNotes} theme={deckTheme}/> </div>); } else { this.slideContentView = null; } const loadStyle = { minWidth: '100%', minHeight: 610, overflowY: 'auto', overflowX: 'auto', position: 'relative' }; return ( <div className="ui bottom attached segment"> {this.slideContentView || <div style={loadStyle} className="ui active dimmer"><div className="ui text loader">Loading</div></div>} </div> ); } } SlideViewPanel.contextTypes = { executeAction: PropTypes.func.isRequired }; SlideViewPanel = connectToStores(SlideViewPanel, [SlideViewStore, DeckTreeStore, SlideEditStore], (context, props) => { return { SlideViewStore: context.getStore(SlideViewStore).getState(), DeckTreeStore: context.getStore(DeckTreeStore).getState(), SlideEditStore: context.getStore(SlideEditStore).getState(), }; }); export default SlideViewPanel;
js/setup.js
weihanglo/pycontw-mobile
import React from 'react' import {Platform} from 'react-native' import {Provider} from 'react-redux' import {createStore, applyMiddleware} from 'redux' import {composeWithDevTools} from 'remote-redux-devtools' import thunk from 'redux-thunk' import reducer from './reducers' import App from './App' // Redux Store Configuration const middlewares = [thunk] const composeEnhancers = composeWithDevTools({ name: `${Platform.OS} - ${new Date()}` })(applyMiddleware(...middlewares)) const store = createStore(reducer, /* initialState, */ composeEnhancers) class Root extends React.Component { render () { return ( <Provider store={store}> <App /> </Provider> ) } } export default function () { return Root }
app/containers/App.js
jrhalchak/BeatsPM
// @flow import React, { Component } from 'react'; export default class App extends Component { props: { children: HTMLElement }; render() { return ( <div> {this.props.children} </div> ); } }
modules/gui/src/app/home/body/process/recipe/classification/panels/inputImagery/assetSection.js
openforis/sepal
import {AssetInput} from 'widget/assetInput' import {msg} from 'translate' import PropTypes from 'prop-types' import React from 'react' import style from './inputImage.module.css' export default class AssetSection extends React.Component { render() { const {input, onLoading, onLoaded} = this.props return ( <AssetInput className={style.inputComponent} input={input} label={msg('process.classification.panel.inputImagery.form.asset.label')} placeholder={msg('process.classification.panel.inputImagery.form.asset.placeholder')} autoFocus onLoading={onLoading} onLoaded={({asset, metadata, visualizations}) => { onLoaded({id: asset, bands: metadata.bands, metadata, visualizations}) }} /> ) } } AssetSection.propTypes = { input: PropTypes.object.isRequired, onLoaded: PropTypes.func.isRequired, onLoading: PropTypes.func.isRequired }
src/components/TagManager/TagManager.js
nambawan/g-old
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { createTag, updateTag, deleteTag } from '../../actions/tag'; import { getTags, getTagStatus } from '../../reducers'; import Button from '../Button'; import Box from '../Box'; import TagForm from '../TagForm'; import TagTable from '../TagTable'; import ConfirmLayer from '../ConfirmLayer'; class TagManager extends React.Component { static propTypes = { tagUpdates: PropTypes.shape({ success: PropTypes.bool, pending: PropTypes.bool, }), updateTag: PropTypes.func.isRequired, createTag: PropTypes.func.isRequired, deleteTag: PropTypes.func.isRequired, tags: PropTypes.arrayOf(PropTypes.shape({})), }; static defaultProps = { tagUpdates: null, tags: null, }; constructor(props) { super(props); this.state = {}; this.onTagClick = this.onTagClick.bind(this); this.onCancelClick = this.onCancelClick.bind(this); this.onCreateTagClick = this.onCreateTagClick.bind(this); this.onDeleteClick = this.onDeleteClick.bind(this); this.onLayerClose = this.onLayerClose.bind(this); this.onDelete = this.onDelete.bind(this); } onTagClick(action, data) { if (action === 'DELETE') { this.onDeleteClick(data); } else { this.setState({ showTag: true, currentTag: data }); } } onCancelClick() { this.setState({ showTag: false }); } onDeleteClick(data) { this.setState({ showLayer: true, currentTag: data }); } onCreateTagClick() { this.setState({ showTag: true, currentTag: {} }); } onLayerClose() { this.setState({ showLayer: false, showTag: false }); } onDelete() { // eslint-disable-next-line react/destructuring-assignment this.props.deleteTag({ id: this.state.currentTag.id }); } render() { const { showTag, currentTag, showLayer } = this.state; const { tagUpdates, updateTag: updateFn, createTag: createFn, tags, } = this.props; if (showTag) { return ( <TagForm tag={currentTag} updates={tagUpdates || {}} updateTag={updateFn} createTag={createFn} onCancel={this.onCancelClick} /> ); } return ( <Box column> {showLayer && ( <ConfirmLayer success={tagUpdates.success} pending={tagUpdates.pending} onSubmit={this.onDelete} onClose={this.onLayerClose} /> )} <Button icon="+" label="Add Tag" onClick={this.onCreateTagClick} /> <TagTable onClickCheckbox={this.onClickCheckbox} onClickMenu={this.onTagClick} allowMultiSelect searchTerm="" noRequestsFound="No requests found" checkedIndices={[]} tags={tags || []} tableHeaders={[ 'default', 'name german', 'name italian', 'name ladin', 'count', '', ]} /> </Box> ); } } const mapStateToProps = state => ({ tags: getTags(state), tagUpdates: getTagStatus(state), }); const mapDispatch = { createTag, updateTag, deleteTag, }; export default connect( mapStateToProps, mapDispatch, )(TagManager);
app/components/InputCell.js
AnnaBlackwell/sudoku-react
import React from 'react' export default React.createClass({ render: function () { return ( <div> <form> <input className='input-cell' type='text' autoFocus={true} maxLength={1} /> </form> </div> ) } })
react/features/invite/components/DialInNumbersForm.js
parisjulien/arkadin-jitsimeet
import { StatelessDropdownMenu } from '@atlaskit/dropdown-menu'; import ExpandIcon from '@atlaskit/icon/glyph/expand'; import React, { Component } from 'react'; import { connect } from 'react-redux'; import { translate } from '../../base/i18n'; import { getLocalParticipant } from '../../base/participants'; import { updateDialInNumbers } from '../actions'; const logger = require('jitsi-meet-logger').getLogger(__filename); /** * React {@code Component} responsible for fetching and displaying telephone * numbers for dialing into a conference. Also supports copying a selected * dial-in number to the clipboard. * * @extends Component */ class DialInNumbersForm extends Component { /** * {@code DialInNumbersForm}'s property types. * * @static */ static propTypes = { /** * The redux state representing the dial-in numbers feature. */ _dialIn: React.PropTypes.object, /** * The display name of the local user. */ _localUserDisplayName: React.PropTypes.string, /** * Invoked to send an ajax request for dial-in numbers. */ dispatch: React.PropTypes.func, /** * The URL of the conference into which this {@code DialInNumbersForm} * is inviting the local participant. */ inviteURL: React.PropTypes.string, /** * Invoked to obtain translated strings. */ t: React.PropTypes.func }; /** * Initializes a new {@code DialInNumbersForm} instance. * * @param {Object} props - The read-only properties with which the new * instance is to be initialized. */ constructor(props) { super(props); this.state = { /** * Whether or not the dropdown should be open. * * @type {boolean} */ isDropdownOpen: false, /** * The dial-in number to display as currently selected in the * dropdown. The value should be an object which has two key/value * pairs, content and number. The value of "content" will display in * the dropdown while the value of "number" is a substring of * "content" which will be copied to clipboard. * * @type {object} */ selectedNumber: null }; /** * The internal reference to the DOM/HTML element backing the React * {@code Component} text area. It is necessary for the implementation * of copying to the clipboard. * * @private * @type {HTMLTextAreaElement} */ this._copyElement = null; // Bind event handlers so they are only bound once for every instance. this._onCopyClick = this._onCopyClick.bind(this); this._onOpenChange = this._onOpenChange.bind(this); this._onSelect = this._onSelect.bind(this); this._setCopyElement = this._setCopyElement.bind(this); } /** * Sets a default number to display in the dropdown trigger. * * @inheritdoc * returns {void} */ componentWillMount() { const { numbers } = this.props._dialIn; if (numbers) { this._setDefaultNumber(numbers); } else { this.props.dispatch(updateDialInNumbers()); } } /** * Monitors for number updates and sets a default number to display in the * dropdown trigger if not already set. * * @inheritdoc * returns {void} */ componentWillReceiveProps(nextProps) { if (!this.state.selectedNumber && nextProps._dialIn.numbers) { this._setDefaultNumber(nextProps._dialIn.numbers); } } /** * Implements React's {@link Component#render()}. Returns null if the * component is not ready for display. * * @inheritdoc * @returns {ReactElement|null} */ render() { const { _dialIn, t } = this.props; const { conferenceID, numbers, numbersEnabled } = _dialIn; const { selectedNumber } = this.state; if (!conferenceID || !numbers || !numbersEnabled || !selectedNumber) { return null; } const items = this._formatNumbers(numbers); return ( <div className = 'form-control dial-in-numbers'> <label className = 'form-control__label'> { t('invite.howToDialIn') } <span className = 'dial-in-numbers-conference-id'> { conferenceID } </span> </label> <div className = 'form-control__container'> { this._createDropdownMenu(items, selectedNumber.content) } <button className = 'button-control button-control_light' onClick = { this._onCopyClick } type = 'button'> Copy </button> </div> <textarea className = 'dial-in-numbers-copy' readOnly = { true } ref = { this._setCopyElement } tabIndex = '-1' value = { this._generateCopyText() } /> </div> ); } /** * Creates a {@code StatelessDropdownMenu} instance. * * @param {Array} items - The content to display within the dropdown. * @param {string} triggerText - The text to display within the * trigger element. * @returns {ReactElement} */ _createDropdownMenu(items, triggerText) { return ( <StatelessDropdownMenu isOpen = { this.state.isDropdownOpen } items = { [ { items } ] } onItemActivated = { this._onSelect } onOpenChange = { this._onOpenChange } shouldFitContainer = { true }> { this._createDropdownTrigger(triggerText) } </StatelessDropdownMenu> ); } /** * Creates a React {@code Component} with a readonly HTMLInputElement as a * trigger for displaying the dropdown menu. The {@code Component} will also * display the currently selected number. * * @param {string} triggerText - Text to display in the HTMLInputElement. * @private * @returns {ReactElement} */ _createDropdownTrigger(triggerText) { return ( <div className = 'dial-in-numbers-trigger'> <input className = 'input-control' readOnly = { true } type = 'text' value = { triggerText || '' } /> <span className = 'dial-in-numbers-trigger-icon'> <ExpandIcon label = 'expand' /> </span> </div> ); } /** * Detects whether the response from dialInNumbersUrl returned an array or * an object with dial-in numbers and calls the appropriate method to * transform the numbers into the format expected by * {@code StatelessDropdownMenu}. * * @param {Array<string>|Object} dialInNumbers - The numbers returned from * requesting dialInNumbersUrl. * @private * @returns {Array<Object>} */ _formatNumbers(dialInNumbers) { if (Array.isArray(dialInNumbers)) { return this._formatNumbersArray(dialInNumbers); } return this._formatNumbersObject(dialInNumbers); } /** * Transforms the passed in numbers array into an array of objects that can * be parsed by {@code StatelessDropdownMenu}. * * @param {Array<string>} dialInNumbers - An array with dial-in numbers to * display and copy. * @private * @returns {Array<Object>} */ _formatNumbersArray(dialInNumbers) { return dialInNumbers.map(number => { return { content: number, number }; }); } /** * Transforms the passed in numbers object into an array of objects that can * be parsed by {@code StatelessDropdownMenu}. * * @param {Object} dialInNumbers - The numbers object to parse. The * expected format is an object with keys being the name of the country * and the values being an array of numbers as strings. * @private * @returns {Array<Object>} */ _formatNumbersObject(dialInNumbers) { const phoneRegions = Object.keys(dialInNumbers); if (!phoneRegions.length) { return []; } const formattedNumbers = phoneRegions.map(region => { const numbers = dialInNumbers[region]; return numbers.map(number => { return { content: `${region}: ${number}`, number }; }); }); return Array.prototype.concat(...formattedNumbers); } /** * Creates a message describing how to dial in to the conference. * * @private * @returns {string} */ _generateCopyText() { const { t } = this.props; const welcome = t('invite.invitedYouTo', { inviteURL: this.props.inviteURL, userName: this.props._localUserDisplayName }); const callNumber = t('invite.callNumber', { number: this.state.selectedNumber.number }); const stepOne = `1) ${callNumber}`; const enterID = t('invite.enterID', { conferenceID: this.props._dialIn.conferenceID }); const stepTwo = `2) ${enterID}`; return `${welcome}\n${stepOne}\n${stepTwo}`; } /** * Copies part of the number displayed in the dropdown trigger into the * clipboard. Only the value specified in selectedNumber.number, which * should be a substring of the displayed value, will be copied. * * @private * @returns {void} */ _onCopyClick() { try { this._copyElement.select(); document.execCommand('copy'); this._copyElement.blur(); } catch (err) { logger.error('error when copying the text', err); } } /** * Sets the internal state to either open or close the dropdown. If the * dropdown is disabled, the state will always be set to false. * * @param {Object} dropdownEvent - The even returned from clicking on the * dropdown trigger. * @private * @returns {void} */ _onOpenChange(dropdownEvent) { this.setState({ isDropdownOpen: dropdownEvent.isOpen }); } /** * Updates the internal state of the currently selected number. * * @param {Object} selection - Event from choosing an dropdown option. * @private * @returns {void} */ _onSelect(selection) { this.setState({ isDropdownOpen: false, selectedNumber: selection.item }); } /** * Sets the internal reference to the DOM/HTML element backing the React * {@code Component} text area. * * @param {HTMLTextAreaElement} element - The DOM/HTML element for this * {@code Component}'s text area. * @private * @returns {void} */ _setCopyElement(element) { this._copyElement = element; } /** * Updates the internal state of the currently selected number by defaulting * to the first available number. * * @param {Object} dialInNumbers - The array or object of numbers to parse. * @private * @returns {void} */ _setDefaultNumber(dialInNumbers) { const numbers = this._formatNumbers(dialInNumbers); this.setState({ selectedNumber: numbers[0] }); } } /** * Maps (parts of) the Redux state to the associated * {@code DialInNumbersForm}'s props. * * @param {Object} state - The Redux state. * @private * @returns {{ * _localUserDisplayName: React.PropTypes.string, * _dialIn: React.PropTypes.object * }} */ function _mapStateToProps(state) { return { _localUserDisplayName: getLocalParticipant(state).name, _dialIn: state['features/invite'] }; } export default translate(connect(_mapStateToProps)(DialInNumbersForm));
lib/datepicker/DatePickerDialog.android.js
pandiaraj44/react-native-datepicker-dialog
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { View, DatePickerAndroid, StyleSheet } from 'react-native'; export default class DatePickerDialog extends Component{ constructor(props){ super(props); this.handleDatePicker = this.handleDatePicker.bind(this); this.state = { date: null } } static propTypes = { /** * Date picked handler. * * This method will be called when the user selected the date from picker * The first and only argument is a Date object representing the picked * date and time. */ onDatePicked: PropTypes.func, /** * Date Cancelled handler. * * This method will be called when the user dismissed the picker. */ onCancel: PropTypes.func, } /** * Opens the standard Android date picker dialog. * * The available keys for the `options` object are: * * `date` (`Date` object or timestamp in milliseconds) - date to show by default * * `minDate` (`Date` or timestamp in milliseconds) - minimum date that can be selected * * `maxDate` (`Date` object or timestamp in milliseconds) - minimum date that can be selected * * Note the native date picker dialog has some UI glitches on Android 4 and lower * when using the `minDate` and `maxDate` options. */ open(options: Object){ DatePickerAndroid.open(options).then(this.handleDatePicker); } handleDatePicker({action, year, month, day}){ if (action !== DatePickerAndroid.dismissedAction) { this.setState({ date: new Date(year, month, day) }); if(this.props.onDatePicked){ this.props.onDatePicked(new Date(year, month, day)); } }else if(this.props.onCancel){ this.props.onCancel(); } } getSelectedDate(){ return this.state.date; } render(){ return( <View style={styles.container}></View> ); } } const styles = StyleSheet.create({ container: { width: 0, height: 0, backgroundColor: 'transparent', position: 'absolute', top: 0, bottom: 0, left: 0, right: 0 } });
Mung/app/utils/Utils.js
mochixuan/Mung
import React from 'react' import { Image, Dimensions } from 'react-native' const {width,height} = Dimensions.get('window'); const TabOptions = (labal,icon)=>{ return ({ tabBarLabel: labal, tabBarIcon: ({tintColor}) => ( <Image style={{ width: 26, height: 26, tintColor:tintColor }} source={icon} /> ) }) } const jumpPager = (navigate,page,params) => { if (params != null) { navigate(page,{ data:params }) } else { navigate(page) } } export {TabOptions,jumpPager,width,height}
test/helpers/shallowRenderHelper.js
JieRong1992/photo-gallery
/** * Function to get the shallow output for a given component * As we are using phantom.js, we also need to include the fn.proto.bind shim! * * @see http://simonsmith.io/unit-testing-react-components-without-a-dom/ * @author somonsmith */ import React from 'react'; import TestUtils from 'react-addons-test-utils'; /** * Get the shallow rendered component * * @param {Object} component The component to return the output for * @param {Object} props [optional] The components properties * @param {Mixed} ...children [optional] List of children * @return {Object} Shallow rendered output */ export default function createComponent(component, props = {}, ...children) { const shallowRenderer = TestUtils.createRenderer(); shallowRenderer.render(React.createElement(component, props, children.length > 1 ? children : children[0])); return shallowRenderer.getRenderOutput(); }
app/javascript/mastodon/features/notifications/index.js
honpya/taketodon
import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Column from '../../components/column'; import ColumnHeader from '../../components/column_header'; import { expandNotifications, scrollTopNotifications } from '../../actions/notifications'; import { addColumn, removeColumn, moveColumn } from '../../actions/columns'; import NotificationContainer from './containers/notification_container'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ColumnSettingsContainer from './containers/column_settings_container'; import { createSelector } from 'reselect'; import { List as ImmutableList } from 'immutable'; import { debounce } from 'lodash'; import ScrollableList from '../../components/scrollable_list'; const messages = defineMessages({ title: { id: 'column.notifications', defaultMessage: 'Notifications' }, }); const getNotifications = createSelector([ state => ImmutableList(state.getIn(['settings', 'notifications', 'shows']).filter(item => !item).keys()), state => state.getIn(['notifications', 'items']), ], (excludedTypes, notifications) => notifications.filterNot(item => excludedTypes.includes(item.get('type')))); const mapStateToProps = state => ({ notifications: getNotifications(state), isLoading: state.getIn(['notifications', 'isLoading'], true), isUnread: state.getIn(['notifications', 'unread']) > 0, hasMore: !!state.getIn(['notifications', 'next']), }); @connect(mapStateToProps) @injectIntl export default class Notifications extends React.PureComponent { static propTypes = { columnId: PropTypes.string, notifications: ImmutablePropTypes.list.isRequired, dispatch: PropTypes.func.isRequired, shouldUpdateScroll: PropTypes.func, intl: PropTypes.object.isRequired, isLoading: PropTypes.bool, isUnread: PropTypes.bool, multiColumn: PropTypes.bool, hasMore: PropTypes.bool, }; static defaultProps = { trackScroll: true, }; componentWillUnmount () { this.handleLoadMore.cancel(); this.handleScrollToTop.cancel(); this.handleScroll.cancel(); this.props.dispatch(scrollTopNotifications(false)); } handleLoadMore = debounce(() => { this.props.dispatch(expandNotifications()); }, 300, { leading: true }); handleScrollToTop = debounce(() => { this.props.dispatch(scrollTopNotifications(true)); }, 100); handleScroll = debounce(() => { this.props.dispatch(scrollTopNotifications(false)); }, 100); handlePin = () => { const { columnId, dispatch } = this.props; if (columnId) { dispatch(removeColumn(columnId)); } else { dispatch(addColumn('NOTIFICATIONS', {})); } } handleMove = (dir) => { const { columnId, dispatch } = this.props; dispatch(moveColumn(columnId, dir)); } handleHeaderClick = () => { this.column.scrollTop(); } setColumnRef = c => { this.column = c; } handleMoveUp = id => { const elementIndex = this.props.notifications.findIndex(item => item.get('id') === id) - 1; this._selectChild(elementIndex); } handleMoveDown = id => { const elementIndex = this.props.notifications.findIndex(item => item.get('id') === id) + 1; this._selectChild(elementIndex); } _selectChild (index) { const element = this.column.node.querySelector(`article:nth-of-type(${index + 1}) .focusable`); if (element) { element.focus(); } } render () { const { intl, notifications, shouldUpdateScroll, isLoading, isUnread, columnId, multiColumn, hasMore } = this.props; const pinned = !!columnId; const emptyMessage = <FormattedMessage id='empty_column.notifications' defaultMessage="You don't have any notifications yet. Interact with others to start the conversation." />; let scrollableContent = null; if (isLoading && this.scrollableContent) { scrollableContent = this.scrollableContent; } else if (notifications.size > 0 || hasMore) { scrollableContent = notifications.map((item) => ( <NotificationContainer key={item.get('id')} notification={item} accountId={item.get('account')} onMoveUp={this.handleMoveUp} onMoveDown={this.handleMoveDown} /> )); } else { scrollableContent = null; } this.scrollableContent = scrollableContent; const scrollContainer = ( <ScrollableList scrollKey={`notifications-${columnId}`} trackScroll={!pinned} isLoading={isLoading} hasMore={hasMore} emptyMessage={emptyMessage} onLoadMore={this.handleLoadMore} onScrollToTop={this.handleScrollToTop} onScroll={this.handleScroll} shouldUpdateScroll={shouldUpdateScroll} > {scrollableContent} </ScrollableList> ); return ( <Column ref={this.setColumnRef}> <ColumnHeader icon='bell' active={isUnread} title={intl.formatMessage(messages.title)} onPin={this.handlePin} onMove={this.handleMove} onClick={this.handleHeaderClick} pinned={pinned} multiColumn={multiColumn} > <ColumnSettingsContainer /> </ColumnHeader> {scrollContainer} </Column> ); } }
example/index.js
in-flux/component-router
import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import './reset.css'; import './app.css'; const appRoot = document.createElement('div'); appRoot.id = 'app'; document.body.appendChild(appRoot); ReactDOM.render(<App />, appRoot);
src/js/components/icons/base/Article.js
linde12/grommet
// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import CSSClassnames from '../../../utils/CSSClassnames'; import Intl from '../../../utils/Intl'; import Props from '../../../utils/Props'; const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_INDEX = CSSClassnames.COLOR_INDEX; export default class Icon extends Component { render () { const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-article`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLASS_ROOT}--responsive`]: responsive, [`${COLOR_INDEX}-${colorIndex}`]: colorIndex } ); a11yTitle = a11yTitle || Intl.getMessage(intl, 'article'); const restProps = Props.omit(this.props, Object.keys(Icon.propTypes)); return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M16,7 L19,7 L19,11 L16,11 L16,7 Z M9,15 L20,15 M9,11 L13,11 M9,7 L13,7 M6,18.5 C6,19.8807119 4.88071187,21 3.5,21 C2.11928813,21 1,19.8807119 1,18.5 L1,7 L6.02493781,7 M6,18.5 L6,3 L23,3 L23,18.5 C23,19.8807119 21.8807119,21 20.5,21 L3.5,21"/></svg>; } }; Icon.contextTypes = { intl: PropTypes.object }; Icon.defaultProps = { responsive: true }; Icon.displayName = 'Article'; Icon.icon = true; Icon.propTypes = { a11yTitle: PropTypes.string, colorIndex: PropTypes.string, size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']), responsive: PropTypes.bool };
examples/js/basic/basic-table.js
pvoznyuk/react-bootstrap-table
/* eslint max-len: 0 */ import React from 'react'; import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table'; const products = []; function addProducts(quantity) { const startId = products.length; for (let i = 0; i < quantity; i++) { const id = startId + i; products.push({ id: id, name: 'Item name ' + id, price: 2100 + i }); } } addProducts(5); export default class BasicTable extends React.Component { render() { return ( <BootstrapTable data={ products }> <TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn> <TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn> <TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> </BootstrapTable> ); } }
src/svg-icons/action/donut-small.js
pomerantsev/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionDonutSmall = (props) => ( <SvgIcon {...props}> <path d="M11 9.16V2c-5 .5-9 4.79-9 10s4 9.5 9 10v-7.16c-1-.41-2-1.52-2-2.84s1-2.43 2-2.84zM14.86 11H22c-.48-4.75-4-8.53-9-9v7.16c1 .3 1.52.98 1.86 1.84zM13 14.84V22c5-.47 8.52-4.25 9-9h-7.14c-.34.86-.86 1.54-1.86 1.84z"/> </SvgIcon> ); ActionDonutSmall = pure(ActionDonutSmall); ActionDonutSmall.displayName = 'ActionDonutSmall'; ActionDonutSmall.muiName = 'SvgIcon'; export default ActionDonutSmall;
Libraries/Components/Keyboard/Keyboard.js
Andreyco/react-native
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Keyboard * @flow */ 'use strict'; const invariant = require('fbjs/lib/invariant'); const NativeEventEmitter = require('NativeEventEmitter'); const KeyboardObserver = require('NativeModules').KeyboardObserver; const dismissKeyboard = require('dismissKeyboard'); const KeyboardEventEmitter = new NativeEventEmitter(KeyboardObserver); type KeyboardEventName = | 'keyboardWillShow' | 'keyboardDidShow' | 'keyboardWillHide' | 'keyboardDidHide' | 'keyboardWillChangeFrame' | 'keyboardDidChangeFrame'; type KeyboardEventData = { endCoordinates: { width: number, height: number, screenX: number, screenY: number, }, }; type KeyboardEventListener = (e: KeyboardEventData) => void; // The following object exists for documentation purposes // Actual work happens in // https://github.com/facebook/react-native/blob/master/Libraries/EventEmitter/NativeEventEmitter.js /** * `Keyboard` module to control keyboard events. * * ### Usage * * The Keyboard module allows you to listen for native events and react to them, as * well as make changes to the keyboard, like dismissing it. * *``` * import React, { Component } from 'react'; * import { Keyboard, TextInput } from 'react-native'; * * class Example extends Component { * componentWillMount () { * this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow); * this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide); * } * * componentWillUnmount () { * this.keyboardDidShowListener.remove(); * this.keyboardDidHideListener.remove(); * } * * _keyboardDidShow () { * alert('Keyboard Shown'); * } * * _keyboardDidHide () { * alert('Keyboard Hidden'); * } * * render() { * return ( * <TextInput * onSubmitEditing={Keyboard.dismiss} * /> * ); * } * } *``` */ let Keyboard = { /** * The `addListener` function connects a JavaScript function to an identified native * keyboard notification event. * * This function then returns the reference to the listener. * * @param {string} eventName The `nativeEvent` is the string that identifies the event you're listening for. This *can be any of the following: * * - `keyboardWillShow` * - `keyboardDidShow` * - `keyboardWillHide` * - `keyboardDidHide` * - `keyboardWillChangeFrame` * - `keyboardDidChangeFrame` * * @param {function} callback function to be called when the event fires. */ addListener(eventName: KeyboardEventName, callback: KeyboardEventListener) { invariant(false, 'Dummy method used for documentation'); }, /** * Removes a specific listener. * * @param {string} eventName The `nativeEvent` is the string that identifies the event you're listening for. * @param {function} callback function to be called when the event fires. */ removeListener(eventName: KeyboardEventName, callback: Function) { invariant(false, 'Dummy method used for documentation'); }, /** * Removes all listeners for a specific event type. * * @param {string} eventType The native event string listeners are watching which will be removed. */ removeAllListeners(eventName: KeyboardEventName) { invariant(false, 'Dummy method used for documentation'); }, /** * Dismisses the active keyboard and removes focus. */ dismiss() { invariant(false, 'Dummy method used for documentation'); } }; // Throw away the dummy object and reassign it to original module Keyboard = KeyboardEventEmitter; Keyboard.dismiss = dismissKeyboard; module.exports = Keyboard;
src/components/tables/NLPMinRankTable.js
nbuechler/ample-affect-exhibit
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import DivListGroup from '../groups/DivListGroup' import { Table, Alert } from 'react-bootstrap'; export default class NLPMinRankTable extends Component { constructor(props) { super(props); } render () { let array = this.props.data; return ( <div> <Table style={{fontSize: '12px', margin: 'auto', textAlign: 'center'}} condensed> <tbody> <tr> <td style={{width: '80%'}}> <div className="affect--display_name"> {array[0].emotion} </div> </td> <td style={{width: '10%'}}> <div className="affect--display_rank"> 1 </div> </td> <td style={{width: '10%'}}> <div className="affect--display_scores"> {array[0].normalized_r_score.toFixed(4)} </div> </td> </tr> <tr> <td> <div className="affect--display_name"> {array[1].emotion} </div> </td> <td> <div className="affect--display_rank"> 2 </div> </td> <td> <div className="affect--display_scores"> {array[1].normalized_r_score.toFixed(4)} </div> </td> </tr> <tr> <td> <div className="affect--display_name"> {array[2].emotion} </div> </td> <td> <div className="affect--display_rank"> 3 </div> </td> <td> <div className="affect--display_scores"> {array[2].normalized_r_score.toFixed(4)} </div> </td> </tr> </tbody> </Table> </div> ); } }
packages/material-ui-icons/src/FeaturedVideo.js
AndriusBil/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let FeaturedVideo = 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-2zm-9 9H3V5h9v7z" /> </SvgIcon>; FeaturedVideo = pure(FeaturedVideo); FeaturedVideo.muiName = 'SvgIcon'; export default FeaturedVideo;
script/js/react/material-ui/src/demo/bar/bar.js
joshuazhan/arsenal4j
import React from 'react'; import {render} from 'react-dom'; import injectTapEventPlugin from 'react-tap-event-plugin'; import AppBar from 'material-ui/AppBar'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import NavigationMenu from 'material-ui/svg-icons/navigation/menu'; import IconButton from 'material-ui/IconButton'; injectTapEventPlugin(); const muiTheme = getMuiTheme(); // 图表列表查看,https://materialdesignicons.com/ const AppBarExampleIcon = () => ( <AppBar title="Title" iconElementLeft={<IconButton><NavigationMenu /></IconButton>} /> ); render( <MuiThemeProvider muiTheme={muiTheme}> <AppBarExampleIcon /> </MuiThemeProvider> , document.getElementById('app'));
src/svg-icons/notification/do-not-disturb-on.js
ichiohta/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NotificationDoNotDisturbOn = (props) => ( <SvgIcon {...props}> <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11H7v-2h10v2z"/> </SvgIcon> ); NotificationDoNotDisturbOn = pure(NotificationDoNotDisturbOn); NotificationDoNotDisturbOn.displayName = 'NotificationDoNotDisturbOn'; NotificationDoNotDisturbOn.muiName = 'SvgIcon'; export default NotificationDoNotDisturbOn;
docs/app/Examples/modules/Checkbox/Types/index.js
koenvg/Semantic-UI-React
import React from 'react' import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' import { Message } from 'semantic-ui-react' const CheckboxTypesExamples = () => ( <ExampleSection title='Types'> <Message info> All checkbox types use an input with type <code>checkbox</code> unless <code>type</code> is provided. {' '}Use <code>type</code> if you'd like to mix and match style and behavior. {' '}For instance, <code>slider</code> with <code>type</code> radio for exclusive sliders. </Message> <ComponentExample title='Checkbox' description='A box for checking.' examplePath='modules/Checkbox/Types/CheckboxExampleCheckbox' /> <ComponentExample description='You can define a label with a props object.' examplePath='modules/Checkbox/Types/CheckboxExampleShorthandObject' /> <ComponentExample description='You can define a label by passing your own element.' examplePath='modules/Checkbox/Types/CheckboxExampleShorthandElement' /> <ComponentExample title='Toggle' description='A checkbox can toggle.' examplePath='modules/Checkbox/Types/CheckboxExampleToggle' /> <ComponentExample title='Slider' description='A checkbox can look like a slider.' examplePath='modules/Checkbox/Types/CheckboxExampleSlider' /> <ComponentExample title='Radio' description='A checkbox can be formatted as a radio element. This means it is an exclusive option.' examplePath='modules/Checkbox/Types/CheckboxExampleRadio' /> <ComponentExample title='Radio Group' examplePath='modules/Checkbox/Types/CheckboxExampleRadioGroup' > <Message warning> Radios in a group must be <a href='https://facebook.github.io/react/docs/forms.html#controlled-components' target='_blank'> &nbsp;controlled components. </a> </Message> </ComponentExample> </ExampleSection> ) export default CheckboxTypesExamples
examples/js/manipulation/search-clear-table.js
dana2208/react-bootstrap-table
/* eslint max-len: 0 */ /* eslint no-console: 0 */ import React from 'react'; import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table'; const products = []; function addProducts(quantity) { const startId = products.length; for (let i = 0; i < quantity; i++) { const id = startId + i; products.push({ id: id, name: 'Item name ' + id, price: 2100 + i }); } } addProducts(5); function afterSearch(searchText, result) { console.log(`Your search text is ${searchText}`); console.log('Result is:'); for (let i = 0; i < result.length; i++) { console.log('Product: ' + result[i].id + ', ' + result[i].name + ', ' + result[i].price); } } const options = { afterSearch: afterSearch, // define a after search hook, clearSearch: true }; export default class SearchClearTable extends React.Component { render() { return ( <BootstrapTable data={ products } search={ true } options={ options }> <TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn> <TableHeaderColumn dataField='name' searchable={ false }>Product Name</TableHeaderColumn> <TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> </BootstrapTable> ); } }
fields/types/name/NameField.js
wmertens/keystone
import Field from '../Field'; import React from 'react'; import { FormField, FormInput, FormRow } from 'elemental'; module.exports = Field.create({ displayName: 'NameField', focusTargetRef: 'first', valueChanged: function (which, event) { this.props.value[which] = event.target.value; this.props.onChange({ path: this.props.path, value: this.props.value, }); }, renderValue () { return ( <FormRow> <FormField width="one-half"> <FormInput noedit style={{ width: '100%' }}>{this.props.value.first}</FormInput> </FormField> <FormField width="one-half"> <FormInput noedit style={{ width: '100%' }}>{this.props.value.last}</FormInput> </FormField> </FormRow> ); }, renderField () { return ( <FormRow> <FormField width="one-half"> <FormInput name={this.props.paths.first} placeholder="First name" ref="first" value={this.props.value.first} onChange={this.valueChanged.bind(this, 'first')} autoComplete="off" /> </FormField> <FormField width="one-half"> <FormInput name={this.props.paths.last} placeholder="Last name" ref="last" value={this.props.value.last} onChange={this.valueChanged.bind(this, 'last')} autoComplete="off" /> </FormField> </FormRow> ); }, });
test/test_helper.js
fzoozai/redux-stephenGrider
import _$ from 'jquery'; import React from 'react'; import ReactDOM from 'react-dom'; import TestUtils from 'react-addons-test-utils'; import jsdom from 'jsdom'; import chai, { expect } from 'chai'; import chaiJquery from 'chai-jquery'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import reducers from '../src/reducers'; global.document = jsdom.jsdom('<!doctype html><html><body></body></html>'); global.window = global.document.defaultView; global.navigator = global.window.navigator; const $ = _$(window); chaiJquery(chai, chai.util, $); function renderComponent(ComponentClass, props = {}, state = {}) { const componentInstance = TestUtils.renderIntoDocument( <Provider store={createStore(reducers, state)}> <ComponentClass {...props} /> </Provider> ); return $(ReactDOM.findDOMNode(componentInstance)); } $.fn.simulate = function(eventName, value) { if (value) { this.val(value); } TestUtils.Simulate[eventName](this[0]); }; export {renderComponent, expect};
example/js/default.js
benlarkins/Keo
import ready from 'document-ready-promise'; import React from 'react'; import { render } from 'react-dom'; import { createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import { Provider } from 'react-redux'; import { Router, Route, useRouterHistory } from 'react-router'; import { createHashHistory } from 'history'; import reducers from './reducers'; import Layout from './containers/layout'; const createStoreWithMiddleware = applyMiddleware(thunk)(createStore); const store = createStoreWithMiddleware(reducers); ready().then(() => { const mountNode = document.querySelector('.todo-app'); const appHistory = useRouterHistory(createHashHistory)({ queryKey: false }); render(( <Provider store={store}> <Router history={appHistory}> <Route path="/" component={Layout} /> <Route path="/:status" component={Layout} /> </Router> </Provider> ), mountNode); });