path
stringlengths
5
195
repo_name
stringlengths
5
79
content
stringlengths
25
1.01M
src/containers/DataPage.js
wanyine/vr-store-frontend
import React from 'react' import LoginForm from '../components/LoginForm' import RoDialog from '../components/RoDialog' import RecordSummaryTable from '../components/RecordSummaryTable' import RecordDetailTable from '../components/RecordDetailTable' import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import {List, ListItem} from 'material-ui/List'; import {Card, CardActions, CardHeader, CardText} from 'material-ui/Card'; import {Table, TableBody, TableFooter, TableHeader, TableHeaderColumn, TableRow, TableRowColumn} from 'material-ui/Table'; import IconButton from 'material-ui/IconButton'; import Layout from './Layout' import ActionVisible from 'material-ui/svg-icons/action/visibility'; import {actions as snackBarActions} from '../reducers/snackBar' import {actions as dialogActions} from '../reducers/dialog' import {actions as recordActions} from '../reducers/record' import client from '../http/client' const DataPage = props => { const {recordState, dialogState, ...actions} = props const loadRecords = ({date, period=1, grouped=false}) => { let params = {beginDay:date, days:period} if(grouped){ params.groupByDate = 1 } client.get('/records', {params}) .then(res => { if(grouped){ actions.setRecordGroups(res.data) } else{ actions.setDailyRecords({date:(new Date(date)).toLocaleDateString(), records:res.data}) actions.showDialog(true) } }) .catch(err => actions.openSnackBar(err.message)) } return ( <Layout> <RecordSummaryTable recordState={recordState} onWatch={ date => loadRecords({date})} onQuery={ () => loadRecords({grouped:true, period:recordState.period, date:recordState.date})} select_date={actions.select_date} select_period={actions.select_period} /> <RoDialog title = {recordState.dailyRecords.date} open={dialogState} onConfirm={event => actions.showDialog(false)} > <RecordDetailTable records={recordState.dailyRecords.records}/> </RoDialog> </Layout> ) } export default connect( state =>({recordState:state.record, dialogState:state.dialog}), dispatch => bindActionCreators(Object.assign(snackBarActions, dialogActions, recordActions), dispatch) )(DataPage);
src/components/currentgraphcontrols/partitionsizer.js
jamjar919/bork
import React from 'react'; import PropTypes from 'prop-types'; import { Range } from 'rc-slider'; import 'rc-slider/assets/index.css'; function indexesToSizes(indexes) { const sizes = []; let lastVal = 0; for (let i = 0; i < indexes.length; i += 1) { sizes.push(indexes[i] - lastVal); lastVal = indexes[i]; } return sizes; } class PartitionSizer extends React.Component { constructor() { super(); this.state = { defaultVals: [], }; } componentWillMount() { this.setDefaultVals(this.props.size, this.props.partitions, this.props.callback); } componentWillReceiveProps(nextProps) { if (nextProps.partitions !== this.props.partitions) { this.setDefaultVals(nextProps.size, nextProps.partitions, nextProps.callback); } } shouldComponentUpdate(nextProps) { return this.props.partitions !== nextProps.partitions; } setDefaultVals(size, partitions, callback) { const defaultVals = []; const partitionSize = Math.floor(size / partitions); for (let i = 0; i < partitions; i += 1) { defaultVals.push(partitionSize); } if (size - defaultVals.reduce((a, b) => a + b, 0) > 0) { let remaining = size - defaultVals.reduce((a, b) => a + b, 0); let j = 0; while (remaining > 0) { defaultVals[j] += 1; remaining -= 1; j += 1; } } let sum = 0; for (let i = 0; i < defaultVals.length; i += 1) { sum += defaultVals[i]; defaultVals[i] = sum; } callback(defaultVals, indexesToSizes(defaultVals)); this.setState({ defaultVals }); } render() { const handleStyles = []; const railStyles = []; let b = 255; for (let i = 0; i < this.props.partitions - 1; i += 1) { handleStyles.push({ borderColor: `rgb(171, 226, ${b.toString()})` }); railStyles.push({ backgroundColor: `rgb(171, 226, ${b.toString()})` }); b -= Math.floor(255 / this.props.partitions); } return ( <Range className="partition-resizer" key={this.props.partitions} min={0} max={this.props.size} count={this.props.partitions - 1} pushable handleStyle={handleStyles} trackStyle={railStyles} dotStyle={{ borderColor: '#888', }} railStyle={{ backgroundColor: '#95a5a6', }} defaultValue={this.state.defaultVals} onAfterChange={(e) => { this.props.callback(e, indexesToSizes(e)); }} /> ); } } PartitionSizer.defaultProps = { size: 0, partitions: 2, callback: () => [], }; PartitionSizer.propTypes = { size: PropTypes.number, partitions: PropTypes.number, callback: PropTypes.func, }; export default PartitionSizer;
src/app/component/paragraph/paragraph.js
all3dp/printing-engine-client
import PropTypes from 'prop-types' import React from 'react' import propTypes from '../../prop-types' import cn from '../../lib/class-names' const Paragraph = ({ classNames, children, size = 'default', strong = false, minor = false, warning = false }) => ( <p className={cn('Paragraph', {[`size-${size}`]: size, strong, minor, warning}, classNames)}> {children} </p> ) Paragraph.propTypes = { ...propTypes.component, children: PropTypes.node.isRequired, size: PropTypes.oneOf(['default', 'l', 's']), strong: PropTypes.bool, minor: PropTypes.bool, warning: PropTypes.bool } export default Paragraph
src/components/CustomIcons/ResistorIcon.js
wavicles/fossasia-pslab-apps
import React from 'react'; const ResistorIcon = ({ size = '1.5em', color = 'rgba(0, 0, 0, 0.38)' }) => { return ( <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" width={size} height={size} x="0px" y="0px" viewBox="0 0 462.782 462.782" > <g fill={color} id="XMLID_21_"> <path id="XMLID_904_" d="M350.272,323.014c-5.974,0-11.411-3.556-13.783-9.091l-50.422-117.65l-40.505,116.662 c-2.08,5.989-7.699,10.023-14.038,10.08c-0.044,0-0.089,0-0.133,0c-6.286,0-11.911-3.921-14.081-9.831l-41.979-114.358 l-40.798,114.234c-2.095,5.867-7.599,9.828-13.827,9.952c-6.242,0.127-11.886-3.615-14.213-9.394l-31.482-78.172H0v-30h85.141 c6.121,0,11.627,3.719,13.914,9.396l20.511,50.93l41.446-116.048c2.124-5.947,7.745-9.927,14.06-9.955c0.022,0,0.044,0,0.066,0 c6.289,0,11.912,3.923,14.081,9.831l41.779,113.814l39.431-113.565c2.032-5.851,7.451-9.852,13.64-10.071 c6.203-0.217,11.877,3.389,14.317,9.082l49.683,115.927l15.254-48.815c1.957-6.262,7.756-10.526,14.317-10.526h85.141v30h-74.113 l-24.076,77.043c-1.873,5.994-7.281,10.186-13.553,10.506C350.784,323.007,350.527,323.014,350.272,323.014z" /> </g> <g /> <g /> <g /> <g /> <g /> <g /> <g /> <g /> <g /> <g /> <g /> <g /> <g /> <g /> <g /> </svg> ); }; export default ResistorIcon;
app/containers/App/index.js
andreasasprou/react-boilerplate-auth
/** * * App.react.js * * This component is the skeleton around the actual pages, and should only * contain code that should be seen on all pages. (e.g. navigation bar) * * NOTE: while this component should technically be a stateless functional * component (SFC), hot reloading does not currently support SFCs. If hot * reloading is not a necessity for you then you can refactor it and remove * the linting exception. */ import React from 'react'; export default class App extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function render() { return ( <div> {React.Children.toArray(this.props.children)} </div> ); } } App.propTypes = { children: React.PropTypes.node, };
src/containers/App.js
superphy/reactapp
import React, { Component } from 'react'; // Components from react-md import NavigationDrawer from 'react-md/lib/NavigationDrawers' import NavLink from '../containers/NavLink' import Avatar from 'react-md/lib/Avatars'; import logo from '../spfy.png' import { version } from '../middleware/api' // react-router import { withRouter } from 'react-router'; import History from '../History'; import Routes from '../Routes'; // bearer token import { bearer, tokenTo } from '../middleware/bearer' import { Redirect } from 'react-router' import { saveStore } from '../middleware/accounts' // redux import { connect } from 'react-redux' // links import { HOME, RESULTS } from '../Routes' class App extends Component { constructor(props){ super(props) this.state = { token: '', fetched: false } } _setToken = (token) => { this.setState({'token': token}) } _setFetched = (bool) => { // A handler to block render until jobs are fetched. this.setState({'fetched': bool}) } componentWillMount(){ bearer(location, this._setToken, this._setFetched, this.props.dispatch, this.props.jobs) } componentWillUpdate(){ console.log('App will update') // Foces store to sync will any change. if (this.state.token){ console.log('Posting store...') saveStore( this.props.jobs, this.state.token) } } render(){ const { token, fetched } = this.state; var navItems = [{ exact: true, label: 'Tasks', to: HOME, icon: 'dashboard' }, { label: 'Results', to: RESULTS, icon: 'bubble_chart' }]; return ( <div> {token? <Redirect to={tokenTo(location.pathname, token)}/> :""} <NavigationDrawer drawerTitle="spfy" drawerHeaderChildren={ <Avatar src={logo} alt="logo" /> } toolbarStyle={{'visibility':'hidden'}} navItems={ navItems.map(props => <NavLink {...props} key={props.to} />) } > <History /> {fetched?<div> <Routes key={location.key} token={token} /> <p style={{ 'right': 20, 'top': 20, 'position': 'absolute', 'textAlign': 'right' }}> For Contact, Email: chad.laing@canada.ca <br></br> {version} <a href="https://github.com/superphy/spfy">superphy/spfy</a> </p> </div>:''} </NavigationDrawer> </div> ) } } const mapStateToProps = (state, ownProps) => { return { jobs: state.jobs, ...ownProps } } App = withRouter( connect( mapStateToProps )(App)) export default App
src/parser/monk/mistweaver/modules/talents/SpiritOfTheCrane.js
fyruna/WoWAnalyzer
import React from 'react'; import SPELLS from 'common/SPELLS'; import SpellLink from 'common/SpellLink'; import { formatNumber } from 'common/format'; import TalentStatisticBox from 'interface/others/TalentStatisticBox'; import Analyzer from 'parser/core/Analyzer'; import { STATISTIC_ORDER } from 'interface/others/StatisticBox'; const SOTC_MANA_PER_SECOND_RETURN_MINOR = 80; const SOTC_MANA_PER_SECOND_RETURN_AVERAGE = SOTC_MANA_PER_SECOND_RETURN_MINOR - 15; const SOTC_MANA_PER_SECOND_RETURN_MAJOR = SOTC_MANA_PER_SECOND_RETURN_MINOR - 15; const debug = false; class SpiritOfTheCrane extends Analyzer { castsTp = 0; buffTotm = 0; castsBk = 0; lastTotmBuffTimestamp = null; totmOverCap = 0; totmBuffWasted = 0; totalTotmBuffs = 0; manaReturnSotc = 0; sotcWasted = 0; constructor(...args) { super(...args); this.active = this.selectedCombatant.hasTalent(SPELLS.SPIRIT_OF_THE_CRANE_TALENT.id); } on_byPlayer_applybuff(event) { const spellId = event.ability.guid; if (spellId === SPELLS.TEACHINGS_OF_THE_MONASTERY.id) { this.buffTotm += 1; this.lastTotmBuffTimestamp = event.timestamp; debug && console.log(`ToTM at ${this.buffTotm}`); } } on_byPlayer_applybuffstack(event) { const spellId = event.ability.guid; if (spellId === SPELLS.TEACHINGS_OF_THE_MONASTERY.id) { this.buffTotm += 1; this.lastTotmBuffTimestamp = event.timestamp; debug && console.log(`ToTM at ${this.buffTotm}`); } } on_byPlayer_removebuff(event) { const spellId = event.ability.guid; if (SPELLS.TEACHINGS_OF_THE_MONASTERY.id === spellId) { debug && console.log(event.timestamp); if ((event.timestamp - this.lastTotmBuffTimestamp) > SPELLS.TEACHINGS_OF_THE_MONASTERY.buffDur) { this.totmBuffWasted += 1; this.buffTotm = 0; debug && console.log('ToTM Buff Wasted'); } this.buffTotm = 0; // debug && console.log('ToTM Buff Zero'); } } on_byPlayer_energize(event) { const spellId = event.ability.guid; if (spellId === SPELLS.SPIRIT_OF_THE_CRANE_BUFF.id) { this.manaReturnSotc += event.resourceChange - event.waste; this.sotcWasted += event.waste; debug && console.log(`SotC Entergize: ${event.resourceChange - event.waste} Total: ${this.manaReturnSotc}`); debug && console.log(`SotC Waste: ${event.waste} Total: ${this.sotcWasted} Timestamp: ${event.timestamp}`); } } on_byPlayer_cast(event) { const spellId = event.ability.guid; if (!this.selectedCombatant.hasBuff(SPELLS.TEACHINGS_OF_THE_MONASTERY.id)) { // console.log('No TotM Buff'); return; } // Need to track when you over cap Teachings stacks. There is no apply aura event fired, so manually tracking stacks. if (spellId === SPELLS.TIGER_PALM.id && this.buffTotm === 3) { debug && console.log(`TP Casted at 3 stacks ${event.timestamp}`); this.lastTotmBuffTimestamp = event.timestamp; this.totmOverCap += 1; } if (spellId === SPELLS.BLACKOUT_KICK.id && this.buffTotm > 0) { if (this.selectedCombatant.hasBuff(SPELLS.TEACHINGS_OF_THE_MONASTERY.id)) { this.totalTotmBuffs += this.buffTotm; // this.manaReturnSotc += (this.buffTotm * (baseMana * SPELLS.TEACHINGS_OF_THE_MONASTERY.manaRet)); debug && console.log(`Black Kick Casted with Totm at ${this.buffTotm} stacks`); } } } get manaReturn() { return this.manaReturnSotc; } get suggestionThresholds() { return { actual: this.manaReturn, isLessThan: { minor: SOTC_MANA_PER_SECOND_RETURN_MINOR * (this.owner.fightDuration / 1000), average: SOTC_MANA_PER_SECOND_RETURN_AVERAGE * (this.owner.fightDuration / 1000), major: SOTC_MANA_PER_SECOND_RETURN_MAJOR * (this.owner.fightDuration / 1000), }, style: 'number', }; } suggestions(when) { when(this.suggestionThresholds).addSuggestion((suggest, actual, recommended) => { return suggest( <> You are not utilizing your <SpellLink id={SPELLS.SPIRIT_OF_THE_CRANE_TALENT.id} /> talent as effectively as you could. Make sure you are using any available downtime to use <SpellLink id={SPELLS.TIGER_PALM.id} /> and <SpellLink id={SPELLS.BLACKOUT_KICK.id} /> to take advantage of this talent. </> ) .icon(SPELLS.SPIRIT_OF_THE_CRANE_TALENT.icon) .actual(`${formatNumber(this.manaReturn)} mana returned through Spirit of the Crane`) .recommended(`${formatNumber(recommended)} is the recommended mana return`); }); } statistic() { return ( <TalentStatisticBox talent={SPELLS.SPIRIT_OF_THE_CRANE_TALENT.id} position={STATISTIC_ORDER.CORE(30)} value={`${formatNumber(this.manaReturnSotc)}`} label="Mana Returned" tooltip={( <> You gained a raw total of {((this.manaReturnSotc + this.sotcWasted) / 1000).toFixed(0)}k mana from SotC with {(this.sotcWasted / 1000).toFixed(0)}k wasted.<br /> You lost {(this.totmOverCap + this.totmBuffWasted)} Teachings of the Monestery stacks.<br /> <ul> {this.totmOverCap > 0 && <li>You overcapped Teachings {(this.totmOverCap)} times</li>} {this.totmBuffWasted > 0 && <li>You let Teachings drop off {(this.totmBuffWasted)} times</li>} </ul> </> )} /> ); } on_fightend() { if (debug) { console.log(`TotM Buffs Wasted:${this.totmBuffWasted}`); console.log(`TotM Buffs Overcap:${this.totmOverCap}`); console.log(`SotC Mana Returned:${this.manaReturnSotc}`); console.log(`Total TotM Buffs:${this.totalTotmBuffs}`); console.log(`SotC Waste Total: ${this.sotcWasted}`); console.log(`SotC Total: ${this.sotcWasted + this.manaReturnSotc}`); } } } export default SpiritOfTheCrane;
app/App.js
cmilfont/zonaextrema
import ReactDOM from 'react-dom'; import React, { Component } from 'react'; import { createStore, compose, combineReducers, applyMiddleware } from 'redux'; import { Provider } from 'react-redux'; import { Router, Route, IndexRedirect, browserHistory } from 'react-router'; import { syncHistoryWithStore, routerReducer } from 'react-router-redux'; import thunkMiddleware from 'redux-thunk'; import createLogger from 'redux-logger'; import rest from './restful'; import Home from './Home'; import Activities from './components/activities/List'; import AddActivity from './components/activities/Grid'; import Filter from './components/Filter'; import Charts from './components/Charts'; import offline from './offline'; import database from './database'; import MiddlewareMerge from './offline/MiddlewareMerge'; class Root extends Component { render() { const reducer = combineReducers({ routing: routerReducer, rest: () => rest, database: () => database, offline: () => offline, activities: offline.activities, ...rest.reducers }); const store = compose( applyMiddleware(thunkMiddleware, createLogger(), MiddlewareMerge) )(createStore)(reducer); const history = syncHistoryWithStore(browserHistory, store); return ( <div> <Provider store={store}> <Router history={history}> <Route path="/" component={Home}> <IndexRedirect to="/today" /> <Route path="add" component={AddActivity} /> <Route path="today" component={Activities} /> <Route path="filter" component={Filter} /> <Route path="charts" component={Charts} /> </Route> </Router> </Provider> </div> ); } } ReactDOM.render(<Root />, document.getElementById('app'));
src/components/Root.js
zebogen/film-bff-client
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Provider } from 'react-redux'; import routes from 'routes'; import { Router } from 'react-router'; export default class Root extends Component { render() { const { store, history } = this.props; return ( <Provider store={store}> <Router history={history} routes={routes} /> </Provider> ); } } Root.propTypes = { store: PropTypes.object.isRequired, history: PropTypes.object.isRequired };
src/svg-icons/image/crop-din.js
xmityaz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageCropDin = (props) => ( <SvgIcon {...props}> <path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z"/> </SvgIcon> ); ImageCropDin = pure(ImageCropDin); ImageCropDin.displayName = 'ImageCropDin'; ImageCropDin.muiName = 'SvgIcon'; export default ImageCropDin;
src/components/DisplayList/DisplayList.js
gReis89/sam-ovens-website
import React from 'react' import PropTypes from 'prop-types' import _map from 'lodash/map' export const DisplayList = ({ data }) => { const component = data.length ? ( <div className='display-list'> <ol> { _map(data, (item, i) => <li key={i}>{item}</li>) } </ol> </div> ) : <div className='display-list'>Add an item</div> return component } DisplayList.propTypes = { data: PropTypes.array.isRequired } export default DisplayList
src/components/invest/index.js
15chrjef/ico-wizard
import React from 'react' import ReactCountdownClock from 'react-countdown-clock' import { checkTxMined, attachToContract, checkNetWorkByID, sendTXToContract } from '../../utils/blockchainHelpers' import { getCrowdsaleData, getCurrentRate, initializeAccumulativeData, getAccumulativeCrowdsaleData, getCrowdsaleTargetDates, findCurrentContractRecursively, getJoinedTiers, getContractStoreProperty } from '../crowdsale/utils' import { getQueryVariable, getURLParam, getWhiteListWithCapCrowdsaleAssets } from '../../utils/utils' import { noMetaMaskAlert, noContractAlert, investmentDisabledAlert, investmentDisabledAlertInTime, successfulInvestmentAlert, invalidCrowdsaleAddrAlert } from '../../utils/alerts' import { Loader } from '../Common/Loader' import { ICOConfig } from '../Common/config' import { CONTRACT_TYPES, GAS_PRICE } from '../../utils/constants' import { observer, inject } from 'mobx-react' @inject('contractStore', 'crowdsalePageStore', 'web3Store', 'tierStore', 'tokenStore', 'generalStore', 'investStore') @observer export class Invest extends React.Component { constructor(props) { super(props); window.scrollTo(0, 0); if (this.tokensToInvestOnChange.bind) this.tokensToInvestOnChange = this.tokensToInvestOnChange.bind(this); if (this.investToTokens.bind) this.investToTokens = this.investToTokens.bind(this); var state = {}; state.seconds = 0; state.loading = true; this.state = state; } componentDidMount () { let newState = { ...this.state } const { web3Store, contractStore } = this.props const web3 = web3Store.web3 if (!web3) { let state = this.state; state.loading = false; this.setState(state); return }; const networkID = ICOConfig.networkID?ICOConfig.networkID:getQueryVariable("networkID"); const contractType = CONTRACT_TYPES.whitelistwithcap;// getQueryVariable("contractType"); checkNetWorkByID(web3, networkID); contractStore.setContractType(contractType); const timeInterval = setInterval(() => this.setState({ seconds: this.state.seconds - 1}), 1000); this.setState({ timeInterval }); switch (contractType) { case CONTRACT_TYPES.whitelistwithcap: { getWhiteListWithCapCrowdsaleAssets((_newState) => { this.setState(_newState); this.extractContractsData(web3); }); } break; default: break; } } extractContractsData(web3) { const { contractStore, crowdsalePageStore } = this.props let state = { ...this.state }; const crowdsaleAddr = ICOConfig.crowdsaleContractURL?ICOConfig.crowdsaleContractURL:getURLParam("addr"); if (!web3.utils.isAddress(crowdsaleAddr)) { state.loading = false; this.setState(state); return invalidCrowdsaleAddrAlert(); } getJoinedTiers(web3, contractStore.crowdsale.abi, crowdsaleAddr, [], (joinedCrowdsales) => { console.log("joinedCrowdsales: "); console.log(joinedCrowdsales); let _crowdsaleAddrs; if ( typeof joinedCrowdsales === 'string' ) { _crowdsaleAddrs = [ joinedCrowdsales ]; } else { _crowdsaleAddrs = joinedCrowdsales; } contractStore.setContractProperty('crowdsale', 'addr', _crowdsaleAddrs); web3.eth.getAccounts().then((accounts) => { if (accounts.length === 0) { let state = this.state; state.loading = false; this.setState(state); return }; state.curAddr = accounts[0]; state.web3 = web3; this.setState(state); if (!contractStore.crowdsale.addr) { let state = this.state; state.loading = false; return this.setState(state); }; findCurrentContractRecursively(0, this, web3, null, (crowdsaleContract) => { if (!crowdsaleContract) { state.loading = false; return this.setState(state); } getCrowdsaleData(web3, this, crowdsaleContract, () => { initializeAccumulativeData(() => { getAccumulativeCrowdsaleData(web3, this, () => { }); }); }); getCrowdsaleTargetDates(web3, this, () => { console.log(crowdsalePageStore); if (crowdsalePageStore.endDate) { let state = this.state; state.seconds = (crowdsalePageStore.endDate - new Date().getTime())/1000; this.setState(state); } }) }) }); }); } investToTokens() { const { crowdsalePageStore, web3Store, contractStore } = this.props const web3 = web3Store.web3 let state = { ...this.state }; state.loading = true; this.setState(state); let startBlock = parseInt(crowdsalePageStore.startBlock, 10); let startDate = crowdsalePageStore.startDate; if ((isNaN(startBlock) || startBlock === 0) && !startDate) { let state = this.state; state.loading = false; this.setState(state); return; } if (web3.eth.accounts.length === 0) { let state = this.state; state.loading = false; this.setState(state); return noMetaMaskAlert(); } console.log('contractStore.contractType', contractStore.contractType) switch (contractStore.contractType) { case CONTRACT_TYPES.whitelistwithcap: { console.log('CONTRACT_TYPES.whitelistwithcap', CONTRACT_TYPES.whitelistwithcap) this.investToTokensForWhitelistedCrowdsale(web3, web3.eth.accounts) } break; default: break; } } investToTokensForWhitelistedCrowdsale(web3) { const { crowdsalePageStore } = this.props console.log("startDate: " + crowdsalePageStore.startDate); console.log("(new Date()).getTime(): " + (new Date()).getTime()); if (crowdsalePageStore.startDate > (new Date()).getTime()) { let state = this.state; state.loading = false; this.setState(state); return investmentDisabledAlertInTime(crowdsalePageStore.startDate); } findCurrentContractRecursively(0, this, web3, null, (crowdsaleContract, tierNum) => { if (!crowdsaleContract) { let state = this; state.loading = false; return this.setState(state); } console.log(web3) getCurrentRate(web3, this, crowdsaleContract, () => { console.log(web3) this.investToTokensForWhitelistedCrowdsaleInternal(crowdsaleContract, tierNum, web3, web3.eth.accounts); }); }) } investToTokensForWhitelistedCrowdsaleInternal(crowdsaleContract, tierNum, web3, accounts) { const { contractStore, tokenStore, crowdsalePageStore, investStore } = this.props let nextTiers = []; console.log(contractStore.crowdsale); for (let i = tierNum + 1; i < contractStore.crowdsale.addr.length; i++) { nextTiers.push(contractStore.crowdsale.addr[i]); } console.log("nextTiers: " + nextTiers); console.log(nextTiers.length); let decimals = parseInt(tokenStore.decimals, 10); console.log("decimals: " + decimals); let rate = parseInt(crowdsalePageStore.rate, 10); //it is from contract. It is already in wei. How much 1 token costs in wei. console.log("rate: " + rate); let tokensToInvest = parseFloat(investStore.tokensToInvest); console.log("tokensToInvest: " + tokensToInvest); let weiToSend = parseInt(tokensToInvest*rate, 10); console.log("weiToSend: " + weiToSend); let opts = { from: accounts[0], value: weiToSend, gasPrice: GAS_PRICE }; console.log(opts); sendTXToContract(web3, crowdsaleContract.methods.buy().send(opts), (err) => { let state = this.state; state.loading = false; this.setState(state); successfulInvestmentAlert(this.state.tokensToInvest); }); /*crowdsaleContract.methods.buy().send(opts, (err, txHash) => { if (err) { let state = this.state; state.loading = false; this.setState(state); return console.log(err); } console.log("txHash: " + txHash); console.log(web3) checkTxMined(web3, txHash, (receipt) => this.txMinedCallback(web3, txHash, receipt)) });*/ } txMinedCallback(web3, txHash, receipt) { console.log(web3); if (receipt) { if (receipt.blockNumber) { let state = this.state; state.loading = false; this.setState(state); successfulInvestmentAlert(this.state.tokensToInvest); } } else { console.log(web3) setTimeout(() => { checkTxMined(web3, txHash, (receipt) => this.txMinedCallback(web3, txHash, receipt)) }, 500); } } tokensToInvestOnChange(event) { this.props.investStore.setProperty('tokensToInvest', event.target.value) } renderPieTracker () { return <div style={{marginLeft: '-20px', marginTop: '-20px'}}> <ReactCountdownClock seconds={this.state.seconds} color="#733EAB" alpha={0.9} size={270} /> </div> } shouldStopCountDown () { const { seconds } = this.state if(seconds < 0) { var state = this.state; state.seconds = 0; this.setState(state); clearInterval(this.state.timeInterval) } } getTimeStamps (seconds) { this.shouldStopCountDown() var days = Math.floor(seconds/24/60/60); var hoursLeft = Math.floor((seconds) - (days*86400)); var hours = Math.floor(hoursLeft/3600); var minutesLeft = Math.floor((hoursLeft) - (hours*3600)); var minutes = Math.floor(minutesLeft/60); return { days, hours, minutes} } render(state){ const { seconds } = this.state const { crowdsalePageStore, tokenStore, contractStore, investStore } = this.props const { days, hours, minutes } = this.getTimeStamps(seconds) const tokenDecimals = !isNaN(tokenStore.decimals)?tokenStore.decimals:0; const tokenTicker = tokenStore.ticker?tokenStore.ticker.toString():""; const tokenName = tokenStore.name?tokenStore.name.toString():""; const rate = crowdsalePageStore.rate; const maxCapBeforeDecimals = crowdsalePageStore.maximumSellableTokens/10**tokenDecimals; const tokenAmountOf = crowdsalePageStore.tokenAmountOf; const ethRaised = crowdsalePageStore.ethRaised; const tokenAddress = getContractStoreProperty('token', 'addr') const crowdsaleAddress = getContractStoreProperty('crowdsale', 'addr') && getContractStoreProperty('crowdsale', 'addr')[0] //balance: tiers, standard const investorBalanceTiers = (tokenAmountOf?((tokenAmountOf/10**tokenDecimals)/*.toFixed(tokenDecimals)*/).toString():"0"); const investorBalanceStandard = (ethRaised?(ethRaised/*.toFixed(tokenDecimals)*//rate).toString():"0"); const investorBalance = (contractStore.contractType === CONTRACT_TYPES.whitelistwithcap)?investorBalanceTiers:investorBalanceStandard; //total supply: tiers, standard const tierCap = !isNaN(maxCapBeforeDecimals)?(maxCapBeforeDecimals/*.toFixed(tokenDecimals)*/).toString():"0"; const standardCrowdsaleSupply = !isNaN(crowdsalePageStore.supply)?(crowdsalePageStore.supply/*.toFixed(tokenDecimals)*/).toString():"0"; const totalSupply = (contractStore.contractType === CONTRACT_TYPES.whitelistwithcap)?tierCap:standardCrowdsaleSupply; return <div className="invest container"> <div className="invest-table"> <div className="invest-table-cell invest-table-cell_left"> <div className="timer-container"> <div className="timer"> <div className="timer-inner"> <div className="timer-i"> <div className="timer-count">{days}</div> <div className="timer-interval">Days</div> </div> <div className="timer-i"> <div className="timer-count">{hours}</div> <div className="timer-interval">Hours</div> </div> <div className="timer-i"> <div className="timer-count">{minutes}</div> <div className="timer-interval">Mins</div> </div> </div> </div> {this.renderPieTracker()} </div> <div className="hashes"> <div className="hashes-i"> <p className="hashes-title">{this.state.curAddr}</p> <p className="hashes-description">Current Account</p> </div> <div className="hashes-i"> <p className="hashes-title">{tokenAddress}</p> <p className="hashes-description">Token Address</p> </div> <div className="hashes-i"> <p className="hashes-title">{crowdsaleAddress}</p> <p className="hashes-description">Crowdsale Contract Address</p> </div> <div className="hashes-i hidden"> <div className="left"> <p className="hashes-title">{tokenName}</p> <p className="hashes-description">Name</p> </div> <div className="left"> <p className="hashes-title">{tokenTicker}</p> <p className="hashes-description">Ticker</p> </div> </div> <div className="hashes-i"> <p className="hashes-title">{totalSupply} {tokenTicker}</p> <p className="hashes-description">Total Supply</p> </div> </div> <p className="invest-title">Invest page</p> <p className="invest-description"> Here you can invest in the crowdsale campaign. At the moment, you need MetaMask client to invest into the crowdsale. If you don't have MetaMask, you can send ethers to the crowdsale address with a MethodID: 0xa6f2ae3a. Sample <a href="https://kovan.etherscan.io/tx/0x42073576a160206e61b4d9b70b436359b8d220f8b88c7c272c77023513c62c3d">transaction</a>. </p> </div> <div className="invest-table-cell invest-table-cell_right"> <div className="balance"> <p className="balance-title">{investorBalance} {tokenTicker}</p> <p className="balance-description">Balance</p> <p className="description"> Your balance in tokens. </p> </div> <form className="invest-form"> <label className="invest-form-label">Choose amount to invest</label> <div className="invest-form-input-container"> <input type="text" className="invest-form-input" value={investStore.tokensToInvest} onChange={this.tokensToInvestOnChange} placeholder="0"/> <div className="invest-form-label">TOKENS</div> </div> <a className="button button_fill" onClick={this.investToTokens}>Invest now</a> <p className="description"> Think twice before investment in ICOs. Tokens will be deposited on a wallet you used to buy tokens. </p> </form> </div> </div> <Loader show={this.state.loading}></Loader> </div> } }
docs/app/Examples/elements/Step/States/StepExampleCompletedOrdered.js
shengnian/shengnian-ui-react
import React from 'react' import { Step } from 'shengnian-ui-react' const StepExampleCompletedOrdered = () => ( <Step.Group ordered> <Step completed> <Step.Content> <Step.Title>Billing</Step.Title> <Step.Description>Enter billing information</Step.Description> </Step.Content> </Step> </Step.Group> ) export default StepExampleCompletedOrdered
ressources/components/svg-icons/SelectionIcon.js
thierryc/Sketch-Find-And-Replace
import React from 'react' const SelectionIcon = (props) => { const { theme, isActive } = props return ( <svg width='38px' height='32px' viewBox='0 0 38 32'> <g stroke='none' strokeWidth='1' fill='none' fillRule='evenodd' > <g transform='translate(6.000000, 9.500000)' fill={ isActive ? theme.activeIconColor : theme.inactiveIconColor } > <rect x='0' y='0' width='2' height='5' /> <rect x='3' y='0' width='2' height='5' /> <rect x='6' y='0' width='2' height='5' /> <rect x='9' y='0' width='17' height='5' /> <rect x='24' y='8' width='2' height='5' /> <rect x='21' y='8' width='2' height='5' /> <rect x='18' y='8' width='2' height='5' /> <rect x='0' y='8' width='17' height='5' /> </g> </g> </svg> ) } export default SelectionIcon
admin/src/components/PopoutBody.js
lojack/keystone
import blacklist from 'blacklist'; import classnames from 'classnames'; import React from 'react'; var PopoutBody = React.createClass({ displayName: 'PopoutBody', propTypes: { children: React.PropTypes.node.isRequired, scrollable: React.PropTypes.bool, }, render () { let className = classnames('Popout__body', { 'Popout__scrollable-area': this.props.scrollable }, this.props.className); let props = blacklist(this.props, 'className', 'scrollable'); return <div className={className} {...props} />; } }); module.exports = PopoutBody;
src/svg-icons/image/navigate-next.js
ArcanisCz/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageNavigateNext = (props) => ( <SvgIcon {...props}> <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/> </SvgIcon> ); ImageNavigateNext = pure(ImageNavigateNext); ImageNavigateNext.displayName = 'ImageNavigateNext'; ImageNavigateNext.muiName = 'SvgIcon'; export default ImageNavigateNext;
content/gocms/src/base/router/routes.js
menklab/goCMS
import React from 'react' import {Route} from 'react-router' import BaseTemplate from '../base_tmpl' let injectedRoutes = []; let routes = <Route component={BaseTemplate}> {injectedRoutes} </Route>; export function injectRoutes(r) { injectedRoutes.push(r); } export function registeredRoutes() { return routes; }
src/svg-icons/hardware/security.js
rscnt/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let HardwareSecurity = (props) => ( <SvgIcon {...props}> <path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"/> </SvgIcon> ); HardwareSecurity = pure(HardwareSecurity); HardwareSecurity.displayName = 'HardwareSecurity'; export default HardwareSecurity;
js/ShowCard.js
PaquitoSoft/complete-intro-to-react
import React from 'react'; import { Link } from 'react-router'; const { shape, string } = React.PropTypes; const ShowCard = React.createClass({ propTypes: { show: shape({ imdbID: string.isRequired, poster: string.isRequired, title: string.isRequired, year: string.isRequired, description: string.isRequired }) }, render () { const show = this.props.show; return ( <Link to={`/details/${show.imdbID}`}> <div className='show-card' key={show.imdbID}> <img src={`/public/img/posters/${show.poster}`} /> <div> <h3>{show.title}</h3> <h4>({show.year})</h4> <p>{show.description}</p> </div> </div> </Link> ); } }); export default ShowCard;
reactjs/budget/client/components/LoginControl/UserGreeting.js
Kevin-Huang-NZ/notes
import React, { Component } from 'react'; class UserGreeting extends Component { render() { return ( <h1> Welcome back. </h1> ); } } export default UserGreeting;
actor-apps/app-web/src/app/components/modals/Contacts.react.js
amezcua/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;
packages/material-ui/src/transitions/Zoom.js
cherniavskii/material-ui
// @inheritedComponent Transition import React from 'react'; import PropTypes from 'prop-types'; import Transition from 'react-transition-group/Transition'; import { duration } from '../styles/transitions'; import withTheme from '../styles/withTheme'; import { reflow, getTransitionProps } from './utils'; const styles = { entering: { transform: 'scale(1)', }, entered: { transform: 'scale(1)', }, }; /** * The Zoom transition can be used for the floating variant of the * [Button](https://material-ui-next.com/demos/buttons/#floating-action-buttons) component. * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally. */ class Zoom extends React.Component { handleEnter = node => { const { theme } = this.props; reflow(node); // So the animation always start from the start. const transitionProps = getTransitionProps(this.props, { mode: 'enter', }); node.style.webkitTransition = theme.transitions.create('transform', transitionProps); node.style.transition = theme.transitions.create('transform', transitionProps); if (this.props.onEnter) { this.props.onEnter(node); } }; handleExit = node => { const { theme } = this.props; const transitionProps = getTransitionProps(this.props, { mode: 'exit', }); node.style.webkitTransition = theme.transitions.create('transform', transitionProps); node.style.transition = theme.transitions.create('transform', transitionProps); if (this.props.onExit) { this.props.onExit(node); } }; render() { const { children, onEnter, onExit, style: styleProp, theme, ...other } = this.props; const style = { ...styleProp, ...(React.isValidElement(children) ? children.props.style : {}), }; return ( <Transition appear onEnter={this.handleEnter} onExit={this.handleExit} {...other}> {(state, childProps) => { return React.cloneElement(children, { style: { transform: 'scale(0)', willChange: 'transform', ...styles[state], ...style, }, ...childProps, }); }} </Transition> ); } } Zoom.propTypes = { /** * A single child content element. */ children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]), /** * If `true`, the component will transition in. */ in: PropTypes.bool, /** * @ignore */ onEnter: PropTypes.func, /** * @ignore */ onExit: PropTypes.func, /** * @ignore */ style: PropTypes.object, /** * @ignore */ theme: PropTypes.object.isRequired, /** * The duration for the transition, in milliseconds. * You may specify a single timeout for all transitions, or individually with an object. */ timeout: PropTypes.oneOfType([ PropTypes.number, PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number }), ]), }; Zoom.defaultProps = { timeout: { enter: duration.enteringScreen, exit: duration.leavingScreen, }, }; export default withTheme()(Zoom);
public/js/src/index/view1.js
Lucifier129/isomorphism-react-file-system
import React from 'react' import Tile from '../component/Tile' import Breadcrumb from '../component/Breadcrumb' export default class View extends React.Component { render() { let tree = this.props.tree return (<div> <Breadcrumb path={tree.path} /> <div className="tile-wrap"> <Tile name="文件名" type="文件类型" lastModifyTime="最后修改时间" /> { tree.children.map((child) => { return <Tile {...child} key={child.path} /> }) } </div> </div>) } } View.PropTypes = { tree: React.PropTypes.object.isRequired }
docs/src/examples/elements/Button/GroupVariations/ButtonExampleGroupLabeledIcon.js
Semantic-Org/Semantic-UI-React
import React from 'react' import { Button } from 'semantic-ui-react' const ButtonExampleGroupLabeledIcon = () => ( <Button.Group vertical labeled icon> <Button icon='play' content='Play' /> <Button icon='pause' content='Pause' /> <Button icon='shuffle' content='Shuffle' /> </Button.Group> ) export default ButtonExampleGroupLabeledIcon
old-or-not-typescript/learn-redux/real-world/index.js
janaagaard75/framework-investigations
import 'babel-polyfill' import React from 'react' import { render } from 'react-dom' import { browserHistory } from 'react-router' import { syncHistoryWithStore } from 'react-router-redux' import Root from './containers/Root' import configureStore from './store/configureStore' const store = configureStore() const history = syncHistoryWithStore(browserHistory, store) render( <Root store={store} history={history} />, document.getElementById('root') )
src/svg-icons/image/flare.js
manchesergit/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageFlare = (props) => ( <SvgIcon {...props}> <path d="M7 11H1v2h6v-2zm2.17-3.24L7.05 5.64 5.64 7.05l2.12 2.12 1.41-1.41zM13 1h-2v6h2V1zm5.36 6.05l-1.41-1.41-2.12 2.12 1.41 1.41 2.12-2.12zM17 11v2h6v-2h-6zm-5-2c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3zm2.83 7.24l2.12 2.12 1.41-1.41-2.12-2.12-1.41 1.41zm-9.19.71l1.41 1.41 2.12-2.12-1.41-1.41-2.12 2.12zM11 23h2v-6h-2v6z"/> </SvgIcon> ); ImageFlare = pure(ImageFlare); ImageFlare.displayName = 'ImageFlare'; ImageFlare.muiName = 'SvgIcon'; export default ImageFlare;
packages/es-components/src/components/controls/buttons/PopoverLink.js
TWExchangeSolutions/es-components
import React from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; import LinkButton from './LinkButton'; import { useTheme } from '../../util/useTheme'; const StyledButton = styled(LinkButton)` text-underline-position: under; text-decoration-skip-ink: none; text-decoration: ${props => props.suppressUnderline ? 'none' : `dashed underline`}; &:hover, :focus { text-decoration: ${props => props.suppressUnderline ? 'none' : `solid underline`}; } `; const PopoverLink = React.forwardRef(function PopoverLink(props, ref) { const { children, styleType, suppressUnderline, ...other } = props; const theme = useTheme(); const variant = theme.buttonStyles.linkButton.variant[styleType]; return ( <StyledButton ref={ref} variant={variant} suppressUnderline={suppressUnderline} {...other} > {children} </StyledButton> ); }); PopoverLink.propTypes = { children: PropTypes.node.isRequired, /** Select the color style of the button, types come from theme */ styleType: PropTypes.string, /** Hide underline from link. Useful for children like Icons */ suppressUnderline: PropTypes.bool }; PopoverLink.defaultProps = { styleType: 'primary', suppressUnderline: false }; export default PopoverLink;
nlyyAPP/component/随访管理/发送受试者短信统计/MLSMSStatisticsLB.js
a497500306/nlyy_APP
import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View, TouchableOpacity, Navigator, TextInput, ActivityIndicator, Alert, ListView } from 'react-native'; var MLTableCell = require('../../MLTableCell/MLTableCell'); var Dimensions = require('Dimensions'); var {width, height} = Dimensions.get('window'); var MLActivityIndicatorView = require('../../MLActivityIndicatorView/MLActivityIndicatorView'); var settings = require("../../../settings"); var Users = require('../../../entity/Users'); var MLNavigatorBar = require('../../MLNavigatorBar/MLNavigatorBar'); import ActionSheet from 'react-native-actionsheet'; var moment = require('moment'); moment().format(); const buttons = ['取消', '按受试者编号排序查看','按时间排序查看']; const CANCEL_INDEX = 0; const DESTRUCTIVE_INDEX = 4; var friendId = 0; var seveRowData = {}; var compareDate = function (obj1, obj2) { var val1 = obj1.Date; var val2 = obj2.Date; if (val1 > val2) { return -1; } else if (val1 < val2) { return 1; } else { return 0; } } var compareUser = function (obj1, obj2) { var val1 = obj1.patient.id; var val2 = obj2.patient.id; if (val1 < val2) { return -1; } else if (val1 > val2) { return 1; } else { return 0; } } var MLSMSStatisticsLB = React.createClass({ show() { this.ActionSheet.show(); }, _handlePress(index) { }, getDefaultProps(){ return{ data:[],//数据 type:0,//排序1:编号排序,2:时间排序 } }, //初始化设置 getInitialState() { var tableData = []; if (this.props.type == 1){ tableData = this.props.data.sort(compareUser) }else{ tableData = this.props.data.sort(compareDate) } //ListView设置 var ds = new ListView.DataSource({rowHasChanged:(r1, r2) => r1 !== r2}); return { //ListView设置 dataSource: ds.cloneWithRows(tableData), tableData:tableData, } }, render() { return ( <View style={styles.container}> <MLNavigatorBar title={'查看详细'} isBack={true} backFunc={() => { this.props.navigator.pop() }} leftTitle={'首页'} leftFunc={()=>{ this.props.navigator.popToRoute(this.props.navigator.getCurrentRoutes()[1]) }}/> <ListView removeClippedSubviews={false} showsVerticalScrollIndicator={false} dataSource={this.state.dataSource}//数据源 renderRow={this.renderRow} /> <ActionSheet ref={(o) => this.ActionSheet = o} title="选择您的操作?" options={buttons} cancelButtonIndex={CANCEL_INDEX} destructiveButtonIndex={DESTRUCTIVE_INDEX} onPress={(sss)=>{ this._handlePress(this) if (sss == 1){//点击修改备注 }else if (sss == 2){//点击查看资料 }else if (sss == 3) {//点击删除好友 } }} /> </View> ); }, //返回具体的cell renderRow(rowData,sectionID, rowID){ return( <TouchableOpacity style={{marginTop : 10,}} onPress={()=>{ var xx = 0; for (var i = 0 ; i < this.props.data.length ; i++){ if (this.props.data[i].patient.USubjID == rowData.patient.USubjID){ xx = xx + 1; } } //错误 Alert.alert( '受试者' + rowData.patient.USubjID + '总条数', xx.toString() + '条', [ {text: '确定'}, ] ) }}> <View style={{ backgroundColor:'white', borderBottomColor:'#dddddd', borderBottomWidth:0.5, }}> <Text style={{ marginTop : 5, marginLeft : 10 }}>{rowData.content}</Text> <Text style={{ marginTop : 5, marginLeft : 10 }}>{'发送者:' + rowData.users.UserMP.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')}</Text> <Text style={{ marginTop : 5, marginLeft : 10 }}>{'发送时间:' + moment(rowData.Date).format('YYYY-MM-DD h:mm:ss a')}</Text> <Text style={{ marginBottom : 5, marginTop : 5, marginLeft : 10 }}>{'接收受试者的编号:' + rowData.patient.USubjID}</Text> </View> </TouchableOpacity> ) } }) const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: 'rgba(233,234,239,1.0)', }, }); // 输出组件类 module.exports = MLSMSStatisticsLB;
src/components/forms/textarea.js
adrienhobbs/redux-glow
/* eslint-disable */ import React from 'react'; import Formsy from 'formsy-react'; const TextArea = React.createClass({ // Add the Formsy Mixin mixins: [Formsy.Mixin], changeValue (event) { this.setValue(event.currentTarget.value); }, render () { const className = this.showRequired() ? 'required' : this.showError() ? 'error' : 'valid'; return ( <div className={className}> <textarea style={{minHeight: '4.5rem'}} onChange={this.changeValue} value={this.getValue()} className='contact-form-textarea' name="" id="" placeholder="brief message &#42;"></textarea> </div> ); } }); export default TextArea;
src/components/login/canvas.js
liuweiGL/eastcoal_mgr_react
import React from 'react' import ReactDom from 'react-dom' import CanvasAnimation from '../../js/canvasAnimation' class Canvas extends React.Component { componentDidMount = () => { const canvas = ReactDom.findDOMNode( this.refs.canvas ); const { count, maxRadius, color, lineWeight, lineColor, isClick, isHover } = this.props; this.canvasAnimation = new CanvasAnimation( canvas, { count, maxRadius, color, lineWeight, lineColor, isClick, isHover } ); } //销毁时解除canvas事件 componentWillUnmount = () => { this.canvasAnimation.offAllHandle(); } render () { return ( <canvas ref="canvas" width={ this.props.width } height={ this.props.height } className={ this.props.className } style={ this.props.style } /> ) } } export default Canvas
src/components/Garden/GardenPlot.js
KageEnterprises/weed-wizard
import PropTypes from 'prop-types'; import React from 'react'; import { Button, Card, CardActions, CardContent, CircularProgress, Grid, Typography } from '@material-ui/core'; import { withStyles } from '@material-ui/core/styles'; import { theme } from '../../Theme'; import { PLANT_GROWTH_PHASES } from '../../Weed/WeedList'; const primaryColor = theme.palette.primary; const styles = { 'card__root--selected': { backgroundColor: primaryColor[100], boxShadow: `0px 3px 4px 0px ${primaryColor[600]}, 0px 1px 1px 0px ${primaryColor[600]}, 0px 2px 1px -1px ${primaryColor[600]}` }, cardAction__root: { padding: '4px', '&:last-child': { paddingBottom: '4px' } }, cardContent__root: { padding: '4px 8px', '&:last-child': { paddingBottom: '4px' } }, cardActionButton__root: { fontSize: '10px', minHeight: '22px', minWidth: '0', padding: '4px' }, typography__body2: { lineHeight: '18px' } }; class GardenPlot extends React.Component { static propTypes = { plant: PropTypes.shape({}) }; readyToHarvest = plant => { if (!plant) return false; const { phase } = plant; return phase === PLANT_GROWTH_PHASES.length - 2; }; render() { const { classes, plant, harvestPlant, removePlant } = this.props; const readyToHarvest = this.readyToHarvest(plant); return ( <Grid item xs={ 4 }> <Card classes={ { root: readyToHarvest ? classes['card__root--selected'] : null } }> <CardContent classes={ { root: classes.cardContent__root } }> { !plant && ( <Typography variant='caption'> Just dirt! </Typography> ) } { plant && ( <div> <Typography classes={ { body2: classes.typography__body2 } } variant='body2'> { plant.name } </Typography> <Typography variant='caption'> { PLANT_GROWTH_PHASES[plant.phase] } </Typography> <CircularProgress variant='determinate' value={ plant.growthProgress } /> </div> ) } </CardContent> { plant && ( <CardActions classes={ { root: classes.cardAction__root } }> <Button classes={ { root: classes.cardActionButton__root } } onClick={ removePlant } size='small'> Remove </Button> {readyToHarvest && ( <Button classes={ { root: classes.cardActionButton__root } } onClick={ harvestPlant } size='small'> Harvest </Button> )} </CardActions> ) } </Card> </Grid> ); } } export default withStyles(styles)(GardenPlot);
src/packages/@ncigdc/routes/ComponentsRoute.js
NCI-GDC/portal-ui
import React from 'react'; import * as ModernComponents from '@ncigdc/modern_components'; export default class extends React.Component { render() { const Component = ModernComponents[this.props.match.params.component]; return Component ? <Component /> : <h1>No matching component found.</h1>; } }
fields/components/Checkbox.js
brianjd/keystone
import React from 'react'; import blacklist from 'blacklist'; import classnames from 'classnames'; import { darken, fade } from '../../admin/client/utils/color'; import E from '../../admin/client/constants'; var Checkbox = React.createClass({ displayName: 'Checkbox', propTypes: { checked: React.PropTypes.bool, component: React.PropTypes.node, onChange: React.PropTypes.func, readonly: React.PropTypes.bool, }, getDefaultProps () { return { component: 'button', }; }, getInitialState () { return { active: null, focus: null, hover: null, }; }, componentDidMount () { window.addEventListener('mouseup', this.handleMouseUp, false); }, componentWillUnmount () { window.removeEventListener('mouseup', this.handleMouseUp, false); }, getStyles () { const { checked, readonly } = this.props; const { active, focus, hover } = this.state; const checkedColor = '#3999fc'; let background = (checked && !readonly) ? checkedColor : 'white'; let borderColor = (checked && !readonly) ? 'rgba(0,0,0,0.15) rgba(0,0,0,0.1) rgba(0,0,0,0.05)' : 'rgba(0,0,0,0.3) rgba(0,0,0,0.2) rgba(0,0,0,0.15)'; let boxShadow = (checked && !readonly) ? '0 1px 0 rgba(255,255,255,0.33)' : 'inset 0 1px 0 rgba(0,0,0,0.06)'; let color = (checked && !readonly) ? 'white' : '#bbb'; const textShadow = (checked && !readonly) ? '0 1px 0 rgba(0,0,0,0.2)' : null; // pseudo state if (hover && !focus && !readonly) { borderColor = (checked) ? 'rgba(0,0,0,0.1) rgba(0,0,0,0.15) rgba(0,0,0,0.2)' : 'rgba(0,0,0,0.35) rgba(0,0,0,0.3) rgba(0,0,0,0.25)'; } if (active) { background = (checked && !readonly) ? darken(checkedColor, 20) : '#eee'; borderColor = (checked && !readonly) ? 'rgba(0,0,0,0.25) rgba(0,0,0,0.3) rgba(0,0,0,0.35)' : 'rgba(0,0,0,0.4) rgba(0,0,0,0.35) rgba(0,0,0,0.3)'; boxShadow = (checked && !readonly) ? '0 1px 0 rgba(255,255,255,0.33)' : 'inset 0 1px 3px rgba(0,0,0,0.2)'; } if (focus && !active) { borderColor = (checked && !readonly) ? 'rgba(0,0,0,0.25) rgba(0,0,0,0.3) rgba(0,0,0,0.35)' : checkedColor; boxShadow = (checked && !readonly) ? `0 0 0 3px ${fade(checkedColor, 15)}` : `inset 0 1px 2px rgba(0,0,0,0.15), 0 0 0 3px ${fade(checkedColor, 15)}`; } // noedit if (readonly) { background = 'rgba(255,255,255,0.5)'; borderColor = 'rgba(0,0,0,0.1)'; boxShadow = 'none'; color = checked ? checkedColor : '#bbb'; } return { alignItems: 'center', background: background, border: '1px solid', borderColor: borderColor, borderRadius: E.borderRadius.sm, boxShadow: boxShadow, color: color, display: 'inline-block', fontSize: 14, height: 16, lineHeight: '15px', outline: 'none', padding: 0, textAlign: 'center', textShadow: textShadow, verticalAlign: 'middle', width: 16, msTransition: 'all 120ms ease-out', MozTransition: 'all 120ms ease-out', WebkitTransition: 'all 120ms ease-out', transition: 'all 120ms ease-out', }; }, handleKeyDown (e) { if (e.keyCode !== 32) return; this.toggleActive(true); }, handleKeyUp () { this.toggleActive(false); }, handleMouseOver () { this.toggleHover(true); }, handleMouseDown () { this.toggleActive(true); this.toggleFocus(true); }, handleMouseUp () { this.toggleActive(false); }, handleMouseOut () { this.toggleHover(false); }, toggleActive (pseudo) { this.setState({ active: pseudo }); }, toggleHover (pseudo) { this.setState({ hover: pseudo }); }, toggleFocus (pseudo) { this.setState({ focus: pseudo }); }, handleChange () { this.props.onChange(!this.props.checked); }, render () { const { checked, readonly } = this.props; const props = blacklist(this.props, 'checked', 'component', 'onChange', 'readonly'); props.style = this.getStyles(); props.ref = 'checkbox'; props.className = classnames('octicon', { 'octicon-check': checked, 'octicon-x': (typeof checked === 'boolean') && !checked && readonly, }); props.type = readonly ? null : 'button'; props.onKeyDown = this.handleKeyDown; props.onKeyUp = this.handleKeyUp; props.onMouseDown = this.handleMouseDown; props.onMouseUp = this.handleMouseUp; props.onMouseOver = this.handleMouseOver; props.onMouseOut = this.handleMouseOut; props.onClick = readonly ? null : this.handleChange; props.onFocus = readonly ? null : () => this.toggleFocus(true); props.onBlur = readonly ? null : () => this.toggleFocus(false); const node = readonly ? 'span' : this.props.component; return React.createElement(node, props); }, }); module.exports = Checkbox;
src/svg-icons/communication/stay-current-portrait.js
frnk94/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let CommunicationStayCurrentPortrait = (props) => ( <SvgIcon {...props}> <path d="M17 1.01L7 1c-1.1 0-1.99.9-1.99 2v18c0 1.1.89 2 1.99 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14z"/> </SvgIcon> ); CommunicationStayCurrentPortrait = pure(CommunicationStayCurrentPortrait); CommunicationStayCurrentPortrait.displayName = 'CommunicationStayCurrentPortrait'; CommunicationStayCurrentPortrait.muiName = 'SvgIcon'; export default CommunicationStayCurrentPortrait;
src/svg-icons/communication/no-sim.js
manchesergit/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let CommunicationNoSim = (props) => ( <SvgIcon {...props}> <path d="M18.99 5c0-1.1-.89-2-1.99-2h-7L7.66 5.34 19 16.68 18.99 5zM3.65 3.88L2.38 5.15 5 7.77V19c0 1.1.9 2 2 2h10.01c.35 0 .67-.1.96-.26l1.88 1.88 1.27-1.27L3.65 3.88z"/> </SvgIcon> ); CommunicationNoSim = pure(CommunicationNoSim); CommunicationNoSim.displayName = 'CommunicationNoSim'; CommunicationNoSim.muiName = 'SvgIcon'; export default CommunicationNoSim;
packages/cf-builder-card/src/CardBuilder.js
mdno/mdno.github.io
import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Card, CardSection, CardContent, CardControl, CardDrawers, CardPropTypes } from 'cf-component-card'; import { DynamicContent } from 'cf-component-dynamic-content'; import markdown from 'cf-util-markdown'; import cardActions from './cardActions'; class CardBuilder extends React.Component { render() { return ( <Card> <CardSection> <CardContent title={this.props.title}> <DynamicContent dangerouslySetInnerHTML={{ __html: markdown(this.props.description) }} /> </CardContent> {this.props.control && <CardControl> {this.props.control} </CardControl>} </CardSection> {this.props.table && <CardSection> {this.props.table} </CardSection>} {this.props.drawers && <CardDrawers onClick={this.props.onDrawerClick} active={this.props.activeDrawer} drawers={this.props.drawers} />} </Card> ); } } CardBuilder.propTypes = { cardName: PropTypes.string.isRequired, title: PropTypes.string.isRequired, description: PropTypes.string.isRequired, control: PropTypes.element, table: PropTypes.element, drawers: CardPropTypes.cardDrawers, onDrawerClick: PropTypes.func, activeDrawer: PropTypes.string }; function mapStateToProps(state, ownProps) { const cardName = ownProps.cardName; const cardState = state.cards[cardName]; return { activeDrawer: cardState && cardState.activeDrawer }; } function mapDispatchToProps(dispatch, ownProps) { const cardName = ownProps.cardName; return { onDrawerClick(drawerId) { dispatch(cardActions.toggleDrawer(cardName, drawerId)); } }; } export default connect(mapStateToProps, mapDispatchToProps)(CardBuilder);
src/components/common/svg-icons/notification/event-busy.js
abzfarah/Pearson.NAPLAN.GnomeH
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NotificationEventBusy = (props) => ( <SvgIcon {...props}> <path d="M9.31 17l2.44-2.44L14.19 17l1.06-1.06-2.44-2.44 2.44-2.44L14.19 10l-2.44 2.44L9.31 10l-1.06 1.06 2.44 2.44-2.44 2.44L9.31 17zM19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11z"/> </SvgIcon> ); NotificationEventBusy = pure(NotificationEventBusy); NotificationEventBusy.displayName = 'NotificationEventBusy'; NotificationEventBusy.muiName = 'SvgIcon'; export default NotificationEventBusy;
new-lamassu-admin/src/components/NotificationCenter/NotificationRow.js
naconner/lamassu-server
import { makeStyles } from '@material-ui/core/styles' import classnames from 'classnames' import prettyMs from 'pretty-ms' import * as R from 'ramda' import React from 'react' import { Label1, Label2, TL2 } from 'src/components/typography' import { ReactComponent as Wrench } from 'src/styling/icons/action/wrench/zodiac.svg' import { ReactComponent as Transaction } from 'src/styling/icons/arrow/transaction.svg' import { ReactComponent as WarningIcon } from 'src/styling/icons/warning-icon/tomato.svg' import styles from './NotificationCenter.styles' const useStyles = makeStyles(styles) const types = { transaction: { display: 'Transactions', icon: <Transaction height={16} width={16} /> }, highValueTransaction: { display: 'Transactions', icon: <Transaction height={16} width={16} /> }, fiatBalance: { display: 'Maintenance', icon: <Wrench height={16} width={16} /> }, cryptoBalance: { display: 'Maintenance', icon: <Wrench height={16} width={16} /> }, compliance: { display: 'Compliance', icon: <WarningIcon height={16} width={16} /> }, error: { display: 'Error', icon: <WarningIcon height={16} width={16} /> } } const NotificationRow = ({ id, type, detail, message, deviceName, created, read, valid, toggleClear }) => { const classes = useStyles() const typeDisplay = R.path([type, 'display'])(types) ?? null const icon = R.path([type, 'icon'])(types) ?? ( <Wrench height={16} width={16} /> ) const age = prettyMs(new Date().getTime() - new Date(created).getTime(), { compact: true, verbose: true }) const notificationTitle = typeDisplay && deviceName ? `${typeDisplay} - ${deviceName}` : !typeDisplay && deviceName ? `${deviceName}` : `${typeDisplay}` const iconClass = { [classes.readIcon]: read, [classes.unreadIcon]: !read } return ( <div className={classnames( classes.notificationRow, !read && valid ? classes.unread : '' )}> <div className={classes.notificationRowIcon}> <div>{icon}</div> </div> <div className={classes.notificationContent}> <Label2 className={classes.notificationTitle}> {notificationTitle} </Label2> <TL2 className={classes.notificationBody}>{message}</TL2> <Label1 className={classes.notificationSubtitle}>{age}</Label1> </div> <div className={classes.readIconWrapper}> <div onClick={() => toggleClear(id)} className={classnames(iconClass)} /> </div> </div> ) } export default NotificationRow
app/components/FleetBody.js
Ruin0x11/fleet
import React, { Component } from 'react'; import { Link } from 'react-router'; import styles from './FleetBody.css'; import DeckListContainer from '../containers/DeckListContainer'; import NotifierContainer from '../containers/NotifierContainer'; import DockInfoContainer from '../containers/DockInfoContainer'; import FleetTabs from './FleetTabs'; export default class FleetBody extends Component { render() { return ( <div className={styles.container}> <div className={styles.leftarea}> <FleetTabs /> </div> <div className={styles.mainarea}> <div className={styles.message}> <div style={{display: 'flex'}}> <DeckListContainer /> <DockInfoContainer /> </div> </div> </div> </div> ); } }
src/svg-icons/maps/local-drink.js
nathanmarks/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let MapsLocalDrink = (props) => ( <SvgIcon {...props}> <path d="M3 2l2.01 18.23C5.13 21.23 5.97 22 7 22h10c1.03 0 1.87-.77 1.99-1.77L21 2H3zm9 17c-1.66 0-3-1.34-3-3 0-2 3-5.4 3-5.4s3 3.4 3 5.4c0 1.66-1.34 3-3 3zm6.33-11H5.67l-.44-4h13.53l-.43 4z"/> </SvgIcon> ); MapsLocalDrink = pure(MapsLocalDrink); MapsLocalDrink.displayName = 'MapsLocalDrink'; MapsLocalDrink.muiName = 'SvgIcon'; export default MapsLocalDrink;
src/ButtonInput.js
leozdgao/react-bootstrap
import React from 'react'; import Button from './Button'; import FormGroup from './FormGroup'; import InputBase from './InputBase'; import childrenValueValidation from './utils/childrenValueInputValidation'; class ButtonInput extends InputBase { renderFormGroup(children) { let {bsStyle, value, ...other} = this.props; return <FormGroup {...other}>{children}</FormGroup>; } renderInput() { let {children, value, ...other} = this.props; let val = children ? children : value; return <Button {...other} componentClass="input" ref="input" key="input" value={val} />; } } ButtonInput.types = ['button', 'reset', 'submit']; ButtonInput.defaultProps = { type: 'button' }; ButtonInput.propTypes = { type: React.PropTypes.oneOf(ButtonInput.types), bsStyle(props) { //defer to Button propTypes of bsStyle return null; }, children: childrenValueValidation, value: childrenValueValidation }; export default ButtonInput;
frontend/js/components/organisms/AppLogo.js
Code4HR/okcandidate-platform
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import IconButton from './../molecules/IconButton'; class AppLogo extends Component { render() { return ( <section className="app-logo"> { this.props.displayMenuButton && <IconButton onClick={this.props.onClick} icon="menu" /> } <a href="/"> <img alt="OKCandidate" src="/dist/images/okcandidate-logo.svg" /> </a> </section> ); } } AppLogo.propTypes = { onClick: PropTypes.func, displayMenuButton: PropTypes.bool }; export default AppLogo;
src/pages/Editor/pages/MapEditor/pages/Upload/containers/DataUploadContainer/components/DataUploadLayout/components/DataUploadHeader/DataUploadHeader.js
caspg/datamaps.co
import React from 'react' import PropTypes from 'prop-types' import { grey300 } from '@src/styles/colors' import UploadSteps from './components/UploadSteps' import UploadInstructions from './components/UploadInstructions' const DataUploadHeader = (props) => { const { currentStep, columnIndexes, onSkipStep, onChangeStep } = props return ( <div className="DataUploadHeader"> <UploadSteps currentStep={currentStep} columnIndexes={columnIndexes} onChangeStep={onChangeStep} /> <UploadInstructions currentStep={currentStep} onSkipStep={onSkipStep} /> <style jsx>{` .DataUploadHeader { background-color: white; min-height: 60px; padding: 20px; padding-left: 35px; border-bottom: 1px solid ${grey300}; } `}</style> </div> ) } DataUploadHeader.propTypes = { currentStep: PropTypes.string.isRequired, columnIndexes: PropTypes.shape({ code: PropTypes.number, name: PropTypes.number, value: PropTypes.number, }), onSkipStep: PropTypes.func.isRequired, onChangeStep: PropTypes.func.isRequired, } export default DataUploadHeader
blueocean-material-icons/src/js/components/svg-icons/editor/border-left.js
kzantow/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const EditorBorderLeft = (props) => ( <SvgIcon {...props}> <path d="M11 21h2v-2h-2v2zm0-4h2v-2h-2v2zm0-12h2V3h-2v2zm0 4h2V7h-2v2zm0 4h2v-2h-2v2zm-4 8h2v-2H7v2zM7 5h2V3H7v2zm0 8h2v-2H7v2zm-4 8h2V3H3v18zM19 9h2V7h-2v2zm-4 12h2v-2h-2v2zm4-4h2v-2h-2v2zm0-14v2h2V3h-2zm0 10h2v-2h-2v2zm0 8h2v-2h-2v2zm-4-8h2v-2h-2v2zm0-8h2V3h-2v2z"/> </SvgIcon> ); EditorBorderLeft.displayName = 'EditorBorderLeft'; EditorBorderLeft.muiName = 'SvgIcon'; export default EditorBorderLeft;
docs/client/routes.js
koaninc/draft-js-plugins
import React from 'react'; import { Route, IndexRoute } from 'react-router'; import App from './components/wrappers/App'; import Page from './components/wrappers/Page'; import NotFound from './components/pages/NotFound'; import Home from './components/pages/Home'; import Hashtag from './components/pages/Hashtag'; import Emoji from './components/pages/Emoji'; import Linkify from './components/pages/Linkify'; import Sticker from './components/pages/Sticker'; import Undo from './components/pages/Undo'; import Mention from './components/pages/Mention'; import Counter from './components/pages/Counter'; import Playground from './components/pages/Playground'; import Image from './components/pages/Image'; import InlineToolbar from './components/pages/InlineToolbar'; import SideToolbar from './components/pages/SideToolbar'; import Alignment from './components/pages/Alignment'; import Focus from './components/pages/Focus'; import Resizeable from './components/pages/Resizeable'; import Video from './components/pages/Video'; import DragNDrop from './components/pages/DragNDrop'; export const routes = ( <Route path="/" title="App" component={App}> <IndexRoute component={Home} /> <Route path="/" title="App" component={Page}> <Route path="plugin/resizeable" title="App - Resizeable" component={Resizeable} /> <Route path="plugin/alignment" title="App - Alignment" component={Alignment} /> <Route path="plugin/focus" title="App - Focus" component={Focus} /> <Route path="plugin/hashtag" title="App - Hashtag" component={Hashtag} /> <Route path="plugin/emoji" title="App - Emoji" component={Emoji} /> <Route path="plugin/linkify" title="App - Linkify" component={Linkify} /> <Route path="plugin/sticker" title="App - Sticker" component={Sticker} /> <Route path="plugin/undo" title="App - Undo" component={Undo} /> <Route path="plugin/mention" title="App - Mention" component={Mention} /> <Route path="plugin/counter" title="App - Counter" component={Counter} /> <Route path="plugin/image" title="App - Image" component={Image} /> <Route path="plugin/inline-toolbar" title="App - InlineToolbar" component={InlineToolbar} /> <Route path="plugin/side-toolbar" title="App - SideToolbar" component={SideToolbar} /> <Route path="plugin/video" title="App - Video" component={Video} /> <Route path="plugin/drag-n-drop" title="App - Drag'n'Drop" component={DragNDrop} /> </Route> <Route path="playground" title="App - Development Playground" component={Playground} /> <Route path="*" title="404: Not Found" component={NotFound} /> </Route> ); export default routes;
src/svg-icons/action/gif.js
lawrence-yu/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionGif = (props) => ( <SvgIcon {...props}> <path d="M11.5 9H13v6h-1.5zM9 9H6c-.6 0-1 .5-1 1v4c0 .5.4 1 1 1h3c.6 0 1-.5 1-1v-2H8.5v1.5h-2v-3H10V10c0-.5-.4-1-1-1zm10 1.5V9h-4.5v6H16v-2h2v-1.5h-2v-1z"/> </SvgIcon> ); ActionGif = pure(ActionGif); ActionGif.displayName = 'ActionGif'; ActionGif.muiName = 'SvgIcon'; export default ActionGif;
examples/huge-apps/routes/Course/components/Nav.js
rkaneriya/react-router
import React from 'react' import { Link } from 'react-router' const styles = {} styles.nav = { borderBottom: '1px solid #aaa' } styles.link = { display: 'inline-block', padding: 10, textDecoration: 'none' } styles.activeLink = { ...styles.link, color: 'red' } class Nav extends React.Component { render() { const { course } = this.props const pages = [ [ 'announcements', 'Announcements' ], [ 'assignments', 'Assignments' ], [ 'grades', 'Grades' ] ] return ( <nav style={styles.nav}> {pages.map((page, index) => ( <Link key={page[0]} activeStyle={index === 0 ? { ...styles.activeLink, paddingLeft: 0 } : styles.activeLink} style={index === 0 ? { ...styles.link, paddingLeft: 0 } : styles.link} to={`/course/${course.id}/${page[0]}`} >{page[1]}</Link> ))} </nav> ) } } export default Nav
src/components/material-style/MaterialStyleSidebar.js
casesandberg/react-docs
'use strict' import React from 'react' import ReactCSS from 'reactcss' import MaterialStyleSidebarMenu from './MaterialStyleSidebarMenu' export class MaterialStyleSidebar extends ReactCSS.Component { classes() { return { 'default': { logo: { height: '64px', lineHeight: '64px', fontSize: '20px', background: '#D6000F', color: '#fff', textAlign: 'center', fontSmoothing: 'antialiased', }, }, } } render() { return ( <div> <div style={ this.styles().logo }><strong>Style</strong>Hub</div> <div style={ this.styles().menu }> <MaterialStyleSidebarMenu route={ this.props.route } /> </div> </div> ) } } export default MaterialStyleSidebar
docs/src/app/components/pages/components/Slider/ExampleAxis.js
kittyjumbalaya/material-components-web
import React from 'react'; import Slider from 'material-ui/Slider'; const styles = { root: { display: 'flex', height: 124, flexDirection: 'row', justifyContent: 'space-around', }, }; /** * The orientation of the slider can be reversed and rotated using the `axis` prop. */ const SliderExampleAxis = () => ( <div style={styles.root}> <Slider style={{height: 100}} axis="y" defaultValue={0.5} /> <Slider style={{width: 200}} axis="x-reverse" /> <Slider style={{height: 100}} axis="y-reverse" defaultValue={1} /> </div> ); export default SliderExampleAxis;
b_stateMachine/complex_templates/jsx/wizard/core/core_index_selection.js
Muzietto/react-playground
'use strict'; import React from 'react'; import ItemsList from '../../template/components/ItemsList'; export default function core_index_selection(props) { let chosenProperty = props.chosen_dataset_property; return ( <div className="core"> <p>This is the core index selection saying: {props.core.message}</p><br/> <p>Your choice is {chosenProperty} | Select the index now</p> <ItemsList containerCssClass="types_container" items={props.handlers.forward}> {(handler, index) => <div key={index} className="type_container" onClick={handler}> {handler.name} </div>} </ItemsList> </div> ); }
node_modules/browser-sync/node_modules/bs-recipes/recipes/webpack.react-transform-hmr/app/js/main.js
riagrawal/Smart_city_accident_prediction
import React from 'react'; // It's important to not define HelloWorld component right in this file // because in that case it will do full page reload on change import HelloWorld from './HelloWorld.jsx'; React.render(<HelloWorld />, document.getElementById('react-root'));
ui/js/containers/Shell/Shell.js
NitorCreations/willow-ui
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { ShellTerminal } from 'components'; import createUuid from '../../util/uuid'; import './Shell.scss'; function terminalConfigurations(newUser, newHost) { return { user: newUser, host: newHost, rows: 30, maxCols: 120, key: createUuid() }; } class Shell extends Component { constructor(props) { super(props); this.state = { terminals: [], newUser: '@admin', newHost: 'hostname' }; } render() { var terminals = this.state.terminals; return ( <div className="shell-container"> <header> <p1>Shells</p1> <form> <input type="text" name="username" value={this.state.newUser} onChange={this.updateUserName.bind(this)} /> <input type="text" name="host" value={this.state.newHost} onChange={this.updateHost.bind(this)} /> <button onClick={this.handleSubmit.bind(this)}>"create"</button> </form> </header> {terminals.map(terminalConfig => { return (<ShellTerminal {...terminalConfig} />); })} </div> ); } handleSubmit(event) { event.preventDefault(); this.setState({ terminals: this.state.terminals.concat(terminalConfigurations(this.state.newUser, this.state.newHost)) }); } updateUserName(event) { this.setState({ newUser: event.target.value }); } updateHost(event) { this.setState({ newHost: event.target.value }); } } export default connect(() => { return {}; }) (Shell);
src/components/Home.js
BingbingYanYK/configuratorDemo
import React from 'react'; import Interactive from 'react-interactive'; import { Link } from 'react-router-dom'; import { Code } from '../styles/style'; import s from '../styles/home.style'; export default function Home() { const repoReadmeLink = text => ( <Interactive as="a" {...s.link} href="https://github.com/rafrex/spa-github-pages#readme" >{text}</Interactive> ); return ( <div> <p style={s.p}> This is an example single page app built with React and React&nbsp;Router using {' '} <Code>BrowserRouter</Code>. Navigate with the links below and refresh the page or copy/paste the url to test out the redirect functionality deployed to overcome GitHub&nbsp;Pages incompatibility with single page apps (like this one). </p> <p style={s.p}> Please see the {repoReadmeLink('repo readme')} for instructions on how to use this boilerplate to deploy your own single page app using GitHub Pages. </p> <div style={s.pageLinkContainer}> <Interactive as={Link} {...s.link} to="/example" >Example page</Interactive> </div> <div style={s.pageLinkContainer}> <Interactive as={Link} {...s.link} to="/example/two-deep?field1=foo&field2=bar#boom!" >Example two deep with query and hash</Interactive> </div> </div> ); }
src/icons/FileUploadIcon.js
kiloe/ui
import React from 'react'; import Icon from '../Icon'; export default class FileUploadIcon extends Icon { getSVG(){return <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M18 32h12V20h8L24 6 10 20h8zm-8 4h28v4H10z"/></svg>;} };
src/containers/recipes/Listing/ListingView.js
npdat/Demo_React_Native
/** * Recipe Listing Screen * - Shows a list of receipes * * React Native Starter App * https://github.com/mcnamee/react-native-starter-app */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { View, ListView, RefreshControl, } from 'react-native'; // Consts and Libs import { AppColors, AppStyles } from '@theme/'; import { ErrorMessages } from '@constants/'; // Containers import RecipeCard from '@containers/recipes/Card/CardContainer'; // Components import Error from '@components/general/Error'; /* Component ==================================================================== */ class RecipeListing extends Component { static componentName = 'RecipeListing'; static propTypes = { recipes: PropTypes.arrayOf(PropTypes.object).isRequired, reFetch: PropTypes.func, } static defaultProps = { reFetch: null, } constructor() { super(); this.state = { isRefreshing: true, dataSource: new ListView.DataSource({ rowHasChanged: (row1, row2) => row1 !== row2, }), }; } componentWillReceiveProps(props) { this.setState({ dataSource: this.state.dataSource.cloneWithRows(props.recipes), isRefreshing: false, }); } /** * Refetch Data (Pull to Refresh) */ reFetch = () => { if (this.props.reFetch) { this.setState({ isRefreshing: true }); this.props.reFetch() .then(() => { this.setState({ isRefreshing: false }); }); } } render = () => { const { recipes } = this.props; const { isRefreshing, dataSource } = this.state; if (!isRefreshing && (!recipes || recipes.length < 1)) { return <Error text={ErrorMessages.recipe404} />; } return ( <View style={[AppStyles.container]}> <ListView initialListSize={5} renderRow={recipe => <RecipeCard recipe={recipe} />} dataSource={dataSource} automaticallyAdjustContentInsets={false} refreshControl={ this.props.reFetch ? <RefreshControl refreshing={isRefreshing} onRefresh={this.reFetch} tintColor={AppColors.brand.primary} /> : null } /> </View> ); } } /* Export Component ==================================================================== */ export default RecipeListing;
app/components/shared/FormYAMLEditorField/index.js
buildkite/frontend
import React from 'react'; import PropTypes from 'prop-types'; import Loadable from 'react-loadable'; import Spinner from 'app/components/shared/Spinner'; const CODEMIRROR_BUFFER = 8; const CODEMIRROR_LINE_HEIGHT = 17; const CODEMIRROR_CONFIG = { lineNumbers: true, tabSize: 2, indentUnit: 2, indentWithTabs: false, mode: 'yaml', keyMap: 'sublime', theme: 'yaml', autoCloseBrackets: true, matchBrackets: true, showCursorWhenSelecting: true, viewportMargin: Infinity, gutters: ['CodeMirror-linenumbers'], extraKeys: { 'Ctrl-Left': 'goSubwordLeft', 'Ctrl-Right': 'goSubwordRight', 'Alt-Left': 'goGroupLeft', 'Alt-Right': 'goGroupRight', 'Tab': (cm) => { return cm.replaceSelection(Array(cm.getOption("indentUnit") + 1).join(" ")); } } }; class FormYAMLEdtiorField extends React.Component { static propTypes = { name: PropTypes.string, value: PropTypes.string, CodeMirror: PropTypes.func }; componentDidMount() { const { CodeMirror } = this.props; this.editor = CodeMirror.fromTextArea( this.input, CODEMIRROR_CONFIG ); } componentWillUnmount() { if (this.editor) { this.editor.toTextArea(); delete this.editor; } } render() { return ( <div> <textarea name={this.props.name} defaultValue={this.props.value} ref={(input) => this.input = input} /> </div> ); } } const FormYAMLEdtiorFieldLoader = (props) => { // Here's a dynamic loader for editor that does some magical stuff. It tries // to attempt the size of the editor before we load it, this way the page // doesn't change in size after we load in Codemirror. const ApproximateHeightLoader = (loader) => { let contents; if (loader.error) { contents = ( <span className="red"> There was an error loading the editor. Please reload the page. </span> ); } else if (loader.pastDelay) { contents = ( <span> <Spinner /> Loading Editor… </span> ); } else { contents = null; } const lines = props.value.split("\n").length; const height = CODEMIRROR_BUFFER + (lines * CODEMIRROR_LINE_HEIGHT); return ( <div className="flex items-center justify-center" style={{ height: height }}> {contents} </div> ); }; ApproximateHeightLoader.propTypes = { value: PropTypes.string }; // This loads Codemirror and all of its addons. const LoadableCodeMirror = Loadable.Map({ loader: { CodeMirror: () => ( import('./codemirror').then((module) => ( // HACK: Add a "zero" delay after the module has // loaded, to allow their styles to take effect new Promise((resolve) => { setTimeout(() => resolve(module.default), 0); }) )) ) }, loading() { return ( <ApproximateHeightLoader /> ); }, render(loaded, props) { return ( <FormYAMLEdtiorField CodeMirror={loaded.CodeMirror} name={props.name} value={props.value} /> ); } }); return ( <LoadableCodeMirror {...props} /> ); }; FormYAMLEdtiorFieldLoader.propTypes = { name: PropTypes.string, value: PropTypes.string }; export default FormYAMLEdtiorFieldLoader;
react/src/containers/MenuFormApp/index.js
sinfin/folio
import React from 'react' import { connect } from 'react-redux' import SortableTree, { changeNodeAtPath, removeNodeAtPath } from 'react-sortable-tree' import { Button } from 'reactstrap' import 'react-sortable-tree/style.css' import { menusSelector, addItem, updateItems, removeItem, MENU_ITEM_URL } from 'ducks/menus' import MenuFormAppWrap from './styled/MenuFormAppWrap' import MenuItem from './MenuItem' import SerializedMenu from './SerializedMenu' const getNodeKey = ({ treeIndex }) => treeIndex function MenuFormApp ({ menus, onChange, makeOnMenuItemChange, makeOnMenuItemRemove, add }) { React.useEffect(() => { const $add = window.jQuery('.f-c-js-menus-form-add') $add.on('click', add) return function cleanup () { $add.off('click', add) } }, [add]) const itemOnChange = makeOnMenuItemChange(menus.items) const itemOnRemove = makeOnMenuItemRemove(menus.items) const styleOptions = [] menus.styles.forEach((ary) => { styleOptions.push( <option key={ary[1]} value={ary[1]}>{ary[0]}</option> ) }) const linkOptions = [ { value: '', label: window.FolioConsole.translations.menuNoLink }, { value: MENU_ITEM_URL, label: window.FolioConsole.translations.menuItemUrl } ] menus.paths.forEach((path, i) => { const value = path.rails_path || `${path.target_type} -=- ${path.target_id}` linkOptions.push({ value: value, title: path.title, label: path.label }) }) return ( <MenuFormAppWrap> <SortableTree maxDepth={menus.maxNestingDepth} rowHeight={80} treeData={menus.items} onChange={onChange} isVirtualized={false} generateNodeProps={({ node, path }) => ({ title: ( <MenuItem node={node} path={path} onChange={itemOnChange} linkOptions={linkOptions} styleOptions={styleOptions} remove={itemOnRemove} /> ) })} /> <div className='my-4'> <Button color='success' type='button' onClick={add}> <i className='fa fa-plus' /> {window.FolioConsole.translations.addMenuItem} </Button> </div> <SerializedMenu menus={menus} /> </MenuFormAppWrap> ) } const mapStateToProps = (state, props) => ({ menus: menusSelector(state) }) function mapDispatchToProps (dispatch) { return { add: () => { dispatch(addItem()) }, onChange: (treeData) => { dispatch(updateItems(treeData)) }, makeOnMenuItemChange: (items) => (path, newNode) => { dispatch( updateItems( changeNodeAtPath({ treeData: items, path, newNode, getNodeKey }) ) ) }, makeOnMenuItemRemove: (items) => (path, removed) => { const tree = removeNodeAtPath({ treeData: items, path, getNodeKey }) dispatch( removeItem(tree, removed) ) } } } export default connect(mapStateToProps, mapDispatchToProps)(MenuFormApp)
client/index.js
heroku/create-render-4r-example
import 'babel-core/polyfill' import React from 'react' import { render } from 'react-dom' import { Provider } from 'react-redux' import configureStore from '../common/store/configure-store' import App from '../common/containers/app' import { Router } from 'react-router' import { createHistory, useQueries } from 'history' import routes from '../common/routes' const initialState = window.__INITIAL_STATE__ const store = configureStore(initialState) const history = useQueries(createHistory)() const rootElement = document.getElementById('react-app') render( <Provider store={store}> <Router children={routes} history={history}/> </Provider>, rootElement )
src/components/BookSerachResultItem.js
pawelzysk1989/game-store
import React from 'react'; import PropTypes from 'prop-types'; const BookSerachResultItem = ({book, currency, priceOnSlider, addBook, index}) => { return ( <div className="book"> <div className="card"> <div className="card-image"> <img src={book.image}/> <span className="card-title"/> <a onClick={() => addBook(index)} className={`btn-floating halfway-fab waves-effect waves-light red ${priceOnSlider > book.price ? "" : "disabled"}`}> <i className="material-icons">add</i></a> </div> <div className="card-content"> <p><strong>Price: </strong>{`${book.price} ${currency}`}</p> </div> </div> </div> ); }; BookSerachResultItem.propTypes = { book: PropTypes.object.isRequired, priceOnSlider: PropTypes.number.isRequired, index: PropTypes.number.isRequired, addBook: PropTypes.func.isRequired, currency: PropTypes.string, }; BookSerachResultItem.defaultProps = { currency: "$" }; export default BookSerachResultItem;
webui/pages/admin/holidays.js
stiftungswo/izivi_relaunch
import React from 'react'; import { Button, Container, Dropdown, Form, Header, Input, Segment, Table } from 'semantic-ui-react'; import App from '../../components/AppContainer'; const yearOptions = [ { text: '2015', value: '2015', }, { text: '2016', value: '2016', }, { text: '2017', value: '2017', }, { text: '2018', value: '2018', }, { text: '2019', value: '2019', } ] const holidayOptions = [ { text: 'Betriebsferien', value: 'betriebsferien', }, { text: 'Feiertag', value: 'feiertag', } ] const entryDates = [ { id: 1, date: '2017-01-01', name: 'Name 1', type: 'Feiertag', }, { id: 2, date: '2017-01-02', name: 'Name 2', type: 'Betriebsferien', }, { id: 3, date: '2017-01-03', name: 'Name 3', type: 'Betriebsferien', } ] export default ({ ...rest }) => ( <App {...rest}> <Container> <Header as='h1'>Feiertage & Betriebsferien</Header> <Segment> <Header as='h2'>Gewähltes Jahr</Header> <Dropdown placeholder='Jahr' selection options={yearOptions}/> </Segment> <Segment> <Header as='h2'>Aktuelle Einträge</Header> <Table celled> <Table.Header> <Table.Row> <Table.HeaderCell>Datum</Table.HeaderCell> <Table.HeaderCell>Name</Table.HeaderCell> <Table.HeaderCell>Art</Table.HeaderCell> <Table.HeaderCell>Operation</Table.HeaderCell> </Table.Row> </Table.Header> <Table.Body> <Table.Row> <Table.Cell>01.01.2017</Table.Cell> <Table.Cell>Name 1</Table.Cell> <Table.Cell>Feiertag</Table.Cell> <Table.Cell>Editieren | Löschen</Table.Cell> </Table.Row> <Table.Row> <Table.Cell>02.01.2017</Table.Cell> <Table.Cell>Name 2</Table.Cell> <Table.Cell>Feiertag</Table.Cell> <Table.Cell>Editieren | Löschen</Table.Cell> </Table.Row> <Table.Row> <Table.Cell>03.01.2017</Table.Cell> <Table.Cell>Name 3</Table.Cell> <Table.Cell>Betriebsferien</Table.Cell> <Table.Cell>Editieren | Löschen</Table.Cell> </Table.Row> </Table.Body> </Table> </Segment> <Segment> <Header as='h2'>Neuen Eintrag erfassen</Header> <Form> <Form.Group inline> <Form.Field control={Input} label='Datum' type='date' /> <Form.Field control={Input} label='Name' type='text' /> <Form.Select label='Art' options={holidayOptions} /> <Form.Button content='Speichern' /> </Form.Group> </Form> </Segment> </Container> </App> );
packages/material-ui-icons/src/SignalWifi3BarSharp.js
lgollut/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path fillOpacity=".3" d="M23.64 7c-.45-.34-4.93-4-11.64-4C5.28 3 .81 6.66.36 7L12 21.5 23.64 7z" /><path d="M3.53 10.95L12 21.5l8.47-10.55C20.04 10.62 16.81 8 12 8s-8.04 2.62-8.47 2.95z" /></React.Fragment> , 'SignalWifi3BarSharp');
pootle/static/js/auth/components/EmailConfirmation.js
Jobava/pootle
/* * Copyright (C) Pootle contributors. * * This file is a part of the Pootle project. It is distributed under the GPL3 * or later license. See the LICENSE file for a copy of the license and the * AUTHORS file for copyright and authorship information. */ 'use strict'; import React from 'react'; import { PureRenderMixin } from 'react/addons'; import AuthContent from './AuthContent'; let EmailConfirmation = React.createClass({ mixins: [PureRenderMixin], propTypes: { onClose: React.PropTypes.func.isRequired, }, /* Layout */ render() { return ( <AuthContent> <p>{gettext('This email confirmation link expired or is invalid.')}</p> <div className="actions"> <button className="btn btn-primary" onClick={this.props.onClose} > {gettext('Close')} </button> </div> </AuthContent> ); } }); export default EmailConfirmation;
packages/ui-toolkit/src/styleguide/sectionHeading.js
yldio/joyent-portal
import React from 'react'; import styled from 'styled-components'; import cx from 'classnames'; import Styled from 'react-styleguidist/lib/rsg-components/Styled'; import remcalc from 'remcalc'; const styles = ({ color, fontFamily, fontSize }) => ({ heading: { color: color.base, fontFamily: fontFamily.base, fontWeight: 'normal' }, heading1: { fontSize: remcalc(36) }, heading2: { fontSize: remcalc(30) }, heading3: { fontSize: remcalc(26) }, heading4: { fontSize: remcalc(24) }, heading5: { fontSize: remcalc(24) }, heading6: { fontSize: remcalc(18) } }); const Link = styled.a` color: ${props => props.theme.text}; text-decoration: none; `; function HeadingRenderer({ classes, level, children, ...props }) { const Tag = `h${level}`; const headingClasses = cx(classes.heading, classes[`heading${level}`]); const Heading = level === 1 ? null : ( <Tag {...props} className={headingClasses}> {children} </Tag> ); return Heading; } const Heading = Styled(styles)(HeadingRenderer); export default ({ classes, children, toolbar, id, href, depth, deprecated }) => { const headingLevel = Math.min(6, depth); return ( <div> <Heading level={headingLevel} id={id}> <Link href={href}>{children}</Link> </Heading> {/* <div className={classes.toolbar}>{toolbar}</div> */} </div> ); };
docs/src/PageFooter.js
mmartche/boilerplate-shop
import React from 'react'; import packageJSON from '../../package.json'; let version = packageJSON.version; if (/docs/.test(version)) { version = version.split('-')[0]; } const PageHeader = React.createClass({ render() { return ( <footer className="bs-docs-footer" role="contentinfo"> <div className="container"> <ul className="bs-docs-footer-links muted"> <li>Currently v{version}</li> </ul> </div> </footer> ); } }); export default PageHeader;
packages/forms/src/deprecated/fields/StringField.js
Talend/ui
import React from 'react'; import PropTypes from 'prop-types'; import { getDefaultFormState, getWidget, getUiOptions, isSelect, optionsList, getDefaultRegistry, } from 'react-jsonschema-form/lib/utils'; function StringField(props) { const { schema, name, uiSchema, idSchema, formData, required, disabled, readonly, autofocus, registry, onChange, onBlur, onFocus, } = props; const { title, format } = schema; const { widgets, formContext } = registry; const enumOptions = isSelect(schema) ? optionsList(schema) : undefined; const defaultWidget = format || (enumOptions ? 'select' : 'text'); const { widget = defaultWidget, placeholder = '', ...options } = getUiOptions(uiSchema); const Widget = getWidget(schema, widget, widgets); const onChangeHandler = value => { onChange(value, options); }; return ( <Widget options={{ ...options, enumOptions }} schema={schema} id={idSchema && idSchema.$id} label={title === undefined ? name : title} value={getDefaultFormState(schema, formData)} onChange={onChangeHandler} onBlur={onBlur} onFocus={onFocus} required={required} disabled={disabled} readonly={readonly} formContext={formContext} autofocus={autofocus} registry={registry} placeholder={placeholder} /> ); } if (process.env.NODE_ENV !== 'production') { StringField.propTypes = { schema: PropTypes.object.isRequired, uiSchema: PropTypes.object.isRequired, idSchema: PropTypes.object, onChange: PropTypes.func.isRequired, onBlur: PropTypes.func, onFocus: PropTypes.func, formData: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), registry: PropTypes.shape({ widgets: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object])) .isRequired, fields: PropTypes.objectOf(PropTypes.func).isRequired, definitions: PropTypes.object.isRequired, formContext: PropTypes.object.isRequired, }), name: PropTypes.string, required: PropTypes.bool, disabled: PropTypes.bool, readonly: PropTypes.bool, autofocus: PropTypes.bool, }; } StringField.defaultProps = { uiSchema: {}, registry: getDefaultRegistry(), disabled: false, readonly: false, autofocus: false, }; export default StringField;
webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js
theforeman/foreman-tasks
import React from 'react'; export const ActionButtons = props => <button>{JSON.stringify(props)}</button>;
src/svg-icons/image/add-a-photo.js
matthewoates/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageAddAPhoto = (props) => ( <SvgIcon {...props}> <path d="M3 4V1h2v3h3v2H5v3H3V6H0V4h3zm3 6V7h3V4h7l1.83 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10h3zm7 9c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-3.2-5c0 1.77 1.43 3.2 3.2 3.2s3.2-1.43 3.2-3.2-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2z"/> </SvgIcon> ); ImageAddAPhoto = pure(ImageAddAPhoto); ImageAddAPhoto.displayName = 'ImageAddAPhoto'; ImageAddAPhoto.muiName = 'SvgIcon'; export default ImageAddAPhoto;
src/svg-icons/social/people-outline.js
lawrence-yu/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let SocialPeopleOutline = (props) => ( <SvgIcon {...props}> <path d="M16.5 13c-1.2 0-3.07.34-4.5 1-1.43-.67-3.3-1-4.5-1C5.33 13 1 14.08 1 16.25V19h22v-2.75c0-2.17-4.33-3.25-6.5-3.25zm-4 4.5h-10v-1.25c0-.54 2.56-1.75 5-1.75s5 1.21 5 1.75v1.25zm9 0H14v-1.25c0-.46-.2-.86-.52-1.22.88-.3 1.96-.53 3.02-.53 2.44 0 5 1.21 5 1.75v1.25zM7.5 12c1.93 0 3.5-1.57 3.5-3.5S9.43 5 7.5 5 4 6.57 4 8.5 5.57 12 7.5 12zm0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm9 5.5c1.93 0 3.5-1.57 3.5-3.5S18.43 5 16.5 5 13 6.57 13 8.5s1.57 3.5 3.5 3.5zm0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2z"/> </SvgIcon> ); SocialPeopleOutline = pure(SocialPeopleOutline); SocialPeopleOutline.displayName = 'SocialPeopleOutline'; SocialPeopleOutline.muiName = 'SvgIcon'; export default SocialPeopleOutline;
imports/ui/pages/versions/EditVersion.js
KyneSilverhide/team-manager
import React from 'react'; import VersionEditor from '../../components/versions/VersionEditor.js'; const EditVersion = ({ version }) => ( <div className="EditVersion"> <h4 className="page-header">Edition de : "{ version.name }"</h4> <VersionEditor version={ version } /> </div> ); EditVersion.propTypes = { version: React.PropTypes.object, }; export default EditVersion;
client/views/Root/index.js
shastajs/boilerplate
/* eslint react/forbid-prop-types: 0 */ import React from 'react' import { Provider, Component, PropTypes } from 'shasta' import { Router } from 'shasta-router' // styling globals import 'styles/global' import rebassStyles from 'styles/rebass' import reflexboxStyles from 'styles/reflexbox' export default class RootView extends Component { static displayName = 'RootView' static propTypes = { history: PropTypes.object.isRequired, store: PropTypes.object.isRequired, routes: PropTypes.node.isRequired } static childContextTypes = { rebass: PropTypes.object, reflexbox: React.PropTypes.object } getChildContext() { return { rebass: rebassStyles, reflexbox: reflexboxStyles } } componentWillMount() { console.time('First Render Time') } componentDidMount() { console.timeEnd('First Render Time') } render() { const { store, history, routes } = this.props return ( <Provider store={store}> <Router history={history}> {routes} </Router> </Provider> ) } }
packages/arwes/src/Grid/Grid.js
romelperez/prhone-ui
import React from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; export default function Grid(props) { const { theme, classes, row, nested, noGutter, noMargin, col, s, m, l, xl, offset, className, children, ...etc } = props; const isCol = !row && col; const isRowCol = row && col; // Grid is either row or col. If both are provided the row is taken // so the child is a col. const baseClass = row ? classes.row : classes.col; const colClasses = { [classes.noGutter]: noGutter, [classes['s' + s]]: s, [classes['m' + m]]: m, [classes['l' + l]]: l, [classes['xl' + xl]]: xl }; offset.forEach(rule => { colClasses[classes['offset-' + rule]] = true; }); const cls = cx( baseClass, noMargin && [classes.noMargin], nested && [classes.nested], isCol && colClasses, className ); return ( <div className={cls} {...etc}> {isRowCol ? ( <div className={cx(classes.col, colClasses)}>{children}</div> ) : ( children )} </div> ); } Grid.propTypes = { theme: PropTypes.any.isRequired, classes: PropTypes.any.isRequired, /** * If component is a row. */ row: PropTypes.bool, /** * If row is nested inside another one. */ nested: PropTypes.bool, /** * Don't add margin bottom to the row. */ noMargin: PropTypes.bool, /** * If component is a column. */ col: PropTypes.bool, /** * Don't add lateral paddings to column. */ noGutter: PropTypes.bool, /** * The number of columns in small breakpoint. */ s: PropTypes.number, /** * The number of columns in medium breakpoint. */ m: PropTypes.number, /** * The number of columns in large breakpoint. */ l: PropTypes.number, /** * The number of columns in extra large breakpoint. */ xl: PropTypes.number, /** * A list of offset definitions for each breakpoint. * Example: `['m4', 'l2']` creates an offset of 4 columns * on medium breakpoint and an offset of 2 columns on large breakpoint. */ offset: PropTypes.arrayOf(PropTypes.string) }; Grid.defaultProps = { offset: [] };
frontend/node_modules/react-router/es/MemoryRouter.js
goodman001/20170927express
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } import warning from 'warning'; import React from 'react'; import PropTypes from 'prop-types'; import createHistory from 'history/createMemoryHistory'; import Router from './Router'; /** * The public API for a <Router> that stores location in memory. */ var MemoryRouter = function (_React$Component) { _inherits(MemoryRouter, _React$Component); function MemoryRouter() { var _temp, _this, _ret; _classCallCheck(this, MemoryRouter); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = createHistory(_this.props), _temp), _possibleConstructorReturn(_this, _ret); } MemoryRouter.prototype.componentWillMount = function componentWillMount() { warning(!this.props.history, '<MemoryRouter> ignores the history prop. To use a custom history, ' + 'use `import { Router }` instead of `import { MemoryRouter as Router }`.'); }; MemoryRouter.prototype.render = function render() { return React.createElement(Router, { history: this.history, children: this.props.children }); }; return MemoryRouter; }(React.Component); MemoryRouter.propTypes = { initialEntries: PropTypes.array, initialIndex: PropTypes.number, getUserConfirmation: PropTypes.func, keyLength: PropTypes.number, children: PropTypes.node }; export default MemoryRouter;
node_modules/react-bootstrap/es/Media.js
darklilium/Factigis_2
import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React from 'react'; import elementType from 'react-prop-types/lib/elementType'; import MediaBody from './MediaBody'; import MediaHeading from './MediaHeading'; import MediaLeft from './MediaLeft'; import MediaList from './MediaList'; import MediaListItem from './MediaListItem'; import MediaRight from './MediaRight'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var propTypes = { componentClass: elementType }; var defaultProps = { componentClass: 'div' }; var Media = function (_React$Component) { _inherits(Media, _React$Component); function Media() { _classCallCheck(this, Media); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Media.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 Media; }(React.Component); Media.propTypes = propTypes; Media.defaultProps = defaultProps; Media.Heading = MediaHeading; Media.Body = MediaBody; Media.Left = MediaLeft; Media.Right = MediaRight; Media.List = MediaList; Media.ListItem = MediaListItem; export default bsClass('media', Media);
app/templates/src/App/Components/MenuItem.js
luisrudge/generator-simple-react-browserify
import React from 'react'; import {Link} from 'react-router'; class MenuItem extends React.Component { render() { return ( <li> <Link to={this.props.route}> {this.props.text} </Link> </li> ); } } module.exports = MenuItem;
docs/app/Examples/elements/List/ContentVariations/ListExampleFloated.js
mohammed88/Semantic-UI-React
import React from 'react' import { Button, Image, List } from 'semantic-ui-react' const ListExampleFloated = () => ( <List divided verticalAlign='middle'> <List.Item> <List.Content floated='right'> <Button>Add</Button> </List.Content> <Image avatar src='http://semantic-ui.com/images/avatar2/small/lena.png' /> <List.Content> Lena </List.Content> </List.Item> <List.Item> <List.Content floated='right'> <Button>Add</Button> </List.Content> <Image avatar src='http://semantic-ui.com/images/avatar2/small/lindsay.png' /> <List.Content> Lindsay </List.Content> </List.Item> <List.Item> <List.Content floated='right'> <Button>Add</Button> </List.Content> <Image avatar src='http://semantic-ui.com/images/avatar2/small/mark.png' /> <List.Content> Mark </List.Content> </List.Item> <List.Item> <List.Content floated='right'> <Button>Add</Button> </List.Content> <Image avatar src='http://semantic-ui.com/images/avatar2/small/molly.png' /> <List.Content> Molly </List.Content> </List.Item> </List> ) export default ListExampleFloated
src/svg-icons/action/turned-in-not.js
owencm/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionTurnedInNot = (props) => ( <SvgIcon {...props}> <path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2zm0 15l-5-2.18L7 18V5h10v13z"/> </SvgIcon> ); ActionTurnedInNot = pure(ActionTurnedInNot); ActionTurnedInNot.displayName = 'ActionTurnedInNot'; ActionTurnedInNot.muiName = 'SvgIcon'; export default ActionTurnedInNot;
app/components/Home.js
jayteesanchez/project-4
import React from 'react'; import {Link} from 'react-router'; import HomeStore from '../stores/HomeStore' import HomeActions from '../actions/HomeActions'; class Home extends React.Component { constructor(props) { super(props); this.state = HomeStore.getState(); this.onChange = this.onChange.bind(this); } componentDidMount() { HomeStore.listen(this.onChange); HomeActions.getQuestions(); } componentWillUnmount() { HomeStore.unlisten(this.onChange); } onChange(state) { this.setState(state); } handleClick(question, event) { //handles the events for hiding hint display if(event.target.id === 'clickDisplay'){ document.getElementById('hintDisplay').style.display = ''; document.getElementById('clickDisplay').style.display = 'none'; }else { document.getElementById('hintDisplay').style.display = 'none'; document.getElementById('clickDisplay').style.display = ''; } //handles the voting Action var choice = event.target.alt; var id = question._id; if (choice === 'votes_choice_1'){ var count = question.votes_choice_1; HomeActions.vote1(id, count); HomeActions.changeDisplay(question); } if (choice === 'votes_choice_2'){ var count = question.votes_choice_2; HomeActions.vote2(id, count); HomeActions.changeDisplay(question); } var count = 0; } downVoting(question, event) { //handles down voting logic var id = question._id; var count = question.downVote; if(count === 4){ return HomeActions.removeQuestion(id); } HomeActions.downVote(id, count); HomeActions.changeDisplay(question); } changeQuestions(question, event) { //handles the question reveal/hide clicks var change = true; var id = question._id; HomeActions.changeDisplay(question); } render() { var resizeImg = { width: '275px', height: '275px' } var hidden = { display: 'none' } var currentQuestions = this.state.questions.questions; if (currentQuestions) { var allQuestions = currentQuestions.reverse().map((question, index) => { if(question.display){ return ( <div key={question._id} className='row fadeInUp animated text-center'> <h3 className='fadeIn animated' onClick={this.changeQuestions.bind(this, question)}> {question.question}? </h3> <div className='col-xs-6 col-sm-6 col-md-6'> <div className='thumbnail fadeInUp animated btn'> <img style={resizeImg} alt={'votes_choice_1'} onClick={this.handleClick.bind(event, question)} src={question.choice1_img}/> <div className='caption text-center'> <ul className='list-inline'> <h4><strong>{question.choice1}</strong></h4><br></br> <li><strong>Votes for:</strong></li> <li><strong>{question.votes_choice_1}</strong></li> </ul> </div> </div> </div> <div className='col-xs-6 col-sm-6 col-md-6'> <div className='thumbnail fadeInUp animated btn'> <img style={resizeImg} alt={'votes_choice_2'} onClick={this.handleClick.bind(event, question)} src={question.choice2_img}/> <div className='caption text-center'> <ul className='list-inline'> <h4><strong>{question.choice2}</strong></h4><br></br> <li><strong>Votes for:</strong></li> <li><strong>{question.votes_choice_2}</strong></li> </ul> </div> </div> </div> <h3 className='text-center'> <button className="btn btn-default btn-sm" onClick={this.downVoting.bind(event, question)}> <span className="glyphicon glyphicon-thumbs-down"></span> &nbsp;{question.downVote} </button> </h3> </div> ); } if(!question.display){ return ( <div key={question._id} alt={ question.index } className='row thumbnail btn flipInX animated' onClick={this.changeQuestions.bind(this, question)}> <h4 className='text-center'>{question.question}?</h4> <h6 className='text-center'> <strong>{question.choice1}</strong> <text> or </text> <strong>{question.choice2}</strong><br></br> <text>Number of times voted:</text><br></br> <strong>{question.votes_choice_1 + question.votes_choice_2}</strong> </h6> </div> ); } }); return ( <div className='container fadeInUp animated text-center'> <div className='row'> <h6 className='text-center fadeIn animated btn' id='clickDisplay' onClick={this.handleClick.bind(event, this.id)}>CLICK HERE to learn how to play...</h6> <h6 className='text-center fadeIn animated btn' style={hidden} id='hintDisplay' onClick={this.handleClick.bind(event, this.id)}> <p>CLICK on a TITLE to expand or shrink a Question, </p> <p>DOWNVOTE for BAD Questions - a total of <strong>5</strong> means DELETION, </p> <p>Have fun!</p> </h6> </div> {allQuestions} </div> ); } return ( <div className='container'> <div className='row'> <h1>{this.state.questions}Not Loading Resources...</h1> </div> </div> ); } } export default Home;
src/common/components/view-case/GovRec-recovery-view.js
ChrisWphoto/react-ccms
import React from 'react'; import {Button} from 'react-bootstrap'; var ViewGovRec = React.createClass({ getInitialState: function() { return { completedDate: null, dateVerified: null, }; }, componentWillReceiveProps: function (nextProps) { if (nextProps.theCase.completedDate) var acompletedDate = nextProps.theCase.completedDate.substr( 0, nextProps.theCase.completedDate.indexOf('T') ); if (nextProps.theCase.dateVerified) var adateVerified = nextProps.theCase.dateVerified.substr( 0, nextProps.theCase.dateVerified.indexOf('T') ); this.setState({ completedDate: acompletedDate, dateVerified: adateVerified }); }, render: function() { return ( <div> <h2>Recovery Details</h2> <h4>Amount Paid: ${this.props.theCase.totalAmount}</h4> <h4>Full Recovery: {this.props.theCase.fullRecovery ? "Yes" : "No"}</h4> <h4>Completed Date: {this.state.completedDate}</h4> <h4>Verified by: Joel Wiebe on {this.state.dateVerified}</h4> <h4> Notes: {this.props.theCase.additionalNotes}</h4> </div> ); } }); module.exports = ViewGovRec;
node_modules/react-bootstrap/es/HelpBlock.js
okristian1/react-info
import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React from 'react'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var HelpBlock = function (_React$Component) { _inherits(HelpBlock, _React$Component); function HelpBlock() { _classCallCheck(this, HelpBlock); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } HelpBlock.prototype.render = function render() { var _props = this.props, className = _props.className, props = _objectWithoutProperties(_props, ['className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = getClassSet(bsProps); return React.createElement('span', _extends({}, elementProps, { className: classNames(className, classes) })); }; return HelpBlock; }(React.Component); export default bsClass('help-block', HelpBlock);
admin/client/App/screens/List/components/UpdateForm.js
frontyard/keystone
import React from 'react'; import Select from 'react-select'; import { findDOMNode } from 'react-dom'; import assign from 'object-assign'; import { Fields } from 'FieldTypes'; import InvalidFieldType from '../../../shared/InvalidFieldType'; import { plural } from '../../../../utils/string'; import { BlankState, Button, Form, Modal } from '../../../elemental'; var UpdateForm = React.createClass({ displayName: 'UpdateForm', propTypes: { isOpen: React.PropTypes.bool, itemIds: React.PropTypes.array, list: React.PropTypes.object, onCancel: React.PropTypes.func, }, getDefaultProps () { return { isOpen: false, }; }, getInitialState () { return { fields: [], }; }, componentDidMount () { this.doFocus(); }, componentDidUpdate () { this.doFocus(); }, doFocus () { if (this.refs.focusTarget) { findDOMNode(this.refs.focusTarget).focus(); } }, getOptions () { const { fields } = this.props.list; return Object.keys(fields).map(key => ({ value: fields[key].path, label: fields[key].label })); }, getFieldProps (field) { var props = assign({}, field); props.value = this.state.fields[field.path]; props.values = this.state.fields; props.onChange = this.handleChange; props.mode = 'create'; props.key = field.path; return props; }, updateOptions (fields) { this.setState({ fields: fields, }, this.doFocus); }, handleChange (value) { console.log('handleChange:', value); }, handleClose () { this.setState({ fields: [], }); this.props.onCancel(); }, renderFields () { const { list } = this.props; const { fields } = this.state; const formFields = []; let focusRef; fields.forEach((fieldOption) => { const field = list.fields[fieldOption.value]; if (typeof Fields[field.type] !== 'function') { formFields.push(React.createElement(InvalidFieldType, { type: field.type, path: field.path, key: field.path })); return; } var fieldProps = this.getFieldProps(field); if (!focusRef) { fieldProps.ref = focusRef = 'focusTarget'; } formFields.push(React.createElement(Fields[field.type], fieldProps)); }); const fieldsUI = formFields.length ? formFields : ( <BlankState heading="Choose a field above to begin" style={{ padding: '3em 2em' }} /> ); return ( <div style={{ borderTop: '1px dashed rgba(0,0,0,0.1)', marginTop: 20, paddingTop: 20 }}> {fieldsUI} </div> ); }, renderForm () { const { itemIds, list } = this.props; const itemCount = plural(itemIds, ('* ' + list.singular), ('* ' + list.plural)); const formAction = `${Keystone.adminPath}/${list.path}`; return ( <Form layout="horizontal" action={formAction} noValidate="true"> <Modal.Header onClose={this.handleClose} showCloseButton text={'Update ' + itemCount} /> <Modal.Body> <Select key="field-select" multi onChange={this.updateOptions} options={this.getOptions()} ref="initialFocusTarget" value={this.state.fields} /> {this.renderFields()} </Modal.Body> <Modal.Footer> <Button color="primary" submit>Update</Button> <Button color="cancel" variant="link" onClick={this.handleClose}>Cancel</Button> </Modal.Footer> </Form> ); }, render () { return ( <Modal.Dialog isOpen={this.props.isOpen} onClose={this.handleClose} backdropClosesModal> {this.renderForm()} </Modal.Dialog> ); }, }); module.exports = UpdateForm;
app/components/Icons/icons/icon-info.js
code4romania/monitorizare-vot-votanti-client
import React from 'react'; function IconInfo() { return ( <svg version="1.1" id="icon-info" x="0px" y="0px" viewBox="-41 164.9 512 512"> <g> <g> <path d="M229.9,467.8c-10.6-14.9-27.5-24.1-45.7-24.8c-0.4,0-0.8-0.1-1.2-0.1c-23.1,0-42.3-17.5-44.9-39.9c6.7-4.9,12.8-11,18.3-18.4c11-14.9,18.2-33.5,20.8-53.7c0.8-0.9,1.5-1.9,2-3.1c4.7-11.1,7-23,7-35.2c0-47.2-35.7-85.6-79.6-85.6c-11.3,0-22.4,2.6-32.8,7.7c-3.9,0.3-7.7,1-11.4,2.1c-36.7,10.6-57.4,55-46.2,98.9c1.1,4.4,2.6,8.8,4.3,12.9c0.5,1.1,1.1,2.1,1.9,3c4.2,31,18.9,56.8,39,71.4c-2.6,22.5-21.7,40-44.9,40c-0.4,0-0.7,0-1.1,0.1c-31.4,1.1-56.6,27-56.6,58.6v63.1c0,5.9,4.8,10.7,10.7,10.7h188.5c5.9,0,10.7-4.8,10.7-10.7c0-5.9-4.8-10.7-10.7-10.7H-19.7v-52.5c0-20.6,16.7-37.3,37.3-37.3c0.4,0,0.7,0,1.1-0.1c7.7-0.2,15-1.8,21.9-4.4l50.5,72.9c2,2.9,5.3,4.6,8.8,4.6s6.8-1.7,8.8-4.6l50.5-72.9c6.8,2.6,14.2,4.2,21.9,4.4c0.3,0,0.7,0.1,1.1,0.1c12.1,0,23.5,5.9,30.5,15.8c2.1,2.9,5.4,4.5,8.7,4.5c2.1,0,4.3-0.6,6.1-2C232.2,479.3,233.3,472.6,229.9,467.8z M68.5,237.3c2.8-0.8,5.8-1.3,8.8-1.4c1.6-0.1,3.1-0.5,4.5-1.2c7.9-4.2,16.3-6.3,24.9-6.3c31.5,0,57.2,27.7,58.2,62.2c-6.4-4.9-14.4-7.7-23-7.7H86.1c-2.8,0-5.4-0.9-7.6-2.5c-1.9-1.4-3.4-3.3-4.2-5.5c-2-5-7-8.1-12.4-7.8c-5.4,0.3-10,4.1-11.3,9.4c-2.7,10.5-7.8,20.2-14.7,28.5C30.3,273.9,44.2,244.3,68.5,237.3z M43.5,327.6c9.3-8.5,16.9-18.9,22.1-30.3c0,0,0.1,0.1,0.1,0.1c5.9,4.4,13,6.8,20.4,6.8h55.8c6.7,0,12.5,3.9,15.2,9.6c-0.1,22.2-6.4,42.9-17.8,58.3c-10.8,14.6-24.8,22.6-39.5,22.6c-13.6,0-26.8-7-37.2-19.8C52.5,362.5,45.8,345.9,43.5,327.6zM99.8,507.9L59,449c10.9-9.1,18.9-21.6,22.3-35.9c5.9,1.9,12.1,2.8,18.5,2.8c6.3,0,12.5-1,18.5-2.8c3.4,14.3,11.4,26.8,22.3,35.9L99.8,507.9z" /> </g> </g> <g> <g> <path d="M414.4,502.3c-0.3,0-0.7-0.1-1.1-0.1c-23.2,0-42.3-17.5-44.9-40c13.1-9.5,23.8-23.8,30.9-41.1c1,3.3,3.6,6,7,7.1c1,0.3,2.1,0.5,3.2,0.5c3.2,0,6.4-1.5,8.4-4.1c14.9-19.1,22.6-44,21.8-70C439,329,430,305,414.5,287c-15.9-18.4-36.8-28.7-59-28.9c-1.2,0-4.1,0.1-4.6,0.1c-11.4-5.2-23.5-7.6-35.9-7.2c-25.6,0.8-49.2,13.6-66.4,36c-16.7,21.7-25.4,50.1-24.4,79.9c0.2,5,0.6,9.7,1.2,14.1c1.7,12.7,5.2,24.8,10.4,36.1c1.6,3.6,5.1,6,9.1,6.2c3.9,0.2,7.7-1.7,9.7-5.1c0.9-1.4,2-3.2,3.2-4.9c4.8,14.4,12,27.4,21.3,37.7c3.9,4.4,8.2,8.2,12.7,11.4c-2.6,22.5-21.7,40-44.9,40c-0.4,0-0.7,0-1.1,0.1c-31.4,1.1-56.6,27-56.6,58.6v63.1c0,5.9,4.8,10.7,10.7,10.7h260.3c5.9,0,10.7-4.8,10.7-10.7v-63.1C471,529.3,445.8,503.5,414.4,502.3z M249.1,390.5c-1.1-4.1-1.9-8.3-2.5-12.6c-0.5-3.7-0.9-7.6-1-11.8c-0.8-24.8,6.3-48.3,20-66.2c13.2-17.2,31-27,50.1-27.6c0.6,0,14.4-0.8,28.4,6.3c1.6,0.8,3.4,1.2,5.1,1.1c0.2,0,5.7-0.3,5.8-0.3c16,0.1,31.4,7.7,43.2,21.5c12.3,14.3,19.5,33.6,20.1,54.3c0.4,11.2-1.2,22.2-4.6,32.2c-1-2.7-2.1-5.3-3.4-7.9c-10.3-21.9-27.6-38.9-48.8-47.8c-2.7-1.1-5.7-1.1-8.4,0c-2.7,1.2-4.8,3.4-5.8,6.1c-1.4,3.8-3.1,7.6-5.1,11.1c-5.6,10-16.8,15.9-29.4,15.5c-1.9-0.1-3.8-0.1-5.7,0c-9.2,0.3-18.2,2.1-26.8,5.2C272.3,372.9,258,380.9,249.1,390.5z M275.4,396.3c4-2.7,8.3-4.9,12.9-6.6c6.3-2.4,13.1-3.7,20-3.9c1.4,0,2.8,0,4.2,0c20.6,0.7,39.2-9.4,48.7-26.4c0.6-1,1.2-2.1,1.7-3.2c9.7,6,18,14.4,24.3,24.7c-0.1,0.3-0.1,0.6-0.1,1c-1.6,20.2-8.6,38.8-19.7,52.3c-10.4,12.7-23.7,19.8-37.2,19.8C305,453.9,282.7,430,275.4,396.3z M311.7,472.4c6,1.9,12.2,2.9,18.5,2.9c6.4,0,12.6-1,18.6-2.9c4.3,18.2,16,33.5,31.8,42.5c-6.2,22.3-26.6,38.3-50.3,38.3c-23.7,0-44.2-16-50.3-38.3C295.6,505.9,307.4,490.5,311.7,472.4z M449.7,613.4h-239V561c0-20.6,16.7-37.3,37.3-37.3c0.4,0,0.7,0,1.1-0.1c3.7-0.1,7.3-0.5,10.8-1.2c9.3,30.4,37.6,52.1,70.3,52.1s61.1-21.7,70.3-52.1c3.5,0.7,7.1,1.1,10.8,1.2c0.3,0,0.7,0.1,1.1,0.1c20.6,0,37.3,16.7,37.3,37.3V613.4z" /> </g> </g> </svg> ); } export default IconInfo;
src/Pokemon.js
awayken/2016-Christmas-Card
import React, { Component } from 'react'; class Pokemon extends Component { render() { const pokemonClass = `pokemon pokemon--${this.props.stats.type}`; const typeClass = `pokemon--statvalue pokemon--${this.props.stats.type}text`; const portraitAlt = `Portrait of ${this.props.name}.`; let portraitClass = 'pokemon--portrait animated'; let pageClass = 'pokemon--page animated'; if (this.props.isEvolving) { portraitClass += ' zoomOut'; pageClass += ' fadeOut'; } else { portraitClass += ' zoomIn'; pageClass += ' fadeIn'; } return ( <article className={pokemonClass}> <header className="pokemon--header"> <span className="pokemon--cp"><small>CP</small>{this.props.cp}</span> <img className={portraitClass} src={this.props.portrait} alt={portraitAlt} /> </header> <main className={pageClass}> <h1 className="pokemon--name">{this.props.name}</h1> <ul className="pokemon--stats pokemon--panel"> <li className="pokemon--stat"> <span className="pokemon--statvalue">{this.props.stats.age}</span> <small className="pokemon--statname">Age</small> </li> <li className="pokemon--stat"> <span className={typeClass}>{this.props.stats.type}</span> <small className="pokemon--statname">Type</small> </li> <li className="pokemon--stat"> <span className="pokemon--statvalue">{this.props.stats.role}</span> <small className="pokemon--statname">Role</small> </li> </ul> <p className="pokemon--description pokemon--panel">{this.props.description}</p> { this.props.evolvesInto ? <div className="pokemon--panel"> <a className="pokemon--evolve" href="#evolve" onClick={(e) => this.props.handleEvolve(this.props.evolvesInto, e)}> <span className="page--button">Evolve</span> <span className="pokemon--evolvename">{this.props.name}</span> </a> </div> : ''} <footer className="pokemon--catch pokemon--panel"> <div className="pokemon--location">{this.props.catch.location}</div> <small className="pokemon--date">{this.props.catch.date}</small> </footer> </main> </article> ); } } export default Pokemon;
src/components/authInputs/authInputs.js
slaweet/lisk-nano
import React from 'react'; import PassphraseInput from '../passphraseInput'; import { extractPublicKey } from '../../utils/api/account'; class AuthInputs extends React.Component { componentDidMount() { if (this.props.account.secondSignature) { this.props.onChange('secondPassphrase', ''); } } onChange(name, value, error) { if (!error) { const publicKeyMap = { passphrase: 'publicKey', secondPassphrase: 'secondPublicKey', }; const expectedPublicKey = this.props.account[publicKeyMap[name]]; if (expectedPublicKey && expectedPublicKey !== extractPublicKey(value)) { error = this.props.t('Entered passphrase does not belong to the active account'); } } this.props.onChange(name, value, error); } render() { return <span> {(!this.props.account.passphrase && <PassphraseInput label={this.props.t('Passphrase')} className='passphrase' error={this.props.passphrase.error} value={this.props.passphrase.value} onChange={this.onChange.bind(this, 'passphrase')} />)} {(this.props.account.secondSignature && <PassphraseInput label={this.props.t('Second Passphrase')} className='second-passphrase' error={this.props.secondPassphrase.error} value={this.props.secondPassphrase.value} onChange={this.onChange.bind(this, 'secondPassphrase')} />)} </span>; } } export default AuthInputs;
collect-webapp/frontend/src/scenes/Pages/Register.js
openforis/collect
import React, { Component } from 'react'; class Register extends Component { render() { return ( <div className="app flex-row align-items-center"> <div className="container"> <div className="row justify-content-center"> <div className="col-md-6"> <div className="card mx-4"> <div className="card-block p-4"> <h1>Register</h1> <p className="text-muted">Create your account</p> <div className="input-group mb-3"> <span className="input-group-addon"><i className="icon-user"></i></span> <input type="text" className="form-control" placeholder="Username"/> </div> <div className="input-group mb-3"> <span className="input-group-addon">@</span> <input type="text" className="form-control" placeholder="Email"/> </div> <div className="input-group mb-3"> <span className="input-group-addon"><i className="icon-lock"></i></span> <input type="password" className="form-control" placeholder="Password"/> </div> <div className="input-group mb-4"> <span className="input-group-addon"><i className="icon-lock"></i></span> <input type="password" className="form-control" placeholder="Repeat password"/> </div> <button type="button" className="btn btn-block btn-success">Create Account</button> </div> <div className="card-footer p-4"> <div className="row"> <div className="col-6"> <button className="btn btn-block btn-facebook" type="button"><span>facebook</span></button> </div> <div className="col-6"> <button className="btn btn-block btn-twitter" type="button"><span>twitter</span></button> </div> </div> </div> </div> </div> </div> </div> </div> ); } } export default Register;
src/studies/Entry/index.js
NewSpring/Apollos
import React from 'react'; import { compose, mapProps, pure, withProps } from 'recompose'; import { get } from 'lodash'; import withStudyEntry from '@data/withStudyEntry'; import BackgroundView from '@ui/BackgroundView'; import Header from '@ui/Header'; import SecondaryNav, { Like, Share } from '@ui/SecondaryNav'; import TabView, { SceneMap } from '@ui/TabView'; import { withThemeMixin } from '@ui/theme'; import withCachedContent, { withCachedParentContent } from '@data/withCachedContent'; import ScriptureTab from './ScriptureTab'; import DevotionalTab from './DevotionalTab'; const enhance = compose( pure, mapProps(({ match: { params: { id } } }) => ({ id })), withStudyEntry, withCachedContent, withCachedParentContent, withProps(({ content }) => { let colors = get(content, 'content.colors'); if (!colors || !colors.length) colors = get(content, 'parent.content.colors'); if (!colors) colors = []; return { colors }; }), withThemeMixin(({ colors }) => { const theme = {}; if (colors && colors.length) { const primary = `#${colors[0].value}`; theme.colors = { background: { primary, }, }; } return theme; }), ); const ShareLink = withStudyEntry(Share); const Study = enhance( ({ id, content: { title, parent = {}, content: { isLiked, body, scripture = [], ...otherContentProps } = {}, } = {}, isLoading, }) => { const hasScripture = isLoading || scripture.length; const tabRoutes = [{ title: 'Devotional', key: 'devotional' }]; if (hasScripture) tabRoutes.push({ title: 'Scripture', key: 'scripture' }); const { title: parentTitle, content: { isLight = false } = {}, children = [] } = parent || {}; return ( <BackgroundView> <Header titleText={parentTitle || 'Devotional'} backButton barStyle={isLight ? 'dark-content' : 'light-content'} /> <TabView barStyle={isLight ? 'dark-content' : 'light-content'} routes={tabRoutes} renderScene={SceneMap({ devotional: withProps({ title, body, scripture, otherContentProps, entryData: children, isLoading, })(DevotionalTab), scripture: withProps({ scripture, entryData: children, isLoading, })(ScriptureTab), })} /> <SecondaryNav isLoading={isLoading} fullWidth> <ShareLink id={id} /> <Like id={id} isLiked={isLiked} /> </SecondaryNav> </BackgroundView> ); }, ); export default Study;
dnim-client/src/components/ShowAll.js
zhangmingkai4315/DNIS-Project
import React from 'react'; export default class ShowAll extends React.Component { constructor(props) { super(props); } render() { return ( <div id="layout" className="content pure-g"> <div>Another router is here</div> </div> ); } }
src/index.js
Wingjam/Plex4Life
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import registerServiceWorker from './registerServiceWorker'; import * as firebase from 'firebase'; // Initialize Firebase var config = { apiKey: "AIzaSyBWp2Xv5jKO_JU-GzjonSE94XKUysD_AxY", authDomain: "plex-4-life.firebaseapp.com", databaseURL: "https://plex-4-life.firebaseio.com", projectId: "plex-4-life", storageBucket: "plex-4-life.appspot.com", messagingSenderId: "521939421512" }; firebase.initializeApp(config); ReactDOM.render(<App />, document.getElementById('root')); registerServiceWorker();
src/svg-icons/hardware/keyboard-arrow-up.js
kasra-co/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let HardwareKeyboardArrowUp = (props) => ( <SvgIcon {...props}> <path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"/> </SvgIcon> ); HardwareKeyboardArrowUp = pure(HardwareKeyboardArrowUp); HardwareKeyboardArrowUp.displayName = 'HardwareKeyboardArrowUp'; HardwareKeyboardArrowUp.muiName = 'SvgIcon'; export default HardwareKeyboardArrowUp;
packages/mineral-ui-icons/src/IconPortableWifiOff.js
mineral-ui/mineral-ui
/* @flow */ import React from 'react'; import Icon from 'mineral-ui/Icon'; import type { IconProps } from 'mineral-ui/Icon/types'; /* eslint-disable prettier/prettier */ export default function IconPortableWifiOff(props: IconProps) { const iconProps = { rtl: false, ...props }; return ( <Icon {...iconProps}> <g> <path d="M17.56 14.24c.28-.69.44-1.45.44-2.24 0-3.31-2.69-6-6-6-.79 0-1.55.16-2.24.44l1.62 1.62c.2-.03.41-.06.62-.06a3.999 3.999 0 0 1 3.95 4.63l1.61 1.61zM12 4c4.42 0 8 3.58 8 8 0 1.35-.35 2.62-.95 3.74l1.47 1.47A9.86 9.86 0 0 0 22 12c0-5.52-4.48-10-10-10-1.91 0-3.69.55-5.21 1.47l1.46 1.46C9.37 4.34 10.65 4 12 4zM3.27 2.5L2 3.77l2.1 2.1C2.79 7.57 2 9.69 2 12c0 3.7 2.01 6.92 4.99 8.65l1-1.73C5.61 17.53 4 14.96 4 12c0-1.76.57-3.38 1.53-4.69l1.43 1.44C6.36 9.68 6 10.8 6 12c0 2.22 1.21 4.15 3 5.19l1-1.74c-1.19-.7-2-1.97-2-3.45 0-.65.17-1.25.44-1.79l1.58 1.58L10 12c0 1.1.9 2 2 2l.21-.02.01.01 7.51 7.51L21 20.23 4.27 3.5l-1-1z"/> </g> </Icon> ); } IconPortableWifiOff.displayName = 'IconPortableWifiOff'; IconPortableWifiOff.category = 'communication';
ChatsUP/App.js
michelmarcondes/ReactNativeStudies
import React, { Component } from 'react'; import { StyleSheet, View } from 'react-native'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import firebase from 'firebase'; //middleware da App // Permite q as funcoes asincronas funcionem no Redux // precisa do applyMiddleware do Redux import ReduxThunk from 'redux-thunk'; import Routes from './routes'; import reducers from './src/reducers/'; import { config } from './src/firebaseConfig'; export default class App extends Component { componentWillMount() { firebase.initializeApp(config); } render() { return ( <Provider store={createStore(reducers, {}, applyMiddleware(ReduxThunk))}> <View style={styles.container}> <Routes /> </View> </Provider> ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'stretch', backgroundColor: '#F5FCFF' } });
client/index.js
a-deal/dr-oogle
import React from 'react'; import ReactDOM from 'react-dom'; import { Router, Route, browserHistory, hashHistory } from 'react-router' import App from './Components/App'; import Reviews from './Components/Reviews'; import Review from './Components/Review'; import UrlInput from './Components/UrlInput'; ReactDOM.render( <Router history={hashHistory}> <Route path="/" component={App}> <Route path="/findDentist" component={UrlInput}/> <Route path="/viewDentists" component={Reviews}> <Route path="/reviews/:dentist" component={Review}/> </Route> </Route> </Router> , document.getElementById('app'));
examples/js/manipulation/export-csv-table.js
opensourcegeek/react-bootstrap-table
'use strict'; import React from 'react'; import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table'; var products = []; function addProducts(quantity) { var startId = products.length; for (var i = 0; i < quantity; i++) { var id = startId + i; products.push({ id: id, name: "Item name " + id, price: 2100 + i }); } } addProducts(5); export default class ExportCSVTable extends React.Component{ render(){ return ( <BootstrapTable data={products} exportCSV={true}> <TableHeaderColumn dataField="id" isKey={true}>Product ID</TableHeaderColumn> <TableHeaderColumn dataField="name">Product Name</TableHeaderColumn> <TableHeaderColumn dataField="price">Product Price</TableHeaderColumn> </BootstrapTable> ); } };
src/svg-icons/image/camera-front.js
hai-cea/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageCameraFront = (props) => ( <SvgIcon {...props}> <path d="M10 20H5v2h5v2l3-3-3-3v2zm4 0v2h5v-2h-5zM12 8c1.1 0 2-.9 2-2s-.9-2-2-2-1.99.9-1.99 2S10.9 8 12 8zm5-8H7C5.9 0 5 .9 5 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zM7 2h10v10.5c0-1.67-3.33-2.5-5-2.5s-5 .83-5 2.5V2z"/> </SvgIcon> ); ImageCameraFront = pure(ImageCameraFront); ImageCameraFront.displayName = 'ImageCameraFront'; ImageCameraFront.muiName = 'SvgIcon'; export default ImageCameraFront;
docs/src/app/components/pages/components/SelectField/ExampleCustomLabel.js
xmityaz/material-ui
import React from 'react'; import SelectField from 'material-ui/SelectField'; import MenuItem from 'material-ui/MenuItem'; export default class SelectFieldExampleCustomLabel extends React.Component { constructor(props) { super(props); this.state = {value: 1}; } handleChange = (event, index, value) => this.setState({value}); render() { return ( <SelectField value={this.state.value} onChange={this.handleChange}> <MenuItem value={1} label="5 am - 12 pm" primaryText="Morning" /> <MenuItem value={2} label="12 pm - 5 pm" primaryText="Afternoon" /> <MenuItem value={3} label="5 pm - 9 pm" primaryText="Evening" /> <MenuItem value={4} label="9 pm - 5 am" primaryText="Night" /> </SelectField> ); } }
client/src/components/HamburgerIcon/index.js
steThera/react-mobx-koa
import React from 'react'; import classNames from 'classnames'; import './styles.less'; const HamburgerIcon = (props) => ( <div id={props.id} onClick={props.onClick} className={classNames( 'nav-icon', { open: props.open, back: props.back, } )} > <div className="nav-icon-bars"> <span></span> <span></span> <span></span> </div> </div> ); export default HamburgerIcon;
src/SearchList.js
jenstitterness/pix
import https from 'https'; import React from 'react'; import ReactDOM from 'react-dom'; import List from 'material-ui/lib/lists/list'; import ListDivider from 'material-ui/lib/lists/list-divider'; import ListItem from 'material-ui/lib/lists/list-item'; import ThemeManager from 'material-ui/lib/styles/theme-manager'; import LightRawTheme from 'material-ui/lib/styles/raw-themes/light-raw-theme'; import Colors from 'material-ui/lib/styles/colors'; import CircularProgress from 'material-ui/lib/circular-progress'; const SearchList = React.createClass({ childContextTypes: { muiTheme: React.PropTypes.object, }, getInitialState () { return { res: {}, muiTheme: ThemeManager.getMuiTheme(LightRawTheme), }; }, getChildContext() { return { muiTheme: this.state.muiTheme, }; }, componentDidMount() { var self = this; var req = https.get(this.props.src + this.props.accessToken, function(res) { res.setEncoding('utf8'); var popularJsonRes = ''; res.on('data', function(d) { popularJsonRes += d; }).on('end', function() { if (self.isMounted()) { self.setState({ res: JSON.parse(popularJsonRes) }); } }.bind(this)); }); req.end(); }, componentWillMount() { let newMuiTheme = ThemeManager.modifyRawThemePalette(this.state.muiTheme, { accent1Color: Colors.deepOrange500, }); this.setState({muiTheme: newMuiTheme}); }, searchThis: function(item) { console.log("search this", item.currentTarget.firstChild.lastChild.firstChild.outerText); const tag = item.currentTarget.firstChild.lastChild.firstChild.outerText; app.loadTagFeed(tag); }, render() { console.log('feed state:', this.state); let containerStyle = { textAlign: 'center', paddingTop: '50px', background: '#ddd', height: '100%' }; let standardActions = [ { text: 'Okay' }, ]; let displayList = { display: this.state.res.data ? '' : 'none' } let loading; if (!this.state.res.data) { loading = <CircularProgress id="circularProgress" mode="indeterminate" />; } let self = this; return ( <div style={containerStyle}> {loading} <div style={displayList}> <List subheader="tags:"> { this.state.res.data && this.state.res.data.map(function(item, i) { return ( <div key={i}> <ListItem primaryText={item.name} secondaryText={item.media_count} onClick={self.searchThis}/> </div> ) }) } </List> </div> </div>); }, _handleTouchTap() { this.refs.superSecretPasswordDialog.show(); }, }); module.exports = SearchList;
src/components/Timeline.js
neontribe/spool
import React, { Component } from 'react'; import Relay from 'react-relay'; import moment from 'moment'; import _ from 'lodash'; import { EntryContainer, Entry } from './Entry'; import Layout from './Layout'; import ButtonLink from './ButtonLink'; import { withRoles } from './wrappers.js'; import IconFilter from './IconFilter.js'; import TouchIcon from './TouchIcon.js'; import styles from './css/Timeline.module.css'; const { Content, Header } = Layout; export class Timeline extends Component { constructor (props) { super(props); this.state = { showScrollMore: false, filters: {}, panel: [] }; this.handleFilterChange = this.handleFilterChange.bind(this); this.onScroll = _.debounce(this.onScroll.bind(this), 100, { leading: false, trailing: true }); this.togglePanel = this.togglePanel.bind(this); window.addEventListener('scroll', this.onScroll, true); } componentDidMount () { this.onScroll(); } componentWillUnmount () { window.removeEventListener('scroll', this.onScroll, true); } onScroll () { var showScrollMore = false; var scrollTop = Math.abs(Math.ceil(this.refs.wrapper.getBoundingClientRect().top) - this.refs.wrapper.offsetTop); var entries = this.props.creator.entries.edges.slice(); if (scrollTop < 25 && Object.keys(entries).length > 3) { showScrollMore = true; } this.setState({ showScrollMore }); } togglePanel (index) { var state = Object.assign({}, this.state); if (!state.panel[index]) { state.panel[index] = { expanded: true }; } else { state.panel[index].expanded = !state.panel[index].expanded; } this.setState(state); } handleFilterChange (filters) { var active = _.reduce(filters, (reduction, value, key) => { if (value) { reduction.push(key); } return reduction; }, []); var mediaArguments; const { text, video, image } = filters; if (text || video || image) { mediaArguments = { text, video, image }; } const filterArguments = { topics: _.intersection(active, ['work', 'learning', 'home', 'food', 'relationships', 'activities', 'travel', 'health']), sentiment: _.intersection(active, ['happy', 'sad']), media: mediaArguments }; this.setState({ filters }); this.props.relay.setVariables({ filter: filterArguments }); } renderMenuContent () { return ( <IconFilter onChange={this.handleFilterChange} filters={this.state.filters} /> ); } render () { var EntryComponent = (this.props.relay) ? EntryContainer : Entry; var entries = this.props.creator.entries.edges.slice(); // Chronologically sort entries entries = entries.sort((a, b) => { return moment(b.node.created) - moment(a.node.created); }); // Group by month entries = _.groupBy(entries, (entry) => { return moment(entry.node.created).startOf('week').format('YYYY-MM-DD'); }); return ( <Layout> <Header auth={this.props.auth} menuContent={this.renderMenuContent()} user={this.props.user} /> <Content> {!Object.keys(entries).length && ( <div className={styles.noResults}> <ButtonLink to='/app/add'><TouchIcon />Add New Entry</ButtonLink> </div> )} <div ref='wrapper'> {Object.keys(entries).map((date, i) => { var _entries = entries[date]; var dateRange = `${moment(date).startOf('week').format('YYYY, MMMM Do')} — ${moment(date).endOf('week').format('MMMM Do')}`; var showEntries = this.state.panel[i] && this.state.panel[i].expanded; return ( <div key={i} className={styles.section}> <h2> <button className={styles.header} onClick={_.partial(this.togglePanel, i)} >{dateRange} <span className={styles.toggle}>{(showEntries) ? '▼' : '▲'}</span></button> </h2> <div style={{ display: (showEntries) ? 'none' : 'block' }}> {_entries.map((entry, j) => ( <div key={j} className={((j + 1) % 3 === 0) ? styles.entryLastRowItem : styles.entry}> <EntryComponent entry={entry.node} thumbnailMode={true} /> </div> ))} </div> {this.state.showScrollMore && ( <div className={styles.moreWrapper}> <div className={styles.more}> Scroll for more&hellip; </div> </div> )} </div> ); })} </div> </Content> </Layout> ); } } export const TimelineContainer = Relay.createContainer(withRoles(Timeline, ['creator']), { initialVariables: { first: 100, filter: { sentiment: ['happy', 'sad'], topics: ['work', 'learning', 'home', 'food', 'relationships', 'activities', 'travel', 'health'], media: { text: true, video: true, image: true } } }, fragments: { user: () => Relay.QL` fragment on User { role ${Header.getFragment('user')} } `, creator: () => Relay.QL` fragment on Creator { happyCount sadCount entries(first: $first, filter: $filter) { edges { node { id, created, ${EntryContainer.getFragment('entry')} } } } } ` } });
src/components/AddTask.js
saitodisse/task-cerebral
import React from 'react'; import {Decorator as Cerebral} from 'cerebral-react'; @Cerebral({ isSaving: ['isSaving'], newTaskTitle: ['newTaskTitle'] }) class AddTask extends React.Component { addTask(event) { event.preventDefault(); if(this.props.newTaskTitle.length === 0) { return; } this.props.signals.newTaskSubmitted(); } setNewTaskTitle(event) { this.props.signals.newTaskTitleChanged({ title: event.target.value }); } render() { return ( <form className="form-horizontal" id="task-form" onSubmit={this.addTask.bind(this)}> <div className="form-group"> <div className="col-sm-10"> <input className="form-control" id="new-task" autoComplete="off" placeholder="new task" disabled={this.props.isSaving} value={this.props.newTaskTitle} onChange={this.setNewTaskTitle.bind(this)} /> </div> </div> </form> ); } } export default AddTask;
src/svg-icons/places/ac-unit.js
mit-cml/iot-website-source
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let PlacesAcUnit = (props) => ( <SvgIcon {...props}> <path d="M22 11h-4.17l3.24-3.24-1.41-1.42L15 11h-2V9l4.66-4.66-1.42-1.41L13 6.17V2h-2v4.17L7.76 2.93 6.34 4.34 11 9v2H9L4.34 6.34 2.93 7.76 6.17 11H2v2h4.17l-3.24 3.24 1.41 1.42L9 13h2v2l-4.66 4.66 1.42 1.41L11 17.83V22h2v-4.17l3.24 3.24 1.42-1.41L13 15v-2h2l4.66 4.66 1.41-1.42L17.83 13H22z"/> </SvgIcon> ); PlacesAcUnit = pure(PlacesAcUnit); PlacesAcUnit.displayName = 'PlacesAcUnit'; PlacesAcUnit.muiName = 'SvgIcon'; export default PlacesAcUnit;
pootle/static/js/admin/general/staticpages.js
Yelp/pootle
/* * Copyright (C) Pootle contributors. * * This file is a part of the Pootle project. It is distributed under the GPL3 * or later license. See the LICENSE file for a copy of the license and the * AUTHORS file for copyright and authorship information. */ import React from 'react'; import LiveEditor from './components/LiveEditor'; const staticpages = { init(opts) { React.render( <LiveEditor initialValue={opts.initialValue} markup={opts.markup} name={opts.htmlName} />, document.querySelector('.js-staticpage-editor') ); }, } export default staticpages;