path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
jenkins-design-language/src/js/components/material-ui/svg-icons/maps/flight.js
alvarolobato/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const MapsFlight = (props) => ( <SvgIcon {...props}> <path d="M10.18 9"/><path d="M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z"/> </SvgIcon> ); MapsFlight.displayName = 'MapsFlight'; MapsFlight.muiName = 'SvgIcon'; export default MapsFlight;
src/svg-icons/device/gps-fixed.js
barakmitz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceGpsFixed = (props) => ( <SvgIcon {...props}> <path d="M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/> </SvgIcon> ); DeviceGpsFixed = pure(DeviceGpsFixed); DeviceGpsFixed.displayName = 'DeviceGpsFixed'; DeviceGpsFixed.muiName = 'SvgIcon'; export default DeviceGpsFixed;
example/pages/dialog/index.js
woshisbb43/coinMessageWechat
import React from 'react'; import { Button, Dialog } from '../../../build/packages'; import Page from '../../component/page'; export default class DialogDemo extends React.Component { state = { showIOS1: false, showIOS2: false, showAndroid1: false, showAndroid2: false, style1: { buttons: [ { label: 'Ok', onClick: this.hideDialog.bind(this) } ] }, style2: { title: 'Heading', buttons: [ { type: 'default', label: 'Cancel', onClick: this.hideDialog.bind(this) }, { type: 'primary', label: 'Ok', onClick: this.hideDialog.bind(this) } ] } }; hideDialog() { this.setState({ showIOS1: false, showIOS2: false, showAndroid1: false, showAndroid2: false, }); } render() { return ( <Page className="dialog" title="Dialog" subTitle="对话框" spacing> <Button type="default" onClick={ e=> this.setState({ showIOS1: true}) } >iOS Style1</Button> <Button type="default" onClick={ e=> this.setState({ showIOS2: true}) }>iOS Style2</Button> <Button type="default" onClick={ e=> this.setState({ showAndroid1: true}) } >Android Style1</Button> <Button type="default" onClick={ e=> this.setState({ showAndroid2: true}) }>Android Style2</Button> <Dialog type="ios" title={this.state.style1.title} buttons={this.state.style1.buttons} show={this.state.showIOS1}> This is iOS Style 1 </Dialog> <Dialog type="ios" title={this.state.style2.title} buttons={this.state.style2.buttons} show={this.state.showIOS2}> This is iOS Style 2 </Dialog> <Dialog type="android" title={this.state.style1.title} buttons={this.state.style1.buttons} show={this.state.showAndroid1}> This is Android Style 1 </Dialog> <Dialog type="android" title={this.state.style2.title} buttons={this.state.style2.buttons} show={this.state.showAndroid2}> This is Android Style 2 </Dialog> </Page> ); } };
app/components/CommentForm/index.js
thecodingwhale/conduit-clone
/** * * CommentForm * */ import React from 'react'; import PropTypes from 'prop-types'; import { Form, Field, reduxForm } from 'redux-form/immutable'; import { Button } from 'reactstrap'; import validator from 'utils/validator'; import Input from 'components/Input'; let CommentForm = (props) => { // eslint-disable-line import/no-mutable-exports const { handleSubmit, submitting, posting } = props; const setSubmitTextBotton = posting ? 'Posting Comment...' : 'Post Comment'; return ( <Form onSubmit={handleSubmit}> <fieldset disabled={posting}> <div> <Field placeholder="Write a comment..." name="comment" component={Input} type="textarea" validate={[validator.required]} /> </div> <Button name="post-article" type="submit" outline color="primary" disabled={submitting}> {setSubmitTextBotton} </Button> </fieldset> </Form> ); }; CommentForm.propTypes = { handleSubmit: PropTypes.func, submitting: PropTypes.bool, posting: PropTypes.bool, }; CommentForm = reduxForm({ form: 'commentForm', enableReinitialize: true, })(CommentForm); export default CommentForm;
src/components/Select.js
g33ktony/ReactBooks
import React from 'react' import PropTypes from 'prop-types' export default function Select( props ) { Select.propTypes = { options: PropTypes.array.isRequired, onChange: PropTypes.func.isRequired, selected: PropTypes.string.isRequired, } return ( <select value={ props.selected } onChange={ props.onChange } > { props.options.map( (op, i) => ( <option value={ op.value } key={ i } disabled={ op.disabled }>{ op.text }</option> )) } </select> ) }
src/Alerts.js
chrislondon/react-bootstrap
import React, { Component } from 'react'; export class Alert extends Component { static defaultProps = { type: 'danger' }; getInterjection() { switch (this.props.type) { case 'success': return 'Well Done!'; case 'info': return 'Heads Up!'; case 'warning': return 'Warning!'; case 'danger': return 'Oh Snap!'; } } render() { const className = 'alert alert-' + this.props.type; return ( <div className={className} role="alert"> <strong>{this.getInterjection()}</strong> { this.props.children } </div> ); } } export class AlertList extends Component { static defaultProps = { type: 'danger', errors: [] }; render() { return ( <div> {this.props.errors.map((error, index) => <Alert key={index} type={this.props.type}>{ error }</Alert> )} </div> ); } }
src/client.js
pathwar/portal.pathwar.net
import React from 'react' import { render } from 'react-dom' import { Router, browserHistory } from 'react-router' import { Provider } from 'react-redux' import { syncHistoryWithStore } from 'react-router-redux' import configureStore from './store/configureStore' import routes from './routes' import DevTools from './containers/DevTools' const store = configureStore() // Create an enhanced history that syncs navigation events with the store const history = syncHistoryWithStore(browserHistory, store) render( <Provider store={store}> <div> <Router history={history} routes={routes} /> <DevTools /> </div> </Provider>, document.getElementById('root') )
src/ui/routes/Home/components/explainerSection/Section.component.js
andest01/trout-bubbles
import React from 'react' import classes from './Explainer.style.scss' const SectionComponent = React.createClass({ propTypes: { children: React.PropTypes.element.isRequired }, componentWillMount () { }, render () { return ( <div className={classes.section}> {this.props.children} </div> ) } }) export default SectionComponent
src/main.ios.js
stepennwolf/logical-quiz-iso-client
import React from 'react'; import { AppRegistry } from 'react-native'; import App from './components/App.ios'; import createConfiguredStore from './store/configureStore'; const store = createConfiguredStore(); const AppWithStore = () => <App store={store} />; // workaround for NavigationExperimental issue https://github.com/aksonov/react-native-router-flux/issues/708 // it should be fixed in ^0.28 version console.ignoredYellowBox = ['Warning: Failed propType: Required prop `sceneRendererProps.isRequired`']; AppRegistry.registerComponent('LogicalQuizISOApp', () => AppWithStore );
client/extensions/woocommerce/components/query-shipping-zones/index.js
Automattic/woocommerce-connect-client
/** @format */ /** * External dependencies */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; /** * Internal dependencies */ import { fetchShippingMethods } from 'woocommerce/state/sites/shipping-methods/actions'; import { fetchShippingZones } from 'woocommerce/state/sites/shipping-zones/actions'; import { fetchShippingClasses } from 'woocommerce/state/sites/shipping-classes/actions'; import { areShippingZonesLoaded } from 'woocommerce/state/sites/shipping-zones/selectors'; import { areShippingMethodsLoaded } from 'woocommerce/state/sites/shipping-methods/selectors'; import { areLocationsLoaded } from 'woocommerce/state/sites/data/locations/selectors'; import { areShippingClassesLoaded } from 'woocommerce/state/sites/shipping-classes/selectors'; import { getSelectedSiteId } from 'state/ui/selectors'; import QueryLocations from 'woocommerce/components/query-locations'; class QueryShippingZones extends Component { fetch( siteId ) { this.props.actions.fetchShippingZones( siteId ); this.props.actions.fetchShippingMethods( siteId ); this.props.actions.fetchShippingClasses( siteId ); } UNSAFE_componentWillMount() { const { siteId, loaded } = this.props; if ( siteId && ! loaded ) { this.fetch( siteId ); } } UNSAFE_componentWillReceiveProps( { siteId, loaded } ) { //site ID changed, fetch new settings if ( siteId !== this.props.siteId && ! loaded ) { this.fetch( siteId ); } } render() { return <QueryLocations siteId={ this.props.siteId } />; } } QueryShippingZones.propTypes = { siteId: PropTypes.number, }; export const areShippingZonesFullyLoaded = ( state, siteId = getSelectedSiteId( state ) ) => { return ( areShippingMethodsLoaded( state, siteId ) && areShippingZonesLoaded( state, siteId ) && areLocationsLoaded( state, siteId ) && areShippingClassesLoaded( state, siteId ) ); }; export default connect( ( state, ownProps ) => ( { loaded: areShippingZonesFullyLoaded( state, ownProps.siteId ), } ), dispatch => ( { actions: bindActionCreators( { fetchShippingZones, fetchShippingMethods, fetchShippingClasses, }, dispatch ), } ) )( QueryShippingZones );
src/containers/ATeam.js
kennethaa/vanvikil-live
import React, { Component } from 'react'; class ATeam extends Component { render() { return ( <div> {'A-lag'} </div> ); } } export default ATeam;
client/src/home/sidebar/MenuToggle.js
ziel5122/autograde
import KeyboardArrowLeft from 'material-ui/svg-icons/hardware/keyboard-arrow-left'; import KeyboardArrowRight from 'material-ui/svg-icons/hardware/keyboard-arrow-right'; import React from 'react'; const arrowStyle = { color: 'white', }; const style = { background: 'orangered', paddingTop: '2px', }; const MenuToggle = ({ open, toggleOpen }) => ( <div onClick={toggleOpen} style={style}>{ open ? <KeyboardArrowLeft style={arrowStyle} /> : <KeyboardArrowRight style={arrowStyle} /> }</div> ); export default MenuToggle;
frontend/app/components/WordsCreateEdit/list-view.js
First-Peoples-Cultural-Council/fv-web-ui
/* Copyright 2016 First People's Cultural Council Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import React from 'react' import PropTypes from 'prop-types' import Immutable, { Map } from 'immutable' // REDUX import { connect } from 'react-redux' // REDUX: actions/dispatch/func import { fetchWords } from 'reducers/fvWord' import { fetchDialect2 } from 'reducers/fvDialect' import { pushWindowPath } from 'reducers/windowPath' import { setRouteParams } from 'reducers/navigation' import selectn from 'selectn' import Edit from '@material-ui/icons/Edit' import { WORKSPACES } from 'common/Constants' import AuthorizationFilter from 'components/AuthorizationFilter' import DataListView from 'components/LearnBase/data-list-view' import DocumentListView from 'components/DocumentListView' import FVButton from 'components/FVButton' import NavigationHelpers, { getSearchObject } from 'common/NavigationHelpers' import Preview from 'components/Preview' import PromiseWrapper from 'components/PromiseWrapper' import Link from 'components/Link' import ProviderHelpers from 'common/ProviderHelpers' import StringHelpers from 'common/StringHelpers' import UIHelpers from 'common/UIHelpers' import { dictionaryListSmallScreenColumnDataTemplate, dictionaryListSmallScreenColumnDataTemplateCustomInspectChildrenCellRender, dictionaryListSmallScreenColumnDataTemplateCustomAudio, dictionaryListSmallScreenTemplateWords, } from 'components/DictionaryList/DictionaryListSmallScreen' /** * List view for words */ class WordsListView extends DataListView { constructor(props, context) { super(props, context) // NOTE: searchObj used below in setting state const searchObj = getSearchObject() this.state = { columns: [ { name: 'title', title: props.intl.trans('word', 'Word', 'first'), columnDataTemplate: dictionaryListSmallScreenColumnDataTemplate.cellRender, render: (v, data) => { const isWorkspaces = this.props.routeParams.area === WORKSPACES const href = NavigationHelpers.generateUIDPath(this.props.routeParams.siteTheme, data, 'words', this.props.routeParams.area) const hrefEdit = NavigationHelpers.generateUIDEditPath(this.props.routeParams.siteTheme, data, 'words') const hrefEditRedirect = `${hrefEdit}?redirect=${encodeURIComponent( `${window.location.pathname}${window.location.search}` )}` const computeDialect2 = this.props.dialect || this.getDialect() const editButton = isWorkspaces && hrefEdit ? ( <AuthorizationFilter filter={{ entity: selectn('response', computeDialect2), login: this.props.computeLogin, role: ['Record', 'Approve', 'Everything'], }} hideFromSections routeParams={this.props.routeParams} > <FVButton type="button" variant="text" size="small" component="a" className="DictionaryList__linkEdit PrintHide" href={hrefEditRedirect} onClick={(e) => { e.preventDefault() NavigationHelpers.navigate(hrefEditRedirect, this.props.pushWindowPath, false) }} > <Edit title={props.intl.trans('edit', 'Edit', 'first')} /> {/* <span>{props.intl.trans('edit', 'Edit', 'first')}</span> */} </FVButton> </AuthorizationFilter> ) : null return ( <> <Link className="DictionaryList__link DictionaryList__link--indigenous" href={href}> {v} </Link> {editButton} </> ) }, sortName: 'fv:custom_order', sortBy: 'fv:custom_order', }, { name: 'fv:definitions', title: props.intl.trans('definitions', 'Definitions', 'first'), columnDataTemplate: dictionaryListSmallScreenColumnDataTemplate.custom, columnDataTemplateCustom: dictionaryListSmallScreenColumnDataTemplateCustomInspectChildrenCellRender, render: (v, data, cellProps) => { return UIHelpers.generateOrderedListFromDataset({ dataSet: selectn(`properties.${cellProps.name}`, data), extractDatum: (entry, i) => { if (entry.language === this.props.DEFAULT_LANGUAGE && i < 2) { return entry.translation } return null }, classNameList: 'DictionaryList__definitionList', classNameListItem: 'DictionaryList__definitionListItem', }) }, sortName: 'fv:definitions/0/translation', }, { name: 'related_audio', title: props.intl.trans('audio', 'Audio', 'first'), columnDataTemplate: dictionaryListSmallScreenColumnDataTemplate.custom, columnDataTemplateCustom: dictionaryListSmallScreenColumnDataTemplateCustomAudio, render: (v, data, cellProps) => { const firstAudio = selectn('contextParameters.word.' + cellProps.name + '[0]', data) if (firstAudio) { return ( <Preview key={selectn('uid', firstAudio)} minimal tagProps={{ preload: 'none' }} styles={{ padding: 0 }} tagStyles={{ width: '100%', minWidth: '230px' }} expandedValue={firstAudio} type="FVAudio" /> ) } }, }, { name: 'related_pictures', width: 72, textAlign: 'center', title: props.intl.trans('picture', 'Picture', 'first'), columnDataTemplate: dictionaryListSmallScreenColumnDataTemplate.cellRender, render: (v, data, cellProps) => { const firstPicture = selectn('contextParameters.word.' + cellProps.name + '[0]', data) if (firstPicture) { return ( <img className="PrintHide itemThumbnail" key={selectn('uid', firstPicture)} src={UIHelpers.getThumbnail(firstPicture, 'Thumbnail')} alt="" /> ) } }, }, { name: 'fv-word:part_of_speech', title: props.intl.trans('part_of_speech', 'Part of Speech', 'first'), columnDataTemplate: dictionaryListSmallScreenColumnDataTemplate.cellRender, render: (v, data) => selectn('contextParameters.word.part_of_speech', data), sortBy: 'fv-word:part_of_speech', }, { name: 'dc:modified', width: 210, title: props.intl.trans('date_modified', 'Date Modified'), render: (v, data) => { return StringHelpers.formatLocalDateString(selectn('lastModified', data)) }, }, { name: 'dc:created', width: 210, title: props.intl.trans('date_created', 'Date Added to FirstVoices'), render: (v, data) => { return StringHelpers.formatLocalDateString(selectn('properties.dc:created', data)) }, }, { name: 'fv-word:categories', title: props.intl.trans('categories', 'Categories', 'first'), render: (v, data) => { return UIHelpers.generateDelimitedDatumFromDataset({ dataSet: selectn('contextParameters.word.categories', data), extractDatum: (entry) => selectn('dc:title', entry), }) }, }, ], sortInfo: { uiSortOrder: [], currentSortCols: this.props.customSortBy || searchObj.sortBy || this.props.DEFAULT_SORT_COL, currentSortType: this.props.customSortOrder || searchObj.sortOrder || this.props.DEFAULT_SORT_TYPE, }, pageInfo: { page: this.props.DEFAULT_PAGE, pageSize: this.props.DEFAULT_PAGE_SIZE, }, } // Only show enabled cols if specified if (this.props.ENABLED_COLS.length > 0) { this.state.columns = this.state.columns.filter((v) => this.props.ENABLED_COLS.indexOf(v.name) !== -1) } // Bind methods to 'this' ;[ '_onNavigateRequest', // no references in file '_handleRefetch', // Note: comes from DataListView '_handleSortChange', // Note: comes from DataListView '_handleColumnOrderChange', // Note: comes from DataListView '_resetColumns', // Note: comes from DataListView ].forEach((method) => (this[method] = this[method].bind(this))) } _getPathOrParentID = (newProps) => { return newProps.parentID ? newProps.parentID : `${newProps.routeParams.dialect_path}/Dictionary` } // NOTE: DataListView calls `fetchData` fetchData(newProps) { if (newProps.dialect === null && !this.getDialect(newProps)) { newProps.fetchDialect2(newProps.routeParams.dialect_path) } const searchObj = getSearchObject() this._fetchListViewData( newProps, newProps.DEFAULT_PAGE, newProps.DEFAULT_PAGE_SIZE, // sortOrder - 1st: custom values, 2nd: redux values, 3rd: url search query, 4th: defaults this.props.customSortOrder || this.props.navigationRouteSearch.sortOrder || searchObj.sortOrder || newProps.DEFAULT_SORT_TYPE, // sortBy - 1st: custom values, 2nd: redux values, 3rd: url search query, 4th: defaults this.props.customSortBy || this.props.navigationRouteSearch.sortBy || searchObj.sortBy || newProps.DEFAULT_SORT_COL ) } _onEntryNavigateRequest = (item) => { if (this.props.action) { this.props.action(item) } else { NavigationHelpers.navigate( NavigationHelpers.generateUIDPath(this.props.routeParams.siteTheme, item, 'words', this.props.routeParams.area), this.props.pushWindowPath, true ) } } _fetchListViewData(props, pageIndex, pageSize, sortOrder, sortBy) { let currentAppliedFilter = '' if (props.filter.has('currentAppliedFilter')) { currentAppliedFilter = Object.values(props.filter.get('currentAppliedFilter').toJS()).join('') } let nql = `${currentAppliedFilter}&currentPageIndex=${ pageIndex - 1 }&pageSize=${pageSize}&sortOrder=${sortOrder}&sortBy=${sortBy}` const { routeParams } = this.props const letter = routeParams.letter if (letter) { nql = `${nql}&dialectId=${this.props.dialectID}&letter=${letter}&starts_with_query=Document.CustomOrderQuery` } else { // WORKAROUND: DY @ 17-04-2019 - Mark this query as a "starts with" query. See DirectoryOperations.js for note nql = `${nql}${ProviderHelpers.isStartsWithQuery(currentAppliedFilter)}` } // NOTE: the following attempts to prevent double requests but it doesn't work all the time! // Eventually `this.state.nql` becomes `undefined` and then a duplicate request is initiated // // DataListView calls this._fetchListViewData AND this.fetchData (which calls this.__fetchListViewData) if (this.state.nql !== nql) { this.setState( { nql, }, () => { props.fetchWords(this._getPathOrParentID(props), nql) } ) } } getDialect(props = this.props) { return ProviderHelpers.getEntry(props.computeDialect2, props.routeParams.dialect_path) } // TODO: Is this fn() being used? _fetchData2 = (fetcherParams /*, props = this.props*/) => { this.setState({ fetcherParams: fetcherParams, }) this._handleRefetch() } render() { const computeEntities = Immutable.fromJS([ { id: this._getPathOrParentID(this.props), entity: this.props.computeWords, }, ]) // If dialect not supplied, promise wrapper will need to wait for compute dialect if (!this.props.dialect) { computeEntities.push( new Map({ id: this.props.routeParams.dialect_path, entity: this.props.computeDialect2, }) ) } const computeWords = ProviderHelpers.getEntry(this.props.computeWords, this._getPathOrParentID(this.props)) const computeDialect2 = this.props.dialect || this.getDialect() return ( <PromiseWrapper renderOnError computeEntities={computeEntities}> {selectn('response.entries', computeWords) && ( <DocumentListView // className={'browseDataGrid'} columns={this.state.columns} data={computeWords} dialect={selectn('response', computeDialect2)} disablePageSize={this.props.disablePageSize} flashcard={this.props.flashcard} flashcardTitle={this.props.flashcardTitle} gridListView={this.props.gridListView} page={this.state.pageInfo.page} pageSize={this.state.pageInfo.pageSize} // NOTE: Pagination === refetcher refetcher={(dataGridProps, page, pageSize) => { const searchObj = getSearchObject() this._handleRefetch2({ page, pageSize, preserveSearch: true, // 1st: custom values, 2nd: redux values, 3rd: url search query, 4th: defaults sortOrder: this.props.customSortOrder || this.props.navigationRouteSearch.sortOrder || searchObj.sortOrder || this.props.DEFAULT_SORT_TYPE, sortBy: this.props.customSortBy || this.props.navigationRouteSearch.sortBy || searchObj.sortBy || this.props.DEFAULT_SORT_COL, }) }} sortHandler={({ page, pageSize, sortBy, sortOrder } = {}) => { this.props.setRouteParams({ search: { pageSize, page, sortBy, sortOrder, }, }) // _handleRefetch2 is called to update the url, eg: // A sort event happened on page 3, `_handleRefetch2` will reset to page 1 this._handleRefetch2({ page, pageSize, preserveSearch: true, sortBy, sortOrder, }) }} type={'FVWord'} dictionaryListClickHandlerViewMode={this.props.dictionaryListClickHandlerViewMode} dictionaryListViewMode={this.props.dictionaryListViewMode} dictionaryListSmallScreenTemplate={dictionaryListSmallScreenTemplateWords} // List View hasViewModeButtons={this.props.hasViewModeButtons} rowClickHandler={this.props.rowClickHandler} hasSorting={this.props.hasSorting} /> )} </PromiseWrapper> ) } } // PropTypes const { array, bool, func, number, object, string } = PropTypes WordsListView.propTypes = { action: func, controlViaURL: bool, customSortBy: string, customSortOrder: string, data: string, DEFAULT_PAGE_SIZE: number, DEFAULT_PAGE: number, DEFAULT_SORT_COL: string, DEFAULT_SORT_TYPE: string, dialect: object, disableClickItem: bool, DISABLED_SORT_COLS: array, disablePageSize: bool, ENABLED_COLS: array, filter: object, flashcard: bool, flashcardTitle: string, gridListView: bool, pageProperties: object, parentID: string, dialectID: string, routeParams: object.isRequired, // Search handleSearch: func, resetSearch: func, hasSearch: bool, hasViewModeButtons: bool, // REDUX: reducers/state computeDialect2: object.isRequired, computeLogin: object.isRequired, computeWords: object.isRequired, properties: object.isRequired, splitWindowPath: array.isRequired, windowPath: string.isRequired, // REDUX: actions/dispatch/func fetchDialect2: func.isRequired, fetchWords: func.isRequired, pushWindowPath: func.isRequired, } WordsListView.defaultProps = { controlViaURL: false, DEFAULT_LANGUAGE: 'english', DEFAULT_PAGE_SIZE: 10, DEFAULT_PAGE: 1, DEFAULT_SORT_COL: 'fv:custom_order', // NOTE: Used when paging DEFAULT_SORT_TYPE: 'asc', dialect: null, disableClickItem: true, DISABLED_SORT_COLS: ['state', 'fv-word:categories', 'related_audio', 'related_pictures', 'dc:modified'], disablePageSize: false, ENABLED_COLS: [ 'fv-word:categories', 'fv-word:part_of_speech', 'fv-word:pronunciation', 'fv:definitions', 'related_audio', 'related_pictures', 'title', ], filter: new Map(), flashcard: false, flashcardTitle: '', gridListView: false, } // REDUX: reducers/state const mapStateToProps = (state /*, ownProps*/) => { const { fvDialect, fvWord, navigation, nuxeo, windowPath, locale } = state const { properties, route } = navigation const { computeLogin } = nuxeo const { computeWords } = fvWord const { computeDialect2 } = fvDialect const { splitWindowPath, _windowPath } = windowPath const { intlService } = locale return { computeDialect2, computeLogin, computeWords, intl: intlService, navigationRouteSearch: route.search, properties, splitWindowPath, windowPath: _windowPath, } } // REDUX: actions/dispatch/func const mapDispatchToProps = { fetchDialect2, fetchWords, pushWindowPath, setRouteParams, } export default connect(mapStateToProps, mapDispatchToProps)(WordsListView)
src/svg-icons/content/text-format.js
barakmitz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ContentTextFormat = (props) => ( <SvgIcon {...props}> <path d="M5 17v2h14v-2H5zm4.5-4.2h5l.9 2.2h2.1L12.75 4h-1.5L6.5 15h2.1l.9-2.2zM12 5.98L13.87 11h-3.74L12 5.98z"/> </SvgIcon> ); ContentTextFormat = pure(ContentTextFormat); ContentTextFormat.displayName = 'ContentTextFormat'; ContentTextFormat.muiName = 'SvgIcon'; export default ContentTextFormat;
src/js/components/NavBar.js
knowncitizen/tripleo-ui
/** * Copyright 2017 Red Hat Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ import { connect } from 'react-redux'; import { defineMessages, FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; import React from 'react'; import { Link, withRouter } from 'react-router-dom'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { getEnabledLanguages } from '../selectors/i18n'; import { getValidationStatusCounts } from '../selectors/validations'; import { logoutUser } from '../actions/LoginActions'; import NavTab from './ui/NavTab'; import I18nDropdown from './i18n/I18nDropdown'; import StatusDropdown from './StatusDropdown'; import UserDropdown from './UserDropdown'; import { toggleValidations } from '../actions/ValidationsActions'; import ValidationsList from './validations/ValidationsList'; import ValidationsToggle from './validations/ValidationsToggle'; import TripleoOwlSvg from '../../img/tripleo-owl-navbar.svg'; const messages = defineMessages({ toggleNavigation: { id: 'NavBar.toggleNavigation', defaultMessage: 'Toggle navigation' }, plansTab: { id: 'NavBar.plansTab', defaultMessage: 'Plans' }, debug: { id: 'NavBar.debug', defaultMessage: 'Debug' }, nodesTab: { id: 'Navbar.nodesTab', defaultMessage: 'Nodes' } }); class NavBar extends React.Component { logout(e) { e.preventDefault(); this.props.logoutUser(); } _renderLanguageDropdown() { // Only include the I18nDropdown if there's more than one // language to choose from. return this.props.languages.size > 1 ? ( <li> <I18nDropdown /> </li> ) : null; } _renderHelpDropdown() { return ( <li> <StatusDropdown /> </li> ); } render() { const { executionsLoaded, showValidations, toggleValidations, validationStatusCounts, validationsLoaded } = this.props; return ( <header> <nav className="navbar navbar-default navbar-pf navbar-fixed-top" role="navigation" > <div className="navbar-header"> <button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#tripleo-navbar-collapse" aria-expanded="false" > <span className="sr-only"> <FormattedMessage {...messages.toggleNavigation} /> </span> <span className="icon-bar" /> <span className="icon-bar" /> <span className="icon-bar" /> </button> <Link className="navbar-brand" to="/" id="NavBar__indexLink"> <img src={TripleoOwlSvg} alt="TripleO" /> </Link> </div> <div className="navbar-collapse collapse" id="tripleo-navbar-collapse" > <ul className="nav navbar-nav navbar-utility"> {this._renderLanguageDropdown()} {this._renderHelpDropdown()} <ValidationsToggle executionsLoaded={executionsLoaded} showValidations={showValidations} toggleValidations={toggleValidations} validationStatusCounts={validationStatusCounts} validationsLoaded={validationsLoaded} /> <UserDropdown name={this.props.user.get('name')} logout={this.logout.bind(this)} /> </ul> <ul className="nav navbar-nav navbar-primary"> <NavTab to="/plans" id="NavBar__PlansTab"> <FormattedMessage {...messages.plansTab} /> </NavTab> <NavTab to="/nodes" id="NavBar__nodesTab"> <FormattedMessage {...messages.nodesTab} /> </NavTab> </ul> </div> <ValidationsList /> </nav> </header> ); } } NavBar.propTypes = { executionsLoaded: PropTypes.bool.isRequired, languages: ImmutablePropTypes.map.isRequired, logoutUser: PropTypes.func.isRequired, showValidations: PropTypes.bool.isRequired, toggleValidations: PropTypes.func.isRequired, user: ImmutablePropTypes.map, validationStatusCounts: ImmutablePropTypes.map.isRequired, validationsLoaded: PropTypes.bool.isRequired }; const mapStateToProps = state => ({ executionsLoaded: state.executions.get('executionsLoaded'), languages: getEnabledLanguages(state), showValidations: state.validations.showValidations, user: state.login.getIn(['token', 'user']), validationStatusCounts: getValidationStatusCounts(state), validationsLoaded: state.validations.get('validationsLoaded') }); const mapDispatchToProps = dispatch => ({ logoutUser: () => dispatch(logoutUser()), toggleValidations: () => dispatch(toggleValidations()) }); export default withRouter(connect(mapStateToProps, mapDispatchToProps)(NavBar));
app/clients/next/components/table/index.js
garbin/koapp
import React from 'react' import { Provider, Header, Body } from 'reactabular-table' import { merge } from 'lodash' import { components as defaultComponents } from './presets/bootstrap' export function column (property, label, definition) { const base = {property, header: { label }} return merge(base, definition) } export default class extends React.Component { render () { const { loading, error, rows, columns, components = defaultComponents, rowKey, ...others } = this.props return ( <Provider columns={columns} components={components} {...others}> <Header /> {(loading || error) ? <Body error={error} loading={loading} rows={[]} /> : <Body rows={rows} empty={rows.length === 0} rowKey={rowKey || 'id'} />} </Provider> ) } }
blueprints/view/files/__root__/views/__name__View/__name__View.js
blinkmobile/things-events-dashboard
import React from 'react' type Props = { }; export class <%= pascalEntityName %> extends React.Component { props: Props; render () { return ( <div></div> ) } } export default <%= pascalEntityName %>
react-router-demo/lessons/13-server-rendering/index.js
zhangjunhd/react-examples
import React from 'react' import { render } from 'react-dom' import { Router, Route, browserHistory, IndexRoute } from 'react-router' import App from './modules/App' import About from './modules/About' import Repos from './modules/Repos' import Repo from './modules/Repo' import Home from './modules/Home' render(( <Router history={browserHistory}> <Route path="/" component={App}> <IndexRoute component={Home}/> <Route path="/repos" component={Repos}> <Route path="/repos/:userName/:repoName" component={Repo}/> </Route> <Route path="/about" component={About}/> </Route> </Router> ), document.getElementById('app'))
lesson-4/src-solution/components/NewNoteModal.js
msd-code-academy/lessons
import React from 'react' import Modal from 'react-modal' import * as shortId from 'shortid' import '../styles/NewNoteModal.css' class NewNoteModal extends React.Component { constructor() { super() this.state = { modalIsOpen: false, note: {}, } } toggleModal = () => { this.setState({ modalIsOpen: !this.state.modalIsOpen, }) } handleChange = field => e => { let note = this.state.note note[field] = e.target.value this.setState({ note }) } handleFormSubmit = e => { e.preventDefault() const { onAddNote } = this.props const { note } = this.state onAddNote({ ...note, uuid: shortId.generate() }) this.toggleModal() } render() { const { modalIsOpen } = this.state return ( <div className="NewNoteModal"> <a onClick={this.toggleModal}>ADD NOTE</a> <Modal isOpen={modalIsOpen} onRequestClose={this.toggleModal} className="NewNoteModal-modal-window" overlayClassName="NewNoteModal-modal-overlay" > <h2>Add a new note</h2> <form onSubmit={this.handleFormSubmit}> <div> <label htmlFor="title">Title</label> <input type="text" id="title" onChange={this.handleChange('title')} /> </div> <div className="NewNoteModal-textarea"> <label htmlFor="text">Text</label> <textarea rows="4" id="text" onChange={this.handleChange('text')} /> </div> <button type="submit">Submit</button> </form> </Modal> </div> ) } } export default NewNoteModal
src/svg-icons/hardware/keyboard.js
w01fgang/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let HardwareKeyboard = (props) => ( <SvgIcon {...props}> <path d="M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-9 3h2v2h-2V8zm0 3h2v2h-2v-2zM8 8h2v2H8V8zm0 3h2v2H8v-2zm-1 2H5v-2h2v2zm0-3H5V8h2v2zm9 7H8v-2h8v2zm0-4h-2v-2h2v2zm0-3h-2V8h2v2zm3 3h-2v-2h2v2zm0-3h-2V8h2v2z"/> </SvgIcon> ); HardwareKeyboard = pure(HardwareKeyboard); HardwareKeyboard.displayName = 'HardwareKeyboard'; HardwareKeyboard.muiName = 'SvgIcon'; export default HardwareKeyboard;
src/components/MarkdownCard.js
busypeoples/reactcards.js
import React from 'react' import showdown from 'showdown' import Card from './Card' import style from './style.less' const markdownToHtml = str => { const conv = new showdown.Converter() return conv.makeHtml(str) } export const Markdown = props => <div className={[style.markdown,props.className].join(' ')} dangerouslySetInnerHTML={{__html:markdownToHtml(props.children)}}/> const MarkdownCard = (props) => <Card><Markdown>{props.children}</Markdown></Card> export default MarkdownCard
src/components/navigation/ImprimirPartidasButton.js
sysbet/sysbet-mobile
import React, { Component } from 'react'; import { View, ToastAndroid, Linking, } from 'react-native'; import { connect } from 'react-redux'; import Button from 'react-native-button'; import Icon from 'react-native-vector-icons/FontAwesome'; import Actions from '../../actions'; let { CarregarJogos, } = Actions; class ImprimirPartidasButton extends Component { onPress() { try { this.props.CarregarJogos(); } catch(e) { ToastAndroid.show("Erro ao atualizar jogos", 2000); } } onImprimirTabelaPress() { let { campeonato, data } = this.props.filtro; console.log(`filtro de ${campeonato} e ${data}`); let callback = encodeURIComponent(`http://demo.sysbet.in/ImpressaoTabelaHtml.aspx/GetTabela?idCampeonato=${campeonato}&dataJogo=${data}`); let url = `imprimirep://demo.sysbet.in/imprimir?idbilhete=${callback}`; Linking.canOpenURL(url).then(supported => { if (!supported) { ToastAndroid.show('Sem aplicativo instalado', 2000); } else { return Linking.openURL(url); } }).catch(err => console.error('An error occurred', err)); } render() { return( <View style={[this.props.style, { flex: 1, flexDirection: 'row', justifyContent: 'flex-end', marginTop: 4, height: 56, }]} > <Button onPress={this.onImprimirTabelaPress.bind(this)} > <Icon name="print" size={30} color="#000" style={{ marginRight: 8, height: 56 }} /></Button> </View> ); } } export default connect((state) => { return { filtro: state.filtro, } }, { CarregarJogos, })(ImprimirPartidasButton)
src/svg-icons/action/home.js
hwo411/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionHome = (props) => ( <SvgIcon {...props}> <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/> </SvgIcon> ); ActionHome = pure(ActionHome); ActionHome.displayName = 'ActionHome'; ActionHome.muiName = 'SvgIcon'; export default ActionHome;
contento/js/src/hooks/textareaJsonschema/index.js
inmagik/contento
import React from 'react' import { render } from 'react-dom' import Form from 'react-jsonschema-form' export default (element) => { const value = JSON.parse(element.value || '{}'); const schema = JSON.parse(element.getAttribute('data-textarea-jsonschema') || '{}') const container = document.createElement('div') element.parentNode.insertBefore(container, element) // element.style.visibility = 'hidden' const handleChange = ({ formData }) => { element.value = JSON.stringify(formData); } const TextareaForm = ( <Form schema={schema} formData={value} onChange={handleChange}> <div/> </Form> ) render(TextareaForm, container) }
src/components/slider/SliderPointer.js
socialtables/react-color
'use strict' /* @flow */ import React from 'react' import ReactCSS from 'reactcss' import shallowCompare from 'react-addons-shallow-compare' export class SliderPointer extends ReactCSS.Component { shouldComponentUpdate = shallowCompare.bind(this, this, arguments[0], arguments[1]) classes(): any { return { 'default': { picker: { width: '14px', height: '14px', borderRadius: '6px', transform: 'translate(-7px, -1px)', backgroundColor: 'rgb(248, 248, 248)', boxShadow: '0px 1px 4px 0 rgba(0, 0, 0, 0.37)', }, }, } } render(): any { return ( <div is="picker"></div> ) } } export default SliderPointer
src/components/icons/IconOther.js
changepane/changepane
import React from 'react'; import Icon from 'react-icon-base'; const IconOther = (props) => <Icon viewBox="0 0 15 15" {...props}> <g id="icon-other" stroke="currentColor" strokeWidth="1" fill="none" fillRule="evenodd" strokeLinecap="round" strokeLinejoin="round"> <rect id="dot-1" x="1.5" y="6.5" width="2" height="2" rx="1" /> <rect id="dot-2" x="6.5" y="6.5" width="2" height="2" rx="1" /> <rect id="dot-3" x="11.5" y="6.5" width="2" height="2" rx="1" /> </g> </Icon> ; export default IconOther;
src/components/comic/ComicElement.js
phelipemaia/marvelous-app
import React from 'react'; import { Text, View, StyleSheet, Image } from 'react-native'; import Card from '../common/Card' import CardSection from "../common/CardSection"; export default class ComicElement extends React.Component { render () { const { headerContentStyle, thumbnailStyle, titleText, titleContainer, priceContainer, priceText } = styles; return ( <Card> <CardSection> <View> <Image style={thumbnailStyle} source={{uri: this.props.comic.thumbnail.path.replace('http', 'https') + "." + this.props.comic.thumbnail.extension, cache: 'only-if-cached'}}> <View style={headerContentStyle}> <View style={titleContainer}> <Text style={titleText}>{this.props.comic.title}</Text> </View> <View style={priceContainer}> <Text style={priceText}>{'$' + this.props.comic.prices[0].price}</Text> </View> </View> </Image> </View> </CardSection> </Card> ); } } const styles = StyleSheet.create({ headerContentStyle: { flex: 1, backgroundColor: 'rgba(0,0,0,.6)' }, thumbnailStyle: { height: 100, width: 100 }, titleContainer: { flex: 3, alignItems: 'center', marginTop: 10 }, titleText: { fontSize: 10, color: '#fff', alignSelf: 'center', margin: 5 }, priceContainer: { flex: 3, alignItems: 'flex-end', justifyContent: 'flex-end' }, priceText: { fontSize: 14, color: '#fff', fontWeight: 'bold' } });
app.js
saintnikopol/react-static-boilerplate
/** * React Static Boilerplate * https://github.com/koistya/react-static-boilerplate * Copyright (c) Konstantin Tarkus (@koistya) | MIT license */ import 'babel/polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment'; import Location from './lib/Location'; import Layout from './components/Layout'; const routes = {}; // Auto-generated on build. See tools/lib/routes-loader.js const route = async (path, callback) => { const handler = routes[path] || routes['/404']; const component = await handler(); await callback(<Layout>{React.createElement(component)}</Layout>); }; if (canUseDOM) { const container = document.getElementById('app'); Location.listen(location => { route(location.pathname, async (component) => ReactDOM.render(component, container)); }); } export default { route, routes };
app/react/components/permission/PermissionList.js
NikaBuligini/whistleblower-server
// @flow import React from 'react'; import PermissionItem from '../../components/permission/PermissionItem'; type PermissionListProps = { permissions: Array<any>, onDelete: (any) => void, } function PermissionList({ permissions, onDelete }: PermissionListProps) { if (permissions.length === 0) { return <span className="no-data">No permissions</span>; } return ( <ul className="list mdl-list"> {permissions.map(permission => ( <PermissionItem key={permission.id} {...permission} onDelete={onDelete} /> ))} </ul> ); } export default PermissionList;
client/components/Main.js
PawlakArtur/project-reactjs-receipt-keeper
import React from 'react'; import { Link } from 'react-router'; const Main = React.createClass({ render() { return ( <main> <h1> <Link to="/">Receipt Keeper</Link> </h1> {React.cloneElement(this.props.children, this.props)} </main> ) } }); export default Main;
src/svg-icons/av/stop.js
ngbrown/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvStop = (props) => ( <SvgIcon {...props}> <path d="M6 6h12v12H6z"/> </SvgIcon> ); AvStop = pure(AvStop); AvStop.displayName = 'AvStop'; AvStop.muiName = 'SvgIcon'; export default AvStop;
src/components/Histogram.js
Baizley/dokkit
import React from 'react'; import * as d3 from 'd3'; import ReactFauxDom from 'react-faux-dom'; class Histogram extends React.Component { constructor() { super(); } drawChart() { let chart = new ReactFauxDom.Element('div'); let data = [{"x":"Monday","y":10},{"x":"Tuesday","y":3},{"x":"Wednesday","y":2},{"x":"Thursday","y":5},{"x":"Friday","y":6},{"x":"Saturday","y":5},{"x":"Sunday","y":6}]; let svg = d3.select(chart).append('svg').attr('width', 700).attr('height', 300); // let x = d3.scaleBand().domain(data.map(({x}) => x)).range([0, 699]); // svg.append('g').attr("transform", "translate(0," + 200 + ")").attr('class', 'x axis').call(d3.axisBottom(x)); var maxCount = d3.max(data, ({x,y}) => y); let y = d3.scaleLinear().range([0, 200]).domain([0, maxCount]); let x = d3.scaleBand().domain(data.map(({x}) => x)).range([0, 699]); svg.append('g').attr("transform", "translate(0," + 200 + ")").attr('class', 'x axis').call(d3.axisBottom(x)); let rects = svg.selectAll('rect').data(data); let newRects = rects.enter(); newRects.append('rect') .attr('x', (d,i) => x(d.x)) .attr('y', (d,i) => 200-y(d.y)) .attr('height', (d,i) => y(d.y)) .attr('width', x.bandwidth()); return chart.toReact(); } render() { return this.drawChart(); } } export default Histogram;
packages/ringcentral-widgets/components/ConferenceCommands/index.js
u9520107/ringcentral-js-widget
import React from 'react'; import PropTypes from 'prop-types'; import BackHeader from '../BackHeader'; import styles from './styles.scss'; import i18n from './i18n'; const Button = ({ text }) => <span key={text} className={styles.button}>{text}</span>; Button.propTypes = { text: PropTypes.string.isRequired, }; const Section = ({ buttons, title, body }) => ( <div key={buttons.join('')} className={styles.section}> {buttons.map(b => <Button text={b} key={b} />)} <p className={styles.title}>{title}</p> {body.split('\n').map(line => <p key={line} className={styles.body}>{line}</p>)} </div> ); Section.propTypes = { title: PropTypes.string.isRequired, buttons: PropTypes.array.isRequired, body: PropTypes.string.isRequired, }; const sections = currentLocale => ([ { buttons: ['*', '#', '2'], title: i18n.getString('starSharp2Title', currentLocale), body: i18n.getString('starSharp2Body', currentLocale), }, { buttons: ['*', '#', '3'], title: i18n.getString('starSharp3Title', currentLocale), body: i18n.getString('starSharp3Body', currentLocale), }, { buttons: ['*', '#', '4'], title: i18n.getString('starSharp4Title', currentLocale), body: i18n.getString('starSharp4Body', currentLocale), }, { buttons: ['*', '#', '5'], title: i18n.getString('starSharp5Title', currentLocale), body: i18n.getString('starSharp5Body', currentLocale), }, { buttons: ['*', '#', '6'], title: i18n.getString('starSharp6Title', currentLocale), body: i18n.getString('starSharp6Body', currentLocale), }, { buttons: ['*', '#', '7'], title: i18n.getString('starSharp7Title', currentLocale), body: i18n.getString('starSharp7Body', currentLocale), }, { buttons: ['*', '#', '8'], title: i18n.getString('starSharp8Title', currentLocale), body: i18n.getString('starSharp8Body', currentLocale), }, { buttons: ['*', '9'], title: i18n.getString('star9Title', currentLocale), body: i18n.getString('star9Body', currentLocale), } ]); const ConferenceCommands = ({ currentLocale, onBack }) => ( <div className={styles.root}> <BackHeader onBackClick={onBack}> {i18n.getString('title', currentLocale)} </BackHeader> <div className={styles.conferenceCommands}> { sections(currentLocale).map( s => <Section key={s.title} buttons={s.buttons} title={s.title} body={s.body} /> ) } </div> </div> ); ConferenceCommands.propTypes = { currentLocale: PropTypes.string.isRequired, onBack: PropTypes.func.isRequired }; export default ConferenceCommands;
src/svg-icons/action/donut-small.js
ngbrown/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;
src/components/Grid/GridFlexItem.js
lebra/lebra-components
import React from 'react'; import classnames from 'classnames'; import PropTypes from 'prop-types'; const propTypes = { disabled: PropTypes.bool, children: PropTypes.node, style:PropTypes.object, prefixCls: PropTypes.string, className: PropTypes.string, } const defaultProps = { prefixCls: 'lebra-flexbox', } export default class GridFlexItem extends React.Component{ render() { let { children, className, prefixCls, style, ...restProps } = this.props; const wrapCls = classnames(`${prefixCls}-item`, className); return ( <div className={wrapCls} style={style} {...restProps}>{children}</div> ) } } GridFlexItem.propTypes = propTypes; GridFlexItem.defaultProps = defaultProps;
src/svg-icons/image/panorama-wide-angle.js
barakmitz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImagePanoramaWideAngle = (props) => ( <SvgIcon {...props}> <path d="M12 6c2.45 0 4.71.2 7.29.64.47 1.78.71 3.58.71 5.36 0 1.78-.24 3.58-.71 5.36-2.58.44-4.84.64-7.29.64s-4.71-.2-7.29-.64C4.24 15.58 4 13.78 4 12c0-1.78.24-3.58.71-5.36C7.29 6.2 9.55 6 12 6m0-2c-2.73 0-5.22.24-7.95.72l-.93.16-.25.9C2.29 7.85 2 9.93 2 12s.29 4.15.87 6.22l.25.89.93.16c2.73.49 5.22.73 7.95.73s5.22-.24 7.95-.72l.93-.16.25-.89c.58-2.08.87-4.16.87-6.23s-.29-4.15-.87-6.22l-.25-.89-.93-.16C17.22 4.24 14.73 4 12 4z"/> </SvgIcon> ); ImagePanoramaWideAngle = pure(ImagePanoramaWideAngle); ImagePanoramaWideAngle.displayName = 'ImagePanoramaWideAngle'; ImagePanoramaWideAngle.muiName = 'SvgIcon'; export default ImagePanoramaWideAngle;
src/components/App/App.js
oboecat/yattt
import React, { Component } from 'react'; import Game from '../Game'; class App extends Component { render() { return ( <Game /> ); } } export default App;
examples/serialize-action/src/components/Checkbox/Container.js
jas-chen/redux
import React from 'react' import { connect } from 'react-redux' import { Change } from './actions' import Checkbox from './Component' const mapDispatchToProps = { onChange: checked => new Change(checked) } const CheckboxContainer = ({ stateKey }) => { const mapStateToProps = state => { return { checked: state[stateKey] } } const Container = connect( mapStateToProps, mapDispatchToProps )(Checkbox) return <Container /> } export default CheckboxContainer
webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableAction.js
theforeman/foreman_ansible
import React from 'react'; import PropTypes from 'prop-types'; import { useMutation } from '@apollo/client'; import classNames from 'classnames'; import { Button, Spinner } from '@patternfly/react-core'; import { TimesIcon, CheckIcon, PencilAltIcon } from '@patternfly/react-icons'; import './EditableAction.scss'; import { decodeModelId } from '../../../../globalIdHelper'; import updateAnsibleVariableOverrideMutation from '../../../../graphql/mutations/updateAnsibleVariableOverride.gql'; import createAnsibleVariableOverrideMutation from '../../../../graphql/mutations/createAnsibleVariableOverride.gql'; import { onCompleted, onError, hasError, createMatcher, } from './EditableActionHelper'; const EditableAction = ({ onValidationError, toggleWorking, onSubmitSuccess, open, onClose, onOpen, state, variable, hostId, hostName, }) => { const [callUpdateMutation] = useMutation( updateAnsibleVariableOverrideMutation, { onCompleted: onCompleted( 'updateAnsibleVariableOverride', onValidationError, toggleWorking, onSubmitSuccess ), onError: onError(toggleWorking), } ); const [callCreateMutation] = useMutation( createAnsibleVariableOverrideMutation, { onCompleted: onCompleted( 'createAnsibleVariableOverride', onValidationError, toggleWorking, onSubmitSuccess ), onError: onError(toggleWorking), } ); const onSubmit = event => { if (!variable.currentValue || variable.currentValue.element !== 'fqdn') { return createOverride(); } return updateOverride(); }; const updateOverride = () => { const match = createMatcher(variable.currentValue.elementName); const lookupValue = variable.lookupValues.nodes.find( item => item.match === match ); toggleWorking(true); callUpdateMutation({ variables: { id: lookupValue.id, value: state.value, hostId, ansibleVariableId: decodeModelId(variable), match, }, }); }; const createOverride = () => { const match = createMatcher(hostName); toggleWorking(true); callCreateMutation({ variables: { hostId, lookupKeyId: decodeModelId(variable), value: state.value, match, }, }); }; if (!variable.meta.canEdit) { return null; } return ( <React.Fragment> <div> <div className={classNames({ hideElement: !open, editableActionItem: true, })} > <Button variant="plain" onClick={onClose} isDisabled={state.working} aria-label="Cancel editing override button" > <TimesIcon /> </Button> <Button variant="plain" onClick={onSubmit} isDisabled={state.working || hasError(state)} aria-label="Submit editing override button" > <CheckIcon /> </Button> <span className={!state.working ? 'hideElement' : ''}> <Spinner size="md" /> </span> </div> <div className={classNames({ hideElement: open, editableActionItem: true, })} > <Button onClick={onOpen} variant="plain" aria-label="Edit override button" > <PencilAltIcon /> </Button> </div> </div> </React.Fragment> ); }; EditableAction.propTypes = { onValidationError: PropTypes.func.isRequired, toggleWorking: PropTypes.func.isRequired, onSubmitSuccess: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired, onOpen: PropTypes.func.isRequired, variable: PropTypes.object.isRequired, state: PropTypes.object.isRequired, open: PropTypes.bool.isRequired, hostId: PropTypes.number.isRequired, hostName: PropTypes.string.isRequired, }; export default EditableAction;
src/app/core/atoms/icon/icons/sun.js
blowsys/reservo
import React from 'react'; const Sun = (props) => <svg {...props} viewBox="0 0 48 48"><g><path d="M14.255,27.812979C14.853,27.912979 15.352,27.912979 15.95,27.912979 16.548,27.912979 17.047,27.912979 17.645,27.812979L17.645,30.205976C17.645,31.102976 16.947,31.899975 15.95,31.899975 15.053,31.899975 14.255,31.201977 14.255,30.205976z M23.227,25.42098L24.424,27.513979C24.822001,28.311978 24.623,29.307978 23.825,29.806976 23.028,30.205976 22.031,30.005978 21.533,29.208978L20.336,27.11498C21.433,26.71698,22.33,26.11798,23.227,25.42098z M8.473,25.220981C9.3710001,25.918981,10.268,26.51698,11.265,26.915979L9.9689999,29.008978C9.47,29.806976 8.473,30.005978 7.6760001,29.606977 6.878,29.108977 6.6790001,28.111979 7.0780001,27.31498z M27.014999,20.435985L29.209,21.731983C30.006001,22.230983 30.305,23.226982 29.806999,24.024981 29.308001,24.821981 28.311001,25.120981 27.514,24.622981L25.321,23.426982C26.019,22.429983,26.617001,21.432983,27.014999,20.435985z M4.8850002,20.236985C5.283,21.233984,5.7820001,22.230983,6.48,23.127982L4.2860003,24.323981C3.4889998,24.722981 2.4919996,24.522982 1.9940004,23.725982 1.5950003,22.927982 1.8940001,21.930984 2.691,21.532984z M27.712999,14.254989L30.305,14.254989C31.202,14.254989 32,14.952989 32,15.949988 32,16.846987 31.302,17.644987 30.305,17.644987L27.813,17.644987C27.913,17.145987 27.913,16.647987 27.913,16.149988 27.813,15.451988 27.813,14.853989 27.712999,14.254989z M1.6949997,14.254989L4.2860003,14.254989C4.1870003,14.853989 4.1870003,15.451988 4.1870003,16.049988 4.1870003,16.547987 4.1870003,17.046987 4.2860003,17.544987L1.6949997,17.544987C0.69799995,17.644987 0,16.846987 0,15.949988 0,15.052989 0.69799995,14.254989 1.6949997,14.254989z M28.410999,7.2769947C29.009001,7.2769947 29.607,7.5759945 29.906,8.0749941 30.305,8.8719931 30.106001,9.8689926 29.308001,10.367992L27.014999,11.663991C26.617001,10.666992,26.019,9.6699927,25.42,8.7729936L27.712999,7.4769945C27.913,7.3769946,28.112,7.2769947,28.410999,7.2769947z M3.5890002,7.1779947C3.888,7.1779947,4.0869999,7.2769947,4.3860002,7.3769946L6.6789999,8.6729932C5.9809999,9.5699928,5.3829999,10.466992,4.9840002,11.563991L2.691,10.267992C1.9940004,9.7689927 1.6949997,8.7729936 2.0930004,7.9749942 2.4919996,7.4769945 2.9900002,7.1779947 3.5890002,7.1779947z M15.95,5.9809957C21.533,5.9809957 26.019,10.466992 26.019,16.049988 26.019,21.631984 21.533,26.11798 15.95,26.11798 10.367,26.11798 5.881,21.631984 5.881,16.049988 5.881,10.466992 10.367,5.9809957 15.95,5.9809957z M23.327,1.9939985L23.427,1.9939985C23.726,1.9939985 23.925,2.0929985 24.224,2.1929979 25.022,2.6919975 25.221,3.6879969 24.822001,4.4859962L23.427,6.778995C22.529,6.0809956,21.632,5.482996,20.536,5.0839958L21.931,2.8909979C22.23,2.2929983,22.729,2.0929985,23.327,1.9939985z M8.8720002,1.8939981C9.47,1.8939981,10.068,2.1929979,10.367,2.6919975L11.663,4.9839964C10.666,5.3829961,9.6700001,5.9809957,8.7720003,6.5789952L7.4759998,4.2869968C6.9780002,3.4889975 7.2770002,2.4919977 8.0749998,2.0929985 8.3740001,1.8939981 8.5730001,1.8939981 8.8720002,1.8939981z M15.95,0C16.847,0,17.645,0.69799995,17.645,1.6949987L17.645,4.3859968C17.146,4.2869968 16.548,4.2869968 15.95,4.2869968 15.352,4.2869968 14.853,4.2869968 14.255,4.3859968L14.255,1.6949987C14.255,0.69799995,15.053,0,15.95,0z" transform="rotate(0,24,24) translate(0,0.0750188827514648) scale(1.5,1.5)"/></g></svg>; export default Sun;
src/components/ShopsDetailsTable/ShopsDetailsTable.js
marinbgd/coolbeer
import React from 'react'; import PropTypes from 'prop-types'; import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn, } from 'material-ui/Table'; const tableConfig = { fixedHeader: false, showRowHover: false, stripedRows: true, selectable: false, multiSelectable: false, enableSelectAll: false, showCheckboxes: false, }; const tableStyle = { tableLayout: 'auto', overflow: 'auto', }; const ShopsDetailsTable = (props) => { return ( <Table style={tableStyle} bodyStyle={tableStyle} height={tableConfig.height} fixedHeader={tableConfig.fixedHeader} fixedFooter={tableConfig.fixedFooter} selectable={tableConfig.selectable} multiSelectable={tableConfig.multiSelectable} > <TableHeader displaySelectAll={tableConfig.showCheckboxes} adjustForCheckbox={tableConfig.showCheckboxes} enableSelectAll={tableConfig.enableSelectAll} > <TableRow> <TableHeaderColumn tooltip="Shop Name">Shop Name</TableHeaderColumn> <TableHeaderColumn tooltip="Serial Number">S/N</TableHeaderColumn> <TableHeaderColumn tooltip="Average Temperature">Temp Avg</TableHeaderColumn> <TableHeaderColumn tooltip="Maximum Temperature">Temp Max</TableHeaderColumn> <TableHeaderColumn tooltip="Minimum Temperature">Temp Min</TableHeaderColumn> <TableHeaderColumn tooltip="Maximum CO2a">CO2a Max</TableHeaderColumn> <TableHeaderColumn tooltip="Minimum CO2a">CO2a Min</TableHeaderColumn> </TableRow> </TableHeader> <TableBody showRowHover={tableConfig.showRowHover} stripedRows={tableConfig.stripedRows} displayRowCheckbox={tableConfig.showCheckboxes} > {props.data.map( (row, index) => ( <TableRow key={index}> <TableRowColumn>{row.shopName}</TableRowColumn> <TableRowColumn>{row.sn}</TableRowColumn> <TableRowColumn>{row.tempAvg}</TableRowColumn> <TableRowColumn>{row.tempMax}</TableRowColumn> <TableRowColumn>{row.tempMin}</TableRowColumn> <TableRowColumn>{row.co2aMax}</TableRowColumn> <TableRowColumn>{row.co2aMin}</TableRowColumn> </TableRow> ))} </TableBody> </Table> ); }; ShopsDetailsTable.propTypes = { data: PropTypes.array, }; export default ShopsDetailsTable;
src/components/LoadingScreen.js
swashcap/LookieHere
import React, { Component } from 'react'; import { Animated, Easing, Image, StyleSheet, Text, View } from 'react-native'; import loadingAnimation from '../images/loading-animation.gif'; const styles = StyleSheet.create({ container: { alignItems: 'center', backgroundColor: 'white', flex: 1, flexDirection: 'column', justifyContent: 'center', }, emoji: { fontSize: 36, }, image: { height: 82, marginLeft: 10, marginRight: 15, width: 56, }, wrapper: { alignItems: 'center', flexDirection: 'row', marginBottom: 15, }, }); export default class LoadingScreen extends Component { constructor() { super(); this.state = { textColor: new Animated.Value(0), }; this.animateTextColor = this.animateTextColor.bind(this); } componentWillMount() { this.animateTextColor(); } animateTextColor() { Animated.sequence([ Animated.timing(this.state.textColor, { duration: 1000, easing: Easing.linear, toValue: 1, }), Animated.timing(this.state.textColor, { duration: 100, easing: Easing.linear, toValue: 0, }), ]).start((event) => { if (event.finished) { this.animateTextColor(); } }); } render() { const color = this.state.textColor.interpolate({ inputRange: [0, 0.2, 0.4, 0.6, 0.8, 1], outputRange: [ 'rgb(255, 0, 0)', 'rgb(255, 255, 0)', 'rgb(0, 255, 0)', 'rgb(0, 255, 255)', 'rgb(0, 0, 255)', 'rgb(255, 0, 255)', ], }); const textStyle = { color, fontFamily: 'Courier New', fontSize: 20, fontWeight: '700', }; return ( <View style={styles.container}> <View style={styles.wrapper}> <Text style={styles.emoji}>🍕</Text> <Image source={loadingAnimation} style={styles.image} /> <Text style={styles.emoji}>🌭</Text> </View> <Animated.Text style={textStyle}> Loading… </Animated.Text> </View> ); } }
maodou/events/client/components/admin/eventsList.js
ShannChiang/meteor-react-redux-base
import React, { Component } from 'react'; import {Link} from 'react-router'; import Loading from 'client/components/common/loading'; import moment from 'moment'; import { shortText } from 'lib/helpers'; export default class EventsList extends Component { render() { const { data, status } = this.props.events; return( <div className="admin-package-wrapper row"> <div className="col-sm-12"> <h1>管理活动</h1> { status === 'ready' ? data.length > 0 ? this.renderEvents(data) : <div>抱歉,目前还没有活动!</div> : <Loading /> } </div> </div> ); } renderEvents(events) { return ( <div className="table-responsive"> <table className="table table-striped"> <thead> <tr style={{fontSize: '16px'}}> <th>活动标题</th> <th>活动日期</th> <th>活动地点</th> <th>人数限制</th> <th>发布日期</th> <th>操作</th> </tr> </thead> <tbody> {events.map((event, index) => <tr key={event._id} style={{fontSize: '16px'}}> <td style={{lineHeight: '50px'}}><Link to={`/event/${event._id}`}>{shortText(event.title)}</Link></td> <td style={{lineHeight: '50px'}}>{moment(event.time).format('YYYY-MM-DD')}</td> <td style={{lineHeight: '50px'}}>{shortText(event.location)}</td> <td style={{lineHeight: '50px'}}>{shortText(event.limit)}</td> <td style={{lineHeight: '50px'}}>{moment(event.createdAt).format('YYYY-MM-DD')}</td> <td style={{lineHeight: '50px'}}> <Link to={`/admin/event/edit/${event._id}`} className="btn btn-success" style={{marginRight: '10px'}}>编辑</Link> <button className="btn btn-danger" onClick={(e) => this.props.dispatch((this.props.deleteEvent(e, event._id)))}>删除</button> </td> </tr> )} </tbody> </table> </div> ); } }
src/components/ContainerProgress.react.js
xloup/kitematic
import React from 'react'; /* Usage: <ContainerProgress pBar1={20} pBar2={70} pBar3={100} pBar4={20} /> */ var ContainerProgress = React.createClass({ render: function () { var pBar1Style = { height: this.props.pBar1 + '%' }; var pBar2Style = { height: this.props.pBar2 + '%' }; var pBar3Style = { height: this.props.pBar3 + '%' }; var pBar4Style = { height: this.props.pBar4 + '%' }; return ( <div className="container-progress"> <div className="bar-1 bar-bg"> <div className="bar-fg" style={pBar4Style}></div> </div> <div className="bar-2 bar-bg"> <div className="bar-fg" style={pBar3Style}></div> </div> <div className="bar-3 bar-bg"> <div className="bar-fg" style={pBar2Style}></div> </div> <div className="bar-4 bar-bg"> <div className="bar-fg" style={pBar1Style}></div> </div> </div> ); } }); module.exports = ContainerProgress;
src/components/views/login/CustomServerDialog.js
aperezdc/matrix-react-sdk
/* Copyright 2015, 2016 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import React from 'react'; import { _t } from '../../../languageHandler'; module.exports = React.createClass({ displayName: 'CustomServerDialog', render: function() { return ( <div className="mx_ErrorDialog"> <div className="mx_Dialog_title"> { _t("Custom Server Options") } </div> <div className="mx_Dialog_content"> <span> { _t("You can use the custom server options to sign into other Matrix " + "servers by specifying a different Home server URL.") } <br /> { _t("This allows you to use this app with an existing Matrix account on " + "a different home server.") } <br /> <br /> { _t("You can also set a custom identity server but this will typically prevent " + "interaction with users based on email address.") } </span> </div> <div className="mx_Dialog_buttons"> <button onClick={this.props.onFinished} autoFocus={true}> { _t("Dismiss") } </button> </div> </div> ); }, });
client/node_modules/uu5g03/doc/main/client/src/common/glyphicons.js
UnicornCollege/ucl.itkpd.configurator
import React from 'react'; import UU5 from 'uu5'; import Breadcrumbs from '../bricks/breadcrumbs.js'; import './glyphicons.css'; export default React.createClass({ //@@viewOn:mixins mixins: [ UU5.Common.BaseMixin, UU5.Common.ElementaryMixin, UU5.Common.VucMixin ], //@@viewOff:mixins //@@viewOn:statics statics: { tagName: 'UU5.Doc.Glyphicons', classNames: { main: 'uu5-doc-glyphicons', item: 'uu5-doc-glyphicons-item list-group-item font-size-150', label: 'uu5-doc-glyphicons-label', glyphicon: 'uu5-doc-glyphicons-glyphicon' } }, //@@viewOff:statics //@@viewOn:propTypes propTypes: { header: React.PropTypes.any, prefix: React.PropTypes.string, items: React.PropTypes.array, navigation: React.PropTypes.array }, //@@viewOff:propTypes //@@viewOn:getDefaultProp getDefaultProps() { return { header: null, prefix: null, items: [], navigation: null }; }, //@@viewOff:getDefaultProps //@@viewOn:standardComponentLifeCycle componentWillMount() { this.setTitle(this.props.header); }, componentWillReceiveProps(nextProps) { this.setTitle(nextProps.header); }, //@@viewOff:standardComponentLifeCycle //@@viewOn:interface //@@viewOff:interface //@@viewOn:overridingMethods //@@viewOff:overridingMethods //@@viewOn:render render: function () { return ( <UU5.Layout.Root> {this.props.navigation && <Breadcrumbs items={this.props.navigation.concat([{ text: this.props.header }])} />} <UU5.Layout.RowCollection header={<UU5.Bricks.Lsi lsi={this.props.header} />}> <UU5.Bricks.Ul className="list-group"> {this.props.items.sort().map(glyphicon => { return ( <UU5.Bricks.Li key={glyphicon} className={this.getClassName().item}> <div className={this.getClassName().glyphicon}> <UU5.Bricks.Glyphicon glyphicon={this.props.prefix + glyphicon} /> </div> <label className={this.getClassName().label}>{this.props.prefix + glyphicon}</label> </UU5.Bricks.Li> ); })} </UU5.Bricks.Ul> </UU5.Layout.RowCollection> </UU5.Layout.Root> ) } //@@viewOff:render });
src/routes/notFound/index.js
Grusteam/spark-in-me
import React from 'react'; import Layout from '../../components/Layout'; import Page from '../../components/Page'; import Link from '../../components/Link'; export default { path: '*', action() { const pageData = { title: 'Page Not Found', desc: 'Sorry, the page you were trying to view does not exist.', bg: '/images/home-bg.jpg', content: '<a href="/">Go to Home</a>', notFound: true }; return { component: <Layout data={pageData}><div>Not Found</div></Layout>, status: 404, }; }, };
src/main/js/layouts/containers/BaseLayout.js
Bernardo-MG/dreadball-toolkit-webpage
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { injectIntl } from 'react-intl'; import App from 'grommet/components/App'; import Box from 'grommet/components/Box'; import Button from 'grommet/components/Button'; import Split from 'grommet/components/Split'; import MainSidebar from 'views/containers/MainSidebar'; import titleMessages from 'i18n/title'; import appMessages from 'i18n/app'; import SocialGithubIcon from 'grommet/components/icons/base/SocialGithub'; import { setSmallScreenStatus } from 'views/actions'; import { selectNavbarVisible, selectSmallScreen } from 'views/selectors'; /** * Base layout for the application. This will frame all the views. * * It contains a navigation bar on the left side, and the view on the rest of the screen. */ class BaseLayout extends Component { /** * Toggle navigation bar on response to view size changes. * * It will signal the callback function, telling it the view is small if it goes * to a single column. * * @param columns indicates the number of columns */ _onResponsiveToggleNav(columns) { const small = columns === 'single'; this.props.onSetSmallScreen(small); } render() { // The navigation bar is rendered only if it is visible. let nav; if (this.props.navbarVisible) { const links = []; links.push({ path: '/dbx', label: this.props.intl.formatMessage(titleMessages.dbxTeamBuilder) }); links.push({ path: '/players', label: this.props.intl.formatMessage(titleMessages.dbxPlayers) }); links.push({ path: '/about', label: this.props.intl.formatMessage(titleMessages.about) }); const title = this.props.intl.formatMessage(appMessages.name); const footer = <Box> <Box>Dreadball © Mantic</Box> <Box direction='row' align='center'>{APP_VERSION} <Button href={REPO_URL} icon={<SocialGithubIcon/>} /></Box> </Box>; nav = <MainSidebar title={title} links={links} footer={footer} />; } // Which side has priority // On a small screen, if the navigation bar is visible it takes priority (left side) // By default the view takes priority (right side) const priority = (this.props.navbarVisible && this.props.smallScreen ? 'left' : 'right'); return ( <App centered={false}> <Split priority={priority} flex='right' separator={true} onResponsive={::this._onResponsiveToggleNav}> {nav} {this.props.children} </Split> </App> ); } } BaseLayout.propTypes = { /** Flag marking if the navigation bar is visible */ navbarVisible: PropTypes.bool.isRequired, /** Flag marking if the UI is on a small screen */ smallScreen: PropTypes.bool.isRequired, /** Callback function for changing to a small screen */ onSetSmallScreen: PropTypes.func.isRequired, /** Children elements, the view contents */ children: PropTypes.oneOfType([ PropTypes.array, PropTypes.object ]), /** I18n object */ intl: PropTypes.object.isRequired }; const mapStateToProps = (state) => { return { navbarVisible: selectNavbarVisible(state), smallScreen: selectSmallScreen(state) }; }; const mapDispatchToProps = (dispatch) => { return { onSetSmallScreen: bindActionCreators(setSmallScreenStatus, dispatch) }; }; export default injectIntl(connect( mapStateToProps, mapDispatchToProps )(BaseLayout));
app/components/ProductList.js
cqlanus/bons
import React from 'react' import ProductPanel from './ProductPanel' import { connect } from 'react-redux' import { filterProducts } from '../reducers/products' const mapStateToProps = (state) => ({ products: state.products.products, filteredProducts: state.products.filteredProducts }) // const mapDispatchToProps = { // filterProducts: filterProducts // } const mapDispatchToProps = dispatch => ({ filterProducts(selectedCat) { dispatch(filterProducts(selectedCat)) } }) function handleChange(evt){ const selectedCat = evt.target.value; console.log("IN HANDLECHANGE", selectedCat) filterProducts(selectedCat) } const allProducts = (props) => { function handleChange(evt){ const selectedCat = evt.target.value; console.log("IN HANDLECHANGE", selectedCat) props.filterProducts(selectedCat) } return( <div> <div className="mainTitle"> <h1 className="big fancy">M</h1><h1>a</h1><h1>s</h1><h1>t</h1><h1>e</h1><h1>r</h1><h1>p</h1><h1>i</h1><h1>e</h1><h1>c</h1><h1>e</h1><h1>s</h1><h1 className="no"> at </h1><h1>Bons</h1> <span className="catSelect pull-right">Choose a product type</span> <select className="pull-right" onChange={handleChange}> <option value="1">Drawing</option> <option value="2">Painting</option> <option value="3">Digital</option> <option value="4">Jewelry</option> <option value="5">Home Decor</option> <option value="6">Photograph</option> <option value="7">Mixed Media</option> </select> <hr></hr> </div> <div className="art container"> { // console.log("PROPS TO PRODUCTSLIST", props.products) props.products.map(function(product) { return ( <div className="col-xs-4 indivArt" key={product.id}> <ProductPanel product={product}/> </div> ) }) /*: 'Sorry, No Products!'*/ } </div> </div> )} export default connect(mapStateToProps, mapDispatchToProps)(allProducts)
src/containers/DevTools.js
rainbowland302/hangman
import React from 'react' // Exported from redux-devtools import { createDevTools } from 'redux-devtools' // Monitors are separate packages, and you can make a custom one import LogMonitor from 'redux-devtools-log-monitor' import DockMonitor from 'redux-devtools-dock-monitor' // createDevTools takes a monitor and produces a DevTools component const DevTools = createDevTools( // Monitors are individually adjustable with props. // Consult their repositories to learn about those props. // Here, we put LogMonitor inside a DockMonitor. // Note: DockMonitor is visible by default. <DockMonitor toggleVisibilityKey='ctrl-h' changePositionKey='ctrl-q' defaultIsVisible={true}> <LogMonitor theme='tomorrow' /> </DockMonitor> ) export default DevTools
public/systemjs/app/pages/example.js
inquisive/keystonejs-site
import React from 'react'; import jade from '../html/templates' import {languages as nav, routes} from '../config'; class Example extends React.Component { constructor(props) { super(props) this.displayName = 'Fetch Examples ' this.state = { html: props.response } this.props = props } render() { let sendme = { "language": "en", "section": "docs", "docssection": { "value": "learn", 'override':"fetch", "path": "/fetch", "label": "Fetch Examples" }, "title": "Fetch Examples", docsnav: nav.en.docsnav, } const menu = jade['en/templates/left-menu'](sendme) return (<div> <div className="page-header page-header"> <div className="container"> <h1>Ref:Fetch</h1> <p className="lead">.<code>fetch</code> to retrieve content</p> </div> </div> <div className="container"> <div className="row"> <div className="col-sm-3"> <div dangerouslySetInnerHTML={{ __html: menu }} /> </div> <div className="col-sm-9"> <div className="docs-content"> <p className="caution-note"> When <code>window.fetch</code> is not available, the <code>whatwg-fetch</code> polyfill will be used. If you experience issues, make sure you are not defining <b>fetch</b> as a local or global variable. </p> {this.props.children} </div> </div> </div> </div> </div>) } } export default Example
src/svg-icons/alert/warning.js
IsenrichO/mui-with-arrows
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AlertWarning = (props) => ( <SvgIcon {...props}> <path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/> </SvgIcon> ); AlertWarning = pure(AlertWarning); AlertWarning.displayName = 'AlertWarning'; AlertWarning.muiName = 'SvgIcon'; export default AlertWarning;
node_modules/react-native-mock/src/components/Image.js
niukui/gitpro
/** * https://github.com/facebook/react-native/blob/master/Libraries/Image/Image.ios.js */ import React from 'react'; import styleSheetPropType from '../propTypes/StyleSheetPropType'; import NativeMethodsMixin from '../mixins/NativeMethodsMixin'; import EdgeInsetsPropType from '../propTypes/EdgeInsetsPropType'; import ImageStylePropTypes from '../propTypes/ImageStylePropTypes'; import ImageResizeMode from '../propTypes/ImageResizeMode'; const { PropTypes } = React; const Image = React.createClass({ propTypes: { style: styleSheetPropType(ImageStylePropTypes), /** * `uri` is a string representing the resource identifier for the image, which * could be an http address, a local file path, or the name of a static image * resource (which should be wrapped in the `require('./path/to/image.png')` function). */ source: PropTypes.oneOfType([ PropTypes.shape({ uri: PropTypes.string, }), // Opaque type returned by require('./image.jpg') PropTypes.number, ]), /** * A static image to display while loading the image source. * @platform ios */ defaultSource: PropTypes.oneOfType([ PropTypes.shape({ uri: PropTypes.string, }), // Opaque type returned by require('./image.jpg') PropTypes.number, ]), /** * When true, indicates the image is an accessibility element. * @platform ios */ accessible: PropTypes.bool, /** * The text that's read by the screen reader when the user interacts with * the image. * @platform ios */ accessibilityLabel: PropTypes.string, /** * When the image is resized, the corners of the size specified * by capInsets will stay a fixed size, but the center content and borders * of the image will be stretched. This is useful for creating resizable * rounded buttons, shadows, and other resizable assets. More info on * [Apple documentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/index.html#//apple_ref/occ/instm/UIImage/resizableImageWithCapInsets) * @platform ios */ capInsets: EdgeInsetsPropType, /** * Determines how to resize the image when the frame doesn't match the raw * image dimensions. * * 'cover': Scale the image uniformly (maintain the image's aspect ratio) * so that both dimensions (width and height) of the image will be equal * to or larger than the corresponding dimension of the view (minus padding). * * 'contain': Scale the image uniformly (maintain the image's aspect ratio) * so that both dimensions (width and height) of the image will be equal to * or less than the corresponding dimension of the view (minus padding). * * 'stretch': Scale width and height independently, This may change the * aspect ratio of the src. * * `repeat`: Repeat the image to cover the frame of the view. The * image will keep it's size and aspect ratio. (iOS only) * */ resizeMode: PropTypes.oneOf(ImageResizeMode), /** * A unique identifier for this element to be used in UI Automation * testing scripts. */ testID: PropTypes.string, /** * Invoked on mount and layout changes with * `{nativeEvent: {layout: {x, y, width, height}}}`. */ onLayout: PropTypes.func, /** * Invoked on load start */ onLoadStart: PropTypes.func, /** * Invoked on download progress with `{nativeEvent: {loaded, total}}` * @platform ios */ onProgress: PropTypes.func, /** * Invoked on load error with `{nativeEvent: {error}}` * @platform ios */ onError: PropTypes.func, /** * Invoked when load completes successfully */ onLoad: PropTypes.func, /** * Invoked when load either succeeds or fails */ onLoadEnd: PropTypes.func, }, mixins: [NativeMethodsMixin], statics: { resizeMode: ImageResizeMode, getSize(uri, success, failure) { }, prefetch(uri) { } }, render() { return null; }, }); module.exports = Image;
lib-module-modern-browsers-dev/browser.js
turacojs/fody
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _jsxFileName = 'browser.jsx'; /* eslint react/no-render-return-value: "off" */ import React from 'react'; import ReactDOM from 'react-dom'; import { AppContainer } from 'react-hot-loader'; import RedBoxWrapper from './RedBoxWrapper'; import DefaultApp from './App'; export { unmountComponentAtNode } from 'react-dom'; import _Helmet from 'react-helmet'; export { _Helmet as Helmet }; import _App from './App'; export { _App as App }; export default function render({ App = DefaultApp, appProps, View, props, element }) { let app = React.createElement( App, _extends({}, appProps, { __self: this, __source: { fileName: _jsxFileName, lineNumber: 13 } }), React.createElement(View, _extends({}, props, { __self: this, __source: { fileName: _jsxFileName, lineNumber: 13 } })) ); app = React.createElement( AppContainer, { errorReporter: RedBoxWrapper, __self: this, __source: { fileName: _jsxFileName, lineNumber: 16 } }, app ); return ReactDOM.render(app, element); } //# sourceMappingURL=browser.js.map
docs/src/components/ComponentDoc/ComponentSidebar/ComponentSidebar.js
Semantic-Org/Semantic-UI-React
import _ from 'lodash' import PropTypes from 'prop-types' import React from 'react' import { Accordion, Menu, Sticky } from 'semantic-ui-react' import { docTypes } from 'docs/src/utils' import ComponentSidebarSection from './ComponentSidebarSection' const sidebarStyle = { background: '#fff', boxShadow: '0 2px 2px rgba(0, 0, 0, 0.1)', paddingLeft: '1em', paddingBottom: '0.1em', paddingTop: '0.1em', } const ComponentSidebar = ({ activePath, examplesRef, onItemClick, sections }) => ( <Sticky context={examplesRef} offset={14}> <Menu as={Accordion} fluid style={sidebarStyle} text vertical> {_.map(sections, ({ examples, sectionName }) => ( <ComponentSidebarSection activePath={activePath} examples={examples} key={sectionName} sectionName={sectionName} onItemClick={onItemClick} /> ))} </Menu> </Sticky> ) ComponentSidebar.propTypes = { activePath: PropTypes.string, examplesRef: PropTypes.object, onItemClick: PropTypes.func.isRequired, sections: docTypes.sidebarSections.isRequired, } const areEqual = (prevProps, nextProps) => prevProps.activePath === nextProps.activePath export default React.memo(ComponentSidebar, areEqual)
src/svg-icons/image/panorama-horizontal.js
owencm/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImagePanoramaHorizontal = (props) => ( <SvgIcon {...props}> <path d="M20 6.54v10.91c-2.6-.77-5.28-1.16-8-1.16-2.72 0-5.4.39-8 1.16V6.54c2.6.77 5.28 1.16 8 1.16 2.72.01 5.4-.38 8-1.16M21.43 4c-.1 0-.2.02-.31.06C18.18 5.16 15.09 5.7 12 5.7c-3.09 0-6.18-.55-9.12-1.64-.11-.04-.22-.06-.31-.06-.34 0-.57.23-.57.63v14.75c0 .39.23.62.57.62.1 0 .2-.02.31-.06 2.94-1.1 6.03-1.64 9.12-1.64 3.09 0 6.18.55 9.12 1.64.11.04.21.06.31.06.33 0 .57-.23.57-.63V4.63c0-.4-.24-.63-.57-.63z"/> </SvgIcon> ); ImagePanoramaHorizontal = pure(ImagePanoramaHorizontal); ImagePanoramaHorizontal.displayName = 'ImagePanoramaHorizontal'; ImagePanoramaHorizontal.muiName = 'SvgIcon'; export default ImagePanoramaHorizontal;
src/svg-icons/file/attachment.js
rhaedes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let FileAttachment = (props) => ( <SvgIcon {...props}> <path d="M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5C8.12 15 7 13.88 7 12.5S8.12 10 9.5 10H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z"/> </SvgIcon> ); FileAttachment = pure(FileAttachment); FileAttachment.displayName = 'FileAttachment'; export default FileAttachment;
app/components/Store/Order/OrderSummary/index.js
VineRelay/VineRelayStore
import React from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; const Wrapper = styled.div` `; const Title = styled.h2` `; const Divider = styled.div` width: 100%; height: 1px; background: #EEE; `; const CartItem = styled.div` display: flex; justify-content: flex-start; align-items: center; width: 100%; margin: 10px 0; `; const CartItemImageWrapper = styled.div` width: 50px; flex-shrink: 0; `; const CartItemImage = styled.img` width: 100%; height: auto; `; const CartItemDescription = styled.h5` text-align: left; margin: 0 20px; flex-basis: 100%; `; const CartItemPrice = styled.h5` flex-shrink: 0; `; const TotalRow = styled.div` display: flex; justify-content: space-between; background: #333; color: #FFF; padding: 10px; `; const TotalWord = styled.h4` margin: 0; `; const TotalPrice = styled.h4` margin: 0; `; const OrderSummary = ({ cart }) => ( <Wrapper> <Title>Order Summary</Title> <Divider /> {cart.items.map((item) => ( <CartItem key={item.product}> <CartItemImageWrapper> <CartItemImage src={item.image} /> </CartItemImageWrapper> <CartItemDescription> <b>{item.quantity} x </b>{item.name} </CartItemDescription> <CartItemPrice> ${item.price} USD </CartItemPrice> </CartItem> ))} <Divider /> <TotalRow> <TotalWord> Total </TotalWord> <TotalPrice> ${cart.totalPrice} USD </TotalPrice> </TotalRow> </Wrapper> ); OrderSummary.propTypes = { cart: PropTypes.shape({ totalPrice: PropTypes.number, items: PropTypes.arrayOf(PropTypes.shape({ product: PropTypes.string.isRequired, image: PropTypes.string, name: PropTypes.string.isRequired, price: PropTypes.number.isRequired, quantity: PropTypes.number.isRequired, })).isRequired, }).isRequired, }; export default OrderSummary;
www/src/pages/404.js
avidw/redd
import React from 'react' import Link from 'gatsby-link' import SimplePage from '../components/SimplePage' const NotFound = () => ( <SimplePage> <h1>Four Zero Four</h1> <p>Looks like you hit a non-existent or removed page. Sorry about that.</p> <p><Link to='/'>Go Back?</Link></p> </SimplePage> ) export default NotFound
docs/app/Views/PageNotFound.js
Rohanhacker/Semantic-UI-React
import React from 'react' import { Grid, Segment, Header, Icon } from 'src' const PageNotFound = () => ( <Grid padded textAlign='center' stretched> <Grid.Row columns='equal'> <Grid.Column> <Header as='h1' icon textAlign='center'> <Icon name='game' /> 404 <Header.Subheader> How about some good old Atari? </Header.Subheader> </Header> </Grid.Column> </Grid.Row> <Grid.Row columns='equal'> <Grid.Column> <Segment basic> <embed src='http://www.pizn.com/swf/classic-asteroids.swf' width='425' height='318' align='center' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' style={{ zoom: '1.13' }} /> </Segment> </Grid.Column> <Grid.Column> <Segment basic> <embed src='http://www.pizn.com/swf/1-space-invaders.swf' width='425' height='359' align='center' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' /> </Segment> </Grid.Column> </Grid.Row> </Grid> ) export default PageNotFound
web/static/js/components/heading_panel.js
TattdCodeMonkey/hmc5883l_demo
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Panel } from 'react-bootstrap'; import { getHeading } from '../reducers/compass'; class HeadingPanel extends Component { render() { const title = <h4>Heading</h4>; const { heading } = this.props; return ( <Panel header={title} bsStyle="info"> <h3>{this.renderHeading(heading)}</h3> </Panel> ); } renderHeading(heading) { if (heading) { return heading.toFixed(1); } return "---"; } } function mapStateToProps(state) { return { heading: getHeading(state) }; } export default connect( mapStateToProps, {} )(HeadingPanel);
ui/src/js/common/components/IconButton.js
Dica-Developer/weplantaforest
import React, { Component } from 'react'; require('./iconButton.less'); export default class IconButton extends Component { constructor() { super(); } render() { return ( <div className="iconButton"> <a role="button" onClick={this.props.onClick.bind(this)}> <span className={'glyphicon ' + this.props.glyphIcon} aria-hidden="true" title={this.props.title}></span> <span>{this.props.text}</span> </a> </div> ); } } /* vim: set softtabstop=2:shiftwidth=2:expandtab */
pages/_app.js
sikhote/clairic
import css from 'styled-jsx/css'; import React from 'react'; import NextApp, { Container } from 'next/app'; import Page from '../components/Page'; const styles = css.global` @import url('/static/css/fontello.css'); * { margin: 0; padding: 0; box-sizing: border-box; } .icon-play::before, .icon-fast-forward::before { margin-right: 0; } `; class App extends NextApp { static async getInitialProps({ Component, ctx }) { let pageProps = {}; if (Component.getInitialProps) { pageProps = await Component.getInitialProps(ctx); } return { pageProps }; } render() { const { Component, pageProps } = this.props; return ( <Container> <style jsx>{styles}</style> <Page> <Component {...pageProps} /> </Page> </Container> ); } } export default App;
app/main.js
jeflores7/character-voting-app
import React from 'react'; import Router from 'react-router'; import ReactDOM from 'react-dom'; import createBrowserHistory from 'history/lib/createBrowserHistory'; import routes from './routes'; let history = createBrowserHistory(); ReactDOM.render(<Router history={history}>{routes}</Router>, document.getElementById('app'));
_seraphim/src/_arch/synth/StepSequence.js
goldbuick/src
import R from 'ramda'; import Tone from 'tone'; import React from 'react'; import Panel from 'elements/panel/Core'; import RenderObject from 'render/RenderObject'; import GridInput, { cellSize } from 'elements/panel/GridInput'; import choird from 'apps/synth/audio/choird.wav'; import wide_open from 'apps/synth/audio/wide_open.wav'; import noise_bass from 'apps/synth/audio/noise_bass.wav'; import washed_chord from 'apps/synth/audio/washed_chord.wav'; import panned_tidbit from 'apps/synth/audio/panned_tidbit.wav'; import clack from 'apps/synth/audio/drums/clack.wav'; import shing from 'apps/synth/audio/drums/shing.wav'; import wipe_snare from 'apps/synth/audio/drums/wipe_snare.wav'; import big_boy_kick from 'apps/synth/audio/drums/big_boy_kick.wav'; import tiny_crisp_clap from 'apps/synth/audio/drums/tiny_crisp_clap.wav'; class StepSequence extends React.Component { static defaultProps = { cols: 32, rows: 5, }; state = { cursor: 0, enabled: {}, }; componentDidMount() { // this.synth = R.range(0, 5).map(i => new Tone.Sampler(washed_chord).toMaster()); this.synth = new Tone.MultiPlayer({ urls : { 'G4': tiny_crisp_clap, 'F4': shing, 'E4': clack, 'D4': wipe_snare, 'C4': big_boy_kick, }, volume : -10, fadeOut : 0.1, }).toMaster(); // this.synth = new Tone.PolySynth(this.props.rows, Tone.Synth, { // oscillator: { // type: 'fatsawtooth', // count: 3, // spread: 30 // }, // envelope: { // attack: 0.1, // decay: 0.3, // sustain: 0.3, // release: 0.3, // attackCurve: 'exponential' // }, // }).toMaster(); const noteValues = ['G4', 'F4', 'E4', 'D4', 'C4']; // const noteValues = [4, 3, 2, 1, 0]; this.loop = new Tone.Sequence((time, col) => { this.setState({ cursor: col }); const { enabled } = this.state; const noteNames = Object.keys(enabled).filter(key => ( enabled[key] && enabled[key].x === col )).map(key => ( enabled[key].y )).map(y => noteValues[y]); noteNames.forEach(noteName => { // this.synth[noteName].triggerAttack((noteName * 2) - 4, time); this.synth.start(noteName, time); // this.synth.triggerAttackRelease(noteName, '8n', time, Math.random() * 0.5 + 0.5); }); }, R.range(0, this.props.cols), '16n'); this.loop.start(); } componentWillUnmount() { } render() { const { enabled, cursor } = this.state; const { values, cols, rows } = this.props; return ( <RenderObject name="StepSequence" onChildren3D={(children) => { return [ RenderObject.byType(children, Panel), RenderObject.byType(children, GridInput), ]; }} onAnimate3D={(object3D, animateState, delta) => { const stepSize = cellSize + 16; const panel = RenderObject.byType(object3D.children, Panel)[0]; panel.position.x = (stepSize * 0.5) + (cursor * stepSize) - (cols * stepSize * 0.5); // console.log(cursor); }} > <Panel name="StepSequenceCursor" width={cellSize} height={(rows + 2) * cellSize} /> <GridInput cols={cols} rows={rows} filled={enabled} elementId={values.id} onCellTap={this.handleCellTap} /> </RenderObject> ); } handleCellTap = (cellKey, elementId, x, y) => { const filled = !!this.state.enabled[cellKey]; const enabled = { ...this.state.enabled, [cellKey]: filled ? undefined : { x, y }, }; this.setState({ enabled }); } } export default RenderObject.Pure(StepSequence);
app/jsx/account_course_user_search/components/UsersList.js
djbender/canvas-lms
/* * Copyright (C) 2015 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ import {Table} from '@instructure/ui-elements' import {ScreenReaderContent} from '@instructure/ui-a11y' import React from 'react' import {arrayOf, string, object, func} from 'prop-types' import I18n from 'i18n!account_course_user_search' import UsersListRow from './UsersListRow' import UsersListHeader from './UsersListHeader' export default class UsersList extends React.Component { shouldComponentUpdate(nextProps) { let count = 0 for (const prop in this.props) { ++count if (this.props[prop] !== nextProps[prop]) { // a change to searchFilter on it's own should not cause the list // to re-render if (prop !== 'searchFilter') { return true } } } return count !== Object.keys(nextProps).length } render() { return ( <Table margin="small 0" caption={<ScreenReaderContent>{I18n.t('Users')}</ScreenReaderContent>} > <thead> <tr> <UsersListHeader id="username" label={I18n.t('Name')} tipDesc={I18n.t('Click to sort by name ascending')} tipAsc={I18n.t('Click to sort by name descending')} searchFilter={this.props.searchFilter} onUpdateFilters={this.props.onUpdateFilters} /> <UsersListHeader id="email" label={I18n.t('Email')} tipDesc={I18n.t('Click to sort by email ascending')} tipAsc={I18n.t('Click to sort by email descending')} searchFilter={this.props.searchFilter} onUpdateFilters={this.props.onUpdateFilters} /> <UsersListHeader id="sis_id" label={I18n.t('SIS ID')} tipDesc={I18n.t('Click to sort by SIS ID ascending')} tipAsc={I18n.t('Click to sort by SIS ID descending')} searchFilter={this.props.searchFilter} onUpdateFilters={this.props.onUpdateFilters} /> <UsersListHeader id="last_login" label={I18n.t('Last Login')} tipDesc={I18n.t('Click to sort by last login ascending')} tipAsc={I18n.t('Click to sort by last login descending')} searchFilter={this.props.searchFilter} onUpdateFilters={this.props.onUpdateFilters} /> <th width="1" scope="col"> <ScreenReaderContent>{I18n.t('User option links')}</ScreenReaderContent> </th> </tr> </thead> <tbody data-automation="users list"> {this.props.users.map(user => ( <UsersListRow handleSubmitEditUserForm={this.props.handleSubmitEditUserForm} key={user.id} accountId={this.props.accountId} user={user} permissions={this.props.permissions} /> ))} </tbody> </Table> ) } } UsersList.propTypes = { accountId: string.isRequired, users: arrayOf(object).isRequired, permissions: object.isRequired, handleSubmitEditUserForm: func.isRequired, searchFilter: object.isRequired, onUpdateFilters: func.isRequired }
app/components/KubeWatcherCreateForm/index.js
fission/fission-ui
/** * * KubeWatcherCreateForm * */ import React from 'react'; // import styled from 'styled-components'; import { FormattedMessage } from 'react-intl'; import commonMessages from 'messages'; class KubeWatcherCreateForm extends React.Component { // eslint-disable-line react/prefer-stateless-function constructor(props) { super(props); this.state = { namespace: 'default', objtype: 'pod', labelselector: '', }; this.onChange = this.onChange.bind(this); this.onWatcherCreate = this.onWatcherCreate.bind(this); } onChange(event) { const target = event.target; this.state[target.name] = target.value; } onWatcherCreate(event) { event.preventDefault(); const { onCreate } = this.props; onCreate(this.state); } render() { const { namespace, objtype, labelselector } = this.state; return ( <form className="form-inline"> <div className="form-group"> <label htmlFor="watcherCreateNamespace"><FormattedMessage {...commonMessages.namespace} /></label> <input type="text" className="form-control" id="watcherCreateNamespace" defaultValue={namespace} name="namespace" onChange={this.onChange} /> </div> <div className="form-group"> <label htmlFor="watcherCreateObjType"><FormattedMessage {...commonMessages.objtype} /></label> <input type="text" className="form-control" id="watcherCreateObjType" defaultValue={objtype} name="objtype" onChange={this.onChange} /> </div> <div className="form-group"> <label htmlFor="watcherCreateLabelSelector"><FormattedMessage {...commonMessages.labelselector} /></label> <input type="text" className="form-control" id="watcherCreateLabelSelector" defaultValue={labelselector} name="labelselector" onChange={this.onChange} /> </div> <button className="btn btn-default" onClick={this.onWatcherCreate} ><FormattedMessage {...commonMessages.add} /></button> </form> ); } } KubeWatcherCreateForm.propTypes = { onCreate: React.PropTypes.func, }; export default KubeWatcherCreateForm;
library/src/pivotal-ui-react/table/table-row.js
sjolicoeur/pivotal-ui
import PropTypes from 'prop-types'; import React from 'react'; export class TableRow extends React.Component { static propTypes = { index: PropTypes.number, rowDatum: PropTypes.object }; render() { let {children, index, rowDatum, ...others} = this.props; return (<tr {...others}> {children} </tr>); } }
docs/src/pages/demos/lists/InsetList.js
AndriusBil/material-ui
// @flow weak import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from 'material-ui/styles'; import List, { ListItem, ListItemIcon, ListItemText } from 'material-ui/List'; import StarIcon from 'material-ui-icons/Star'; const styles = theme => ({ root: { width: '100%', maxWidth: 360, background: theme.palette.background.paper, }, }); function InsetList(props) { const classes = props.classes; return ( <List className={classes.root}> <ListItem button> <ListItemIcon> <StarIcon /> </ListItemIcon> <ListItemText inset primary="Chelsea Otakan" /> </ListItem> <ListItem button> <ListItemText inset primary="Eric Hoffman" /> </ListItem> </List> ); } InsetList.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styles)(InsetList);
examples/js/manipulation/demo.js
prajapati-parth/react-bootstrap-table
/* eslint max-len: 0 */ import React from 'react'; import InsertRowTable from './insert-row-table'; import DeleteRowTable from './delete-row-table'; import StrictSearchTable from './strict-search-table'; import SearchTable from './search-table'; import ColumnFilterTable from './filter-table'; import MultiSearchTable from './multi-search-table'; import StrictMultiSearchTable from './strict-multi-search-table'; import ExportCSVTable from './export-csv-table'; import ExportCSVColumnTable from './export-csv-column-table'; import DeleteRowCustomComfirmTable from './del-row-custom-confirm'; import SearchClearTable from './search-clear-table'; import SearchFormatTable from './search-format-table'; import DebounceSearchTable from './debounce-search-table'; import CustomButtonTextTable from './custom-btn-text-table'; import DefaultSearchTable from './default-search-table'; class Demo extends React.Component { render() { return ( <div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Insert Row Example' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/insert-row-table.js' }</h5> <InsertRowTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Delete Row Example' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/delete-row-table.js' }</h5> <DeleteRowTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Table Search Example(Include after search hook)' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/strict-search-table.js' }</h5> <h5>{ 'The table\'s ' }<code>{ 'strictSearch' }</code>{ ' is by default ' }<code>{ 'true' }</code>{ '.' }</h5> <h5>{ 'See your console to watch information of after searching.' }</h5> <h5>{ 'The Product ID has ' }<code>{ 'searchable' }</code>{ ' set to ' }<code>{ 'false' }</code>{ '.' }</h5> <StrictSearchTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Table Search Example(Use space to delimited search text, ex:"name banana")' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/search-table.js' }</h5> <h5>{ 'The table\'s ' }<code>{ 'strictSearch' }</code>{ ' is set to ' }<code>{ 'false' }</code>{ '.' }</h5> <h5>{ 'See your console to watch information of after searching.' }</h5> <h5>{ 'The Product ID has ' }<code>{ 'searchable' }</code>{ ' set to ' }<code>{ 'false' }</code>{ '.' }</h5> <SearchTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Table Multi Search Example(Use space to delimited search text, ex:"3 4")' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/multi-search-table.js' }</h5> <h5>{ 'The table\'s ' }<code>{ 'strictSearch' }</code>{ ' is by default ' }<code>{ 'false' }</code>{ '.' }</h5> <h5>{ 'The Product ID has ' }<code>{ 'searchable' }</code>{ ' set to ' }<code>{ 'false' }</code>{ '.' }</h5> <MultiSearchTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Table Multi Search Example(Use space to delimited search text, ex:"3 orange")' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/strict-multi-search-table.js' }</h5> <h5>{ 'The table\'s ' }<code>{ 'strictSearch' }</code>{ ' is set to ' }<code>{ 'true' }</code>{ '.' }</h5> <h5>{ 'The Product ID has ' }<code>{ 'searchable' }</code>{ ' set to ' }<code>{ 'false' }</code>{ '.' }</h5> <StrictMultiSearchTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Table Search Example with Clear Button' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/search-clear-table.js' }</h5> <h5>{ 'The Product Name has ' }<code>{ 'searchable' }</code>{ ' set to ' }<code>{ 'false' }</code>{ '.' }</h5> <SearchClearTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Search for custom format data' }</div> <div className='panel-body'> <h5>{ 'You can custom the filter value by giving ' }<code>{ 'filterValue' }</code>{ ' when searching or filtering' }</h5> <h5>{ 'For example, the second field is formatted from an object, and you can searh on its type by keying Cloud, Mail, Insert, Modify, Money' }</h5> <h5>{ 'You can also search or filter the column after formatted, just enable ' }<code>{ 'filterFormatted' }</code></h5> <br/> <h5>{ 'Source in /examples/js/manipulation/search-format-table.js' }</h5> <SearchFormatTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Debounce Search Table Example(Use searchDelayTime props to set your search delay time)' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/debounce-search-table.js' }</h5> <h5>{ 'use ' }<code>{ 'searchDelayTime' }</code>{ ' for ' }<code>{ 'options' }</code>{ ' object to set delay time in search input and default is 0.' }</h5> <DebounceSearchTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Default Search Table' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/default-search-table.js' }</h5> <DefaultSearchTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Column Filter Example' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/filter-table.js' }</h5> <h5>{ 'See your console to watch information of after column filtering.' }</h5> <ColumnFilterTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Export CSV Example' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/export-csv-table.js' }</h5> <h5><b>{ 'Use ' }<code>{ 'options.csvFormat' }</code> on <code>{ 'TableHeaderColumn' }</code> { ' to format cell when exporting.' }</b></h5> <h5><b>{ 'Use ' }<code>{ 'options.csvHeader' }</code> on <code>{ 'TableHeaderColumn' }</code> { ' to change the header text in csv.' }</b></h5> <h5><b>{ 'Use ' }<code>{ 'options.csvFieldType' }</code> on <code>{ 'TableHeaderColumn' }</code> { ' to assign the value type(Available value is number and string).' }</b></h5> <h5><b>{ 'Use ' }<code>{ 'csvFormatExtraData' }</code> on <code>{ 'TableHeaderColumn' }</code> { ' to assign your extra data for formatting csv cell data.' }</b></h5> <h5><b>{ 'Use ' }<code>{ 'options.exportCSVSeparator' }</code>{ ' to speficy the separator of CSV file' }</b></h5> <h5><b>{ 'Use ' }<code>{ 'options.noAutoBOM' }</code>{ ' to speficy no_auto_bom' }</b></h5> <h5><b>{ 'Use ' }<code>{ 'options.excludeCSVHeader' }</code>{ ' to exclude the header when it is true' }</b></h5> <ExportCSVTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Export CSV Column Example' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/export-csv-column-table.js' }</h5> <h5><b>{ 'Use ' }<code>{ 'export' }</code>{ ' to ask ' }<code>{ 'react-bootstrap-table' }</code>{ ' to export hidden column' }</b></h5> <h5><b>{ 'For example, The ID column is hidden, but can be exported by assigning ' }<code>{ 'export' }</code></b></h5> <h5><b>{ 'You can also give ' }<code>{ 'export=false' }</code>{ ' to ignore this column on exporting' }</b></h5> <ExportCSVColumnTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'A Custom add/delete/exportcsv Button Text Example' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/custom-btn-text-table.js' }</h5> <CustomButtonTextTable /> </div> </div> </div> <div className='col-md-offset-1 col-md-8'> <div className='panel panel-default'> <div className='panel-heading'>{ 'Custom Confirmation for row deletion Example' }</div> <div className='panel-body'> <h5>{ 'Source in /examples/js/manipulation/del-row-custom-confirm.js' }</h5> <DeleteRowCustomComfirmTable /> </div> </div> </div> </div> ); } } export default Demo;
src/index.js
relaunched/book_list
import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import App from './components/app'; import reducers from './reducers'; const createStoreWithMiddleware = applyMiddleware()(createStore); ReactDOM.render( <Provider store={createStoreWithMiddleware(reducers)}> <App /> </Provider> , document.querySelector('.container'));
app/javascript/mastodon/features/follow_recommendations/index.js
koba-lab/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; import { FormattedMessage } from 'react-intl'; import { fetchSuggestions } from 'mastodon/actions/suggestions'; import { changeSetting, saveSettings } from 'mastodon/actions/settings'; import { requestBrowserPermission } from 'mastodon/actions/notifications'; import { markAsPartial } from 'mastodon/actions/timelines'; import Column from 'mastodon/features/ui/components/column'; import Account from './components/account'; import Logo from 'mastodon/components/logo'; import imageGreeting from 'mastodon/../images/elephant_ui_greeting.svg'; import Button from 'mastodon/components/button'; const mapStateToProps = state => ({ suggestions: state.getIn(['suggestions', 'items']), isLoading: state.getIn(['suggestions', 'isLoading']), }); export default @connect(mapStateToProps) class FollowRecommendations extends ImmutablePureComponent { static contextTypes = { router: PropTypes.object.isRequired, }; static propTypes = { dispatch: PropTypes.func.isRequired, suggestions: ImmutablePropTypes.list, isLoading: PropTypes.bool, }; componentDidMount () { const { dispatch, suggestions } = this.props; // Don't re-fetch if we're e.g. navigating backwards to this page, // since we don't want followed accounts to disappear from the list if (suggestions.size === 0) { dispatch(fetchSuggestions(true)); } } componentWillUnmount () { const { dispatch } = this.props; // Force the home timeline to be reloaded when the user navigates // to it; if the user is new, it would've been empty before dispatch(markAsPartial('home')); } handleDone = () => { const { dispatch } = this.props; const { router } = this.context; dispatch(requestBrowserPermission((permission) => { if (permission === 'granted') { dispatch(changeSetting(['notifications', 'alerts', 'follow'], true)); dispatch(changeSetting(['notifications', 'alerts', 'favourite'], true)); dispatch(changeSetting(['notifications', 'alerts', 'reblog'], true)); dispatch(changeSetting(['notifications', 'alerts', 'mention'], true)); dispatch(changeSetting(['notifications', 'alerts', 'poll'], true)); dispatch(changeSetting(['notifications', 'alerts', 'status'], true)); dispatch(saveSettings()); } })); router.history.push('/home'); } render () { const { suggestions, isLoading } = this.props; return ( <Column> <div className='scrollable follow-recommendations-container'> <div className='column-title'> <Logo /> <h3><FormattedMessage id='follow_recommendations.heading' defaultMessage="Follow people you'd like to see posts from! Here are some suggestions." /></h3> <p><FormattedMessage id='follow_recommendations.lead' defaultMessage="Posts from people you follow will show up in chronological order on your home feed. Don't be afraid to make mistakes, you can unfollow people just as easily any time!" /></p> </div> {!isLoading && ( <React.Fragment> <div className='column-list'> {suggestions.size > 0 ? suggestions.map(suggestion => ( <Account key={suggestion.get('account')} id={suggestion.get('account')} /> )) : ( <div className='column-list__empty-message'> <FormattedMessage id='empty_column.follow_recommendations' defaultMessage='Looks like no suggestions could be generated for you. You can try using search to look for people you might know or explore trending hashtags.' /> </div> )} </div> <div className='column-actions'> <img src={imageGreeting} alt='' className='column-actions__background' /> <Button onClick={this.handleDone}><FormattedMessage id='follow_recommendations.done' defaultMessage='Done' /></Button> </div> </React.Fragment> )} </div> </Column> ); } }
src/option-selector/option-selector.js
Synchro-TEC/apollo
import React from 'react'; import PropTypes from 'prop-types'; const optionSelectorStyles = { container: { display: 'inline', position: 'relative', }, options: { padding: '10px', backgroundColor: '#fff', boxShadow: '0 0 5px #d1d1d1', display: 'none', position: 'absolute', listStyle: 'none', zIndex: '99', }, li: { display: 'block', cursor: 'pointer', margin: '10px 0', lineHeight: '1.5', }, }; class OptionSelector extends React.Component { constructor(props) { super(props); this.state = { label: this.props.initialValue, isVisible: false }; } onSelect(opt) { this.setState({ label: opt[this.props.labelKey], isVisible: false }); if (this.props.onSelectCallBack) { this.props.onSelectCallBack(opt); } } showOptions() { this.setState({ label: this.state.label, isVisible: !this.state.isVisible }); } render() { let options = this.props.options.map((opt, i) => { return ( <li key={`opt-${i}`} onClick={() => this.onSelect(opt)} style={optionSelectorStyles.li}> {opt[this.props.labelKey]} </li> ); }); var display = this.state.isVisible ? { display: 'block' } : { display: 'none' }; var optsStyles = Object.assign({}, optionSelectorStyles.options, display); var classes = this.props.classes || 'sv-button link link-info'; return ( <div style={optionSelectorStyles.container}> <button className={classes} onClick={() => this.showOptions()}> {this.state.label} </button> <ul style={optsStyles}>{options}</ul> </div> ); } } OptionSelector.displayName = 'OptionSelector'; OptionSelector.propTypes = { classes: PropTypes.string, initialValue: PropTypes.string, labelKey: PropTypes.string, onSelectCallBack: PropTypes.func, options: PropTypes.array.isRequired, }; OptionSelector.defaultProps = { initialValue: '?', }; export default OptionSelector;
packages/ndla-icons/src/editor/Heading2.js
netliferesearch/frontend-packages
/** * Copyright (c) 2017-present, NDLA. * * This source code is licensed under the GPLv3 license found in the * LICENSE file in the root directory of this source tree. * */ // N.B! AUTOGENERATED FILE. DO NOT EDIT import React from 'react'; import Icon from '../Icon'; const Heading2 = props => ( <Icon viewBox="0 0 22 15" data-license="CC-BY 4.0" data-source="Knowit" {...props}> <g> <path fillRule="evenodd" d="M.2 15h.704V7.564h8.14V15h.704V.48h-.704v6.468H.904V.48H.2V15zm12.672 0h8.448v-.616h-5.06c-.792 0-1.584.044-2.376.088 4.136-4.378 6.732-7.084 6.732-9.944 0-2.332-1.408-3.872-3.872-3.872-1.672 0-2.904.924-3.916 2.068l.484.44c.88-1.1 2.068-1.892 3.388-1.892 2.244 0 3.212 1.452 3.212 3.256 0 2.508-2.288 5.148-7.04 10.032V15z" /> </g> </Icon> ); export default Heading2;
src/routes.js
urre/chock.press
import React from 'react'; import { Route, IndexRoute } from 'react-router'; import App from './components/App'; const routes = ( <Route path="/" component={ App }> </Route> ); export default routes;
docs/src/app/components/pages/components/Slider/ExampleSimple.js
mtsandeep/material-ui
import React from 'react'; import Slider from 'material-ui/Slider'; /** * The `defaultValue` property sets the initial position of the slider. * The slider appearance changes when not at the starting position. */ const SliderExampleSimple = () => ( <div> <Slider /> <Slider defaultValue={0.5} /> <Slider defaultValue={1} /> </div> ); export default SliderExampleSimple;
docs/app/Examples/elements/Button/GroupVariations/ButtonExampleGroupBasic.js
vageeshb/Semantic-UI-React
import React from 'react' import { Button, Divider } from 'semantic-ui-react' const ButtonExampleGroupBasic = () => ( <div> <Button.Group basic> <Button>One</Button> <Button>Two</Button> <Button>Three</Button> </Button.Group> <Divider /> <Button.Group basic vertical> <Button>One</Button> <Button>Two</Button> <Button>Three</Button> </Button.Group> </div> ) export default ButtonExampleGroupBasic
js/about/index.js
JenningsWu/Chaldea-archives
/** * @flow */ import React from 'react' import { View, Text, Linking, Alert, ScrollView, } from 'react-native' import { List, ListItem, } from 'react-native-elements' import { StackNavigator } from 'react-navigation' import Icon from 'react-native-vector-icons/FontAwesome' import NgaReference from './ngaReference' const TabBarIcon = ({ tintColor }) => ( <Icon name="map" size={20} style={{ color: tintColor }} /> ) const Developer = [ { name: '@吴钩霜雪明', link: 'http://weibo.com/jenningswu', }, ] const About = ({ navigation }) => ( <ScrollView style={{ backgroundColor: 'white' }} > <List style={{ marginTop: 0 }}> <ListItem title="开源于" rightTitle="GitHub" rightTitleStyle={{ color: '#333' }} onPress={() => Linking.openURL('https://github.com/JenningsWu/Chaldea-archives')} /> <ListItem title="意见反馈与 Bug 提交" onPress={() => { Alert.alert( '意见反馈与 Bug 提交', '', [ { text: '取消', }, { text: '通过 GitHub', onPress: () => Linking.openURL('https://github.com/JenningsWu/Chaldea-archives/issues/new'), }, { text: '通过邮件', onPress: () => Linking.openURL('mailto:chaldea.archives@gmail.com'), }, ], ) }} /> <ListItem title="开发者" subtitle={ <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}> { Developer.map(({ name, link }) => ( <Text style={{ marginRight: 10, marginBottom: 5 }} key={`${name}-${link}`} onPress={() => link && Linking.openURL(link)} > {name} </Text> )) } </View> } subtitleContainerStyle={{ marginLeft: 10, marginTop: 10 }} hideChevron /> <ListItem title="APP 图标画师" rightTitle="空想" rightTitleStyle={{ color: '#333' }} onPress={() => Linking.openURL('https://www.pixiv.net/member.php?id=6937042')} hideChevron /> <ListItem title="数据来源:" subtitle={<View> <ListItem title="Fate/Grand Order Wikia(英)" onPress={() => Linking.openURL('http://fategrandorder.wikia.com/wiki/Fate/Grand_Order_Wikia/')} hideChevron /> <ListItem title="茹西教王的理想乡" onPress={() => Linking.openURL('http://kazemai.github.io/fgo-vz/')} hideChevron /> <ListItem title="NGA 玩家社区 - FGO 版" onPress={() => navigation.navigate('NgaRef')} /> <ListItem title="Fate/Grand Order @wiki(日)" onPress={() => Linking.openURL('https://www9.atwiki.jp/f_go/')} hideChevron /> <ListItem title="FGO WIKI" onPress={() => Linking.openURL('http://fgowiki.com/')} hideChevron containerStyle={{ borderBottomWidth: 0 }} /> </View>} subtitleContainerStyle={{ margin: 10 }} hideChevron /> </List> </ScrollView> ) About.navigationOptions = { tabBarLabel: '关于', tabBarIcon: TabBarIcon, title: '关于', } export default StackNavigator({ Index: { screen: About, }, NgaRef: { screen: NgaReference, }, }, { navigationOptions: { gesturesEnabled: true, }, })
src/routes/Login/index.js
pmg1989/dva-admin
import React from 'react' import PropTypes from 'prop-types' import { connect } from 'dva' import { Spin } from 'antd' import LoginForm from './LoginForm' import styles from './LoginForm.less' function Login ({ dispatch, loading = false }) { const loginProps = { loading, onOk (data) { dispatch({ type: 'login/submit', payload: data }) }, } return ( <div className={styles.spin}><Spin tip="加载用户信息..." spinning={loading} size="large"><LoginForm {...loginProps} /></Spin></div> ) } Login.propTypes = { dispatch: PropTypes.func, loading: PropTypes.bool, } function mapStateToProps ({ loading }) { return { loading: loading.models.login } } export default connect(mapStateToProps)(Login)
fields/types/number/NumberColumn.js
dvdcastro/keystone
import React from 'react'; import numeral from 'numeral'; import ItemsTableCell from '../../components/ItemsTableCell'; import ItemsTableValue from '../../components/ItemsTableValue'; var NumberColumn = React.createClass({ displayName: 'NumberColumn', propTypes: { col: React.PropTypes.object, data: React.PropTypes.object, }, renderValue () { const value = this.props.data.fields[this.props.col.path]; if (!value || isNaN(value)) return null; const formattedValue = (this.props.col.path === 'money') ? numeral(value).format('$0,0.00') : value; return formattedValue; }, render () { return ( <ItemsTableCell> <ItemsTableValue field={this.props.col.type}> {this.renderValue()} </ItemsTableValue> </ItemsTableCell> ); }, }); module.exports = NumberColumn;
src/javascripts/components/NoMatch.js
taydakov/url-shortener
/* Static dependencies */ /* JS dependencies */ import React from 'react'; export default class NoMatch extends React.Component { constructor (...args) { super(...args); this.state = { }; } render () { return ( <div class="text-center"> <h4>Page Not Found</h4> <h1>404</h1> </div> ); } }; NoMatch.propTypes = { };
src/pages/index.js
green-arrow/ibchamilton
import React from 'react'; import styled from 'react-emotion'; import Link from 'gatsby-link'; import Container from '../components/Container'; const PageWrapper = styled(Container)` @media (min-width: 768px) { text-align: center; } `; const IndexPage = props => ( <PageWrapper> <h2>Regular Services</h2> <h3>Sunday @ 9:30 &amp; 10:30 am</h3> <h3>Wednesday @ 7:00 pm</h3> <h2>Location</h2> <iframe width="100%" height="450" frameBorder="0" scrolling="no" marginHeight="0" marginWidth="0" src="https://maps.google.com/maps?oe=utf-8&amp;client=firefox-a&amp;ie=UTF8&amp;q=1770+Eaton+Ave+Hamilton,+OH+45013&amp;fb=1&amp;split=1&amp;gl=us&amp;cid=8168267082802788523&amp;li=lmd&amp;s=AARTsJqO2big0ld5vcsctzOUG2yYgQC-0w&amp;ll=39.435978,-84.581144&amp;spn=0.007955,0.013733&amp;z=16&amp;iwloc=A&amp;output=embed" /> </PageWrapper> ); export default IndexPage;
app/javascript/mastodon/features/account_timeline/components/header.js
8796n/mastodon
import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import InnerHeader from '../../account/components/header'; import ActionBar from '../../account/components/action_bar'; import MissingIndicator from '../../../components/missing_indicator'; import ImmutablePureComponent from 'react-immutable-pure-component'; class Header extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.map, me: PropTypes.number.isRequired, onFollow: PropTypes.func.isRequired, onBlock: PropTypes.func.isRequired, onMention: PropTypes.func.isRequired, onReport: PropTypes.func.isRequired, onMute: PropTypes.func.isRequired }; static contextTypes = { router: PropTypes.object }; handleFollow = () => { this.props.onFollow(this.props.account); } handleBlock = () => { this.props.onBlock(this.props.account); } handleMention = () => { this.props.onMention(this.props.account, this.context.router); } handleReport = () => { this.props.onReport(this.props.account); this.context.router.push('/report'); } handleMute = () => { this.props.onMute(this.props.account); } render () { const { account, me } = this.props; if (account === null) { return <MissingIndicator />; } return ( <div className='account-timeline__header'> <InnerHeader account={account} me={me} onFollow={this.handleFollow} /> <ActionBar account={account} me={me} onBlock={this.handleBlock} onMention={this.handleMention} onReport={this.handleReport} onMute={this.handleMute} /> </div> ); } } export default Header;
docs/src/app/components/pages/components/FlatButton/Page.js
manchesergit/material-ui
import React from 'react'; import Title from 'react-title-component'; import CodeExample from '../../../CodeExample'; import PropTypeDescription from '../../../PropTypeDescription'; import MarkdownElement from '../../../MarkdownElement'; import flatButtonReadmeText from './README'; import flatButtonExampleSimpleCode from '!raw!./ExampleSimple'; import FlatButtonExampleSimple from './ExampleSimple'; import flatButtonExampleComplexCode from '!raw!./ExampleComplex'; import FlatButtonExampleComplex from './ExampleComplex'; import flatButtonExampleIconCode from '!raw!./ExampleIcon'; import FlatButtonExampleIcon from './ExampleIcon'; import flatButtonCode from '!raw!material-ui/FlatButton/FlatButton'; const descriptions = { simple: '`FlatButton` with default color, `primary`, `secondary` and `disabled` props applied.', complex: 'The first example uses an `input` as a child component. ' + 'The second example has an [SVG Icon](/#/components/svg-icon), with the label positioned after. ' + 'The final example uses a [Font Icon](/#/components/font-icon), and is wrapped in an anchor tag.', icon: 'Examples of Flat Buttons using an icon without a label. The first example uses an' + ' [SVG Icon](/#/components/svg-icon), and has the default color. The second example shows' + ' how the icon and background color can be changed. The final example uses a' + ' [Font Icon](/#/components/font-icon), and is wrapped in an anchor tag.', }; const FlatButtonPage = () => ( <div> <Title render={(previousTitle) => `Flat Button - ${previousTitle}`} /> <MarkdownElement text={flatButtonReadmeText} /> <CodeExample title="Simple examples" description={descriptions.simple} code={flatButtonExampleSimpleCode} > <FlatButtonExampleSimple /> </CodeExample> <CodeExample title="Complex examples" description={descriptions.complex} code={flatButtonExampleComplexCode} > <FlatButtonExampleComplex /> </CodeExample> <CodeExample title="Icon examples" description={descriptions.icon} code={flatButtonExampleIconCode} > <FlatButtonExampleIcon /> </CodeExample> <PropTypeDescription code={flatButtonCode} /> </div> ); export default FlatButtonPage;
src/js/main.js
michaelatmender/gui
import React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; import { BrowserRouter as Router } from 'react-router-dom'; import { CacheProvider } from '@emotion/react'; import createCache from '@emotion/cache'; import { LocalizationProvider } from '@mui/lab'; import AdapterMoment from '@mui/lab/AdapterMoment'; import CssBaseline from '@mui/material/CssBaseline'; import withStyles from '@mui/styles/withStyles'; import './../less/main.less'; import App from './components/app'; import store from './reducers'; import ErrorBoundary from './errorboundary'; const cache = createCache({ key: 'mui', prepend: true }); const cssVariables = ({ palette: p }) => ({ '@global': { ':root': { '--mui-primary-main': p.primary.main, '--mui-secondary-main': p.secondary.main } } }); export const WrappedBaseline = withStyles(cssVariables)(CssBaseline); export const AppProviders = () => ( <Provider store={store}> <CacheProvider value={cache}> <LocalizationProvider dateAdapter={AdapterMoment}> <ErrorBoundary> <Router basename="/ui/#"> <App /> </Router> </ErrorBoundary> </LocalizationProvider> </CacheProvider> </Provider> ); export const Main = () => { render(<AppProviders />, document.getElementById('main') || document.createElement('div')); }; Main();
src/components/profile/UserInfo.js
simnau/event-scraper-ui
import React from 'react'; import { Field } from 'redux-form'; import { TextField } from 'redux-form-material-ui'; import { Row, Col } from 'react-flexbox-grid'; function UserInfo({ profile, }) { return ( <Row style={{ margin: 0, padding: '2rem 0 2rem 2rem', }} > <Col lg={2} sm={4} xs={6} style={{ display: 'flex', flexDirection: 'column' }}> <div style={{ backgroundColor: 'red', width: 150, height: 150 }}> PHOTO </div> </Col> <Col lg={10} sm={8} xs={6}> <form form="userInfoForm"> <Row style={{ margin: 0 }}> <Col sm={5} > <div style={{ margin: '0 1rem' }}> <Field name="username" floatingLabelText="Username" floatingLabelFixed component={TextField} disabled inputStyle={{ color: 'black' }} underlineShow={false} fullWidth /> <Field name="email" floatingLabelText="Email" component={TextField} disabled inputStyle={{ color: 'black' }} underlineShow={false} fullWidth /> </div> </Col> <Col sm={5} > <div style={{ margin: '0 1rem' }}> <Field name="country" floatingLabelText="Country" component={TextField} fullWidth /> <Field name="city" floatingLabelText="City" component={TextField} fullWidth /> </div> </Col> </Row> </form> </Col> </Row> ); } export default UserInfo;
src/components/web/PageTitle.js
Manuelandro/Universal-Commerce
import React from 'react' import styled from 'styled-components' const { View, Text } = { View: styled.div` display: flex; flex: 1; flex-direction: row; align-self: stretch; justify-content: center; margin-top: 20px; margin-bottom: 5px; `, Text: styled.p` align-self: center; font-size: 18px; font-weight: 600; color: #000; ` } const PageTitle = ({ children }) => <View> <Text>{children}</Text> </View> export { PageTitle }
static/src/components/islands/IslandSmall.js
taylorsmcclure/airhornbot-dev
// @flow import React from 'react'; import Constants from '../../Constants'; const islands = [ Constants.Image.ISLAND_SMALL_1, Constants.Image.ISLAND_SMALL_2, Constants.Image.ISLAND_SMALL_3, Constants.Image.ISLAND_SMALL_4, Constants.Image.ISLAND_SMALL_5, Constants.Image.ISLAND_SMALL_6 ]; type Props = { type: number, number: number, paused: boolean }; export default ({type, number, paused}: Props): React.Element => { const className = `island small-island small-${number} ${paused ? 'paused' : ''}`; return <img className={className} src={islands[type]} />; };
react-dev/components/right_menu_bar.js
InsidiousMind/code.LiquidThink
import React from 'react'; import Toggle from 'material-ui/Toggle'; import { green800, green900, cyan500 } from 'material-ui/styles/colors'; import { getLink } from '../helpers'; import { SocialMediaList } from './social_media_list'; function getLogo(logo, logoURL) { if (!logo) { return; } return (<img role="presentation" src={logoURL} />); } const styles = { toggle: { marginBottom: 5, width: 'auto', height: 'auto', float: 'left', }, input: { width: '43%', }, divToggle: { position: 'relative', }, label: { width: 'calc(100% - 256)', } }; export const RightBar = (props) => ( <div className="right-menu-bar" > <div> {getLink(getLogo(props.config.logo, `${props.config.url}/${props.config.logo}`), '', props.config.url, '/')} </div> <div> <Toggle label="Toggle Theme" labelPosition="right" labelStyle={styles.label} defaultToggled style={styles.toggle} inputStyle={styles.input} onToggle={props.handleThemeSwitch} /> <SocialMediaList social={props.config.social} /> </div> </div> );
src/views/Playlist/components/Track.js
Gouthamve/BINS-FRONT
import React from 'react' import { ListGroupItem, Row, Col, Image, Button } from 'react-bootstrap' import alart from 'img/coverart1.jpg' const Track = ({ name, album, artist, playing, setCurrent, pauseCurrent}) => { let playButton = <Button onClick={setCurrent}><i className={`fa fa-play-circle-o fa-2x`}></i></Button> if (playing) { playButton = <Button onClick={pauseCurrent}><i className={`fa fa-pause-circle-o fa-2x`}></i></Button> } return <ListGroupItem> <Row className='vertical-align'> <Col xs={1}> {playButton} </Col> <Col xs={1}> <Image src={alart} responsive /> </Col> <Col xs={4} className='text-left'> <p>{name}</p> </Col> <Col xs={1} className='text-left'> <p>4:60</p> </Col> <Col xs={2} className='text-left'> <p>{artist}</p> </Col> <Col xs={1} className='text-left'> <p>Alternate</p> </Col> <Col xs={1} className='text-right'> <p>2016</p> </Col> </Row> </ListGroupItem> } export default Track
app/components/PriceList/Symbol.js
cshutchinson/sk
import React, { Component } from 'react'; export default class Symbol extends Component { constructor(props){ super(props); } render(){ return ( <tr> <td>{this.props.symbolData.symbol}</td> <td>{this.props.symbolData.name}</td> <td className="text-right">${new Number(this.props.symbolData.current_price).toFixed(2)}</td> <td className="text-right">{this.props.symbolData.volume}</td> </tr> ); } }
examples/App.js
manishksmd/react-scheduler-smartdata
import React from 'react'; import Api from './Api'; // import Intro from './Intro.md'; import cn from 'classnames'; import { render } from 'react-dom'; import localizer from 'react-big-calendar/lib/localizers/globalize'; import globalize from 'globalize'; localizer(globalize); import 'react-big-calendar/lib/less/styles.less'; import './styles.less'; import './prism.less'; import Basic from './demos/basic'; import Selectable from './demos/selectable'; import Cultures from './demos/cultures'; import Popup from './demos/popup'; import Rendering from './demos/rendering'; import CustomView from './demos/customView'; import Timeslots from './demos/timeslots'; import Dnd from './demos/dnd'; let demoRoot = 'https://github.com/intljusticemission/react-big-calendar/tree/master/examples/demos' class Example extends React.Component{ constructor(props){ super(props); this.state = { selected: 'dnd', }; } render() { let selected = this.state.selected; let Current = { basic: Basic, selectable: Selectable, cultures: Cultures, popup: Popup, rendering: Rendering, customView: CustomView, timeslots: Timeslots, dnd: Dnd, }[selected]; return ( <div className='app'> <div className="jumbotron"> <div className="container"> <h1>Big Calendar <i className='fa fa-calendar'/></h1> <p>such enterprise, very business.</p> <p> <a href="#intro"> <i className='fa fa-play'/> Getting started </a> {' | '} <a href="#api"> <i className='fa fa-book'/> API documentation </a> {' | '} <a target='_blank' href="https://github.com/intljusticemission/react-big-calendar"> <i className='fa fa-github'/> github </a> </p> </div> </div> <div className='examples'> <header className="contain"> <ul className='nav nav-pills'> <li className={cn({active: selected === 'basic' })}> <a href='#' onClick={this.select.bind(null, 'basic')}>Basic</a> </li> <li className={cn({active: selected === 'selectable' })}> <a href='#' onClick={this.select.bind(null, 'selectable')}>Selectable</a> </li> <li className={cn({active: selected === 'cultures' })}> <a href='#' onClick={this.select.bind(null, 'cultures')}>I18n and Locales</a> </li> <li className={cn({active: selected === 'popup' })}> <a href='#' onClick={this.select.bind(null, 'popup')}>Popup</a> </li> <li className={cn({active: selected === 'timeslots' })}> <a href='#' onClick={this.select.bind(null, 'timeslots')}>Timeslots</a> </li> <li className={cn({active: selected === 'rendering' })}> <a href='#' onClick={this.select.bind(null, 'rendering')}>Custom rendering</a> </li> {/* temporary hide link to documentation <li className={cn({active: selected === 'customView' })}> <a href='#' onClick={this.select.bind(null, 'customView')}>Custom View</a> </li> */} <li className={cn({active: selected === 'dnd' })}> <a href='#' onClick={this.select.bind(null, 'dnd')}>Drag and Drop</a> </li> </ul> </header> <div className='example'> <div className='view-source'> <a target='_blank' href={demoRoot + '/' + selected + '.js' }> <strong><i className='fa fa-code'/>{' View example source code'}</strong> </a> </div> <Current className='demo' /> </div> </div> <div className='docs'> {/* <Intro className='contain section'/> */} <Api className='contain section' /> </div> </div> ); } select(selected, e){ e.preventDefault(); this.setState({ selected }) } } render(<Example/>, document.getElementById('root'));
packages/mineral-ui-icons/src/IconBluetooth.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 IconBluetooth(props: IconProps) { const iconProps = { rtl: false, ...props }; return ( <Icon {...iconProps}> <g> <path d="M17.71 7.71L12 2h-1v7.59L6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 11 14.41V22h1l5.71-5.71-4.3-4.29 4.3-4.29zM13 5.83l1.88 1.88L13 9.59V5.83zm1.88 10.46L13 18.17v-3.76l1.88 1.88z"/> </g> </Icon> ); } IconBluetooth.displayName = 'IconBluetooth'; IconBluetooth.category = 'device';
test/helpers/shallowRenderHelper.js
panlu888/small-react-app
/** * 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(); }
pkg/ui/src/components/WorkloadsPage.js
matt-deboer/kuill
import React from 'react' import { Link } from 'react-router-dom' import FloatingActionButton from 'material-ui/FloatingActionButton' import { blueA400, grey200, grey300, grey500, grey800, red900, white } from 'material-ui/styles/colors' import { connect } from 'react-redux' import { addFilter, removeFilter, removeResource, scaleResource, viewResource, detachResource } from '../state/actions/resources' import sizeMe from 'react-sizeme' import FilterTable from './filter-table/FilterTable' import { withRouter } from 'react-router-dom' import IconAdd from 'material-ui/svg-icons/content/add' import IconDelete from 'material-ui/svg-icons/action/delete' import IconSuspend from 'material-ui/svg-icons/content/block' import Paper from 'material-ui/Paper' import { arraysEqual, objectEmpty } from '../comparators' import { compareStatuses, kindsByResourceGroup, anySelectedWithReplicas } from '../utils/resource-utils' import { getResourceCellValue, renderResourceCell } from '../utils/resource-column-utils' import FilterBox from './FilterBox' import ConfirmationDialog from './ConfirmationDialog' import ScaleDialog from './ScaleDialog' import FilteredResourceCountsPanel from './FilteredResourceCountsPanel' import RowActionMenu from './RowActionMenu' import Checkbox from 'material-ui/Checkbox' import MultiResourceActionButton from './MultiResourceActionButton' import './WorkloadsPage.css' // import Perf from 'react-addons-perf' const mapStateToProps = function(store) { return { filters: store.resources.filters, filterNames: store.resources.filterNames, autocomplete: store.resources.autocomplete.workloads, accessEvaluator: store.session.accessEvaluator, kinds: store.apimodels.kinds, linkGenerator: store.session.linkGenerator, podMetrics: store.metrics.pod, resourceRevision: store.resources.resourceRevision, metricsRevision: store.metrics.revision, } } const mapDispatchToProps = function(dispatch, ownProps) { return { addFilter: function(filterName) { dispatch(addFilter(filterName)) }, removeFilter: function(filterName, index) { dispatch(removeFilter(filterName, index)) }, viewResource: function(resource, view='config') { dispatch(viewResource(resource,view)) }, removeResource: function(...resources) { dispatch(removeResource(...resources)) }, detachResource: function(resource) { dispatch(detachResource(resource)) }, scaleResource: function(resource, replicas) { dispatch(scaleResource( resource.metadata.namespace, resource.kind, resource.metadata.name, replicas)) } } } const styles = { newResourceButton: { margin: 0, top: 100, right: 60, bottom: 'auto', left: 'auto', position: 'fixed', }, deleteResourceButton: { margin: 0, top: 110, right: 130, bottom: 'auto', left: 'auto', position: 'fixed', }, suspendResourceButton: { margin: 0, top: 110, right: 180, bottom: 'auto', left: 'auto', position: 'fixed', }, editButton: { fill: grey500 }, cell: { paddingLeft: 2, paddingRight: 2, }, header: { fontWeight: 600, fontSize: '13px', color: white, fill: white, }, iconButton: { float: 'left', paddingTop: 17 }, editLink: { color: blueA400, fontWeight: 600, textDecoration: 'none', }, miniButton: { margin: 10, }, popover: { marginTop: 8, marginLeft: 15, marginRight: 0, paddingLeft: 15, paddingRight: 15, paddingTop: 6, paddingBottom: 6, backgroundColor: '#BBB', border: '1px solid #000', borderRadius: '3px', boxShadow: 'rgba(0, 0, 0, 0.16) 0px 3px 10px, rgba(0, 0, 0, 0.23) 0px 3px 10px', display: 'flex', }, paper: { padding: 15, margin: 5, height: 'calc(100vh - 110px)', border: '1px solid rgba(33,33,33,0.8)', position: 'absolute,' }, statusIcon: { marginLeft: 10, }, actionContainer: { position: 'relative', display: 'inline-block', float: 'left', }, actionLabel: { position: 'absolute', bottom: 0, textAlign: 'center', width: '100%', color: white, fontSize: 10, zIndex: 100, pointerEvents: 'none', }, actionButton: { backgroundColor: 'transparent', marginTop: 4, marginBottom: 4, color: grey200, fontSize: 18, fontWeight: 600, }, actionButtonLabel: { textTransform: 'none', color: grey300, }, actionIcon: { color: white, marginTop: -4, }, actionHoverStyle: { backgroundColor: '#999', }, } // use functional component style for representational components export default sizeMe({ monitorWidth: true, monitorHeight: true }) ( withRouter(connect(mapStateToProps, mapDispatchToProps) ( class WorkloadsPage extends React.Component { constructor(props) { super(props); this.state = { actionsOpen: false, deleteOpen: false, scaleOpen: false, suspendOpen: false, hoveredRow: -1, hoveredResources: null, selectedResources: [], openTerminalOnDetach: true, } this.selectedIds = {} this.deleteEnabled = false this.suspendEnabled = false this.rows = this.resourcesToRows(props.resources, props.kinds) this.columns = [ { id: 'kind', label: 'kind', sortable: true, headerStyle: styles.header, style: { ...styles.cell, width: '100px', } }, { id: 'name', label: 'name', sortable: true, headerStyle: styles.header, style: { ...styles.cell, // width: '35%', }, }, { id: 'namespace', label: 'ns', sortable: true, headerStyle: styles.header, style: { ...styles.cell, width: 100, } }, { id: 'cpu_utilized', label: <div><span>cpu</span><br/><span>used</span></div>, sortable: true, isNumeric: true, headerStyle: {...styles.header, textAlign: 'center', whiteSpace: 'normal', lineHeight: '13px', padding: 0, }, style: { ...styles.cell, width: '7%', textAlign: 'right', paddingRight: '2%', }, }, { id: 'mem_utilized', label: <div><span>Gi mem</span><br/><span>used</span></div>, sortable: true, isNumeric: true, headerStyle: {...styles.header, textAlign: 'center', whiteSpace: 'normal', lineHeight: '13px', padding: 0, }, style: { ...styles.cell, width: '7%', textAlign: 'right', paddingRight: '2%', }, }, { id: 'disk_utilized', label: <div><span>Gi disk</span><br/><span>used</span></div>, sortable: true, isNumeric: true, headerStyle: {...styles.header, textAlign: 'center', whiteSpace: 'normal', lineHeight: '13px', padding: 0, }, style: { ...styles.cell, width: '7%', textAlign: 'right', paddingRight: '2%', }, }, { id: 'pods', label: 'pods', sortable: true, isNumeric: true, headerStyle: styles.header, style: { ...styles.cell, width: '7%', paddingLeft: '1%' } }, { id: 'status', label: 'status', headerStyle: styles.header, style: { ...styles.cell, width: '7%', verticalAlign: 'middle', textAlign: 'center', paddingLeft: '1%', }, sortable: true, comparator: compareStatuses, }, { id: 'age', label: 'age', sortable: true, headerStyle: {...styles.header, textAlign: 'center', }, style: { ...styles.cell, width: '10%', textAlign: 'center', } }, { id: 'actions', label: 'actions ', headerStyle: {...styles.header, paddingLeft: 0, }, style: { ...styles.cell, width: 55, lineHeight: '50px', }, className: 'resource-actions', }, ] for (let fn of [ 'renderCell', 'getCellValue', 'handleRowSelection', 'handleCellClick', 'handleDelete', ]) { this[fn] = this[fn].bind(this) } } resourcesToRows = (resources, kinds) => { if (!this.kinds || Object.keys(this.kinds).length === 0) { this.kinds = kindsByResourceGroup(kinds, 'workloads') } return Object.values(resources).filter(el => !el.isFiltered && (el.kind in this.kinds || !(el.kind in kinds))) } shouldComponentUpdate = (nextProps, nextState) => { return !arraysEqual(this.props.filterNames, nextProps.filterNames) || !arraysEqual(this.props.autocomplete, nextProps.autocomplete) || this.props.resourceRevision !== nextProps.resourceRevision || this.props.metricsRevision !== nextProps.metricsRevision || this.state.actionsOpen !== nextState.actionsOpen || this.state.hoveredRow !== nextState.hoveredRow || this.props.resources !== nextProps.resources || this.state.deleteOpen !== nextState.deleteOpen || this.state.suspendOpen !== nextState.suspendOpen || this.state.scaleOpen !== nextState.scaleOpen || this.props.kinds !== nextProps.kinds } toggleOpenTerminalOnDetach = () => { this.setState({ openTerminalOnDetach: !this.state.openTerminalOnDetach, }) } handleActionsRequestClose = () => { this.setState({ actionsOpen: false, hoveredRow: -1, hoveredResource: null, }) } handleRowSelection = (selectedIds) => { if (!this.actionsClicked) { this.selectedIds = selectedIds this.deleteEnabled = !objectEmpty(selectedIds) this.suspendEnabled = anySelectedWithReplicas(selectedIds, this.props.resources) this.deleteButton.setDisabled(!this.deleteEnabled) this.suspendButton.setDisabled(!this.suspendEnabled) } } handleCellClick = (rowId, colId, resource, col) => { this.actionsClicked = false if (col.id === 'actions') { let trs = document.getElementsByClassName('workloads filter-table')[1].children[0].children let that = this this.props.accessEvaluator.getObjectAccess(resource, 'workloads').then((access) => { that.setState({ actionsOpen: true, actionsAnchor: trs[rowId].children[colId+1], hoveredRow: rowId, hoveredResource: resource, hoveredResourceAccess: access, }) }) this.actionsClicked = true return false } else { this.props.viewResource(resource) return false } } handleDelete = (resource) => { let resources = [] if (resource && 'kind' in resource) { resources.push(resource) } else if (this.selectedIds && Object.keys(this.selectedIds).length > 0) { for (let id in this.selectedIds) { resources.push(this.props.resources[id]) } } this.setState({ selectedResources: resources, deleteOpen: true, actionsOpen: false, }) } handleSuspend = (resource) => { let resources = [] if (resource) { resources.push(resource) } else if (this.selectedIds && Object.keys(this.selectedIds).length > 0) { for (let id in this.selectedIds) { let resource = this.props.resources[id] if ('replicas' in resource.spec && resource.spec.replicas > 0) { resources.push(resource) } } } this.setState({ selectedResources: resources, suspendOpen: true, actionsOpen: false, }) } handleScale = () => { this.setState({ scaleOpen: true, actionsOpen: false, }) } handleDetach = (resource) => { let resources = [] if (resource) { resources.push(resource) } else if (this.selectedIds && Object.keys(this.selectedIds).length > 0) { for (let id in this.selectedIds) { resources.push(this.props.resources[id]) } } this.setState({ selectedResources: resources, detachOpen: true, actionsOpen: false, }) } handleRequestCloseDetach = () => { this.setState({ detachOpen: false, selectedResources: [], }) } handleRequestCloseDelete = () => { this.setState({ deleteOpen: false, selectedResources: [], }) } handleConfirmDelete = () => { this.props.removeResource(...this.state.selectedResources) this.setState({ selectedResources: [], deleteOpen: false, }) this.handleRowSelection({}) } handleConfirmDetach = () => { this.props.detachResource(...this.state.selectedResources) this.setState({ selectedResources: [], detachOpen: false, }) this.handleRowSelection({}) } handleRequestCloseScale = () => { this.setState({ scaleOpen: false, hoveredRow: -1, }) } handleConfirmScale = (replicas) => { this.setState({ scaleOpen: false, }) if (replicas !== undefined) { this.props.scaleResource(this.state.hoveredResource, replicas) } } handleRequestCloseSuspend = () => { this.setState({ suspendOpen: false, }) } handleConfirmSuspend = () => { this.setState({ suspendOpen: false, }) for (let resource of this.state.selectedResources) { this.props.scaleResource(resource, 0) } this.handleRowSelection({}) this.actionsClicked = false } // componentWillUpdate = () => { // setTimeout(() => { // Perf.start() // }, 0) // } componentDidUpdate = () => { // Perf.stop() // let m = Perf.getLastMeasurements() // Perf.printWasted(m) if (!this.state.actionsOpen) { this.actionsClicked = false } } componentWillReceiveProps = (nextProps) => { this.rows = this.resourcesToRows(nextProps.resources, nextProps.kinds) this.setState({filters: nextProps.filters}) } renderCell = (column, row) => { return renderResourceCell(column, row, this.props.podMetrics) } getCellValue = (column, row) => { return getResourceCellValue(column, row, this.props.podMetrics) } render() { let { props } = this return ( <Paper style={styles.paper} className={'workloads-page'}> <FilterBox addFilter={props.addFilter} removeFilter={props.removeFilter} filterNames={props.filterNames} autocomplete={props.autocomplete} /> <FilteredResourceCountsPanel resources={props.resources} kinds={this.kinds}/> <FilterTable className={'workloads'} columns={this.columns} data={this.rows} height={'calc(100vh - 364px)'} multiSelectable={true} revision={`${props.resourceRevision}-${props.metricsRevision}`} onRowSelection={this.handleRowSelection} onCellClick={this.handleCellClick} hoveredRow={this.state.hoveredRow} onRenderCell={this.renderCell} getCellValue={this.getCellValue} selectedIds={this.selectedIds} stripedRows={false} iconStyle={{fill: 'rgba(255,255,255,0.9)'}} iconInactiveStyle={{fill: 'rgba(255,255,255,0.5)'}} width={'calc(100vw - 60px)'} wrapperStyle={{marginLeft: -15, marginRight: -15, overflowX: 'hidden', overflowY: 'auto'}} headerStyle={{backgroundColor: 'rgba(28,84,178,0.8)', color: 'white'}} /> <RowActionMenu open={!!this.state.hoveredResource} handlers={{ logs: ()=> { this.props.viewResource(this.state.hoveredResource,'logs') }, terminal: ()=> { this.props.viewResource(this.state.hoveredResource,'terminal') }, suspend: ()=>{ this.handleSuspend(this.state.hoveredResource)}, scale: this.handleScale, edit: ()=> { this.props.viewResource(this.state.hoveredResource,'edit') }, delete: ()=>{ this.handleDelete(this.state.hoveredResources)}, detach: ()=> { this.handleDetach(this.state.hoveredResource)}, close: this.handleActionsRequestClose, }} access={this.state.hoveredResourceAccess} anchorEl={this.state.actionsAnchor} /> <Link to="/workloads/new" > <FloatingActionButton className={'new-workload'} style={styles.newResourceButton} backgroundColor={blueA400}> <IconAdd /> </FloatingActionButton> </Link> <MultiResourceActionButton backgroundColor={red900} mini={true} style={styles.deleteResourceButton} disabled={!this.deleteEnabled} onTouchTap={this.handleDelete} ref={(ref)=>{this.deleteButton = ref}} data-rh={'Delete Selected...'} data-rh-at={'bottom'}> <IconDelete/> </MultiResourceActionButton> <MultiResourceActionButton backgroundColor={grey800} mini={true} style={styles.suspendResourceButton} disabled={!this.suspendEnabled} onTouchTap={this.handleSuspend} ref={(ref)=>{this.suspendButton = ref}} data-rh={'Suspend Selected...'} data-rh-at={'bottom'}> <IconSuspend/> </MultiResourceActionButton> <ConfirmationDialog open={this.state.deleteOpen} title={'Delete Resource(s):'} message={`Are you sure you want to delete the following ` + `${this.state.selectedResources.length > 1 ? this.state.selectedResources.length + ' ' : ''}` + `resource${this.state.selectedResources.length > 1 ? 's':''}?`} resources={this.state.selectedResources} onRequestClose={this.handleRequestCloseDelete} onConfirm={this.handleConfirmDelete} linkGenerator={this.props.linkGenerator} /> <ConfirmationDialog open={this.state.suspendOpen} title={'Suspend Resource(s):'} message={`Are you sure you want to suspend the following ` + `${this.state.selectedResources.length > 1 ? this.state.selectedResources.length + ' ' : ''}` + `resource${this.state.selectedResources.length > 1 ? 's':''} (by scaling to 0 replicas)?`} resources={this.state.selectedResources} onRequestClose={this.handleRequestCloseSuspend} onConfirm={this.handleConfirmSuspend} linkGenerator={this.props.linkGenerator} /> <ConfirmationDialog open={this.state.detachOpen} title={'Detach Resource:'} message={`Are you sure you want to detach the following resource?`} resources={this.state.selectedResources} onRequestClose={this.handleRequestCloseDetach} onConfirm={this.handleConfirmDetach} linkGenerator={this.props.linkGenerator} > <p> This object will no longer count among the replicas for it's owner. <br/> Note: You can view "detached" resources in the workloads view by adding the filter 'detached:true' </p> <Checkbox label="Open terminal view" className={'open-term'} checked={this.state.openTerminalOnDetach} onCheck={this.toggleOpenTerminalOnDetach} style={styles.checkbox} labelStyle={styles.checkboxLabel} /> </ConfirmationDialog> <ScaleDialog open={this.state.scaleOpen} resource={this.state.hoveredResource} onRequestClose={this.handleRequestCloseScale} onConfirm={this.handleConfirmScale} /> </Paper> ) } })))
newclient/scripts/components/user/entities/entity-form-information-step/index.js
kuali/research-coi
/* The Conflict of Interest (COI) module of Kuali Research Copyright © 2005-2016 Kuali, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/> */ import styles from './style'; import React from 'react'; import {DisclosureStore} from '../../../../stores/disclosure-store'; import {Question} from '../question'; import {QUESTION_TYPE} from '../../../../../../coi-constants'; import {FileUpload} from '../../../file-upload'; export class EntityFormInformationStep extends React.Component { constructor() { super(); this.getAnswer = this.getAnswer.bind(this); this.addEntityAttachments = this.addEntityAttachments.bind(this); this.deleteEntityAttachment = this.deleteEntityAttachment.bind(this); this.onAnswer = this.onAnswer.bind(this); } onAnswer(newValue, questionId) { this.props.onAnswerQuestion(newValue, questionId); } getAnswer(id) { if (this.props.answers) { const answerForId = this.props.answers.find(answer => { return answer.questionId === id; }); if (answerForId) { return answerForId.answer.value; } } } addEntityAttachments(files) { this.props.addEntityAttachments(files, this.props.id); } deleteEntityAttachment(index) { this.props.deleteEntityAttachment(index, this.props.id); } render() { let validationErrors; if (this.props.validating) { validationErrors = DisclosureStore.entityInformationStepErrors(this.props.id); } let heading = null; if (!this.props.update) { if (this.props.name) { heading = ( <div className={styles.title}> {this.props.name} <span style={{marginLeft: 3}}>Information</span> </div> ); } else { heading = ( <div className={styles.title}>Add New Financial Entity</div> ); } } const {config} = this.context.configState; const questions = config.questions.entities.sort((a, b) => { return a.question.order - b.question.order; }).map((question, index) => { let columnStyle; if (question.question.type === QUESTION_TYPE.TEXTAREA) { columnStyle = styles.longColumn; } else { columnStyle = styles.column; } return ( <div className={columnStyle} key={index}> <Question readonly={this.props.readonly} entityId={this.props.id} id={question.id} answer={this.getAnswer(question.id)} question={question} disclosureid={this.props.disclosureid} invalid={validationErrors ? validationErrors.includes(question.id) : false} onAnswer={this.onAnswer} /> </div> ); }); let attachmentSection; if (!this.props.readonly || this.props.files && this.props.files.length > 0) { attachmentSection = ( <div style={{marginBottom: 10}}> <div className={styles.attachmentLabel}> ATTACHMENTS </div> <FileUpload fileType='Attachment' readonly={this.props.readonly} onDrop={this.addEntityAttachments} delete={this.deleteEntityAttachment} files={this.props.files} multiple={true} > <div>Drag and drop or click to upload your attachments</div> <div>Acceptable Formats: .pdf, .png, .doc, .jpeg</div> </FileUpload> </div> ); } return ( <span className={`${this.props.className}`}> {heading} <div style={{color: '#333'}}> {questions} </div> {attachmentSection} </span> ); } } EntityFormInformationStep.contextTypes = { configState: React.PropTypes.object };
information/blendle-frontend-react-source/app/components/navigation/HideOnScroll/index.js
BramscoChill/BlendleParser
import React from 'react'; import { node } from 'prop-types'; import Headroom from 'react-headroom'; import CSS from './style.scss'; function HideOnScroll({ children }) { return ( <Headroom className={CSS.hideOnScroll} upTolerance={10} downTolerance={10}> {children} </Headroom> ); } HideOnScroll.propTypes = { children: node, }; HideOnScroll.defaultProps = { children: null, }; export default HideOnScroll; // WEBPACK FOOTER // // ./src/js/app/components/navigation/HideOnScroll/index.js
react-admin-dashboard/src/pages/UserProfile/index.js
chaitanya1375/Myprojects
import React from 'react'; import ProfileForm from './ProfileForm'; import UserInfo from './UserInfo'; const UserProfile = () => ( <div className="content"> <div className="container-fluid"> <div className="row"> <div className="col-md-8"> <ProfileForm /> </div> <div className="col-md-4"> <UserInfo /> </div> </div> </div> </div> ); export default UserProfile;
src/svg-icons/image/blur-circular.js
ruifortes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageBlurCircular = (props) => ( <SvgIcon {...props}> <path d="M10 9c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zM7 9.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm3 7c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm-3-3c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm3-6c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM14 9c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-1.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zm3 6c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm0-4c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm2-3.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm0-3.5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1z"/> </SvgIcon> ); ImageBlurCircular = pure(ImageBlurCircular); ImageBlurCircular.displayName = 'ImageBlurCircular'; ImageBlurCircular.muiName = 'SvgIcon'; export default ImageBlurCircular;
fields/types/boolean/BooleanColumn.js
stunjiturner/keystone
import React from 'react'; import classnames from 'classnames'; import Checkbox from '../../../admin/client/components/Checkbox'; import ItemsTableCell from '../../../admin/client/components/ItemsTableCell'; import ItemsTableValue from '../../../admin/client/components/ItemsTableValue'; var BooleanColumn = React.createClass({ displayName: 'BooleanColumn', propTypes: { col: React.PropTypes.object, data: React.PropTypes.object, }, renderValue () { return ( <ItemsTableValue truncate={false} field={this.props.col.type}> <Checkbox readonly checked={this.props.data.fields[this.props.col.path]} /> </ItemsTableValue> ); }, render () { return ( <ItemsTableCell> {this.renderValue()} </ItemsTableCell> ); } }); module.exports = BooleanColumn;