path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
ui/src/pages/DataSourcePage/ExportManager/index.js
LearningLocker/learninglocker
import React from 'react'; import PropTypes from 'prop-types'; import { Map, List } from 'immutable'; import Tabs from 'ui/components/Material/Tabs'; import { Tab } from 'react-toolbox/lib/tabs'; import { connect } from 'react-redux'; import { compose, withState, withHandlers, setPropTypes, withProps } from 'recompose'; import ModelAutoComplete from 'ui/containers/ModelAutoComplete'; import Spinner from 'ui/components/Spinner'; import { loggedInUserId } from 'ui/redux/modules/auth'; import { withSchema } from 'ui/utils/hocs'; import AddModelPrompt from './AddModelPrompt'; import ExportDownloadManager from './ExportDownloadManager'; import ExportForm from './ExportForm'; const schema = 'export'; const enhance = compose( withSchema(schema), withState('activeTab', 'setActiveTab', 0), withState('selectedExportId', 'setSelectedExportId'), connect(state => ({ userId: loggedInUserId(state) })), withHandlers({ onAddExport: ({ addModel, userId, setSelectedExportId }) => async () => { const { model } = await addModel({ props: { owner: userId, name: 'New Export' } }); setSelectedExportId(model.get('_id')); }, setSelectedExport: ({ setSelectedExportId }) => (model) => { if (model) return setSelectedExportId(model.get('_id')); setSelectedExportId(null); } }), withProps(({ models, selectedExportId }) => { if (selectedExportId) return { selectedExportId }; if (models.size > 0) { return { selectedExportId: models.first().get('_id') }; } return {}; }), setPropTypes({ activeTab: PropTypes.number.isRequired, pipelines: PropTypes.instanceOf(List).isRequired, models: PropTypes.instanceOf(Map).isRequired, setActiveTab: PropTypes.func.isRequired, setSelectedExportId: PropTypes.func.isRequired, setSelectedExport: PropTypes.func.isRequired, onAddExport: PropTypes.func.isRequired, selectedExportId: PropTypes.string, }) ); const renderSelectedExport = ({ pipelines, selectedExportId, setSelectedExport }) => ( <div> <div key={0} style={{ display: 'flex' }}> <ModelAutoComplete schema={schema} id={selectedExportId} parseOption={model => model.get('name')} parseOptionTooltip={model => model.get('name')} onChange={setSelectedExport} /> </div> <ExportForm key={1} id={selectedExportId} pipelines={pipelines} /> </div> ); const renderNoExport = onAddExport => ( <AddModelPrompt message="No exports configured yet! Add one to get started." schema={schema} onAdd={onAddExport} /> ); const renderExports = ({ isLoading, models, pipelines, selectedExportId, setSelectedExport, onAddExport }) => { if (isLoading) return <Spinner />; if (models.size > 0) { return renderSelectedExport({ pipelines, selectedExportId, setSelectedExport, onAddExport }); } return renderNoExport(onAddExport); }; const render = ({ models, isLoading, pipelines, selectedExportId, setSelectedExport, onAddExport, activeTab, setActiveTab, }) => ( <Tabs index={activeTab} onChange={setActiveTab}> <Tab label="Manage"> <div> {renderExports({ isLoading, models, pipelines, selectedExportId, setSelectedExport, onAddExport })} </div> </Tab> <Tab label="Downloads"> <ExportDownloadManager /> </Tab> </Tabs> ); export default enhance(render);
app/javascript/mastodon/features/compose/components/action_bar.js
lynlynlynx/mastodon
import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' }, pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned toots' }, preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' }, follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' }, favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' }, lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' }, blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' }, domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Hidden domains' }, mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' }, filters: { id: 'navigation_bar.filters', defaultMessage: 'Muted words' }, logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' }, bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' }, }); export default @injectIntl class ActionBar extends React.PureComponent { static propTypes = { account: ImmutablePropTypes.map.isRequired, onLogout: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; handleLogout = () => { this.props.onLogout(); } render () { const { intl } = this.props; let menu = []; menu.push({ text: intl.formatMessage(messages.edit_profile), href: '/settings/profile' }); menu.push({ text: intl.formatMessage(messages.preferences), href: '/settings/preferences' }); menu.push({ text: intl.formatMessage(messages.pins), to: '/pinned' }); menu.push(null); menu.push({ text: intl.formatMessage(messages.follow_requests), to: '/follow_requests' }); menu.push({ text: intl.formatMessage(messages.favourites), to: '/favourites' }); menu.push({ text: intl.formatMessage(messages.bookmarks), to: '/bookmarks' }); menu.push({ text: intl.formatMessage(messages.lists), to: '/lists' }); menu.push(null); menu.push({ text: intl.formatMessage(messages.mutes), to: '/mutes' }); menu.push({ text: intl.formatMessage(messages.blocks), to: '/blocks' }); menu.push({ text: intl.formatMessage(messages.domain_blocks), to: '/domain_blocks' }); menu.push({ text: intl.formatMessage(messages.filters), href: '/filters' }); menu.push(null); menu.push({ text: intl.formatMessage(messages.logout), action: this.handleLogout }); return ( <div className='compose__action-bar'> <div className='compose__action-bar-dropdown'> <DropdownMenuContainer items={menu} icon='chevron-down' size={16} direction='right' /> </div> </div> ); } }
jenkins-design-language/src/js/components/material-ui/svg-icons/av/queue-music.js
alvarolobato/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const AvQueueMusic = (props) => ( <SvgIcon {...props}> <path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z"/> </SvgIcon> ); AvQueueMusic.displayName = 'AvQueueMusic'; AvQueueMusic.muiName = 'SvgIcon'; export default AvQueueMusic;
app/javascript/mastodon/components/status_list.js
PlantsNetwork/mastodon
import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import StatusContainer from '../containers/status_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ScrollableList from './scrollable_list'; import { FormattedMessage } from 'react-intl'; export default class StatusList extends ImmutablePureComponent { static propTypes = { scrollKey: PropTypes.string.isRequired, statusIds: ImmutablePropTypes.list.isRequired, featuredStatusIds: ImmutablePropTypes.list, onLoadMore: PropTypes.func, onScrollToTop: PropTypes.func, onScroll: PropTypes.func, trackScroll: PropTypes.bool, shouldUpdateScroll: PropTypes.func, isLoading: PropTypes.bool, isPartial: PropTypes.bool, hasMore: PropTypes.bool, prepend: PropTypes.node, emptyMessage: PropTypes.node, }; static defaultProps = { trackScroll: true, }; handleMoveUp = id => { const elementIndex = this.props.statusIds.indexOf(id) - 1; this._selectChild(elementIndex); } handleMoveDown = id => { const elementIndex = this.props.statusIds.indexOf(id) + 1; this._selectChild(elementIndex); } _selectChild (index) { const element = this.node.node.querySelector(`article:nth-of-type(${index + 1}) .focusable`); if (element) { element.focus(); } } setRef = c => { this.node = c; } render () { const { statusIds, featuredStatusIds, ...other } = this.props; const { isLoading, isPartial } = other; if (isPartial) { return ( <div className='regeneration-indicator'> <div> <div className='regeneration-indicator__figure' /> <div className='regeneration-indicator__label'> <FormattedMessage id='regeneration_indicator.label' tagName='strong' defaultMessage='Loading&hellip;' /> <FormattedMessage id='regeneration_indicator.sublabel' defaultMessage='Your home feed is being prepared!' /> </div> </div> </div> ); } let scrollableContent = (isLoading || statusIds.size > 0) ? ( statusIds.map(statusId => ( <StatusContainer key={statusId} id={statusId} onMoveUp={this.handleMoveUp} onMoveDown={this.handleMoveDown} /> )) ) : null; if (scrollableContent && featuredStatusIds) { scrollableContent = featuredStatusIds.map(statusId => ( <StatusContainer key={`f-${statusId}`} id={statusId} featured onMoveUp={this.handleMoveUp} onMoveDown={this.handleMoveDown} /> )).concat(scrollableContent); } return ( <ScrollableList {...other} ref={this.setRef}> {scrollableContent} </ScrollableList> ); } }
examples/counter/containers/App.js
nikgraf/redux-devtools
import React, { Component } from 'react'; import CounterApp from './CounterApp'; import { createStore, applyMiddleware, combineReducers, compose } from 'redux'; import { devTools, persistState } from 'redux-devtools'; import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react'; import thunk from 'redux-thunk'; import { Provider } from 'react-redux'; import * as reducers from '../reducers'; const finalCreateStore = compose( applyMiddleware(thunk), devTools(), persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)) )(createStore); const reducer = combineReducers(reducers); const store = finalCreateStore(reducer); if (module.hot) { module.hot.accept('../reducers', () => store.replaceReducer(combineReducers(require('../reducers'))) ); } export default class App extends Component { render() { return ( <div> <Provider store={store}> {() => <CounterApp />} </Provider> <DebugPanel top right bottom> <DevTools store={store} monitor={LogMonitor} visibleOnLoad={true} /> </DebugPanel> </div> ); } }
src/main/webapp/resources/modules/home/MainTabs.js
cwoolner/flex-poker
import React from 'react' import { useSelector } from 'react-redux' import _ from 'lodash' import { BrowserRouter } from 'react-router-dom' import { Redirect, Route, Switch } from 'react-router' import GameTabs from './GameTabs' import Lobby from '../lobby/Lobby' import GamePage from '../game/GamePage' import TablePage from '../table/TablePage' import Logout from './Logout' import Chat from './Chat' export default () => { const redirectUrl = useSelector(state => state.redirectUrl) return ( <BrowserRouter> <div> <GameTabs /> <Switch> <Route exact path="/" component={Lobby} /> <Route exact path="/game/:gameId" component={GamePage} /> <Route exact path="/game/:gameId/table/:tableId" component={TablePage} /> <Route exact path="/logout" component={Logout} /> </Switch> {_.isNil(redirectUrl) ? null : <Redirect to={redirectUrl} />} <Chat /> </div> </BrowserRouter> ) }
src/components/estate-list.js
alexandrudanpop/EstatesWebApp
import React, { Component } from 'react'; import EstateListItem from './estate-list-item' import styles from './index.scss' import Blazy from 'blazy' class EstateList extends Component { renderItems() { if (!this.props.estates) { return } // used to lazy load images const bLazy = new Blazy({}); return this.props.estates.map(estate => { return ( <EstateListItem key={estate.id} estate={estate} deleteEstate={this.props.deleteEstate} editEstate={this.props.editEstate} cancel={this.props.cancel} showImages={this.props.showImages} showDetails={this.props.showDetails} /> ) }) } render() { return ( <div className='container'> <div className={styles['featured-block']}> <div className='row'> {this.renderItems()} </div> </div> </div> ); } } export default EstateList;
dashboard-ui/app/components/appSelected.js
CloudBoost/cloudboost
/** * Created by Darkstar on 11/30/2016. */ 'use strict'; import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { manageApp, changeState } from '../actions'; const ReactRouter = require('react-router'); const browserHistory = ReactRouter.browserHistory; export class AppSelected extends React.Component { static propTypes = { apps: PropTypes.any, isAppActive: PropTypes.any, params: PropTypes.any, routes: PropTypes.any, dispatch: PropTypes.any, openDrawer: PropTypes.any, children: PropTypes.any } constructor (props) { super(props); this.state = { selected: 'settings', isAppDisabled: false }; } static get contextTypes () { return { router: React.PropTypes.object.isRequired }; } componentWillMount () { // if no app data is found in memory , then find the app and set that data if (this.props.isAppActive === false) { let appFound = false; this.props.apps.map((app) => { if (app.appId === this.props.params.appId) { appFound = true; this.setState({ isAppDisabled: app.disabled }); // save app data in memory this.props.dispatch(manageApp(app.appId, app.keys.master, app.keys.js, app.name)); } }); // if app not found , send back to home page if (!appFound) { browserHistory.push(window.DASHBOARD_BASE_URL); } } } componentWillReceiveProps (props) { // select nav button wrt to path if (props.routes[2].path) { this.setState({ selected: props.routes[2].path }); } } redirectTo = (where) => () => { this.context.router.push('/' + this.props.params.appId + '/' + where); this.props.dispatch(changeState(where, this.props.openDrawer)); } openFiles = () => { let url = window.DASHBOARD_BASE_URL + '/' + this.props.params.appId + '/files'; var win = window.open(url, '_self'); win.focus(); } openAnalytics = () => { let url = window.ANALYTICS_URL + '/' + this.props.params.appId; var win = window.open(url, '_blank'); win.focus(); } render () { return ( <div className='push-campaign'> <div className='panel menu-panel'> <div className='menu-wrapper'> <div className='panel-menu'> <ul> <li style={this.state.isAppDisabled ? { cursor: 'not-allowed' } : null} className={this.state.selected === 'tables' ? 'active' : ''} onClick={!this.state.isAppDisabled && this.redirectTo('tables')}> <i className='fa fa-bars' id='tablesIcon' aria-hidden='true' /> &nbsp;Tables </li> <li style={this.state.isAppDisabled ? { cursor: 'not-allowed' } : null} className={this.state.selected === 'files' ? 'active' : ''} onClick={!this.state.isAppDisabled && this.redirectTo('files')}> <i className='fa fa-file' id='filesIcon' aria-hidden='true' /> &nbsp;Files </li> {/* <li className={this.state.selected === "push" ? "active" : ""} onClick={this.redirectTo.bind(this, 'push')}> <i className="fa fa-bell-o " /> &nbsp;Push Notifications </li> <li className={this.state.selected === "email" ? "active" : ""} onClick={this.redirectTo.bind(this, 'email')}> <i className="fa fa-envelope-o" /> &nbsp;Email Campaign </li> */} <li className={this.state.selected === 'settings' ? 'active' : ''} onClick={this.redirectTo('settings')}> <i className='fa fa-cog ' id='settingsIcon' /> &nbsp;Settings </li> {/* <li className={this.state.selected === "queue" ? "active" : ""} onClick={this.redirectTo.bind(this, 'queue')}> <i className="fa fa-exchange" /> &nbsp;Queue </li> <li className={this.state.selected === "cache" ? "active " : ""} onClick={this.redirectTo.bind(this, 'cache')}> <i className="fa fa-bolt" /> &nbsp;Cache </li> <li className={this.state.selected === "analytics" ? "active" : ""} onClick={this.redirectTo.bind(this, 'analytics')}> <i className="fa fa-bar-chart " /> &nbsp;Usage </li> <li className={this.state.selected === "appAnalytics" ? "active" : ""} onClick={this.openAnalytics.bind(this)}> <i className="fa fa-bar-chart "/> &nbsp;App Analytics </li> */} </ul> </div> <div className='panel-content'> {this.props.isAppActive && this.props.children} </div> </div> </div> </div> ); } } const mapStateToProps = (state) => { let isAppActive = state.manageApp.viewActive || false; return { apps: state.apps || [], isAppActive, openDrawer: state.drawer.openDrawer }; }; export default connect(mapStateToProps, null)(AppSelected);
react-flux-mui/js/material-ui/src/svg-icons/image/filter-3.js
pbogdan/react-flux-mui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageFilter3 = (props) => ( <SvgIcon {...props}> <path d="M21 1H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zM3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm14 8v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V7c0-1.11-.9-2-2-2h-4v2h4v2h-2v2h2v2h-4v2h4c1.1 0 2-.89 2-2z"/> </SvgIcon> ); ImageFilter3 = pure(ImageFilter3); ImageFilter3.displayName = 'ImageFilter3'; ImageFilter3.muiName = 'SvgIcon'; export default ImageFilter3;
app/javascript/mastodon/components/avatar_composite.js
musashino205/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { autoPlayGif } from '../initial_state'; export default class AvatarComposite extends React.PureComponent { static propTypes = { accounts: ImmutablePropTypes.list.isRequired, animate: PropTypes.bool, size: PropTypes.number.isRequired, }; static defaultProps = { animate: autoPlayGif, }; renderItem (account, size, index) { const { animate } = this.props; let width = 50; let height = 100; let top = 'auto'; let left = 'auto'; let bottom = 'auto'; let right = 'auto'; if (size === 1) { width = 100; } if (size === 4 || (size === 3 && index > 0)) { height = 50; } if (size === 2) { if (index === 0) { right = '1px'; } else { left = '1px'; } } else if (size === 3) { if (index === 0) { right = '1px'; } else if (index > 0) { left = '1px'; } if (index === 1) { bottom = '1px'; } else if (index > 1) { top = '1px'; } } else if (size === 4) { if (index === 0 || index === 2) { right = '1px'; } if (index === 1 || index === 3) { left = '1px'; } if (index < 2) { bottom = '1px'; } else { top = '1px'; } } const style = { left: left, top: top, right: right, bottom: bottom, width: `${width}%`, height: `${height}%`, backgroundSize: 'cover', backgroundImage: `url(${account.get(animate ? 'avatar' : 'avatar_static')})`, }; return ( <div key={account.get('id')} style={style} /> ); } render() { const { accounts, size } = this.props; return ( <div className='account__avatar-composite' style={{ width: `${size}px`, height: `${size}px` }}> {accounts.take(4).map((account, i) => this.renderItem(account, Math.min(accounts.size, 4), i))} {accounts.size > 4 && ( <span className='account__avatar-composite__label'> +{accounts.size - 4} </span> )} </div> ); } }
actor-apps/app-web/src/app/components/modals/Contacts.react.js
Ajunboys/actor-platform
// // Deprecated // import _ from 'lodash'; import React from 'react'; import { PureRenderMixin } from 'react/addons'; import ContactActionCreators from 'actions/ContactActionCreators'; import DialogActionCreators from 'actions/DialogActionCreators'; import ContactStore from 'stores/ContactStore'; import Modal from 'react-modal'; import AvatarItem from 'components/common/AvatarItem.react'; let appElement = document.getElementById('actor-web-app'); Modal.setAppElement(appElement); let getStateFromStores = () => { return { contacts: ContactStore.getContacts(), isShown: ContactStore.isContactsOpen() }; }; class Contacts extends React.Component { componentWillMount() { ContactStore.addChangeListener(this._onChange); } componentWillUnmount() { ContactStore.removeChangeListener(this._onChange); } constructor() { super(); this._onClose = this._onClose.bind(this); this._onChange = this._onChange.bind(this); this.state = getStateFromStores(); } _onChange() { this.setState(getStateFromStores()); } _onClose() { ContactActionCreators.hideContactList(); } render() { let contacts = this.state.contacts; let isShown = this.state.isShown; let contactList = _.map(contacts, (contact, i) => { return ( <Contacts.ContactItem contact={contact} key={i}/> ); }); if (contacts !== null) { return ( <Modal className="modal contacts" closeTimeoutMS={150} isOpen={isShown}> <header className="modal__header"> <a className="modal__header__close material-icons" onClick={this._onClose}>clear</a> <h3>Contact list</h3> </header> <div className="modal__body"> <ul className="contacts__list"> {contactList} </ul> </div> </Modal> ); } else { return (null); } } } Contacts.ContactItem = React.createClass({ propTypes: { contact: React.PropTypes.object }, mixins: [PureRenderMixin], _openNewPrivateCoversation() { DialogActionCreators.selectDialogPeerUser(this.props.contact.uid); ContactActionCreators.hideContactList(); }, render() { let contact = this.props.contact; return ( <li className="contacts__list__item row"> <AvatarItem image={contact.avatar} placeholder={contact.placeholder} size="small" title={contact.name}/> <div className="col-xs"> <span className="title"> {contact.name} </span> </div> <div className="controls"> <a className="material-icons" onClick={this._openNewPrivateCoversation}>message</a> </div> </li> ); } }); export default Contacts;
app/javascript/mastodon/features/compose/components/search.js
gol-cha/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Overlay from 'react-overlays/lib/Overlay'; import Motion from '../../ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; import { searchEnabled } from '../../../initial_state'; import Icon from 'mastodon/components/icon'; const messages = defineMessages({ placeholder: { id: 'search.placeholder', defaultMessage: 'Search' }, }); class SearchPopout extends React.PureComponent { static propTypes = { style: PropTypes.object, }; render () { const { style } = this.props; const extraInformation = searchEnabled ? <FormattedMessage id='search_popout.tips.full_text' defaultMessage='Simple text returns statuses you have written, favourited, boosted, or have been mentioned in, as well as matching usernames, display names, and hashtags.' /> : <FormattedMessage id='search_popout.tips.text' defaultMessage='Simple text returns matching display names, usernames and hashtags' />; return ( <div style={{ ...style, position: 'absolute', width: 285, zIndex: 2 }}> <Motion defaultStyle={{ opacity: 0, scaleX: 0.85, scaleY: 0.75 }} style={{ opacity: spring(1, { damping: 35, stiffness: 400 }), scaleX: spring(1, { damping: 35, stiffness: 400 }), scaleY: spring(1, { damping: 35, stiffness: 400 }) }}> {({ opacity, scaleX, scaleY }) => ( <div className='search-popout' style={{ opacity: opacity, transform: `scale(${scaleX}, ${scaleY})` }}> <h4><FormattedMessage id='search_popout.search_format' defaultMessage='Advanced search format' /></h4> <ul> <li><em>#example</em> <FormattedMessage id='search_popout.tips.hashtag' defaultMessage='hashtag' /></li> <li><em>@username@domain</em> <FormattedMessage id='search_popout.tips.user' defaultMessage='user' /></li> <li><em>URL</em> <FormattedMessage id='search_popout.tips.user' defaultMessage='user' /></li> <li><em>URL</em> <FormattedMessage id='search_popout.tips.status' defaultMessage='status' /></li> </ul> {extraInformation} </div> )} </Motion> </div> ); } } export default @injectIntl class Search extends React.PureComponent { static contextTypes = { router: PropTypes.object.isRequired, }; static propTypes = { value: PropTypes.string.isRequired, submitted: PropTypes.bool, onChange: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired, onClear: PropTypes.func.isRequired, onShow: PropTypes.func.isRequired, openInRoute: PropTypes.bool, intl: PropTypes.object.isRequired, singleColumn: PropTypes.bool, }; state = { expanded: false, }; setRef = c => { this.searchForm = c; } handleChange = (e) => { this.props.onChange(e.target.value); } handleClear = (e) => { e.preventDefault(); if (this.props.value.length > 0 || this.props.submitted) { this.props.onClear(); } } handleKeyUp = (e) => { if (e.key === 'Enter') { e.preventDefault(); this.props.onSubmit(); if (this.props.openInRoute) { this.context.router.history.push('/search'); } } else if (e.key === 'Escape') { document.querySelector('.ui').parentElement.focus(); } } handleFocus = () => { this.setState({ expanded: true }); this.props.onShow(); if (this.searchForm && !this.props.singleColumn) { const { left, right } = this.searchForm.getBoundingClientRect(); if (left < 0 || right > (window.innerWidth || document.documentElement.clientWidth)) { this.searchForm.scrollIntoView(); } } } handleBlur = () => { this.setState({ expanded: false }); } render () { const { intl, value, submitted } = this.props; const { expanded } = this.state; const hasValue = value.length > 0 || submitted; return ( <div className='search'> <label> <span style={{ display: 'none' }}>{intl.formatMessage(messages.placeholder)}</span> <input ref={this.setRef} className='search__input' type='text' placeholder={intl.formatMessage(messages.placeholder)} value={value} onChange={this.handleChange} onKeyUp={this.handleKeyUp} onFocus={this.handleFocus} onBlur={this.handleBlur} /> </label> <div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}> <Icon id='search' className={hasValue ? '' : 'active'} /> <Icon id='times-circle' className={hasValue ? 'active' : ''} aria-label={intl.formatMessage(messages.placeholder)} /> </div> <Overlay show={expanded && !hasValue} placement='bottom' target={this}> <SearchPopout /> </Overlay> </div> ); } }
components/BtnGroup/BtnGroup.story.js
rdjpalmer/bloom
import React from 'react'; import { storiesOf } from '@storybook/react'; import cx from 'classnames'; import Medallion from '../Medallion/Medallion'; import m from '../../globals/modifiers.css'; import BtnGroup from './BtnGroup'; import Icon from '../Icon/Icon'; import Btn from '../Btn/Btn'; storiesOf('BtnGroup', module) .add('Default Button Group', () => ( <BtnGroup> <Btn> <Icon className={ m.mrRegular } name="filter" /> Filters <Medallion className={ cx(m.mlRegular, m.fr) }>1</Medallion> </Btn> <Btn> <Icon className={ m.mrRegular } name="map" /> Map </Btn> <Btn> <Icon className={ m.mrRegular } name="bogroll" /> Flush </Btn> </BtnGroup> )) .add('Primary Button Group', () => ( <BtnGroup context="primary"> <Btn> <Icon className={ m.mrRegular } name="filter" /> Filters <Medallion className={ cx(m.mlRegular, m.fr) }>1</Medallion> </Btn> <Btn> <Icon className={ m.mrRegular } name="map" /> Map </Btn> <Btn> <Icon className={ m.mrRegular } name="bogroll" /> Flush </Btn> </BtnGroup> )) .add('Action Button Group', () => ( <BtnGroup context="action"> <Btn> <Icon className={ m.mrRegular } name="filter" /> Filters <Medallion className={ cx(m.mlRegular, m.fr) }>12</Medallion> </Btn> <Btn> <Icon className={ m.mrRegular } name="map" /> Map </Btn> <Btn> <Icon className={ m.mrRegular } name="bogroll" /> Flush </Btn> </BtnGroup> )) .add('Danger Button Group', () => ( <BtnGroup context="danger"> <Btn> <Icon className={ m.mrRegular } name="filter" /> Filters <Medallion className={ cx(m.mlRegular, m.fr) }>124</Medallion> </Btn> <Btn> <Icon className={ m.mrRegular } name="map" /> Map </Btn> <Btn> <Icon className={ m.mrRegular } name="bogroll" /> Flush </Btn> </BtnGroup> )) .add('Whiteout Button Group', () => ( <BtnGroup context="whiteout"> <Btn> <Icon className={ m.mrRegular } name="filter" /> Filters <Medallion variant="dark" className={ cx(m.mlRegular, m.fr) }>9001</Medallion> </Btn> <Btn> <Icon className={ m.mrRegular } name="map" /> Map </Btn> <Btn> <Icon className={ m.mrRegular } name="bogroll" /> Flush </Btn> </BtnGroup> )) .add('High priority Button Group', () => ( <BtnGroup priority="high"> <Btn> <Icon className={ m.mrRegular } name="filter" /> Filters <Medallion className={ cx(m.mlRegular, m.fr) }>1</Medallion> </Btn> <Btn> <Icon className={ m.mrRegular } name="map" /> Map </Btn> <Btn> <Icon className={ m.mrRegular } name="bogroll" /> Flush </Btn> </BtnGroup> ));
src/jsx/components/OwlCarousel.js
jsmankoo/coastalluxe
'use strict'; import React from 'react'; import {findDOMNode} from 'react-dom'; /** * http://owlgraphic.com/owlcarousel/demos/one.html * * Props * items: number. This variable allows you to set the maximum amount of items displayed at a time with the widest browser width * itemsDesktop: array. This allows you to preset the number of slides visible with a particular browser width. * The format is [x,y] whereby x=browser width and y=number of slides displayed. * For example [1199,4] means that if(window<=1199){ show 4 slides per page} * Alternatively use itemsDesktop: false to override these settings. * itemsDesktopSmall: array. As above. * itemsTablet: array. As above. * itemsTabletSmall: array. As above. Default value is disabled. * itemsMobile: array. As above. * itemsCustom: array. This allow you to add custom variations of items depending from the width * If this option is set, itemsDeskop, itemsDesktopSmall, itemsTablet, itemsMobile etc. are disabled * For better preview, order the arrays by screen size, but it's not mandatory * Don't forget to include the lowest available screen size, otherwise it will take the default one for screens lower than lowest available. * Example: [[0, 2], [400, 4], [700, 6], [1000, 8], [1200, 10], [1600, 16]] * singleItem : , * itemsScaleUp: boolean. Option to not stretch items when it is less than the supplied items. * slideSpeed: number. Slide speed in milliseconds. * paginationSpeed: number. Pagination speed in milliseconds. * rewindNav: boolean. Slide to first item. Use rewindSpeed to change animation speed. * rewindSpeed: number. Rewind speed in milliseconds. * autoPlay: boolean. Change to any integrer for example autoPlay : 5000 to play every 5 seconds. * If you set autoPlay: true default speed will be 5 seconds. * stopOnHover: boolean. Stop autoplay on mouse hover. * navigation: boolean. Display "next" and "prev" buttons. * navigationText: array of element | boolean. You can customize your own navigation. * To get empty buttons use navigationText : false. Also HTML can be used here. * scrollPerPage: boolean. Scroll per page not per item. This affect next/prev buttons and mouse/touch dragging. * pagination: boolean. Show pagination. * paginationNumbers: boolean. Show numbers inside pagination buttons * responsive: boolean. Change that to "false" to disable resposive capabilities * responsiveRefreshRate: number. Check window width changes every 200ms for responsive actions * responsiveBaseWidth: jQuery selector. Owl Carousel check window for browser width changes. * baseClass: string. Automaticly added class for base CSS styles. * theme: string. Default Owl CSS styles for navigation and buttons. Change it to match your own theme. * lazyLoad: boolean. Delays loading of images. Images outside of viewport won't be loaded before user scrolls to them. * Great for mobile devices to speed up page loadings. IMG need special markup class="lazyOwl" and data-src="your img path". * lazyFollow: boolean. When pagination used, it skips loading the images from pages that got skipped. * It only loads the images that get displayed in viewport. * If set to false, all images get loaded when pagination used. It is a sub setting of the lazy load function. * lazyEffect: boolean / one of "fade", , Default is fadeIn on 400ms speed. Use false to remove that effect. * autoHeight: boolean. Add height to owl-wrapper-outer so you can use diffrent heights on slides. Use it only for one item per page setting. * jsonPath: string. Allows you to load directly from a jSon file. * The JSON structure you use needs to match the owl JSON structure used here. To use custom JSON structure see jsonSuccess option. * jsonSuccess: function. Success callback for $.getJSON build in into carousel. * dragBeforeAnimFinish: boolean. Ignore whether a transition is done or not (only dragging). * mouseDrag: boolean. Turn off/on mouse events. * touchDrag: boolean. Turn off/on touch events. * addClassActive: boolean. Add "active" classes on visible items. Works with any numbers of items on screen. * transitionStyle: string. Add CSS3 transition style. Works only with one item on screen. * * Method * next() * prev() * goTo(x) * jumpTo(x) * play() * stop() */ const OwlCarousel = React.createClass({ getDefaultProps() { return { options : {}, style : {}, }; }, propTypes: { children : React.PropTypes.oneOfType([ React.PropTypes.element, React.PropTypes.arrayOf(React.PropTypes.element.isRequired), ]).isRequired, style : React.PropTypes.object, id : React.PropTypes.string, options : React.PropTypes.shape({ items : React.PropTypes.number, itemsCustom : React.PropTypes.arrayOf(React.PropTypes.arrayOf(React.PropTypes.number).isRequired), itemsDesktop : React.PropTypes.arrayOf(React.PropTypes.number.isRequired), itemsDesktopSmall : React.PropTypes.arrayOf(React.PropTypes.number.isRequired), itemsTablet : React.PropTypes.arrayOf(React.PropTypes.number.isRequired), itemsTabletSmall : React.PropTypes.arrayOf(React.PropTypes.number.isRequired), itemsMobile : React.PropTypes.arrayOf(React.PropTypes.number.isRequired), singleItem : React.PropTypes.bool, itemsScaleUp : React.PropTypes.bool, slideSpeed : React.PropTypes.number, paginationSpeed : React.PropTypes.number, rewindSpeed : React.PropTypes.number, autoPlay : React.PropTypes.oneOfType([ React.PropTypes.bool, React.PropTypes.number, ]), stopOnHover : React.PropTypes.bool, navigation : React.PropTypes.bool, navigationText : React.PropTypes.arrayOf(React.PropTypes.string), rewindNav : React.PropTypes.bool, scrollPerPage : React.PropTypes.bool, pagination : React.PropTypes.bool, paginationNumbers : React.PropTypes.bool, responsive : React.PropTypes.bool, responsiveRefreshRate : React.PropTypes.number, responsiveBaseWidth : function(props, propName, componentName) { if ( props[propName] && !$(props[propName]).length ) { return new Error('React-owl-carousel: the props `responsiveBaseWidth` needs jQuery selector.'); } }, baseClass : React.PropTypes.string, theme : React.PropTypes.string, lazyLoad : React.PropTypes.bool, lazyFollow : React.PropTypes.bool, lazyEffect : React.PropTypes.bool, autoHeight : React.PropTypes.bool, jsonPath : React.PropTypes.string, jsonSuccess : React.PropTypes.func, dragBeforeAnimFinish : React.PropTypes.bool, mouseDrag : React.PropTypes.bool, touchDrag : React.PropTypes.bool, addClassActive : React.PropTypes.bool, //build-in transitionStyle: 'fade', 'backSlide', 'goDown', 'scaleUp' transitionStyle : React.PropTypes.string, beforeUpdate : React.PropTypes.func, afterUpdate : React.PropTypes.func, beforeInit : React.PropTypes.func, afterInit : React.PropTypes.func, beforeMove : React.PropTypes.func, afterMove : React.PropTypes.func, afterAction : React.PropTypes.func, startDragging : React.PropTypes.func, afterLazyLoad: React.PropTypes.func, }), }, componentDidMount() { $(findDOMNode(this)).owlCarousel(this.props.options); }, componentWillReceiveProps(nextProps) { $(findDOMNode(this)).data('owlCarousel').destroy(); }, componentDidUpdate(prevProps, prevState) { $(findDOMNode(this)).owlCarousel(this.props.options); }, componentWillUnmount() { $(findDOMNode(this)).data('owlCarousel').destroy(); }, render() { // this.props.options.touchDrag !== false // ? React.initializeTouchEvents(true) // : React.initializeTouchEvents(false); return ( <div id={this.props.id} style={this.props.style}> {this.props.children} </div> ); }, next() { $(findDOMNode(this)).data('owlCarousel').next(); }, prev() { $(findDOMNode(this)).data('owlCarousel').prev(); }, // Go to x slide goTo(x) { $(findDOMNode(this)).data('owlCarousel').goTo(x); }, // Go to x slide without slide animation jumpTo(x) { $(findDOMNode(this)).data('owlCarousel').jumpTo(x); }, play() { $(findDOMNode(this)).data('owlCarousel').play(); }, stop() { $(findDOMNode(this)).data('owlCarousel').stop(); }, }); module.exports = OwlCarousel;
docs/Documentation/RadioButtonPage.js
reactivers/react-material-design
/** * Created by muratguney on 29/03/2017. */ import React from 'react'; import {Card, CardHeader,RadioButton,Table, TableRow, TableHeaderColumn, TableHeader, TableRowColumn, TableBody} from '../../lib'; import HighLight from 'react-highlight.js' export default class RadioButtonPage extends React.Component { render() { let document = ` import React from "react"; import {RadioButton} from "react-material-design"; export default class Example extends React.Component { render() { return ( <div style={{display: "flex" }}> <RadioButton name="same" label="Same 1" setChecked={true}/> <RadioButton name="same" label="Same 2"/> <RadioButton name="different 1" label="Different 1"/> <RadioButton name="different 2" label="Different 2" setDisabled={true}/> </div> ) } }`; return ( <Card style={{padding: 8}}> <CardHeader title="Radio Button"/> <div style={{display:"flex"}}> <RadioButton name={"same"} setChecked={true} label="Same 1"/> <RadioButton name={"same"} label="Same 2"/> <RadioButton name={"different 1"} label="Different 1"/> <RadioButton name={"different 2"} setDisabled={true} label="Different 2" /> </div> <HighLight source="javascript"> {document} </HighLight> <CardHeader title="RadioButton properties"/> <Table> <TableHeader> <TableRow> <TableHeaderColumn>Props</TableHeaderColumn> <TableHeaderColumn>Type</TableHeaderColumn> <TableHeaderColumn>Description</TableHeaderColumn> </TableRow> </TableHeader> <TableBody> <TableRow> <TableRowColumn>className</TableRowColumn> <TableRowColumn>String</TableRowColumn> <TableRowColumn>You can add your ownd css classes</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>style</TableRowColumn> <TableRowColumn>Object</TableRowColumn> <TableRowColumn>You can add your own css inline-style</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>label</TableRowColumn> <TableRowColumn>String</TableRowColumn> <TableRowColumn>Label for radio button.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>onChange</TableRowColumn> <TableRowColumn>Function</TableRowColumn> <TableRowColumn>Gives the value of selected radio button.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>isChecked</TableRowColumn> <TableRowColumn>Function</TableRowColumn> <TableRowColumn>Gives the checked/unchecked of selected radio button..</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>isDisabled</TableRowColumn> <TableRowColumn>Function</TableRowColumn> <TableRowColumn>Gives the disabled/enabled of selected radio button..</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>setChecked</TableRowColumn> <TableRowColumn>Boolean</TableRowColumn> <TableRowColumn>Set selected/unselected radio button.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>setDisabled</TableRowColumn> <TableRowColumn>Boolean</TableRowColumn> <TableRowColumn>Set disabled/enabled radio button.</TableRowColumn> </TableRow> <TableRow> <TableRowColumn>name</TableRowColumn> <TableRowColumn>String</TableRowColumn> <TableRowColumn>Name of radio buttons. If two radio button's name are same then you check only one of them.</TableRowColumn> </TableRow> </TableBody> </Table> </Card> ) } }
src/components/projects/index.js
Adutchguy/portfolio
import './_projects.scss'; import Slider from 'react-slick'; import superagent from 'superagent'; import React, { Component } from 'react'; import Project from './project'; class Projects extends React.Component { constructor(props) { super(props); this.state = { reposToRequest: [ { name: 'Adutchguy/portfolio', deployed_url: 'https://michael-miller-portfolio.herokuapp.com/', }, { name: 'Adutchguy/ibcf-music-frontend', deployed_url: 'https://ibcf.herokuapp.com/', }, { name: 'Adutchguy/ibcf-music-backend', }, { name: 'vagabond0079/casehawk-frontend', deployed_url: 'https://casehawk-frontend.herokuapp.com/', }, { name: 'vagabond0079/casehawk-backend', }, ], githubRepos: [], standardSettings: { slidesToShow: 2, arrows: true, infinite: true, autoplay: true, autoplaySpeed: 6000, speed: 500, pauseOnHover: true, draggable: false, swipe: false, }, mobileSettings: { slidesToShow: 1, arrows: true, infinite: true, autoplay: false, speed: 500, pauseOnHover: true, draggable: true, swipe: true, }, }; this.githubAllRepoRequest = this.githubAllRepoRequest.bind(this); } githubAllRepoRequest() { superagent('get', `${process.env.REACT_APP_GITHUB_URL}`) .set({'Authorization': `token ${process.env.REACT_APP_GITHUB_TOKEN}`}) .then((res) => { res.body.filter(repo => this.state.reposToRequest.map(item => {return item.name;}) .includes(repo.full_name) ? this.setState({githubRepos: [...this.state.githubRepos, repo]}) : null ); }) .catch(err => console.error(err)); } componentWillMount() { this.githubAllRepoRequest(); } render() { return ( <div className='projects-body'> <div className='projects-body'> <header className='projects-header'> <div> <h2>Projects</h2> </div> </header> <main className='projects-main'> <Slider {...this.props.windowWidth <= 1024 ? this.state.mobileSettings : this.state.standardSettings}> {this.state.githubRepos.map((repo,index) => { return( <div key={index}> <Project githubRepo={repo} reposToRequest={this.state.reposToRequest} /> </div> ); })} </Slider> </main> </div> </div> ); } } export default Projects;
src/svg-icons/av/pause-circle-outline.js
lawrence-yu/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvPauseCircleOutline = (props) => ( <SvgIcon {...props}> <path d="M9 16h2V8H9v8zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm1-4h2V8h-2v8z"/> </SvgIcon> ); AvPauseCircleOutline = pure(AvPauseCircleOutline); AvPauseCircleOutline.displayName = 'AvPauseCircleOutline'; AvPauseCircleOutline.muiName = 'SvgIcon'; export default AvPauseCircleOutline;
app/js/components/window/windowControls.js
Dennetix/Motwo
import React from 'react'; import autobind from 'autobind-decorator'; import radium from 'radium'; import { remote } from 'electron' import theme from '../../utils/theme'; @theme @radium export default class WindowControls extends React.Component { constructor(props) { super(props); remote.getCurrentWindow().removeAllListeners('maximize'); remote.getCurrentWindow().removeAllListeners('unmaximize'); remote.getCurrentWindow().on('maximize', () => {this.forceUpdate()}); remote.getCurrentWindow().on('unmaximize', () => {this.forceUpdate()}); } getStyle() { return { dragbar: { width: '100%', height: '3.5rem', position: 'fixed', top: 1, left: 0, WebkitAppRegion: 'drag', pointerEvents: 'none' }, controls: { position: 'fixed', top: '14px', right: '12px', WebkitAppRegion: 'no-drag' }, icon: { width: '25px', height: '25px', padding: '0 4px', opacity: '0.7', transition: 'opacity 0.15s', pointerEvents: 'visible', ':hover': { opacity: '1', cursor: 'pointer' } } }; } @autobind onMinimize() { remote.getCurrentWindow().minimize(); } @autobind onMaximizeRestore() { if(remote.getCurrentWindow().isMaximized()) remote.getCurrentWindow().restore(); else remote.getCurrentWindow().maximize(); } @autobind onClose() { remote.getCurrentWindow().close(); } render() { let style = this.getStyle(); return ( <div style={style.dragbar}> <div style={style.controls}> <img key="minimize" src={this.props.getThemeProp('iconWindowControlsMinimize', true)} style={style.icon} onClick={this.onMinimize} /> <img key="maximizeRestore" src={remote.getCurrentWindow().isMaximized() ? this.props.getThemeProp('iconWindowControlsRestore', true) : this.props.getThemeProp('iconWindowControlsMaximize', true)} style={style.icon} onClick={this.onMaximizeRestore} /> <img key="close" src={this.props.getThemeProp('iconWindowControlsClose', true)} style={style.icon} onClick={this.onClose} /> </div> </div> ); } }
stories/index.js
jedwards1211/resume
import React from 'react' import { storiesOf } from '@storybook/react' import Resume from '../src/Resume' import data from '../src/data' storiesOf('resume', module) .add('Resume', () => ( <Resume data={data} /> ))
src/components/News.js
vinhnglx/Dzone-news
import React from 'react'; let moment = require('moment'); class News extends React.Component { render() { let news = this.props.entry; let desc = news.description; let categories; categories = news.categories.map(function(category, index) { return ( <a href="javascript:void(0);" className="tag-name" key={index}> <span className="label label-default">{category}</span> </a> ) }); return ( <div> <div className="post-preview"> <a href={news.link} target="_blank"> <h2 className="post-title"> {news.title} </h2> <h5 className="post-subtitle" dangerouslySetInnerHTML={{__html: desc}}></h5> </a> <p> {categories} </p> <p className="post-meta">Posted by {news.author} on {moment(news.pubDate).format('YYYY-MM-DD hh:mm:ss')}</p> </div> <hr/> </div> ) } } export default News;
src/components/left_nav_trigger.js
pingf/BSIDK
import React from 'react'; import Radium from 'radium'; //import color from 'color'; import mui from 'material-ui'; let IconMenu = mui.IconMenu; let IconButton = mui.IconButton; const MenuItem = require('material-ui/lib/menus/menu-item'); class LeftNavTrigger extends React.Component { render() { let button = ( <IconButton iconClassName="fa fa-500px" tooltip="hello world"/> ); return ( <div> <IconMenu iconButtonElement={button} openDirection='bottom-right'> <MenuItem primaryText="Refresh"/> <MenuItem primaryText="Send feedback"/> <MenuItem primaryText="Settings"/> <MenuItem primaryText="Help"/> <MenuItem primaryText="Sign out"/> </IconMenu> </div> ); } } export default Radium(LeftNavTrigger);
src/PageHeader.js
Azerothian/react-bootstrap
import React from 'react'; import classNames from 'classnames'; const PageHeader = React.createClass({ render() { return ( <div {...this.props} className={classNames(this.props.className, 'page-header')}> <h1>{this.props.children}</h1> </div> ); } }); export default PageHeader;
src/Degrees.js
PythEch/ruc-scheduler
import React, { Component } from 'react'; import { observer } from 'mobx-react'; import store from './Store'; import { ListButton } from './ListButton'; const DEGREES = ["Bachelor", "Master's"]; const BACH_INDEX = DEGREES.indexOf("Bachelor"); const MASTERS_INDEX = DEGREES.indexOf("Master's"); @observer class DegreeListView extends Component { render() { return ( <ul> { DEGREES.map((degree, index) => { return ( <DegreeView key={ index } index={ index } text={ degree } /> ); }) } </ul> ); } } @observer class DegreeView extends ListButton { constructor(props) { super(props); this.indexProperty = 'degreeIndex'; this.className = 'degree'; this.isTopNode = true; } } export { BACH_INDEX, MASTERS_INDEX, DegreeListView };
frontend/src/app/containers/HomePageNoAddon.js
clouserw/testpilot
import React from 'react'; import MainInstallButton from '../components/MainInstallButton'; import ExperimentCardList from '../components/ExperimentCardList'; import LoadingPage from './LoadingPage'; import View from '../components/View'; export default class HomePageNoAddon extends React.Component { render() { const { experiments, isAfterCompletedDate } = this.props; if (experiments.length === 0) { return <LoadingPage />; } const currentExperiments = experiments.filter(x => !isAfterCompletedDate(x)); return ( <section data-hook="landing-page"> <View {...this.props}> <div className="split-banner responsive-content-wrapper"> <div className="copter-wrapper fly-up"> <div className="copter"></div> </div> <div className="intro-text"> <h2 className="banner"> <span data-l10n-id="landingIntroLead" className="block lead-in">Go beyond . . . </span> <span data-l10n-id="landingIntroOne" className="block">Test new features.</span> <span data-l10n-id="landingIntroTwo" className="block">Give your feedback.</span> <span data-l10n-id="landingIntroThree" className="block">Help build Firefox.</span> </h2> </div> </div> <div className="centered-banner responsive-content-wrapper"> <MainInstallButton {...this.props} eventCategory="HomePage Interactions" /> </div> <div className="transparent-container"> <div className="responsive-content-wrapper delayed-fade-in"> <h2 className="card-list-header" data-l10n-id="landingExperimentsTitle">Try out the latest experimental features</h2> <div data-hook="experiment-list"> <ExperimentCardList {...this.props} experiments={currentExperiments} eventCategory="HomePage Interactions" /> </div> </div> </div> <div className="responsive-content-wrapper delayed-fade-in"> <h2 className="card-list-header" data-l10n-id="landingCardListTitle">Get started in 3 easy steps</h2> <div id="how-to" className="card-list"> <div className="card"> <div className="card-icon add-on-icon large"></div> <div className="card-copy large" data-l10n-id="landingCardOne">Get the Test Pilot add-on</div> </div> <div className="card"> <div className="card-icon test-pilot-icon large"></div> <div className="card-copy large" data-l10n-id="landingCardTwo">Enable experimental features</div> </div> <div className="card"> <div className="card-icon chat-icon large"></div> <div className="card-copy large" data-l10n-id="landingCardThree">Tell us what you think</div> </div> </div> <div className="centered-banner responsive-content-wrapper"> <MainInstallButton {...this.props} eventCategory="HomePage Interactions" /> </div> </div> </View> </section> ); } } HomePageNoAddon.propTypes = { hasAddon: React.PropTypes.bool, isFirefox: React.PropTypes.bool, experiments: React.PropTypes.array, isAfterCompletedDate: React.PropTypes.func };
src/components/Views/WorkSingle/index.js
jmikrut/keen-2017
import React, { Component } from 'react'; import ViewWrap from '../../ViewWrap'; import DocumentMeta from 'react-document-meta'; import WorkContinue from '../../WorkContinue'; import TextBG from '../../Layout/TextBG'; import PageNotFound from '../PageNotFound'; import './WorkSingle.css'; import workContent from '../../../content/work'; class WorkSingle extends Component { constructor(props) { super(props); this.active = this.props.match.params.work; this.workIndex = 0; this.work = workContent.find( (el, i) => { this.workIndex = i; return el.slug === this.props.match.params.work; } ); this.prevWork = workContent[(this.workIndex !== 0 ? this.workIndex - 1 : workContent.length - 1)]; this.nextWork = workContent[(this.workIndex !== workContent.length - 1 ? this.workIndex + 1 : 0)]; } shouldComponentUpdate(nextProps, nextState) { return false; } render() { if (this.work) { const meta = { title: `${this.work.title} - Keen Studio`, description: this.work.excerpt, meta: { name: { keywords: this.work.tags.join(', '), 'twitter:image:alt': this.work.excerpt }, property: { 'og:title': `Keen Studio - ${this.work.title}`, 'og:description': this.work.excerpt, 'og:image': this.work.bg, 'og:url': window.location.href } } } let Component = this.work.component; let colors = { primaryColor: this.work.primaryColor, secondaryColor: this.work.secondaryColor }; return ( <ViewWrap view="work-single"> <DocumentMeta {...meta} /> <div className="intro" style={{ backgroundImage: `url(${this.work.bg})`, color: this.work.primaryColor }} data-animate="1"> <h1> <TextBG {...colors}> {this.work.title} </TextBG> </h1> <div className="details"> <div className="type" data-animate="1"> <TextBG {...colors}> <label>Type</label> </TextBG> <p> <TextBG {...colors}> {this.work.tags.join(', ')} </TextBG> </p> </div> <div className="client" data-animate="2"> <TextBG {...colors}> <label>Client</label> </TextBG> <p> <TextBG {...colors}> {this.work.client} </TextBG> </p> </div> <div className="year" data-animate="3"> <TextBG {...colors}> <label>Year</label> </TextBG> <p> <TextBG {...colors}> {this.work.year} </TextBG> </p> </div> </div> </div> <Component {...colors} /> <WorkContinue prev={this.prevWork} next={this.nextWork} /> <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: ` { "@context": "http://schema.org", "@type": "Article", "image": "https://keen-studio.com/${this.work.bg}", "headline": "${this.work.title}", "about": "${this.work.excerpt}", "url": "https://keen-studio.com/work/${this.work.slug}", "sponsor": "${this.work.client}", "author": "${this.work.type.join(', ')}", "publisher": { "@type": "Organization", "name": "Keen", "logo": { "@type": "ImageObject", "url": "https://keen-studio.com/logo.png" } }, "datePublished": "${this.work.year}", "mainEntityOfPage": "https://keen-studio.com/work/${this.work.slug}" } ` }} /> </ViewWrap> ); } else { return <PageNotFound /> } } } export default WorkSingle;
components/CommitteeSpread.js
uclaacm/website
// import Image from 'next/image'; import React from 'react'; function Committee(props){ return ( <a className={`committee ${props.committee.class}`} href={`/committees#${props.committee.class}`} > {/* TODO: use next image without breaking deploy */} {/* eslint-disable-next-line @next/next/no-img-element */} <img src={props.committee.image} layout='fill' alt={`Logo and Wordmark for ACM ${props.committee.name}`} /> <div className="info"> <p>{props.committee.tagline}</p> </div> </a> ); } function CommitteeSpread(props){ return ( <div className="committees"> {props.committees.map( committee => <Committee key={committee.name} committee={committee} />, )} </div> ); } export default CommitteeSpread;
docs/src/app/components/pages/components/Chip/ExampleSimple.js
owencm/material-ui
import React from 'react'; import Avatar from 'material-ui/Avatar'; import Chip from 'material-ui/Chip'; import FontIcon from 'material-ui/FontIcon'; import SvgIconFace from 'material-ui/svg-icons/action/face'; import {blue300, indigo900} from 'material-ui/styles/colors'; const styles = { chip: { margin: 4, }, wrapper: { display: 'flex', flexWrap: 'wrap', }, }; function handleRequestDelete() { alert('You clicked the delete button.'); } function handleTouchTap() { alert('You clicked the Chip.'); } /** * Examples of Chips, using an image [Avatar](/#/components/font-icon), [Font Icon](/#/components/font-icon) Avatar, * [SVG Icon](/#/components/svg-icon) Avatar, "Letter" (string) Avatar, and with custom colors. * * Chips with the `onRequestDelete` property defined will display a delete icon. */ export default class ChipExampleSimple extends React.Component { render() { return ( <div style={styles.wrapper}> <Chip style={styles.chip} > Text Chip </Chip> <Chip onRequestDelete={handleRequestDelete} onTouchTap={handleTouchTap} style={styles.chip} > Deletable Text Chip </Chip> <Chip onTouchTap={handleTouchTap} style={styles.chip} > <Avatar src="images/uxceo-128.jpg" /> Image Avatar Chip </Chip> <Chip onRequestDelete={handleRequestDelete} onTouchTap={handleTouchTap} style={styles.chip} > <Avatar src="images/ok-128.jpg" /> Deletable Avatar Chip </Chip> <Chip onTouchTap={handleTouchTap} style={styles.chip} > <Avatar icon={<FontIcon className="material-icons">perm_identity</FontIcon>} /> FontIcon Avatar Chip </Chip> <Chip onRequestDelete={handleRequestDelete} onTouchTap={handleTouchTap} style={styles.chip} > <Avatar color="#444" icon={<SvgIconFace />} /> SvgIcon Avatar Chip </Chip> <Chip onTouchTap={handleTouchTap} style={styles.chip}> <Avatar size={32}>A</Avatar> Text Avatar Chip </Chip> <Chip backgroundColor={blue300} onRequestDelete={handleRequestDelete} onTouchTap={handleTouchTap} style={styles.chip} > <Avatar size={32} color={blue300} backgroundColor={indigo900}> MB </Avatar> Colored Chip </Chip> </div> ); } }
webapp/app/components/Save/Filters/Groups/index.js
EIP-SAM/SAM-Solution-Server
// // Filters page save // import React from 'react'; import { FormGroup, ControlLabel, FormControl, Col } from 'react-bootstrap'; import styles from 'components/Save/Filters/styles.css'; /* eslint-disable react/prefer-stateless-function */ export default class SaveFiltersGroups extends React.Component { constructor(props) { super(props); this.selectGroup = this.selectGroup.bind(this); } componentDidMount() { this.props.getGroupsRequest(); } selectGroup(e) { this.props.getCurrentGroup(e.target.value); this.props.filterUsers(this.props.currentTypeUser, e.target.value, this.props.allUsers); } render() { const selectGroups = []; selectGroups.push(<option key="option-all" value="All">All Groups</option>); if (this.props.groups !== undefined) { if (this.props.groups.length > 0) { this.props.groups.map((group, index) => ( selectGroups.push(<option key={`option-${index}`} value={group.name}>{group.name}</option>) )); } } return ( <FormGroup controlId="groups" bsSize="small"> <Col componentClass={ControlLabel} sm={2}> Groups : </Col> <Col sm={4}> <FormControl componentClass="select" className={styles.select} onChange={this.selectGroup}> {selectGroups} </FormControl> </Col> </FormGroup> ); } } SaveFiltersGroups.propTypes = { groups: React.PropTypes.arrayOf(React.PropTypes.object), currentTypeUser: React.PropTypes.string, allUsers: React.PropTypes.arrayOf(React.PropTypes.object), getCurrentGroup: React.PropTypes.func, getGroupsRequest: React.PropTypes.func, filterUsers: React.PropTypes.func, };
frontend/src/index.js
paulobichara/customers
import React from 'react'; import ReactDOM from 'react-dom'; import Main from './Main'; ReactDOM.render( <Main />, document.getElementById('root') );
node_modules/react-bootstrap/es/Jumbotron.js
joekay/awebb
import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import React from 'react'; import classNames from 'classnames'; import elementType from 'react-prop-types/lib/elementType'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var propTypes = { componentClass: elementType }; var defaultProps = { componentClass: 'div' }; var Jumbotron = function (_React$Component) { _inherits(Jumbotron, _React$Component); function Jumbotron() { _classCallCheck(this, Jumbotron); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Jumbotron.prototype.render = function render() { var _props = this.props, Component = _props.componentClass, className = _props.className, props = _objectWithoutProperties(_props, ['componentClass', 'className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = getClassSet(bsProps); return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) })); }; return Jumbotron; }(React.Component); Jumbotron.propTypes = propTypes; Jumbotron.defaultProps = defaultProps; export default bsClass('jumbotron', Jumbotron);
js/components/Home.js
htmlacademy/firstaidgit
import React from 'react'; import FilterableList from './FilterableList'; import Sidebar from './Sidebar'; require('es6-promise').polyfill(); let Home = React.createClass({ getInitialState() { return { data: [] }; }, componentDidMount() { var self = this; if (this.isMounted()) { fetch('./assets/posts.ru.json') .then(function(res) { res.headers['X-Request-URL'] = res.url; return res.json(); }).then(function(json) { self.setState({ data: json }); }).catch(function(err) { console.log(err); self.setErrorState(err); }); } }, setErrorState(error) { this.setState({ error: error }); }, render(error) { if (this.state.error) { var self = this; // Probably shouldn't be calling this directly. // TODO: Don't do it. setTimeout(function(){ self.componentDidMount(); }, 5000); return (<h1 className="error-state">Что-то пошло не так!</h1>); } // It's very bad that the Sidebar component is being injected here. // It should live completely separate from this component. return ( <section className="main-content"> <FilterableList data = { this.state.data } autofocus = "true" sidebar = {Sidebar} placeholder = "Чем вам помочь?" /> </section> ); } }); export default Home;
packages/@vega/communicator-system/src/components/views/CommunicatorWrapper.js
VegaPublish/vega-studio
// @flow import React from 'react' import styles from './styles/CommunicatorWrapper.css' import Communicator from '../providers/Communicator' type Props = { children: any[], focusedCommentId: string } export default class CommunicatorWrapper extends React.Component<Props> { render() { const {children, ...rest} = this.props return ( <div className={styles.root}> <div className={styles.content}>{children}</div> <div className={styles.communicator}> <Communicator {...rest} /> </div> </div> ) } }
src/assets/js/react/components/CoreFonts/CoreFontListSpacer.js
GravityPDF/gravity-forms-pdf-extended
import React from 'react' /** * @package Gravity PDF * @copyright Copyright (c) 2021, Blue Liquid Designs * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License * @since 5.0 */ /** * Display a spacer block * * @since 5.0 */ const CoreFontListSpacer = () => ( <div data-test='component-coreFontList-spacer' className='gfpdf-core-font-spacer'>---</div> ) export default CoreFontListSpacer
packages/wix-style-react/src/AvatarGroup/test/AvatarGroup.visual.js
wix/wix-style-react
import React from 'react'; import { snap, story, visualize } from 'storybook-snapper'; import AvatarGroup from '../AvatarGroup'; const commonProps = { items: [ { name: 'first user', color: 'A1' }, { name: 'second user', color: 'A2' }, { name: 'third avatar', color: 'A3' }, { name: 'fourth avatar', color: 'A4' }, { name: 'fifth avatar', color: 'A5' }, { name: 'sixth avatar', color: 'A6' }, { name: 'seventh avatar', color: 'A1' }, { name: 'eighth avatar', color: 'A2' }, { name: 'ninth avatar', color: 'A3' }, ], // use for repeated props across the tests (e.g. {buttonText: 'example'}) }; const tests = [ { describe: 'sanity', // prop name (e.g. size) its: [ { it: 'default', // prop variation (e.g. small) props: {}, }, ], }, { describe: 'divider', its: [ { it: 'should render with divider', props: { showDivider: true, }, }, { it: 'should render with divider with condensed grouping', props: { type: 'condensed', showDivider: true, }, }, { it: 'should not render if has less than two avatar', props: { showDivider: true, items: [{ name: 'first user', color: 'A1' }], }, }, ], }, { describe: 'size', its: [ { it: 'should render as medium by default', props: {}, }, { it: 'should render as medium by prop', props: { size: 'medium', }, }, { it: 'should render as small', props: { size: 'small', }, }, ], }, { describe: 'grouping type', its: [ { it: 'should render as condensed grouping', props: { type: 'condensed', }, }, { it: 'should render as stretched grouping', props: { type: 'stretched', }, }, ], }, ]; export const runTests = () => { visualize(AvatarGroup.displayName, () => { tests.forEach(({ describe, its }) => { story(describe, () => { its.map(({ it, props }) => snap(it, () => <AvatarGroup {...commonProps} {...props} />), ); }); }); }); };
docs/getting-started-chart/components/ReadSide.js
reimagined/resolve
import React from 'react' const ReadSide = ({ selected, onClick }) => ( <g className="box-outer" data-selected={selected} onClick={onClick}> <path className="box" d="M130 314H410V414H130V314Z" /> <path className="caption" d="M226.956 344V330.909H232.121C233.11 330.909 233.953 331.086 234.652 331.44C235.355 331.789 235.89 332.286 236.257 332.929C236.627 333.568 236.813 334.32 236.813 335.185C236.813 336.055 236.625 336.803 236.25 337.429C235.875 338.051 235.332 338.528 234.62 338.861C233.913 339.193 233.056 339.359 232.051 339.359H228.593V337.135H231.603C232.132 337.135 232.57 337.062 232.92 336.918C233.269 336.773 233.529 336.555 233.7 336.266C233.874 335.976 233.962 335.616 233.962 335.185C233.962 334.751 233.874 334.384 233.7 334.086C233.529 333.788 233.267 333.562 232.914 333.408C232.564 333.251 232.123 333.172 231.59 333.172H229.724V344H226.956ZM234.026 338.043L237.279 344H234.224L231.041 338.043H234.026ZM243.034 344.192C242.024 344.192 241.154 343.987 240.426 343.578C239.701 343.165 239.143 342.581 238.751 341.827C238.359 341.068 238.163 340.171 238.163 339.136C238.163 338.126 238.359 337.239 238.751 336.477C239.143 335.714 239.695 335.119 240.407 334.693C241.123 334.267 241.962 334.054 242.925 334.054C243.573 334.054 244.176 334.158 244.734 334.367C245.297 334.572 245.787 334.881 246.204 335.294C246.626 335.707 246.954 336.227 247.189 336.854C247.423 337.476 247.54 338.205 247.54 339.04V339.788H239.25V338.1H244.977C244.977 337.708 244.892 337.361 244.721 337.058C244.551 336.756 244.314 336.519 244.012 336.349C243.713 336.174 243.366 336.087 242.97 336.087C242.556 336.087 242.19 336.183 241.87 336.374C241.555 336.562 241.308 336.815 241.129 337.135C240.95 337.45 240.858 337.802 240.854 338.19V339.794C240.854 340.28 240.944 340.7 241.123 341.053C241.306 341.407 241.564 341.68 241.896 341.871C242.228 342.063 242.623 342.159 243.078 342.159C243.381 342.159 243.658 342.116 243.909 342.031C244.161 341.946 244.376 341.818 244.555 341.648C244.734 341.477 244.87 341.268 244.964 341.021L247.483 341.188C247.355 341.793 247.093 342.321 246.696 342.773C246.304 343.22 245.797 343.57 245.175 343.821C244.557 344.068 243.843 344.192 243.034 344.192ZM252.117 344.185C251.49 344.185 250.932 344.077 250.442 343.859C249.952 343.638 249.564 343.312 249.279 342.881C248.998 342.447 248.857 341.906 248.857 341.258C248.857 340.712 248.957 340.254 249.157 339.884C249.358 339.513 249.63 339.214 249.975 338.989C250.321 338.763 250.713 338.592 251.152 338.477C251.595 338.362 252.059 338.281 252.545 338.234C253.116 338.175 253.576 338.119 253.926 338.068C254.275 338.013 254.529 337.932 254.686 337.825C254.844 337.719 254.923 337.561 254.923 337.352V337.314C254.923 336.909 254.795 336.596 254.539 336.374C254.288 336.153 253.93 336.042 253.466 336.042C252.975 336.042 252.586 336.151 252.296 336.368C252.006 336.581 251.814 336.849 251.721 337.173L249.202 336.969C249.33 336.372 249.581 335.857 249.956 335.422C250.331 334.983 250.815 334.646 251.407 334.412C252.004 334.173 252.694 334.054 253.478 334.054C254.024 334.054 254.546 334.118 255.044 334.246C255.547 334.374 255.993 334.572 256.38 334.84C256.772 335.109 257.081 335.454 257.307 335.876C257.533 336.293 257.646 336.794 257.646 337.378V344H255.064V342.638H254.987C254.829 342.945 254.618 343.216 254.354 343.45C254.09 343.68 253.772 343.862 253.402 343.994C253.031 344.121 252.603 344.185 252.117 344.185ZM252.897 342.306C253.297 342.306 253.651 342.227 253.958 342.07C254.265 341.908 254.505 341.69 254.68 341.418C254.855 341.145 254.942 340.836 254.942 340.491V339.449C254.857 339.504 254.74 339.555 254.591 339.602C254.446 339.645 254.282 339.685 254.098 339.724C253.915 339.758 253.732 339.79 253.549 339.82C253.365 339.845 253.199 339.869 253.05 339.89C252.73 339.937 252.451 340.011 252.213 340.114C251.974 340.216 251.789 340.354 251.657 340.529C251.525 340.7 251.458 340.913 251.458 341.168C251.458 341.539 251.593 341.822 251.861 342.018C252.134 342.21 252.479 342.306 252.897 342.306ZM263.376 344.16C262.631 344.16 261.955 343.968 261.35 343.585C260.749 343.197 260.272 342.628 259.918 341.878C259.569 341.124 259.394 340.199 259.394 339.104C259.394 337.979 259.575 337.043 259.938 336.298C260.3 335.548 260.781 334.987 261.382 334.616C261.987 334.241 262.65 334.054 263.37 334.054C263.92 334.054 264.378 334.148 264.744 334.335C265.115 334.518 265.413 334.749 265.639 335.026C265.869 335.298 266.044 335.567 266.163 335.831H266.246V330.909H268.963V344H266.278V342.428H266.163C266.036 342.7 265.854 342.971 265.62 343.239C265.39 343.504 265.089 343.723 264.719 343.898C264.352 344.072 263.905 344.16 263.376 344.16ZM264.239 341.993C264.678 341.993 265.049 341.874 265.352 341.635C265.658 341.392 265.893 341.053 266.055 340.619C266.221 340.184 266.304 339.675 266.304 339.091C266.304 338.507 266.223 338 266.061 337.57C265.899 337.139 265.665 336.807 265.358 336.572C265.051 336.338 264.678 336.221 264.239 336.221C263.792 336.221 263.415 336.342 263.108 336.585C262.801 336.828 262.569 337.165 262.411 337.595C262.254 338.026 262.175 338.524 262.175 339.091C262.175 339.662 262.254 340.167 262.411 340.606C262.573 341.04 262.805 341.381 263.108 341.629C263.415 341.871 263.792 341.993 264.239 341.993ZM282.521 334.674C282.469 334.158 282.25 333.758 281.862 333.472C281.474 333.187 280.948 333.044 280.283 333.044C279.832 333.044 279.45 333.108 279.139 333.236C278.828 333.359 278.589 333.532 278.423 333.754C278.261 333.975 278.18 334.227 278.18 334.508C278.172 334.742 278.221 334.947 278.327 335.121C278.438 335.296 278.589 335.447 278.781 335.575C278.973 335.699 279.195 335.808 279.446 335.901C279.697 335.991 279.966 336.067 280.251 336.131L281.428 336.413C281.999 336.54 282.523 336.711 283 336.924C283.477 337.137 283.891 337.399 284.24 337.71C284.589 338.021 284.86 338.388 285.052 338.81C285.248 339.232 285.348 339.715 285.352 340.261C285.348 341.062 285.143 341.756 284.739 342.344C284.338 342.928 283.759 343.382 283 343.706C282.246 344.026 281.336 344.185 280.271 344.185C279.214 344.185 278.293 344.023 277.509 343.7C276.729 343.376 276.12 342.896 275.681 342.261C275.246 341.622 275.018 340.832 274.997 339.89H277.675C277.705 340.329 277.831 340.695 278.053 340.989C278.278 341.279 278.579 341.499 278.954 341.648C279.333 341.793 279.761 341.865 280.239 341.865C280.707 341.865 281.114 341.797 281.46 341.661C281.809 341.524 282.08 341.335 282.271 341.092C282.463 340.849 282.559 340.57 282.559 340.254C282.559 339.96 282.472 339.713 282.297 339.513C282.126 339.312 281.875 339.142 281.543 339.001C281.214 338.861 280.812 338.733 280.335 338.618L278.909 338.26C277.805 337.991 276.934 337.572 276.295 337.001C275.656 336.43 275.338 335.661 275.342 334.693C275.338 333.901 275.549 333.208 275.975 332.616C276.406 332.023 276.996 331.561 277.746 331.229C278.496 330.896 279.348 330.73 280.303 330.73C281.274 330.73 282.122 330.896 282.847 331.229C283.575 331.561 284.142 332.023 284.547 332.616C284.952 333.208 285.161 333.894 285.173 334.674H282.521ZM287.163 344V334.182H289.886V344H287.163ZM288.531 332.916C288.126 332.916 287.779 332.782 287.489 332.513C287.203 332.241 287.061 331.915 287.061 331.536C287.061 331.161 287.203 330.839 287.489 330.57C287.779 330.298 288.126 330.161 288.531 330.161C288.936 330.161 289.281 330.298 289.566 330.57C289.856 330.839 290.001 331.161 290.001 331.536C290.001 331.915 289.856 332.241 289.566 332.513C289.281 332.782 288.936 332.916 288.531 332.916ZM295.685 344.16C294.939 344.16 294.264 343.968 293.659 343.585C293.058 343.197 292.581 342.628 292.227 341.878C291.877 341.124 291.703 340.199 291.703 339.104C291.703 337.979 291.884 337.043 292.246 336.298C292.608 335.548 293.09 334.987 293.691 334.616C294.296 334.241 294.958 334.054 295.679 334.054C296.228 334.054 296.686 334.148 297.053 334.335C297.424 334.518 297.722 334.749 297.948 335.026C298.178 335.298 298.353 335.567 298.472 335.831H298.555V330.909H301.272V344H298.587V342.428H298.472C298.344 342.7 298.163 342.971 297.929 343.239C297.699 343.504 297.398 343.723 297.027 343.898C296.661 344.072 296.213 344.16 295.685 344.16ZM296.548 341.993C296.987 341.993 297.358 341.874 297.66 341.635C297.967 341.392 298.201 341.053 298.363 340.619C298.529 340.184 298.613 339.675 298.613 339.091C298.613 338.507 298.532 338 298.37 337.57C298.208 337.139 297.973 336.807 297.667 336.572C297.36 336.338 296.987 336.221 296.548 336.221C296.1 336.221 295.723 336.342 295.417 336.585C295.11 336.828 294.877 337.165 294.72 337.595C294.562 338.026 294.483 338.524 294.483 339.091C294.483 339.662 294.562 340.167 294.72 340.606C294.882 341.04 295.114 341.381 295.417 341.629C295.723 341.871 296.1 341.993 296.548 341.993ZM307.985 344.192C306.975 344.192 306.106 343.987 305.377 343.578C304.653 343.165 304.094 342.581 303.702 341.827C303.31 341.068 303.114 340.171 303.114 339.136C303.114 338.126 303.31 337.239 303.702 336.477C304.094 335.714 304.646 335.119 305.358 334.693C306.074 334.267 306.913 334.054 307.876 334.054C308.524 334.054 309.127 334.158 309.685 334.367C310.248 334.572 310.738 334.881 311.155 335.294C311.577 335.707 311.905 336.227 312.14 336.854C312.374 337.476 312.491 338.205 312.491 339.04V339.788H304.201V338.1H309.928C309.928 337.708 309.843 337.361 309.672 337.058C309.502 336.756 309.265 336.519 308.963 336.349C308.665 336.174 308.317 336.087 307.921 336.087C307.508 336.087 307.141 336.183 306.822 336.374C306.506 336.562 306.259 336.815 306.08 337.135C305.901 337.45 305.809 337.802 305.805 338.19V339.794C305.805 340.28 305.895 340.7 306.074 341.053C306.257 341.407 306.515 341.68 306.847 341.871C307.18 342.063 307.574 342.159 308.03 342.159C308.332 342.159 308.609 342.116 308.861 342.031C309.112 341.946 309.327 341.818 309.506 341.648C309.685 341.477 309.822 341.268 309.915 341.021L312.434 341.188C312.306 341.793 312.044 342.321 311.648 342.773C311.256 343.22 310.748 343.57 310.126 343.821C309.508 344.068 308.795 344.192 307.985 344.192Z" /> </g> ) export default ReadSide
sampleProject/index.ios.js
shivam-aditya/SampleReactExamples
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View } from 'react-native'; export default class sampleProject2 extends Component { render() { return ( <View style={styles.container}> <Text style={styles.welcome}> Welcome to React Native! </Text> <Text style={styles.instructions}> To get started, edit index.ios.js </Text> <Text style={styles.instructions}> Press Cmd+R to reload,{'\n'} Cmd+D or shake for dev menu </Text> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, }, }); AppRegistry.registerComponent('sampleProject2', () => sampleProject2);
src/app/Content.react.js
blueberryapps/react-bluekit
import AllComponentsPreview from './AllComponentsPreview.react'; import Component from './PureRenderComponent.react'; import ComponentPage from './component/Page.react'; import {mediaQueries} from './styles/MediaQueries'; import Radium from 'radium'; import React from 'react'; import RPT from 'prop-types'; @Radium export default class Content extends Component { static propTypes = { componentsIndex: RPT.object.isRequired, customProps: RPT.object, filteredComponentsIndex: RPT.object.isRequired, selectAtom: RPT.func.isRequired, selectedAtom: RPT.string, showMobileProps: RPT.bool, simplePropsSelected: RPT.bool, sourceBackground: RPT.string, toggleMobileProps: RPT.func.isRequired, triggeredProps: RPT.object } renderAtom() { const { componentsIndex, customProps, selectedAtom, showMobileProps, simplePropsSelected, sourceBackground, toggleMobileProps, triggeredProps, selectAtom } = this.props return ( <ComponentPage componentsIndex={componentsIndex} customProps={customProps} selectAtom={selectAtom} selectedAtom={selectedAtom} showMobileProps={showMobileProps} simplePropsSelected={simplePropsSelected} sourceBackground={sourceBackground} toggleMobileProps={toggleMobileProps} triggeredProps={triggeredProps} /> ); } renderList() { const {filteredComponentsIndex, selectAtom, selectedAtom} = this.props return ( <div style={[styles.list]}> <AllComponentsPreview componentsIndex={filteredComponentsIndex} selectAtom={selectAtom} selectedAtom={selectedAtom} /> </div> ); } render() { const {selectedAtom} = this.props return ( <div style={styles.content}> {selectedAtom ? this.renderAtom() : this.renderList()} </div> ); } } const styles = { content: { width: '80%', height: '100%', display: 'inline-block', position: 'relative', verticalAlign: 'top', [mediaQueries.breakpointLarge]: { width: '100%' } }, list: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, overflowY: 'auto' } };
docs/client.js
jhernandezme/react-materialize
import React from 'react'; import { Router } from 'react-router'; import ReactDOM from 'react-dom'; import createBrowserHistory from 'history/lib/createBrowserHistory'; import Root from './src/Root'; import routes from './src/Routes'; window.React = React; Root.propData = window.PROP_DATA; ReactDOM.render( <Router history={createBrowserHistory()} children={routes} />, document );
app/components/List/index.js
mclxly/react-study
import React from 'react'; import styles from './styles.css'; function List(props) { const ComponentToRender = props.component; let content = (<div></div>); // If we have items, render them if (props.items) { content = props.items.map((item, index) => ( <ComponentToRender key={`item-${index}`} item={item} /> )); } else { // Otherwise render a single component content = (<ComponentToRender />); } return ( <div className={styles.listWrapper}> <ul className={styles.list}> {content} </ul> </div> ); } List.propTypes = { component: React.PropTypes.func.isRequired, items: React.PropTypes.array, }; export default List;
docs/src/app/components/pages/components/Tabs/Page.js
pomerantsev/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 tabsReadmeText from './README'; import tabsExampleSimpleCode from '!raw!./ExampleSimple'; import TabsExampleSimple from './ExampleSimple'; import tabsExampleControlledCode from '!raw!./ExampleControlled'; import TabsExampleControlled from './ExampleControlled'; import tabsExampleSwipeableCode from '!raw!./ExampleSwipeable'; import TabsExampleSwipeable from './ExampleSwipeable'; import tabsExampleIconCode from '!raw!./ExampleIcon'; import TabsExampleIcon from './ExampleIcon'; import tabsExampleIconTextCode from '!raw!./ExampleIconText'; import TabsExampleIconText from './ExampleIconText'; import tabsCode from '!raw!material-ui/Tabs/Tabs'; import tabCode from '!raw!material-ui/Tabs/Tab'; const descriptions = { simple: 'A simple example of Tabs. The third tab demonstrates the `onActive` property of `Tab`.', controlled: 'An example of controlled tabs. The selected tab is handled through state and callbacks in the parent ' + '(example) component.', swipeable: 'This example integrates the [react-swipeable-views]' + '(https://github.com/oliviertassinari/react-swipeable-views) component with Tabs, animating the Tab transition, ' + 'and allowing tabs to be swiped on touch devices.', icon: 'An example of tabs with icon.', iconText: 'An example of tabs with icon and text.', }; const TabsPage = () => ( <div> <Title render={(previousTitle) => `Tabs - ${previousTitle}`} /> <MarkdownElement text={tabsReadmeText} /> <CodeExample title="Simple example" description={descriptions.simple} code={tabsExampleSimpleCode} > <TabsExampleSimple /> </CodeExample> <CodeExample title="Controlled example" description={descriptions.controlled} code={tabsExampleControlledCode} > <TabsExampleControlled /> </CodeExample> <CodeExample title="Swipeable example" description={descriptions.swipeable} code={tabsExampleSwipeableCode} > <TabsExampleSwipeable /> </CodeExample> <CodeExample title="Icon example" description={descriptions.icon} code={tabsExampleIconCode} > <TabsExampleIcon /> </CodeExample> <CodeExample title="Icon and text example" description={descriptions.iconText} code={tabsExampleIconTextCode} > <TabsExampleIconText /> </CodeExample> <PropTypeDescription code={tabsCode} header="### Tabs Properties" /> <PropTypeDescription code={tabCode} header="### Tab Properties" /> </div> ); export default TabsPage;
src/parser/warrior/protection/modules/talents/Vengeance.js
sMteX/WoWAnalyzer
import React from 'react'; import Analyzer from 'parser/core/Analyzer'; import SPELLS from 'common/SPELLS'; import SpellIcon from 'common/SpellIcon'; import SpellLink from 'common/SpellLink'; import StatisticBox, { STATISTIC_ORDER } from 'interface/others/StatisticBox'; import { formatPercentage } from 'common/format'; import RageTracker from '../core/RageTracker'; class Vengeance extends Analyzer { static dependencies = { rageTracker: RageTracker, }; buffedIgnoreCasts = 0; buffedRevengeCasts = 0; ignoreBuffsOverwritten = 0; revengeBuffsOverwritten = 0; constructor(...args) { super(...args); this.active = this.selectedCombatant.hasTalent(SPELLS.VENGEANCE_TALENT.id); } on_byPlayer_cast(event) { if (event.ability.guid !== SPELLS.IGNORE_PAIN.id && event.ability.guid !== SPELLS.REVENGE.id) { return; } if (this.selectedCombatant.hasBuff(SPELLS.VENGEANCE_IGNORE_PAIN.id) && event.ability.guid === SPELLS.REVENGE.id) { this.ignoreBuffsOverwritten += 1; return; } if (this.selectedCombatant.hasBuff(SPELLS.VENGEANCE_REVENGE.id) && event.ability.guid === SPELLS.IGNORE_PAIN.id) { this.revengeBuffsOverwritten += 1; return; } if (event.ability.guid === SPELLS.REVENGE.id && this.selectedCombatant.hasBuff(SPELLS.VENGEANCE_REVENGE.id)) { this.buffedRevengeCasts += 1; return; } if (event.ability.guid === SPELLS.IGNORE_PAIN.id && this.selectedCombatant.hasBuff(SPELLS.VENGEANCE_IGNORE_PAIN.id)) { this.buffedIgnoreCasts += 1; return; } } get buffUsage() { return (this.ignoreBuffsOverwritten + this.revengeBuffsOverwritten) / (this.buffedIgnoreCasts + this.buffedRevengeCasts + this.ignoreBuffsOverwritten + this.revengeBuffsOverwritten); } get uptimeSuggestionThresholds() { return { actual: this.buffUsage, isGreaterThan: { minor: 0, average: .1, major: .2, }, style: 'percentage', }; } suggestions(when) { when(this.uptimeSuggestionThresholds) .addSuggestion((suggest, actual, recommended) => { return suggest(<>Avoid casting <SpellLink id={SPELLS.IGNORE_PAIN.id} /> and <SpellLink id={SPELLS.REVENGE.id} /> back to back without using it's counterpart. <SpellLink id={SPELLS.VENGEANCE_TALENT.id} /> requires you to weave between those two spells to get the most rage and damage out of it.</>) .icon(SPELLS.VENGEANCE_TALENT.icon) .actual(`${formatPercentage(actual)}% overwritten`) .recommended(`${formatPercentage(recommended)}% recommended`); }); } statistic() { return ( <StatisticBox icon={<SpellIcon id={SPELLS.VENGEANCE_TALENT.id} />} value={`${formatPercentage(this.buffUsage)}%`} label="Buffs unused" tooltip={( <> {this.buffedIgnoreCasts} buffed {SPELLS.IGNORE_PAIN.name} casts<br /> {this.buffedRevengeCasts} buffed {SPELLS.REVENGE.name} casts<br /> You refreshed your "{SPELLS.VENGEANCE_IGNORE_PAIN.name}" buff {this.ignoreBuffsOverwritten} times<br /> You refreshed your "{SPELLS.VENGEANCE_REVENGE.name}" buff {this.revengeBuffsOverwritten} times<br /><br /> You saved <strong>{this.rageTracker.rageSavedByVengeance}</strong> Rage by casting {SPELLS.IGNORE_PAIN.name} and {SPELLS.REVENGE.name} with Vengeance up. </> )} /> ); } statisticOrder = STATISTIC_ORDER.CORE(5); } export default Vengeance;
src/bloks/Grid/Grid.js
frankydoge/blok
import React from 'react' import PropTypes from 'prop-types' import cx from 'classnames' import '../../blok.css' import Column from './Column' import Row from './Row' const Grid = (props) => { const { children, className, color, font, raised, size, tag, textAlign } = props var gridClass = cx ({ 'container': true, [`color-background-${color}`]: color, [`font-family-${font}`]: font, 'container-raised': raised, [`font-size-${size}`]: size, [`text-align-${textAlign}`]: textAlign, [`${className}`]: className }) const ElementTag = `${props.tag}` return ( <ElementTag className={gridClass} > {props.children} </ElementTag> ) } Grid.propTypes = { /* Add Custom Content */ children: PropTypes.node, /* Add Custom Classes */ className: PropTypes.string, /* Set The Color Scheme - REPLACE WITH THEME */ color: PropTypes.string, /* Set The Font Type */ font: PropTypes.string, /* Add Shadow So Grid 'Floats' */ raised: PropTypes.bool, /* Set The Size Of The Font */ size: PropTypes.string, /* Set The Tag For The Element */ tag: PropTypes.string, /* Set The Alignment Of The Text */ textAlign: PropTypes.string } Grid.defaultProps = { tag: 'div' } Grid.Row = Row Grid.Column = Column export default Grid
src/svg-icons/image/view-comfy.js
jacklam718/react-svg-iconx
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageViewComfy = (props) => ( <SvgIcon {...props}> <path d="M3 9h4V5H3v4zm0 5h4v-4H3v4zm5 0h4v-4H8v4zm5 0h4v-4h-4v4zM8 9h4V5H8v4zm5-4v4h4V5h-4zm5 9h4v-4h-4v4zM3 19h4v-4H3v4zm5 0h4v-4H8v4zm5 0h4v-4h-4v4zm5 0h4v-4h-4v4zm0-14v4h4V5h-4z"/> </SvgIcon> ); ImageViewComfy = pure(ImageViewComfy); ImageViewComfy.displayName = 'ImageViewComfy'; ImageViewComfy.muiName = 'SvgIcon'; export default ImageViewComfy;
src/server/render.js
sinapinto/ricehalla
import React from 'react'; import { renderToString } from 'react-dom/server'; import createLocation from 'history/lib/createLocation'; import { RouterContext, match, createMemoryHistory } from 'react-router'; import { Provider } from 'react-redux'; import createRouter from '../containers/Routes'; import Html from './Html'; import configureStore from '../utils/configureStore'; let assets; try { assets = require('../../webpack-assets.json'); } catch (_) { /* ignore exception */ } /** * Fetch data needed by components in the current route. * Depends on components containing a prefetchData static method. */ function prefetchData(components, obj) { const promises = (Array.isArray(components) ? components : [components]) .filter(comp => comp && comp.prefetchData && typeof comp.prefetchData === 'function' ) .map(comp => comp.prefetchData.call(this, obj) ); return Promise.all(promises); } export default function *() { const isCached = this.cashed ? yield this.cashed() : false; if (isCached) { return; } const initialState = { auth: { token: this.cookies.get('token'), isAuthenticated: !!this.state.user, }, }; const store = configureStore(initialState); const location = createLocation(this.originalUrl); const routes = createRouter(createMemoryHistory(), store); const [error, redirectLocation, renderProps] = yield new Promise((resolve) => { match({ routes, location }, (...args) => resolve(args)); }); if (error) { this.throw(400); } if (redirectLocation) { this.redirect(redirectLocation.pathname + redirectLocation.search); return; } this.assert(renderProps, 400); yield prefetchData(renderProps.components, { dispatch: store.dispatch, // path: renderProps.location.pathname, // query: renderProps.location.query, params: renderProps.params, }); const component = ( <Provider store={store}> {<RouterContext {...renderProps} />} </Provider> ); const html = <Html component={component} state={store.getState()} assets={assets} />; this.body = `<!DOCTYPE html>\n${renderToString(html)}`; }
src/components/Footer.js
ptrslr/silent-party
import React from 'react'; const Footer = () => { return ( <footer className="footer center f6 mt4"> <div className="container"> Just a little project by <a href="https://github.com/ptrslr" target="_blank">Peter Solař</a> </div> </footer> ) } export default Footer;
app/src/components/Blog/Shared/PostImage.js
RyanCCollins/ryancollins.io
import React from 'react'; import placeholder from './placeholder.png'; const PostImage = ({ url }) => ( <img src={url !== undefined && url.length > 0 ? url : placeholder} alt={`A dynamically loaded image for the blog`} /> ); export default PostImage;
src/components/Grid/Col.js
LevelPlayingField/levelplayingfield
/* @flow */ /* eslint-disable react/prefer-stateless-function */ import React from 'react'; import cx from 'classnames'; import s from './Grid.scss'; type Props = { // TODO: Fix any -> string/number? sm?: any, md?: any, lg?: any, className?: string, } function Col({ sm, md, lg, className, ...props }: Props) { return ( <div className={cx( s.col, s[`colSm${sm || '12'}`], s[`colMd${md || ''}`], s[`colLg${lg || ''}`], className )} {...props} /> ); } export default Col;
src/component/post-list-container/index.js
arn1313/kritter-frontend
import React from 'react'; import * as utils from '../../lib/utils'; import PostItem from '../post-item'; import { postFetchAllRequest } from '../../action/post-actions.js'; import { connect } from 'react-redux'; class PostList extends React.Component { constructor(props) { super(props); this.state = { sortedArray: this.props.post, }; } render() { let sorted = this.props.post.sort(function (a, b) { return b.exactTime - a.exactTime; }); console.log('====>THIS IS SORTED', this.props.post); return ( <div> {utils.renderIf(this.props.post, sorted.map(post => <div key={post._id}>{ <PostItem key={post._id} post={post} /> }<br /></div> ))} </div> ); } } //testing let mapStateToProps = state => ({ auth: state.auth, user: state.user, post: state.post, }); let mapDispatchToProps = dispatch => ({ postFetch: () => dispatch(postFetchAllRequest()), }); export default connect(mapStateToProps, mapDispatchToProps)(PostList);
src/js/components/header/app-header-search.js
TheFixers/node-honeypot-client
/** * Filename: 'app-header.js' * Author: JMW <rabbitfighter@cryptolab.net> * App header component */ import React from 'react' import SearchArea from '../search/app-search' import AppListButton from '../list/app-list-button' const AppHeaderSearch = ( props ) => { let styles = { width: '40px', height: '40px', display: 'inline-block', float: 'left', margin: '10px', marginTop: '20px' } return ( <div className="row" style={ {borderBottom: '2px solid #ccc'} }> <div className="col-sm-4 text-left"> <img src='http://dejanstojanovic.net/media/31519/honey.ico' style={ styles } /> <h1>Honeypot Client</h1> </div> <div className="col-sm-6"> <SearchArea /> </div> <div className="col-sm-2"> <AppListButton /> </div> </div> ) } export default AppHeaderSearch
react-flux-mui/js/material-ui/src/svg-icons/av/snooze.js
pbogdan/react-flux-mui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvSnooze = (props) => ( <SvgIcon {...props}> <path d="M7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm-3-9h3.63L9 15.2V17h6v-2h-3.63L15 10.8V9H9v2z"/> </SvgIcon> ); AvSnooze = pure(AvSnooze); AvSnooze.displayName = 'AvSnooze'; AvSnooze.muiName = 'SvgIcon'; export default AvSnooze;
app/containers/HomePage.js
nickrfer/code-sentinel
// @flow import React, { Component } from 'react'; import Home from '../components/Home'; export default class HomePage extends Component { render() { return ( <Home /> ); } }
app/containers/AppContainer.js
thenormalsquid/electronApp
// @flow import React from 'react'; import type { Children } from 'react'; const AppContainer = ({ children } : any) => <div> {children} </div>; export default AppContainer;
src/svg-icons/communication/call-made.js
ichiohta/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let CommunicationCallMade = (props) => ( <SvgIcon {...props}> <path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"/> </SvgIcon> ); CommunicationCallMade = pure(CommunicationCallMade); CommunicationCallMade.displayName = 'CommunicationCallMade'; CommunicationCallMade.muiName = 'SvgIcon'; export default CommunicationCallMade;
admin/client/App/shared/Popout/PopoutListItem.js
vokal/keystone
/** * Render a popout list item */ import React from 'react'; import blacklist from 'blacklist'; import classnames from 'classnames'; var PopoutListItem = React.createClass({ displayName: 'PopoutListItem', propTypes: { icon: React.PropTypes.string, iconHover: React.PropTypes.string, isSelected: React.PropTypes.bool, label: React.PropTypes.string.isRequired, onClick: React.PropTypes.func, }, getInitialState () { return { hover: false, }; }, hover () { this.setState({ hover: true }); }, unhover () { this.setState({ hover: false }); }, // Render an icon renderIcon () { if (!this.props.icon) return null; const icon = this.state.hover && this.props.iconHover ? this.props.iconHover : this.props.icon; const iconClassname = classnames('PopoutList__item__icon octicon', ('octicon-' + icon)); return <span className={iconClassname} />; }, render () { const itemClassname = classnames('PopoutList__item', { 'is-selected': this.props.isSelected, }); const props = blacklist(this.props, 'className', 'icon', 'iconHover', 'isSelected', 'label'); return ( <button type="button" title={this.props.label} className={itemClassname} onFocus={this.hover} onBlur={this.unhover} onMouseOver={this.hover} onMouseOut={this.unhover} {...props} > {this.renderIcon()} <span className="PopoutList__item__label"> {this.props.label} </span> </button> ); }, }); module.exports = PopoutListItem;
src/svg-icons/image/rotate-right.js
jacklam718/react-svg-iconx
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageRotateRight = (props) => ( <SvgIcon {...props}> <path d="M15.55 5.55L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42l1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z"/> </SvgIcon> ); ImageRotateRight = pure(ImageRotateRight); ImageRotateRight.displayName = 'ImageRotateRight'; ImageRotateRight.muiName = 'SvgIcon'; export default ImageRotateRight;
src/scenes/Disaster.js
glassysky/forecast
import React, { Component } from 'react'; import './Disaster.css'; export default class Disaster extends Component { render() { return ( <div className="disaster">灾害预警-开发中...</div> ); } }
docs/src/app/components/pages/components/GridList/Page.js
igorbt/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 gridListReadmeText from './README'; import gridListExampleSimpleCode from '!raw!./ExampleSimple'; import GridListExampleSimple from './ExampleSimple'; import gridListExampleComplexCode from '!raw!./ExampleComplex'; import GridListExampleComplex from './ExampleComplex'; import gridListExampleSingleLineCode from '!raw!./ExampleSingleLine'; import GridListExampleSingleLine from './ExampleSingleLine'; import gridListCode from '!raw!material-ui/GridList/GridList'; import gridTileCode from '!raw!material-ui/GridList/GridTile'; const GridListPage = () => ( <div> <Title render={(previousTitle) => `Grid List - ${previousTitle}`} /> <MarkdownElement text={gridListReadmeText} /> <CodeExample title="Simple example" code={gridListExampleSimpleCode} > <GridListExampleSimple /> </CodeExample> <CodeExample title="Complex example" code={gridListExampleComplexCode} > <GridListExampleComplex /> </CodeExample> <CodeExample title="One line example" code={gridListExampleSingleLineCode} > <GridListExampleSingleLine /> </CodeExample> <PropTypeDescription header="### GridList Properties" code={gridListCode} /> <PropTypeDescription header="### GridTile Properties" code={gridTileCode} /> </div> ); export default GridListPage;
src/views/ForgotPasswordView/ForgotPasswordView.js
LuCavallin/yfirbord-app
import React, { Component } from 'react'; import { PropTypes } from 'prop-types'; import { Col } from 'react-bootstrap'; import './ForgotPasswordView.scss'; export default class ForgotPasswordView extends Component { static propTypes = { }; constructor(props) { super(props); } render() { return ( <div> <div className="bold text-left">Forgot password?</div> </div> ); } }
reduxBasicApp/src/js/components/addTodo.js
3mundi/React-Bible
import React from 'react'; import { connect } from 'react-redux'; import TodoActions from '../actions/todoActions.js'; let AddTodo = ({ dispatch }) => { let input; return ( <div> <input ref={node => { input = node; }} /> <button onClick={() => { dispatch(TodoActions.addTodo(input.value)); input.value = ''; }}> Add Todo </button> </div> ); }; AddTodo = connect()(AddTodo); // connect to the own component with an empty container export default AddTodo;
src/components/UI/Header.js
mcnamee/react-native-starter-app
import React from 'react'; import PropTypes from 'prop-types'; import { View } from 'react-native'; import { Text, H1 } from 'native-base'; import Spacer from './Spacer'; const Header = ({ title, content }) => ( <View> <Spacer size={25} /> <H1>{title}</H1> {!!content && ( <View> <Spacer size={10} /> <Text>{content}</Text> </View> )} <Spacer size={25} /> </View> ); Header.propTypes = { title: PropTypes.string, content: PropTypes.string, }; Header.defaultProps = { title: 'Missing title', content: '', }; export default Header;
src/svg-icons/action/important-devices.js
mmrtnz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionImportantDevices = (props) => ( <SvgIcon {...props}> <path d="M23 11.01L18 11c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5c.55 0 1-.45 1-1v-9c0-.55-.45-.99-1-.99zM23 20h-5v-7h5v7zM20 2H2C.89 2 0 2.89 0 4v12c0 1.1.89 2 2 2h7v2H7v2h8v-2h-2v-2h2v-2H2V4h18v5h2V4c0-1.11-.9-2-2-2zm-8.03 7L11 6l-.97 3H7l2.47 1.76-.94 2.91 2.47-1.8 2.47 1.8-.94-2.91L15 9h-3.03z"/> </SvgIcon> ); ActionImportantDevices = pure(ActionImportantDevices); ActionImportantDevices.displayName = 'ActionImportantDevices'; ActionImportantDevices.muiName = 'SvgIcon'; export default ActionImportantDevices;
packages/wix-style-react/src/Input/InputContext.js
wix/wix-style-react
import React from 'react'; export const InputContext = React.createContext();
features/taskboard/components/tasklistToolbar.js
zymokey/mission-park
import React from 'react'; // import { connect } from 'react-redux'; import AddTasklist from './addTasklist'; import SearchInput from '../../common/components/searchInput'; class TasklistToolbar extends React.Component { constructor(props){ super(props); } render(){ return( <div className="btn-group toolbar" role="group" aria-label="tasklist toolbar"> <AddTasklist projectId={this.props.projectId} /> <SearchInput model="tasklist" parentId={this.props.projectId} attr={{name:"任务列表名称", keyName: 'tasklistName'}} /> </div> ); } } // const mapDispatchToProps = dispatch => ({ // }); // export default connect(null, mapDispatchToProps)(TasklistToolbar); export default TasklistToolbar;
packages/react/components/fab.js
iamxiaoma/Framework7
import React from 'react'; import Utils from '../utils/utils'; import Mixins from '../utils/mixins'; import __reactComponentWatch from '../runtime-helpers/react-component-watch.js'; import __reactComponentDispatchEvent from '../runtime-helpers/react-component-dispatch-event.js'; import __reactComponentSlots from '../runtime-helpers/react-component-slots.js'; import __reactComponentSetProps from '../runtime-helpers/react-component-set-props.js'; class F7Fab extends React.Component { constructor(props, context) { super(props, context); this.__reactRefs = {}; (() => { Utils.bindMethods(this, ['onClick']); })(); } onClick(event) { const self = this; self.dispatchEvent('click', event); } render() { const self = this; const props = self.props; const { className, id, style, morphTo, href: initialHref, position, text, target } = props; let href = initialHref; if (href === true) href = '#'; if (href === false) href = undefined; const linkChildren = []; const rootChildren = []; const { link: linkSlots, default: defaultSlots, root: rootSlots, text: textSlots } = self.slots; if (defaultSlots) { for (let i = 0; i < defaultSlots.length; i += 1) { const child = defaultSlots[i]; let isRoot; { const tag = child.type && (child.type.displayName || child.type.name); if (tag === 'F7FabButtons' || tag === 'f7-fab-buttons') isRoot = true; } if (isRoot) rootChildren.push(child);else linkChildren.push(child); } } let textEl; if (text || textSlots && textSlots.length) { textEl = React.createElement('div', { className: 'fab-text' }, text || textSlots); } let linkEl; if (linkChildren.length || linkSlots && linkSlots.length) { linkEl = React.createElement('a', { ref: __reactNode => { this.__reactRefs['linkEl'] = __reactNode; }, target: target, href: href, key: 'f7-fab-link' }, linkChildren, textEl, linkSlots); } const classes = Utils.classNames(className, 'fab', `fab-${position}`, { 'fab-morph': morphTo, 'fab-extended': typeof textEl !== 'undefined' }, Mixins.colorClasses(props)); return React.createElement('div', { id: id, style: style, className: classes, 'data-morph-to': morphTo }, linkEl, rootChildren, rootSlots); } componentWillUnmount() { const self = this; if (self.refs.linkEl) { self.refs.linkEl.removeEventListener('click', self.onClick); } if (self.f7Tooltip && self.f7Tooltip.destroy) { self.f7Tooltip.destroy(); self.f7Tooltip = null; delete self.f7Tooltip; } } componentDidMount() { const self = this; if (self.refs.linkEl) { self.refs.linkEl.addEventListener('click', self.onClick); } const { tooltip, tooltipTrigger } = self.props; if (!tooltip) return; self.$f7ready(f7 => { self.f7Tooltip = f7.tooltip.create({ targetEl: self.refs.el, text: tooltip, trigger: tooltipTrigger }); }); } get slots() { return __reactComponentSlots(this.props); } dispatchEvent(events, ...args) { return __reactComponentDispatchEvent(this, events, ...args); } get refs() { return this.__reactRefs; } set refs(refs) {} componentDidUpdate(prevProps, prevState) { __reactComponentWatch(this, 'props.tooltip', prevProps, prevState, newText => { const self = this; if (!newText && self.f7Tooltip) { self.f7Tooltip.destroy(); self.f7Tooltip = null; delete self.f7Tooltip; return; } if (newText && !self.f7Tooltip && self.$f7) { self.f7Tooltip = self.$f7.tooltip.create({ targetEl: self.refs.el, text: newText, trigger: self.props.tooltipTrigger }); return; } if (!newText || !self.f7Tooltip) return; self.f7Tooltip.setText(newText); }); } } __reactComponentSetProps(F7Fab, Object.assign({ id: [String, Number], className: String, style: Object, morphTo: String, href: [Boolean, String], target: String, text: String, position: { type: String, default: 'right-bottom' }, tooltip: String, tooltipTrigger: String }, Mixins.colorProps)); F7Fab.displayName = 'f7-fab'; export default F7Fab;
src/checkout/choose-continent.js
bhongy/react-components
import React from 'react'; import { actions } from './store'; import SelectAndRoute from './select-and-route'; const Option = ({ children, continent }) => ( <SelectAndRoute next="choose-destination" action={actions.chooseContinent(continent)}> {children} </SelectAndRoute> ); const ChooseContinent = () => ( <article> <h1>Continent</h1> <ul> <li> <Option continent="europe">Europe</Option> </li> <li> <p>Asia</p> </li> <li> <p>Africa</p> </li> <li> <p>Australia</p> </li> </ul> </article> ); export default ChooseContinent;
app/addons/verifyinstall/components/VerifyInstallResults.js
michellephung/couchdb-fauxton
// 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 PropTypes from 'prop-types'; import React from 'react'; import Constants from '../constants'; export default class VerifyInstallResults extends React.Component { static propTypes = { testResults: PropTypes.object.isRequired }; showTestResult = (test) => { if (!this.props.testResults[test].complete) { return ''; } if (this.props.testResults[test].success) { return <span>&#10003;</span>; } return <span>&#x2717;</span>; }; render() { return ( <table className="table table-striped table-bordered"> <thead> <tr> <th>Test</th> <th>Status</th> </tr> </thead> <tbody> <tr> <td>Create Database</td> <td id="js-test-create-db">{this.showTestResult(Constants.TESTS.CREATE_DATABASE)}</td> </tr> <tr> <td>Create Document</td> <td id="js-test-create-doc">{this.showTestResult(Constants.TESTS.CREATE_DOCUMENT)}</td> </tr> <tr> <td>Update Document</td> <td id="js-test-update-doc">{this.showTestResult(Constants.TESTS.UPDATE_DOCUMENT)}</td> </tr> <tr> <td>Delete Document</td> <td id="js-test-delete-doc">{this.showTestResult(Constants.TESTS.DELETE_DOCUMENT)}</td> </tr> <tr> <td>Create View</td> <td id="js-test-create-view">{this.showTestResult(Constants.TESTS.CREATE_VIEW)}</td> </tr> <tr> <td>Replication</td> <td id="js-test-replication">{this.showTestResult(Constants.TESTS.REPLICATION)}</td> </tr> </tbody> </table> ); } }
jenkins-design-language/src/js/components/material-ui/svg-icons/action/trending-up.js
alvarolobato/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const ActionTrendingUp = (props) => ( <SvgIcon {...props}> <path d="M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"/> </SvgIcon> ); ActionTrendingUp.displayName = 'ActionTrendingUp'; ActionTrendingUp.muiName = 'SvgIcon'; export default ActionTrendingUp;
src/components/SideBar.js
tofuness/Toshocat
import React from 'react'; import utils from '../utils'; import LogoContainer from '../containers/LogoContainer'; import SideBarNavigation from './SideBarNavigation'; const SideBar = () => { return ( <div className="sidebar"> <LogoContainer /> <SideBarNavigation /> <div className="sidebar-bottom"> IN DEVELOPMENT. ANYTHING CAN BREAK. {utils.version()} </div> </div> ); }; export default SideBar;
src/svg-icons/image/crop-rotate.js
ruifortes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageCropRotate = (props) => ( <SvgIcon {...props}> <path d="M7.47 21.49C4.2 19.93 1.86 16.76 1.5 13H0c.51 6.16 5.66 11 11.95 11 .23 0 .44-.02.66-.03L8.8 20.15l-1.33 1.34zM12.05 0c-.23 0-.44.02-.66.04l3.81 3.81 1.33-1.33C19.8 4.07 22.14 7.24 22.5 11H24c-.51-6.16-5.66-11-11.95-11zM16 14h2V8c0-1.11-.9-2-2-2h-6v2h6v6zm-8 2V4H6v2H4v2h2v8c0 1.1.89 2 2 2h8v2h2v-2h2v-2H8z"/> </SvgIcon> ); ImageCropRotate = pure(ImageCropRotate); ImageCropRotate.displayName = 'ImageCropRotate'; ImageCropRotate.muiName = 'SvgIcon'; export default ImageCropRotate;
src/components/RevealAuction/TimeDuration.js
chochinlu/ens-bid-dapp
import React from 'react'; import {momentFromNow} from '../../lib/util'; import './TimeDuration.css'; export const TimeDuration = (props) => ( <div className='RevealAuctionTimeDuration'> <div className='RevealAuctionTimeDuration-Reveal'> <div>Reveal Auction On</div> <h3>{props.unsealStartsAt.toString()}</h3> <div>{momentFromNow(props.unsealStartsAt).toString()}</div> </div> <div className='RevealAuctionTimeDuration-Finalize'> <div>Finalize Auction On</div> <h3>{props.registratesAt.toString()}</h3> <div>{momentFromNow(props.registratesAt).toString()}</div> </div> </div> );
scripts/src/pages/views/rooms.js
Twogether/just-meet-frontend
import React from 'react'; import Helmet from 'react-helmet' import { Link } from 'react-router'; export default (self) => { return ( <div> <Helmet title="Just Meet | Rooms" /> <div className="left quarter"> <nav className="side-nav"> <ul> {self.state.menu.map((link, index) => { return ( <li key={index}> <Link to={link.path}><i className={'fa fa-' + link.icon} aria-hidden="true"></i> {link.text}</Link> <ul className="sub-menu"> {link.children && link.children.map((link, index) => { return ( <li key={`child-${index}`}><Link to={link.path}><i className={'fa fa-' + link.icon} aria-hidden="true"></i> {link.text}</Link></li> ); })} </ul> </li> ); })} </ul> </nav> </div> <div className="right three-quarters white-bg padding-medium"> <h2>Rooms</h2> </div> </div> ); };
stories/snackbar.stories.js
isogon/material-components
import React from 'react' import { storiesOf } from '@storybook/react' import wrapStory from './decorators/wrapStory' import Snackbar from '../src/components/snackbar/demos/Snackbar.js' import SnackbarWithAction from '../src/components/snackbar/demos/SnackbarWithAction.js' storiesOf('Snackbar', module) .addDecorator(wrapStory) .add('Snackbar', () => <Snackbar />) .add('Snackbar With Action', () => <SnackbarWithAction />)
src/Survey/Complex/Default/Samples/Location.js
NERC-CEH/irecord-app
import React from 'react'; import PropTypes from 'prop-types'; import _ from 'lodash'; import bigu from 'bigu'; import { observer } from 'mobx-react'; import { IonPage } from '@ionic/react'; import Log from 'helpers/log'; import { message } from 'helpers/toast'; import Header from 'Components/Location/Header'; import Main from 'Components/Location/Main'; import { onManualGridrefChange, onLocationNameChange, onGPSClick, } from 'Components/Location/utils'; @observer class Container extends React.Component { static propTypes = { savedSamples: PropTypes.array.isRequired, match: PropTypes.object, appModel: PropTypes.object.isRequired, }; constructor(props) { super(props); this.surveySample = this.props.savedSamples.find( ({ cid }) => cid === this.props.match.params.id ); const sample = this.surveySample.samples.find( ({ cid }) => cid === this.props.match.params.smpId ); this.state = { sample, }; this.onManualGridrefChange = onManualGridrefChange.bind(this); this.onLocationNameChange = onLocationNameChange.bind(this); this.onGPSClick = onGPSClick.bind(this); } /** * Sets location for the sample. * @param sample * @param loc * @param reset * @returns {Promise.<T>} */ setLocation = async (loc, reset) => { const { sample } = this.state; if (typeof loc !== 'object') { // jQuery event object bug fix // todo clean up if not needed anymore Log('Location:Controller:setLocation: loc is not an object.', 'e'); return Promise.reject(new Error('Invalid location')); } let location = loc; // we don't need the GPS running and overwriting the selected location if (sample.isGPSRunning()) { sample.stopGPS(); } if (!reset) { // extend old location to preserve its previous attributes like name or id let oldLocation = sample.attrs.location; if (!_.isObject(oldLocation)) { oldLocation = {}; } // check for locked true location = { ...oldLocation, ...location }; } sample.attrs.location = location; return sample.save().catch(error => { Log(error, 'e'); }); }; validateLocation = location => { const { sample } = this.state; const gridCoords = bigu.latlng_to_grid_coords( location.latitude, location.longitude ); if (!gridCoords) { return false; } const parentGridref = sample.parent.attrs.location.gridref; if (!parentGridref) { return false; } if (location.gridref.length < parentGridref.length) { return false; } const parentParsedRef = bigu.GridRefParser.factory(parentGridref); return gridCoords.to_gridref(parentParsedRef.length) === parentGridref; }; render() { const { appModel } = this.props; const { sample } = this.state; const location = sample.attrs.location || {}; return ( <IonPage id="survey-complex-default-edit-subsample-location"> <Header location={location} sample={sample} appModel={appModel} onManualGridrefChange={this.onManualGridrefChange} /> <Main location={location} sample={sample} appModel={appModel} onGPSClick={this.onGPSClick} setLocation={this.setLocation} /> </IonPage> ); } } export default Container;
js/components/Chat/ListChats.js
DevHse/ClubRoom
import React, { Component } from 'react'; import { Image, Dimensions, ListView, Text, TouchableOpacity } from 'react-native'; import { connect } from 'react-redux'; import { actions } from 'react-native-navigation-redux-helpers'; import { Container, Content, InputGroup, Input, Button, Icon, View } from 'native-base'; import { setIndex } from '../../actions/list'; import { setUser } from '../../actions/user'; const w = Dimensions.get('window').width; const h = Dimensions.get('window').height; const { reset, pushRoute, } = actions; const background = require('../../../images/shadow.png'); const avatar = require('../../../images/avatar.png'); const imgProfile = require('../../../images/avatarDefault.jpg'); const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); const listData = [ { name: 'Candace Jefferson', status: 'last seen just now' }, { name: 'Philip Green', status: 'last seen just now' }, { name: 'Rosa Mclaughlin', status: 'last seen just now' }, { name: 'Elbert Santos', status: 'last seen just now' }, ]; class ListChats extends Component { static propTypes = { name: React.PropTypes.string, list: React.PropTypes.arrayOf(React.PropTypes.string), setIndex: React.PropTypes.func, openDrawer: React.PropTypes.func, pushRoute: React.PropTypes.func, reset: React.PropTypes.func, navigation: React.PropTypes.shape({ key: React.PropTypes.string, }), } constructor(props) { super(props); this.state = { name: '', dataSource: ds.cloneWithRows(listData), }; } setUser(name) { this.props.setUser(name); } pushRoute(route, index) { this.props.setIndex(index); this.props.pushRoute({ key: route, index: 1 }, this.props.navigation.key); } replaceRoute(route) { this.setUser(this.state.name); this.props.replaceAt('login', { key: route }, this.props.navigation.key); } onAcitonChat() { this.pushRoute('chat', 4); } renderRowCustom(rowData) { return ( <TouchableOpacity onPress={() => this.onAcitonChat()} > <View style={{ width: w, height: 60, backgroundColor: 'white' }}> <Text style={{ marginLeft: 70, marginTop: 10, color: 'black', fontFamily: 'Avenir-Medium', fontSize: 16 }} >{rowData.name}</Text> <Text style={{ marginLeft: 70, color: '#c9c9c9', fontFamily: 'Avenir-Medium', fontSize: 14 }} >{rowData.status}</Text> <Image style={{ position: 'absolute', top: 5, left: 10, width: 50, height: 50, borderRadius: 25, borderColor: '#f8f8f8', borderWidth: 1 }} source={avatar} /> <View style={{ position: 'absolute', top: 59, left: 70, backgroundColor: '#c9c9c9', height: 1, width: w - 70 }} /> </View> </TouchableOpacity> ); } render() { return ( <View style={{ flex: 1, backgroundColor: 'white' }}> <View style={{ width: w, height: 60, backgroundColor: '#f8f8f8' }}> <Text style={{ marginTop: 20, textAlign: 'center', color: 'black', fontFamily: 'Avenir-Medium', fontSize: 18 }} >Contacts</Text> </View> <View style={{ backgroundColor: '#b2b2b2', width: w, height: 1 }} /> <View style={{ width: w, height: h - 60 }}> <View style={{ width: w - 20, marginTop: 10, marginLeft: 10, borderRadius: 5, height: 30, backgroundColor: '#ededed' }}> <Text style={{ color: '#8e8e90', marginTop: 8, marginLeft: 5, fontSize: 12 }}> Search for contacts or usernames..</Text> </View> <View style={{ width: w, height: 70, backgroundColor: 'white' }}> <Text style={{ marginLeft: 70, marginTop: 15, color: 'black', fontFamily: 'Avenir-Medium', fontSize: 16 }} >John Nguyen</Text> <Text style={{ marginLeft: 70, color: '#c9c9c9', fontFamily: 'Avenir-Medium', fontSize: 14 }}>+84 0909999999</Text> <Image style={{ position: 'absolute', top: 10, left: 10, width: 50, height: 50, borderRadius: 25, borderColor: '#f8f8f8', borderWidth: 1 }} source={imgProfile} /> <View style={{ position: 'absolute', top: 69, backgroundColor: '#c9c9c9', height: 1, width: w }} /> </View> <ListView automaticallyAdjustContentInsets={false} style={{ flex: 1 }} dataSource={this.state.dataSource} renderRow={rowData => this.renderRowCustom(rowData)} /> </View> </View> ); } } function bindActions(dispatch) { return { setIndex: index => dispatch(setIndex(index)), openDrawer: () => dispatch(openDrawer()), pushRoute: (route, key) => dispatch(pushRoute(route, key)), reset: key => dispatch(reset([{ key: 'login' }], key, 0)), }; } const mapStateToProps = state => ({ navigation: state.cardNavigation, }); export default connect(mapStateToProps, bindActions)(ListChats);
examples/with-glamorous/pages/index.js
callumlocke/next.js
import React from 'react' import { rehydrate, css } from 'glamor' import glamorous from 'glamorous' // Adds server generated styles to glamor cache. // Has to run before any `style()` calls // '__NEXT_DATA__.ids' is set in '_document.js' if (typeof window !== 'undefined') { rehydrate(window.__NEXT_DATA__.ids) } export default () => { css.global('html, body', { padding: '3rem 1rem', margin: 0, background: 'papayawhip', minHeight: '100%', fontFamily: 'Helvetica, Arial, sans-serif', fontSize: '24px' }) const basicStyles = { backgroundColor: 'white', color: 'cornflowerblue', border: '1px solid lightgreen', borderRight: 'none', borderBottom: 'none', boxShadow: '5px 5px 0 0 lightgreen, 10px 10px 0 0 lightyellow', transition: 'all 0.1s linear', margin: `3rem 0`, padding: `1rem 0.5rem` } const hoverStyles = { ':hover': { color: 'white', backgroundColor: 'lightgray', borderColor: 'aqua', boxShadow: `-15px -15px 0 0 aqua, -30px -30px 0 0 cornflowerblue` }, '& code': { backgroundColor: 'linen' } } const crazyStyles = props => { const crazyStyles = hoverStyles const bounce = css.keyframes({ '0%': { transform: `scale(1.01)` }, '100%': { transform: `scale(0.99)` } }) crazyStyles.animation = `${bounce} 0.2s infinite ease-in-out alternate` return crazyStyles } const Basic = glamorous.div(basicStyles) const Combined = glamorous.div(basicStyles, hoverStyles) const Animated = glamorous.div(basicStyles, hoverStyles, crazyStyles) return ( <div> <Basic> Cool Styles </Basic> <Combined> With <code>:hover</code>. </Combined> <Animated> Let's bounce. </Animated> </div> ) }
src/components/OrderSummary/OrderSummary-story.js
jzhang300/carbon-components-react
/* eslint-disable no-console */ import React from 'react'; import { storiesOf } from '@storybook/react'; import { OrderSummary, OrderSummaryHeader, OrderSummaryCategory, OrderSummaryList, OrderSummaryListItem, OrderSummaryTotal, OrderSummaryFooter, } from '../OrderSummary'; import Button from '../Button'; import Dropdown from '../Dropdown'; import DropdownItem from '../DropdownItem'; storiesOf('OrderSummary', module) .addWithInfo( 'Simple', ` This component is used to display the items a user will be purchasing. This version does not include OrderSummaryCategory. `, () => ( <OrderSummary> <OrderSummaryHeader title="Order Summary"> <Dropdown onChange={selectedItemInfo => console.log(selectedItemInfo)} defaultText="USD"> <DropdownItem itemText="USD" value="usd" /> <DropdownItem itemText="GBP" value="gbp" /> <DropdownItem itemText="NOK" value="nok" /> <DropdownItem itemText="EUR" value="eur" /> </Dropdown> </OrderSummaryHeader> <OrderSummaryList> <OrderSummaryListItem /> <OrderSummaryListItem text="Detail 2" price="$20.00" /> <OrderSummaryListItem text="Detail 3" price="$40.00" /> </OrderSummaryList> <OrderSummaryTotal summaryText="Total due now:" summaryPrice="$0.00" summaryDetails="estimated"> <Button>Primary Button</Button> <Button kind="secondary">Primary Button</Button> </OrderSummaryTotal> <OrderSummaryFooter footerText="Need Help?" linkText="Contact Bluemix Sales" href="www.google.com" /> </OrderSummary> ) ) .addWithInfo( 'Category', ` This component is used to display the items a user will be purchasing. The category version of OrderSummary can break the items being purchased into categories. `, () => ( <OrderSummary> <OrderSummaryHeader title="Order Summary"> <Dropdown onChange={selectedItemInfo => console.log(selectedItemInfo)} defaultText="USD"> <DropdownItem itemText="USD" value="usd" /> <DropdownItem itemText="GBP" value="gbp" /> <DropdownItem itemText="NOK" value="nok" /> <DropdownItem itemText="EUR" value="eur" /> </Dropdown> </OrderSummaryHeader> <OrderSummaryList> <OrderSummaryCategory> <OrderSummaryListItem /> <OrderSummaryListItem text="Detail 2" price="$20.00" /> <OrderSummaryListItem text="Detail 3" price="$40.00" /> </OrderSummaryCategory> <OrderSummaryCategory> <OrderSummaryListItem /> <OrderSummaryListItem text="Detail 2" price="$20.00" /> <OrderSummaryListItem text="Detail 3" price="$40.00" /> </OrderSummaryCategory> <OrderSummaryCategory> <OrderSummaryListItem /> <OrderSummaryListItem text="Detail 2" price="$20.00" /> <OrderSummaryListItem text="Detail 3" price="$40.00" /> </OrderSummaryCategory> </OrderSummaryList> <OrderSummaryTotal summaryText="Total due now:" summaryPrice="$0.00" summaryDetails="estimated"> <Button>Primary Button</Button> <Button kind="secondary">Primary Button</Button> </OrderSummaryTotal> <OrderSummaryFooter footerText="Need Help?" linkText="Contact Bluemix Sales" href="www.google.com" /> </OrderSummary> ) );
app/components/Home.js
kaunio/gloso
// @flow import React, { Component } from 'react'; import { Link } from 'react-router'; import styles from './Home.css'; import SaveLink from './SaveLink'; import StartTestLink from './StartTestLink'; import LoadLink from './LoadLink'; export default class Home extends Component { render() { return ( <div> <div className={styles.container} data-tid="container"> <h2>GLOSO</h2> <Link to="/createBundle">Create bundle</Link><br /><br/> <SaveLink data={this.props.saveData}>Save stuff</SaveLink><br /> <LoadLink>Load the stuff</LoadLink><br /><br/> <StartTestLink>Start test</StartTestLink> </div> </div> ); } }
src/components/pagination/PaginationButton/PaginationNext.js
CtrHellenicStudies/Commentary
import React from 'react'; import { connect } from 'react-redux'; import { updatePage } from '../../../actions/pagination'; const PaginationNext = ({ updatePage, location, activePage }) => ( <button type="button" onClick={updatePage.bind(this, activePage + 1)} > <span> Next </span> <i className="mdi mdi-chevron-right" /> </button> ); const mapStateToProps = state => ({ activePage: state.pagination.page, }); const mapDispatchToProps = dispatch => ({ updatePage: (page) => { dispatch(updatePage(page)); }, }); export default connect( mapStateToProps, mapDispatchToProps, )(PaginationNext);
ios/versioned-react-native/ABI8_0_0/Libraries/Image/Image.ios.js
jolicloud/exponent
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Image * @flow */ 'use strict'; const EdgeInsetsPropType = require('EdgeInsetsPropType'); const ImageResizeMode = require('ImageResizeMode'); const ImageSourcePropType = require('ImageSourcePropType'); const ImageStylePropTypes = require('ImageStylePropTypes'); const NativeMethodsMixin = require('react/lib/NativeMethodsMixin'); const NativeModules = require('NativeModules'); const PropTypes = require('react/lib/ReactPropTypes'); const React = require('React'); const ReactNativeViewAttributes = require('ReactNativeViewAttributes'); const StyleSheet = require('StyleSheet'); const StyleSheetPropType = require('StyleSheetPropType'); const flattenStyle = require('flattenStyle'); const requireNativeComponent = require('requireNativeComponent'); const resolveAssetSource = require('resolveAssetSource'); const ImageViewManager = NativeModules.ImageViewManager; /** * A React component for displaying different types of images, * including network images, static resources, temporary local images, and * images from local disk, such as the camera roll. * * This exmaples shows both fetching and displaying an image from local storage as well as on from * network. * * ```ReactNativeWebPlayer * import React, { Component } from 'react'; * import { AppRegistry, View, Image } from 'react-native'; * * class DisplayAnImage extends Component { * render() { * return ( * <View> * <Image * source={require('./img/favicon.png')} * /> * <Image * source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}} * /> * </View> * ); * } * } * * // App registration and rendering * AppRegistry.registerComponent('DisplayAnImage', () => DisplayAnImage); * ``` * * You can also add `style` to an image: * * ```ReactNativeWebPlayer * import React, { Component } from 'react'; * import { AppRegistry, View, Image, StyleSheet} from 'react-native'; * * const styles = StyleSheet.create({ * stretch: { * width: 50, * height: 200 * } * }); * *class DisplayAnImageWithStyle extends Component { * render() { * return ( * <View> * <Image * style={styles.stretch} * source={require('./img/favicon.png')} * /> * </View> * ); * } * } * * // App registration and rendering * AppRegistry.registerComponent( * 'DisplayAnImageWithStyle', * () => DisplayAnImageWithStyle * ); * ``` */ const Image = React.createClass({ propTypes: { /** * > `ImageResizeMode` is an `Enum` for different image resizing modes, set via the * > `resizeMode` style property on `Image` components. The values are `contain`, `cover`, * > `stretch`, `center`, `repeat`. */ style: StyleSheetPropType(ImageStylePropTypes), /** * The image source (either a remote URL or a local file resource). */ source: ImageSourcePropType, /** * A static image to display while loading the image source. * * - `uri` - a string representing the resource identifier for the image, which * should be either a local file path or the name of a static image resource * (which should be wrapped in the `require('./path/to/image.png')` function). * - `width`, `height` - can be specified if known at build time, in which case * these will be used to set the default `<Image/>` component dimensions. * - `scale` - used to indicate the scale factor of the image. Defaults to 1.0 if * unspecified, meaning that one image pixel equates to one display point / DIP. * - `number` - Opaque type returned by something like `require('./image.jpg')`. * * @platform ios */ defaultSource: PropTypes.oneOfType([ // TODO: Tooling to support documenting these directly and having them display in the docs. PropTypes.shape({ uri: PropTypes.string, width: PropTypes.number, height: PropTypes.number, scale: PropTypes.number, }), PropTypes.number, ]), /** * When true, indicates the image is an accessibility element. * @platform ios */ accessible: PropTypes.bool, /** * The text that's read by the screen reader when the user interacts with * the image. * @platform ios */ accessibilityLabel: PropTypes.string, /** * blurRadius: the blur radius of the blur filter added to the image * @platform ios */ blurRadius: PropTypes.number, /** * When the image is resized, the corners of the size specified * by `capInsets` will stay a fixed size, but the center content and borders * of the image will be stretched. This is useful for creating resizable * rounded buttons, shadows, and other resizable assets. More info in the * [official Apple documentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/index.html#//apple_ref/occ/instm/UIImage/resizableImageWithCapInsets). * * @platform ios */ capInsets: EdgeInsetsPropType, /** * Determines how to resize the image when the frame doesn't match the raw * image dimensions. * * - `cover`: Scale the image uniformly (maintain the image's aspect ratio) * so that both dimensions (width and height) of the image will be equal * to or larger than the corresponding dimension of the view (minus padding). * * - `contain`: Scale the image uniformly (maintain the image's aspect ratio) * so that both dimensions (width and height) of the image will be equal to * or less than the corresponding dimension of the view (minus padding). * * - `stretch`: Scale width and height independently, This may change the * aspect ratio of the src. * * - `repeat`: Repeat the image to cover the frame of the view. The * image will keep it's size and aspect ratio. (iOS only) */ resizeMode: PropTypes.oneOf(['cover', 'contain', 'stretch', 'repeat', 'center']), /** * A unique identifier for this element to be used in UI Automation * testing scripts. */ testID: PropTypes.string, /** * Invoked on mount and layout changes with * `{nativeEvent: {layout: {x, y, width, height}}}`. */ onLayout: PropTypes.func, /** * Invoked on load start. * * e.g., `onLoadStart={(e) => this.setState({loading: true})}` */ onLoadStart: PropTypes.func, /** * Invoked on download progress with `{nativeEvent: {loaded, total}}`. * @platform ios */ onProgress: PropTypes.func, /** * Invoked on load error with `{nativeEvent: {error}}`. * @platform ios */ onError: PropTypes.func, /** * Invoked when load completes successfully. */ onLoad: PropTypes.func, /** * Invoked when load either succeeds or fails. */ onLoadEnd: PropTypes.func, }, statics: { resizeMode: ImageResizeMode, /** * Retrieve the width and height (in pixels) of an image prior to displaying it. * This method can fail if the image cannot be found, or fails to download. * * In order to retrieve the image dimensions, the image may first need to be * loaded or downloaded, after which it will be cached. This means that in * principle you could use this method to preload images, however it is not * optimized for that purpose, and may in future be implemented in a way that * does not fully load/download the image data. A proper, supported way to * preload images will be provided as a separate API. * * @param uri The location of the image. * @param success The function that will be called if the image was sucessfully found and width * and height retrieved. * @param failure The function that will be called if there was an error, such as failing to * to retrieve the image. * * @returns void * * @platform ios */ getSize: function( uri: string, success: (width: number, height: number) => void, failure: (error: any) => void, ) { ImageViewManager.getSize(uri, success, failure || function() { console.warn('Failed to get size for image: ' + uri); }); }, /** * Prefetches a remote image for later use by downloading it to the disk * cache * * @param url The remote location of the image. * * @return The prefetched image. */ prefetch(url: string) { return ImageViewManager.prefetchImage(url); }, }, mixins: [NativeMethodsMixin], /** * `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We * make `this` look like an actual native component class. */ viewConfig: { uiViewClassName: 'UIView', validAttributes: ReactNativeViewAttributes.UIView }, render: function() { const source = resolveAssetSource(this.props.source) || { uri: undefined, width: undefined, height: undefined }; const {width, height, uri} = source; const style = flattenStyle([{width, height}, styles.base, this.props.style]) || {}; const resizeMode = this.props.resizeMode || (style || {}).resizeMode || 'cover'; // Workaround for flow bug t7737108 const tintColor = (style || {}).tintColor; // Workaround for flow bug t7737108 if (uri === '') { console.warn('source.uri should not be an empty string'); } if (this.props.src) { console.warn('The <Image> component requires a `source` property rather than `src`.'); } return ( <RCTImageView {...this.props} style={style} resizeMode={resizeMode} tintColor={tintColor} source={source} /> ); }, }); const styles = StyleSheet.create({ base: { overflow: 'hidden', }, }); const RCTImageView = requireNativeComponent('RCTImageView', Image); module.exports = Image;
react-router-demo/lessons/09-index-links/modules/About.js
zhangjunhd/react-examples
import React from 'react' export default React.createClass({ render() { return <div>About</div> } })
src/Components/Card.stories.js
elderfo/elderfo-react-native-components
import React from 'react'; import { Text } from 'react-native'; import { storiesOf, action, linkTo } from '@kadira/react-native-storybook'; import {Card, CenterView} from '../'; storiesOf('Card', module) .addDecorator(getStory => ( <CenterView fillParent={true} style={{padding:10}}>{getStory()}</CenterView> )) .add('with text', () => ( <Card> <Text>With Text</Text> </Card> )) .add('with centered content', () => ( <Card center={true}> <Text>Centered</Text> </Card> )) .add('with padding', ()=> ( <Card includePadding={true}> <Text>With Padding</Text> </Card> )) .add('without padding', ()=> ( <Card includePadding={false}> <Text>Without Padding</Text> </Card> )) .add('with click handler', () => ( <Card onPress={action('Clicked')}> <Text>Click me</Text> </Card> ));
src/components/seller-info.js
KoushikKumar/trade-a-book-client
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { SELLER_INFO } from '../constants/content-constants'; class SellerInfo extends Component { render() { if(this.props.bookdetailsById.sellerInfo) { return ( <div className="seller-information-container-info"> <div className="seller-information-info seller-information-title-info"> {SELLER_INFO} </div> <div className="seller-information-info seller-information-name-info"> {this.props.bookdetailsById.sellerInfo.name} </div> <div className="seller-information-info seller-information-address-info"> {this.props.bookdetailsById.sellerInfo.address} </div> </div> ); } else { return false; } } } function mapStateToProps(state) { return { bookdetailsById: state.book.bookdetailsById } } export default connect(mapStateToProps)(SellerInfo)
src/components/export-modal/export-modal.js
mpigsley/sectors-without-number
import React from 'react'; import dayjs from 'dayjs'; import PropTypes from 'prop-types'; import { FormattedMessage, intlShape } from 'react-intl'; import FlexContainer from 'primitives/container/flex-container'; import Modal from 'primitives/modal/modal'; import Button from 'primitives/other/button'; import ExportTypes from 'constants/export-types'; import { createJSONDownload, createImageDownlaod } from 'utils/export'; import { translateEntities } from 'utils/entity'; import './style.scss'; export default function ExportModal({ isExportOpen, exportType, closeExport, startPrint, setEntityExport, customTags, intl, entities, sector, }) { const onContinue = () => { if (exportType === ExportTypes.json.key) { closeExport(); return createJSONDownload( translateEntities(entities, customTags, intl), `${sector.name} - ${dayjs().format('MMMM D, YYYY')}`, ); } if (exportType === ExportTypes.image.key) { closeExport(); return createImageDownlaod('hex-map'); } return startPrint(); }; return ( <Modal width={500} isOpen={isExportOpen} onCancel={closeExport} title={intl.formatMessage({ id: 'misc.exportOptions' })} actionButtons={[ <Button primary key="continue" onClick={onContinue}> <FormattedMessage id="misc.continue" /> </Button>, ]} > <FlexContainer justify="center"> <Button primary={exportType === ExportTypes.condensed.key} onClick={() => setEntityExport(ExportTypes.condensed.key)} > <FormattedMessage id="misc.condensed" /> </Button> <Button primary={exportType === ExportTypes.expanded.key} onClick={() => setEntityExport(ExportTypes.expanded.key)} > <FormattedMessage id="misc.expanded" /> </Button> </FlexContainer> <FlexContainer justify="center" className="ExportModal-Buttons"> <Button primary={exportType === ExportTypes.image.key} onClick={() => setEntityExport(ExportTypes.image.key)} > <FormattedMessage id="misc.image" /> </Button> <Button primary={exportType === ExportTypes.json.key} onClick={() => setEntityExport(ExportTypes.json.key)} > <FormattedMessage id="misc.jsonFormat" /> </Button> </FlexContainer> <FlexContainer className="ExportModal-Description" justify="center"> <FormattedMessage id={ExportTypes[exportType].description} /> </FlexContainer> </Modal> ); } ExportModal.propTypes = { customTags: PropTypes.shape().isRequired, isExportOpen: PropTypes.bool.isRequired, exportType: PropTypes.string.isRequired, closeExport: PropTypes.func.isRequired, startPrint: PropTypes.func.isRequired, setEntityExport: PropTypes.func.isRequired, intl: intlShape.isRequired, sector: PropTypes.shape({ name: PropTypes.string, }).isRequired, entities: PropTypes.shape().isRequired, };
src/navigation/auth.js
b1alpha/Smoothie-Du-Jour
/** * Auth Scenes * * React Native Starter App * https://github.com/mcnamee/react-native-starter-app */ import React from 'react'; import { Scene, ActionConst } from 'react-native-router-flux'; // Consts and Libs import { AppConfig } from '@constants/'; // Scenes import Authenticate from '@containers/auth/AuthenticateView'; import AuthWebView from '@containers/auth/WebView'; import AuthLogin from '@containers/auth/Login/LoginContainer'; /* Routes ==================================================================== */ const scenes = ( <Scene key={'authenticate'}> <Scene hideNavBar key={'authLanding'} component={Authenticate} type={ActionConst.RESET} analyticsDesc={'Authenticate: Authentication'} /> <Scene {...AppConfig.navbarProps} key={'login'} title={'Login'} clone component={AuthLogin} analyticsDesc={'AuthLogin: Login'} /> <Scene {...AppConfig.navbarProps} key={'signUp'} title={'Sign Up'} clone component={AuthWebView} url={AppConfig.urls.signUp} analyticsDesc={'AuthWebView: Sign Up'} /> <Scene {...AppConfig.navbarProps} key={'passwordReset'} title={'Password Reset'} clone component={AuthWebView} url={AppConfig.urls.resetPassword} analyticsDesc={'AuthWebView: Password Reset'} /> </Scene> ); export default scenes;
src/containers/MessageDisplay/index.js
dramich/twitchBot
import React, { Component } from 'react'; import Tooltip from '../../components/Tooltip'; import { styles } from './styles.scss'; export default class MessageDisplay extends Component { constructor(props) { super(props); this.state = { blurClass: 'row blurred', blurBtn: 'Show Chat', blurMsg: 'Twitch channel chats can be scary places. Unblur at your own risk!', }; } toggleBlur() { if (this.state.blurClass === 'row') { this.setState({ blurClass: 'row blurred', blurBtn: 'Show Chat', blurMsg: 'Twitch channel chats can be scary places. Unblur at your own risk!', }); } else { this.setState({ blurClass: 'row', blurBtn: 'Blur Chat', blurMsg: 'Are your eyes tired yet? Blur the incoming messages!', }); } } parseMessage(msg, emotes) { let splitText; if (emotes) { splitText = msg.split(''); Object.keys(emotes).forEach(i => { const e = emotes[i]; Object.keys(e).forEach(j => { let mote = e[j]; if (typeof mote === 'string') { mote = mote.split('-'); mote = [parseInt(mote[0], 10), parseInt(mote[1], 10)]; const length = mote[1] - mote[0]; const empty = Array.apply(null, new Array(length + 1)).map(() => ''); splitText = splitText.slice(0, mote[0]).concat(empty).concat(splitText.slice(mote[1] + 1, splitText.length)); splitText.splice(mote[0], 1, parseInt(i, 10)); } }); }); return splitText.reduce((msgArr, char) => { if (typeof char === 'number') { msgArr.push(parseInt(char, 10)); } else { if (typeof msgArr[msgArr.length - 1] === 'number') { msgArr.push(char); } else { const newEntry = msgArr[msgArr.length - 1] + char; return msgArr.slice(0, msgArr.length - 1).concat([newEntry]); } } return msgArr; }, ['']); } return [msg]; } mapMessage(msg) { if (!msg) return false; return msg.map((chunk) => { const rand = parseInt(Math.random() * 1000000, 10); if (typeof chunk === 'number') { return ( <img className="emoticon" key={rand} src={`http://static-cdn.jtvnw.net/emoticons/v1/${chunk}/3.0`} alt="Emoticon" /> ); } return ( <span key={rand}>{chunk}</span> ); }); } renderUser(user) { return ( <h4 key={user}> {user} </h4> ); } renderMessage(user, msg) { return ( <h4 key={user}> {msg} </h4> ); } render() { return ( <section className={`${styles}`}> <div className="row message-top-row"> <div className="col-sm-4"> <h2 className="channel-name">{this.props.channel}</h2> </div> <div className="col-sm-8 text-right"> <button className="btn btn-danger btn-blur-toggle" onClick={() => this.toggleBlur()}> {this.state.blurBtn} <Tooltip position="left-center" text={this.state.blurMsg} /> </button> </div> </div> <div className={`row ${this.state.blurClass}`}> <div className="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div className="message-ticker-user"> <div className="ticker-user"> {this.renderUser(this.props.msg.user.username)} </div> </div> <div className="message-ticker-message"> <div className="ticker-message"> {this.renderMessage(this.props.user, this.mapMessage(this.parseMessage(this.props.msg.msg, this.props.msg.user.emotes)))} </div> </div> </div> </div> </section> ); } } MessageDisplay.propTypes = { channel: React.PropTypes.string, msg: React.PropTypes.object, user: React.PropTypes.string, };
src/svg-icons/image/blur-linear.js
skarnecki/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageBlurLinear = (props) => ( <SvgIcon {...props}> <path d="M5 17.5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5-1.5.67-1.5 1.5.67 1.5 1.5 1.5zM9 13c.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 1zM3 21h18v-2H3v2zM5 9.5c.83 0 1.5-.67 1.5-1.5S5.83 6.5 5 6.5 3.5 7.17 3.5 8 4.17 9.5 5 9.5zm0 4c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5-1.5.67-1.5 1.5.67 1.5 1.5 1.5zM9 17c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm8-.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM3 3v2h18V3H3zm14 5.5c.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.5zM13 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 1zm0 4c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1z"/> </SvgIcon> ); ImageBlurLinear = pure(ImageBlurLinear); ImageBlurLinear.displayName = 'ImageBlurLinear'; export default ImageBlurLinear;
actor-apps/app-web/src/app/components/sidebar/RecentSection.react.js
webwlsong/actor-platform
import _ from 'lodash'; import React from 'react'; import { Styles, RaisedButton } from 'material-ui'; import ActorTheme from 'constants/ActorTheme'; import DialogActionCreators from 'actions/DialogActionCreators'; import DialogStore from 'stores/DialogStore'; import CreateGroupActionCreators from 'actions/CreateGroupActionCreators'; import RecentSectionItem from './RecentSectionItem.react'; import CreateGroupModal from 'components/modals/CreateGroup.react'; import CreateGroupStore from 'stores/CreateGroupStore'; const ThemeManager = new Styles.ThemeManager(); const LoadDialogsScrollBottom = 100; const getStateFromStore = () => { return { isCreateGroupModalOpen: CreateGroupStore.isModalOpen(), dialogs: DialogStore.getAll() }; }; class RecentSection extends React.Component { static childContextTypes = { muiTheme: React.PropTypes.object }; getChildContext() { return { muiTheme: ThemeManager.getCurrentTheme() }; } constructor(props) { super(props); this.state = getStateFromStore(); DialogStore.addChangeListener(this.onChange); DialogStore.addSelectListener(this.onChange); CreateGroupStore.addChangeListener(this.onChange); ThemeManager.setTheme(ActorTheme); } componentWillUnmount() { DialogStore.removeChangeListener(this.onChange); DialogStore.removeSelectListener(this.onChange); CreateGroupStore.removeChangeListener(this.onChange); } onChange = () => { this.setState(getStateFromStore()); } openCreateGroup = () => { CreateGroupActionCreators.openModal(); } onScroll = event => { if (event.target.scrollHeight - event.target.scrollTop - event.target.clientHeight <= LoadDialogsScrollBottom) { DialogActionCreators.onDialogsEnd(); } } render() { let dialogs = _.map(this.state.dialogs, (dialog, index) => { return ( <RecentSectionItem dialog={dialog} key={index}/> ); }, this); let createGroupModal; if (this.state.isCreateGroupModalOpen) { createGroupModal = <CreateGroupModal/>; } return ( <section className="sidebar__recent"> <ul className="sidebar__list sidebar__list--recent" onScroll={this.onScroll}> {dialogs} </ul> <footer> <RaisedButton label="Create group" onClick={this.openCreateGroup} style={{width: '100%'}}/> {createGroupModal} </footer> </section> ); } } export default RecentSection;
docs/pages/api-docs/list-subheader.js
lgollut/material-ui
import React from 'react'; import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; import { prepareMarkdown } from 'docs/src/modules/utils/parseMarkdown'; const pageFilename = 'api/list-subheader'; const requireRaw = require.context('!raw-loader!./', false, /\/list-subheader\.md$/); export default function Page({ docs }) { return <MarkdownDocs docs={docs} />; } Page.getInitialProps = () => { const { demos, docs } = prepareMarkdown({ pageFilename, requireRaw }); return { demos, docs }; };
app/javascript/mastodon/features/ui/components/actions_modal.js
pso2club/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import StatusContent from '../../../components/status_content'; import Avatar from '../../../components/avatar'; import RelativeTimestamp from '../../../components/relative_timestamp'; import DisplayName from '../../../components/display_name'; import IconButton from '../../../components/icon_button'; import classNames from 'classnames'; export default class ActionsModal extends ImmutablePureComponent { static propTypes = { status: ImmutablePropTypes.map, actions: PropTypes.array, onClick: PropTypes.func, }; renderAction = (action, i) => { if (action === null) { return <li key={`sep-${i}`} className='dropdown-menu__separator' />; } const { icon = null, text, meta = null, active = false, href = '#' } = action; return ( <li key={`${text}-${i}`}> <a href={href} target='_blank' rel='noopener' onClick={this.props.onClick} data-index={i} className={classNames({ active })}> {icon && <IconButton title={text} icon={icon} role='presentation' tabIndex='-1' inverted />} <div> <div className={classNames({ 'actions-modal__item-label': !!meta })}>{text}</div> <div>{meta}</div> </div> </a> </li> ); } render () { const status = this.props.status && ( <div className='status light'> <div className='boost-modal__status-header'> <div className='boost-modal__status-time'> <a href={this.props.status.get('url')} className='status__relative-time' target='_blank' rel='noopener'> <RelativeTimestamp timestamp={this.props.status.get('created_at')} /> </a> </div> <a href={this.props.status.getIn(['account', 'url'])} className='status__display-name'> <div className='status__avatar'> <Avatar account={this.props.status.get('account')} size={48} /> </div> <DisplayName account={this.props.status.get('account')} /> </a> </div> <StatusContent status={this.props.status} /> </div> ); return ( <div className='modal-root__modal actions-modal'> {status} <ul className={classNames({ 'with-status': !!status })}> {this.props.actions.map(this.renderAction)} </ul> </div> ); } }
src/icons/IosBookOutline.js
fbfeix/react-icons
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class IosBookOutline extends React.Component { render() { if(this.props.bare) { return <g> <path d="M347.621,64c-40.941,0-79.121,14-91.578,44.495C242.5,78,205.408,64,164.466,64C109.265,64,64,89.98,64,143v1v8.995V417v9 h6.215h10.958h4.967c12.86-26.334,44.238-42,78.325-42c40.224,0,73.877,27.528,81.617,64h19.714c7.739-36.472,41.495-64,81.722-64 c34.085,0,61.149,11.666,78.429,42h4.967h10.959H448v-17V148v-4v-1C448,89.98,402.823,64,347.621,64z M248,410.926 C230,385.055,199.27,368,164.5,368c-34.769,0-64.5,10.055-83.5,35.926l-1,0.537V142l0,0v-1c3-41.825,40.089-61,84.293-61 c45.162,0,82.145,18.708,83.363,61.808c-0.017,0.729,0.016,1.459,0.016,2.192L248,157.103V410.926z M432,148v255.926 C414,378.055,382.269,368,347.5,368c-34.77,0-65.5,17.055-83.5,42.926V145v-1c0-44.112,37.659-64,83.587-64 C391.79,80,429,91.175,432,133v1V148z"></path> </g>; } return <IconBase> <path d="M347.621,64c-40.941,0-79.121,14-91.578,44.495C242.5,78,205.408,64,164.466,64C109.265,64,64,89.98,64,143v1v8.995V417v9 h6.215h10.958h4.967c12.86-26.334,44.238-42,78.325-42c40.224,0,73.877,27.528,81.617,64h19.714c7.739-36.472,41.495-64,81.722-64 c34.085,0,61.149,11.666,78.429,42h4.967h10.959H448v-17V148v-4v-1C448,89.98,402.823,64,347.621,64z M248,410.926 C230,385.055,199.27,368,164.5,368c-34.769,0-64.5,10.055-83.5,35.926l-1,0.537V142l0,0v-1c3-41.825,40.089-61,84.293-61 c45.162,0,82.145,18.708,83.363,61.808c-0.017,0.729,0.016,1.459,0.016,2.192L248,157.103V410.926z M432,148v255.926 C414,378.055,382.269,368,347.5,368c-34.77,0-65.5,17.055-83.5,42.926V145v-1c0-44.112,37.659-64,83.587-64 C391.79,80,429,91.175,432,133v1V148z"></path> </IconBase>; } };IosBookOutline.defaultProps = {bare: false}
src/svg-icons/notification/wifi.js
mtsandeep/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NotificationWifi = (props) => ( <SvgIcon {...props}> <path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z"/> </SvgIcon> ); NotificationWifi = pure(NotificationWifi); NotificationWifi.displayName = 'NotificationWifi'; NotificationWifi.muiName = 'SvgIcon'; export default NotificationWifi;
src/routes/dashboard/components/cpu.js
terryli1643/thinkmore
import React from 'react' import PropTypes from 'prop-types' import styles from './cpu.less' import { color } from '../../../utils' import CountUp from 'react-countup' import { LineChart, Line, XAxis, YAxis, CartesianGrid, ResponsiveContainer } from 'recharts' const countUpProps = { start: 0, duration: 2.75, useEasing: true, useGrouping: true, separator: ',', } function Cpu ({ usage, space, cpu, data }) { return (<div className={styles.cpu}> <div className={styles.number}> <div className={styles.item}> <p>usage</p> <p><CountUp end={usage} suffix="GB" {...countUpProps} /></p> </div> <div className={styles.item}> <p>space</p> <p><CountUp end={space} suffix="GB" {...countUpProps} /></p> </div> <div className={styles.item}> <p>cpu</p> <p><CountUp end={cpu} suffix="%" {...countUpProps} /></p> </div> </div> <ResponsiveContainer minHeight={300}> <LineChart data={data} margin={{ left: -40 }}> <XAxis dataKey="name" axisLine={{ stroke: color.borderBase, strokeWidth: 1 }} tickLine={false} /> <YAxis axisLine={false} tickLine={false} /> <CartesianGrid vertical={false} stroke={color.borderBase} strokeDasharray="3 3" /> <Line type="monotone" connectNulls dataKey="cpu" stroke={color.blue} fill={color.blue} /> </LineChart> </ResponsiveContainer> </div>) } Cpu.propTypes = { data: PropTypes.array, usage: PropTypes.number, space: PropTypes.number, cpu: PropTypes.number, } export default Cpu
app/src/components/Tutorial/index.js
civa86/web-synth
import React from 'react'; import icon from '../../../img/icon.png'; const Tutorial = () => { return ( <div id="tutorial" className="modal fade" tabIndex="-1" role="dialog"> <div className="modal-dialog" role="document"> <div className="modal-content"> <div className="modal-header modal-pre-hide"> <div className="logo no-select cursor-default"> <div className="pull-left icon"> <img src={icon} alt="icon"/> </div> <div className="pull-left"> <span className="capital">H</span>ow <span className="capital">T</span>o <span className="capital">U</span>se </div> </div> <div className="menu hidden-xs"> <ul className="no-select"> <li className="menu-item active" data-target="#carousel-slides" data-slide-to="0"> <a className="cursor-pointer"> <i className="ion-information-circled"/> <span className="menu-label">Intro</span> </a> </li> <li className="menu-item" data-target="#carousel-slides" data-slide-to="1"> <a> <i className="ion-fork-repo"/> <span className="menu-label">Add</span> </a> </li> <li className="menu-item" data-target="#carousel-slides" data-slide-to="2"> <a> <i className="ion-pull-request"/> <span className="menu-label">Link</span> </a> </li> <li className="menu-item" data-target="#carousel-slides" data-slide-to="3"> <a> <i className="icon-piano" style={{ fontSize: '18px' }}/> <span className="menu-label">Play</span> </a> </li> <li className="menu-item" data-target="#carousel-slides" data-slide-to="4"> <a> <i className="ion-levels"/> <span className="menu-label">Control</span> </a> </li> <li className="menu-item" data-target="#carousel-slides" data-slide-to="5"> <a> <i className="ion-trash-b"/> <span className="menu-label">Delete</span> </a> </li> </ul> </div> </div> <div className="modal-body modal-pre-hide"> <div id="carousel-slides" className="carousel slide" data-interval="false" data-ride="carousel"> <div className="carousel-inner" role="listbox"> <div className="item active" data-index="0"> <div className="intro"> <h4>Welcome to ElectroPhone</h4> <p className="sub-title"> Learn how to start building and playing your custom syntesizer. </p> <p> Based on Web Audio API. </p> <p> Add modules and link them each other. </p> <p> Master module lets sound coming out your sound card. </p> <p> User you keyboard to play notes. </p> <p> Change between graph and control view. </p> <p> Turn knobs to change module properties. </p> </div> </div> <div className="item" data-index="1"> <div className="anim-slide add-modules-slide"/> <div className="carousel-caption"> <i className="badge-icon ion-ios-information-outline"/> <span className="badge-txt"> Add modules and build your synthesizer.<br/> Oscillator and Noise can make sounds. </span> </div> </div> <div className="item" data-index="2"> <div className="anim-slide link-modules-slide"/> <div className="carousel-caption"> <i className="badge-icon ion-ios-information-outline"/> <span className="badge-txt"> Link modules. Sound comes out from Master.<br/> Press <b className="key">SHIFT</b> to quick toggle link mode. </span> </div> </div> <div className="item" data-index="3"> <div className="anim-slide play-slide"/> <div className="carousel-caption top-caption"> <i className="badge-icon ion-ios-information-outline"/> <span className="badge-txt"> Play with your keyboard.<br/> Press <b className="key">Z</b> <b className="key">X</b> to change octave. </span> </div> </div> <div className="item" data-index="4"> <div className="anim-slide control-slide"/> <div className="carousel-caption"> <i className="badge-icon ion-ios-information-outline"/> <span className="badge-txt"> Control module properties.<br/> Press <b className="key">TAB</b> to switch view. </span> </div> </div> <div className="item" data-index="5"> <div className="anim-slide delete-slide"/> <div className="carousel-caption"> <i className="badge-icon ion-ios-information-outline"/> <span className="badge-txt"> Delete modules.<br/> press <b className="key">DELETE</b> to remove selected modules. </span> </div> </div> </div> <a className="cursor-pointer left carousel-control" data-target="#carousel-slides" role="button" data-slide="prev"> <span className="carousel-control-icon ion-chevron-left"/> </a> <a className="cursor-pointer right carousel-control" data-target="#carousel-slides" role="button" data-slide="next"> <span className="carousel-control-icon ion-chevron-right"/> </a> </div> </div> <div className="modal-footer modal-pre-hide"> <button className="btn" data-dismiss="modal">Got It!</button> </div> </div> </div> </div> ); }; export default Tutorial;
src/index.js
john-d-pelingo/tic-tac-toe
import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import configureStore from 'core/store'; import App from 'views/app'; import { BoardContainer, MessageContainer, ScoresContainer } from 'views/containers'; // Styles import 'static/scss/style.css'; import registerServiceWorker from './registerServiceWorker'; const store = configureStore(); ReactDOM.render( <Provider store={ store }> <App> <MessageContainer /> <ScoresContainer /> <BoardContainer /> </App> </Provider>, document.getElementById('root') ); registerServiceWorker();
src/index.js
eugene-matvejev/battleship-game-gui-react-js
import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter, Route, Switch } from 'react-router-dom'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import generate from 'node-random-name'; import WebApp from './web-app'; import unauthorizedRoutes from './__configs/router.unauthorized.routes'; import authorizedRoutes from './__configs/router.authorized.routes'; import sidenavUnauthorizedRoutes from './__configs/sidenav.unauthorized.routes'; import sidenavAuthorizedRoutes from './__configs/sidenav.authorized.routes'; import './index.scss'; const mock = new MockAdapter(axios, { delayResponse: 100 }); mock.onPost(/account/, { username: 'example@example.com', password: 'password' }).reply( 201, { user: { id: 'id', username: 's', }, session: { id: 'test-session-hash' }, } ); mock.onAny(/account/).reply(401); mock.onGet(/spotlight/).reply( 200, (() => [ { text: 'friends', nodes: (new Array(20)).fill(1).map((_, i) => ({ text: `friend No ${i} "${generate()}"` })), }, { text: 'alliances', nodes: (new Array(5)).fill(1).map((_, i) => ({ text: `alliance No ${i} "${generate()}"`, nodes: (new Array(4)).fill(1).map((_, j) => ({ text: `guild No ${j} "${generate()}"`, nodes: (new Array(20)).fill(1).map((_, k) => ({ text: `guild's ${i} member ${k} "${generate()}"`, })) })) })), }, { text: 'guilds', nodes: [ ...(new Array(2)).fill(1).map((_, i) => ({ text: `guild No ${i} "${generate()}"`, nodes: (new Array(20).fill(1)).map((_, j) => ({ text: `guild's ${i} member ${j} "${generate()}"`, })), })), { text: 'no children', }, ], }, { text: 'no children', }, ])() ); mock.onAny(/history/).reply(401); // mock.onGet(/game/, { page: 1 }).reply( // 200, // [ // { id: 1, name: 'test', timestamp: (new Date()).toLocaleString(), }, // { id: 2, name: 'test', timestamp: (new Date()).toLocaleString(), }, // { id: 3, name: 'test', timestamp: (new Date()).toLocaleString(), }, // { id: 4, name: 'test', timestamp: (new Date()).toLocaleString(), }, // { id: 5, name: 'test', timestamp: (new Date()).toLocaleString(), }, // ], // { // 'x-page-page': 1, // 'x-page-total': 2, // } // ); // mock.onGet(/game/, { page: 2 }).reply( // 200, // [ // { id: 6, name: 'test', timestamp: (new Date()).toLocaleString(), }, // { id: 7, name: 'test', timestamp: (new Date()).toLocaleString(), }, // ], // { // 'x-page-page': 2, // 'x-page-total': 2, // } // ); // mock.onGet(/game/).reply( // 404, // [ // ], // { // 'x-page-page': 2, // 'x-page-total': 2, // } // ); const props = { authorizedRoutes, unauthorizedRoutes, sidenavUnauthorizedRoutes, sidenavAuthorizedRoutes, title: process.env['REACT_APP_WEBSITE_NAME'], } ReactDOM.render( <BrowserRouter> <Switch> <Route path="/" component={() => <WebApp {...props} />} /> </Switch> </BrowserRouter>, document.getElementById('app') );
extension/panel/src/routes.js
capacitorjs/capacitor
'use strict'; import AppView from 'src/components/app-view'; import PluginContainer from 'src/components/plugin-container'; import React from 'react'; import {Route} from 'react-router'; export default ( <Route name='home' path='/' handler={AppView}> <Route name='plugin' path='/plugin/:pluginId' handler={PluginContainer}/> </Route> );
src/client.js
nambawan/g-old
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-present Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import 'whatwg-fetch'; import React from 'react'; import ReactDOM from 'react-dom'; import deepForceUpdate from 'react-deep-force-update'; import queryString from 'query-string'; import { createPath } from 'history/PathUtils'; import { addLocaleData } from 'react-intl'; import de from 'react-intl/locale-data/de'; import it from 'react-intl/locale-data/it'; import lld from './locales/lld'; import App from './components/App'; import createFetch from './createFetch'; import configureStore from './store/configureStore'; import { updateMeta } from './DOMUtils'; import history from './history'; import router from './router'; import { getIntl } from './actions/intl'; import { LOADING_START, LOADING_SUCCESS } from './constants'; /* @intl-code-template addLocaleData(${lang}); */ addLocaleData(de); addLocaleData(it); addLocaleData(lld); /* @intl-code-template-end */ /* eslint-disable global-require */ // Universal HTTP client const fetch = createFetch(window.fetch, { baseUrl: window.App.apiUrl, }); const store = configureStore(window.App.state, { history, fetch }); /* eslint-disable global-require */ // Global (context) variables that can be easily accessed from any React component // https://facebook.github.io/react/docs/context.html const context = { // Enables critical path CSS rendering // https://github.com/kriasoft/isomorphic-style-loader insertCss: (...styles) => { // eslint-disable-next-line no-underscore-dangle const removeCss = styles.map(x => x._insertCss()); return () => { removeCss.forEach(f => f()); }; }, store, // storeSubscription: null, // Universal HTTP client fetch, // intl instance as it can be get with injectIntl intl: store.dispatch(getIntl()), }; const container = document.getElementById('app'); let currentLocation = history.location; let appInstance; const scrollPositionsHistory = {}; // Re-render the app when window.location changes async function onLocationChange(location, action) { // Remember the latest scroll position for the previous location scrollPositionsHistory[currentLocation.key] = { scrollX: window.pageXOffset, scrollY: window.pageYOffset, }; // Delete stored scroll position for next page if any if (action === 'PUSH') { delete scrollPositionsHistory[location.key]; } currentLocation = location; context.intl = store.dispatch(getIntl()); const isInitialRender = !action; try { // Show loading indicator store.dispatch({ type: LOADING_START, payload: location.pathname }); context.pathname = location.pathname; context.query = queryString.parse(location.search); context.locale = store.getState().intl.locale; // Traverses the list of routes in the order they are defined until // it finds the first route that matches provided URL path string // and whose action method returns anything other than `undefined`. const route = await router.resolve(context); // Prevent multiple page renders during the routing process if (currentLocation.key !== location.key) { return; } if (route.redirect) { history.replace(route.redirect); return; } const renderReactApp = isInitialRender ? ReactDOM.hydrate : ReactDOM.render; appInstance = renderReactApp( <App context={context}>{route.component}</App>, container, () => { if (isInitialRender) { // Switch off the native scroll restoration behavior and handle it manually // https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration if (window.history && 'scrollRestoration' in window.history) { window.history.scrollRestoration = 'manual'; } const elem = document.getElementById('css'); if (elem) elem.parentNode.removeChild(elem); return; } document.title = route.title; updateMeta('description', route.description); // Update necessary tags in <head> at runtime here, ie: // updateMeta('keywords', route.keywords); // updateCustomMeta('og:url', route.canonicalUrl); // updateCustomMeta('og:image', route.imageUrl); // updateLink('canonical', route.canonicalUrl); // etc. let scrollX = 0; let scrollY = 0; const pos = scrollPositionsHistory[location.key]; if (pos) { /* eslint-disable prefer-destructuring */ scrollX = pos.scrollX; scrollY = pos.scrollY; /* eslint-enable prefer-destructuring */ } else { const targetHash = location.hash.substr(1); if (targetHash) { const target = document.getElementById(targetHash); if (target) { scrollY = window.pageYOffset + target.getBoundingClientRect().top; } } } // Restore the scroll position if it was saved into the state // or scroll to the given #hash anchor // or scroll to top of the page window.scrollTo(scrollX, scrollY); // Google Analytics tracking. Don't send 'pageview' event after // the initial rendering, as it was already sent if (window.ga) { window.ga('send', 'pageview', createPath(location)); } }, ); store.dispatch({ type: LOADING_SUCCESS }); } catch (error) { if (__DEV__) { throw error; } console.error(error); // Do a full page reload if error occurs during client-side navigation if (!isInitialRender && currentLocation.key === location.key) { console.error('RSK will reload your page after error'); window.location.reload(); } } } let isHistoryObserved = false; export default function main() { // Handle client-side navigation by using HTML5 History API // For more information visit https://github.com/mjackson/history#readme currentLocation = history.location; if (!isHistoryObserved) { isHistoryObserved = true; history.listen(onLocationChange); } onLocationChange(currentLocation); } // globally accesible entry point window.RSK_ENTRY = main; // Enable Hot Module Replacement (HMR) if (module.hot) { module.hot.accept('./router', () => { if (appInstance && appInstance.updater.isMounted(appInstance)) { // Force-update the whole tree, including components that refuse to update deepForceUpdate(appInstance); } onLocationChange(currentLocation); }); }
app/.storybook/rr.js
atralice/reactDockerizeBoilerplate
import React from 'react'; import { action } from '@storybook/addon-actions'; // Export the original react-router module.exports = require('react-router-original'); // Set the custom link component. module.exports.Link = class Link extends React.Component { handleClick(e) { e.preventDefault(); const { to } = this.props; action('Link')(to); } render() { const { children, style, to } = this.props; return ( <a style={style} href={to} onClick={(e) => this.handleClick(e)} > {children} </a> ); } };
packages/lore-hook-forms-bootstrap/src/blueprints/create/Optimistic/index.js
lore/lore-forms
import React from 'react'; import createReactClass from 'create-react-class'; import Optimistic from './Optimistic'; export default createReactClass({ render: function() { const { schema, fieldMap, actionMap, data, validators, fields, actions, ...other } = this.props; return ( <Optimistic schema={schema} fieldMap={fieldMap} actionMap={actionMap} data={data} validators={validators} fields={fields || [ { key: 'question', type: 'custom', props: { render: (form) => { return ( <p> No fields have been provided. </p> ); } } } ]} actions={actions || [ { type: 'primary', props: (form) => { return { label: 'Create', disabled: form.hasError, onClick: () => { form.callbacks.onSubmit(form.data) } } } } ]} {...other} /> ); } });
src/map/js/components/Modals/ShareModal.js
wri/gfw-water
import ModalWrapper from 'components/Modals/ModalWrapper'; import {modalStore} from 'stores/ModalStore'; import {modalText} from 'js/config'; import utils from 'utils/AppUtils'; import React from 'react'; let facebookSvg = '<use xlink:href="#icon-facebook" />'; let twitterSvg = '<use xlink:href="#icon-twitter" />'; let googleSvg = '<use xlink:href="#icon-googleplus" />'; let windowOptions = 'toolbar=0,status=0,height=650,width=450'; export default class ShareModal extends React.Component { constructor (props) { super(props); modalStore.listen(this.storeUpdated.bind(this)); let defaultState = modalStore.getState(); this.state = { bitlyUrl: defaultState.bitlyUrl, copyText: modalText.share.copyButton }; } storeUpdated () { let newState = modalStore.getState(); this.setState({ bitlyUrl: newState.bitlyUrl, copyText: modalText.share.copyButton }); } copyShare () { let element = this.refs.shareInput; if (utils.copySelectionFrom(element)) { this.setState({ copyText: modalText.share.copiedButton }); } else { alert(modalText.share.copyFailure); } } shareGoogle () { let url = modalText.share.googleUrl(this.state.bitlyUrl); window.open(url, 'Google Plus', windowOptions); } shareFacebook () { let url = modalText.share.facebookUrl(this.state.bitlyUrl); window.open(url, 'Facebook', windowOptions); } shareTwitter () { let url = modalText.share.twitterUrl(this.state.bitlyUrl); window.open(url, 'Twitter', windowOptions); } handleFocus (e) { setTimeout(() => { e.target.select(); }, 0); } render () { return ( <ModalWrapper> <div className='modal-title'>{modalText.share.title}</div> <div className='share-instructions'>{modalText.share.linkInstructions}</div> <div className='share-input'> <input ref='shareInput' type='text' readOnly value={this.state.bitlyUrl} onClick={this.handleFocus} /> <button className='gfw-btn white pointer' onClick={this.copyShare.bind(this)}>{this.state.copyText}</button> </div> <div className='share-items'> <div title='Google Plus' className='share-card googleplus-modal pointer' onClick={this.shareGoogle.bind(this)}> <svg dangerouslySetInnerHTML={{ __html: googleSvg }}/> </div> <div title='Twitter' className='share-card twitter-modal pointer' onClick={this.shareTwitter.bind(this)}> <svg dangerouslySetInnerHTML={{ __html: twitterSvg }}/> </div> <div title='Facebook' className='share-card facebook-modal pointer' onClick={this.shareFacebook.bind(this)}> <svg dangerouslySetInnerHTML={{ __html: facebookSvg }}/> </div> </div> </ModalWrapper> ); } }