path stringlengths 5 195 | repo_name stringlengths 5 79 | content stringlengths 25 1.01M |
|---|---|---|
packages/material-ui-icons/src/Folder.js | cherniavskii/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<g><path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z" /></g>
, 'Folder');
|
src/Containers/Disputes/DisputeResolution/Decision/Form/index.js | kleros/kleros-front | import React from 'react'
import { SubmissionError, Field, reduxForm } from 'redux-form'
import { connect } from 'react-redux'
import { withRouter, Redirect } from 'react-router-dom'
import FontAwesome from 'react-fontawesome'
import { submitDisputeResolution } from '../../../../../redux/disputes/action-creators'
import Input from '../../../../../Components/Input'
import './Form.css'
const Form = props => {
const {
submitSucceeded,
resolutionOptions = [],
votes,
hash,
disputeId,
handleSubmit,
submitting,
error,
hasErrored
} = props
const submitWithProps = (values, dispatch) => {
return dispatch(submitDisputeResolution(values.decision, disputeId, votes, hash))
.catch(error => {
if (error) { throw new SubmissionError({_error: 'Unable to submit ruling'}) }
})
}
if (submitSucceeded) {
return <Redirect
to='/disputes'
push />
}
return (
<form onSubmit={handleSubmit(submitWithProps)} className='Form-container'>
{
resolutionOptions.map(option => (
<div className='radio-input-container' key={option.value}>
<div className='input-container'>
<div className='resolution-option'>
<Field
name='decision'
required
id={`decision-input-${option.value}`}
type='radio'
className='input-dispute-resolution'
value={`${option.value}`}
component={Input} />
<div className='option-information'>
<h2>{ option.name }</h2>
<p>{ option.description }</p>
</div>
</div>
</div>
<div className='divider' />
</div>
))
}
{ error && <div><strong>{ error }</strong></div> }
<div className='button-container'>
<button
type='submit'
disabled={submitting || error}
className='submit'>
{
submitting &&
<FontAwesome
name='circle-o-notch'
spin
style={{marginRight: '10px'}}
/>
}
Submit now
</button>
</div>
{ hasErrored && <div>Error contract</div> }
</form>
)
}
const FORM_NAME = 'disputeResolution'
const mapStateToProps = state => {
return {
formDisputeResolution: state.form.disputeResolution
}
}
const validate = () => {
return {}
}
export default withRouter(connect(mapStateToProps, null)(
reduxForm({
form: FORM_NAME,
validate
})(Form)))
|
test/test_helper.js | nfcortega89/airtime | 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};
|
node_modules/material-ui/src/utils/children.js | Sporks/Doc-tor | import React from 'react';
import createFragment from 'react-addons-create-fragment';
export default {
create(fragments) {
let newFragments = {};
let validChildrenCount = 0;
let firstKey;
//Only create non-empty key fragments
for (let key in fragments) {
const currentChild = fragments[key];
if (currentChild) {
if (validChildrenCount === 0) firstKey = key;
newFragments[key] = currentChild;
validChildrenCount++;
}
}
if (validChildrenCount === 0) return undefined;
if (validChildrenCount === 1) return newFragments[firstKey];
return createFragment(newFragments);
},
extend(children, extendedProps, extendedChildren) {
return React.isValidElement(children) ?
React.Children.map(children, (child) => {
const newProps = typeof (extendedProps) === 'function' ?
extendedProps(child) : extendedProps;
const newChildren = typeof (extendedChildren) === 'function' ?
extendedChildren(child) : extendedChildren ?
extendedChildren : child.props.children;
return React.cloneElement(child, newProps, newChildren);
}) : children;
},
};
|
src/js/app/header/SearchBar/common.js | ludonow/ludo-beta-react | import React from 'react';
import styled from 'styled-components';
import CancelIcon from 'material-ui/svg-icons/navigation/cancel';
import { grey700 } from 'material-ui/styles/colors';
/**
* hacky usage of styled-component to use react-tap-event-plugin
* ref: https://github.com/styled-components/styled-components/issues/527#issuecomment-281931998
*/
export const A = (props) => (
<a {...props} />
);
const CancelIconPadding = `
padding-right: 3px;
padding-top: 1px;
`;
const CancelIconButtonWrapper = styled(A)`
${CancelIconPadding}
`;
const CancelIconWrapper = styled.div`
padding-top: ${props => props.isMoblie ? '2px': '0'};
`;
export const CancelIconPlaceHolder = styled.div`
${CancelIconPadding}
height: ${props => props.height ? props.height: '15px'};
width: ${props => props.width ? props.width: '15px'};
`;
export const CancelIconButton = ({
handleSearchingTextClear,
height,
isMobile,
width,
}) => (
<CancelIconButtonWrapper onTouchTap={handleSearchingTextClear}>
<CancelIconWrapper isMobile={isMobile}>
<CancelIcon
color={grey700}
style={{height, width}}
/>
</CancelIconWrapper>
</CancelIconButtonWrapper>
);
CancelIconButton.defaultProps = {
height: '15px',
width: '15px',
};
export const SearchBar = styled.div`
background-color: #999999;
border-radius: 50px;
display: inline-flex;
& > img {
position: relative;
padding: 5px 10px;
width: 20px;
height: 20px;
}
& input {
width: 140px;
border: none;
outline: none;
background-color: #999999;
caret-color: white;
color: white;
font-size: ${props => props.isMobile ? '16px' : '12px'};
font-family: "Exo", "Microsoft JhengHei";
}
input::-webkit-input-placeholder {
color: rgba(255, 255, 255, 0.8);
}
input:focus::-webkit-input-placeholder {
color: rgba(255, 255, 255, 0.5);
}
`;
|
src/components/portal/Single/Battlegear.js | chaoticbackup/chaoticbackup.github.io | import React from 'react';
import API from '../../SpreadsheetData';
import s from '../../../styles/app.style';
import { observer, inject } from 'mobx-react';
import { PageNotFound } from '../../Snippets';
import Single from './_base';
@inject((stores, props, context) => props) @observer
export default class SingleBattlegear extends React.Component {
render() {
const path = this.props.location.pathname.split("/");
if (path[path.length-1] == "") path.pop(); // Remove trailing backslash
// Path too long
if ( path.length !== 4 ) {
return (<PageNotFound location={this.props.location}/>);
}
const name = decodeURIComponent(path[3]);
const battlegear = API.portal.battlegear.findOne({ 'gsx$name': name });
const card_data = API.cards.battlegear.findOne({ 'gsx$name': name });
if (battlegear) {
const sections = [];
if (battlegear.gsx$attributes) {
sections.push(["Attributes", battlegear.gsx$attributes]);
}
if (battlegear.gsx$background) {
sections.push(["Background", battlegear.gsx$background]);
}
if (battlegear.gsx$details) {
sections.push(["Details", battlegear.gsx$details]);
}
return (<Single
card={card_data}
col2={
sections.map((val, i) => {
return (<React.Fragment key={i} >
<div>
<strong>{val[0]}:</strong><br />
{val[1]}
</div>
{i !== sections.length - 1 && <hr />}
</React.Fragment>);
})
}
/>);
}
else if (card_data) {
if (API.hasFullart(card_data)) {
return (<Single card={card_data}/>);
}
}
return (<PageNotFound location={this.props.location}/>);
}
}
|
webpack/move_to_pf/TooltipButton/TooltipButton.js | johnpmitsch/katello | import React from 'react';
import PropTypes from 'prop-types';
import { Button, Tooltip, OverlayTrigger } from 'patternfly-react';
import './TooltipButton.scss';
const TooltipButton = ({
disabled, title, tooltipText, tooltipId, tooltipPlacement, renderedButton, ...props
}) => {
if (!disabled) return renderedButton || (<Button {...props}>{title}</Button>);
return (
<OverlayTrigger
placement={tooltipPlacement}
delayHide={150}
overlay={<Tooltip id={tooltipId}>{tooltipText}</Tooltip>}
>
<div className="tooltip-button-helper">
{renderedButton || (<Button {...props} disabled>{title}</Button>)}
</div>
</OverlayTrigger>
);
};
TooltipButton.propTypes = {
disabled: PropTypes.bool,
title: PropTypes.string,
tooltipText: PropTypes.string,
tooltipId: PropTypes.string.isRequired,
tooltipPlacement: PropTypes.string,
renderedButton: PropTypes.node,
};
TooltipButton.defaultProps = {
disabled: false,
title: '',
tooltipPlacement: 'bottom',
tooltipText: '',
renderedButton: null,
};
export default TooltipButton;
|
src/svg-icons/av/mic-off.js | IsenrichO/mui-with-arrows | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvMicOff = (props) => (
<SvgIcon {...props}>
<path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17c0-.06.02-.11.02-.17V5c0-1.66-1.34-3-3-3S9 3.34 9 5v.18l5.98 5.99zM4.27 3L3 4.27l6.01 6.01V11c0 1.66 1.33 3 2.99 3 .22 0 .44-.03.65-.08l1.66 1.66c-.71.33-1.5.52-2.31.52-2.76 0-5.3-2.1-5.3-5.1H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c.91-.13 1.77-.45 2.54-.9L19.73 21 21 19.73 4.27 3z"/>
</SvgIcon>
);
AvMicOff = pure(AvMicOff);
AvMicOff.displayName = 'AvMicOff';
AvMicOff.muiName = 'SvgIcon';
export default AvMicOff;
|
src/svg-icons/maps/local-hospital.js | ichiohta/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsLocalHospital = (props) => (
<SvgIcon {...props}>
<path d="M19 3H5c-1.1 0-1.99.9-1.99 2L3 19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-1 11h-4v4h-4v-4H6v-4h4V6h4v4h4v4z"/>
</SvgIcon>
);
MapsLocalHospital = pure(MapsLocalHospital);
MapsLocalHospital.displayName = 'MapsLocalHospital';
MapsLocalHospital.muiName = 'SvgIcon';
export default MapsLocalHospital;
|
src/svg-icons/communication/chat-bubble-outline.js | mit-cml/iot-website-source | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let CommunicationChatBubbleOutline = (props) => (
<SvgIcon {...props}>
<path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"/>
</SvgIcon>
);
CommunicationChatBubbleOutline = pure(CommunicationChatBubbleOutline);
CommunicationChatBubbleOutline.displayName = 'CommunicationChatBubbleOutline';
CommunicationChatBubbleOutline.muiName = 'SvgIcon';
export default CommunicationChatBubbleOutline;
|
src/components/Header/Header.js | KwakJuYoung/MyProtoType | /*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
import React from 'react';
import styles from './Header.css';
import withStyles from '../../decorators/withStyles';
import Link from '../Link';
import Navigation from '../Navigation';
@withStyles(styles)
class Header {
render() {
return (
<div className="Header">
<div className="Header-container">
<a className="Header-brand" href="/" onClick={Link.handleClick}>
<img className="Header-brandImg" src={require('./logo-small.png')} width="38" height="38" alt="React" />
<span className="Header-brandTxt">Your Company</span>
</a>
<Navigation className="Header-nav" />
<div className="Header-banner">
<h1 className="Header-bannerTitle">React</h1>
<p className="Header-bannerDesc">Complex web apps made easy</p>
</div>
</div>
</div>
);
}
}
export default Header;
|
templates/rubix/rubix-bootstrap/src/Timeline.js | jeffthemaximum/Teachers-Dont-Pay-Jeff | import React from 'react';
import classNames from 'classnames';
import Icon from './Icon';
export class TimelineView extends React.Component {
static propTypes = {
centered: React.PropTypes.bool,
withHeader: React.PropTypes.bool
};
render() {
var classes = classNames({
'rubix-timeline-view': true,
'rubix-timeline-centered': this.props.centered || false,
'rubix-timeline-with-header': this.props.withHeader || false,
'rubix-timeline-normal': !this.props.withHeader
}, this.props.className);
var props = {
...this.props,
centered: null,
withHeader: null,
className: classes.trim()
};
delete props.centered;
delete props.withHeader;
return (
<div {...props}>
{this.props.children}
</div>
);
}
}
export class TimelineItem extends React.Component {
render() {
var props = {
...this.props,
className: classNames('rubix-timeline-item', this.props.className)
};
return (
<div {...props}>
{this.props.children}
</div>
);
}
}
export class TimelineHeader extends React.Component {
render() {
var props = {
...this.props,
className: classNames('rubix-timeline-header', this.props.className)
};
return (
<div {...props}>
{this.props.children}
</div>
);
}
}
export class TimelineIcon extends React.Component {
render() {
var props = {
...this.props,
className: classNames('rubix-timeline-icon', this.props.className)
};
return (
<Icon {...props} />
);
}
}
export class TimelineAvatar extends React.Component {
render() {
var props = {
width: 30,
height: 30,
...this.props,
className: classNames('rubix-timeline-avatar', this.props.className),
style: {
borderWidth: 2,
borderStyle: 'solid',
borderRadius: 100,
padding: 2,
position: 'absolute',
top: 0
},
};
return (
<img {...props} />
);
}
}
export class TimelineTitle extends React.Component {
render() {
var props = {
...this.props,
className: classNames('rubix-timeline-title', this.props.className)
};
return (
<div {...props}>
{this.props.children}
</div>
);
}
}
export class TimelineBody extends React.Component {
render() {
var props = {
...this.props,
className: classNames('rubix-timeline-body', this.props.className)
};
return (
<div {...props}>
{this.props.children}
</div>
);
}
}
|
ordering/stories/MemberIntentField.js | root-systems/cobuy | import React from 'react'
import { storiesOf } from '@storybook/react'
import { action } from '@storybook/addon-actions'
import { reduxForm, Field } from 'redux-form'
import MemberIntentField from '../components/MemberIntentField'
// https://github.com/root-systems/cobuy/wiki/Models#offering
const avoOffering = {
resourceType: {
name: 'crate of avocados',
items: [
{
resourceType: {
name: 'avocado'
},
quantity: {
step: '1',
value: '24',
unit: 'each'
}
},
{
resourceType: {
name: 'crate'
},
quantity: {
value: '1',
unit: 'each'
}
}
]
},
priceSpecifications: [
{
minimum: '0',
price: '100',
currency: 'NZD'
}
]
}
const IntentForm = props => {
const { handleSubmit } = props
return (
<form onSubmit={handleSubmit}>
<Field name='intent' component={MemberIntentField} offering={avoOffering} />
</form>
)
}
const ConnectedIntentForm = reduxForm({ form: 'memberIntent' })(IntentForm)
storiesOf('ordering.MemberIntentField', module)
.add('default', () => (
<ConnectedIntentForm />
))
|
src/svg-icons/action/perm-identity.js | ngbrown/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionPermIdentity = (props) => (
<SvgIcon {...props}>
<path d="M12 5.9c1.16 0 2.1.94 2.1 2.1s-.94 2.1-2.1 2.1S9.9 9.16 9.9 8s.94-2.1 2.1-2.1m0 9c2.97 0 6.1 1.46 6.1 2.1v1.1H5.9V17c0-.64 3.13-2.1 6.1-2.1M12 4C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4z"/>
</SvgIcon>
);
ActionPermIdentity = pure(ActionPermIdentity);
ActionPermIdentity.displayName = 'ActionPermIdentity';
ActionPermIdentity.muiName = 'SvgIcon';
export default ActionPermIdentity;
|
examples/complete/material/src/routes/Projects/routes/Project/components/ProjectPage/ProjectPage.js | prescottprue/react-redux-firebase | import React from 'react'
import Card from '@material-ui/core/Card'
import CardContent from '@material-ui/core/CardContent'
import Typography from '@material-ui/core/Typography'
import { makeStyles } from '@material-ui/core/styles'
import { useFirebaseConnect, isLoaded } from 'react-redux-firebase'
import { useParams } from 'react-router-dom'
import { useSelector } from 'react-redux'
import LoadingSpinner from 'components/LoadingSpinner'
import styles from './ProjectPage.styles'
const useStyles = makeStyles(styles)
function ProjectPage() {
const { projectId } = useParams()
const classes = useStyles()
// Create listener for projects
useFirebaseConnect(() => [{ path: `projects/${projectId}` }])
// Get projects from redux state
const project = useSelector(({ firebase: { data } }) => {
return data.projects && data.projects[projectId]
})
// Show loading spinner while project is loading
if (!isLoaded(project)) {
return <LoadingSpinner />
}
return (
<div className={classes.root}>
<Card className={classes.card}>
<CardContent>
<Typography className={classes.title} component="h2">
{project.name || 'Project'}
</Typography>
<Typography className={classes.subtitle}>{projectId}</Typography>
<div style={{ marginTop: '10rem' }}>
<pre>{JSON.stringify(project, null, 2)}</pre>
</div>
</CardContent>
</Card>
</div>
)
}
export default ProjectPage
|
webpack/scenes/ContentViews/components/InactiveText.js | Katello/katello | import React from 'react';
import PropTypes from 'prop-types';
import { TextContent, Text, TextVariants } from '@patternfly/react-core';
const InactiveText = props => (
<TextContent>
<Text component={TextVariants.small} {...props}>{props.text}</Text>
</TextContent>
);
InactiveText.propTypes = {
text: PropTypes.string.isRequired,
};
export default InactiveText;
|
node_modules/react-bootstrap/es/Collapse.js | okristian1/react-info | import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import classNames from 'classnames';
import css from 'dom-helpers/style';
import React from 'react';
import Transition from 'react-overlays/lib/Transition';
import capitalize from './utils/capitalize';
import createChainedFunction from './utils/createChainedFunction';
var MARGINS = {
height: ['marginTop', 'marginBottom'],
width: ['marginLeft', 'marginRight']
};
// reading a dimension prop will cause the browser to recalculate,
// which will let our animations work
function triggerBrowserReflow(node) {
node.offsetHeight; // eslint-disable-line no-unused-expressions
}
function getDimensionValue(dimension, elem) {
var value = elem['offset' + capitalize(dimension)];
var margins = MARGINS[dimension];
return value + parseInt(css(elem, margins[0]), 10) + parseInt(css(elem, margins[1]), 10);
}
var propTypes = {
/**
* Show the component; triggers the expand or collapse animation
*/
'in': React.PropTypes.bool,
/**
* Unmount the component (remove it from the DOM) when it is collapsed
*/
unmountOnExit: React.PropTypes.bool,
/**
* Run the expand animation when the component mounts, if it is initially
* shown
*/
transitionAppear: React.PropTypes.bool,
/**
* Duration of the collapse animation in milliseconds, to ensure that
* finishing callbacks are fired even if the original browser transition end
* events are canceled
*/
timeout: React.PropTypes.number,
/**
* Callback fired before the component expands
*/
onEnter: React.PropTypes.func,
/**
* Callback fired after the component starts to expand
*/
onEntering: React.PropTypes.func,
/**
* Callback fired after the component has expanded
*/
onEntered: React.PropTypes.func,
/**
* Callback fired before the component collapses
*/
onExit: React.PropTypes.func,
/**
* Callback fired after the component starts to collapse
*/
onExiting: React.PropTypes.func,
/**
* Callback fired after the component has collapsed
*/
onExited: React.PropTypes.func,
/**
* The dimension used when collapsing, or a function that returns the
* dimension
*
* _Note: Bootstrap only partially supports 'width'!
* You will need to supply your own CSS animation for the `.width` CSS class._
*/
dimension: React.PropTypes.oneOfType([React.PropTypes.oneOf(['height', 'width']), React.PropTypes.func]),
/**
* Function that returns the height or width of the animating DOM node
*
* Allows for providing some custom logic for how much the Collapse component
* should animate in its specified dimension. Called with the current
* dimension prop value and the DOM node.
*/
getDimensionValue: React.PropTypes.func,
/**
* ARIA role of collapsible element
*/
role: React.PropTypes.string
};
var defaultProps = {
'in': false,
timeout: 300,
unmountOnExit: false,
transitionAppear: false,
dimension: 'height',
getDimensionValue: getDimensionValue
};
var Collapse = function (_React$Component) {
_inherits(Collapse, _React$Component);
function Collapse(props, context) {
_classCallCheck(this, Collapse);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
_this.handleEnter = _this.handleEnter.bind(_this);
_this.handleEntering = _this.handleEntering.bind(_this);
_this.handleEntered = _this.handleEntered.bind(_this);
_this.handleExit = _this.handleExit.bind(_this);
_this.handleExiting = _this.handleExiting.bind(_this);
return _this;
}
/* -- Expanding -- */
Collapse.prototype.handleEnter = function handleEnter(elem) {
var dimension = this._dimension();
elem.style[dimension] = '0';
};
Collapse.prototype.handleEntering = function handleEntering(elem) {
var dimension = this._dimension();
elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
};
Collapse.prototype.handleEntered = function handleEntered(elem) {
var dimension = this._dimension();
elem.style[dimension] = null;
};
/* -- Collapsing -- */
Collapse.prototype.handleExit = function handleExit(elem) {
var dimension = this._dimension();
elem.style[dimension] = this.props.getDimensionValue(dimension, elem) + 'px';
triggerBrowserReflow(elem);
};
Collapse.prototype.handleExiting = function handleExiting(elem) {
var dimension = this._dimension();
elem.style[dimension] = '0';
};
Collapse.prototype._dimension = function _dimension() {
return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
};
// for testing
Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
return elem['scroll' + capitalize(dimension)] + 'px';
};
Collapse.prototype.render = function render() {
var _props = this.props,
onEnter = _props.onEnter,
onEntering = _props.onEntering,
onEntered = _props.onEntered,
onExit = _props.onExit,
onExiting = _props.onExiting,
className = _props.className,
props = _objectWithoutProperties(_props, ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'className']);
delete props.dimension;
delete props.getDimensionValue;
var handleEnter = createChainedFunction(this.handleEnter, onEnter);
var handleEntering = createChainedFunction(this.handleEntering, onEntering);
var handleEntered = createChainedFunction(this.handleEntered, onEntered);
var handleExit = createChainedFunction(this.handleExit, onExit);
var handleExiting = createChainedFunction(this.handleExiting, onExiting);
var classes = {
width: this._dimension() === 'width'
};
return React.createElement(Transition, _extends({}, props, {
'aria-expanded': props.role ? props['in'] : null,
className: classNames(className, classes),
exitedClassName: 'collapse',
exitingClassName: 'collapsing',
enteredClassName: 'collapse in',
enteringClassName: 'collapsing',
onEnter: handleEnter,
onEntering: handleEntering,
onEntered: handleEntered,
onExit: handleExit,
onExiting: handleExiting
}));
};
return Collapse;
}(React.Component);
Collapse.propTypes = propTypes;
Collapse.defaultProps = defaultProps;
export default Collapse; |
local-cli/templates/HelloNavigation/components/ListItem.js | dikaiosune/react-native | 'use strict';
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
TouchableHighlight,
TouchableNativeFeedback,
View,
} from 'react-native';
/**
* Renders the right type of Touchable for the list item, based on platform.
*/
const Touchable = ({onPress, children}) => {
const child = React.Children.only(children);
if (Platform.OS === 'android') {
return (
<TouchableNativeFeedback onPress={onPress}>
{child}
</TouchableNativeFeedback>
);
} else {
return (
<TouchableHighlight onPress={onPress} underlayColor="#ddd">
{child}
</TouchableHighlight>
);
}
};
const ListItem = ({label, onPress}) => (
<Touchable onPress={onPress}>
<View style={styles.item}>
<Text style={styles.label}>{label}</Text>
</View>
</Touchable>
);
const styles = StyleSheet.create({
item: {
height: 48,
justifyContent: 'center',
paddingLeft: 12,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#ddd',
},
label: {
fontSize: 16,
}
});
export default ListItem;
|
src/components/chart-label.js | ronlobo/building-os-charts | import React from 'react';
import classNames from 'classnames';
export default class ChartLabel extends React.Component {
static propTypes = {
className: React.PropTypes.string,
style: React.PropTypes.object,
text: React.PropTypes.string.isRequired,
transform: React.PropTypes.string,
x: React.PropTypes.number.isRequired,
y: React.PropTypes.number.isRequired,
}
static defaultProps = {
className: '',
style: {},
text: '',
transform: '',
x: 0,
y: 0,
}
render() {
return (
<text
className={classNames('chart-label', this.props.className)}
style={this.props.style}
transform={this.props.transform}
x={this.props.x}
y={this.props.y}>
{this.props.text}
</text>
);
}
}
|
src/login/index.js | MarceloProjetos/react-router-node-red | import React, { Component } from 'react';
import {
Modal,
Row,
Col,
FormGroup,
FormControl,
Button
} from 'react-bootstrap';
import md5 from 'md5';
import api from './../api';
import Error from './../Error';
export default class Login extends Component {
constructor(props) {
super(props);
this.state = {
usuario: '',
senha: ''
}
this.handleChange = this.handleChange.bind(this);
this.handleCloseDialog = this.handleCloseDialog.bind(this);
this.handleLogin = this.handleLogin.bind(this);
}
handleChange(element) {
this.setState({[element.target.name]: element.target.value})
}
handleCloseDialog() {
this.setState({dialog: null});
}
handleLogin() {
api.usuario.login(this.state.usuario, md5(this.state.senha), this.handleAuthenticate.bind(this))
}
handleAuthenticate(user) {
if (user.nome) {
this.props.onLogin && this.props.onLogin(user);
} else {
let err = {mensagem: 'Usuário e senha não encontrado. Verifique se digitou a senha corretamente.'}
this.setState({dialog: <Error {...err} onClose={this.handleCloseDialog.bind(this)} />})
}
}
render() {
return(
<div className="static-modal">
<Modal.Dialog>
<Modal.Header>
<Modal.Title>Controle de Acesso</Modal.Title>
</Modal.Header>
<Modal.Body>
<Row>
<Col md={4}>Usuario</Col>
<Col md={8}>
<FormGroup validationState="success">
{/*<ControlLabel>Input with success and feedback icon</ControlLabel>*/}
<FormControl type="text" name="usuario" value={this.state.usuario} onChange={this.handleChange} />
<FormControl.Feedback />
</FormGroup>
</Col>
</Row>
<Row>
<Col md={4}>Senha</Col>
<Col md={8}>
<FormGroup validationState="success">
{/*<ControlLabel>Input with success and feedback icon</ControlLabel>*/}
<FormControl type="password" name="senha" value={this.state.senha} onChange={this.handleChange} />
<FormControl.Feedback />
</FormGroup>
</Col>
</Row>
</Modal.Body>
<Modal.Footer>
<Button bsStyle="primary" onClick={this.handleLogin} >Acessar</Button>
</Modal.Footer>
{this.state.dialog}
</Modal.Dialog>
</div>
);
}
} |
app/javascript/mastodon/features/blocks/index.js | tateisu/mastodon | import React from 'react';
import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { debounce } from 'lodash';
import PropTypes from 'prop-types';
import LoadingIndicator from '../../components/loading_indicator';
import Column from '../ui/components/column';
import ColumnBackButtonSlim from '../../components/column_back_button_slim';
import AccountContainer from '../../containers/account_container';
import { fetchBlocks, expandBlocks } from '../../actions/blocks';
import ScrollableList from '../../components/scrollable_list';
const messages = defineMessages({
heading: { id: 'column.blocks', defaultMessage: 'Blocked users' },
});
const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'blocks', 'items']),
hasMore: !!state.getIn(['user_lists', 'blocks', 'next']),
});
export default @connect(mapStateToProps)
@injectIntl
class Blocks extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
shouldUpdateScroll: PropTypes.func,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
intl: PropTypes.object.isRequired,
};
componentWillMount () {
this.props.dispatch(fetchBlocks());
}
handleLoadMore = debounce(() => {
this.props.dispatch(expandBlocks());
}, 300, { leading: true });
render () {
const { intl, accountIds, shouldUpdateScroll, hasMore } = this.props;
if (!accountIds) {
return (
<Column>
<LoadingIndicator />
</Column>
);
}
const emptyMessage = <FormattedMessage id='empty_column.blocks' defaultMessage="You haven't blocked any users yet." />;
return (
<Column icon='ban' heading={intl.formatMessage(messages.heading)}>
<ColumnBackButtonSlim />
<ScrollableList
scrollKey='blocks'
onLoadMore={this.handleLoadMore}
hasMore={hasMore}
shouldUpdateScroll={shouldUpdateScroll}
emptyMessage={emptyMessage}
>
{accountIds.map(id =>
<AccountContainer key={id} id={id} />
)}
</ScrollableList>
</Column>
);
}
}
|
components/Form/FormComponents.js | NGMarmaduke/bloom | /* eslint-disable react/no-multi-comp */
import PropTypes from 'prop-types';
import React from 'react';
import cx from 'classnames';
import css from './FormComponents.css';
export const Field = ({ className, children, error }) => (
<div
className={ cx(
css.field,
error ? css.errorField : null,
className
) }
>
{ children }
</div>
);
export const Meta = ({ className, children }) => (
<span className={ cx(css.meta, className) }>
{ children }
</span>
);
export const Description = ({ className, children }) => (
<span className={ cx(css.description, className) }>
{ children }
</span>
);
export const Label = (props) => {
const {
className,
children,
htmlFor,
error,
optionalLabel,
} = props;
return (
<label
htmlFor={ htmlFor }
className={ cx(
css.label,
error ? css.error : null,
className
) }
>
{ children } { optionalLabel && (
<span className={ css.optional }>{ optionalLabel }</span>
) }
</label>
);
};
export const Value = ({ className, children }) => (
<span className={ cx(css.value, className) }>
{ children }
</span>
);
export const Placeholder = ({ className, children }) => (
<span className={ cx(css.placeholder, className) }>
{ children }
</span>
);
export const InputWrapper = ({ className, children }) => (
<div className={ cx(css.inputWrapper, className) }>
{ children }
</div>
);
const sharedPropTypes = {
className: PropTypes.string,
children: PropTypes.node,
};
Field.propTypes = {
...sharedPropTypes,
error: PropTypes.string,
};
Meta.propTypes = sharedPropTypes;
Description.propTypes = sharedPropTypes;
Label.propTypes = {
...sharedPropTypes,
htmlFor: PropTypes.string,
optionalLabel: PropTypes.string,
};
Value.propTypes = sharedPropTypes;
Placeholder.propTypes = sharedPropTypes;
InputWrapper.propTypes = sharedPropTypes;
/* eslint-enable react/no-multi-comp */
|
src/docs/examples/UIDatePicker/ExampleUIDatePicker.js | rajeshpillai/zs-react-pattern-lib | import React from 'react';
import moment from 'moment';
import UIDatePicker from 'zs-react/UIDatePicker';
/** Datepicker Example */
export default class ExampleUIDatePicker extends React.Component {
constructor (props) {
super(props);
this.state = {
startDate: moment()
}
}
handleChange = (date) => {
console.log(date);
this.setState({
startDate: date
})
}
render() {
return <UIDatePicker selected={this.state.startDate} onChange = {this.handleChange} />
}
}
|
client/gatsby-ssr.js | raisedadead/FreeCodeCamp | import PropTypes from 'prop-types';
import React from 'react';
import { I18nextProvider } from 'react-i18next';
import { Provider } from 'react-redux';
import i18n from './i18n/config';
import { createStore } from './src/redux/createStore';
import layoutSelector from './utils/gatsby/layout-selector';
import { getheadTagComponents, getPostBodyComponents } from './utils/tags';
const store = createStore();
export const wrapRootElement = ({ element }) => {
return (
<Provider store={store}>
<I18nextProvider i18n={i18n}>{element}</I18nextProvider>
</Provider>
);
};
wrapRootElement.propTypes = {
element: PropTypes.any
};
export const wrapPageElement = layoutSelector;
export const onRenderBody = ({
pathname,
setHeadComponents,
setPostBodyComponents
}) => {
setHeadComponents(getheadTagComponents());
setPostBodyComponents(getPostBodyComponents(pathname));
};
export const onPreRenderHTML = ({
getHeadComponents,
replaceHeadComponents
}) => {
const headComponents = getHeadComponents();
headComponents.sort((x, y) => {
if (x.key === 'bootstrap-min-preload' || x.key === 'bootstrap-min') {
return -1;
} else if (y.key === 'bootstrap-min-preload' || y.key === 'bootstrap-min') {
return 1;
}
return 0;
});
replaceHeadComponents(headComponents);
};
|
src/js/components/link__list/index.js | afk-mcz/web_client.ellu | import PropTypes from 'prop-types';
import React from 'react';
import Link from '../link__row';
const LinkList = ({ links }) => (
<ul className="links">
{links.map(link => (
<Link key={link.id} {...link} onClick={() => onLinkClick(link.id)} />
))}
</ul>
);
LinkList.propTypes = {
links: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
link: PropTypes.string.isRequired,
}).isRequired
).isRequired,
};
export default LinkList;
|
src/svg-icons/action/settings-cell.js | verdan/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionSettingsCell = (props) => (
<SvgIcon {...props}>
<path d="M7 24h2v-2H7v2zm4 0h2v-2h-2v2zm4 0h2v-2h-2v2zM16 .01L8 0C6.9 0 6 .9 6 2v16c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V2c0-1.1-.9-1.99-2-1.99zM16 16H8V4h8v12z"/>
</SvgIcon>
);
ActionSettingsCell = pure(ActionSettingsCell);
ActionSettingsCell.displayName = 'ActionSettingsCell';
ActionSettingsCell.muiName = 'SvgIcon';
export default ActionSettingsCell;
|
src/Courses.js | PythEch/ruc-scheduler | import React, { Component } from 'react';
import { observer, calculated } from 'mobx-react';
|
website/src/pages/404.js | plouc/mozaik | import React from 'react'
const NotFoundPage = () => (
<div>
<h1>NOT FOUND</h1>
<p>You just hit a route that doesn't exist... the sadness.</p>
</div>
)
export default NotFoundPage
|
app/containers/PageSection/index.js | interra/data-generate | /**
* RepoListItem
*
* Lists the name and the issue count of a repository
*/
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import ListItem from 'components/ListItem';
import Wrapper from './Wrapper';
import StyledLink from './StyledLink';
import PageItemExtentMap from 'components/PageItemExtentMap';
import PageItemFileDownload from 'components/PageItemFileDownload';
import PageItemFilePreview from 'containers/PageItemFilePreview';
import PageItemImage from 'components/PageItemImage';
import PageItemOrg from 'components/PageItemOrg';
import PageItemResource from 'components/PageItemResource';
import PageItemSchema from 'components/PageItemSchema';
import PageItemSearchPage from 'components/PageItemSearchPage';
import PageItemSocial from 'components/PageItemSocial';
import PageItemString from 'components/PageItemString';
import PageItemTag from 'components/PageItemTag';
import PageItemText from 'components/PageItemText';
import PageItemTheme from 'components/PageItemTheme';
import SectionTypeMain from 'components/SectionTypeMain';
import SectionTypeTitle from 'components/SectionTypeTitle';
import SectionTypeLeft from 'components/SectionTypeLeft';
import SectionTypeTable from 'components/SectionTypeTable';
export class PageSection extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
const pageItems = {
PageItemFileDownload,
PageItemFilePreview,
PageItemImage,
PageItemOrg,
PageItemSchema,
PageItemString,
PageItemText,
PageItemTag,
PageItemTheme,
PageItemExtentMap,
PageItemSearchPage,
PageItemResource,
PageItemSocial,
};
const SectionTypes = {
SectionTypeMain,
SectionTypeLeft,
SectionTypeTable,
SectionTypeTitle,
};
const { doc, pageSchema, schema, type } = this.props;
const SectionComponent = SectionTypes[`SectionType${type}`];
const fields = pageSchema ? pageSchema[type] : {};
if (fields && doc) {
const section = Object.keys(fields).map((field, index) => {
const Component = pageItems[`PageItem${fields[field].type}`];
const label = 'label' in fields[field] ? [field].label : false;
const labelValue = field === 'widget' ? '' : schema.properties[field].title;
const def = fields[field];
const item = {
data: {
field,
doc,
def,
value: doc[field],
},
};
if (field in doc || field === 'widget') {
return (<Component labelValue={labelValue} label={label} key={index} {...item} />);
}
},'<div></div>');
return (
<SectionComponent {...section} />
);
} else {
return (<span></span>)
}
}
}
PageSection.propTypes = {
doc: PropTypes.oneOfType([
PropTypes.object,
PropTypes.bool,
]),
schema: PropTypes.oneOfType([
PropTypes.object,
PropTypes.bool,
]),
type: PropTypes.string,
};
export default connect()(PageSection);
|
app/javascript/mastodon/features/compose/components/search_results.js | hyuki0000/mastodon | import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';
import AccountContainer from '../../../containers/account_container';
import StatusContainer from '../../../containers/status_container';
import Link from 'react-router-dom/Link';
import ImmutablePureComponent from 'react-immutable-pure-component';
export default class SearchResults extends ImmutablePureComponent {
static propTypes = {
results: ImmutablePropTypes.map.isRequired,
};
render () {
const { results } = this.props;
let accounts, statuses, hashtags;
let count = 0;
if (results.get('accounts') && results.get('accounts').size > 0) {
count += results.get('accounts').size;
accounts = (
<div className='search-results__section'>
{results.get('accounts').map(accountId => <AccountContainer key={accountId} id={accountId} />)}
</div>
);
}
if (results.get('statuses') && results.get('statuses').size > 0) {
count += results.get('statuses').size;
statuses = (
<div className='search-results__section'>
{results.get('statuses').map(statusId => <StatusContainer key={statusId} id={statusId} />)}
</div>
);
}
if (results.get('hashtags') && results.get('hashtags').size > 0) {
count += results.get('hashtags').size;
hashtags = (
<div className='search-results__section'>
{results.get('hashtags').map(hashtag =>
<Link key={hashtag} className='search-results__hashtag' to={`/timelines/tag/${hashtag}`}>
#{hashtag}
</Link>
)}
</div>
);
}
return (
<div className='search-results'>
<div className='search-results__header'>
<FormattedMessage id='search_results.total' defaultMessage='{count, number} {count, plural, one {result} other {results}}' values={{ count }} />
</div>
{accounts}
{statuses}
{hashtags}
</div>
);
}
}
|
js/components/pages/NotFound.js | jvalen/nth-days-old | import React from 'react';
import { Link } from 'react-router';
const NotFound = function () {
return (
<article>
<h1>404 Not found</h1>
<Link to="/" className="btn">Home</Link>
</article>
);
};
export default NotFound;
|
ExampleApp/src/AppContainer.js | damianham/react-native-audio-kit | import React from 'react';
import {
Text,
View,
StyleSheet,
Switch,
Slider
} from 'react-native';
import Button from 'react-native-button';
import {
Player,
Recorder,
MediaStates
} from 'react-native-audio-toolkit';
let filename = 'test.mp4';
class AppContainer extends React.Component {
constructor() {
super();
this.state = {
playPauseButton: 'Preparing...',
recordButton: 'Preparing...',
stopButtonDisabled: true,
playButtonDisabled: true,
recordButtonDisabled: true,
loopButtonStatus: false,
progress: 0,
error: null
};
}
componentWillMount() {
this.player = null;
this.recorder = null;
this.lastSeek = 0;
this._reloadPlayer();
this._reloadRecorder();
this._progressInterval = setInterval(() => {
if (this.player && this._shouldUpdateProgressBar()) {// && !this._dragging) {
this.setState({progress: Math.max(0, this.player.currentTime) / this.player.duration});
}
}, 100);
}
componentWillUnmount() {
//console.log('unmount');
// TODO
clearInterval(this._progressInterval);
}
_shouldUpdateProgressBar() {
// Debounce progress bar update by 200 ms
return Date.now() - this.lastSeek > 200;
}
_updateState(err) {
this.setState({
playPauseButton: this.player && this.player.isPlaying ? 'Pause' : 'Play',
recordButton: this.recorder && this.recorder.isRecording ? 'Stop' : 'Record',
stopButtonDisabled: !this.player || !this.player.canStop,
playButtonDisabled: !this.player || !this.player.canPlay || this.recorder.isRecording,
recordButtonDisabled: !this.recorder || (this.player && !this.player.isStopped),
});
}
_playPause() {
this.player.playPause((err, playing) => {
if (err) {
this.setState({
error: err.message
});
}
this._updateState();
});
}
_stop() {
this.player.stop(() => {
this._updateState();
});
}
_seek(percentage) {
if (!this.player) {
return;
}
this.lastSeek = Date.now();
let position = percentage * this.player.duration;
this.player.seek(position, () => {
this._updateState();
});
}
_reloadPlayer() {
if (this.player) {
this.player.destroy();
}
this.player = new Player(filename, {
autoDestroy: false
}).prepare((err) => {
if (err) {
console.log('error at _reloadPlayer():');
console.log(err);
} else {
this.player.looping = this.state.loopButtonStatus;
}
this._updateState();
});
this._updateState();
this.player.on('ended', () => {
this._updateState();
});
this.player.on('pause', () => {
this._updateState();
});
}
_reloadRecorder() {
if (this.recorder) {
this.recorder.destroy();
}
this.recorder = new Recorder(filename, {
bitrate: 256000,
channels: 2,
sampleRate: 44100,
quality: 'max'
//format: 'ac3', // autodetected
//encoder: 'aac', // autodetected
});
this._updateState();
}
_toggleRecord() {
if (this.player) {
this.player.destroy();
}
this.recorder.toggleRecord((err, stopped) => {
if (err) {
this.setState({
error: err.message
});
}
if (stopped) {
this._reloadPlayer();
this._reloadRecorder();
}
this._updateState();
});
}
_toggleLooping(value) {
this.setState({
loopButtonStatus: value
});
if (this.player) {
this.player.looping = value;
}
}
render() {
return (
<View>
<View>
<Text style={styles.title}>
Playback
</Text>
</View>
<View style={styles.buttonContainer}>
<Button disabled={this.state.playButtonDisabled} style={styles.button} onPress={() => this._playPause()}>
{this.state.playPauseButton}
</Button>
<Button disabled={this.state.stopButtonDisabled} style={styles.button} onPress={() => this._stop()}>
Stop
</Button>
</View>
<View style={styles.settingsContainer}>
<Switch
onValueChange={(value) => this._toggleLooping(value)}
value={this.state.loopButtonStatus} />
<Text>Toggle Looping</Text>
</View>
<View style={styles.slider}>
<Slider step={0.0001} disabled={this.state.playButtonDisabled} onValueChange={(percentage) => this._seek(percentage)} value={this.state.progress}/>
</View>
<View>
<Text style={styles.title}>
Recording
</Text>
</View>
<View style={styles.buttonContainer}>
<Button disabled={this.state.recordButtonDisabled} style={styles.button} onPress={() => this._toggleRecord()}>
{this.state.recordButton}
</Button>
</View>
<View>
<Text style={styles.errorMessage}>{this.state.error}</Text>
</View>
</View>
);
}
}
var styles = StyleSheet.create({
button: {
padding: 20,
fontSize: 20,
backgroundColor: 'white',
},
slider: {
height: 10,
margin: 10,
},
buttonContainer: {
flex: 1,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
settingsContainer: {
flex: 1,
justifyContent: 'space-between',
alignItems: 'center',
},
container: {
borderRadius: 4,
borderWidth: 0.5,
borderColor: '#d6d7da',
},
title: {
fontSize: 19,
fontWeight: 'bold',
textAlign: 'center',
padding: 20,
},
errorMessage: {
fontSize: 15,
textAlign: 'center',
padding: 10,
color: 'red'
}
});
export default AppContainer;
|
packages/app/app/components/SearchResults/PlaylistResults/index.js | nukeop/nuclear | import React from 'react';
import TracksResults from '../TracksResults';
import FontAwesome from 'react-fontawesome';
import artPlaceholder from '../../../../resources/media/art_placeholder.png';
import _ from 'lodash';
import { withTranslation } from 'react-i18next';
import styles from './styles.scss';
@withTranslation('search')
class PlaylistResults extends React.Component {
constructor(props) {
super(props);
}
addTrack(track) {
if (typeof track !== 'undefined') {
this.props.addToQueue({
artist: track.artist,
name: track.name,
thumbnail: track.thumbnail ?? _.get(track, 'image[1][\'#text\']', artPlaceholder)
});
}
}
renderAddAllButton(tracks) {
return (tracks.length > 0 ? <a
key='add-all-tracks-to-queue'
href='#'
onClick={() => {
tracks
.map(track => {
this.addTrack(track);
});
}}
className={styles.add_button}
aria-label={this.props.t('queue-add')}
>
<FontAwesome name='plus' /> Add all
</a> : null
);
}
renderLoading() {
return (<div>Loading... <FontAwesome name='spinner' pulse /></div>);
}
renderResults = () =>
<div>
{this.renderAddAllButton(this.props.playlistSearchResults.info)}
<TracksResults
clearQueue={this.props.clearQueue}
startPlayback={this.props.startPlayback}
selectSong={this.props.selectSong}
addToQueue={this.props.addToQueue}
tracks={this.props.playlistSearchResults.info}
limit='100'
streamProviders={this.props.streamProviders}
/></div>
renderNoResult() {
return (<div>{this.props.t('empty')}</div>);
}
render() {
return (
this.props.playlistSearchStarted ? ((this.props.playlistSearchStarted.length > 0 && typeof this.props.playlistSearchResults.info === 'undefined') ? this.renderLoading() : this.renderResults()) : this.renderNoResult()
);
}
}
export default PlaylistResults;
|
shared/components/counter/counter.js | lsjroberts/react-redux-skeleton | import React, { Component } from 'react';
import styles from './counter.scss';
export class Counter extends Component {
render() {
const { count, onIncrement, onDecrement } = this.props;
return (
<div className={ styles.default }>
<button onClick={ onDecrement }>-</button>
{ count }
<button onClick={ onIncrement }>+</button>
</div>
);
}
}
|
src/client/assets/javascripts/app/index.js | nicksp/redux-webpack-es6-boilerplate | import React from 'react';
import { render } from 'react-dom';
import { browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import { AppContainer } from 'react-hot-loader';
import Redbox from 'redbox-react';
import Root from './Root';
import configureStore from './store/configureStore';
import 'styles/bootstrap.min.css';
import 'styles/styles.scss';
const store = configureStore();
const history = syncHistoryWithStore(browserHistory, store);
// Get the DOM Element that will host our React application
const rootEl = document.getElementById('app');
// Render the React application to the DOM
render(
<AppContainer errorReporter={Redbox}>
<Root store={store} history={history} />
</AppContainer>,
rootEl
);
if (module.hot) {
/**
* Warning from React Router, caused by react-hot-loader.
* The warning can be safely ignored, so filter it from the console.
* Otherwise you'll see it every time something changes.
* See https://github.com/gaearon/react-hot-loader/issues/298
*/
const orgError = console.error; // eslint-disable-line no-console
console.error = (message) => { // eslint-disable-line no-console
if (message && message.indexOf('You cannot change <Router routes>;') === -1) {
// Log the error as normally
orgError.apply(console, [message]);
}
};
module.hot.accept('./Root', () => {
// If you use Webpack 2 in ES modules mode, you can
// use <App /> here rather than require() a <NextApp />.
const NextApp = require('./Root').default;
render(
<AppContainer errorReporter={Redbox}>
<NextApp store={store} history={history} />
</AppContainer>,
rootEl
);
});
}
|
app/components/ToggleOption/index.js | darrellesh/redux-react-boilerplate | /**
*
* ToggleOption
*
*/
import React from 'react';
import { injectIntl, intlShape } from 'react-intl';
const ToggleOption = ({ value, message, intl }) => (
<option value={value}>
{message ? intl.formatMessage(message) : value}
</option>
);
ToggleOption.propTypes = {
value: React.PropTypes.string.isRequired,
message: React.PropTypes.object,
intl: intlShape.isRequired,
};
export default injectIntl(ToggleOption);
|
src/routes/privacy/index.js | ziedAb/PVMourakiboun | /**
* 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 React from 'react';
import Layout from '../../components/Layout';
import Page from '../../components/Page';
export default {
path: '/privacy',
async action() {
const data = await require.ensure([], require => require('./privacy.md'), 'privacy');
return {
title: data.title,
chunk: 'privacy',
component: <Layout><Page {...data} /></Layout>,
};
},
};
|
src/containers/BusinessPage.js | nickeblewis/walkapp | /**
* Component that lists all Posts
*/
import React from 'react'
import Business from '../components/Business'
import { graphql } from 'react-apollo'
import gql from 'graphql-tag'
class BusinessPage extends React.Component {
static propTypes = {
data: React.PropTypes.object,
}
render () {
if (this.props.data.loading) {
return (<div>Loading</div>)
}
return (
<div className="tl bt b--black-10 pa3 pa5-ns bg-lightest-green navy">
<div className="mw9 center">
<h1 className="f5 ttu tracked fw6">Business Directory</h1>
<section className="lh-copy">
<div className="cf">
{this.props.data.allBusinesses.map((business) =>
<Business key={business.id} business={business} />
)}
</div>
</section>
</div>
</div>
)
}
}
const FeedQuery = gql`query allBusinesses {
allBusinesses(orderBy: businessName_ASC) {
id
contactName
businessName
emailAddress
}
}`
const BusinessPageWithData = graphql(FeedQuery)(BusinessPage)
export default BusinessPageWithData
|
demo/app/components/base/Notice.js | itpkg/web | import React from 'react'
import { Alert } from 'react-bootstrap';
export const Index = React.createClass({
render: function() {
return (
<Alert bsStyle="warning">
<strong>Holy guacamole!</strong> Best check yo self, youre not looking too good.
</Alert>
);
}
});
export const Show = React.createClass({
render: function() {
return (
<div>
notice {this.props.id}
</div>
);
}
});
|
blueocean-material-icons/src/js/components/svg-icons/social/notifications-active.js | kzantow/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const SocialNotificationsActive = (props) => (
<SvgIcon {...props}>
<path d="M7.58 4.08L6.15 2.65C3.75 4.48 2.17 7.3 2.03 10.5h2c.15-2.65 1.51-4.97 3.55-6.42zm12.39 6.42h2c-.15-3.2-1.73-6.02-4.12-7.85l-1.42 1.43c2.02 1.45 3.39 3.77 3.54 6.42zM18 11c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2v-5zm-6 11c.14 0 .27-.01.4-.04.65-.14 1.18-.58 1.44-1.18.1-.24.15-.5.15-.78h-4c.01 1.1.9 2 2.01 2z"/>
</SvgIcon>
);
SocialNotificationsActive.displayName = 'SocialNotificationsActive';
SocialNotificationsActive.muiName = 'SvgIcon';
export default SocialNotificationsActive;
|
frontend/app/js/components/app.js | pivotal/pulse | import React from 'react';
import Alert from './alert';
export default class App extends React.Component {
render() {
let { alert } = this.props.ui;
return (
<div>
<Alert {...alert} />
{this.props.children}
</div>
);
}
}
|
docs/app/Examples/elements/Label/Groups/LabelExampleGroupTag.js | aabustamante/Semantic-UI-React | import React from 'react'
import { Label } from 'semantic-ui-react'
const LabelExampleGroupTag = () => (
<Label.Group tag>
<Label as='a'>$10.00</Label>
<Label as='a'>$19.99</Label>
<Label as='a'>$24.99</Label>
<Label as='a'>$30.99</Label>
<Label as='a'>$10.25</Label>
</Label.Group>
)
export default LabelExampleGroupTag
|
src/desktop/apps/categories/components/FeaturedGenes.js | kanaabe/force | import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import FeaturedGene from './FeaturedGene'
const propTypes = {
featuredGenes: PropTypes.object
}
const Layout = styled.div`
display: none;
@media (min-width: 768px) {
display: block;
padding-top: 1em;
column-count: 3;
column-gap: 2em;
}
`
const FeaturedGenes = ({ featuredGenes }) => {
return (
<Layout>
{featuredGenes &&
featuredGenes.genes.length > 0 &&
featuredGenes.genes
.map(featuredGene => (
<FeaturedGene key={featuredGene.id} {...featuredGene} />
))
.slice(0, 3)}
</Layout>
)
}
FeaturedGenes.propTypes = propTypes
export default FeaturedGenes
|
client/node_modules/uu5g03/doc/main/server/public/data/source/uu5-bricks-nav-bar-header.js | UnicornCollege/ucl.itkpd.configurator | import React from 'react';
import {BaseMixin, ElementaryMixin, ContentMixin} from '../common/common.js';
import Button from './button.js';
import Glyphicon from './glyphicon.js';
import './nav-bar-header.less';
export default React.createClass({
//@@viewOn:mixins
mixins: [
BaseMixin,
ElementaryMixin,
ContentMixin
],
//@@viewOff:mixins
//@@viewOn:statics
statics: {
tagName: 'UU5.Bricks.NavBar.Header',
classNames: {
main: 'uu5-bricks-nav-bar-header navbar-header',
hamburger: 'uu5-bricks-nav-bar-header-hamburger navbar-toggle',
brand: 'uu5-bricks-nav-bar-header-brand navbar-brand'
},
defaults: {
parentTagName: 'UU5.Bricks.NavBar'
}
},
//@@viewOff:statics
//@@viewOn:propTypes
propTypes: {
_glyphicon: React.PropTypes.string,
_hamburger: React.PropTypes.bool,
_onOpen: React.PropTypes.func,
_onClose: React.PropTypes.func
},
//@@viewOff:propTypes
//@@viewOn:getDefaultProps
getDefaultProps: function () {
return {
_glyphicon: 'uu-glyphicon-menu',
_hamburger: true,
_onOpen: null,
_onClose: null
};
},
//@@viewOff:getDefaultProps
//@@viewOn:standardComponentLifeCycle
componentWillMount: function () {
this.checkParentTagName(this.getDefault().parentTagName);
},
//@@viewOff:standardComponentLifeCycle
//@@viewOn:interface
//@@viewOff:interface
//@@viewOn:overridingMethods
//@@viewOff:overridingMethods
//@@viewOn:componentSpecificHelpers
_onClickHamburger: function () {
var header = this;
this.getParent() && this.getParent().toggle(function () {
if (this.isOpened()) {
header.props._onOpen && header.props._onOpen(this);
} else {
header.props._onClose && header.props._onClose(this);
}
});
},
_getHamburgerProps: function () {
return {
className: this.getClassName().hamburger,
onClick: this._onClickHamburger
};
},
//@@viewOff:componentSpecificHelpers
//@@viewOn:render
render: function () {
var hamburger = null;
if (this.props._hamburger) {
hamburger = (
<Button {...this._getHamburgerProps()}>
<Glyphicon glyphicon={this.props._glyphicon} />
</Button>
);
}
var children = this.getChildren();
if (children) {
children = (
<span className={this.getClassName().brand}>
{this.getChildren()}
</span>
);
}
return (
<div {...this.buildMainAttrs()}>
{hamburger}
{children}
{this.getDisabledCover()}
</div>
);
}
//@@viewOff:render
}); |
src/svg-icons/image/photo-album.js | mit-cml/iot-website-source | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImagePhotoAlbum = (props) => (
<SvgIcon {...props}>
<path d="M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4zm0 15l3-3.86 2.14 2.58 3-3.86L18 19H6z"/>
</SvgIcon>
);
ImagePhotoAlbum = pure(ImagePhotoAlbum);
ImagePhotoAlbum.displayName = 'ImagePhotoAlbum';
ImagePhotoAlbum.muiName = 'SvgIcon';
export default ImagePhotoAlbum;
|
src/components/bank/Features.js | hackclub/website | import React from 'react'
import styled from 'styled-components'
import {
Box,
Container,
Flex,
Heading,
Icon,
Link as A,
Text,
theme
} from '@hackclub/design-system'
import { Headline, Lead } from 'components/Content'
const Base = styled(Box.section).attrs({ bg: 'dark', color: 'gray.3' })``
const Modules = styled(Container)`
display: grid;
grid-gap: ${theme.space[3]}px;
${theme.mediaQueries.md} {
grid-template-columns: repeat(3, 1fr);
grid-gap: ${theme.space[5]}px ${theme.space[4]}px;
> div:first-child {
grid-column: span 3;
}
}
`
Modules.defaultProps = {
px: 3,
mt: [4, null, 3],
mb: 3,
mx: 'auto',
maxWidth: 72
}
const Module = ({ icon, name, body, ...props }) => (
<Flex align="start" {...props}>
<Icon
size={48}
mr={3}
glyph={icon}
color="primary"
style={{ flexShrink: 0 }}
/>
<Box>
<Heading.h3 color="snow" fontSize={3} mb={1} children={name} />
<Text
color="muted"
fontSize={2}
style={{ lineHeight: '1.375' }}
children={body}
/>
</Box>
</Flex>
)
const ModuleDetails = styled(Box).attrs({
bg: '#252429',
color: 'smoke',
mt: 2,
ml: 3,
py: 3,
px: 2
})`
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.0625);
border-radius: ${theme.radii[2]};
ul {
padding: 0;
list-style: none;
}
li + li {
margin-top: ${theme.space[2]}px;
}
`
const ModuleDetailsDocument = styled(Flex.withComponent('li'))``
const Document = ({ name, cost }) => (
<ModuleDetailsDocument align={cost ? 'start' : 'center'}>
<Icon
size={28}
mr={1}
glyph="payment"
color="success"
style={{ flexShrink: 0 }}
/>
<Box>
<Text fontSize={2} children={name} />
{cost && (
<Text
fontSize={1}
color="muted"
style={{ lineHeight: '1.375' }}
children={cost}
/>
)}
</Box>
</ModuleDetailsDocument>
)
const Laptop = styled.a`
display: block;
width: 100%;
height: 100%;
min-height: 16rem;
background-size: auto 115%;
background-image: url('/bank/laptop-light.png');
background-position: center top;
background-repeat: no-repeat;
@media (prefers-color-scheme: dark) {
background-image: url('/bank/laptop-dark.png');
}
${theme.mediaQueries.md} {
grid-row: span 2;
grid-column: span 2;
}
`
export default () => (
<Base pt={[5, 6, 7]} pb={[4, 5, 6]} color="snow">
<Modules px={3}>
<Box>
<Headline>A full-stack toolkit for organizing anything.</Headline>
<Lead fontSize={[3, 4]} color="muted" maxWidth={48} mx={0}>
Invoice sponsors, issue debit cards to your team, and view history.
<br />
Ongoing support so you can focus on organizing, not the paperwork.
</Lead>
</Box>
<Box>
<Module
icon="bank-account"
name="Bank account"
body="Backed by Silicon Valley Bank with a custom, beautiful dashboard."
/>
<ModuleDetails>
<Document
name="501(c)(3) nonprofit status"
cost="Become part of Hack Club's legal entity, getting the benefits of our tax status."
/>
<Document
name="Tax filings (990, end-of-year)"
cost="We handle all filings with the IRS, so you can focus on your event, not hiring CPAs."
/>
</ModuleDetails>
</Box>
<Laptop
href="https://bank.hackclub.com/hackpenn"
target="_blank"
title="See Hack Pennsylvania’s finances in public"
/>
<Module
icon="card"
name="Debit cards"
body={
<>
Issue physical debit cards to all your teammates, backed by{' '}
<A
href="https://stripe.com/issuing"
color="smoke"
hoverline
target="_blank"
>
Stripe
</A>
.
</>
}
/>
<Module
icon="analytics"
name="Balance & history"
body="Check real-time account balance + transaction history online anytime."
/>
<Module
icon="payment"
name="Built-in invoicing"
body="Accept sponsor payments with low negotiated rates from Stripe."
/>
<Module
icon="docs"
name="Pre-written forms"
body="Download liability + photo forms custom written by expert lawyers."
/>
<Module
icon="explore"
name="Transparency Mode"
body="If you’d like, show your finances on public pages for full transparency."
/>
<Module
icon="google"
name="Google Workspace"
body="Get instant, free accounts for your team (like joy@hackpenn.com)."
/>
<Module
icon="support"
name="Support anytime"
body="We’ll never leave you hanging with best-effort 24hr response time."
/>
</Modules>
<Lead maxWidth={28} color="slate" fontSize={3} align="center" mt={[4, 5]}>
Have more questions?
<br />
Check out the{' '}
<A
href="https://bank.hackclub.com/faq"
target="_blank"
color="primary"
hoverline
>
Hack Club Bank FAQ
</A>
.
</Lead>
</Base>
)
|
app/scripts/main.js | dmlond/duke-data-service-portal | import React from 'react';
import ReactDOM from 'react-dom'
import Router from 'react-router';
import routes from './routes';
require('es6-promise').polyfill();
//Needed for onTouchTap
//Can go away when react 1.0 release
//Check this repo:
//https://github.com/zilverline/react-tap-event-plugin
var injectTapEventPlugin = require("react-tap-event-plugin");
injectTapEventPlugin();
let appRouter = Router.create({
routes: routes,
location: Router.HashLocation
});
appRouter.run((Handler, state) => {
ReactDOM.render(<Handler routerPath={state.path} appRouter={appRouter}/>, document.body)
}); |
app/packages/client/src/components/mot/MOT.js | kslat3r/anpr-dashcam | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { ListGroup, ListGroupItem } from 'react-bootstrap';
import Loading from '../loading/Loading';
import './MOT.css';
class MOT extends Component {
static propTypes = {
details: PropTypes.object.isRequired,
}
shouldComponentUpdate(nextProps) {
if (this.props.details.incoming !== nextProps.details.incoming) {
return true;
}
if (this.props.details.item.numberPlate !== nextProps.details.item.numberPlate) {
return true;
}
return false;
}
render() {
let mot;
let motExpires = 'UKNOWN';
if (this.props.details.item.dvlaDetails && this.props.details.item.dvlaDetails.mot !== undefined) {
mot = this.props.details.item.dvlaDetails.mot;
motExpires = this.props.details.item.dvlaDetails.motExpires || 'UNKNOWN';
}
return (
<ListGroup className="mot">
<ListGroupItem header="MOT" className={[mot === undefined ? '' : mot ? 'valid' : 'invalid']}>
{this.props.details.incoming ? (
<Loading />
) : null}
{mot === undefined ? 'UKNOWN' : mot ? `Expires ${motExpires}` : 'Expired'}
</ListGroupItem>
</ListGroup>
)
}
}
export default MOT;
|
fields/components/columns/CloudinaryImageSummary.js | asifiqbal84/keystone | import React from 'react';
// import CloudinaryImage from 'react-cloudinary-img';
import ItemsTableValue from '../../../admin/src/components/ItemsTableValue';
const linkStyle = {
marginRight: 8,
};
const boxStyle = {
borderRadius: 3,
display: 'inline-block',
height: 18,
overflow: 'hidden',
verticalAlign: 'middle',
width: 18,
};
const imageStyle = {
display: 'block',
height: 18,
left: '50%',
position: 'relative',
WebkitTransform: 'translateX(-50%)',
MozTransform: 'translateX(-50%)',
msTransform: 'translateX(-50%)',
transform: 'translateX(-50%)',
};
const textStyle = {
color: '#888',
display: 'inline-block',
fontSize: '.8rem',
marginLeft: 8,
verticalAlign: 'middle'
};
var CloudinaryImageSummary = React.createClass({
displayName: 'CloudinaryImageSummary',
propTypes: {
label: React.PropTypes.oneOf(['dimensions', 'publicId']),
image: React.PropTypes.object.isRequired,
},
renderLabel () {
if (!this.props.label) return;
let { label, image } = this.props;
let text;
if (label === 'dimensions') {
text = `${image.width} × ${image.height}`;
} else {
text = `${image.public_id}.${image.format}`;
}
return (
<span style={textStyle}>
{text}
</span>
);
},
render () {
let { image } = this.props;
return (
<span style={linkStyle}>
<span style={boxStyle}>
<img src={image.url} style={imageStyle} />
</span>
{this.renderLabel()}
</span>
);
}
});
module.exports = CloudinaryImageSummary;
|
example/src/user.js | weflex/react-portal-tooltip | import React from 'react'
import ToolTip from './../../src'
export default class User extends React.Component {
state = {
isTooltipActive: false
}
static coverWrapperStyle = {
width: 370,
height: 80
}
static coverStyle = {
position: 'absolute',
width: 350,
height: 80,
top: 0,
left: 0
}
static avatarStyle = {
position: 'relative',
top: 30,
left: 20,
width: 70,
height: 70
}
showTooltip() {
this.setState({isTooltipActive: true})
}
hideTooltip() {
this.setState({isTooltipActive: false})
}
render() {
return (
<div className={this.props.className}>
<span className="btn btn-link" id={`user-${this.props.id}`} onMouseEnter={::this.showTooltip} onMouseLeave={::this.hideTooltip} style={{cursor: 'pointer'}}>{this.props.username}</span>
<ToolTip active={this.state.isTooltipActive} parent={`#user-${this.props.id}`} position={this.props.position} arrow={this.props.arrow} group={this.props.group}>
<div className="row" style={User.coverWrapperStyle}>
<img src={this.props.cover_250_url} style={User.coverStyle}/>
<a href="#"><img src={this.props.avatar_120_url} style={User.avatarStyle}/></a>
</div>
<div className="row">
<div className="col-sm-12">
<div style={{padding: '30px 10px 10px 10px'}}>
<a href="#">{this.props.screenname}</a>
<span className="text-muted pull-right">
{this.props.videos_total} videos
{this.props.fans_total} followers
</span>
</div>
</div>
</div>
</ToolTip>
</div>
)
}
}
|
client/src/core-components/loading.js | opensupports/opensupports | import React from 'react';
import classNames from 'classnames';
class Loading extends React.Component {
static propTypes = {
backgrounded: React.PropTypes.bool,
size: React.PropTypes.oneOf(['small', 'medium', 'large'])
};
static defaultProps = {
size: 'small',
backgrounded: false
};
render() {
return (
<div className={this.getClass()}>
<span className="loading__icon" />
</div>
);
}
getClass() {
let classes = {
'loading': true,
'loading_backgrounded': (this.props.backgrounded),
'loading_large': (this.props.size === 'large')
};
classes[this.props.className] = (this.props.className);
return classNames(classes);
}
}
export default Loading; |
src/containers/Footer.js | abzfarah/Pearson.NAPLAN.GnomeH | // (C) Copyright 2014-2016 Hewlett Packard Enterprise Development Company, L.P.
import React, { Component } from 'react';
import Anchor from '../components/common/Anchor';
import Paragraph from '../components/common/Paragraph';
import Box from '../components/common/Box';
import Columns from '../components/common/Columns';
import Footer from '../components/common/Footer';
import Menu from '../components/common/Menu';
import classnames from 'classnames';
export default class BlogFooter extends Component {
render () {
return (
<Footer size='small' appCentered={true} colorIndex='light-1'
direction='row' primary={true} justify='center'
pad={{horizontal: 'medium', vertical: 'medium', between: 'medium'}} className="footy" wrap={true}>
<Box direction="row" className="footerContainer" wrap={true} align="center" >
<Box direction="row"className="numberOne">
<Columns className="logo_1" className="flexy1" align="center">
<div className="logo"><img src="http://i.imgur.com/1xspNP5.png" width="78"/></div>
</Columns>
<Box direction="row" className="footer-grid" className="flexy2" >
<Columns>
<div className="item">
<h6>Company</h6>
</div>
<div className="item"><a href="https://auth0.com/pricing">About Us</a></div>
<div className="item"><a href="https://auth0.com/why-auth0">Why Pearson</a></div>
<div className="item"><a href="https://auth0.com/how-it-works">How It Works</a></div>
</Columns>
<Columns>
<div className="item">
<h6>My account</h6>
</div>
<div className="item"><a href="https://auth0.com/about">Log in</a></div>
<div className="item"><a href="https://auth0.com/blog">Sign up</a></div>
</Columns>
<Columns>
<div className="item">
<h6>Careers</h6>
</div>
<div className="item"><a href="https://support.auth0.com">Employment</a></div>
<div className="item"><a href="https://auth0.com/docs">Professional</a></div>
</Columns>
<Columns>
<div className="item">
<h6>Media</h6>
</div>
<div className="item"><a href="https://auth0.com/lock">Media enqueries</a></div>
</Columns>
<Columns size="large" className="outcol">
<div className="item">
<h6>Contact</h6>
</div>
<div className="item item-text">Level 1, 2 Lonsdale Street<br/>Suite 700<br/>Melbourne, VIC 3000</div>
</Columns>
<Box className="contacts">
<div className="no-heading">
<div className="item"><a href="tel:+18882352699">+61 (03) 9032 1700</a></div>
<div className="item"><a href="tel:+14253126521">+61 (425) 1800 134 197</a></div>
<div className="item"><a href="https://support.auth0.com">Support Center</a></div>
</div>
</Box>
</Box>
</Box>
<Box direction="row" className="colopon" className="flexy3" >
<div className="column flexy4">
<div className="social">
<div className="twitter">
<iframe scrolling="no" src="//platform.twitter.com/widgets/follow_button.html?screen_name=VicGovAu" className="twitter"></iframe>
</div>
<div className="facebook">
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Ffacebook.com%2Fgetauth0&width&layout=button_count&action=like&show_faces=false&show_count=false&share=false&height=21&appId=507756515938786" scrolling="no" className="facebook"></iframe>
</div>
</div>
</div>
<ul className="column list-inline flexy5" >
<li className="listy"><a href="https://auth0.com/privacy">Privacy Policy</a></li>
<li className="listy"><a href="https://auth0.com/terms">Terms of Service</a></li>
<li className="listy"><span>© 2013-2016 VCAA®. All Rights Reserved.</span></li>
</ul>
</Box>
</Box>
</Footer>
);
}
}
|
stories/MultiSelect/ExampleStandard.js | nirhart/wix-style-react | import React from 'react';
import MultiSelect from 'wix-style-react/MultiSelect';
import styles from './ExampleStandard.scss';
import isstring from 'lodash.isstring';
const options = [
{value: 'Alabama', id: 'Alabama', tag: {label: 'Alabama'}},
{value: 'Alaska', id: 'Alaska'},
{value: <div className={styles.option}><div>Arizona</div><div className={styles.thumb}/></div>, id: 'Arizona', tag: {label: 'Arizona', thumb: <div className={styles.thumb}/>}},
{value: 'Arkansas', id: 'Arkansas', tag: {label: 'Arkansas'}},
{value: 'Arkansas', id: 'Arkansas'},
{value: 'California', id: 'California'},
{value: 'California2', id: 'California2'},
{value: 'California3', id: 'California3'},
{value: 'California4', id: 'California4'},
{value: 'California5', id: 'California5'},
{value: 'California6', id: 'California6'},
{value: 'California7', id: 'California7'},
{value: 'Two words', id: 'Two words'}
];
class ExampleStandard extends React.Component {
constructor(props) {
super(props);
this.state = {
tags: [],
options,
inputValue: ''
};
}
getValue = option => isstring(option.value) ? option.value : option.value.props.children[0].props.children;
handleOnSelect = tag => this.setState({tags: [...this.state.tags, tag]});
handleOnRemoveTag = tagId => this.setState({tags: this.state.tags.filter(currTag => currTag.id !== tagId)});
handleOnChange = event => this.setState({inputValue: event.target.value});
predicate = option => this.getValue(option).toLowerCase().includes(this.state.inputValue.toLowerCase());
render() {
return (
<div className={styles.main}>
<MultiSelect
tags={this.state.tags}
onSelect={this.handleOnSelect}
onRemoveTag={this.handleOnRemoveTag}
onChange={this.handleOnChange}
onManuallyInput={this.handleOnSelect}
options={this.state.options}
value={this.state.inputValue}
predicate={this.predicate}
/>
</div>
);
}
}
export default ExampleStandard;
|
app/javascript/mastodon/components/relative_timestamp.js | mstdn-jp/mastodon | import React from 'react';
import { injectIntl, defineMessages } from 'react-intl';
import PropTypes from 'prop-types';
const messages = defineMessages({
just_now: { id: 'relative_time.just_now', defaultMessage: 'now' },
seconds: { id: 'relative_time.seconds', defaultMessage: '{number}s' },
minutes: { id: 'relative_time.minutes', defaultMessage: '{number}m' },
hours: { id: 'relative_time.hours', defaultMessage: '{number}h' },
days: { id: 'relative_time.days', defaultMessage: '{number}d' },
});
const dateFormatOptions = {
hour12: false,
year: 'numeric',
month: 'short',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
};
const shortDateFormatOptions = {
month: 'short',
day: 'numeric',
};
const SECOND = 1000;
const MINUTE = 1000 * 60;
const HOUR = 1000 * 60 * 60;
const DAY = 1000 * 60 * 60 * 24;
const MAX_DELAY = 2147483647;
const selectUnits = delta => {
const absDelta = Math.abs(delta);
if (absDelta < MINUTE) {
return 'second';
} else if (absDelta < HOUR) {
return 'minute';
} else if (absDelta < DAY) {
return 'hour';
}
return 'day';
};
const getUnitDelay = units => {
switch (units) {
case 'second':
return SECOND;
case 'minute':
return MINUTE;
case 'hour':
return HOUR;
case 'day':
return DAY;
default:
return MAX_DELAY;
}
};
@injectIntl
export default class RelativeTimestamp extends React.Component {
static propTypes = {
intl: PropTypes.object.isRequired,
timestamp: PropTypes.string.isRequired,
year: PropTypes.number.isRequired,
};
state = {
now: this.props.intl.now(),
};
static defaultProps = {
year: (new Date()).getFullYear(),
};
shouldComponentUpdate (nextProps, nextState) {
// As of right now the locale doesn't change without a new page load,
// but we might as well check in case that ever changes.
return this.props.timestamp !== nextProps.timestamp ||
this.props.intl.locale !== nextProps.intl.locale ||
this.state.now !== nextState.now;
}
componentWillReceiveProps (nextProps) {
if (this.props.timestamp !== nextProps.timestamp) {
this.setState({ now: this.props.intl.now() });
}
}
componentDidMount () {
this._scheduleNextUpdate(this.props, this.state);
}
componentWillUpdate (nextProps, nextState) {
this._scheduleNextUpdate(nextProps, nextState);
}
componentWillUnmount () {
clearTimeout(this._timer);
}
_scheduleNextUpdate (props, state) {
clearTimeout(this._timer);
const { timestamp } = props;
const delta = (new Date(timestamp)).getTime() - state.now;
const unitDelay = getUnitDelay(selectUnits(delta));
const unitRemainder = Math.abs(delta % unitDelay);
const updateInterval = 1000 * 10;
const delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
this._timer = setTimeout(() => {
this.setState({ now: this.props.intl.now() });
}, delay);
}
render () {
const { timestamp, intl, year } = this.props;
const date = new Date(timestamp);
const delta = this.state.now - date.getTime();
let relativeTime;
if (delta < 10 * SECOND) {
relativeTime = intl.formatMessage(messages.just_now);
} else if (delta < 7 * DAY) {
if (delta < MINUTE) {
relativeTime = intl.formatMessage(messages.seconds, { number: Math.floor(delta / SECOND) });
} else if (delta < HOUR) {
relativeTime = intl.formatMessage(messages.minutes, { number: Math.floor(delta / MINUTE) });
} else if (delta < DAY) {
relativeTime = intl.formatMessage(messages.hours, { number: Math.floor(delta / HOUR) });
} else {
relativeTime = intl.formatMessage(messages.days, { number: Math.floor(delta / DAY) });
}
} else if (date.getFullYear() === year) {
relativeTime = intl.formatDate(date, shortDateFormatOptions);
} else {
relativeTime = intl.formatDate(date, { ...shortDateFormatOptions, year: 'numeric' });
}
return (
<time dateTime={timestamp} title={intl.formatDate(date, dateFormatOptions)}>
{relativeTime}
</time>
);
}
}
|
src/Toolbar/Toolbar.js | dimik/react-material-web-components | import React from 'react'
import PropTypes from 'prop-types'
import {MDCComponent} from '../MDCComponent'
import {MDCToolbar} from '@material/toolbar/dist/mdc.toolbar'
import classNames from 'classnames'
class Toolbar extends MDCComponent {
static displayName = 'Toolbar'
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
fixed: PropTypes.bool,
fixedAdjustElementSelector: PropTypes.string,
fixedAtLastRow: PropTypes.bool,
fixedLastRowOnly: PropTypes.bool,
flexible: PropTypes.bool,
flexibleDefaultBehavior: PropTypes.bool,
flexibleMax: PropTypes.bool,
flexibleMin: PropTypes.bool,
onChange: PropTypes.func,
waterfall: PropTypes.bool,
}
static defaultProps = {
onChange: () => {},
fixedAdjustElementSelector: '.mdc-toolbar-fixed-adjust',
}
componentDidMount() {
super.componentDidMount()
this._setupListeners()
}
componentDidUpdate() {
this.component_.destroy()
this.component_ = this.attachTo(this.root_)
const fixedAdjustElement = document.querySelector(this.props.fixedAdjustElementSelector)
if (fixedAdjustElement) {
this.component_.fixedAdjustElement = fixedAdjustElement
}
}
componentWillUnmount() {
this._clearListeners()
super.componentWillUnmount()
}
attachTo(el) {
return new MDCToolbar(el)
}
_setupListeners() {
this.listen(
'MDCToolbar:change',
this.changeListener_ = e => this.props.onChange(e, e.detail)
)
}
_clearListeners() {
this.unlisten(
'MDCToolbar:change',
this.changeListener_
)
}
render() {
const {
children,
className,
fixed,
fixedAdjustElementSelector,
fixedAtLastRow,
fixedLastRowOnly,
flexible,
flexibleDefaultBehavior,
flexibleMax,
flexibleMin,
onChange,
waterfall,
...otherProps,
} = this.props
const cssClasses = classNames({
'mdc-toolbar': true,
'mdc-toolbar--fixed': fixed,
'mdc-toolbar--fixed-at-last-row': fixedAtLastRow,
'mdc-toolbar--fixed-lastrow-only': fixedLastRowOnly,
'mdc-toolbar--flexible': flexible,
'mdc-toolbar--flexible-default-behavior': flexibleDefaultBehavior,
'mdc-toolbar--flexible-space-maximized': flexibleMax,
'mdc-toolbar--flexible-space-minimized': flexibleMin,
'mdc-toolbar--waterfall': waterfall,
}, className)
return (
<header
{...otherProps}
className={cssClasses}
ref={el => this.root_ = el}
>
{children}
</header>
)
}
}
export default Toolbar
|
src/components/Weui/cell/cells_title.js | ynu/ecard-wxe | /*
eslint-disable
*/
import React from 'react';
import classNames from 'classnames';
export default class CellsTitle extends React.Component {
render() {
const {className, children, ...others} = this.props;
const cls = classNames({
'weui-cells__title': true,
[className]: className
});
return (
<div className={cls} {...others}>{children}</div>
);
}
};
|
src/index.js | yoke233/react-test | import React from 'react';
import { Provider } from 'react-redux';
import App from './containers/App';
import configureStore from './store/configureStore';
const store = configureStore();
React.render(
<Provider store={store}>
{() => <App />}
</Provider>,
document.getElementById('root')
);
|
app/javascript/mastodon/components/regeneration_indicator.js | tootcafe/mastodon | import React from 'react';
import { FormattedMessage } from 'react-intl';
import illustration from 'mastodon/../images/elephant_ui_working.svg';
const RegenerationIndicator = () => (
<div className='regeneration-indicator'>
<div className='regeneration-indicator__figure'>
<img src={illustration} alt='' />
</div>
<div className='regeneration-indicator__label'>
<FormattedMessage id='regeneration_indicator.label' tagName='strong' defaultMessage='Loading…' />
<FormattedMessage id='regeneration_indicator.sublabel' defaultMessage='Your home feed is being prepared!' />
</div>
</div>
);
export default RegenerationIndicator;
|
react-client/src/components/users/DeleteUserForm.js | danieluy/radiocero_premios | import React, { Component } from 'react';
import { deleteUser } from '../../radiocero-api'
import session from '../../session'
import styles from '../../assets/styles'
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
class DeleteUserForm extends Component {
constructor(props) {
super(props)
this.state = {
user: null,
loggedUser: session.getLocalUser()
}
}
componentWillReceiveProps(nextProps) {
if (nextProps.user !== this.state.user)
this.setState({ user: nextProps.user })
}
deleteUser() {
deleteUser(this.state.user)
.then(res => {
this.props.onActionSuccess()
this.handleClose()
})
.catch(err => {
console.error(err)
})
}
handleClose() {
this.setState({ user: null })
this.props.onActionCanceled()
}
render() {
if (this.state.user) {
const actions = [
<FlatButton
label="Eliminar"
onClick={this.deleteUser.bind(this)}
/>,
<RaisedButton
label="Cancelar"
primary={true}
onClick={this.handleClose.bind(this)}
style={{ marginLeft: '5px' }}
/>,
];
return (
<Dialog
title={`Eliminar usuario ${this.state.user.userName}?`}
actions={actions}
modal={false}
open={!!this.state.user}
onRequestClose={this.handleClose.bind(this)}
contentStyle={styles.dialog}
autoScrollBodyContent={true}
>
<p>Esta acción NO se puede deshacer</p>
</Dialog>
);
}
return null;
}
}
export default DeleteUserForm; |
node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js | asrar7787/Test-Frontools | import React from 'react';
import { render } from 'react-dom';
// 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';
render(<HelloWorld />, document.getElementById('react-root'));
|
app/javascript/mastodon/components/admin/Dimension.js | MitarashiDango/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import api from 'mastodon/api';
import { FormattedNumber } from 'react-intl';
import { roundTo10 } from 'mastodon/utils/numbers';
import Skeleton from 'mastodon/components/skeleton';
export default class Dimension extends React.PureComponent {
static propTypes = {
dimension: PropTypes.string.isRequired,
start_at: PropTypes.string.isRequired,
end_at: PropTypes.string.isRequired,
limit: PropTypes.number.isRequired,
label: PropTypes.string.isRequired,
params: PropTypes.object,
};
state = {
loading: true,
data: null,
};
componentDidMount () {
const { start_at, end_at, dimension, limit, params } = this.props;
api().post('/api/v1/admin/dimensions', { keys: [dimension], start_at, end_at, limit, [dimension]: params }).then(res => {
this.setState({
loading: false,
data: res.data,
});
}).catch(err => {
console.error(err);
});
}
render () {
const { label, limit } = this.props;
const { loading, data } = this.state;
let content;
if (loading) {
content = (
<table>
<tbody>
{Array.from(Array(limit)).map((_, i) => (
<tr className='dimension__item' key={i}>
<td className='dimension__item__key'>
<Skeleton width={100} />
</td>
<td className='dimension__item__value'>
<Skeleton width={60} />
</td>
</tr>
))}
</tbody>
</table>
);
} else {
const sum = data[0].data.reduce((sum, cur) => sum + (cur.value * 1), 0);
content = (
<table>
<tbody>
{data[0].data.map(item => (
<tr className='dimension__item' key={item.key}>
<td className='dimension__item__key'>
<span className={`dimension__item__indicator dimension__item__indicator--${roundTo10(((item.value * 1) / sum) * 100)}`} />
<span title={item.key}>{item.human_key}</span>
</td>
<td className='dimension__item__value'>
{typeof item.human_value !== 'undefined' ? item.human_value : <FormattedNumber value={item.value} />}
</td>
</tr>
))}
</tbody>
</table>
);
}
return (
<div className='dimension'>
<h4>{label}</h4>
{content}
</div>
);
}
}
|
src/svg-icons/image/panorama-horizontal.js | verdan/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImagePanoramaHorizontal = (props) => (
<SvgIcon {...props}>
<path d="M20 6.54v10.91c-2.6-.77-5.28-1.16-8-1.16-2.72 0-5.4.39-8 1.16V6.54c2.6.77 5.28 1.16 8 1.16 2.72.01 5.4-.38 8-1.16M21.43 4c-.1 0-.2.02-.31.06C18.18 5.16 15.09 5.7 12 5.7c-3.09 0-6.18-.55-9.12-1.64-.11-.04-.22-.06-.31-.06-.34 0-.57.23-.57.63v14.75c0 .39.23.62.57.62.1 0 .2-.02.31-.06 2.94-1.1 6.03-1.64 9.12-1.64 3.09 0 6.18.55 9.12 1.64.11.04.21.06.31.06.33 0 .57-.23.57-.63V4.63c0-.4-.24-.63-.57-.63z"/>
</SvgIcon>
);
ImagePanoramaHorizontal = pure(ImagePanoramaHorizontal);
ImagePanoramaHorizontal.displayName = 'ImagePanoramaHorizontal';
ImagePanoramaHorizontal.muiName = 'SvgIcon';
export default ImagePanoramaHorizontal;
|
js/components/About.js | Couto/firstaidgit | import React from 'react';
let About = React.createClass({
render() {
return (
<section className="main-content section-about wrapper">
<div className="row">
<div className="column-12">
<h2 className="section-title">What is this all about?</h2>
<p className="section-copy">First Aid Git started out as a dummy project while I was learning more on
using <a href="http://webpack.github.io">Webpack</a> with <a href="https://facebook.github.io/react/">React</a>. Halfway through it I thought about making something
useful out of it, so I began to collect a few posts about the most frequently asked questions about git issues.</p>
<p className="section-copy">The motivation behind it was to have an easy and quick way to
search through the most common git-related issues when they arise, as I find myself having
dozens of Stackoverflow bookmarks scattered everywhere for these issues.</p>
</div>
<div className="row">
<div className="column-12">
<h2 className="section-title">The source code looks a bit messy...?</h2>
<p className="section-copy">That's because it is messy! Since this wasn't meant to become a project
in the first place, I wasn't paying too much attention to its structure... so I will be cleaning up the code as the project is being maintained.</p>
</div>
</div>
<div className="row">
<div className="column-12">
<h2 className="section-title">Can I contribute?</h2>
<p className="section-copy">You can and you should! Submit your changes on <a href="https://github.com/magalhini/firstaidgit">Github</a> or drop a <a href="http://www.twitter.com/magalhini">tweet</a>. I'd love to hear some feedback</p>
</div>
</div>
</div>
</section>
);
}
});
export default About;
|
src/svg-icons/communication/location-on.js | manchesergit/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let CommunicationLocationOn = (props) => (
<SvgIcon {...props}>
<path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>
</SvgIcon>
);
CommunicationLocationOn = pure(CommunicationLocationOn);
CommunicationLocationOn.displayName = 'CommunicationLocationOn';
CommunicationLocationOn.muiName = 'SvgIcon';
export default CommunicationLocationOn;
|
examples/counter/containers/App.js | sapegin/redux | import React, { Component } from 'react';
import CounterApp from './CounterApp';
import { createRedux } from 'redux';
import { Provider } from 'redux/react';
import * as stores from '../stores';
const redux = createRedux(stores);
export default class App extends Component {
render() {
return (
<Provider redux={redux}>
{() => <CounterApp />}
</Provider>
);
}
}
|
markbin/client/components/app.js | tpechacek/learn-react-native | import React from 'react';
import Header from './header';
export default (props) => {
return (
<div>
<Header />
{props.children}
</div>
);
};
|
src/utils/index.js | dfala/react-practice | import React from 'react';
import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react';
export function createConstants (...constants) {
return constants.reduce((acc, constant) => {
acc[constant] = constant;
return acc;
}, {});
}
export function createReducer (initialState, reducerMap) {
return (state = initialState, action) => {
const reducer = reducerMap[action.type];
return reducer ? reducer(state, action.payload) : state;
};
}
export function createDevToolsWindow (store) {
const win = window.open(
null,
'redux-devtools', // give it a name so it reuses the same window
'menubar=no,location=no,resizable=yes,scrollbars=no,status=no'
);
// reload in case it's reusing the same window with the old content
win.location.reload();
// wait a little bit for it to reload, then render
setTimeout(() => {
React.render(
<DebugPanel top right bottom left >
<DevTools store={store} monitor={LogMonitor} />
</DebugPanel>
, win.document.body);
}, 10);
}
|
stories/index.stories.js | fateseal/react-mtg-playtester | import React from 'react';
import { storiesOf } from '@storybook/react';
import App from './App';
storiesOf('Playtester', module).add('default', () => <App />);
|
src/utils/ValidComponentChildren.js | xiaoking/react-bootstrap | import React from 'react';
/**
* Maps children that are typically specified as `props.children`,
* but only iterates over children that are "valid components".
*
* The mapFunction provided index will be normalised to the components mapped,
* so an invalid component would not increase the index.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} mapFunction.
* @param {*} mapContext Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapValidComponents(children, func, context) {
let index = 0;
return React.Children.map(children, function(child) {
if (React.isValidElement(child)) {
let lastIndex = index;
index++;
return func.call(context, child, lastIndex);
}
return child;
});
}
/**
* Iterates through children that are typically specified as `props.children`,
* but only iterates over children that are "valid components".
*
* The provided forEachFunc(child, index) will be called for each
* leaf child with the index reflecting the position relative to "valid components".
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc.
* @param {*} forEachContext Context for forEachContext.
*/
function forEachValidComponents(children, func, context) {
let index = 0;
return React.Children.forEach(children, function(child) {
if (React.isValidElement(child)) {
func.call(context, child, index);
index++;
}
});
}
/**
* Count the number of "valid components" in the Children container.
*
* @param {?*} children Children tree container.
* @returns {number}
*/
function numberOfValidComponents(children) {
let count = 0;
React.Children.forEach(children, function(child) {
if (React.isValidElement(child)) { count++; }
});
return count;
}
/**
* Determine if the Child container has one or more "valid components".
*
* @param {?*} children Children tree container.
* @returns {boolean}
*/
function hasValidComponent(children) {
let hasValid = false;
React.Children.forEach(children, function(child) {
if (!hasValid && React.isValidElement(child)) {
hasValid = true;
}
});
return hasValid;
}
export default {
map: mapValidComponents,
forEach: forEachValidComponents,
numberOf: numberOfValidComponents,
hasValidComponent
};
|
dev/react-subjects/subjects/TweenState/lecture.js | AlanWarren/dotfiles | import React from 'react'
import { render } from 'react-dom'
import TransitionGroup from 'react-addons-transition-group'
import HeightFader from './components/HeightFader'
const List = React.createClass({
getInitialState() {
return {
items: []
}
},
addItem(e) {
if (e.key === 'Enter') {
if (this.guid == null)
this.guid = 1
const newItem = {
id: this.guid++,
label: e.target.value
}
this.setState({
items: [ newItem ].concat(this.state.items)
})
e.target.value = ''
}
},
removeItem(item) {
this.setState({
items: this.state.items.filter(i => i !== item)
})
},
render() {
return (
<div>
<h1>{this.props.name}</h1>
<input onKeyPress={this.addItem}/>
<ul>
{this.state.items.map(item => (
<li key={item.id}>
{item.label} <button onClick={() => this.removeItem(item)}>remove</button>
</li>
))}
</ul>
</div>
)
}
})
const App = React.createClass({
render() {
return (
<div>
<List name="Transition Group"/>
</div>
)
}
})
render(<App/>, document.getElementById('app'))
|
client/src/routes.js | TeamDreamStream/GigRTC | import React from 'react';
import { Route, IndexRoute } from 'react-router';
import App from './components/app';
import VideoPlayer from './containers/video-container';
import StreamsContainer from './containers/streams-container';
import Login from './components/forms/login';
import {requireAuthentication} from './components/AuthenticatedComponent';
import ArtistContainer from './containers/artist-container';
import AuthenticationContainer from './components/auth/authenticatePage';
import {videoHigherOrderFunction} from './containers/watchAndHost/watchingHigherOrder'
import ArtistAuthenticationLanding from './components/artistAuthentication/artistAuthenticationLanding'
import RegisteredArtists from './components/registeredArtists/registeredArtists'
import ArtistPage from './components/artistShowPage'
import Chat from './components/Chat';
import About from './components/about/about';
import Landing from './components/landing/landing';
import ArtistLand from './components/landing/artistLand';
import FanLand from './components/landing/fanLand';
import DescribePerformance from './components/performanceDescription/describePerformance';
export default (
<Route path="/" component={ App } >
<IndexRoute component={ Landing } />
<Route path="router/streamYourself" component={videoHigherOrderFunction(VideoPlayer)} />
<Route path="router/socialLogin" component={AuthenticationContainer} />
<Route path="router/nowStreaming" component={StreamsContainer} />
<Route path="router/artistAuthenticate/:formType" component={ArtistAuthenticationLanding} />
<Route path="router/registeredArtists" component={RegisteredArtists} />
<Route path="router/activeStream/:room" component={videoHigherOrderFunction(VideoPlayer)} />
<Route path="router/about" component={About} />
<Route path="router/artistLand" component={ArtistLand} />
<Route path="router/fanLand" component={FanLand} />
<Route path="router/landing" component={Landing} />
<Route path="router/artistPage/:artist_name" component={ArtistPage} />
<Route path="router/describePerformance" component={ DescribePerformance } />
</Route>
);
|
src/svg-icons/image/filter-vintage.js | xmityaz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageFilterVintage = (props) => (
<SvgIcon {...props}>
<path d="M18.7 12.4c-.28-.16-.57-.29-.86-.4.29-.11.58-.24.86-.4 1.92-1.11 2.99-3.12 3-5.19-1.79-1.03-4.07-1.11-6 0-.28.16-.54.35-.78.54.05-.31.08-.63.08-.95 0-2.22-1.21-4.15-3-5.19C10.21 1.85 9 3.78 9 6c0 .32.03.64.08.95-.24-.2-.5-.39-.78-.55-1.92-1.11-4.2-1.03-6 0 0 2.07 1.07 4.08 3 5.19.28.16.57.29.86.4-.29.11-.58.24-.86.4-1.92 1.11-2.99 3.12-3 5.19 1.79 1.03 4.07 1.11 6 0 .28-.16.54-.35.78-.54-.05.32-.08.64-.08.96 0 2.22 1.21 4.15 3 5.19 1.79-1.04 3-2.97 3-5.19 0-.32-.03-.64-.08-.95.24.2.5.38.78.54 1.92 1.11 4.2 1.03 6 0-.01-2.07-1.08-4.08-3-5.19zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z"/>
</SvgIcon>
);
ImageFilterVintage = pure(ImageFilterVintage);
ImageFilterVintage.displayName = 'ImageFilterVintage';
ImageFilterVintage.muiName = 'SvgIcon';
export default ImageFilterVintage;
|
packages/core/admin/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsButton/index.js | wistityhq/strapi | import React from 'react';
import PropTypes from 'prop-types';
import Cog from '@strapi/icons/Cog';
import { Button } from '@strapi/design-system/Button';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
const Wrapper = styled.div`
position: relative;
${({ hasConditions, disabled, theme }) =>
hasConditions &&
`
&:before {
content: '';
position: absolute;
top: -3px;
left: -10px;
width: 6px;
height: 6px;
border-radius: ${20 / 16}rem;;
background: ${disabled ? theme.colors.neutral100 : theme.colors.primary600};
}
`}
`;
const ConditionsButton = ({ onClick, className, hasConditions, variant }) => {
const { formatMessage } = useIntl();
return (
<Wrapper hasConditions={hasConditions} className={className}>
<Button variant={variant} startIcon={<Cog />} onClick={onClick}>
{formatMessage({
id: 'app.components.LeftMenuLinkContainer.settings',
defaultMessage: 'Settings',
})}
</Button>
</Wrapper>
);
};
ConditionsButton.defaultProps = {
className: null,
hasConditions: false,
variant: 'tertiary',
};
ConditionsButton.propTypes = {
onClick: PropTypes.func.isRequired,
className: PropTypes.string,
hasConditions: PropTypes.bool,
variant: PropTypes.string,
};
// This is a styled component advanced usage :
// Used to make a ref to a non styled component.
// https://styled-components.com/docs/advanced#caveat
export default styled(ConditionsButton)``;
|
docs/src/Routes.js | gearz-lab/react-ui | import React from 'react';
import Root from './Root';
import HomePage from './HomePage';
import GettingStartedPage from './GettingStartedPage';
import ComponentsPage from './ComponentsPage';
import NotFoundPage from './NotFoundPage';
import {Route, DefaultRoute, NotFoundRoute} from 'react-router';
export default (
<Route name='app' path='/' handler={Root}>
<DefaultRoute handler={HomePage}/>
<NotFoundRoute handler={NotFoundPage} />
<Route name='home' path='index.html' handler={HomePage} />
<Route name='getting-started' path='getting-started.html' handler={GettingStartedPage} />
<Route name='components' path='components.html' handler={ComponentsPage} />
</Route>
)
|
node_modules/react-bootstrap/es/Tab.js | C0deSamurai/muzjiks | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import _extends from 'babel-runtime/helpers/extends';
import React from 'react';
import TabContainer from './TabContainer';
import TabContent from './TabContent';
import TabPane from './TabPane';
var propTypes = _extends({}, TabPane.propTypes, {
disabled: React.PropTypes.bool,
title: React.PropTypes.node,
/**
* tabClassName is used as className for the associated NavItem
*/
tabClassName: React.PropTypes.string
});
var Tab = function (_React$Component) {
_inherits(Tab, _React$Component);
function Tab() {
_classCallCheck(this, Tab);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
Tab.prototype.render = function render() {
var props = _extends({}, this.props);
// These props are for the parent `<Tabs>` rather than the `<TabPane>`.
delete props.title;
delete props.disabled;
delete props.tabClassName;
return React.createElement(TabPane, props);
};
return Tab;
}(React.Component);
Tab.propTypes = propTypes;
Tab.Container = TabContainer;
Tab.Content = TabContent;
Tab.Pane = TabPane;
export default Tab; |
packages/react/components/navbar.js | AdrianV/Framework7 | import React from 'react';
import Utils from '../utils/utils';
import Mixins from '../utils/mixins';
import F7NavLeft from './nav-left';
import F7NavTitle from './nav-title';
import __reactComponentDispatchEvent from '../runtime-helpers/react-component-dispatch-event.js';
import __reactComponentSlots from '../runtime-helpers/react-component-slots.js';
import __reactComponentSetProps from '../runtime-helpers/react-component-set-props.js';
class F7Navbar extends React.Component {
constructor(props, context) {
super(props, context);
this.__reactRefs = {};
}
hide(animate) {
const self = this;
if (!self.$f7) return;
self.$f7.navbar.hide(self.refs.el, animate);
}
show(animate) {
const self = this;
if (!self.$f7) return;
self.$f7.navbar.show(self.refs.el, animate);
}
size() {
const self = this;
if (!self.$f7) return;
self.$f7.navbar.size(self.refs.el);
}
onBackClick(e) {
this.dispatchEvent('back-click backClick click:back clickBack', e);
}
render() {
const self = this;
const props = self.props;
const {
backLink,
backLinkUrl,
backLinkForce,
sliding,
title,
subtitle,
inner,
innerClass,
innerClassName,
className,
id,
style,
hidden,
noShadow,
noHairline
} = props;
let innerEl;
let leftEl;
let titleEl;
if (inner) {
if (backLink) {
leftEl = React.createElement(F7NavLeft, {
backLink: backLink,
backLinkUrl: backLinkUrl,
backLinkForce: backLinkForce,
onBackClick: self.onBackClick.bind(self)
});
}
if (title || subtitle) {
titleEl = React.createElement(F7NavTitle, {
title: title,
subtitle: subtitle
});
}
innerEl = React.createElement('div', {
ref: __reactNode => {
this.__reactRefs['inner'] = __reactNode;
},
className: Utils.classNames('navbar-inner', innerClass, innerClassName, {
sliding
})
}, leftEl, titleEl, this.slots['default']);
}
const classes = Utils.classNames(className, 'navbar', {
'navbar-hidden': hidden,
'no-shadow': noShadow,
'no-hairline': noHairline
}, Mixins.colorClasses(props));
return React.createElement('div', {
ref: __reactNode => {
this.__reactRefs['el'] = __reactNode;
},
id: id,
style: style,
className: classes
}, this.slots['before-inner'], innerEl, this.slots['after-inner']);
}
componentDidUpdate() {
const self = this;
if (!self.$f7) return;
const el = self.refs.el;
if (el && el.children && el.children.length) {
self.$f7.navbar.size(el);
} else if (self.refs.inner) {
self.$f7.navbar.size(self.refs.inner);
}
}
get slots() {
return __reactComponentSlots(this.props);
}
dispatchEvent(events, ...args) {
return __reactComponentDispatchEvent(this, events, ...args);
}
get refs() {
return this.__reactRefs;
}
set refs(refs) {}
}
__reactComponentSetProps(F7Navbar, Object.assign({
id: [String, Number],
backLink: [Boolean, String],
backLinkUrl: String,
backLinkForce: Boolean,
sliding: {
type: Boolean,
default: true
},
title: String,
subtitle: String,
hidden: Boolean,
noShadow: Boolean,
noHairline: Boolean,
inner: {
type: Boolean,
default: true
},
innerClass: String,
innerClassName: String
}, Mixins.colorProps));
F7Navbar.displayName = 'f7-navbar';
export default F7Navbar; |
dev/react-subjects/subjects/Flux/exercise/components/ContactList.js | AlanWarren/dotfiles | import React from 'react'
import { getState, addChangeListener } from '../stores/ContactStore'
import { loadContacts } from '../actions/ViewActionCreators'
const ContactList = React.createClass({
getInitialState() {
return getState()
},
componentDidMount() {
loadContacts()
},
render() {
const { contacts, loaded } = this.state
if (!loaded)
return <div>Loading...</div>
const items = contacts.map(contact => {
return (
<li key={contact.id}>
<img src={contact.avatar} width="40"/> {contact.first} {contact.last}
</li>
)
})
return (
<div>
<ul>{items}</ul>
</div>
)
}
})
export default ContactList
|
src/parser/shaman/elemental/modules/talents/StormElemental.js | fyruna/WoWAnalyzer | import React from 'react';
import SPELLS from 'common/SPELLS';
import SpellIcon from 'common/SpellIcon';
import { formatNumber, formatPercentage } from 'common/format';
import Analyzer from 'parser/core/Analyzer';
import EnemyInstances from 'parser/shared/modules/EnemyInstances';
import StatisticBox, { STATISTIC_ORDER } from 'interface/others/StatisticBox';
import Abilities from '../Abilities';
const STORMELE_DURATION = 30000 - 1500;
class StormElemental extends Analyzer {
static dependencies = {
abilities: Abilities,
enemies: EnemyInstances,
};
_resolveAbilityGcdField(value) {
if (typeof value === 'function') {
return value.call(this.owner, this.selectedCombatant);
} else {
return value;
}
}
badFS = 0;
justEnteredSE = false;
checkDelay = 0;
numCasts = {
[SPELLS.STORM_ELEMENTAL_TALENT.id]: 0,
[SPELLS.LIGHTNING_BOLT.id]: 0,
[SPELLS.CHAIN_LIGHTNING.id]: 0,
[SPELLS.EARTH_SHOCK.id]: 0,
[SPELLS.EARTHQUAKE.id]: 0,
others: 0,
};
constructor(...args) {
super(...args);
this.active = this.selectedCombatant.hasTalent(SPELLS.STORM_ELEMENTAL_TALENT.id);
}
get stormEleUptime() {
return this.selectedCombatant.getBuffUptime(SPELLS.WIND_GUST_BUFF.id) / this.owner.fightDuration;
}
get averageLightningBoltCasts() {
return (this.numCasts[SPELLS.LIGHTNING_BOLT.id]/this.numCasts[SPELLS.STORM_ELEMENTAL_TALENT.id]) || 0;
}
get averageChainLightningCasts() {
return (this.numCasts[SPELLS.CHAIN_LIGHTNING.id]/this.numCasts[SPELLS.STORM_ELEMENTAL_TALENT.id]) || 0;
}
on_byPlayer_cast(event) {
const spellId = event.ability.guid;
const target = this.enemies.getEntity(event);
if(spellId === SPELLS.STORM_ELEMENTAL_TALENT.id) {
this.justEnteredSE = true;
this.numCasts[SPELLS.STORM_ELEMENTAL_TALENT.id]+=1;
}
const ability = this.abilities.getAbility(spellId);
if(!ability){
return;
}
if(!this.selectedCombatant.hasBuff(SPELLS.WIND_GUST_BUFF.id, event.timestamp)){
return;
}
const gcd = this._resolveAbilityGcdField(ability.gcd);
if(!gcd){
return;
}
if(this.justEnteredSE){
if(target){
this.justEnteredSE = false;
if(!target.hasBuff(SPELLS.FLAME_SHOCK.id, event.timestamp-this.checkDelay) || target.getBuff(SPELLS.FLAME_SHOCK.id, event.timestamp-this.checkDelay).end - event.timestamp < STORMELE_DURATION){
this.badFS+=1;
}
} else {
this.checkDelay+=gcd;
}
}
if (this.numCasts[spellId] !== undefined) {
this.numCasts[spellId] += 1;
} else {
this.numCasts.others += 1;
}
}
statistic() {
return (
<StatisticBox
icon={<SpellIcon id={SPELLS.STORM_ELEMENTAL_TALENT.id} />}
value={`${formatNumber(this.averageLightningBoltCasts)}`}
label="Average Number Of Lightning Bolts per Storm Elemental Cast"
tooltip={(
<>
With a uptime of: {formatPercentage(this.stormEleUptime)} %<br />
Casts while Storm Elemental was up:
<ul>
<li>Earth Shock: {this.numCasts[SPELLS.EARTH_SHOCK.id]}</li>
<li>Lightning Bolt: {this.numCasts[SPELLS.LIGHTNING_BOLT.id]}</li>
<li>Earthquake: {this.numCasts[SPELLS.EARTHQUAKE.id]}</li>
<li>Chain Lightning: {this.numCasts[SPELLS.CHAIN_LIGHTNING.id]}</li>
<li>Other Spells: {this.numCasts.others}</li>
</ul>
</>
)}
/>
);
}
get suggestionTresholds() {
return {
actual: this.numCasts.others,
isGreaterThan: {
minor: 0,
major: 1,
},
style: 'absolute',
};
}
suggestions(when) {
const abilities = `Lightning Bolt/Chain Lightning and Earth Shock/Earthquake`;
when(this.suggestionTresholds)
.addSuggestion((suggest, actual, recommended) => {
return suggest(<span>Maximize your damage during Storm Elemental by only using {abilities}.</span>)
.icon(SPELLS.STORM_ELEMENTAL_TALENT.icon)
.actual(`${actual} other casts with Storm Elemental up`)
.recommended(`Only cast ${abilities} while Storm Elemental is up.`);
});
}
statisticOrder = STATISTIC_ORDER.OPTIONAL();
}
export default StormElemental;
|
react-flux-mui/js/material-ui/src/svg-icons/av/music-video.js | pbogdan/react-flux-mui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvMusicVideo = (props) => (
<SvgIcon {...props}>
<path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14zM8 15c0-1.66 1.34-3 3-3 .35 0 .69.07 1 .18V6h5v2h-3v7.03c-.02 1.64-1.35 2.97-3 2.97-1.66 0-3-1.34-3-3z"/>
</SvgIcon>
);
AvMusicVideo = pure(AvMusicVideo);
AvMusicVideo.displayName = 'AvMusicVideo';
AvMusicVideo.muiName = 'SvgIcon';
export default AvMusicVideo;
|
src/components/Page/Page.js | stanxii/laiico | /**
* 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 React from 'react';
import PropTypes from 'prop-types';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Page.css';
class Page extends React.Component {
static propTypes = {
title: PropTypes.string.isRequired,
html: PropTypes.string.isRequired,
};
render() {
const { title, html } = this.props;
return (
<div className={s.root}>
<div className={s.container}>
<h1>{title}</h1>
<div
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: html }}
/>
</div>
</div>
);
}
}
export default withStyles(s)(Page);
|
imports/ui/components/AppNavigation.js | themeteorchef/base | import React from 'react';
import PropTypes from 'prop-types';
import { Navbar } from 'react-bootstrap';
import { Link } from 'react-router';
import { Meteor } from 'meteor/meteor';
import PublicNavigation from './PublicNavigation.js';
import AuthenticatedNavigation from './AuthenticatedNavigation.js';
import container from '../../modules/container';
const renderNavigation = hasUser => (hasUser ? <AuthenticatedNavigation /> : <PublicNavigation />);
const AppNavigation = ({ hasUser }) => (
<Navbar>
<Navbar.Header>
<Navbar.Brand>
<Link to="/">Application Name</Link>
</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
<Navbar.Collapse>
{ renderNavigation(hasUser) }
</Navbar.Collapse>
</Navbar>
);
AppNavigation.propTypes = {
hasUser: PropTypes.object,
};
export default container((props, onData) => {
onData(null, { hasUser: Meteor.user() });
}, AppNavigation);
|
src/page/list/index.js | KleeGroup/focus-components | //The purpose of this module is to deal with autonomous lists.
//If you need lists inside a form please see the listFor helper function in a form.
//The following lists can
//- be loaded from a criteria (or without) (the criteria can be the result of a form)
//- be paginated
//- be displayed in any list container.
import React from 'react';
import camelCase from 'lodash/string/camelCase';
import capitalize from 'lodash/string/capitalize';
import builder from 'focus-core/component/builder';
import types from 'focus-core/component/types';
import actionBuilder from 'focus-core/list/action-builder';
import assign from 'object-assign';
import { component as DEFAULT_LIST_COMPONENT } from '../../list/table/list';
const STORE_NODE = ['criteria', 'groupingKey', 'sortBy', 'sortAsc', 'dataList', 'totalCount'];
/**
* Cretes a name for the property listener.
* @param {string} node - Node name.
* @return {string} the built property.
*/
function _listenerProp(node) {
return `add${capitalize(camelCase(node))}ChangeListener`;
}
function _unListenerProp(node) {
return `remove${capitalize(camelCase(node))}ChangeListener`;
}
/**
* Mixin to deal the list page.
* @type {Object}
*/
const listPageMixin = {
getDefaultProps() {
return {
ListComponent: DEFAULT_LIST_COMPONENT,
pickProps(props) { return props; }
};
},
getInitialState() {
return {};
},
/** @inheritdoc */
propTypes: {
//Store object.
pickProps: types('func'),
service: types('func'),
store: types('object').isRequired
},
/**
* Build the action from.
*/
_buildAction() {
this._action = this.props.action || actionBuilder({
service: this.props.service,
identifier: this.props.store.identifier,
getListOptions: () => { return this.props.store.getValue.call(this.props.store); } // Binding the store in the function call
});
},
/**
* Read the state from the store.
* @return {object} - The object read from the store.
*/
_getStateFromStore() {
const store = this.props.store;
return store.getValue();
},
/**
* Hanlde the list store change.
*/
_handleStoreChanged() {
this.setState(this._getStateFromStore());
},
/**
* Register the store nodes.
*/
_reload() {
this._action.load();
},
_registerStoreNode() {
STORE_NODE.forEach((node) => {
//Maybe this is a bit too much, a global change event could be more efficient as almost all store props change.
this.props.store[_listenerProp(node)](this._handleStoreChanged);
});
//When the criteria is changed, the search is triggered.
this.props.store.addCriteriaChangeListener(this._reload);
},
_unRegisterStoreNode() {
STORE_NODE.forEach((node) => {
//Maybe this is a bit too much, a global change event could be more efficient as almost all store props change.
this.props.store[_unListenerProp(node)](this._handleStoreChanged);
});
//When the criteria is changed, the search is triggered.
this.props.store.removeCriteriaChangeListener(this._reload);
},
/**
* build the list props.
* @return {object} - the list property.
*/
_buildListProps() {
const { props, state } = this;
let { dataList, totalCount } = state;
dataList = dataList || [];
return assign({}, props, state, {
data: dataList,
fetchNextPage: this._action.load,
hasMoreData: dataList.length < totalCount
});
},
/** @inheritdoc */
componentWillMount() {
this._registerStoreNode();
this._buildAction();
this._action.load();
},
componentWillUnmount() {
this._unRegisterStoreNode();
},
/** @inheritdoc */
render() {
const listProps = this._buildListProps();
return (
<this.props.ListComponent {...listProps} ref='list' />
);
}
};
const { mixin, component } = builder(listPageMixin);
export { mixin, component };
export default { mixin, component };
|
src/components/general/Error.js | KennethMa/Readhub-Client | import React from 'react';
import PropTypes from 'prop-types';
import { View } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import { AppStyles } from '../../theme/';
// Components
import { Spacer, Text, Button } from '../ui/';
/* Component ==================================================================== */
const Error = ({ text, tryAgain }) => (
<View style={[AppStyles.container, AppStyles.containerCentered]}>
<Icon name={'ios-alert-outline'} size={50} color={'#CCC'} />
<Spacer size={10} />
<Text style={AppStyles.textCenterAligned}>{text}</Text>
<Spacer size={20} />
{!!tryAgain &&
<Button
small
outlined
title={'Try again'}
onPress={tryAgain}
/>
}
</View>
);
Error.propTypes = { text: PropTypes.string, tryAgain: PropTypes.func };
Error.defaultProps = { text: 'Woops, Something went wrong.', tryAgain: null };
Error.componentName = 'Error';
/* Export Component ==================================================================== */
export default Error;
|
app/javascript/src/client/users/new.js | rringler/billtalk | import _ from 'lodash';
import React, { Component } from 'react';
import { Button, Col, ControlLabel, Form, FormControl, FormGroup, HelpBlock } from 'react-bootstrap';
import { Field, reduxForm } from 'redux-form';
import { connect } from 'react-redux';
import { createUser } from './actions';
import { emailRegex } from 'validations';
class SignUp extends Component {
onSubmit = (values) => {
this.props.createUser(values)
.then(this.onSuccess);
}
onSuccess = () => {
this.props.history.push('/');
}
renderInputField = (field) => {
const validationState = this.validationState(field);
const helpBlock = this.renderHelpBlock(field);
return (
<FormGroup validationState={validationState}>
<label>{field.label}</label>
<input
className='form-control'
type={field.type}
placeholder={field.placeholder}
{...field.input}
/>
<FormControl.Feedback />
{helpBlock}
</FormGroup>
);
}
renderCheckboxField = (field) => {
const validationState = this.validationState(field);
const helpBlock = this.renderHelpBlock(field);
return(
<FormGroup validationState={validationState}>
<div className='checkbox'>
<label>
<input
type='checkbox'
{...field.input}
/>
{field.label}
</label>
{helpBlock}
</div>
</FormGroup>
);
}
renderHelpBlock = (field) => {
const { meta: { touched, error } } = field;
if (!touched) { return null; }
return(
<HelpBlock>
{error}
</HelpBlock>
);
}
validationState = ({ meta: { touched, error, warning }}) => {
if (!touched) { return null; }
return (error && 'error') || (warning && 'warning') || 'success';
}
render() {
const { handleSubmit, pristine, submitting } = this.props;
return (
<Col sm={6} smOffset={3}>
<h1>Join the conversation</h1>
<Form
id='users-new'
className='create-user-form'
onSubmit={handleSubmit(this.onSubmit)}
>
<Field
label='Email'
name='email'
type='text'
component={this.renderInputField}
/>
<Field
label='Password'
name='password'
type='password'
component={this.renderInputField}
/>
<Field
label="I agree to Bill Talk's terms of service"
name='tos'
component={this.renderCheckboxField}
/>
<FormGroup>
<Button
bsStyle="primary"
type="submit"
disabled={pristine || submitting}
>
Submit
</Button>
</FormGroup>
</Form>
</Col>
);
}
}
function validate(values) {
const errors = {};
if (!values.email) {
errors.email = 'Please enter an email address'
}
if (values.email && !values.email.match(emailRegex)) {
errors.email = 'Please enter a valid email address'
}
if (!values.password) {
errors.password = 'Please enter a password'
}
if (!values.tos) {
errors.tos = 'Please accept the Terms of Service'
}
return errors;
}
export default reduxForm({
form: 'UsersNewForm',
validate
})(
connect(null, { createUser })(SignUp)
);
|
src/svg-icons/av/play-arrow.js | manchesergit/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvPlayArrow = (props) => (
<SvgIcon {...props}>
<path d="M8 5v14l11-7z"/>
</SvgIcon>
);
AvPlayArrow = pure(AvPlayArrow);
AvPlayArrow.displayName = 'AvPlayArrow';
AvPlayArrow.muiName = 'SvgIcon';
export default AvPlayArrow;
|
js/components/forecast.js | stage88/react-weather | /**
* @flow
*/
'use strict';
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import ForecastItem from './forecastitem';
import type { WeatherForecast } from '../models/view';
type Props = {
forecast: Array<WeatherForecast>;
};
class Forecast extends Component {
props: Props;
constructor(props: Props) {
super(props);
(this: any).renderForecastItems = this.renderForecastItems.bind(this);
}
render() {
return (
<View style={styles.forecastView}>
<View style={styles.forecastList}>
{ this.renderForecastItems() }
</View>
</View>
);
}
renderForecastItems() {
return (
this.props.forecast.map((item, index) => {
if (index === 0) {
return null;
};
if (index < this.props.forecast.length - 1) {
var separator = {
borderColor: '#F4F4F4',
borderBottomWidth: StyleSheet.hairlineWidth,
};
}
return (
<ForecastItem key={item.day} index={index} {...item} separator={separator} />
);
})
);
}
}
const styles = StyleSheet.create({
forecastView: {
marginLeft: 5,
marginRight: 5,
flexDirection: 'row',
borderColor: '#e2e2e2',
backgroundColor: '#fff',
borderWidth: 1,
borderRadius: 3
},
forecastList: {
flex: 1,
borderColor: '#E2E2E2',
paddingLeft: 12,
paddingRight: 12
},
});
module.exports = Forecast;
|
src/components/general/WebView.js | banovotz/WatchBug2 | /**
* Web View
*
* <WebView url={"http://google.com"} />
*
* React Native Starter App
* https://github.com/mcnamee/react-native-starter-app
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
WebView,
StyleSheet,
InteractionManager,
} from 'react-native';
// Consts and Libs
import { AppColors, AppStyles } from '@theme/';
// Components
import Loading from '@components/general/Loading';
import Error from '@components/general/Error';
/* Styles ==================================================================== */
const styles = StyleSheet.create({
container: {
backgroundColor: AppColors.background,
},
});
/* Component ==================================================================== */
class AppWebView extends Component {
static componentName = 'AppWebView';
static propTypes = {
url: PropTypes.string.isRequired,
onNavigationStateChange: PropTypes.func,
}
static defaultProps = {
onNavigationStateChange: null,
}
constructor(props) {
super(props);
this.state = {
loading: true,
webViewURL: props.url || null,
};
}
componentDidMount = () => {
// Wait until interaction has finished before loading the webview in
InteractionManager.runAfterInteractions(() => {
this.setState({ loading: false });
});
}
/**
* Each time page loads, update the URL
*/
onNavigationStateChange = (navState) => {
this.state.webViewURL = navState.url;
if (this.props.onNavigationStateChange) this.props.onNavigationStateChange(navState.url);
}
render = () => {
const { webViewURL, loading } = this.state;
if (loading) return <Loading />;
if (!webViewURL) return <Error type={'URL not defined.'} />;
return (
<WebView
scalesPageToFit
startInLoadingState
source={{ uri: webViewURL }}
automaticallyAdjustContentInsets={false}
style={[AppStyles.container, styles.container]}
onNavigationStateChange={this.onNavigationStateChange}
/>
);
}
}
/* Export Component ==================================================================== */
export default AppWebView;
|
pages/api/input.js | AndriusBil/material-ui | // @flow
import React from 'react';
import withRoot from 'docs/src/modules/components/withRoot';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from './input.md';
function Page() {
return <MarkdownDocs markdown={markdown} />;
}
export default withRoot(Page);
|
src/parser/deathknight/blood/modules/features/AlwaysBeCasting.js | FaideWW/WoWAnalyzer | import React from 'react';
import CoreAlwaysBeCasting from 'parser/shared/modules/AlwaysBeCasting';
import SPELLS from 'common/SPELLS';
import { formatPercentage } from 'common/format';
import { STATISTIC_ORDER } from 'interface/others/StatisticBox';
import SpellLink from 'common/SpellLink';
class AlwaysBeCasting extends CoreAlwaysBeCasting {
get downtimeSuggestionThresholds() {
return {
actual: this.downtimePercentage,
isGreaterThan: {
minor: 0.20,
average: 0.30,
major: 0.40,
},
style: 'percentage',
};
}
suggestions(when) {
const boss = this.owner.boss;
if (!boss || !boss.fight.disableDowntimeSuggestion) {
when(this.downtimeSuggestionThresholds).addSuggestion((suggest, actual, recommended) => {
return suggest(<>While some downtime is inevitable in fights with movement, you should aim to reduce downtime to prevent capping Runes. You can reduce downtime by casting ranged/filler abilities like <SpellLink id={SPELLS.BLOODDRINKER_TALENT.id} /> or <SpellLink id={SPELLS.BLOOD_BOIL.id} /></>)
.icon('spell_mage_altertime')
.actual(`${formatPercentage(actual)}% downtime`)
.recommended(`<${formatPercentage(recommended)}% is recommended`);
});
}
}
statisticOrder = STATISTIC_ORDER.CORE(1);
}
export default AlwaysBeCasting;
|
examples/js/expandRow/manage-expanding.js | echaouchna/react-bootstrap-tab | /* eslint max-len: 0 */
import React from 'react';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
const products = [];
function addProducts(quantity) {
const startId = products.length;
for (let i = 0; i < quantity; i++) {
const id = startId + i;
products.push({
id: id,
name: 'Item name ' + id,
price: 2100 + i,
expand: [ {
fieldA: 'test1',
fieldB: (i + 1) * 99,
fieldC: (i + 1) * Math.random() * 100,
fieldD: '123eedd' + i
}, {
fieldA: 'test2',
fieldB: i * 99,
fieldC: i * Math.random() * 100,
fieldD: '123eedd' + i
} ]
});
}
}
addProducts(5);
class BSTable extends React.Component {
render() {
if (this.props.data) {
return (
<BootstrapTable data={ this.props.data }>
<TableHeaderColumn dataField='fieldA' isKey={ true }>Field A</TableHeaderColumn>
<TableHeaderColumn dataField='fieldB'>Field B</TableHeaderColumn>
<TableHeaderColumn dataField='fieldC'>Field C</TableHeaderColumn>
<TableHeaderColumn dataField='fieldD'>Field D</TableHeaderColumn>
</BootstrapTable>);
} else {
return (<p>?</p>);
}
}
}
export default class ExpandRow extends React.Component {
constructor(props) {
super(props);
this.state = {
// Default expanding row
expanding: [ 2 ]
};
}
isExpandableRow() {
return true;
}
expandComponent(row) {
return (
<BSTable data={ row.expand } />
);
}
render() {
const options = {
expandRowBgColor: 'rgb(66, 134, 244)',
expanding: this.state.expanding
};
return (
<BootstrapTable data={ products }
options={ options }
expandableRow={ this.isExpandableRow }
expandComponent={ this.expandComponent }
search>
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name' expandable={ false }>Product Name</TableHeaderColumn>
<TableHeaderColumn dataField='price' expandable={ false }>Product Price</TableHeaderColumn>
</BootstrapTable>
);
}
}
|
admin/client/App/shared/Popout/index.js | matthewstyers/keystone | /**
* A Popout component.
* One can also add a Header (Popout/Header), a Footer
* (Popout/Footer), a Body (Popout/Body) and a Pan (Popout/Pane).
*/
import React from 'react';
import Portal from '../Portal';
import Transition from 'react-addons-css-transition-group';
const SIZES = {
arrowHeight: 12,
arrowWidth: 16,
horizontalMargin: 20,
};
var Popout = React.createClass({
displayName: 'Popout',
propTypes: {
isOpen: React.PropTypes.bool,
onCancel: React.PropTypes.func,
onSubmit: React.PropTypes.func,
relativeToID: React.PropTypes.string.isRequired,
width: React.PropTypes.number,
},
getDefaultProps () {
return {
width: 320,
};
},
getInitialState () {
return {};
},
componentWillReceiveProps (nextProps) {
if (!this.props.isOpen && nextProps.isOpen) {
window.addEventListener('resize', this.calculatePosition);
this.calculatePosition(nextProps.isOpen);
} else if (this.props.isOpen && !nextProps.isOpen) {
window.removeEventListener('resize', this.calculatePosition);
}
},
getPortalDOMNode () {
return this.refs.portal.getPortalDOMNode();
},
calculatePosition (isOpen) {
if (!isOpen) return;
let posNode = document.getElementById(this.props.relativeToID);
const pos = {
top: 0,
left: 0,
width: posNode.offsetWidth,
height: posNode.offsetHeight,
};
while (posNode.offsetParent) {
pos.top += posNode.offsetTop;
pos.left += posNode.offsetLeft;
posNode = posNode.offsetParent;
}
let leftOffset = Math.max(pos.left + (pos.width / 2) - (this.props.width / 2), SIZES.horizontalMargin);
let topOffset = pos.top + pos.height + SIZES.arrowHeight;
var spaceOnRight = window.innerWidth - (leftOffset + this.props.width + SIZES.horizontalMargin);
if (spaceOnRight < 0) {
leftOffset = leftOffset + spaceOnRight;
}
const arrowLeftOffset = leftOffset === SIZES.horizontalMargin
? pos.left + (pos.width / 2) - (SIZES.arrowWidth / 2) - SIZES.horizontalMargin
: null;
const newStateAvaliable = this.state.leftOffset !== leftOffset
|| this.state.topOffset !== topOffset
|| this.state.arrowLeftOffset !== arrowLeftOffset;
if (newStateAvaliable) {
this.setState({
leftOffset: leftOffset,
topOffset: topOffset,
arrowLeftOffset: arrowLeftOffset,
});
}
},
renderPopout () {
if (!this.props.isOpen) return;
const { arrowLeftOffset, leftOffset, topOffset } = this.state;
const arrowStyles = arrowLeftOffset
? { left: 0, marginLeft: arrowLeftOffset }
: null;
return (
<div
className="Popout"
style={{
left: leftOffset,
top: topOffset,
width: this.props.width,
}}
>
<span className="Popout__arrow" style={arrowStyles} />
<div className="Popout__inner">
{this.props.children}
</div>
</div>
);
},
renderBlockout () {
if (!this.props.isOpen) return;
return <div className="blockout" onClick={this.props.onCancel} />;
},
render () {
return (
<Portal className="Popout-wrapper" ref="portal">
<Transition
className="Popout-animation"
transitionEnterTimeout={190}
transitionLeaveTimeout={190}
transitionName="Popout"
component="div"
>
{this.renderPopout()}
</Transition>
{this.renderBlockout()}
</Portal>
);
},
});
module.exports = Popout;
// expose the child to the top level export
module.exports.Header = require('./PopoutHeader');
module.exports.Body = require('./PopoutBody');
module.exports.Footer = require('./PopoutFooter');
module.exports.Pane = require('./PopoutPane');
|
src/components/common/BookingBar.js | mdicarlo3/cautious-disco | import React, { Component } from 'react';
class BookingBar extends Component {
render(){
return(
<div className="booking-bar">this is the booking bar</div>
);
}
}
export default BookingBar;
|
js/components/App.js | c-h-/universal-native-boilerplate | import React from 'react';
import PropTypes from 'prop-types';
import {
connect,
} from 'react-redux';
import '../libs';
import AppNavigator from './AppNavigator';
import URIWrapper from './URIWrapper';
const NavigationWrappedApp = URIWrapper(AppNavigator);
const App = (props) => {
const {
appReady,
dispatch,
nav,
} = props;
return (
<NavigationWrappedApp
dispatch={dispatch}
state={nav}
appReady={appReady}
/>
);
};
App.propTypes = {
appReady: PropTypes.bool,
nav: PropTypes.object,
dispatch: PropTypes.func,
};
function mapStateToProps(state) {
return {
appReady: state.transient.appReady,
nav: state.nav,
};
}
export default connect(mapStateToProps)(App);
|
server/dashboard/js/components/BenchLogEntry.react.js | MrAlone/mzbench | import React from 'react';
class BenchLogEntry extends React.Component {
constructor(props) {
super(props);
this.state = {};
this.nShown = props.from;
}
shouldComponentUpdate(nextProps, nextState) {
return (nextProps.log.length < nextProps.to) || this.nShown < nextProps.to;
}
render() {
let query = this.props.query;
let from = this.props.from;
let to = this.props.to;
let log = this.props.log;
let res = [];
for (var i = from; i < to; i++) {
let line = log[i];
if (!line) break;
let cssClass = line.severity == "[error]" ? "danger" : (line.severity == "[warning]" ? "warning": "");
let fullText = line.time + " " + line.severity + line.text;
if (!query) {
res.push(
<tr key={line.id} className={cssClass}>
<td>
<pre>{fullText}</pre>
</td>
</tr>);
} else {
let pieces = fullText.split(query);
let logLine = [pieces[0]];
for (var k = 1; k < pieces.length; k++) {
logLine.push(<mark key={k}>{query}</mark>);
logLine.push(pieces[k])
}
res.push(
<tr key={line.id} className={cssClass}>
<td>
<pre>{logLine}</pre>
</td>
</tr>);
}
}
this.nShown = i;
return <table className="table table-striped table-logs"><tbody>{res}</tbody></table>;
}
};
export default BenchLogEntry;
|
src/react-pointerlock.js | jeongsd/react-pointerlock | import React from 'react';
import ReactDom from 'react-dom';
import classnames from 'classnames';
import { POINTERLOCK_ELEMENT, POINTERLOCK_CHANGE,
REQUEST_POINTERLOCK, EXIT_POINTERLOCK, POINTERLOCK_ERROR,
MOVEMENT_X, MOVEMENT_Y } from './helper/pointLock.js';
// import './react-pointerlock.css';
const propTypes = {
className: React.PropTypes.string,
onMouseMove: React.PropTypes.func,
onPointLock: React.PropTypes.func,
onExitPointLock: React.PropTypes.func,
blockElement: React.PropTypes.node,
// onError: PropTypes.func,
};
const defaultProps = {
blockElement: (
<div className="PointerLocker-blocker">
<div className="PointerLocker-instructions">
Click to View
</div>
</div>
),
};
class PointerLocker extends React.Component {
constructor() {
super();
this.state = {
isPointLock: false,
};
this.requestPointerLock = this.requestPointerLock.bind(this);
this.onPointLockChange = this.onPointLockChange.bind(this);
this.onMouseMove = this.onMouseMove.bind(this);
this.onPointLockError = this.onPointLockError.bind(this);
this.onClick = this.onClick.bind(this);
}
componentDidMount() {
if (this.caniuse()) {
document.addEventListener(POINTERLOCK_CHANGE, this.onPointLockChange, false);
// document.addEventListener(POINTERLOCK_ERROR, this.onPointLockError, false);
}
}
componentDidUpdate(prevProps, prevState) {
if (this.state.isPointLock !== prevState.isPointLock ) {
if (this.state.isPointLock) {
this.props.onPointLock();
} else {
this.props.onExitPointLock();
}
}
}
componentWillUnmount() {
if (this.caniuse()) {
document.removeEventListener(POINTERLOCK_CHANGE, this.onPointLockChange, false);
// document.removeEventListener(POINTERLOCK_ERROR, this.onPointLockError, false);
}
}
onPointLockChange() {
const currentPointLockElement = document[POINTERLOCK_ELEMENT];
const pointLockElement = ReactDom.findDOMNode(this.refs.pointerLocker);
if (currentPointLockElement === pointLockElement) {
// react onMouseMove event doesn't extension to mouse events
// https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API#extensions
document.addEventListener('mousemove', this.onMouseMove, false);
return this.setState({
isPointLock: true,
});
}
document.removeEventListener('mousemove', this.onMouseMove);
this.setState({
isPointLock: false,
});
}
onClick() {
this.requestPointerLock();
}
onMouseMove(event) {
if (this.props.onMouseMove) {
const movement = {
x: event[MOVEMENT_X] || 0,
y: event[MOVEMENT_Y] || 0,
};
this.props.onMouseMove(movement, event);
}
}
onPointLockError(error) {
console.error('requestPointerLock or exitPointerLock calling failed', error);
if (this.props.onError) {
this.props.onError(error);
}
}
exitPointLock() {
document[EXIT_POINTERLOCK]();
}
requestPointerLock() {
const pointerLocker = ReactDom.findDOMNode(this.refs.pointerLocker);
pointerLocker[REQUEST_POINTERLOCK]();
}
caniuse() {
if (POINTERLOCK_ELEMENT) {
return true;
}
return false;
}
render() {
const className = classnames('PointerLocker', this.props.className);
let blocker;
if (!this.state.isPointLock) {
blocker = this.props.blockElement;
}
return (
<div
ref="pointerLocker"
className={ className }
onMouseMove={
this.state.isPointLock ? this.onMouseMove : null
}
onClick={ this.requestPointerLock } >
{ blocker }
{ this.props.children }
</div>
);
}
}
PointerLocker.propTypes = propTypes;
PointerLocker.defaultProps = defaultProps;
export default PointerLocker;
|
docs/src/app/components/pages/components/Tabs/ExampleIcon.js | nathanmarks/material-ui | import React from 'react';
import {Tabs, Tab} from 'material-ui/Tabs';
import FontIcon from 'material-ui/FontIcon';
import ActionFlightTakeoff from 'material-ui/svg-icons/action/flight-takeoff';
const TabsExampleIcon = () => (
<Tabs>
<Tab icon={<FontIcon className="muidocs-icon-action-home" />} />
<Tab icon={<ActionFlightTakeoff />} />
<Tab icon={<FontIcon className="material-icons">favorite</FontIcon>} />
</Tabs>
);
export default TabsExampleIcon;
|
docs/src/example.js | bokuweb/react-resizable-box | import React from 'react';
import Resizable from '../../src';
const handlerClasses = {
wrapper: 'react-resize-wrapper'
}
export default () => (
<div>
<Resizable
className="item"
width="280"
height="300"
minWidth="240"
minHeight="120"
maxWidth="800"
maxHeight="600"
handlerClasses={handlerClasses}
>
<div className="content">
Resize me!!<br />
<span style={{ fontSize: '11px', fontFamily: 'Arial' }}>
max 800 * 600 / min 240 * 120
</span>
</div>
</Resizable>
</div>
);
|
client-react/src/app.js | diman84/Welthperk | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import feathers from 'feathers/client';
import hooks from 'feathers-hooks';
import rest from 'feathers-rest/client';
import authentication from 'feathers-authentication-client';
import superagent from 'superagent';
import config from './config';
const storage = __SERVER__ ? require('localstorage-memory') : require('localforage');
const host = clientUrl => (__SERVER__ ? `http://${config.apiHost}:${config.apiPort}` : clientUrl);
const configureApp = transport => feathers()
.configure(transport)
.configure(hooks())
.configure(authentication({ storage, path: '/auth/login' }));
const customizeAuthRequest = () =>
hook => {
const { strategy, ...data } = hook.data;
hook.data = data;
hook.params.headers = { 'Content-Type': 'application/x-www-form-urlencoded', ...hook.params.headers };
return Promise.resolve(hook);
};
export function createApp(req) {
if (req === 'rest') {
const feathersApp = configureApp(rest(host('/api')).superagent(superagent));
feathersApp.service('auth/login').hooks({
before: {
create: [customizeAuthRequest()]
}
});
return feathersApp;
}
//if (__SERVER__ && req) {
const app = configureApp(rest(host('/api')).superagent(superagent, {
headers: {
Cookie: req.get('cookie'),
authorization: req.header('authorization')
}
}));
const accessToken = req.header('authorization') || (req.cookies && req.cookies['feathers-jwt']);
app.set('accessToken', accessToken);
return app;
}
export function withApp(WrappedComponent) {
class WithAppComponent extends Component {
static contextTypes = {
app: PropTypes.object.isRequired,
restApp: PropTypes.object.isRequired,
}
render() {
const { restApp } = this.context;
return <WrappedComponent {...this.props} restApp={restApp} />;
}
}
return WithAppComponent;
}
|
react/CardGroup/CardGroup.demo.js | seek-oss/seek-style-guide | import React from 'react';
import PropTypes from 'prop-types';
import {
CardGroup,
Card,
Text,
PageBlock,
Section
} from 'seek-style-guide/react';
const CardGroupContainer = ({ component: DemoComponent, componentProps }) => (
<PageBlock>
<Section>
<DemoComponent {...componentProps} />
</Section>
</PageBlock>
);
CardGroupContainer.propTypes = {
component: PropTypes.any,
componentProps: PropTypes.object.isRequired
};
export default {
route: '/card-group',
title: 'Card Group',
category: 'Layout',
component: CardGroup,
container: CardGroupContainer,
block: true,
initialProps: {
children: [
<Card key="1">
<Section>
<Text heading>Living Style Guide</Text>
</Section>
</Card>,
<Card key="2">
<Section>
<Text heading>Living Style Guide</Text>
</Section>
</Card>,
<Card key="3">
<Section>
<Text heading>Living Style Guide</Text>
</Section>
</Card>
]
},
options: []
};
|
node_modules/antd/es/icon/index.js | ZSMingNB/react-news | import _extends from 'babel-runtime/helpers/extends';
import _defineProperty from 'babel-runtime/helpers/defineProperty';
import React from 'react';
import classNames from 'classnames';
import omit from 'omit.js';
var Icon = function Icon(props) {
var type = props.type,
_props$className = props.className,
className = _props$className === undefined ? '' : _props$className,
spin = props.spin;
var classString = classNames(_defineProperty({
anticon: true,
'anticon-spin': !!spin || type === 'loading'
}, 'anticon-' + type, true), className);
return React.createElement('i', _extends({}, omit(props, ['type', 'spin']), { className: classString }));
};
export default Icon; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.