path
stringlengths 5
195
| repo_name
stringlengths 5
79
| content
stringlengths 25
1.01M
|
---|---|---|
src/svg-icons/notification/airline-seat-legroom-normal.js | xmityaz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NotificationAirlineSeatLegroomNormal = (props) => (
<SvgIcon {...props}>
<path d="M5 12V3H3v9c0 2.76 2.24 5 5 5h6v-2H8c-1.66 0-3-1.34-3-3zm15.5 6H19v-7c0-1.1-.9-2-2-2h-5V3H6v8c0 1.65 1.35 3 3 3h7v7h4.5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5z"/>
</SvgIcon>
);
NotificationAirlineSeatLegroomNormal = pure(NotificationAirlineSeatLegroomNormal);
NotificationAirlineSeatLegroomNormal.displayName = 'NotificationAirlineSeatLegroomNormal';
NotificationAirlineSeatLegroomNormal.muiName = 'SvgIcon';
export default NotificationAirlineSeatLegroomNormal;
|
src/components/SubCheck.js | benuchadnezzar/subway-checker | // We're controlling all of our state here and using children
// components only to return lists and handle AJAX calls.
import React, { Component } from 'react';
import SubList from './SubList';
import StopList from './StopList';
import { DelayN, DelayS } from './IsDelay';
class SubCheck extends Component {
constructor (props) {
super(props);
this.state = {
selectedSub: null,
selectedStop: null,
stops: [],
};
this.handleSubSelect = this.handleSubSelect.bind(this);
this.handleStopSelect = this.handleStopSelect.bind(this);
}
// We want the user to be able to select their specific subway
// stop, so obviously a different array of stops needs to be
// loaded for each subway. We're getting those from utils/stops.json.
handleSubSelect(event) {
var stopData = require('../utils/stops');
var stopsArray = [];
var sub = event.target.value
for (var i = 0; i < stopData.length; i++) {
var stop = stopData[i];
if (String(stop.stop_id).charAt(0) === sub) {
stopsArray.push(stop.stop_name);
}
}
this.setState(() => {
return {
selectedSub: sub,
stops: stopsArray
}
});
}
handleStopSelect(event) {
this.setState({selectedStop: event.target.value});
}
render() {
return (
<div>
<SubList onSubSelect={this.handleSubSelect}/>
<StopList stops={this.state.stops} onStopSelect={this.handleStopSelect}/>
<DelayN sub={this.state.selectedSub} stop={this.state.selectedStop}/>
<DelayS sub={this.state.selectedSub} stop={this.state.selectedStop}/>
</div>
);
}
}
export default SubCheck; |
src/pure-component.js | Monar/react-immutable-pure-component | import React from 'react';
import { check } from './check';
export class ImmutablePureComponent extends React.Component {
shouldComponentUpdate(nextProps, nextState = {}) {
return (
!check(this.updateOnProps, this.props, nextProps, 'updateOnProps') ||
!check(this.updateOnStates, this.state, nextState, 'updateOnStates')
);
}
}
|
app/components/Home.js | zanjs/newedenfaces-react | import React from 'react';
import {Link} from 'react-router';
import HomeStore from '../stores/HomeStore'
import HomeActions from '../actions/HomeActions';
import {first, without, findWhere} from 'underscore';
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.getTwoCharacters();
}
componentWillUnmount() {
HomeStore.unlisten(this.onChange);
}
onChange(state) {
this.setState(state);
}
handleClick(character) {
var winner = character.characterId;
var loser = first(without(this.state.characters, findWhere(this.state.characters, { characterId: winner }))).characterId;
HomeActions.vote(winner, loser);
}
render() {
var characterNodes = this.state.characters.map((character, index) => {
return (
<div key={character.characterId} className={index === 0 ? 'col-xs-6 col-sm-6 col-md-5 col-md-offset-1' : 'col-xs-6 col-sm-6 col-md-5'}>
<div className='thumbnail fadeInUp animated'>
<img onClick={this.handleClick.bind(this, character)} src={'http://image.eveonline.com/Character/' + character.characterId + '_512.jpg'}/>
<div className='caption text-center'>
<ul className='list-inline'>
<li><strong>Race:</strong> {character.race}</li>
<li><strong>Bloodline:</strong> {character.bloodline}</li>
</ul>
<h4>
<Link to={'/characters/' + character.characterId}><strong>{character.name}</strong></Link>
</h4>
</div>
</div>
</div>
);
});
return (
<div className='container'>
<h3 className='text-center'>Click on the portrait. Select your favorite.</h3>
<div className='row'>
{characterNodes}
</div>
</div>
);
}
}
export default Home; |
sms_sponsorship/webapp/src/components/CenteredLoading.js | CompassionCH/compassion-modules | import React from 'react';
import Typography from '@material-ui/core/Typography';
import CircularProgress from '@material-ui/core/CircularProgress';
export default class extends React.Component {
render() {
let styles = {
loadingContainer: {
marginTop: '120px',
},
loadingTextContainer: {
width: '80%',
margin: 'auto',
textAlign: 'center',
paddingTop: 10,
},
circularProgressContainer: {
marginLeft: '50%',
position: 'relative',
right: 15
}
};
return (
<div>
<div style={styles.loadingContainer}>
<div style={styles.circularProgressContainer}>
<CircularProgress/>
</div>
<Typography component="p" style={styles.loadingTextContainer}>
{this.props.text}
</Typography>
</div>
</div>
);
}
} |
src/server.js | fkenk/Majsternia | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import path from 'path';
import Promise from 'bluebird';
import express from 'express';
import cookieParser from 'cookie-parser';
import requestLanguage from 'express-request-language';
import bodyParser from 'body-parser';
import expressJwt, { UnauthorizedError as Jwt401Error } from 'express-jwt';
import expressGraphQL from 'express-graphql';
import jwt from 'jsonwebtoken';
import React from 'react';
import ReactDOM from 'react-dom/server';
import { getDataFromTree } from 'react-apollo';
import PrettyError from 'pretty-error';
import { IntlProvider } from 'react-intl';
import './serverIntlPolyfill';
import createApolloClient from './core/createApolloClient';
import App from './components/App';
import Html from './components/Html';
import { ErrorPageWithoutStyle } from './routes/error/ErrorPage';
import errorPageStyle from './routes/error/ErrorPage.css';
import createFetch from './createFetch';
import passport from './passport';
import router from './router';
import models from './data/models';
import schema from './data/schema';
import assets from './assets.json'; // eslint-disable-line import/no-unresolved
import configureStore from './store/configureStore';
import { setRuntimeVariable } from './actions/runtime';
import { setLocale } from './actions/intl';
import config from './config';
const app = express();
//
// Tell any CSS tooling (such as Material UI) to use all vendor prefixes if the
// user agent is not known.
// -----------------------------------------------------------------------------
global.navigator = global.navigator || {};
global.navigator.userAgent = global.navigator.userAgent || 'all';
//test1
//
// Register Node.js middleware
// -----------------------------------------------------------------------------
app.use(express.static(path.join(__dirname, 'public')));
app.use(cookieParser());
app.use(requestLanguage({
languages: config.locales,
queryName: 'lang',
cookie: {
name: 'lang',
options: {
path: '/',
maxAge: 3650 * 24 * 3600 * 1000, // 10 years in miliseconds
},
url: '/lang/{language}',
},
}));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
//
// Authentication
// -----------------------------------------------------------------------------
app.use(expressJwt({
secret: config.auth.jwt.secret,
credentialsRequired: false,
getToken: req => req.cookies.id_token,
}));
// Error handler for express-jwt
app.use((err, req, res, next) => { // eslint-disable-line no-unused-vars
if (err instanceof Jwt401Error) {
console.error('[express-jwt-error]', req.cookies.id_token);
// `clearCookie`, otherwise user can't use web-app until cookie expires
res.clearCookie('id_token');
}
next(err);
});
app.use(passport.initialize());
if (__DEV__) {
app.enable('trust proxy');
}
app.get('/login/facebook',
passport.authenticate('facebook', { scope: ['email', 'user_location'], session: false }),
);
app.get('/login/facebook/return',
passport.authenticate('facebook', { failureRedirect: '/login', session: false }),
(req, res) => {
const expiresIn = 60 * 60 * 24 * 180; // 180 days
const token = jwt.sign(req.user, config.auth.jwt.secret, { expiresIn });
res.cookie('id_token', token, { maxAge: 1000 * expiresIn, httpOnly: true });
res.redirect('/');
},
);
//
// Register API middleware
// -----------------------------------------------------------------------------
const graphqlMiddleware = expressGraphQL(req => ({
schema,
graphiql: __DEV__,
rootValue: { request: req },
pretty: __DEV__,
}));
app.use('/graphql', graphqlMiddleware);
//
// Register server-side rendering middleware
// -----------------------------------------------------------------------------
app.get('*', async (req, res, next) => {
try {
const apolloClient = createApolloClient({
schema,
rootValue: { request: req },
});
const fetch = createFetch({
baseUrl: config.api.serverUrl,
cookie: req.headers.cookie,
apolloClient,
});
const initialState = {
user: req.user || null,
};
const store = configureStore(initialState, {
cookie: req.headers.cookie,
apolloClient,
fetch,
// I should not use `history` on server.. but how I do redirection? follow universal-router
history: null,
});
store.dispatch(setRuntimeVariable({
name: 'initialNow',
value: Date.now(),
}));
store.dispatch(setRuntimeVariable({
name: 'availableLocales',
value: config.locales,
}));
const locale = req.language;
await store.dispatch(setLocale({
locale,
}));
const css = new Set();
// Global (context) variables that can be easily accessed from any React component
// https://facebook.github.io/react/docs/context.html
const context = {
// Enables critical path CSS rendering
// https://github.com/kriasoft/isomorphic-style-loader
insertCss: (...styles) => {
// eslint-disable-next-line no-underscore-dangle
styles.forEach(style => css.add(style._getCss()));
},
fetch,
// You can access redux through react-redux connect
store,
storeSubscription: null,
// Apollo Client for use with react-apollo
client: apolloClient,
};
const route = await router.resolve({
path: req.path,
query: req.query,
locale,
fetch,
store,
});
if (route.redirect) {
res.redirect(route.status || 302, route.redirect);
return;
}
const data = { ...route };
const rootComponent = (
<App context={context} store={store}>
{route.component}
</App>
);
await getDataFromTree(rootComponent);
// this is here because of Apollo redux APOLLO_QUERY_STOP action
await Promise.delay(0);
data.children = await ReactDOM.renderToString(rootComponent);
data.styles = [
{ id: 'css', cssText: [...css].join('') },
];
data.scripts = [
assets.vendor.js,
assets.client.js,
];
if (assets[route.chunk]) {
data.scripts.push(assets[route.chunk].js);
}
// Furthermore invoked actions will be ignored, client will not receive them!
if (__DEV__) {
// eslint-disable-next-line no-console
console.log('Serializing store...');
}
data.app = {
apiUrl: config.api.clientUrl,
state: context.store.getState(),
lang: locale,
};
const html = ReactDOM.renderToStaticMarkup(<Html {...data} />);
res.status(route.status || 200);
res.send(`<!doctype html>${html}`);
} catch (err) {
next(err);
}
});
//
// Error handling
// -----------------------------------------------------------------------------
const pe = new PrettyError();
pe.skipNodeFiles();
pe.skipPackage('express');
app.use((err, req, res, next) => { // eslint-disable-line no-unused-vars
const locale = req.language;
console.error(pe.render(err));
const html = ReactDOM.renderToStaticMarkup(
<Html
title="Internal Server Error"
description={err.message}
styles={[{ id: 'css', cssText: errorPageStyle._getCss() }]} // eslint-disable-line no-underscore-dangle
app={{ lang: locale }}
>
{ReactDOM.renderToString(
<IntlProvider locale={locale}>
<ErrorPageWithoutStyle error={err} />
</IntlProvider>,
)}
</Html>,
);
res.status(err.status || 500);
res.send(`<!doctype html>${html}`);
});
//
// Launch the server
// -----------------------------------------------------------------------------
models.sync().catch(err => console.error(err.stack)).then(() => {
app.listen(config.port, () => {
console.info(`The server is running at http://localhost:${config.port}/`);
});
});
|
src/components/StoneQuest/July2012.js | mattschwartz/mattschwartz | import React from 'react'
import stonequest1 from '../../res/worldsbetween/stonequest_july_2012.png'
import ImagePreview from './ImagePreview';
import EntryHeading from './EntryHeading';
export default () => (
<>
<EntryHeading>July 2012</EntryHeading>
<p>
With my first semester at UT behind me, I went back to my family for summer vacation and picked up the game again. I threw away the first iteration and after about 100 hours, I had a fully functional game engine upon which I could write the rest of the game. The beauty of roguelikes is that they can be as simple or complex as you want. They're games that you can grow with as a developer.
</p>
<ImagePreview image={stonequest1} description="Roguelike2 progress, July 2012" />
</>
)
|
App.js | caesai/sushka-chat | import React from 'react';
import MainBox from './components/MainBox';
import UsersList from './components/UsersList';
import UserProfile from './components/UserProfile';
import * as actions from './actions/actions';
import { connect } from 'react-redux';
import store from './store/store';
import * as styles from './scss/main.scss';
// VK.Widgets.Auth("vk_auth", {
// width: "200px",
// onAuth: function(smth) {
// console.log(smth);
let userInfo = {
id: 1,
name: "Cas",
avatar: 'img/images.png',
status: 'offline',
account: [
{
id: 12423523,
sum: 12000
}
],
deposit: [
{
id: 12676675,
sum: 34235235
}
]
};
store.dispatch(actions.userJoin());
export default class Chat extends React.Component {
constructor(props){
super(props);
this.state = {}
}
render(){
let users = [];
return (
<div className={styles.chatPage}>
<UsersList users={users} />
<MainBox />
</div>
);
}
}
|
app/javascript/pawoo/components/suggested_accounts_page.js | pixiv/mastodon | import PropTypes from 'prop-types';
import React from 'react';
import { defineMessages, injectIntl } from 'react-intl';
import Column from '../../mastodon/features/ui/components/column';
import SuggestedAccountsContainer from '../containers/suggested_accounts_container';
const messages = defineMessages({
title: { id: 'column.suggested_accounts', defaultMessage: 'Active Users' },
});
function SuggestedAccountsPage({ intl }) {
return (
<Column
icon='user'
active={false}
heading={intl.formatMessage(messages.title)}
pawooClassName='pawoo-suggested-accounts-page'
>
<div className='pawoo-suggested-accounts-page__suggested-accounts'>
<SuggestedAccountsContainer scrollKey='suggested_accounts_page' trackScroll={false} />
</div>
</Column>
);
}
SuggestedAccountsPage.propTypes = {
intl: PropTypes.object.isRequired,
};
export default injectIntl(SuggestedAccountsPage);
|
src/components/Header/Header.js | stinkyfingers/IsoTest | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Header.scss';
import Link from '../Link';
import Navigation from '../Navigation';
class Header extends Component {
render() {
return (
<div className={s.root}>
<div className={s.container}>
<Navigation className={s.nav} />
<Link className={s.brand} to="/">
<img src={require('./logo-small.png')} width="38" height="38" alt="React" />
<span className={s.brandTxt}>Your Company</span>
</Link>
<div className={s.banner}>
<h1 className={s.bannerTitle}>React</h1>
<p className={s.bannerDesc}>Complex web apps made easy</p>
</div>
</div>
</div>
);
}
}
export default withStyles(Header, s);
|
08-create-a-sidebar/components/App/index.js | nodeyu/jason-react-router-demos-v4 | import React from 'react';
import { BrowserRouter, Link, Route } from 'react-router-dom';
import style from './style.css'
import routes from '../../routes/routes';
class App extends React.Component {
render() {
return(
<BrowserRouter>
<div className={style.main_wrapper}>
<div className={style.side_bar}>
<ul>
{
routes.map((route, index) => (
<li key={`l${index}`}>
<Link to={route.path}>{route.sidebar}</Link>
</li>
))
}
</ul>
</div>
<div className={style.content}>
{
routes.map((route, index) => (
<Route
key={`r${index}`}
exact={route.exact}
path={route.path}
component={route.content}
/>
))
}
</div>
</div>
</BrowserRouter>
);
}
}
export default App;
|
examples/CustomPicker/index.ios.js | thegamenicorus/react-native-phone-input | /**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
} from 'react-native';
import App from './app'
AppRegistry.registerComponent('CustomPicker', () => App); |
src/routes/Auth/containers/ChangePassEditorContainer.js | wkozyra95/react-boilerplate | /* @flow */
import React from 'react';
import { connect } from 'react-redux';
import { FormInput } from 'components/Form';
import RaisedButton from 'material-ui/RaisedButton';
import { t } from 'i18n';
import Style from 'styles';
import selector from '../selector';
import { actionCreator } from '../reducer';
type Props = {
changePassword: (newPassword: string, oldPassword: string) => void,
clearFormError: (field: string) => void,
formError: { password?: string, oldPassword?: string },
}
class ChangePassEditorContainer extends React.Component {
props: Props
state: {
oldPassword: string,
password: string,
repeatPassword: string,
} = {
oldPassword: '',
password: '',
repeatPassword: '',
}
onFieldUpdate = (value: string, type: string) => {
this.props.clearFormError(type);
this.setState({ [type]: value });
}
saveForm = () => {
this.props.changePassword(this.state.password, this.state.oldPassword);
this.setState({
oldPassword: '',
password: '',
repeatPassword: '',
});
}
render() {
return (
<div>
<p style={styles.title}>{t('auth.title.resetPass')}</p>
<FormInput
floatingLabelText={t('auth.form.oldPasswordLabel')}
type="oldPassword"
onChange={this.onFieldUpdate}
value={this.state.oldPassword}
fullWidth
secureTextEntry
errorText={this.props.formError.oldPassword}
/>
<FormInput
floatingLabelText={t('auth.form.newPasswordLabel')}
type="password"
onChange={this.onFieldUpdate}
value={this.state.password}
fullWidth
secureTextEntry
errorText={this.props.formError.password}
/>
<FormInput
floatingLabelText={t('auth.form.repeatNewPasswordLabel')}
type="repeatPassword"
onChange={this.onFieldUpdate}
value={this.state.repeatPassword}
fullWidth
secureTextEntry
/>
<div style={styles.btnRow}>
<RaisedButton
label={t('auth.form.saveBtn')}
onTouchTap={this.saveForm}
primary
/>
</div>
</div>
);
}
}
const styles = {
title: {
fontSize: Style.Dimens.font.large,
},
btnRow: {
...Style.Flex.rootRow,
justifyContent: 'flex-end',
},
};
const mapStateToProps = (state) => {
return {
...selector.changePasswordSelector(state),
};
};
const mapDispatchToProps = (dispatch) => {
return {
changePassword: (newPassword, oldPassword) => (
dispatch(actionCreator.changePassword(newPassword, oldPassword))
),
clearFormError: (field: string) => dispatch(actionCreator.clearChangePasswordError(field)),
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(ChangePassEditorContainer);
|
pootle/static/js/auth/components/EmailConfirmation.js | claudep/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 { PureRenderMixin } from 'react-addons-pure-render-mixin';
import AuthContent from './AuthContent';
const EmailConfirmation = React.createClass({
propTypes: {
onClose: React.PropTypes.func.isRequired,
},
mixins: [PureRenderMixin],
/* 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;
|
examples/todomvc/index.js | BayanGroup/redux | import 'babel/polyfill';
import React from 'react';
import Root from './containers/Root';
import 'todomvc-app-css/index.css';
React.render(
<Root />,
document.getElementById('root')
);
|
docs/src/app/components/pages/components/Stepper/VerticalNonLinearStepper.js | manchesergit/material-ui | import React from 'react';
import {
Step,
Stepper,
StepButton,
StepContent,
} from 'material-ui/Stepper';
import RaisedButton from 'material-ui/RaisedButton';
import FlatButton from 'material-ui/FlatButton';
/**
* A basic vertical non-linear implementation
*/
class VerticalNonLinear extends React.Component {
state = {
stepIndex: 0,
};
handleNext = () => {
const {stepIndex} = this.state;
if (stepIndex < 2) {
this.setState({stepIndex: stepIndex + 1});
}
};
handlePrev = () => {
const {stepIndex} = this.state;
if (stepIndex > 0) {
this.setState({stepIndex: stepIndex - 1});
}
};
renderStepActions(step) {
return (
<div style={{margin: '12px 0'}}>
<RaisedButton
label="Next"
disableTouchRipple={true}
disableFocusRipple={true}
primary={true}
onClick={this.handleNext}
style={{marginRight: 12}}
/>
{step > 0 && (
<FlatButton
label="Back"
disableTouchRipple={true}
disableFocusRipple={true}
onClick={this.handlePrev}
/>
)}
</div>
);
}
render() {
const {stepIndex} = this.state;
return (
<div style={{maxWidth: 380, maxHeight: 400, margin: 'auto'}}>
<Stepper
activeStep={stepIndex}
linear={false}
orientation="vertical"
>
<Step>
<StepButton onClick={() => this.setState({stepIndex: 0})}>
Select campaign settings
</StepButton>
<StepContent>
<p>
For each ad campaign that you create, you can control how much
you're willing to spend on clicks and conversions, which networks
and geographical locations you want your ads to show on, and more.
</p>
{this.renderStepActions(0)}
</StepContent>
</Step>
<Step>
<StepButton onClick={() => this.setState({stepIndex: 1})}>
Create an ad group
</StepButton>
<StepContent>
<p>An ad group contains one or more ads which target a shared set of keywords.</p>
{this.renderStepActions(1)}
</StepContent>
</Step>
<Step>
<StepButton onClick={() => this.setState({stepIndex: 2})}>
Create an ad
</StepButton>
<StepContent>
<p>
Try out different ad text to see what brings in the most customers,
and learn how to enhance your ads using features like ad extensions.
If you run into any problems with your ads, find out how to tell if
they're running and how to resolve approval issues.
</p>
{this.renderStepActions(2)}
</StepContent>
</Step>
</Stepper>
</div>
);
}
}
export default VerticalNonLinear;
|
src/interface/others/ReportSelecter.js | FaideWW/WoWAnalyzer | import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import { Trans } from '@lingui/macro';
import ReactTooltip from 'react-tooltip';
import { t } from '@lingui/macro';
import REGION_CODES from 'common/REGION_CODES';
import { i18n } from 'interface/RootLocalizationProvider';
import './ReportSelecter.css';
export function getReportCode(input) {
const match = input.trim().match(/^(.*reports\/)?([a-zA-Z0-9]{16})\/?(#.*)?$/);
return match && match[2];
}
class ReportSelecter extends React.PureComponent {
static propTypes = {
push: PropTypes.func.isRequired,
};
static getFight(input) {
const match = input.trim().match(/fight=([^&]*)/);
return match && match[1];
}
static getPlayer(input) {
const match = input.trim().match(/source=([^&]*)/);
return match && match[1];
}
static getCharacterFromWCLUrl(input) {
const match = input.trim().match(/^(.*character\/)(\S*)\/(\S*)\/(\S*)/);
return match && {
region: match[2],
realm: match[3],
name: match[4].split('#')[0],
};
}
static getCharacterFromBattleNetUrl(input) {
const match = input.trim().match(/^(.*)\/([A-Za-z]{2}-[A-Za-z]{2})\/(character)\/(\S*)\/(\S*)/);
return match && REGION_CODES[match[2]] && {
region: REGION_CODES[match[2]],
realm: match[4],
name: match[5].split('#')[0],
};
}
codeInput = null;
constructor() {
super();
this.handleSubmit = this.handleSubmit.bind(this);
this.handleChange = this.handleChange.bind(this);
}
componentDidMount() {
if (this.codeInput) {
this.codeInput.focus();
}
}
componentDidUpdate() {
ReactTooltip.rebuild();
}
componentWillUnmount() {
ReactTooltip.hide();
}
handleSubmit(e) {
e.preventDefault();
const code = this.codeInput.value;
if (!code) {
// eslint-disable-next-line no-alert
alert('Enter a report first.');
return;
}
this.handleCodeInputChange(code);
}
handleChange(e) {
this.handleCodeInputChange(this.codeInput.value);
}
handleCodeInputChange(value) {
const code = getReportCode(value);
const fight = this.constructor.getFight(value);
const player = this.constructor.getPlayer(value);
const character = this.constructor.getCharacterFromWCLUrl(value) || this.constructor.getCharacterFromBattleNetUrl(value);
if (character) {
const constructedUrl = `character/${character.region}/${character.realm}/${character.name}`;
this.props.push(constructedUrl);
}
if (code) {
let constructedUrl = `report/${code}`;
if (fight) {
constructedUrl += `/${fight}`;
if (player) {
constructedUrl += `/${player}`;
}
}
this.props.push(constructedUrl);
}
}
render() {
return (
<form onSubmit={this.handleSubmit} className="form-inline">
<div className="report-selector">
<input
data-tip={i18n._(t`
Parsable links:<br/>
<ul>
<li>https://www.warcraftlogs.com/reports/<report code></li>
<li>https://www.warcraftlogs.com/character/<region>/<realm>/<name></li>
<li>https://worldofwarcraft.com/<language-code>/character/<realm>/<name></li>
<li>https://www.wowchina.com/<language-code>/character/<realm>/<name></li>
</ul>
`)}
data-delay-show="200"
type="text"
name="code"
className="form-control"
ref={elem => {
this.codeInput = elem;
}}
onChange={this.handleChange}
style={{ width: 360, cursor: 'help' }}
placeholder={i18n._(t`https://www.warcraftlogs.com/reports/<report code>`)}
autoCorrect="off"
autoCapitalize="off"
spellCheck="false"
/>
<button type="submit" className="btn btn-primary analyze">
<Trans>Analyze</Trans> <span className="glyphicon glyphicon-chevron-right" aria-hidden />
</button>
</div>
</form>
);
}
}
export default connect(null, {
push,
})(ReportSelecter);
|
src/svg-icons/action/find-in-page.js | rhaedes/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionFindInPage = (props) => (
<SvgIcon {...props}>
<path d="M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75L20 19.59zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z"/>
</SvgIcon>
);
ActionFindInPage = pure(ActionFindInPage);
ActionFindInPage.displayName = 'ActionFindInPage';
export default ActionFindInPage;
|
app/components/ImageSlider.js | Byte-Code/lm-digital-store-private-test | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Slider from 'react-slick';
import Image from './Image';
const settings = {
infinite: false,
slidesToShow: 1,
slidesToScroll: 1,
speed: 100,
arrows: false,
dots: true,
dotsClass: 'slickDots'
};
export default class ImageSlider extends Component {
static propTypes = {
imageIDList: ImmutablePropTypes.list.isRequired,
imageOptions: PropTypes.shape({
height: PropTypes.number,
width: PropTypes.number
}).isRequired,
alt: PropTypes.string.isRequired
};
renderImages() {
const { imageIDList, imageOptions, alt } = this.props;
return imageIDList.map(imageID => (
<div key={imageID}>
<Image zoomable fixBrightColor imageID={imageID} imageOptions={imageOptions} alt={alt} />
</div>
));
}
render() {
const { imageIDList } = this.props;
if (imageIDList.size === 1) {
return (
<div>
{this.renderImages()}
</div>
);
}
return (
<Slider {...settings}>
{this.renderImages()}
</Slider>
);
}
}
|
App/node_modules/react-navigation/src/views/withNavigation.js | Dagers/React-Native-Differential-Updater | /* @flow */
import React from 'react';
import propTypes from 'prop-types';
import hoistStatics from 'hoist-non-react-statics';
import type { NavigationState, NavigationAction } from '../TypeDefinition';
type Context = {
navigation: InjectedProps<NavigationState, NavigationAction>,
};
type InjectedProps = {
navigation: InjectedProps<NavigationState, NavigationAction>,
};
export default function withNavigation<T: *>(
Component: ReactClass<T & InjectedProps>
) {
const componentWithNavigation = (props: T, { navigation }: Context) => (
<Component {...props} navigation={navigation} />
);
componentWithNavigation.displayName = `withNavigation(${Component.displayName || Component.name})`;
componentWithNavigation.contextTypes = {
navigation: propTypes.object.isRequired,
};
return hoistStatics(componentWithNavigation, Component);
}
|
actor-apps/app-web/src/app/components/modals/invite-user/ContactItem.react.js | sc4599/actor-platform | import React from 'react';
import ReactMixin from 'react-mixin';
import addons from 'react/addons';
import classnames from 'classnames';
import AvatarItem from 'components/common/AvatarItem.react';
const {addons: { PureRenderMixin }} = addons;
@ReactMixin.decorate(PureRenderMixin)
class ContactItem extends React.Component {
static propTypes = {
contact: React.PropTypes.object,
onSelect: React.PropTypes.func,
member: React.PropTypes.bool
};
constructor(props) {
super(props);
}
onSelect = () => {
this.props.onSelect(this.props.contact);
};
render() {
const contact = this.props.contact;
const contactClassName = classnames('contacts__list__item row', {
'contacts__list__item--member': this.props.member
});
let controls;
if (!this.props.member) {
controls = <a className="material-icons" onClick={this.onSelect}>person_add</a>;
} else {
controls = <i className="material-icons">check</i>;
}
return (
<li className={contactClassName}>
<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">
{controls}
</div>
</li>
);
}
}
export default ContactItem;
|
src/public/components/list/index.js | Harrns/segta | import React from 'react'
import TorrentList from './torrent'
import FileList from './file'
export default class List extends React.Component {
constructor (props) {
super(props)
}
render () {
return (
<div className="lists" id={this.props.id}>
<TorrentList />
<FileList />
</div>
)
}
}
|
examples/react-hello/test/lib/index.js | chrisbuttery/tdd-es6-react | import test from 'tape';
import React from 'react';
import dom from 'cheerio';
import hello from '../../source/hello';
import createActions from '../fixtures/create-actions';
const renderText = React.renderToStaticMarkup;
test('Hello component', nest => {
nest.test('...with no props', assert => {
const Hello = hello(React);
const actions = createActions();
const el = <Hello actions={ actions } />;
const $ = dom.load(renderText(el));
const output = $('.hello-world').html();
const actual = output;
const expected = 'Hello, World!';
assert.equal(actual, expected,
`should render default message`);
assert.end();
});
nest.test('...with custom word prop', assert => {
const Hello = hello(React);
const actions = createActions();
const el = <Hello actions={ actions } word="Puppy" />;
const $ = dom.load(renderText(el));
const output = $('.hello-world').html();
const actual = output;
const expected = 'Hello, Puppy!';
assert.equal(actual, expected,
`should render customized message`);
assert.end();
});
});
|
assets/javascripts/kitten/components/action/social-button-icon/index.js | KissKissBankBank/kitten | import React from 'react'
import { Button } from '../../action/button'
import { FacebookIcon } from '../../graphics/icons/facebook-icon'
import { TwitterIcon } from '../../graphics/icons/twitter-icon'
import { LinkedinIcon } from '../../graphics/icons/linkedin-icon'
import { InstagramIcon } from '../../graphics/icons/instagram-icon'
import { YoutubeIcon } from '../../graphics/icons/youtube-icon'
export const FacebookButtonIcon = props => (
<Button {...props}>
<FacebookIcon width="14" height="14" />
</Button>
)
export const TwitterButtonIcon = props => (
<Button {...props}>
<TwitterIcon width="15" height="15" />
</Button>
)
export const LinkedinButtonIcon = props => (
<Button {...props}>
<LinkedinIcon width="12" height="12" />
</Button>
)
export const InstagramButtonIcon = props => (
<Button {...props}>
<InstagramIcon width="16" height="16" />
</Button>
)
export const YoutubeButtonIcon = props => (
<Button {...props}>
<YoutubeIcon width="16" height="16" />
</Button>
)
const defaultProps = {
modifier: 'beryllium',
fit: 'icon',
}
FacebookButtonIcon.defaultProps = defaultProps
TwitterButtonIcon.defaultProps = defaultProps
LinkedinButtonIcon.defaultProps = defaultProps
InstagramButtonIcon.defaultProps = defaultProps
YoutubeButtonIcon.defaultProps = defaultProps
|
src/Parser/DeathKnight/Blood/Modules/Items/T20_2pc.js | enragednuke/WoWAnalyzer | import React from 'react';
import SPELLS from 'common/SPELLS';
import SpellLink from 'common/SpellLink';
import SpellIcon from 'common/SpellIcon';
import { formatPercentage } from 'common/format';
import Analyzer from 'Parser/Core/Analyzer';
import Combatants from 'Parser/Core/Modules/Combatants';
class T20_2pc extends Analyzer {
static dependencies = {
combatants: Combatants,
};
get uptime() {
return this.combatants.getBuffUptime(SPELLS.GRAVEWARDEN.id) / this.owner.fightDuration;
}
on_initialized() {
this.active = this.combatants.selected.hasBuff(SPELLS.BLOOD_DEATH_KNIGHT_T20_2SET_BONUS_BUFF.id);
}
item() {
return {
id: `spell-${SPELLS.BLOOD_DEATH_KNIGHT_T20_2SET_BONUS_BUFF.id}`,
icon: <SpellIcon id={SPELLS.BLOOD_DEATH_KNIGHT_T20_2SET_BONUS_BUFF.id} />,
title: <SpellLink id={SPELLS.BLOOD_DEATH_KNIGHT_T20_2SET_BONUS_BUFF.id} />,
result: <span><SpellLink id={SPELLS.BLOOD_DEATH_KNIGHT_T20_2SET_BONUS_BUFF.id}>Gravewarden</SpellLink> {formatPercentage((this.uptime) || 0)} % uptime</span>,
};
}
suggestions(when) {
when(this.uptime).isLessThan(0.90)
.addSuggestion((suggest, actual, recommended) => {
return suggest(<span><SpellLink id={SPELLS.BLOOD_DEATH_KNIGHT_T20_2SET_BONUS_BUFF.id}> Gravewarden </SpellLink> happens when you hit an enemy with <SpellLink id={SPELLS.BLOOD_BOIL.id}/>. Uptime may be lower when there are no enemies in range, like Kil'jaeden's intermissions.</span>)
.icon(SPELLS.GRAVEWARDEN.icon)
.actual(`${formatPercentage(actual)}% Gravewarden uptime`)
.recommended(`>${formatPercentage(recommended)}% is recommended`)
.regular(recommended - 0.05).major(recommended - 0.1);
});
}
}
export default T20_2pc;
|
frontend/src/Artist/Delete/DeleteArtistModalContent.js | lidarr/Lidarr | import PropTypes from 'prop-types';
import React, { Component } from 'react';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
import FormLabel from 'Components/Form/FormLabel';
import Icon from 'Components/Icon';
import Button from 'Components/Link/Button';
import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
import { icons, inputTypes, kinds } from 'Helpers/Props';
import formatBytes from 'Utilities/Number/formatBytes';
import styles from './DeleteArtistModalContent.css';
class DeleteArtistModalContent extends Component {
//
// Lifecycle
constructor(props, context) {
super(props, context);
this.state = {
deleteFiles: false,
addImportListExclusion: false
};
}
//
// Listeners
onDeleteFilesChange = ({ value }) => {
this.setState({ deleteFiles: value });
}
onAddImportListExclusionChange = ({ value }) => {
this.setState({ addImportListExclusion: value });
}
onDeleteArtistConfirmed = () => {
const deleteFiles = this.state.deleteFiles;
const addImportListExclusion = this.state.addImportListExclusion;
this.setState({ deleteFiles: false });
this.setState({ addImportListExclusion: false });
this.props.onDeletePress(deleteFiles, addImportListExclusion);
}
//
// Render
render() {
const {
artistName,
path,
statistics,
onModalClose
} = this.props;
const {
trackFileCount,
sizeOnDisk
} = statistics;
const deleteFiles = this.state.deleteFiles;
const addImportListExclusion = this.state.addImportListExclusion;
let deleteFilesLabel = `Delete ${trackFileCount} Track Files`;
let deleteFilesHelpText = 'Delete the track files and artist folder';
if (trackFileCount === 0) {
deleteFilesLabel = 'Delete Artist Folder';
deleteFilesHelpText = 'Delete the artist folder and its contents';
}
return (
<ModalContent
onModalClose={onModalClose}
>
<ModalHeader>
Delete - {artistName}
</ModalHeader>
<ModalBody>
<div className={styles.pathContainer}>
<Icon
className={styles.pathIcon}
name={icons.FOLDER}
/>
{path}
</div>
<FormGroup>
<FormLabel>{deleteFilesLabel}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="deleteFiles"
value={deleteFiles}
helpText={deleteFilesHelpText}
kind={kinds.DANGER}
onChange={this.onDeleteFilesChange}
/>
</FormGroup>
<FormGroup>
<FormLabel>Add List Exclusion</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="addImportListExclusion"
value={addImportListExclusion}
helpText="Prevent artist from being added to Lidarr by Import lists"
kind={kinds.DANGER}
onChange={this.onAddImportListExclusionChange}
/>
</FormGroup>
{
deleteFiles &&
<div className={styles.deleteFilesMessage}>
<div>The artist folder <strong>{path}</strong> and all of its content will be deleted.</div>
{
!!trackFileCount &&
<div>{trackFileCount} track files totaling {formatBytes(sizeOnDisk)}</div>
}
</div>
}
</ModalBody>
<ModalFooter>
<Button onPress={onModalClose}>
Close
</Button>
<Button
kind={kinds.DANGER}
onPress={this.onDeleteArtistConfirmed}
>
Delete
</Button>
</ModalFooter>
</ModalContent>
);
}
}
DeleteArtistModalContent.propTypes = {
artistName: PropTypes.string.isRequired,
path: PropTypes.string.isRequired,
statistics: PropTypes.object.isRequired,
onDeletePress: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired
};
DeleteArtistModalContent.defaultProps = {
statistics: {
trackFileCount: 0
}
};
export default DeleteArtistModalContent;
|
imports/ui/components/JournalFees/JournalFees.js | jamiebones/Journal_Publication | import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { Table, Alert, Button , Col , Label , Well , HelpBlock ,
Row , FormGroup , InputGroup , } from 'react-bootstrap';
import { Meteor } from 'meteor/meteor';
import { Bert } from 'meteor/themeteorchef:bert';
import Loading from '../../components/Loading/Loading';
import { Capitalize , GetNameFromUserId , GetEmailFromUserId } from '../../../modules/utilities';
import Icon from '../../components/Icon/Icon';
import Journal from '../../../api/Journal/Journal';
import { createContainer } from 'meteor/react-meteor-data';
class JournalFees extends React.Component {
constructor(props){
super(props);
this.setPublishFees = this.setPublishFees.bind(this);
this.setReveiwFees = this.setReveiwFees.bind(this);
}
setReveiwFees(event , journalId){
event.preventDefault();
let reviewFee = this.reviewFee.value;
reviewFee = parseInt(reviewFee);
if (isNaN(reviewFee)){
Bert.alert('Paper Review fee must be a number')
return;
}
Meteor.call('journal.setReviewFee' , journalId , reviewFee , (error , response)=>{
if (!error){
Bert.alert('Review fee set' , 'success');
}
else {
Bert.alert(`Review fee could not be set ${error}` , 'danger');
}
})
}
setPublishFees(event , journalId){
event.preventDefault();
let publishFee = this.publishFee.value;
publishFee = parseInt(publishFee);
if (isNaN(publishFee)){
Bert.alert('Paper Publish fee must be a number')
return;
}
Meteor.call('journal.setPublishFee' , journalId , publishFee , (error , response)=>{
if (!error){
Bert.alert('Publish fee set' , 'success');
}
else {
Bert.alert(`Publish fee could not be set ${error}` , 'danger');
}
})
}
render(){
const {journal} = this.props ;
return (
<div className="tabTop">
<Row>
<Col md={6} mdOffset={3}>
<Well>
<h4>
Paper Review Fee : ₦
{journal && journal[0].settings && journal[0].settings.reviewFee ? (
` ${journal[0].settings.reviewFee}`
)
: "Paper Review Fee Not Set."}
</h4>
<h4>
Paper Publish Fee : ₦
{journal && journal[0].settings && journal[0].settings.publishFee ? (
` ${journal[0].settings.publishFee}`
)
: "Paper Publish Fee Not Set."}
</h4>
</Well>
<h4>Set Paper Review Fee</h4>
<FormGroup>
<InputGroup>
<input className="form-control"
defaultValue={journal && journal[0].settings && journal[0].settings.reviewFee }
ref={reviewFee => (this.reviewFee = reviewFee)}/>
<InputGroup.Button>
<Button bsStyle="info"
onClick={(event)=> this.setReveiwFees(event , journal && journal[0]._id)}>
Set Paper Review Fee</Button>
</InputGroup.Button>
</InputGroup>
</FormGroup>
<HelpBlock>
<h5>If you want to review paper for free please don't set
the <b>Paper Review Fee. <span className="text-primary">To remove any fee set its value to 0</span> </b> </h5>
</HelpBlock>
<h4>Set Paper Publishing Fee</h4>
<FormGroup>
<InputGroup>
<input className="form-control"
defaultValue={journal && journal[0].settings && journal[0].settings.publishFee }
ref={publishFee => (this.publishFee = publishFee)}/>
<InputGroup.Button>
<Button bsStyle="info"
onClick={(event)=> this.setPublishFees(event , journal && journal[0]._id)}>
Set Paper Publish Fee</Button>
</InputGroup.Button>
</InputGroup>
</FormGroup>
</Col>
</Row>
</div>
)
}
}
export default JournalFees;
|
app/components/views/members/EditMemberDataR.js | AidanNichol/stedwards-booking-system | // require('sass/watermark.scss');
import 'sass/editMember.scss';
import * as i from 'icepick';
import React from 'react';
import {Field, reduxForm, formValueSelector, getFormValues, isDirty} from 'redux-form';
import {connect} from 'react-redux';
import classnames from 'classnames';
import TooltipButton from 'utility/TooltipButton';
// var belle = require('belle');
// var TextInput = belle.TextInput;
import TextInput from 'react-textarea-autosize';
// import {Panel, PanelHeader} from 'rebass';
// import {Panel} from 'react-bootstrap';
import {getSubsStatus} from 'utilities/subsStatus';
import {Panel} from 'utility/AJNPanel'
// import {getSubsDue, getSubsLate} from 'utilities/DateUtilities';
import {properCaseName, properCaseAddress, normalizePhone} from 'components/utility/normalizers';
import Logit from 'factories/logit.js';
var logit = Logit('color:yellow; background:cyan;', 'EditMemberData');
// export const fields= [ "address", "name", "phone", "email", "mobile", "nextOfKin", "medical",
// "memberStatus", "lastName", "firstName" , "account" , "memberId" ,
// "status" , "subscription" , "accountId"] // all the fields in your form
import 'sass/util.css';
let renderField = (field) => {
// console.log('renderField', field);
const {input, meta, children, size, name, className='', ...other} = field;
return (
<span className={"item-input "+name+' '+className}>
<input {...field.input} size={field.size? 1*field.size: 35} type="text" {...other}/>
{field.children||null}
{field.meta.touched && field.meta.error &&
<span className="error">{field.meta.error}</span>}
</span>
)
}
let renderTextArea = (field) => {
const {input, meta, children, size, name, className, ...other} = field;
return(
<span className={"item-input "+name+' '+className||''}>
<TextInput {...field.input} type="text" cols={field.cols||34} {...other}/>
{field.meta.touched && field.meta.error &&
<span className="error">{field.meta.error}</span>}
</span>
)
}
// renderField='input';
const subscriptionButton = (props)=>{
const { input: { onChange}, _delete, editMode, subsStatus, meta, style={}, ...other } = props;
// if (!subsStatus.due) return null;
style.marginLeft = 140;
logit('subscriptionButton',{ _delete, editMode, subsStatus, other})
return (
<TooltipButton label={`Paid £${subsStatus.fee} for ${subsStatus.year}`} onClick={()=>onChange(subsStatus.year)} {...other} style={style} visible={editMode && !_delete && subsStatus.due} />
)
}
const suspendButtons = (props)=>{
const { input: { value:suspended, onChange}, _delete, editMode } = props
return (
<span>
<TooltipButton img="/images/user-disable.svg" onClick={()=>onChange(true)} tiptext='Suspend this Member' visible={editMode && !suspended} />
<TooltipButton img="/images/user-enable.svg" onClick={()=>onChange(false)} tiptext="Unsuspend this Member" visible={editMode && (!_delete) && suspended} />
</span>
)
}
const deleteButtons = (props)=>{
const { input: { value: deleteMe, onChange}, editMode, suspended, remove } = props
if (!suspended) return null;
return (
<span>
<TooltipButton label="Delete Member" onClick={remove} tiptext="Permanently Delete Member" visible={editMode && deleteMe} />
<TooltipButton img="/images/user-undelete.svg" onClick={()=>onChange(false)} tiptext='Clear the Delete Request' visible={editMode && deleteMe}/>
<TooltipButton img="/images/user-delete.svg" onClick={()=>onChange(true)} tiptext="Request Member Deletion" visible={editMode && (!deleteMe)} />
</span>
)
}
// const Panel = (props)=>(<div className={props.className} style={{boxSizing: 'border-box', padding: 10, marginBottom: 16, border: '1px solid #bce8f1', borderRadius: 2, backgroundColor: 'rgb(255, 255, 255)'}}>{props.children}</div>)
// const PanelHeader = (props)=>(<div className={props.className} style={{boxSizing: 'border-box', fontSize: '2rem', display: 'flex', alignItems: 'center', fontWeight: 600, margin: '-11px -11px 10px', padding: 'inherit', borderRadius: '2px 2px 0 0', color:'#31708f', backgroundColor: '#d9edf7'}}>{props.children}</div>)
let EditMemberData = (props)=>{
logit('props', props);
const {
// firstName, lastName, memberStatus, suspended, _delete,
showEditMemberModal: editMode,
dirty,
setShowEditMemberModal, membersEditSaveChanges, memberAdmin,
handleSubmit,
reset,
formValues,
} = props;
const {firstName, lastName, subscription, memberStatus, suspended, _delete, } = formValues||{};
// const saveChanges = (values)=>{
// logit('saveChanges', values);
// membersEditSaveChanges({doc: values, origDoc: props.members});
// }
const saveChangesX = (values)=>{
logit('saveChangesX', {values, props});
// handleSubmit(saveChanges);
let res = membersEditSaveChanges({doc: props.formValues, origDoc: props.member});
logit('save result', res)
}
if (!props.member.memberId)return (null);
var showMode = !editMode;
const deletePending = _delete || false;
var remove = ()=> {
const doc = {...props.formValues, _deleted: true}
membersEditSaveChanges({doc, origDoc: props.member});
}
const subsStatus = getSubsStatus({subscription, memberStatus}); // {due: true, year: 2016, fee: 15, status: 'late'}
var title = (<div style={{width:'100%'}}>
{ firstName } { lastName } {dirty ? '(changed)' : ''}
<span style={{float: 'right', hidden:!(editMode && dirty), cursor:'pointer'}} className='closeWindow' onClick={()=>setShowEditMemberModal(false)} >{showMode || dirty?"" :"X"}</span>
</div>);
let clss = classnames({['form-horizontal user-details modal-body ']:true, suspended: suspended, deleted: _delete}, memberStatus).toLowerCase();
return (
<Panel bsStyle='info' className={"show-member-details "+(editMode ? 'editmode' : 'showMode')} header={title}>
<TooltipButton className={memberAdmin ? 'edit-member ' : 'edit-member hidden' } label='Edit' onClick={()=>setShowEditMemberModal(true)} visible={showMode} />
<div className={clss}>
{/* <form className={clss} name="user-details" autoComplete="off" onSubmit={onSubmit} > */}
<fieldset disabled={showMode} size={40}>
<div className="form-line">
<label className="item-label">firstName</label>
<Field component={renderField} name="firstName" type="text" normalize={properCaseName} />
</div>
<div className="form-line">
<label className="item-label">lastName</label>
<Field component={renderField} name='lastName' type="text" normalize={properCaseName} />
</div>
<div className="form-line">
<label className="item-label">address</label>
<Field component={renderTextArea} name="address" normalize={properCaseAddress} />
</div>
<div className="form-line">
<label className="item-label">phone</label>
<Field component={renderField} name='phone' type="text" normalize={normalizePhone} />
</div>
<div className="form-line">
<label className="item-label">email</label>
<Field component={renderField} name='email' type="email" />
</div>
<div className="form-line">
<label className="item-label">mobile</label>
<Field component={renderField} name='mobile' type="text"/>
</div>
<div className="form-line">
<label className="item-label">subscription</label>
<Field component={renderField} name="subscription" className={subsStatus.status} type="text" size={5}>
<Field component={subscriptionButton} name='subscription' {...{editMode, _delete, subsStatus}} />
</Field>
</div>
<div className="form-line">
<label className="item-label">nextOfKin</label>
<Field component={renderTextArea} name="nextOfKin" />
</div>
<div className="form-line">
<label className="item-label">medical</label>
<Field component={renderField} name="medical" type="text" />
</div>
<div className="form-line">
<label className="item-label">Member Id</label>
<Field name="memberId" component={renderField} disabled="true" type="text" />
</div>
<div className="form-line">
<label className="item-label">Account Id</label>
<Field component={renderField} name="accountId" disabled="true" type="text" />
</div>
<div className="form-line">
<label className="item-label">Status</label>
<Field component='select' name='memberStatus' disabled={!memberAdmin || showMode} >
<option value="OK">Member</option>
<option value="Guest">Guest</option>
<option value="HLM">Honary Life Member</option>
</Field>
</div>
</fieldset>
<span>
delete id {_delete?'true':'false'}
{_delete ?
<img className="stamp" src="/images/Deleted Member.svg" /> : null
}
</span>
<TooltipButton label='Close' onClick={()=>setShowEditMemberModal(false)} visible={editMode && !dirty} />
<TooltipButton label='Discard' onClick={reset} visible={editMode && dirty && !deletePending} />
{/* <button type="submit" disabled={pristine || submitting}>Submit</button> */}
<TooltipButton label="Save" onClick={saveChangesX} tiptext="Save All Changes to this Member" visible={editMode && !_delete && dirty} />
{/* <TooltipButton img="/images/user-undelete.svg" onClick={()=>_deleted.onchange(false)} tiptext='Clear the Delete Request' visible={editMode && deletePending}/>
<TooltipButton img="/images/user-delete.svg" onClick={()=>_deleted.onChange(true)} tiptext="Completely Delete Member" visible={editMode && (!deletePending) && isSuspended} />
<TooltipButton lable="Delete Member" onClick={()=>handleSubmit(remove)} tiptext="Permanently Delete Member" visible={editMode && deletePending} /> */}
<Field component={suspendButtons} name='suspended' {...{editMode, _delete, suspended}} />
<Field component={deleteButtons} name='_delete' {...{editMode, suspended, handleSubmit, remove}} />
{/* <TooltipButton img="/images/user-disable.svg" onClick={()=>suspended.onChange(true)} tiptext='Suspend this Member' visible={editMode && !isSuspended} />
<TooltipButton img="/images/user-enable.svg" onClick={()=>suspended.onChange(false)} tiptext="Unsuspend this Member" visible={editMode && (!deletePending) && isSuspended} /> */}
{/* </form> */}
</div>
</Panel>
);
}
const selector = formValueSelector('EditMemberData');
const mapStateToProps = function mapStateToProps(state, props){
let {member, other} = props;
const formValues = getFormValues('EditMemberData')(state);
member = member ? i.thaw(member) : {};
if (member && !('suspended' in member))member.suspended = false;
const newProps = {
initialValues: {_delete:false, ...member}, // will pull state into form's initialValues
enableReinitialize: true,
...other,
member,
formValues,
dirty: isDirty('EditMemberData')(state),
...selector(state, 'firstName', 'lastName', 'suspended', '_delete'),
};
logit('mapStateToProps', {state, props, newProps})
return newProps;
}
EditMemberData = reduxForm({ // <----- THIS IS THE IMPORTANT PART!
form: 'EditMemberData', // a unique name for this form
}
)(EditMemberData);
EditMemberData = connect(
mapStateToProps
)(EditMemberData)
export default EditMemberData
|
app/client/src/scenes/ManageActionComposeMessage/ManageActionComposeMessage.js | uprisecampaigns/uprise-app | import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { compose, graphql } from 'react-apollo';
import FontIcon from 'material-ui/FontIcon';
import ComposeMessage from 'components/ComposeMessage';
import Link from 'components/Link';
import s from 'styles/Organize.scss';
import ActionQuery from 'schemas/queries/ActionQuery.graphql';
import CampaignQuery from 'schemas/queries/CampaignQuery.graphql';
import MeQuery from 'schemas/queries/MeQuery.graphql';
import history from 'lib/history';
import SendMessageMutation from 'schemas/mutations/SendMessageMutation.graphql';
import { notify } from 'actions/NotificationsActions';
class ManageActionComposeMessage extends Component {
static propTypes = {
campaign: PropTypes.object,
action: PropTypes.object,
userObject: PropTypes.object.isRequired,
recipients: PropTypes.arrayOf(PropTypes.object).isRequired,
// TODO: I don't know why eslint is complaining about this one
// eslint-disable-next-line react/no-unused-prop-types
sendMessage: PropTypes.func.isRequired,
// eslint-disable-next-line react/no-unused-prop-types
actionId: PropTypes.string.isRequired,
// eslint-disable-next-line react/no-unused-prop-types
campaignId: PropTypes.string.isRequired,
};
static defaultProps = {
campaign: undefined,
action: undefined,
};
handleSend = async ({ subject, body }) => {
const { userObject, recipients, sendMessage, ...props } = this.props;
const fullBody = `From: ${userObject.first_name} ${userObject.last_name}\nPlease reply to: ${userObject.email}\n${
props.campaign.title
}\n${props.action.title}\n\n${body}`;
try {
await sendMessage({
variables: {
data: {
replyToEmail: userObject.email,
recipientIds: recipients.map((r) => r.id),
body: fullBody,
subject,
},
},
});
props.dispatch(notify('Message Sent'));
setTimeout(() => {
history.goBack();
}, 500);
} catch (e) {
console.error(e);
props.dispatch(notify('There was an error sending your message.'));
}
};
render() {
if (this.props.campaign && this.props.action && this.props.recipients && this.props.userObject) {
const { campaign, action, userObject, recipients } = this.props;
const baseActionUrl = `/organize/${campaign.slug}/opportunity/${action.slug}`;
const detailLines = [
`From: ${userObject.first_name} ${userObject.last_name}`,
`Please reply to: ${userObject.email}`,
campaign.title,
action.title,
];
return (
<div className={s.outerContainer}>
<div className={s.innerContainer}>
<div className={s.sectionHeaderContainer}>
<div className={s.pageHeader}>{campaign.title}</div>
{campaign.profile_subheader && <div className={s.sectionSubheader}>{campaign.profile_subheader}</div>}
</div>
<div className={s.crumbs}>
<div className={s.navHeader}>
<Link to={`${baseActionUrl}`}>{action.title}</Link>
<FontIcon className={['material-icons', 'arrowRight'].join(' ')}>keyboard_arrow_right</FontIcon>
Contact Volunteers
</div>
</div>
<ComposeMessage
fromEmail={userObject.email}
detailLines={detailLines}
recipients={recipients}
handleSend={this.handleSend}
/>
</div>
</div>
);
}
return null;
}
}
const mapStateToProps = (state) => ({
recipients: state.messages.recipients,
});
export default compose(
connect(mapStateToProps),
graphql(CampaignQuery, {
options: (ownProps) => ({
variables: {
search: {
id: ownProps.campaignId,
},
},
}),
props: ({ data }) => ({
campaign: data.campaign,
}),
}),
graphql(ActionQuery, {
options: (ownProps) => ({
variables: {
search: {
id: ownProps.actionId,
},
},
}),
props: ({ data }) => ({
action: data.action,
}),
}),
graphql(MeQuery, {
props: ({ data }) => ({
userObject: data.me,
}),
}),
graphql(SendMessageMutation, { name: 'sendMessage' }),
)(ManageActionComposeMessage);
|
src/components/Slide.js | prjctrft/mantenuto | import React from 'react';
import PropTypes from 'prop-types';
import Transition from 'react-transition-group/Transition';
const defaultStyles = {
width: '100%',
height: '100%'
}
const transitionStyles = (duration) => ({
'entering': {
transform: 'translate(100vw)'
},
'entered': {
transform: 'translate(0%)',
transition: `transform ${duration * 0.75}ms ease-in-out`
},
'exiting': {
transform: 'translate(100vw)',
transition: `transform ${duration * 0.75}ms ease-in-out`
},
'exited': {
display: 'none',
transform: 'translate(100vw)'
}
})
const Slide = ({ slideIn, children, duration, className }) => (
<Transition in={slideIn} timeout={duration}>
{(state) => (
<div
className={className || ''} style={{
...defaultStyles,
...transitionStyles(duration)[state]
}}
>
{ children }
</div>
)}
</Transition>
);
Slide.propTypes = {
slideIn: PropTypes.bool.isRequired, // whether or not elements are visible
children: PropTypes.arrayOf(PropTypes.element).isRequired, // element(s) to slide in
duration: PropTypes.number.isRequired, // how long transition takes
className: PropTypes.string // apply custom classes to element
}
export default Slide;
|
www/src/components/WeightForm.js | savannidgerinel/health | import React from 'react';
import math from 'mathjs';
import { isSomething, renderWeight, parseUnit } from '../common'
import { TextEditForm } from './ValidatedText'
export class WeightForm extends React.Component {
render () {
return (isSomething(this.props.value))
? <p> {renderWeight(this.props.value.weight)} </p>
: <p> </p>
}
}
export class WeightEditForm extends React.Component {
render () {
return <TextEditForm value={this.props.value ? this.props.value.weight : math.unit(0, 'kg')}
render={renderWeight}
parse={parseUnit}
onUpdate={(value) => this.props.onUpdate(value)}/>
}
}
|
src/components/Question/List.js | maloun96/react-admin | import React from 'react';
import {render} from 'react-dom';
class List extends React.Component {
constructor(props){
super(props);
}
removeCompany(id){
axios.get('home/delete/' + id).then(res => {
this.props.removeCompany(id);
});
}
editCompany(id){
this.props.onEditCompany(id);
}
render(){
let companies = this.props.companies.map((elem) => {
return (
<tr key={elem.id}>
<td>{elem.id}</td>
<td>{elem.name}</td>
<td>{elem.description}</td>
<td>{elem.created_at}</td>
<td>
<button className="btn btn-warning" onClick={this.removeCompany.bind(this, elem.id)}>Delete</button>
<button className="btn btn-warning" onClick={this.editCompany.bind(this, elem.id)}>Edit</button>
</td>
</tr>
)
});
return (
<div>
<table className="table table-bordered">
<tbody>
<tr>
<th >#</th>
<th>Name</th>
<th>Description</th>
<th >Date</th>
<th >Action</th>
</tr>
{companies}
</tbody>
</table>
</div>
);
}
}
export default List; |
node_modules/react-color/examples/Sketch.js | premcool/getmydeal | 'use strict'
import React from 'react'
import reactCSS from 'reactcss'
import { SketchPicker } from 'react-color'
class SketchExample extends React.Component {
state = {
displayColorPicker: false,
color: {
r: '241',
g: '112',
b: '19',
a: '1',
},
};
handleClick = () => {
this.setState({ displayColorPicker: !this.state.displayColorPicker })
};
handleClose = () => {
this.setState({ displayColorPicker: false })
};
handleChange = (color) => {
this.setState({ color: color.rgb })
};
render() {
const styles = reactCSS({
'default': {
color: {
width: '36px',
height: '14px',
borderRadius: '2px',
background: `rgba(${ this.state.color.r }, ${ this.state.color.g }, ${ this.state.color.b }, ${ this.state.color.a })`,
},
swatch: {
padding: '5px',
background: '#fff',
borderRadius: '1px',
boxShadow: '0 0 0 1px rgba(0,0,0,.1)',
display: 'inline-block',
cursor: 'pointer',
},
popover: {
position: 'absolute',
zIndex: '2',
},
cover: {
position: 'fixed',
top: '0px',
right: '0px',
bottom: '0px',
left: '0px',
},
},
})
return (
<div>
<div style={ styles.swatch } onClick={ this.handleClick }>
<div style={ styles.color } />
</div>
{ this.state.displayColorPicker ? <div style={ styles.popover }>
<div style={ styles.cover } onClick={ this.handleClose } />
<SketchPicker color={ this.state.color } onChange={ this.handleChange } />
</div> : null }
</div>
)
}
}
export default SketchExample
|
utils/typography.js | danheadforcode/fg-gatsby | import ReactDOM from 'react-dom/server'
import React from 'react'
import Typography from 'typography'
import CodePlugin from 'typography-plugin-code'
import { MOBILE_MEDIA_QUERY } from 'typography-breakpoint-constants'
const options = {
baseFontSize: '18px',
baseLineHeight: 1.45,
scaleRatio: 2.25,
plugins: [new CodePlugin()],
overrideStyles: ({ rhythm, scale }, options) => ({
[MOBILE_MEDIA_QUERY]: {
// Make baseFontSize on mobile 16px.
html: {
fontSize: `${16 / 16 * 100}%`,
},
},
}),
}
const typography = new Typography(options)
// Hot reload typography in development.
if (process.env.NODE_ENV !== 'production') {
typography.injectStyles()
}
export default typography
|
src/svg-icons/av/closed-caption.js | ArcanisCz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvClosedCaption = (props) => (
<SvgIcon {...props}>
<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z"/>
</SvgIcon>
);
AvClosedCaption = pure(AvClosedCaption);
AvClosedCaption.displayName = 'AvClosedCaption';
AvClosedCaption.muiName = 'SvgIcon';
export default AvClosedCaption;
|
src/index.js | yyssc/sanhu | import React from 'react';
import ReactDOM from 'react-dom';
/**
* Import the stylesheet you want used! Here we just reference
* the main SCSS file we have in the styles directory.
*/
import './styles/main.scss';
/**
* Both configureStore and Root are required conditionally.
* See configureStore.js and Root.js for more details.
*/
import { configureStore } from './store/configureStore';
import { Root } from './containers/Root';
const store = configureStore();
ReactDOM.render(
<Root store={store} />,
document.getElementById('root')
);
|
app/components/Chatlog.js | nesfe/electron-LAN-chat | import React, { Component } from 'react';
import utils from '../utils/utils';
export default class Chatlog extends Component {
componentDidUpdate() {
this.refs.chatlog.scrollTop = this.refs.chatlog.scrollHeight;
}
render() {
let nowIp = this.props.nowIp;
let items = [];
let arr = JSON.parse(localStorage[nowIp]);
let tx = localStorage[nowIp + 'tx'];
let metx = localStorage[utils.ip + 'tx'];
arr.forEach((x, y) => {
if (x.ip) {
items.push(
<div className="you" key={y}>
<div className="tx">
<div className={"div" + tx} alt=""/>
</div>
<div className="mess">
{x.message}
</div>
<div className="horn"></div>
</div>
)
} else {
items.push(
<div className="me" key={y}>
<div className="tx">
<div className={"div" + metx} alt=""/>
</div>
<div className="mess">
{x.message}
</div>
<div className="horn"></div>
</div>
);
}
});
return (
<div className="chatlog" ref="chatlog">
{items}
</div>
);
}
}
|
src/App.js | gauriramesh/budgetbuddy | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import './App.css';
import CategoryButton from './CategoryButton.js';
import Budget from './Budget.js';
import CategoryEntry from './Entry.js';
class App extends Component {
render() {
return (
<div className="App">
<OverallBalance/>
</div>
);
}
}
class OverallBalance extends Component {
constructor(props) {
super(props);
this.state = {
overallBalance: "$0.00",
showPop: false,
amountAllocated: "$0.00",
totalUsed: "$0.00",
}
this.moneyIsValidated = this.moneyIsValidated.bind(this);
this.setOverallBalance = this.setOverallBalance.bind(this);
this.handleSubmission = this.handleSubmission.bind(this);
this.handleEdit = this.handleEdit.bind(this);
this.updateOverallBalance = this.updateOverallBalance.bind(this);
this.handleCategoryButtonClick = this.handleCategoryButtonClick.bind(this);
this.handleBudgetAllocation = this.handleBudgetAllocation.bind(this);
this.checkNegative = this.checkNegative.bind(this);
this.handleEntryKey = this.handleEntryKey.bind(this);
};
moneyIsValidated(input) {
let regexp = /^(?:(?:USD)?\$)?(?:-)?(?:\d+|\d{1,3}(?:,\d{3})*)(?:\.\d{1,2})?$/;
return regexp.test(input);
}
setOverallBalance(e) {
e.preventDefault();
console.log(this.state.overallBalance);
if(this.moneyIsValidated(e.target.value)===true) {
this.setState({overallBalance: e.target.value});
}
}
checkNegative() {
if(Number(this.state.overallBalance.replace(/[^0-9.||-]+/g,"")) < 0) {
document.getElementById('obalance').style.backgroundColor = "#a50000";
} else {
document.getElementById('obalance').style.backgroundColor = "#1eb550";
}
}
updateOverallBalance(e) {
e.preventDefault();
let oldCurrency = Number(this.state.overallBalance.replace(/[^0-9.||-]+/g,""));
let addCurrency = Number(document.getElementById('add').value.replace(/[^0-9.||-]+/g,""));
let subtractCurrency = Number(document.getElementById('subtract').value.replace(/[^0-9.||-]+/g,""));
this.setState({overallBalance: (oldCurrency+addCurrency-subtractCurrency).toString()});
console.log(this.state.overallBalance);
this.setState({showPop: false});
this.checkNegative();
}
handleSubmission() {
document.getElementById("obalance").disabled = true;
}
handleEdit() {
this.setState({
showPop: true,
});
}
handleCategoryButtonClick() {
this.setState({
showBudgets: true,
});
}
handleBudgetAllocation() {
console.log("Starting budget allocation handler!");
var allocations = document.getElementsByClassName("BudgetAllocation");
var allocationsArray = Array.prototype.slice.call(allocations).map((allocation) => allocation.value);
allocationsArray.forEach((element) => {
if (this.moneyIsValidated(element)) {
let oldCurrency = Number(this.state.overallBalance.replace(/[^0-9.||-]+/g, ""));
console.log(oldCurrency);
let allocation = Number(element.replace(/[^0-9.||-]+/g, ""));
console.log(allocation);
this.setState({amountAllocated: allocation.toString()})
console.log(this.state.amountAllocated);
this.checkNegative();
this.setState({overallBalance: (oldCurrency - allocation).toString()});
}
});
}
handleEntryKey(e) {
this.forceUpdate();
if(e.keyCode==13) {
//set the state
//maybe make active element disabled.
let allocation = Number(document.activeElement.value.replace(/[^0-9.||-]+/g, ""));
let oldAllocation = Number(this.state.amountAllocated.replace(/[^0-9.||-]+/g, ""));
this.setState({amountAllocated: (oldAllocation-allocation).toString()});
let oldTotalUsed = Number(this.state.totalUsed.replace(/[^0-9.||-]+/g, ""));
this.setState({totalUsed: (oldTotalUsed + allocation).toString()});
}
}
render() {
const budget = this.state.budgets;
return (
<div className="App">
<form>
<input id="obalance" className="OverallBalance-input" value={this.state.overallBalance} onChange={(e) => this.setOverallBalance(e)}/>
<br/>
<button className="OverallBalance-submit" type="button" onClick={this.handleSubmission}> Enter </button>
<button className="OverallBalance-submit" type="button" onClick={this.handleEdit}>Edit</button>
{this.state.showPop ? <EditPopup updateOverallBalance={(e) => this.updateOverallBalance(e)}/> : null}
</form>
<CategoryButton handleClick={this.handleAddBudgetClick} name="Add New Budget" color="#10d3a6"/>
<Budget totalUsed={this.state.totalUsed} amountAllocated={this.state.amountAllocated} addEntry={this.handleAddEntry} balance={this.state.overallBalance} handleBudgetAllocation={this.handleBudgetAllocation} handleEntryKey={(e) => this.handleEntryKey(e)} />
<CategoryEntry handleEntryKey={(e) => this.handleEntryKey(e)} color="#42f4c8" />
<CategoryEntry handleEntryKey={(e) => this.handleEntryKey(e)} color="#42f4c8" />
<CategoryEntry handleEntryKey={(e) => this.handleEntryKey(e)} color="#42f4c8" />
<CategoryEntry handleEntryKey={(e) => this.handleEntryKey(e)} color="#42f4c8" />
<CategoryEntry handleEntryKey={(e) => this.handleEntryKey(e)} color="#42f4c8" />
<CategoryEntry handleEntryKey={(e) => this.handleEntryKey(e)} color="#42f4c8" />
{this.state.showBudgets ? <Budget handleEntryKey={(e) => this.handleEntryKey(e)} totalUsed={this.state.totalUsed} amountAllocated={this.state.amountAllocated} addEntry={this.handleAddEntry} entries={this.state.budgets.map((budget)=> budget.entries)} balance={this.state.overallBalance} handleBudgetAllocation={this.handleBudgetAllocation}/> : null}
</div>
);
}
}
function EditPopup(props) {
return(
<div>
<div className="popup">
<h3> Edit or Update Balance </h3>
<form>
Add: <input id="add" name="Add" defaultValue="$0.00"/> <br/>
Subtract: <input id="subtract" name="Subtract" defaultValue="$0.00"/> <br/>
<button className="updateClose" onClick={props.updateOverallBalance}> Update & Close </button>
</form>
</div>
</div>
);
}
EditPopup.propTypes = {
updateOverallBalance: PropTypes.func.isRequired
}
export default App;
|
templates/rubix/laravel/laravel-example/src/routes/AllTodos.js | jeffthemaximum/Teachers-Dont-Pay-Jeff | import React from 'react';
import { Link } from 'react-router';
import Todo from '../components/Todo';
import TodoForm from '../components/TodoForm';
import {
Row,
Col,
Grid,
Panel,
PanelBody,
PanelContainer,
} from '@sketchpixy/rubix';
import client from '@sketchpixy/rubix/lib/utils/HttpClient';
export default class AllTodos extends React.Component {
static fetchData() {
return client.get('/api/todos');
}
constructor(props) {
super(props);
this.state = {
todos: props.data.todos,
};
}
componentWillReceiveProps(nextProps) {
this.setState({
todos: nextProps.data.todos,
});
}
addTodo(todo) {
let todos = this.state.todos.concat();
todos.push(todo);
this.setState({
todos: todos,
});
}
render() {
let { todos } = this.state;
let todosExist = todos && typeof todos.map === 'function';
return (
<PanelContainer>
<Panel>
<PanelBody style={{padding: 0, paddingBottom: 25}}>
<Grid>
<Row>
<Col xs={12}>
<h3>Todo List:</h3>
<TodoForm parent={this} />
{todosExist && todos.map((todo) => {
return <Todo key={todo.id} todo={todo} />;
})}
</Col>
</Row>
</Grid>
</PanelBody>
</Panel>
</PanelContainer>
);
}
}
|
Tutorial/js/basic/1.props.js | onezens/react-native-repo | import React, { Component } from 'react';
import { AppRegistry, Image, Text, View } from 'react-native';
class Tutorial extends Component {
render() {
return (
<LotsOfGreeting />
);
}
}
class Greeting extends Component {
render() {
return (
<Text>Hello ! {this.props.name}</Text>
);
}
}
class LotsOfGreeting extends Component {
render() {
return (
<View>
<Greeting name='Xiaoming' />
<Greeting name='XiaoHua' />
<Greeting name='Xiaozhen' />
<ShowImage />
</View>
)
};
}
class ShowImage extends Component {
render(){
let pic = {
url : 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'
};
return(
<Image source={pic} style={{width: 193, height: 110}}/>
)
};
}
AppRegistry.registerComponent('Tutorial', ()=>Tutorial);
|
apps/app/src/components/SmoothCodeLogo.js | argos-ci/argos | import React from 'react'
function SmoothCodeLogoLight(props) {
return (
<svg width={1011} height={204} viewBox="0 0 1011 204" {...props}>
<title>Smooth Code</title>
<defs>
<path
d="M135.775 119.34c-.78-1.213-1.17-2.383-1.17-3.51 0-1.733.91-3.207 2.73-4.42.867-.607 1.863-.91 2.99-.91 1.56 0 2.99.65 4.29 1.95 2.6 2.947 5.395 5.157 8.385 6.63 2.99 1.473 6.565 2.21 10.725 2.21 3.293-.087 6.197-.845 8.71-2.275 2.513-1.43 3.77-3.748 3.77-6.955 0-2.947-1.278-5.2-3.835-6.76-2.557-1.56-6.305-2.99-11.245-4.29-4.853-1.3-8.883-2.665-12.09-4.095a21.664 21.664 0 01-8.125-6.24c-2.21-2.73-3.315-6.305-3.315-10.725 0-3.9 1.105-7.323 3.315-10.27 2.21-2.947 5.157-5.243 8.84-6.89 3.683-1.647 7.692-2.47 12.025-2.47 4.16 0 8.298.78 12.415 2.34 4.117 1.56 7.475 3.943 10.075 7.15 1.04 1.213 1.56 2.47 1.56 3.77 0 1.387-.693 2.73-2.08 4.03-.867.78-1.95 1.17-3.25 1.17-1.56 0-2.817-.52-3.77-1.56-1.82-2.08-4.052-3.683-6.695-4.81-2.643-1.127-5.568-1.69-8.775-1.69-3.293 0-6.088.672-8.385 2.015-2.297 1.343-3.445 3.618-3.445 6.825.087 3.033 1.408 5.287 3.965 6.76 2.557 1.473 6.478 2.903 11.765 4.29 4.593 1.213 8.407 2.513 11.44 3.9 3.033 1.387 5.59 3.445 7.67 6.175s3.12 6.305 3.12 10.725c0 4.073-1.17 7.605-3.51 10.595s-5.395 5.287-9.165 6.89c-3.77 1.603-7.778 2.405-12.025 2.405-5.46 0-10.508-.953-15.145-2.86-4.637-1.907-8.558-4.94-11.765-9.1zm144.04-58.63c15.167 0 22.75 9.447 22.75 28.34v34.71c0 1.82-.563 3.315-1.69 4.485-1.127 1.17-2.6 1.755-4.42 1.755-1.82 0-3.315-.607-4.485-1.82-1.17-1.213-1.755-2.687-1.755-4.42V89.18c0-11.353-4.767-17.03-14.3-17.03-3.38 0-6.435.758-9.165 2.275-2.73 1.517-4.853 3.575-6.37 6.175-1.517 2.6-2.275 5.46-2.275 8.58v34.58c0 1.733-.585 3.207-1.755 4.42s-2.665 1.82-4.485 1.82c-1.82 0-3.293-.585-4.42-1.755-1.127-1.17-1.69-2.665-1.69-4.485V89.05c0-5.113-1.083-9.208-3.25-12.285s-5.763-4.615-10.79-4.615c-5.113 0-9.338 1.625-12.675 4.875-3.337 3.25-5.005 7.258-5.005 12.025v34.71c0 1.733-.585 3.207-1.755 4.42s-2.665 1.82-4.485 1.82c-1.82 0-3.293-.585-4.42-1.755-1.127-1.17-1.69-2.665-1.69-4.485V68.12c0-1.733.585-3.207 1.755-4.42s2.622-1.82 4.355-1.82c1.82 0 3.315.607 4.485 1.82 1.17 1.213 1.755 2.687 1.755 4.42v4.55c2.253-3.38 5.265-6.218 9.035-8.515 3.77-2.297 7.865-3.445 12.285-3.445 10.747 0 17.723 4.767 20.93 14.3 1.907-3.64 5.07-6.933 9.49-9.88 4.42-2.947 9.1-4.42 14.04-4.42zm105.69 35.23c0 6.76-1.517 12.827-4.55 18.2-3.033 5.373-7.172 9.577-12.415 12.61-5.243 3.033-11.028 4.55-17.355 4.55s-12.112-1.517-17.355-4.55-9.382-7.237-12.415-12.61c-3.033-5.373-4.55-11.44-4.55-18.2s1.517-12.87 4.55-18.33c3.033-5.46 7.172-9.707 12.415-12.74 5.243-3.033 11.028-4.55 17.355-4.55s12.112 1.517 17.355 4.55 9.382 7.28 12.415 12.74c3.033 5.46 4.55 11.57 4.55 18.33zm-12.35 0c0-4.68-.975-8.862-2.925-12.545-1.95-3.683-4.593-6.543-7.93-8.58-3.337-2.037-7.042-3.055-11.115-3.055s-7.778 1.018-11.115 3.055c-3.337 2.037-5.98 4.897-7.93 8.58-1.95 3.683-2.925 7.865-2.925 12.545 0 4.593.975 8.71 2.925 12.35 1.95 3.64 4.593 6.478 7.93 8.515 3.337 2.037 7.042 3.055 11.115 3.055s7.778-1.018 11.115-3.055c3.337-2.037 5.98-4.875 7.93-8.515 1.95-3.64 2.925-7.757 2.925-12.35zm91.13 0c0 6.76-1.517 12.827-4.55 18.2-3.033 5.373-7.172 9.577-12.415 12.61-5.243 3.033-11.028 4.55-17.355 4.55s-12.112-1.517-17.355-4.55-9.382-7.237-12.415-12.61c-3.033-5.373-4.55-11.44-4.55-18.2s1.517-12.87 4.55-18.33c3.033-5.46 7.172-9.707 12.415-12.74 5.243-3.033 11.028-4.55 17.355-4.55s12.112 1.517 17.355 4.55 9.382 7.28 12.415 12.74c3.033 5.46 4.55 11.57 4.55 18.33zm-12.35 0c0-4.68-.975-8.862-2.925-12.545-1.95-3.683-4.593-6.543-7.93-8.58-3.337-2.037-7.042-3.055-11.115-3.055s-7.778 1.018-11.115 3.055c-3.337 2.037-5.98 4.897-7.93 8.58-1.95 3.683-2.925 7.865-2.925 12.545 0 4.593.975 8.71 2.925 12.35 1.95 3.64 4.593 6.478 7.93 8.515 3.337 2.037 7.042 3.055 11.115 3.055s7.778-1.018 11.115-3.055c3.337-2.037 5.98-4.875 7.93-8.515 1.95-3.64 2.925-7.757 2.925-12.35zm45.11-21.97v38.74c0 4.333 1.95 6.5 5.85 6.5.607 0 1.43-.152 2.47-.455 1.04-.303 1.863-.455 2.47-.455 1.127 0 2.08.477 2.86 1.43.78.953 1.17 2.167 1.17 3.64 0 1.82-1.04 3.38-3.12 4.68-2.08 1.3-4.42 1.95-7.02 1.95-2.86 0-5.482-.303-7.865-.91s-4.507-2.145-6.37-4.615c-1.863-2.47-2.795-6.218-2.795-11.245V73.97h-7.54c-1.647 0-3.012-.542-4.095-1.625-1.083-1.083-1.625-2.448-1.625-4.095 0-1.647.542-2.99 1.625-4.03s2.448-1.56 4.095-1.56h7.54V51.74c0-1.733.585-3.207 1.755-4.42s2.665-1.82 4.485-1.82c1.733 0 3.185.607 4.355 1.82 1.17 1.213 1.755 2.687 1.755 4.42v10.92h10.79c1.647 0 3.012.542 4.095 1.625 1.083 1.083 1.625 2.448 1.625 4.095 0 1.647-.542 2.99-1.625 4.03s-2.448 1.56-4.095 1.56h-10.79zm64.87-13.26c15.253 0 22.88 9.447 22.88 28.34v34.71c0 1.733-.585 3.207-1.755 4.42s-2.665 1.82-4.485 1.82c-1.733 0-3.185-.607-4.355-1.82-1.17-1.213-1.755-2.687-1.755-4.42V89.05c0-11.267-4.767-16.9-14.3-16.9-5.113 0-9.36 1.625-12.74 4.875-3.38 3.25-5.07 7.258-5.07 12.025v34.71c0 1.733-.585 3.207-1.755 4.42s-2.665 1.82-4.485 1.82c-1.82 0-3.293-.585-4.42-1.755-1.127-1.17-1.69-2.665-1.69-4.485V40.04c0-1.733.585-3.207 1.755-4.42s2.622-1.82 4.355-1.82c1.82 0 3.315.607 4.485 1.82 1.17 1.213 1.755 2.687 1.755 4.42v32.89c2.167-3.38 5.2-6.262 9.1-8.645 3.9-2.383 8.06-3.575 12.48-3.575zm106.99-.39c6.847 0 12.545 1.083 17.095 3.25 4.55 2.167 6.825 4.94 6.825 8.32 0 1.473-.477 2.795-1.43 3.965s-2.167 1.755-3.64 1.755c-1.127 0-2.015-.173-2.665-.52-.65-.347-1.538-.91-2.665-1.69-.52-.52-1.343-1.127-2.47-1.82-1.04-.52-2.513-.953-4.42-1.3-1.907-.347-3.64-.52-5.2-.52-4.507 0-8.493 1.04-11.96 3.12-3.467 2.08-6.153 4.962-8.06 8.645-1.907 3.683-2.86 7.778-2.86 12.285 0 4.593.932 8.71 2.795 12.35 1.863 3.64 4.485 6.5 7.865 8.58s7.237 3.12 11.57 3.12c4.507 0 8.147-.693 10.92-2.08.607-.347 1.43-.91 2.47-1.69.867-.693 1.625-1.213 2.275-1.56.65-.347 1.452-.52 2.405-.52 1.733 0 3.098.542 4.095 1.625.997 1.083 1.495 2.492 1.495 4.225 0 1.82-1.148 3.618-3.445 5.395-2.297 1.777-5.373 3.228-9.23 4.355-3.857 1.127-7.995 1.69-12.415 1.69-6.587 0-12.393-1.538-17.42-4.615-5.027-3.077-8.905-7.323-11.635-12.74-2.73-5.417-4.095-11.462-4.095-18.135 0-6.673 1.43-12.718 4.29-18.135 2.86-5.417 6.847-9.663 11.96-12.74s10.963-4.615 17.55-4.615zm101.66 35.62c0 6.76-1.517 12.827-4.55 18.2-3.033 5.373-7.172 9.577-12.415 12.61-5.243 3.033-11.028 4.55-17.355 4.55s-12.112-1.517-17.355-4.55-9.382-7.237-12.415-12.61c-3.033-5.373-4.55-11.44-4.55-18.2s1.517-12.87 4.55-18.33c3.033-5.46 7.172-9.707 12.415-12.74 5.243-3.033 11.028-4.55 17.355-4.55s12.112 1.517 17.355 4.55 9.382 7.28 12.415 12.74c3.033 5.46 4.55 11.57 4.55 18.33zm-12.35 0c0-4.68-.975-8.862-2.925-12.545-1.95-3.683-4.593-6.543-7.93-8.58-3.337-2.037-7.042-3.055-11.115-3.055s-7.778 1.018-11.115 3.055c-3.337 2.037-5.98 4.897-7.93 8.58-1.95 3.683-2.925 7.865-2.925 12.545 0 4.593.975 8.71 2.925 12.35 1.95 3.64 4.593 6.478 7.93 8.515 3.337 2.037 7.042 3.055 11.115 3.055s7.778-1.018 11.115-3.055c3.337-2.037 5.98-4.875 7.93-8.515 1.95-3.64 2.925-7.757 2.925-12.35zm81.9-62.14c1.82 0 3.315.585 4.485 1.755 1.17 1.17 1.755 2.665 1.755 4.485v83.72c0 1.733-.585 3.207-1.755 4.42s-2.665 1.82-4.485 1.82c-1.82 0-3.293-.585-4.42-1.755-1.127-1.17-1.69-2.665-1.69-4.485v-3.64c-2.167 3.12-5.222 5.763-9.165 7.93-3.943 2.167-8.168 3.25-12.675 3.25-5.893 0-11.223-1.517-15.99-4.55-4.767-3.033-8.537-7.258-11.31-12.675-2.773-5.417-4.16-11.505-4.16-18.265s1.365-12.848 4.095-18.265c2.73-5.417 6.478-9.642 11.245-12.675 4.767-3.033 10.01-4.55 15.73-4.55 4.593 0 8.84.953 12.74 2.86 3.9 1.907 7.063 4.377 9.49 7.41V40.04c0-1.82.563-3.315 1.69-4.485 1.127-1.17 2.6-1.755 4.42-1.755zm-26.52 86.06c4.073 0 7.692-1.04 10.855-3.12 3.163-2.08 5.633-4.94 7.41-8.58 1.777-3.64 2.665-7.757 2.665-12.35 0-4.507-.888-8.602-2.665-12.285-1.777-3.683-4.247-6.565-7.41-8.645-3.163-2.08-6.782-3.12-10.855-3.12s-7.692 1.04-10.855 3.12c-3.163 2.08-5.633 4.962-7.41 8.645-1.777 3.683-2.665 7.778-2.665 12.285 0 4.593.888 8.71 2.665 12.35 1.777 3.64 4.247 6.5 7.41 8.58 3.163 2.08 6.782 3.12 10.855 3.12zm110.89-26.52c-.087 1.56-.737 2.882-1.95 3.965-1.213 1.083-2.643 1.625-4.29 1.625h-45.76c.607 6.327 3.012 11.397 7.215 15.21 4.203 3.813 9.338 5.72 15.405 5.72 4.16 0 7.54-.607 10.14-1.82 2.6-1.213 4.897-2.773 6.89-4.68 1.3-.78 2.557-1.17 3.77-1.17 1.473 0 2.708.52 3.705 1.56.997 1.04 1.495 2.253 1.495 3.64 0 1.82-.867 3.467-2.6 4.94-2.513 2.513-5.85 4.637-10.01 6.37-4.16 1.733-8.407 2.6-12.74 2.6-7.02 0-13.195-1.473-18.525-4.42-5.33-2.947-9.447-7.063-12.35-12.35-2.903-5.287-4.355-11.267-4.355-17.94 0-7.28 1.495-13.672 4.485-19.175s6.933-9.728 11.83-12.675c4.897-2.947 10.162-4.42 15.795-4.42 5.547 0 10.747 1.43 15.6 4.29 4.853 2.86 8.753 6.803 11.7 11.83 2.947 5.027 4.463 10.66 4.55 16.9zm-31.85-21.58c-4.853 0-9.057 1.365-12.61 4.095-3.553 2.73-5.893 6.955-7.02 12.675h38.35v-1.04c-.433-4.593-2.492-8.363-6.175-11.31-3.683-2.947-7.865-4.42-12.545-4.42z"
id="xxxx_smooth_code_logo"
/>
</defs>
<g fill="none" fillRule="evenodd">
<path
d="M87.279 43.5l-28.76 41.19a3.248 3.248 0 00.004 3.724l28.756 41.009-33.075-40.83a3.248 3.248 0 01-.004-4.084L87.279 43.5z"
fill="#DDD"
/>
<path
d="M57.934 86.553H53.48a3.243 3.243 0 01.72-2.044L87.279 43.5l-28.76 41.19a3.245 3.245 0 00-.585 1.863z"
fill="#888"
/>
<path
d="M83.064 39.185a3.094 3.094 0 014.114-.23 3.089 3.089 0 01.49 4.342L55.004 84.243a3.248 3.248 0 00.002 4.055l32.919 41.153a3.07 3.07 0 01-.228 4.09 3.075 3.075 0 01-4.346 0L38.3 88.518a3.249 3.249 0 010-4.597l44.764-44.736z"
fill="#CCC"
/>
<g>
<path
d="M84.721 160.5l28.76-41.19a3.248 3.248 0 00-.004-3.724L84.721 74.577l33.075 40.83a3.248 3.248 0 01.004 4.084L84.721 160.5z"
fill="#DDD"
/>
<path
d="M114.066 117.447h4.454a3.243 3.243 0 01-.72 2.044L84.721 160.5l28.76-41.19c.39-.559.586-1.211.585-1.863z"
fill="#888"
/>
<path
d="M88.936 164.815a3.094 3.094 0 01-4.114.23 3.089 3.089 0 01-.49-4.342l32.664-40.946a3.248 3.248 0 00-.002-4.055L84.075 74.55a3.07 3.07 0 01.228-4.09c1.2-1.2 3.146-1.2 4.346 0l45.051 45.023a3.249 3.249 0 010 4.597l-44.764 44.736z"
fill="#CCC"
/>
</g>
<g fillRule="nonzero" fill="#FFF" transform="translate(36 5)">
<use xlinkHref="#xxxx_smooth_code_logo" />
<use xlinkHref="#xxxx_smooth_code_logo" />
</g>
</g>
</svg>
)
}
function SmoothCodeLogoDark(props) {
return (
<svg width={1011} height={204} viewBox="0 0 1011 204" {...props}>
<title>Smooth Code</title>
<g id="logo" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<g
id="logo/horizontal/light"
transform="translate(36.000000, 5.000000)"
>
<g id="Logo">
<g id="shield/light" transform="translate(0.000000, 32.000000)">
<g id="Left" transform="translate(1.219512, 1.218750)">
<path
d="M50.0592962,5.28125 L21.2994987,46.4703047 C20.5179854,47.5895684 20.5194731,49.0775659 21.303223,50.1952665 L50.0592962,91.2041168 L16.9846185,50.3746965 C16.0202736,49.1842497 16.0185026,47.4824945 16.9803677,46.2900456 L50.0592962,5.28125 Z"
id="Shadow-light"
fill="#D26C57"
/>
<path
d="M20.7143908,48.334087 L16.2601626,48.334087 C16.2592011,47.6104648 16.4992242,46.8865353 16.9803706,46.2900456 L50.0592991,5.28125 L21.2995016,46.4703047 C20.908602,47.0301413 20.7135959,47.6822288 20.7143908,48.334087 L20.7143908,48.334087 Z"
id="Shadow-dark"
fill="#973A28"
/>
<path
d="M45.8440328,0.96658399 C46.9567622,-0.145449942 48.7276998,-0.244962084 49.958152,0.7354043 C51.2934813,1.79933182 51.5129565,3.7436372 50.4483637,5.07813191 L17.7839999,46.0237565 C16.8373774,47.2103723 16.8384894,48.8937378 17.7866788,50.0791035 L50.7053082,91.231865 C51.6829673,92.4540717 51.5850381,94.215406 50.4779077,95.3218444 C49.2776009,96.5214011 47.331519,96.5214011 46.1312122,95.3218444 L1.08002205,50.2988113 C-0.189975644,49.0296073 -0.189975644,46.9718212 1.08002205,45.7026172 L45.8440328,0.96658399 L45.8440328,0.96658399 Z"
id="Arrow"
fill="#BD4932"
/>
</g>
<g
id="Right"
transform="translate(65.447154, 80.437500) scale(-1, -1) translate(-65.447154, -80.437500) translate(48.373984, 37.375000)"
>
<path
d="M33.7991336,0 L5.03933613,41.1890547 C4.25782278,42.3083184 4.25931049,43.7963159 5.04306038,44.9140165 L33.7991336,85.9228668 L0.72445592,45.0934465 C-0.239889009,43.9029997 -0.241659974,42.2012445 0.720205148,41.0087956 L33.7991336,0 Z"
id="Shadow-light"
fill="#D26C57"
/>
<path
d="M4.45422823,43.052837 L0,43.052837 C-0.000961527664,42.3292148 0.23906157,41.6052853 0.720208043,41.0087956 L33.7991365,0 L5.03933902,41.1890547 C4.64843938,41.7488913 4.45343327,42.4009788 4.45422823,43.052837 L4.45422823,43.052837 Z"
id="Shadow-dark"
fill="#973A28"
/>
<path
d="M29.5838702,-4.31466601 C30.6965996,-5.42669994 32.4675372,-5.52621208 33.6979894,-4.5458457 C35.0333187,-3.48191818 35.2527939,-1.5376128 34.188201,-0.203118086 L1.52383729,40.7425065 C0.577214759,41.9291223 0.578326774,43.6124878 1.52651621,44.7978535 L34.4451456,85.950615 C35.4228047,87.1728217 35.3248755,88.934156 34.2177451,90.0405944 C33.0174383,91.2401511 31.0713564,91.2401511 29.8710496,90.0405944 L-15.1801405,45.0175613 C-16.4501382,43.7483573 -16.4501382,41.6905712 -15.1801405,40.4213672 L29.5838702,-4.31466601 L29.5838702,-4.31466601 Z"
id="Arrow"
fill="#BD4932"
/>
</g>
</g>
<text
id="smooth-code"
fill="#333333"
fontFamily="Quicksand-Medium, Quicksand"
fontSize="130"
fontWeight="400"
>
<tspan x="130.445" y="130">
smooth code
</tspan>
</text>
</g>
</g>
</g>
</svg>
)
}
export function SmoothCodeLogo({ colorMode, ...props }) {
return colorMode === 'dark' ? (
<SmoothCodeLogoLight {...props} />
) : (
<SmoothCodeLogoDark {...props} />
)
}
|
src/components/Calendar/CalendarSetup.js | Angular-Toast/habitat | import React, { Component } from 'react';
import { View, Text, Image, Button, Linking, TouchableOpacity } from 'react-native';
import { AuthSession } from 'expo';
import axios from 'axios';
import Ecosystem from '../Frontend/EcoSystem';
import CalendarTasks from './CalendarTasks';
export default class CalendarSetup extends Component {
constructor(props) {
super(props);
this.state = {
userID: '',
markers: '',
categories: '',
sync: false
}
this.goBack = this.goBack.bind(this);
}
componentDidMount() {
this.setState({
userID: this.props.screenProps.userID
});
this.getUserInfo();
}
getUserInfo() {
axios.get('http://10.16.1.152:3000/getUserInfo', { params: { userID: this.props.screenProps.userID }})
.then(information => {
let { markers, categories } = information.data;
this.setState({ markers, categories });
})
}
calendar(){
this.setState({
sync: !this.state.sync
});
}
goBack = async () => {
this.props.navigation.navigate('Home');
}
render() {
return (
<View style={{ display: 'flex', flex:1, alignItems: 'center', justifyContent: 'center'}}>
{!this.state.sync ? <TouchableOpacity onPress={() => this.calendar()}>
<Image style={{ height: 300, width: 350}} source={require('../assets/googleCalendar.png')} />
</TouchableOpacity>
: (
<CalendarTasks goBack={this.goBack} markers={this.state.markers} categories={this.state.categories} userID={this.state.userID}/>
)}
</View>
)
}
} |
app/components/App.js | csreyes/TLCJournal | import React from 'react';
import {RouteHandler} from 'react-router';
import Navbar from './Navbar';
class App extends React.Component {
render() {
return (
<div>
<RouteHandler />
</div>
);
}
}
export default App; |
tests/react_native_tests/test_data/native_code/Image/app/components/Mobile/component.js | ibhubs/sketch-components | /**
* @flow
*/
import React from 'react'
import PropTypes from 'prop-types'
import { observer } from 'mobx-react/native'
import styles from './styles'
import placeholder_image from '../../../images/placeholder_image.png'
import styled from 'styled-components/native'
import { Image } from 'react-native'
import { View } from 'react-native'
const Mobile = (props) => (
<MobileStyledView>
<Image
source={placeholder_image}
style={styles.listViewItemImageStyle}
/>
</MobileStyledView>
)
export const MobileStyledView = styled.View`
alignItems: center;
flex: 1;
justifyContent: center;
`
export default observer(Mobile) |
react/DownRightArrowIcon/DownRightArrowIcon.iconSketch.js | seekinternational/seek-asia-style-guide | import React from 'react';
import DownRightArrowIcon from './DownRightArrowIcon';
export const symbols = {
'DownRightArrowIcon': <DownRightArrowIcon />
};
|
platform/viewer/src/googleCloud/DicomStorePickerModal.js | OHIF/Viewers | import React from 'react';
import PropTypes from 'prop-types';
import DatasetSelector from './DatasetSelector';
import './googleCloud.css';
import { withTranslation } from 'react-i18next';
import * as GoogleCloudUtilServers from './utils/getServers';
import { servicesManager } from './../App.js';
function DicomStorePickerModal({
isOpen = false,
setServers,
onClose,
user,
url,
t,
}) {
const { UIModalService } = servicesManager.services;
const showDicomStorePickerModal = () => {
const handleEvent = data => {
const servers = GoogleCloudUtilServers.getServers(data, data.dicomstore);
setServers(servers);
// Force auto close
UIModalService.hide();
onClose();
};
if (UIModalService) {
UIModalService.show({
content: DatasetSelector,
title: t('Google Cloud Healthcare API'),
contentProps: {
setServers: handleEvent,
user,
url,
},
onClose,
});
}
};
return (
<React.Fragment>{isOpen && showDicomStorePickerModal()}</React.Fragment>
);
}
DicomStorePickerModal.propTypes = {
isOpen: PropTypes.bool.isRequired,
setServers: PropTypes.func.isRequired,
onClose: PropTypes.func,
user: PropTypes.object.isRequired,
url: PropTypes.string,
};
export default withTranslation('Common')(DicomStorePickerModal);
|
node_modules/native-base/Components/Widgets/H3.js | mk007sg/threeSeaShells | /* @flow */
'use strict';
import React from 'react';
import Text from './Text';
import NativeBaseComponent from '../Base/NativeBaseComponent';
import computeProps from '../../Utils/computeProps';
export default class H3NB extends NativeBaseComponent {
propTypes: {
style : React.PropTypes.object
}
prepareRootProps() {
var type = {
color: this.getTheme().textColor,
fontSize: this.getTheme().fontSizeH3
}
var defaultProps = {
style: type
}
return computeProps(this.props, defaultProps);
}
render() {
return(
<Text {...this.prepareRootProps()}>{this.props.children}</Text>
);
}
}
|
node_modules/react-bootstrap/es/ModalDialog.js | yeshdev1/Everydays-project | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { bsClass, bsSizes, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
import { Size } from './utils/StyleConfig';
var propTypes = {
/**
* A css class to apply to the Modal dialog DOM node.
*/
dialogClassName: PropTypes.string
};
var ModalDialog = function (_React$Component) {
_inherits(ModalDialog, _React$Component);
function ModalDialog() {
_classCallCheck(this, ModalDialog);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
ModalDialog.prototype.render = function render() {
var _extends2;
var _props = this.props,
dialogClassName = _props.dialogClassName,
className = _props.className,
style = _props.style,
children = _props.children,
props = _objectWithoutProperties(_props, ['dialogClassName', 'className', 'style', 'children']);
var _splitBsProps = splitBsProps(props),
bsProps = _splitBsProps[0],
elementProps = _splitBsProps[1];
var bsClassName = prefix(bsProps);
var modalStyle = _extends({ display: 'block' }, style);
var dialogClasses = _extends({}, getClassSet(bsProps), (_extends2 = {}, _extends2[bsClassName] = false, _extends2[prefix(bsProps, 'dialog')] = true, _extends2));
return React.createElement(
'div',
_extends({}, elementProps, {
tabIndex: '-1',
role: 'dialog',
style: modalStyle,
className: classNames(className, bsClassName)
}),
React.createElement(
'div',
{ className: classNames(dialogClassName, dialogClasses) },
React.createElement(
'div',
{ className: prefix(bsProps, 'content'), role: 'document' },
children
)
)
);
};
return ModalDialog;
}(React.Component);
ModalDialog.propTypes = propTypes;
export default bsClass('modal', bsSizes([Size.LARGE, Size.SMALL], ModalDialog)); |
source/components/Buttons/LoadMoreButton.js | mikey1384/twin-kle | import PropTypes from 'prop-types';
import React from 'react';
import Button from 'components/Button';
import Icon from 'components/Icon';
import ErrorBoundary from 'components/Wrappers/ErrorBoundary';
import { css } from 'emotion';
LoadMoreButton.propTypes = {
label: PropTypes.string,
style: PropTypes.object,
onClick: PropTypes.func.isRequired,
loading: PropTypes.bool
};
export default function LoadMoreButton({
label,
onClick,
loading,
style,
...props
}) {
return (
<ErrorBoundary>
<div
className={css`
width: 100%;
display: flex;
align-items: center;
justify-content: center;
`}
>
<Button disabled={loading} onClick={onClick} style={style} {...props}>
{loading ? 'Loading' : label || 'Load More'}
{loading && (
<Icon style={{ marginLeft: '0.7rem' }} icon="spinner" pulse />
)}
</Button>
</div>
</ErrorBoundary>
);
}
|
src/Parser/Core/Modules/Items/GnawedThumbRing.js | mwwscott0/WoWAnalyzer | import React from 'react';
import ITEMS from 'common/ITEMS';
import SPELLS from 'common/SPELLS_OTHERS';
import Module from 'Parser/Core/Module';
import calculateEffectiveHealing from 'Parser/Core/calculateEffectiveHealing';
import Combatants from 'Parser/Core/Modules/Combatants';
const GNAWED_THUMB_RING_HEALING_INCREASE = 0.05;
const GNAWED_THUMB_RING_DAMAGE_INCREASE = 0.05;
class GnawedThumbRing extends Module {
static dependencies = {
combatants: Combatants,
};
healing = 0;
damage = 0;
on_initialized() {
this.active = this.combatants.selected.hasFinger(ITEMS.GNAWED_THUMB_RING.id);
}
on_byPlayer_heal(event) {
const spellId = event.ability.guid;
if (this.owner.constructor.abilitiesAffectedByHealingIncreases.indexOf(spellId) === -1) {
return;
}
if (this.combatants.selected.hasBuff(SPELLS.GNAWED_THUMB_RING.id)) {
this.healing += calculateEffectiveHealing(event, GNAWED_THUMB_RING_HEALING_INCREASE);
}
}
on_byPlayer_damage(event) {
if (this.combatants.selected.hasBuff(SPELLS.GNAWED_THUMB_RING.id)) {
this.damage += event.amount - (event.amount / (1 + GNAWED_THUMB_RING_DAMAGE_INCREASE));
}
}
item() {
return {
item: ITEMS.GNAWED_THUMB_RING,
result: (
<dfn data-tip={`The effective healing and damage contributed by Gnawed Thumb Ring.<br/>
Damage: ${this.owner.formatItemDamageDone(this.damage)} <br/>
Healing: ${this.owner.formatItemHealingDone(this.healing)}`}
>
{this.healing > this.damage ? this.owner.formatItemHealingDone(this.healing) : this.owner.formatItemDamageDone(this.damage)}
</dfn>
),
};
}
}
export default GnawedThumbRing;
|
MARVELous/client/src/js/components/characterSelect/characterList.js | nicksenger/StackAttack2017 | import React from 'react';
import CharacterScroller from '../characterScroller/index';
const CharacterList = (props) => (
<article>
<header>
<h2>Select a character:</h2>
</header>
<CharacterScroller characters={props.characters} />
</article>
);
export default CharacterList;
|
src/App/demo2/routes/app.js | zhouyi318/dva-multiple-entry-demo | import React from 'react';
import { connect } from 'dva';
import Count from '../components/Count';
// import styles from './app.less';
function App(props) {
return (
<div>
{ /* models 传给组件 */ }
<Count props={ props } />
</div>
)
}
// 将数据吐出给组件props
function mapStateToProps(state) {
return {
...state
}
}
App.propTypes = {};
// 用 connect 将数据和组件链接
export default connect(mapStateToProps)(App);
|
src/client/search/SearchResultEmptyMessage.js | busyorg/busy | import React from 'react';
import { FormattedMessage } from 'react-intl';
const SearchResultEmptyMessage = () => (
<div className="Search__message-container">
<FormattedMessage
id="no_search_results_found"
defaultMessage="No results were found for your search."
/>
</div>
);
export default SearchResultEmptyMessage;
|
packages/react-devtools-shell/src/app/InspectableElements/CustomObject.js | flarnie/react | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import React from 'react';
class Custom {
_number = 42;
get number() {
return this._number;
}
}
export default function CustomObject() {
return <ChildComponent customObject={new Custom()} />;
}
function ChildComponent(props: any) {
return null;
}
|
app/components/Editor.js | christianalfoni/TeachKidsCode | import React from 'react';
import {Mixin} from 'cerebral-react-immutable-store';
import MTRC from 'markdown-to-react-components';
import {
Row,
Col,
Input,
Button
} from 'react-bootstrap';
MTRC.configure({});
const TextareaStyle = {
outline: 'none',
width: '100%',
height: 'calc(100% - 49px)',
resize: 'none',
padding: 10,
border: '1px solid #DDD',
borderRadius: 3
};
const PreviewStyle = {
overflowY: 'scroll',
height: '100%',
border: '1px solid #DDD',
borderRadius: 3,
padding: 10
};
const Editor = React.createClass({
mixins: [Mixin],
getStatePaths() {
return {
isSaving: ['isSaving'],
file: ['file']
};
},
getInitialState() {
return {
markdown: null
};
},
componentDidMount() {
if (this.state.file.content) {
this.setState({
markdown: MTRC(this.state.file.content).tree
});
}
},
componentWillUpdate(nextProps, nextState) {
if (nextState.file.content !== this.state.file.content) {
this.setState({
markdown: MTRC(nextState.file.content).tree
});
}
},
render() {
return (
<Row className='show-grid' style={{height: '100%'}}>
<Col md={6} style={PreviewStyle}>
{this.state.markdown}
</Col>
<Col md={6} style={{height: '100%'}}>
<Row>
<Col md={8}>
<Input
type="text"
placeholder="Insert filename..."
addonAfter=".md"
value={this.state.file.name.replace('.md', '')}
disabled={this.state.isSaving}
onChange={(e) => this.signals.fileNameChanged(true, {fileName: e.target.value})}/>
</Col>
<Col md={4}>
<Button
className="pull-right"
bsStyle="success"
style={{marginLeft: 10}}
disabled={!this.state.file.content.length || !this.state.file.name.length || this.state.isSaving}
onClick={() => this.signals.saveClicked()}>Save</Button>
<Button
className="pull-right"
bsStyle="primary"
disabled={this.state.isSaving}
onClick={() => this.signals.publishClicked()}>Publish</Button>
</Col>
</Row>
<textarea
style={TextareaStyle}
disabled={this.state.isSaving}
onChange={(e) => this.signals.fileContentChanged(true, {fileContent: e.target.value})}
value={this.state.file.content}/>
</Col>
</Row>
);
}
});
export default Editor;
|
Mr.Mining/MikeTheMiner/Santas_helpers/Sia_wallet/resources/app/plugins/Files/js/components/searchfield.js | patel344/Mr.Miner | import PropTypes from 'prop-types'
import React from 'react'
const SearchField = ({searchText, path, actions}) => {
const onSearchChange = (e) => actions.setSearchText(e.target.value, path)
return (
<div className="search-field">
<input value={searchText} autoFocus onChange={onSearchChange} />
<i className="fa fa-search" />
</div>
)
}
SearchField.propTypes = {
searchText: PropTypes.string.isRequired,
path: PropTypes.string.isRequired,
}
export default SearchField
|
test/test_helper.js | auldsyababua/react-tube | import _$ from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import jsdom from 'jsdom';
import chai, { expect } from 'chai';
import chaiJquery from 'chai-jquery';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from '../src/reducers';
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = global.document.defaultView;
global.navigator = global.window.navigator;
const $ = _$(window);
chaiJquery(chai, chai.util, $);
function renderComponent(ComponentClass, props = {}, state = {}) {
const componentInstance = TestUtils.renderIntoDocument(
<Provider store={createStore(reducers, state)}>
<ComponentClass {...props} />
</Provider>
);
return $(ReactDOM.findDOMNode(componentInstance));
}
$.fn.simulate = function(eventName, value) {
if (value) {
this.val(value);
}
TestUtils.Simulate[eventName](this[0]);
};
export {renderComponent, expect};
|
stories/Combobox/AutoCompleteComboboxDemo.js | propertybase/react-lds | import React, { Component } from 'react';
import { without } from 'lodash-es';
import { BASE_ITEMS } from './constants';
import { AutoCompleteCombobox } from '../../src';
const mockItems = BASE_ITEMS.map((item, i) => ({
...item,
isDisabled: i === 2,
}));
export class AutoCompleteComboboxDemo extends Component {
static getDerivedStateFromProps = (props, state) => {
const { isMultiSelect } = props;
const { selection } = state;
if (!isMultiSelect && selection.length > 1) return { selection: [].concat(selection[0]) };
return null;
}
state = {
isOpen: false,
items: mockItems,
selection: [],
search: '',
}
onSelect = (id, { isReplace, isRemove }) => {
if (isReplace) {
this.setState({
selection: [].concat(id),
});
} else if (isRemove) {
this.setState(({ selection: prevSelection }) => ({
selection: without(prevSelection, id),
}));
} else {
this.setState(({ selection: prevSelection }) => ({
selection: [...prevSelection, id],
}));
}
}
onToggle = (nextOpen) => {
this.setState({ isOpen: nextOpen });
}
onSearch = (val) => {
this.setState({ search: val });
}
render() {
const {
isOpen,
items,
search,
selection,
} = this.state;
const filteredItems = search.length < 2
? items
: items.filter(({ isHeader, label }) => isHeader || label.toLowerCase().includes(search.toLowerCase()));
const selectedItems = selection.map((id) => {
const existingItem = items.find(item => item.id === id);
return existingItem || { label: id, id };
});
return (
<AutoCompleteCombobox
{...this.props}
isOpen={isOpen}
items={filteredItems}
onSearch={this.onSearch}
onSelect={this.onSelect}
onToggle={this.onToggle}
search={search}
selectedItems={selectedItems}
/>
);
}
}
|
js/barber/ScheduleBuilder.js | BarberHour/barber-hour | import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
StatusBar,
TextInput,
Switch,
TimePickerAndroid,
ScrollView,
ActivityIndicator,
Platform,
Modal,
DatePickerIOS
} from 'react-native';
import dismissKeyboard from 'dismissKeyboard';
import { connect } from 'react-redux';
import Toolbar from '../common/Toolbar';
import Button from '../common/Button';
import WaitReview from './WaitReview';
import formStyle from '../forms/style';
import {
createScheduleTemplates,
toggleScheduleTemplate,
changeScheduleTemplateTime,
addError,
getScheduleTemplates,
changeAverageServiceTime
} from '../actions/scheduleTemplates';
class ScheduleBuilder extends Component {
constructor(props) {
super(props);
var date = new Date();
date.setMinutes(0);
this.state = {
modalVisible: false,
date: date,
weekday: null,
field: null
};
}
_createScheduleTemplates() {
var active = this.props.form.scheduleTemplates.filter(scheduleTemplate => scheduleTemplate.active);
if (active.length) {
var scheduleTemplates = this.props.form.scheduleTemplates.map(scheduleTemplate => {
return {
id: scheduleTemplate.id,
weekday: scheduleTemplate.weekday,
active: scheduleTemplate.active,
opens_at: scheduleTemplate.opensAt.value,
closes_at: scheduleTemplate.closesAt.value,
lunch_starts_at: scheduleTemplate.lunchStartsAt.value,
lunch_ends_at: scheduleTemplate.lunchEndsAt.value
}
});
var averageServiceTime = this.props.form.averageServiceTime.value;
var data = {
schedule_templates_attributes: scheduleTemplates,
average_service_time: averageServiceTime
};
this.props.dispatch(createScheduleTemplates(data, this.props.edit));
} else {
this.props.dispatch(addError());
}
}
componentDidMount() {
if (this.props.edit) {
this.props.dispatch(getScheduleTemplates());
}
}
componentDidUpdate() {
if (this.props.form.success) {
if (this.props.edit) {
this.props.navigator.pop();
} else {
const route = {
component: WaitReview,
title: 'Barber Hour'
};
this.props.navigator.replace(route);
}
}
}
toggleScheduleTemplate(weekday, value) {
this.props.dispatch(toggleScheduleTemplate(weekday, value));
}
updateTime(weekday, field, time) {
this.props.dispatch(changeScheduleTemplateTime(weekday, field, time));
}
changeAverageServiceTime(averageServiceTime) {
this.props.dispatch(changeAverageServiceTime(averageServiceTime));
}
showPicker(weekday, field) {
dismissKeyboard();
if (Platform.OS === 'ios') {
this.showIOSPicker(weekday, field);
} else {
this.showAndroidPicker(weekday, field);
}
}
showIOSPicker(weekday, field) {
this.setState({modalVisible: true, weekday: weekday, field: field});
}
selectTime() {
var {weekday, field, date} = this.state;
var [hour, minutes] = date.toTimeString().split(':');
this.updateTime(weekday, field, `${hour}:${minutes}`);
this.setState({modalVisible: false, weekday: null, field: null});
}
async showAndroidPicker(weekday, field) {
try {
const {action, minute, hour} = await TimePickerAndroid.open({is24Hour: true});
if (action === TimePickerAndroid.timeSetAction) {
this.updateTime(weekday, field, this._formatTime(hour, minute));
}
} catch ({code, message}) {
}
}
_formatTime(hour, minute) {
return hour + ':' + (minute < 10 ? '0' + minute : minute);
}
_getButtonLabel() {
if (this.props.edit) {
return this.props.form.isLoading ? 'Alterando...' : 'Alterar';
} else {
return this.props.form.isLoading ? 'Cadastrando...' : 'Avançar';
}
}
render() {
var errorMessage;
if (this.props.form.error) {
errorMessage = <Text style={formStyle.errorBlock}>Por favor, selecione pelo menos um dia.</Text>;
}
var content;
if (this.props.form.isRequestingInfo) {
content = <ActivityIndicator size='small' />;
}
var toolbarContent;
if (this.props.edit) {
toolbarContent = <Toolbar backIcon navigator={this.props.navigator} />;
}
var modalContent;
if (Platform.OS === 'ios') {
modalContent = (
<Modal
transparent={false}
visible={this.state.modalVisible}
animationType='slide'>
<View style={styles.container}>
<View style={styles.innerContainer}>
<Text style={styles.title}>Selecione o horário:</Text>
<DatePickerIOS
mode='time'
date={this.state.date}
onDateChange={(date) => this.setState({date: date})}
minuteInterval={30}/>
<Button
text='OK'
containerStyle={styles.button}
onPress={this.selectTime.bind(this)} />
</View>
</View>
</Modal>
);
}
var isLoading = this.props.form.isLoading || this.props.form.isRequestingInfo;
return(
<View style={styles.container}>
<ScrollView automaticallyAdjustContentInsets={false}>
<StatusBar backgroundColor='#C5C5C5' networkActivityIndicatorVisible={isLoading} />
{toolbarContent}
{modalContent}
<View style={styles.innerContainer}>
<Text style={styles.title}>Agenda semanal</Text>
<Text style={styles.info}>Selecione os dias e horários que você trabalha:</Text>
{content}
<View style={styles.formContainer}>
<View style={[styles.row, styles.item]}>
<Text style={styles.info}>Duração média de serviço:</Text>
<TextInput
style={[formStyle.textbox.normal, styles.averageServiceTimeInput]}
placeholder='horas:minutos'
onChangeText={(text) => {this.changeAverageServiceTime(text)}}
value={this.props.form.averageServiceTime.value}
maxLength={5}
editable={!isLoading} />
</View>
{this.props.form.averageServiceTime.error ? (
<Text style={[formStyle.errorBlock, {textAlign: 'right'}]}>{this.props.form.averageServiceTime.error}</Text>
) : <View />}
<Text style={formStyle.helpBlock.normal}>Use o formato: horas:minutos</Text>
{this.props.form.scheduleTemplates.map((scheduleTemplate) => {
var time = scheduleTemplate.active ? (
<View style={styles.time}>
<TextInput
style={formStyle.textbox.normal}
placeholder='abre às'
value={scheduleTemplate.opensAt.value}
editable={!isLoading}
maxLength={5}
onFocus={() => {this.showPicker(scheduleTemplate.weekday, 'opensAt')}} />
{scheduleTemplate.opensAt.error ? (
<Text style={formStyle.errorBlock}>{scheduleTemplate.opensAt.error}</Text>
) : <View />}
<TextInput
style={formStyle.textbox.normal}
placeholder='almoço às'
value={scheduleTemplate.lunchStartsAt.value}
editable={!isLoading}
maxLength={5}
onFocus={() => {this.showPicker(scheduleTemplate.weekday, 'lunchStartsAt')}} />
{scheduleTemplate.lunchStartsAt.error ? (
<Text style={formStyle.errorBlock}>{scheduleTemplate.lunchStartsAt.error}</Text>
) : <View />}
<TextInput
style={formStyle.textbox.normal}
placeholder='fim do almoço'
value={scheduleTemplate.lunchEndsAt.value}
editable={!isLoading}
maxLength={5}
onFocus={() => {this.showPicker(scheduleTemplate.weekday, 'lunchEndsAt')}} />
{scheduleTemplate.lunchEndsAt.error ? (
<Text style={formStyle.errorBlock}>{scheduleTemplate.lunchEndsAt.error}</Text>
) : <View />}
<TextInput
style={formStyle.textbox.normal}
placeholder='fecha às'
value={scheduleTemplate.closesAt.value}
editable={!isLoading}
maxLength={5}
onFocus={() => {this.showPicker(scheduleTemplate.weekday, 'closesAt')}} />
{scheduleTemplate.closesAt.error ? (
<Text style={formStyle.errorBlock}>{scheduleTemplate.closesAt.error}</Text>
) : <View />}
</View>
) : <View />;
return(
<View key={scheduleTemplate.weekday} style={[styles.row, styles.item]}>
<Text style={styles.name}>{scheduleTemplate.name}</Text>
<Switch
style={styles.toggle}
onValueChange={(value) => {this.toggleScheduleTemplate(scheduleTemplate.weekday, value)}}
disabled={isLoading}
onTintColor='#004575'
value={scheduleTemplate.active} />
{time}
</View>
)
})}
</View>
{errorMessage}
<Button
containerStyle={styles.button}
text={this._getButtonLabel()}
disabled={isLoading}
onPress={this._createScheduleTemplates.bind(this)} />
</View>
</ScrollView>
</View>
);
}
}
function select(store) {
return {
form: store.scheduleTemplates
};
}
export default connect(select)(ScheduleBuilder);
var styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
backgroundColor: 'white',
marginTop: Platform.OS === 'ios' ? 55 : 0
},
innerContainer: {
padding: 20,
},
title: {
fontSize: 24,
textAlign: 'center'
},
info: {
fontSize: 16,
textAlign: 'center'
},
button: {
marginTop: 20
},
formContainer: {
marginTop: 10
},
row: {
flexDirection: 'row',
alignItems: 'center',
},
name: {
fontSize: 16,
flex: .4,
},
time: {
flex: .4,
},
toggle: {
marginBottom: Platform.OS === 'ios' ? 5 : 0,
marginRight: Platform.OS === 'ios' ? 5 : 0
},
averageServiceTimeInput: {
flex: .2,
marginLeft: 5
},
item: {
borderColor: '#DCDCDC',
borderBottomWidth: 1,
marginBottom: 5
}
});
|
src/svg-icons/action/invert-colors.js | ichiohta/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionInvertColors = (props) => (
<SvgIcon {...props}>
<path d="M17.66 7.93L12 2.27 6.34 7.93c-3.12 3.12-3.12 8.19 0 11.31C7.9 20.8 9.95 21.58 12 21.58c2.05 0 4.1-.78 5.66-2.34 3.12-3.12 3.12-8.19 0-11.31zM12 19.59c-1.6 0-3.11-.62-4.24-1.76C6.62 16.69 6 15.19 6 13.59s.62-3.11 1.76-4.24L12 5.1v14.49z"/>
</SvgIcon>
);
ActionInvertColors = pure(ActionInvertColors);
ActionInvertColors.displayName = 'ActionInvertColors';
ActionInvertColors.muiName = 'SvgIcon';
export default ActionInvertColors;
|
docs/src/app/components/pages/components/CircularProgress/ExampleSimple.js | verdan/material-ui | import React from 'react';
import CircularProgress from 'material-ui/CircularProgress';
const CircularProgressExampleSimple = () => (
<div>
<CircularProgress />
<CircularProgress size={60} thickness={7} />
<CircularProgress size={80} thickness={5} />
</div>
);
export default CircularProgressExampleSimple;
|
src/svg-icons/social/sentiment-satisfied.js | nathanmarks/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let SocialSentimentSatisfied = (props) => (
<SvgIcon {...props}>
<circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm0-4c-1.48 0-2.75-.81-3.45-2H6.88c.8 2.05 2.79 3.5 5.12 3.5s4.32-1.45 5.12-3.5h-1.67c-.7 1.19-1.97 2-3.45 2z"/>
</SvgIcon>
);
SocialSentimentSatisfied = pure(SocialSentimentSatisfied);
SocialSentimentSatisfied.displayName = 'SocialSentimentSatisfied';
SocialSentimentSatisfied.muiName = 'SvgIcon';
export default SocialSentimentSatisfied;
|
react/features/device-selection/components/DeviceSelectionDialog.js | KalinduDN/kalindudn.github.io | import React, { Component } from 'react';
import { connect } from 'react-redux';
import {
setAudioInputDevice,
setAudioOutputDevice,
setVideoInputDevice
} from '../../base/devices';
import { hideDialog } from '../../base/dialog';
import DeviceSelectionDialogBase from './DeviceSelectionDialogBase';
/**
* React component for previewing and selecting new audio and video sources.
*
* @extends Component
*/
class DeviceSelectionDialog extends Component {
/**
* DeviceSelectionDialog component's property types.
*
* @static
*/
static propTypes = {
/**
* All known audio and video devices split by type. This prop comes from
* the app state.
*/
_availableDevices: React.PropTypes.object,
/**
* Device id for the current audio input device. This device will be set
* as the default audio input device to preview.
*/
currentAudioInputId: React.PropTypes.string,
/**
* Device id for the current audio output device. This device will be
* set as the default audio output device to preview.
*/
currentAudioOutputId: React.PropTypes.string,
/**
* Device id for the current video input device. This device will be set
* as the default video input device to preview.
*/
currentVideoInputId: React.PropTypes.string,
/**
* Whether or not the audio selector can be interacted with. If true,
* the audio input selector will be rendered as disabled. This is
* specifically used to prevent audio device changing in Firefox, which
* currently does not work due to a browser-side regression.
*/
disableAudioInputChange: React.PropTypes.bool,
/**
* True if device changing is configured to be disallowed. Selectors
* will display as disabled.
*/
disableDeviceChange: React.PropTypes.bool,
/**
* Invoked to notify the store of app state changes.
*/
dispatch: React.PropTypes.func,
/**
* Function that checks whether or not a new audio input source can be
* selected.
*/
hasAudioPermission: React.PropTypes.func,
/**
* Function that checks whether or not a new video input sources can be
* selected.
*/
hasVideoPermission: React.PropTypes.func,
/**
* If true, the audio meter will not display. Necessary for browsers or
* configurations that do not support local stats to prevent a
* non-responsive mic preview from displaying.
*/
hideAudioInputPreview: React.PropTypes.bool,
/**
* Whether or not the audio output source selector should display. If
* true, the audio output selector and test audio link will not be
* rendered. This is specifically used for hiding audio output on
* temasys browsers which do not support such change.
*/
hideAudioOutputSelect: React.PropTypes.bool
};
/**
* Implements React's {@link Component#render()}.
*
* @inheritdoc
*/
render() {
const {
currentAudioInputId,
currentAudioOutputId,
currentVideoInputId,
disableAudioInputChange,
disableDeviceChange,
dispatch,
hasAudioPermission,
hasVideoPermission,
hideAudioInputPreview,
hideAudioOutputSelect
} = this.props;
const props = {
availableDevices: this.props._availableDevices,
closeModal: () => dispatch(hideDialog()),
currentAudioInputId,
currentAudioOutputId,
currentVideoInputId,
disableAudioInputChange,
disableDeviceChange,
hasAudioPermission,
hasVideoPermission,
hideAudioInputPreview,
hideAudioOutputSelect,
setAudioInputDevice: id => {
dispatch(setAudioInputDevice(id));
return Promise.resolve();
},
setAudioOutputDevice: id => {
dispatch(setAudioOutputDevice(id));
return Promise.resolve();
},
setVideoInputDevice: id => {
dispatch(setVideoInputDevice(id));
return Promise.resolve();
}
};
return <DeviceSelectionDialogBase { ...props } />;
}
}
/**
* Maps (parts of) the Redux state to the associated DeviceSelectionDialog's
* props.
*
* @param {Object} state - The Redux state.
* @private
* @returns {{
* _availableDevices: Object
* }}
*/
function _mapStateToProps(state) {
return {
_availableDevices: state['features/base/devices']
};
}
export default connect(_mapStateToProps)(DeviceSelectionDialog);
|
client/extensions/woocommerce/woocommerce-services/views/label-settings/label-payment-method.js | Automattic/woocommerce-connect-client | /** @format */
/**
* External dependencies
*/
import React from 'react';
import PropTypes from 'prop-types';
import { localize } from 'i18n-calypso';
/**
* Internal dependencies
*/
import FormCheckbox from 'components/forms/form-checkbox';
import CompactCard from 'components/card/compact';
import PaymentLogo from 'components/payment-logo';
export const getPaymentMethodTitle = ( translate, paymentType, digits ) => {
const supportedTypes = {
amex: translate( 'American Express' ),
discover: translate( 'Discover' ),
mastercard: translate( 'MasterCard' ),
visa: translate( 'VISA' ),
paypal: translate( 'PayPal' ),
};
if ( ! supportedTypes[ paymentType ] ) {
return null;
}
if ( ! digits ) {
return supportedTypes[ paymentType ];
}
return translate( '%(card)s ****%(digits)s', {
args: {
card: supportedTypes[ paymentType ],
digits,
},
} );
};
const PaymentMethod = ( {
translate,
selected,
isLoading,
type,
digits,
name,
expiry,
onSelect,
} ) => {
const renderPlaceholder = () => (
<CompactCard className="label-settings__card">
<FormCheckbox className="label-settings__card-checkbox" />
<PaymentLogo className="label-settings__card-logo" type="placeholder" altText={ '' } />
<div className="label-settings__card-details">
<p className="label-settings__card-number" />
<p className="label-settings__card-name" />
</div>
<div className="label-settings__card-date">
<p />
</div>
</CompactCard>
);
if ( isLoading ) {
return renderPlaceholder();
}
const typeTitle = getPaymentMethodTitle( translate, type, digits );
const typeId = typeTitle ? type : 'placeholder';
const typeName = typeTitle || type;
return (
<CompactCard className="label-settings__card" onClick={ onSelect }>
<FormCheckbox
className="label-settings__card-checkbox"
checked={ selected }
onChange={ onSelect }
/>
<PaymentLogo className="label-settings__card-logo" type={ typeId } altText={ typeTitle } />
<div className="label-settings__card-details">
<p className="label-settings__card-number">{ typeName }</p>
<p className="label-settings__card-name">{ name }</p>
</div>
<div className="label-settings__card-date">
{ translate( 'Expires %(date)s', {
args: { date: expiry },
context: 'date is of the form MM/YY',
} ) }
</div>
</CompactCard>
);
};
PaymentMethod.propTypes = {
selected: PropTypes.bool.isRequired,
isLoading: PropTypes.bool,
type: PropTypes.string,
digits: PropTypes.string,
name: PropTypes.string,
expiry: PropTypes.string,
onSelect: PropTypes.func,
};
export default localize( PaymentMethod );
|
benchmarks/src/implementations/radium/Dot.js | rofrischmann/fela | /* eslint-disable react/prop-types */
import Radium from 'radium';
import React from 'react';
const Dot = ({ size, x, y, children, color }) => (
<div
style={[
styles.root,
{
borderBottomColor: color,
borderRightWidth: `${size / 2}px`,
borderBottomWidth: `${size / 2}px`,
borderLeftWidth: `${size / 2}px`,
marginLeft: `${x}px`,
marginTop: `${y}px`
}
]}
>
{children}
</div>
);
const styles = {
root: {
position: 'absolute',
cursor: 'pointer',
width: 0,
height: 0,
borderColor: 'transparent',
borderStyle: 'solid',
borderTopWidth: 0,
transform: 'translate(50%, 50%)'
}
};
export default Radium(Dot);
|
src/main.js | mikearnaldi/react-starter | import 'rxjs/add/operator/filter'
import 'rxjs/add/operator/map'
import 'rxjs/add/operator/debounce'
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import { AppContainer } from 'react-hot-loader'
import store from './redux/store'
import App from './App'
import Wrapper from './router/wrapper'
const MOUNT_NODE = document.getElementById('root')
ReactDOM.render(
<AppContainer>
<Provider store={store}><Wrapper><App /></Wrapper></Provider>
</AppContainer>, MOUNT_NODE)
if (process.env.NODE_ENV === 'development') {
if (module.hot) {
module.hot.accept('./App', () => {
const NextApp = require('./App').default;
ReactDOM.render(
<AppContainer>
<Provider store={store}><Wrapper><NextApp /></Wrapper></Provider>
</AppContainer>, MOUNT_NODE)
})
}
if (window.devToolsExtension) {
window.devToolsExtension.open()
}
}
|
frontend/modules/recipe/components/Directions.js | rustymyers/OpenEats | import React from 'react'
import PropTypes from 'prop-types'
const Directions = ({ data }) => {
let directions = [];
data.split("\n").map((direction, i) => {
if (direction.length > 0) {
directions.push(
<li className="direction" key={ i }>
{ direction }
</li>
);
}
});
return (
<ol className="directions" >
{ directions }
</ol>
);
};
Directions.PropTypes = {
data: PropTypes.string.isRequired
};
export default Directions;
|
src/svg-icons/alert/add-alert.js | xmityaz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AlertAddAlert = (props) => (
<SvgIcon {...props}>
<path d="M10.01 21.01c0 1.1.89 1.99 1.99 1.99s1.99-.89 1.99-1.99h-3.98zm8.87-4.19V11c0-3.25-2.25-5.97-5.29-6.69v-.72C13.59 2.71 12.88 2 12 2s-1.59.71-1.59 1.59v.72C7.37 5.03 5.12 7.75 5.12 11v5.82L3 18.94V20h18v-1.06l-2.12-2.12zM16 13.01h-3v3h-2v-3H8V11h3V8h2v3h3v2.01z"/>
</SvgIcon>
);
AlertAddAlert = pure(AlertAddAlert);
AlertAddAlert.displayName = 'AlertAddAlert';
AlertAddAlert.muiName = 'SvgIcon';
export default AlertAddAlert;
|
src/layouts/PageLayout/index.js | ligangwolai/blog | import React from 'react'
import PropTypes from 'prop-types'
export default class PageLayout extends React.Component {
render () {
return (
<div>
{this.props.children}
</div>
)
}
}
PageLayout.propTypes = {
children: PropTypes.any
}
|
src/react/AdminPanel.js | laundree/laundree | // @flow
import React from 'react'
import { Link } from 'react-router-dom'
import sdk from '../client/sdk'
import { FormattedMessage } from 'react-intl'
import Switch from './Switch'
import Debug from 'debug'
import type { Stats, Laundry, User, State } from 'laundree-sdk/lib/redux'
import type { ListOptions } from 'laundree-sdk/lib/sdk'
import { connect } from 'react-redux'
import { Meta } from './intl'
const debug = Debug('laundree.react.AdminPanel')
class StatsComponent extends React.Component<{ stats: ?Stats }> {
componentDidMount () {
sdk.updateStats()
}
renderStats () {
const {realLaundryCount, realUserCount, demoUserCount, demoLaundryCount, machineCount, bookingCount} = this.stats()
return <ul className={this.props.stats ? '' : 'loading'}>
<li>
<span className='value'>{realUserCount}</span>
<span className='label'>
<FormattedMessage id='admin-panel.users' />
</span>
</li>
<li>
<span className='value'>{demoUserCount}</span>
<span className='label'>
<FormattedMessage id='admin-panel.demo-users' />
</span>
</li>
<li>
<span className='value'>{realLaundryCount}</span>
<span className='label'>
<FormattedMessage id='admin-panel.laundries' />
</span>
</li>
<li>
<span className='value'>{demoLaundryCount}</span>
<span className='label'>
<FormattedMessage id='admin-panel.demo-laundries' />
</span>
</li>
<li>
<span className='value'>{machineCount}</span>
<span className='label'>
<FormattedMessage id='admin-panel.machines' />
</span>
</li>
<li>
<span className='value'>{bookingCount}</span>
<span className='label'>
<FormattedMessage id='admin-panel.bookings' />
</span>
</li>
</ul>
}
stats () {
if (!this.props.stats) return {}
const {laundryCount, demoLaundryCount, userCount, demoUserCount} = this.props.stats
return {
...this.props.stats,
realLaundryCount: laundryCount - demoLaundryCount,
realUserCount: userCount - demoUserCount
}
}
render () {
return <section id='Stats'>
<FormattedMessage id='admin-panel.stats-title' tagName='h2' />
{this.renderStats()}
</section>
}
}
class QueryList<T: { id: string }> extends React.Component<{
elements: T[],
totalDemo: ?number,
total: ?number
},
{ loaded: boolean, page: number, q: ? string, demoOn: boolean }> {
limit = 10
state = {
loaded: false,
page: 0,
q: null,
demoOn: false
}
updateFilter (q: ?string) {
this.setState({q}, () => this._load())
}
componentDidMount () {
this._load()
}
prev () {
if (this.currentPage() === 0) return
this.setState({page: this.currentPage() - 1}, () => this._load())
}
next () {
if (this.currentPage() === this.totalPages()) return
this.setState({page: this.currentPage() + 1}, () => this._load())
}
load (options) {
throw new Error('Not implemented')
}
_load () {
const config = {
q: this.state.q || undefined,
showDemo: this.state.demoOn,
limit: this.limit,
skip: this.limit * this.currentPage()
}
debug('Loading', config)
return this
.load(config)
.then(() => this.setState({loaded: true, page: this.currentPage()}))
}
renderLoading () {
throw new Error('Not implemented')
}
renderEmpty () {
throw new Error('Not implemented')
}
renderElement (elm: T) {
throw new Error('Not implemented')
}
currentPage () {
return Math.max(0, Math.min(this.state.page, this.totalPages()))
}
totalPages () {
if (typeof this.props.total !== 'number') {
return 0
}
if (typeof this.props.totalDemo !== 'number') {
return 0
}
return Math.max(0, Math.floor(((this.state.demoOn ? this.props.total : this.props.total - this.props.totalDemo) - 1) / this.limit))
}
toggleDemo (on) {
this.setState({demoOn: on}, () => this._load())
}
renderList () {
if (!this.state.loaded) {
return <div className='bigListMessage'>
{this.renderLoading()}
</div>
}
return <div>
<div className='nav'>
<span className={'prev link' + (this.currentPage === 0 ? ' inactive' : '')} onClick={() => this.prev()} />
<FormattedMessage
id='admin-panel.page-of'
values={{
page: this.currentPage() + 1,
numPages: this.totalPages() + 1
}}
/>
<span
className={'next link' + (this.currentPage() === this.totalPages() ? ' inactive' : '')}
onClick={() => this.next()} />
</div>
<div className='filter'>
<label>
<input
type='text' placeholder='Filter' value={this.state.q || ''}
onChange={({target: {value}}) => this.updateFilter(value)} />
</label>
<div className='demoSwitch'>
<Switch onChange={demoOn => this.toggleDemo(demoOn)} on={this.state.demoOn} />
<FormattedMessage id='admin-panel.show-demo' />
</div>
</div>
{this.props.elements.length
? <ul className='bigList'>
{this.props.elements.map(element => <li key={element.id}>{this.renderElement(element)}</li>)}
</ul>
: <div className='bigListMessage'>
{this.renderEmpty()}
</div>}
</div>
}
}
class LaundryList extends QueryList<Laundry> {
renderLoading () {
return <FormattedMessage id='admin-panel.loading' />
}
renderEmpty () {
return <FormattedMessage id='admin-panel.no-laundries' />
}
renderElement (l: Laundry) {
return <div className='name'>
<Link to={`/laundries/${l.id}`}>
{l.name}
</Link>
</div>
}
load (options: ListOptions) {
return sdk.listLaundries(options)
}
render () {
return <section id='LaundryList'>
<FormattedMessage id='admin-panel.laundries' tagName='h2' />
{this.renderList()}
</section>
}
}
class UserList extends QueryList<User> {
load (options: ListOptions) {
return sdk.listUsers(options)
}
renderLoading () {
return <FormattedMessage id='admin-panel.loading' />
}
renderEmpty () {
return <FormattedMessage id='admin-panel.no-users' />
}
renderElement ({id, photo, displayName}: User) {
return <div className='name'>
<Link to={`/users/${id}/settings`}>
<img src={photo} className='avatar' />
{displayName}
</Link>
</div>
}
render () {
return <section id='UserList'>
<FormattedMessage id='admin-panel.users' tagName='h2' />
{this.renderList()}
</section>
}
}
type AdminPanelProps = {
stats: ?Stats,
laundries: { [string]: Laundry },
users: { [string]: User },
userList: string[],
laundryList: string[]
}
const AdminPanel = ({stats, laundries, users, userList, laundryList}: AdminPanelProps) => {
const ls: Laundry[] = laundryList.map(id => laundries[id]).filter((l: ?Laundry) => l)
const us: User[] = userList.map(id => users[id]).filter(u => u)
return (
<main id='AdminPanel' className='topNaved'>
<Meta title='document-title.administrator-panel' />
<FormattedMessage id='admin-panel.title' tagName='h1' />
<StatsComponent stats={stats} />
<LaundryList elements={ls} totalDemo={stats && stats.demoLaundryCount} total={stats && stats.laundryCount} />
<UserList elements={us} totalDemo={stats && stats.demoUserCount} total={stats && stats.userCount} />
</main>)
}
export default connect(({users, userList, stats, laundries, laundryList}: State, _: {}): AdminPanelProps => ({
stats,
laundries,
users,
userList,
laundryList
}))(AdminPanel)
|
src/js/redux/components/TodoApp.js | daigof/react-redux | import React from 'react'
import Footer from './Footer'
import AddTodo from '../containers/AddTodo'
import VisibleTodoList from '../containers/VisibleTodoList'
const TodoApp = () => (
<div className='panel panel-default'>
<div className='panel-heading'>Todo App</div>
<div className='panel-body'>
<AddTodo/>
<VisibleTodoList/>
<Footer/>
</div>
</div>
)
export default TodoApp
|
mine-data/src/LoginForm/LoginForm.js | BerlingskeMedia/nyhedsbreveprofil | import React from 'react';
import {connect} from 'react-redux';
import {login, resetLogin, setPassword, setUsername} from './login.actions';
import SubmitButton from '../SubmitButton/SubmitButton';
import {Link} from 'react-router-dom';
import {FormInput} from '../Form/FormInput';
import {LogoutLink} from '../logout/LogoutLink';
import {
fetchVerifyUser,
resetVerifyUser
} from '../VerifyUserPage/verifyUser.actions';
import {Modal, ModalBody, ModalFooter} from "reactstrap";
export class LoginDisconnected extends React.Component {
constructor(props) {
super(props);
this.setPassword = this.setPassword.bind(this);
this.setUsername = this.setUsername.bind(this);
this.submit = this.submit.bind(this);
this.toggleModal = this.toggleModal.bind(this);
this.submitModal = this.submitModal.bind(this);
this.state = {showModal: false}
}
componentWillMount() {
if (this.props.userInfo.userInfo && this.props.userInfo.userInfo.profile) {
this.props.setUsername(this.props.userInfo.userInfo.profile.email);
}
}
componentWillUnmount() {
this.props.resetLogin();
this.props.resetVerifyUser();
}
translateError(errorResponse) {
if (errorResponse.errorCode === 403042) {
return 'Forkert kodeord eller bruger';
}
return errorResponse.errorDetails;
}
setPassword(e) {
this.props.setPassword(e.target.value);
}
setUsername(e) {
this.props.setUsername(e.target.value);
}
submit(e) {
e.preventDefault();
if (this.props.userInfo.userInfo && this.props.userInfo.userInfo.profile) {
this.props.fetchVerifyUser(this.props.password);
} else {
this.props.login({
username: this.props.username,
password: this.props.password
}).then(response => {
if (response && response.errorCode === 206002) {
this.setState({showModal: true});
}
});
}
}
submitModal() {
gigya.accounts.resendVerificationCode({
regToken: this.props.response.regToken,
email: this.props.username
});
this.toggleModal();
}
toggleModal() {
this.setState({ showModal: false });
}
render() {
const {userInfo, username, pending, password, response, verifyUser} = this.props;
const isPending = pending || verifyUser.isPending;
const isLoggedIn = !!userInfo.userInfo && !!userInfo.userInfo.profile;
const isMailPending = response && response.errorCode === 206002;
return (
<form className="form" onSubmit={this.submit} autoComplete="off">
<FormInput name="email" type="email" label="E-mailadresse"
value={username} pending={pending}
onChange={this.setUsername} readOnly={isLoggedIn}
hint={isLoggedIn ?
<div>Ikke dig? <LogoutLink>Log ind med en anden konto.</LogoutLink></div> : null}/>
<FormInput name="password" type="password" value={password}
onChange={this.setPassword} pending={isPending}
autoComplete="off"
hint={<Link to="/mine-data/reset-password" className="text-secondary">Glemt adgangskode?</Link>}/>
<div className="row justify-content-center">
<div className="col-sm-6 nav-buttons">
<Link to="/mine-data/register">Opret konto</Link>
<SubmitButton loading={isPending}>Log ind</SubmitButton>
</div>
</div>
{response && !isMailPending ? <div className="row justify-content-center">
<div className="col-sm-6 form-error">{this.translateError(response)}</div>
</div> : null}
<Modal isOpen={this.state.showModal} toggle={this.toggleModal}>
<ModalBody>
For din sikkerhed er der sendt en verifikations-email til dig.<br/>
Følg instruktionerne i e-mailen for at bekræfte din konto.<br/>
<strong>For at sende bekræftelses-e-mailen igen, skal du klikke på Send.</strong>
</ModalBody>
<ModalFooter>
<SubmitButton onClick={this.submitModal}>Send</SubmitButton>
<SubmitButton color="link" onClick={this.toggleModal}>Close</SubmitButton>
</ModalFooter>
</Modal>
{verifyUser.response ? <div className="row justify-content-center">
<div className="col-sm-6 form-error">{this.translateError(verifyUser.response)}</div>
</div> : null}
</form>
);
}
}
const mapStateToProps = ({login, userInfo, verifyUser}) => ({
pending: login.pending,
response: login.response,
username: login.username,
password: login.password,
userInfo,
verifyUser
});
const mapDispatchToProps = (dispatch) => ({
login: (payload) => dispatch(login(payload)),
setUsername: (username) => dispatch(setUsername(username)),
setPassword: (password) => dispatch(setPassword(password)),
resetLogin: () => dispatch(resetLogin()),
fetchVerifyUser: (password) => dispatch(fetchVerifyUser(password)),
resetVerifyUser: () => dispatch(resetVerifyUser())
});
export const LoginForm = connect(mapStateToProps, mapDispatchToProps)(LoginDisconnected);
|
client/components/MapGeometryEditor/index.js | DarkHorseJP/RPGScenarist | import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
class MapGeometryEditor extends React.PureComponent {
render() {
return (
<div className={this.props.className}>
MapGeometryEditor
</div>
)
}
}
MapGeometryEditor.propTypes = {
className: PropTypes.string,
data: PropTypes.object
}
export default MapGeometryEditor
|
docs/src/HomePage.js | pivotal-cf/react-bootstrap | import React from 'react';
import NavMain from './NavMain';
import PageFooter from './PageFooter';
import Grid from '../../src/Grid';
import Alert from '../../src/Alert';
import Glyphicon from '../../src/Glyphicon';
import Label from '../../src/Label';
export default class HomePage extends React.Component{
render() {
return (
<div>
<NavMain activePage="home" />
<main className="bs-docs-masthead" id="content" role="main">
<div className="container">
<span className="bs-docs-booticon bs-docs-booticon-lg bs-docs-booticon-outline"></span>
<p className="lead">The most popular front-end framework, rebuilt for React.</p>
</div>
</main>
<Grid>
<Alert bsStyle='warning'>
<p><Glyphicon glyph='bullhorn' /> We are actively working to reach a 1.0.0 release, and we would love your help to get there.</p>
<p><Glyphicon glyph='check' /> Check out the <a href="https://github.com/react-bootstrap/react-bootstrap/wiki#100-roadmap">1.0.0 Roadmap</a> and <a href="https://github.com/react-bootstrap/react-bootstrap/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> to see where you can help out.</p>
<p><Glyphicon glyph='sunglasses' /> A great place to start is any <a target='_blank' href="https://github.com/react-bootstrap/react-bootstrap/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22">issues</a> with a <Label bsStyle='success'>help-wanted</Label> label.</p>
<p><Glyphicon glyph='ok' /> We are open to pull requests that address bugs, improve documentation, enhance accessibility,</p>
<p>add test coverage, or bring us closer to feature parity with <a target='_blank' href='http://getbootstrap.com/'>Bootstrap</a>.</p>
<p><Glyphicon glyph='user' /> We actively seek to invite frequent pull request authors to join the organization. <Glyphicon glyph='thumbs-up' /></p>
</Alert>
<Alert bsStyle='danger'>
<p><Glyphicon glyph='warning-sign' /> The project is under active development, and APIs will change. </p>
<p><Glyphicon glyph='bullhorn' /> Prior to the 1.0.0 release, breaking changes should result in a Minor version bump.</p>
</Alert>
</Grid>
<PageFooter />
</div>
);
}
}
|
app/containers/WelcomePage.js | soosgit/vessel | // @flow
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import Welcome from '../components/Welcome';
import * as KeyActions from '../actions/keys';
import * as PreferencesActions from '../actions/preferences';
class WelcomePage extends Component {
render() {
return (
<div>
<Welcome
{... this.props}
/>
</div>
);
}
}
function mapStateToProps(state) {
return {
account: state.account,
keys: state.keys,
processing: state.processing,
preferences: state.preferences
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
...KeyActions,
...PreferencesActions
}, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(WelcomePage);
|
src/modules/page1/index.js | mtrabelsi/universal-javascript-boilerplate | import React from 'react'
if(typeof window === "object") {
require('./page.css')
}
const imgUrl = './image1.jpg';
export default React.createClass({
render() {
return <div className="page page1">Page 1 content {(typeof window === "object") && <img src={require(`${imgUrl}`)} />} </div>
}
})
|
app/addons/fauxton/navigation/components/Brand.js | michellephung/couchdb-fauxton | // Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
const Brand = ({isMinimized}) => {
const burgerClasses = classNames(
'faux-navbar__brand-logo',
{'faux-navbar__brand-logo--wide': !isMinimized},
{'faux-navbar__brand-logo--narrow': isMinimized}
);
return (
<div className="faux-navbar__brand">
<div className={burgerClasses}></div>
</div>
);
};
Brand.propTypes = {
isMinimized: PropTypes.bool.isRequired
};
export default Brand;
|
packages/xo-web/src/common/xo/snapshot-vm-modal/index.js | vatesfr/xo-web | import _ from 'intl'
import React from 'react'
import BaseComponent from 'base-component'
import { compileTemplate } from '@xen-orchestra/template'
import { connectStore } from 'utils'
import { Container, Col, Row } from 'grid'
import { createGetObjectsOfType } from 'selectors'
import { forEach } from 'lodash'
const RULES = {
'{date}': () => new Date().toISOString(),
'{description}': vm => vm.name_description,
'{name}': vm => vm.name_label,
}
@connectStore(
{
vms: createGetObjectsOfType('VM').pick((_, props) => props.vms),
},
{ withRef: true }
)
export default class SnapshotVmModalBody extends BaseComponent {
state = {
descriptionPattern: '{description}',
namePattern: '{name}_{date}',
}
get value() {
const { descriptionPattern, namePattern, saveMemory } = this.state
if (namePattern === '' && descriptionPattern === '') {
return { names: {}, descriptions: {}, saveMemory }
}
const generateName = compileTemplate(namePattern, RULES)
const generateDescription = compileTemplate(descriptionPattern, RULES)
const names = {}
const descriptions = {}
forEach(this.props.vms, (vm, id) => {
if (namePattern !== '') {
names[id] = generateName(vm)
}
if (descriptionPattern !== '') {
descriptions[id] = generateDescription(vm)
}
})
return {
descriptions,
names,
saveMemory,
}
}
render() {
return (
<Container>
<Row className='mb-1'>
<Col size={6}>{_('snapshotVmsName')}</Col>
<Col size={6}>
<input
className='form-control'
onChange={this.linkState('namePattern')}
type='text'
value={this.state.namePattern}
/>
</Col>
</Row>
<Row>
<Col size={6}>{_('snapshotVmsDescription')}</Col>
<Col size={6}>
<input
className='form-control'
onChange={this.linkState('descriptionPattern')}
type='text'
value={this.state.descriptionPattern}
/>
</Col>
</Row>
<Row>
<Col>
<label>
<input type='checkbox' onChange={this.linkState('saveMemory')} checked={this.state.saveMemory} />{' '}
{_('snapshotSaveMemory')}
</label>
</Col>
</Row>
</Container>
)
}
}
|
src/components/page-elements/header.js | sunpietro/LeagueManager | import React, { Component } from 'react';
import '../../css/components/page-elements/header.css';
class Header extends Component {
render() {
return (
<header className="component--header">
<h2 className="component--header__subtitle">{this.props.subtitle}</h2>
</header>
);
}
}
Header.PropTypes = {
subtitle: React.PropTypes.string.isRequired,
};
export default Header;
|
src/components/baeder/BaederInfo.js | cismet/wupp-geoportal3-powerboats | import React from 'react';
import PropTypes from 'prop-types';
import InfoBox from '../commons/InfoBox';
import { getColorForProperties } from '../../utils/baederHelper';
import { triggerLightBoxForPOI } from '../../utils/stadtplanHelper';
import { Well } from 'react-bootstrap';
import { Icon } from 'react-fa';
import IconLink from '../commons/IconLink';
// Since this component is simple and static, there's no parent container for it.
const BaederInfo = ({
featureCollection,
items,
selectedIndex,
next,
previous,
fitAll,
loadingIndicator,
showModalMenu,
uiState,
uiStateActions,
linksAndActions,
panelClick,
pixelwidth
}) => {
const currentFeature = featureCollection[selectedIndex];
if (currentFeature) {
let header = `${currentFeature.properties.more.typ} (${currentFeature.properties.more
.betreiber}), ${currentFeature.properties.more.zugang}`;
let adresse = currentFeature.properties.adresse;
if (currentFeature.properties.stadt !== 'Wuppertal') {
adresse += ', ' + currentFeature.properties.stadt;
}
let info = '';
if (currentFeature.properties.info) {
info = currentFeature.properties.info;
}
let links = [];
if (currentFeature.properties.tel) {
links.push(
<IconLink
key={`IconLink.tel`}
tooltip="Anrufen"
href={'tel:' + currentFeature.properties.tel}
iconname="phone"
/>
);
}
if (currentFeature.properties.email) {
links.push(
<IconLink
key={`IconLink.email`}
tooltip="E-Mail schreiben"
href={'mailto:' + currentFeature.properties.email}
iconname="envelope-square"
/>
);
}
if (currentFeature.properties.url) {
links.push(
<IconLink
key={`IconLink.web`}
tooltip="Zur Homepage"
href={currentFeature.properties.url}
target="_blank"
iconname="external-link-square"
/>
);
}
if (currentFeature.properties.more.coursemanager) {
links.push(
<IconLink
key={`IconLink.coursemanager`}
tooltip="Kurs buchen"
href={currentFeature.properties.more.coursemanager}
target="coursemanager"
iconname="calendar"
/>
);
}
let fotoPreview;
if (currentFeature.properties.foto) {
fotoPreview = (
<table style={{ width: '100%' }}>
<tbody>
<tr>
<td style={{ textAlign: 'right', verticalAlign: 'top' }}>
<a
onClick={() => {
triggerLightBoxForPOI(currentFeature, uiStateActions);
}}
hrefx={currentFeature.properties.fotostrecke || currentFeature.properties.foto}
target="_fotos"
>
<img
alt="Bild"
style={{ paddingBottom: '5px' }}
src={currentFeature.properties.foto.replace(
/http:\/\/.*fotokraemer-wuppertal\.de/,
'https://wunda-geoportal-fotos.cismet.de/'
)}
width="150"
/>
</a>
</td>
</tr>
</tbody>
</table>
);
}
return (
<InfoBox
featureCollection={featureCollection}
items={items}
selectedIndex={selectedIndex}
next={next}
previous={previous}
fitAll={fitAll}
loadingIndicator={loadingIndicator}
showModalMenu={showModalMenu}
uiState={uiState}
uiStateActions={uiStateActions}
linksAndActions={linksAndActions}
panelClick={panelClick}
colorize={getColorForProperties}
pixelwidth={pixelwidth}
header={header}
headerColor={getColorForProperties(currentFeature.properties)}
links={links}
title={currentFeature.text}
subtitle={adresse}
additionalInfo={info}
zoomToAllLabel={`${items.length} Bäder in Wuppertal`}
currentlyShownCountLabel={`${featureCollection.length} ${featureCollection.length === 1
? 'Bad'
: 'Bäder'} angezeigt`}
fotoPreview={fotoPreview}
/>
);
} else {
return (
<Well bsSize="small" pixelwidth={250}>
<h5>Keine Bäder gefunden!</h5>
<p>
Für mehr Bäder, Ansicht mit <Icon name="minus-square" /> verkleinern oder mit dem untenstehenden
Link auf das komplette Stadtgebiet zoomen.
</p>
<div align="center">
<a onClick={fitAll}>{items.length} Bäder in Wuppertal</a>
</div>
</Well>
);
}
};
export default BaederInfo;
BaederInfo.propTypes = {
featureCollection: PropTypes.array.isRequired,
filteredPOIs: PropTypes.array.isRequired,
selectedIndex: PropTypes.number.isRequired,
next: PropTypes.func.isRequired,
previous: PropTypes.func.isRequired,
fitAll: PropTypes.func.isRequired,
showModalMenu: PropTypes.func.isRequired,
panelClick: PropTypes.func.isRequired
};
BaederInfo.defaultProps = {
featureCollection: [],
filteredPOIs: [],
selectedIndex: 0,
next: () => {},
previous: () => {},
fitAll: () => {},
showModalMenu: () => {}
};
|
react-router-tutorial/lessons/11-productionish-server/modules/About.js | zerotung/practices-and-notes | import React from 'react'
export default React.createClass({
render() {
return <div>About</div>
}
})
|
src/index.js | lizzyphy/gallery-by-react | import 'core-js/fn/object/assign';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/Main';
//alert('11111111111111');
// Render the main component into the dom
ReactDOM.render(<App />, document.getElementById('app'));
//alert('aaaaaaaaaa');
|
es/components/style/cancel-button.js | vovance/3d-demo | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import Button from './button';
var STYLE = {
borderColor: "#adadad",
backgroundColor: "#e6e6e6"
};
var STYLE_HOVER = {
backgroundColor: "#d4d4d4",
borderColor: "#8c8c8c"
};
export default function CancelButton(_ref) {
var children = _ref.children,
rest = _objectWithoutProperties(_ref, ['children']);
return React.createElement(
Button,
_extends({ style: STYLE, styleHover: STYLE_HOVER }, rest),
children
);
} |
test/integration/prerender/pages/blocking-fallback-once/[slug].js | JeromeFitz/next.js | import React from 'react'
import Link from 'next/link'
import { useRouter } from 'next/router'
export async function getStaticPaths() {
return {
paths: [],
fallback: 'blocking',
}
}
export async function getStaticProps({ params }) {
await new Promise((resolve) => setTimeout(resolve, 1000))
return {
props: {
params,
hello: 'world',
post: params.slug,
random: Math.random(),
time: (await import('perf_hooks')).performance.now(),
},
revalidate: false,
}
}
export default ({ post, time, params }) => {
if (useRouter().isFallback) {
return <p>hi fallback</p>
}
return (
<>
<p>Post: {post}</p>
<span>time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
</Link>
</>
)
}
|
src/app/js/components/Weather.react.js | fcurella/redux-boilerplate | import React from 'react'
import { Address } from '../resources/common'
const Weather = React.createClass({
render() {
const locations = this.props.addresses.map((address, idx) => {
return (
<li key={idx}>
<span>{address.city}, {address.state}</span>
<a href="#" onClick={() => this.props.onSave(address)}>Save</a>
<a href="#" onClick={() => this.props.onRemove({key: idx})}>-</a>
</li>
)
})
let cityAddress
let stateAddress
return (
<div>
<ul>
{locations}
</ul>
<div>
<label htmlFor="city">City</label>
<input id="city" ref={node => {
cityAddress = node
}} />
<label htmlFor="state">State</label>
<input id="state" ref={node => {
stateAddress = node
}} />
<a href="#" onClick={() => {
this.props.onAdd({
city: cityAddress.value,
state: stateAddress.value
})
cityAddress.value = ''
stateAddress.value = ''
}}>+</a>
</div>
</div>
);
}
});
export default Weather
|
src/App.js | guzmonne/conapps-charts | import React, { Component } from 'react';
import logo from './_images/logo.svg';
import './_styles/App.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}
export default App;
|
src/rsg-components/Pathline/PathlineRenderer.js | bluetidepro/react-styleguidist | import React from 'react';
import PropTypes from 'prop-types';
import copy from 'clipboard-copy';
import MdContentCopy from 'react-icons/lib/md/content-copy';
import ToolbarButton from 'rsg-components/ToolbarButton';
import Styled from 'rsg-components/Styled';
export const styles = ({ space, fontFamily, fontSize, color }) => ({
pathline: {
fontFamily: fontFamily.monospace,
fontSize: fontSize.small,
color: color.light,
},
copyButton: {
marginLeft: space[0],
},
});
export function PathlineRenderer({ classes, children }) {
return (
<div className={classes.pathline}>
{children}
<ToolbarButton
small
className={classes.copyButton}
onClick={() => copy(children)}
title="Copy to clipboard"
>
<MdContentCopy />
</ToolbarButton>
</div>
);
}
PathlineRenderer.propTypes = {
classes: PropTypes.object.isRequired,
children: PropTypes.string,
};
export default Styled(styles)(PathlineRenderer);
|
src/client/components/Content.js | hara-io/realtime-react-client | import React from 'react';
import DeviceList from './DeviceList';
import Device from './Device';
class Content extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentWillUnmount() {
}
render() {
return (
<div id="pageContent">
<div id="deviceList">
<DeviceList />
</div>
<div id="deviceConfig">
<Device />
</div>
</div>
);
}
}
export default Content;
|
example/src/client.js | wyze/redux-debounce | import { Provider } from 'react-redux'
import { render } from 'react-dom'
import AppContainer from './containers/AppContainer'
import React from 'react'
import createStore from './redux'
const store = createStore()
render((
<Provider store={store}>
<AppContainer />
</Provider>
), document.getElementById('root'))
|
src/components/posts_show.js | hollymhofer/ReduxForms | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { fetchPost, deletePost } from '../actions';
import { Link } from 'react-router-dom';
class PostsShow extends Component {
componentDidMount() {
const { id } = this.props.match.params; // provided by react router
this.props.fetchPost(id);
}
onDeleteClick() {
const { id } = this.props.match.params; // provided by react router
this.props.deletePost(id, () => {
this.props.history.push('/');
});
}
render() {
const { post } = this.props;
if(!post) {
return <div>Loading...</div>
}
return (
<div>
<Link to="/"> Back To Index</Link>
<button
className="btn btn-danger pull=-xs-right"
onClick={this.onDeleteClick.bind(this)}
>Delete Post</button>
<h3>{post.title}</h3>
<h6>Categories: {post.categories}</h6>
<p>{post.content}</p>
</div>
);
}
}
function mapStateToProps({ posts }, ownProps) {
return { post: posts[ownProps.match.params.id] };
}
export default connect(mapStateToProps, { fetchPost, deletePost })(PostsShow); |
src/interface/icons/Versatility.js | anom0ly/WoWAnalyzer | import React from 'react';
const icon = (props) => (
<svg
xmlns="http://www.w3.org/2000/svg"
version="1.1"
viewBox="16 16 32 32"
className="icon"
{...props}
>
<polygon points="40.128,30.517 43.92,31.535 48.567,26.883 47.893,24.366 44.461,27.802 40.628,26.774 39.601,22.935 43.032,19.499 40.519,18.825 35.873,23.477 36.889,27.275 33.991,30.177 27.422,23.6 29.315,21.705 34.293,19.143 26.654,19.04 24.761,20.935 24.04,20.213 21.065,23.192 21.786,23.914 19.668,26.035 17.91,26.531 15.656,28.788 19.613,32.749 21.866,30.493 22.362,28.733 22.329,28.7 24.448,26.579 31.016,33.155 28.23,35.945 24.437,34.927 19.791,39.579 20.465,42.096 23.896,38.66 27.73,39.689 28.757,43.527 25.325,46.963 27.838,47.637 32.485,42.985 31.468,39.187 34.254,36.398 42.875,45.03 45.85,42.051 37.229,33.419" />
</svg>
);
export default icon;
|
test/kitchensink/src/features/webpack/SassModulesInclusion.js | egoist/poi | import React from 'react'
import styles from './assets/sass-styles.module.sass'
import indexStyles from './assets/index.module.sass'
export default () => (
<div>
<p className={styles.sassModulesInclusion}>SASS Modules are working!</p>
<p className={indexStyles.sassModulesIndexInclusion}>
SASS Modules with index are working!
</p>
</div>
)
|
node_modules/bs-recipes/recipes/webpack.react-transform-hmr/app/js/main.js | alexbid/sqrtrading | 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'));
|
components/AppLayout/AppSidebar.js | cofacts/rumors-site | import React from 'react';
import gql from 'graphql-tag';
import { t } from 'ttag';
import SwipeableDrawer from '@material-ui/core/SwipeableDrawer';
import { makeStyles } from '@material-ui/core/styles';
import {
Box,
Button,
Typography,
Divider,
List,
ListItem,
} from '@material-ui/core';
import Avatar from './Widgets/Avatar';
import LevelProgressBar from './Widgets/LevelProgressBar';
import { PROJECT_HACKFOLDR, CONTACT_EMAIL, LINE_URL } from 'constants/urls';
import NavLink from 'components/NavLink';
import Ribbon from 'components/Ribbon';
import ProfileLink from 'components/ProfileLink';
import { NAVBAR_HEIGHT, TABS_HEIGHT } from 'constants/size';
import { withDarkTheme } from 'lib/theme';
import GoogleWebsiteTranslator from './GoogleWebsiteTranslator';
import LEVEL_NAMES from 'constants/levelNames';
const useStyles = makeStyles(theme => ({
paper: {
top: `${NAVBAR_HEIGHT + TABS_HEIGHT}px !important`,
background: theme.palette.background.default,
overflow: 'inherit',
maxWidth: '80vw',
},
level: {
margin: '16px 0',
padding: '2px 8px 4px 20px',
'& > strong': {
marginRight: 12,
},
},
name: {
marginLeft: 16,
flex: '1 1 0',
display: '-webkit-box',
overflow: 'hidden',
boxOrient: 'vertical',
textOverflow: 'ellipsis',
lineClamp: 2,
},
login: {
margin: '24px auto',
borderRadius: 70,
},
list: {
padding: 0,
},
listItem: {
justifyContent: 'center',
padding: '12px 42px',
textTransform: 'uppercase',
'& a': {
color: 'inherit',
textDecoration: 'none',
},
},
divider: {
backgroundColor: theme.palette.secondary[400],
margin: '12px 42px',
},
}));
function AppSidebar({ open, toggle, user, onLoginModalOpen, onLogout }) {
const classes = useStyles();
const pointsLeft = user?.points?.nextLevel - user?.points?.total;
return (
<SwipeableDrawer
anchor="right"
open={open}
onClose={() => toggle(false)}
onOpen={() => toggle(true)}
variant="persistent"
classes={{
paper: classes.paper,
}}
>
{!user ? (
<Button
variant="outlined"
className={classes.login}
onClick={onLoginModalOpen}
>
{t`Login`}
</Button>
) : (
<div>
<Ribbon className={classes.level}>
<strong>Lv. {user?.level}</strong> {LEVEL_NAMES[(user?.level)]}
</Ribbon>
<Box px={1.5} pb={2} display="flex" alignItems="center">
<Avatar user={user} size={60} />
<Typography className={classes.name} variant="h6">
{user?.name}
</Typography>
</Box>
<Box px={1.5} pb={2}>
<Typography
variant="caption"
color="textSecondary"
display="block"
gutterBottom
>
{t`Earn ${pointsLeft} EXP to next level`}
</Typography>
<LevelProgressBar user={user} />
</Box>
<List>
<ListItem classes={{ root: classes.listItem }} button>
<ProfileLink user={user}>{t`My Profile`}</ProfileLink>
</ListItem>
</List>
</div>
)}
<Divider classes={{ root: classes.divider }} />
<List className={classes.list}>
<ListItem classes={{ root: classes.listItem }} button>
<NavLink href="/tutorial">{t`Tutorial`}</NavLink>
</ListItem>
<ListItem classes={{ root: classes.listItem }} button>
<NavLink external href={PROJECT_HACKFOLDR}>
{t`About`}
</NavLink>
</ListItem>
<ListItem classes={{ root: classes.listItem }} button>
<NavLink external href={`mailto:${CONTACT_EMAIL}`}>
{t`Contact Us`}
</NavLink>
</ListItem>
<ListItem classes={{ root: classes.listItem }} button>
Line:
<NavLink external href={LINE_URL}>
@cofacts
</NavLink>
</ListItem>
<ListItem classes={{ root: classes.listItem }}>
<GoogleWebsiteTranslator />
</ListItem>
</List>
{user && (
<>
<Divider classes={{ root: classes.divider }} />
<List className={classes.list}>
<ListItem
classes={{ root: classes.listItem }}
button
onClick={onLogout}
>
{t`Logout`}
</ListItem>
</List>
</>
)}
</SwipeableDrawer>
);
}
const exported = React.memo(withDarkTheme(AppSidebar));
exported.fragments = {
AppSidebarUserData: gql`
fragment AppSidebarUserData on User {
name
level
points {
total
nextLevel
}
...AvatarData
...LevelProgressBarData
...ProfileLinkUserData
}
${Avatar.fragments.AvatarData}
${LevelProgressBar.fragments.LevelProgressBarData}
${ProfileLink.fragments.ProfileLinkUserData}
`,
};
export default exported;
|
app/static/src/diagnostic/EquipmentForm_modules/AditionalEqupmentParameters_modules/TankParams.js | SnowBeaver/Vision | import React from 'react';
import FormControl from 'react-bootstrap/lib/FormControl';
import FormGroup from 'react-bootstrap/lib/FormGroup';
import ControlLabel from 'react-bootstrap/lib/ControlLabel';
import {findDOMNode} from 'react-dom';
import {hashHistory} from 'react-router';
import {Link} from 'react-router';
import Checkbox from 'react-bootstrap/lib/Checkbox';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
import Tooltip from 'react-bootstrap/lib/Tooltip';
import HelpBlock from 'react-bootstrap/lib/HelpBlock';
var SelectField = React.createClass({
handleChange: function (event, index, value) {
this.setState({
value: event.target.value
});
},
getInitialState: function () {
return {
items: [],
isVisible: false,
value: -1
};
},
isVisible: function () {
return this.state.isVisible;
},
componentDidMount: function () {
var source = '/api/v1.0/' + this.props.source + '/';
this.serverRequest = $.authorizedGet(source, function (result) {
this.setState({items: (result['result'])});
}.bind(this), 'json');
},
componentWillUnmount: function () {
this.serverRequest.abort();
},
setVisible: function () {
this.state.isVisible = true;
},
render: function () {
var label = (this.props.label != null) ? this.props.label : "";
var value = (this.props.value != null) ? this.props.value : "";
var name = (this.props.name != null) ? this.props.name : "";
var validationState = (this.props.errors[name]) ? 'error' : null;
var error = this.props.errors[name];
var menuItems = [];
for (var key in this.state.items) {
menuItems.push(<option key={this.state.items[key].id}
value={this.state.items[key].id}>{`${this.state.items[key].name}`}</option>);
}
return (
<FormGroup validationState={validationState}>
<ControlLabel>{label}</ControlLabel>
<FormControl componentClass="select"
onChange={this.handleChange}
value={value}
name={name}
>
<option>{this.props.label}</option>);
{menuItems}
</FormControl>
<HelpBlock className="warning">{error}</HelpBlock>
</FormGroup>
);
}
});
var TankParams = React.createClass({
getInitialState: function () {
return {
'sealed': '',
'welded_cover': '',
'id':'',
'errors': {}
}
},
handleChange: function(e){
var state = this.state;
if (e.target.type == "checkbox"){
state[e.target.name] = e.target.checked;
}
else
state[e.target.name] = e.target.value;
this.setState(state);
},
load:function() {
this.setState(this.props.equipment_item)
},
render: function () {
var errors = (Object.keys(this.state.errors).length) ? this.state.errors : this.props.errors;
return (
<div>
<div className="row">
<div className="col-md-4">
<SelectField
source="fluid_type"
label="Fluid Type"
name="fluid_type_id"
value={this.state.fluid_type_id}
errors={errors}/>
</div>
<div className="col-md-4">
<SelectField
source="fluid_level"
label="Fluid Level"
name="fluid_level_id"
value={this.state.fluid_level_id}
errors={errors}/>
</div>
<div className="col-md-2">
<Checkbox name="welded_cover" checked={this.state.welded_cover} onChange={this.handleChange}><b>Welded Cover</b></Checkbox>
</div>
</div>
</div>
)
}
});
export default TankParams; |
src/App.js | devigor/react-busca-cep | import React from 'react';
import ReactDOM from 'react-dom';
import BuscaCep from './Components/BuscaCEP';
ReactDOM.render(
<BuscaCep />,
document.getElementById('root')
);
|
src/svg-icons/navigation/arrow-forward.js | pancho111203/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NavigationArrowForward = (props) => (
<SvgIcon {...props}>
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/>
</SvgIcon>
);
NavigationArrowForward = pure(NavigationArrowForward);
NavigationArrowForward.displayName = 'NavigationArrowForward';
NavigationArrowForward.muiName = 'SvgIcon';
export default NavigationArrowForward;
|
test/fixtures/block-element/input.js | rebem/rebem-jsx | import React from 'react';
function Test() {
return <div block="test">
<div block="test" elem="test2"></div>
</div>;
}
|
src/svg-icons/action/backup.js | owencm/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionBackup = (props) => (
<SvgIcon {...props}>
<path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"/>
</SvgIcon>
);
ActionBackup = pure(ActionBackup);
ActionBackup.displayName = 'ActionBackup';
ActionBackup.muiName = 'SvgIcon';
export default ActionBackup;
|
components/Navigation/index.js | joaojusto/jose-gomes-landing-page | import React from 'react';
import './index.scss';
import NextArrow from './next.svg';
import PreviowsArrow from './previous.svg';
const Navigation = ({ onPrevious, onNext }) =>
<div className="Navigation">
<img
className="Navigation-previous"
src={PreviowsArrow}
onClick={onPrevious}
/>
<img className="Navigation-next" src={NextArrow} onClick={onNext} />
</div>;
export default Navigation;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.