path
stringlengths 5
195
| repo_name
stringlengths 5
79
| content
stringlengths 25
1.01M
|
---|---|---|
demo/components/Logo.js | Adphorus/react-date-range | import React from 'react';
import PropTypes from 'prop-types';
import Styled from 'rsg-components/Styled';
import logo from './logo.svg';
const styles = ({ fontFamily, color }) => ({
logo: {
display: 'flex',
alignItems: 'center',
margin: 0,
fontFamily: fontFamily.base,
fontSize: 18,
fontWeight: 'normal',
color: color.baseBackground,
},
image: {
width: '2.5em',
marginLeft: '-0.5em',
},
});
export function LogoRenderer({ classes, children }) {
return (
<h1 className={classes.logo}>
<img className={classes.image} src={logo} />
{children}
</h1>
);
}
LogoRenderer.propTypes = {
classes: PropTypes.object.isRequired,
children: PropTypes.node,
};
export default Styled(styles)(LogoRenderer);
|
Waterfall.js | gimhol/react-native-waterfall | import React, { Component } from 'react';
import { ScrollView, View, StyleSheet} from 'react-native';
import ItemView from './ItemView'
var styles = StyleSheet.create({
root: {
flex:1,
alignSelf:'stretch'
},
container: {
alignSelf:'stretch'
},
header:{ }
})
export default class Waterfall extends Component{
static defaultProps = {
onEndReachedThreshold: 0,
expansionOfScope: 500,
numberOfColumns: 3,
data: []
};
constructor(props){
super(props);
this.list = [...props.data];
this._resetColHeight();
this.itemRefs = [];
this.visibleRange = { start: 0, end: 0 };
this.curPlacingIdx = 0;
this.headerHeight = 0;
this.headerWidth = 0;
}
componentWillReceiveProps(nextProps){
var { data } = nextProps;
if( !data instanceof Array ){
var err = new Error("props.data should be an array!");
return console.error(err);
}
//datas have been refresh, remove all items.
if( data !== this.props.data ){
//reset placement job, start with the first item.
this.curPlacingIdx = 0;
//reset the list to remove all items
this.list = [...data];
//reset items' reference
this.itemRefs = [];
//reset every columns' height
this._resetColHeight()
//reset visible range
this._resetVisibleRange()
//fire 'render' to remove all itemViews
this.forceUpdate()
this.scrollView.scrollTo({x: 0, y: 0, animated: false})
}
//add more item
else if(data.length > this.list.length){
for(var i=this.list.length; i< data.length; ++i){
this.list.push(data[i])
}
this.forceUpdate()
}
else if(data.length < this.list.length){
var err = new Error("does not support remove item!");
return console.error(err);
}
else{
}
}
componentDidUpdate(lastProps,lastState){
}
_resetVisibleRange(){
this.visibleRange.start = 0;
this.visibleRange.end = 0;
delete this.lastContentOffset;
}
_resetColHeight(){
var { numberOfColumns } = this.props;
this.colHeights = [];
for(let i=0; i < numberOfColumns; ++i){
this.colHeights.push(0)
}
}
componentWillUpdate(lastProps,lastState){}
_getItemWidth(){
var { numberOfColumns, gap } = this.props
if( gap > 0){
return (this.width - gap * (1 + numberOfColumns)) / numberOfColumns
}
else{
return this.width/numberOfColumns
}
}
_getMaxHeight(){
var maxCol = this._getMaxCol();
return this.headerHeight + this.colHeights[maxCol];
}
_getMinHeight(){
var minCol = this._getMinCol();
var { gap } = this.props
if( gap > 0 ){
return gap + this.headerHeight + this.colHeights[minCol]
}else{
return this.headerHeight + this.colHeights[minCol];
}
}
_getMaxCol(){
var numberOfColumns = 0;
var max = this.colHeights[0];
for(var i=0; i<this.colHeights.length; ++i){
if(this.colHeights[i] > max){
numberOfColumns = i;;
max = this.colHeights[i];
}
}
return numberOfColumns;
}
_getMinCol(){
var numberOfColumns = 0;
var min = this.colHeights[0];
for(var i=0; i<this.colHeights.length; ++i){
if(this.colHeights[i] < min){
numberOfColumns = i;
min = this.colHeights[i];
}
}
return numberOfColumns;
}
_renderItems(){
return this.list.map(this._renderItem);
}
_renderItem = (item,idx)=>{
var { renderItem, numberOfColumns } = this.props;
var ref = (ref)=>{ this._refItem(ref,idx) };
var initStyle = {
position:'absolute',
width: this._getItemWidth(),
left: -1000,
top:-1000,
};
return (
<ItemView
parent={this}
idx={idx}
item={item}
ref={ref}
key={idx}
style={initStyle}
renderContent={renderItem}/>
);
}
_refItem = (ref,idx)=>{
this.itemRefs[idx] = ref;
}
placementJobs = {}
placeItem(itemRef){
if( !itemRef ){
return
}
if( itemRef.props.idx == 0){
this.curPlacingIdx = 0;
this._resetVisibleRange();
this._resetColHeight();
}
var placementJob = (itemRef)=>{
if( !itemRef ){
return
}
var minCol = this._getMinCol();
var left = minCol*this._getItemWidth();
var { gap } = this.props;
if( gap > 0 ){
left += (minCol+1)*gap;
}
var top = this._getMinHeight();
itemRef.setPosition(left,top);
itemRef.showUp();
this.colHeights[minCol] += itemRef.height;
var { gap } = this.props;
if( gap > 0 ){
this.colHeights[minCol] += gap;
}
//重新设置内部容器高度
this.container.setNativeProps({
style:{
height: this._getMaxHeight()
}
});
++this.curPlacingIdx;
if( this.curPlacingIdx === this.list.length){
this.jobAfterPlacing && this.jobAfterPlacing();
this.jobAfterPlacing = null;
}
}
var idx = itemRef.props.idx
this.placementJobs[idx] = ()=>placementJob(itemRef)
var currentJob = this.placementJobs[this.curPlacingIdx]
while( currentJob ){
delete this.placementJobs[this.curPlacingIdx]
currentJob();
currentJob = this.placementJobs[this.curPlacingIdx]
}
}
_onRootLayout = (e)=>{
this.props.onLayout && this.props.onLayout(e);
var { width, height } = e.nativeEvent.layout;
if( width != this.width){
this.forceUpdate()
}
this.width = width;
this.height = height;
}
_onHeaderLayout = (e)=>{
this.props.onHeaderLayout && this.props.onHeaderLayout(e);
var { width, height } = e.nativeEvent.layout;
this.headerWidth = width;
this.headerHeight = height;
}
_refScrollView = (ref)=>{ this.scrollView = ref; }
_refContainer = (ref)=>{ this.container = ref; }
_refHeader = (ref)=> { this.header = ref; }
_controlItemVisibility = (contentOffsetY)=>{
var expansionOfScope = this.props.expansionOfScope || 0;
var top = contentOffsetY - expansionOfScope;
var bottom = contentOffsetY + this.height + expansionOfScope;
var { start, end } = this.visibleRange;
if(this.lastContentOffset === undefined){
for(var i = 0; i < this.itemRefs.length; ++i){
var itemView = this.itemRefs[i];
if( !itemView ){
continue
}
if( top > itemView.getFoot() ){
itemView.hideIt();
this.visibleRange.start = i+1;
}
else if( bottom < itemView.getTop() ){
itemView.hideIt();
}
else{
itemView.showIt();
this.visibleRange.end = i;
}
}
}
//items move upward
else if( contentOffsetY > this.lastContentOffset){
for(var i = start; i<this.itemRefs.length; ++i){
var itemView = this.itemRefs[i];
if( !itemView ){
continue
}if( top > itemView.getFoot() ){
itemView.hideIt();
}else{
this.visibleRange.start = i;
break;
}
}
for(var i=end; i < this.itemRefs.length; ++i){
var itemView = this.itemRefs[i];
if( !itemView ){
continue
}if( bottom > itemView.getTop() ){
itemView.showIt();
this.visibleRange.end = i;
}else{
break;
}
}
}
//items move downward
if( contentOffsetY < this.lastContentOffset){
for(var i=start; i>=0; --i){
var itemView = this.itemRefs[i];
if( !itemView ){
continue
}if( top < itemView.getFoot() ){
itemView.showIt();
this.visibleRange.start = i;
}else{
break;
}
}
for(var i=end; i>=0; --i){
var itemView = this.itemRefs[i];
if( !itemView ){
continue
}if( bottom < itemView.getTop() ){
itemView.hideIt();
}else{
this.visibleRange.end = i;
break;
}
}
}
this.lastContentOffset = contentOffsetY;
}
_onScroll = (e)=>{
var { onScroll, onEndReached, onEndReachedThreshold } = this.props;
var { nativeEvent } = e;
var { contentOffset , layoutMeasurement, contentSize} = nativeEvent;
this._controlItemVisibility( contentOffset.y );
onScroll && onScroll(e);
if( this.isHandlingOnEndReached && contentSize.height != this.lastContentHeight){
this.isHandlingOnEndReached = false;
}
if( !this.isHandlingOnEndReached && contentSize.height - contentOffset.y - layoutMeasurement.height < onEndReachedThreshold ){
this.isHandlingOnEndReached = true;
this.lastContentHeight = contentSize.height;
onEndReached && onEndReached();
}else if( this.isHandlingOnEndReached && contentSize.height - contentOffset.y - layoutMeasurement.height > onEndReachedThreshold){
this.isHandlingOnEndReached = false;
}
}
_renderHeader = ()=>{
return (
<View style={styles.header} ref={this._refHeader} onLayout={this._onHeaderLayout}>
{ this.props.renderHeader && this.props.renderHeader() }
</View>
)
}
render(){
return (
<ScrollView scrollEventThrottle={4} {...this.props} ref={this._refScrollView} style={[styles.root,this.props.style]} onLayout={this._onRootLayout} onScroll={this._onScroll}>
<View style={styles.container} ref={this._refContainer} >
{ this._renderHeader() }
{ this.width && this._renderItems() }
</View>
</ScrollView>
);
}
}
|
katharsis-ui/src/main/resources/App.js | adnovum/katharsis-framework | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}
export default App;
|
docs/src/pages/components/tree-view/RecursiveTreeView.js | lgollut/material-ui | import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import TreeView from '@material-ui/lab/TreeView';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import TreeItem from '@material-ui/lab/TreeItem';
const data = {
id: 'root',
name: 'Parent',
children: [
{
id: '1',
name: 'Child - 1',
},
{
id: '3',
name: 'Child - 3',
children: [
{
id: '4',
name: 'Child - 4',
},
],
},
],
};
const useStyles = makeStyles({
root: {
height: 110,
flexGrow: 1,
maxWidth: 400,
},
});
export default function RecursiveTreeView() {
const classes = useStyles();
const renderTree = (nodes) => (
<TreeItem key={nodes.id} nodeId={nodes.id} label={nodes.name}>
{Array.isArray(nodes.children) ? nodes.children.map((node) => renderTree(node)) : null}
</TreeItem>
);
return (
<TreeView
className={classes.root}
defaultCollapseIcon={<ExpandMoreIcon />}
defaultExpanded={['root']}
defaultExpandIcon={<ChevronRightIcon />}
>
{renderTree(data)}
</TreeView>
);
}
|
src/components/HelpContents/HelpDialog.js | synchu/schema | import PropTypes from 'prop-types';
import React, { Component } from 'react';
import {Dialog, Button, Tabs, Tab} from 'react-toolbox'
import {SearchContent, SideNavigation, TopMenuContent,
AppSettingsContent, GeneralContent} from '../HelpContents/HelpContents'
import classes from './HelpDialog.scss'
export class HelpDialog extends Component {
visible = true
static propTypes = {
helpActive: PropTypes.bool,
toggleHelp: PropTypes.func.isRequired
}
state = {
index: 0
}
constructor (props) {
super(props)
this.visible = true
}
handleVisibility = () => {
this.visible = false
this
.props
.toggleHelp()
}
handleTabChange = (index) => {
this.setState({index})
}
handleFixedTabChange = (index) => {
this.setState({fixedIndex: index})
}
handleInverseTabChange = (index) => {
this.setState({inverseIndex: index})
}
handleActive = () => {
console.log('Special one activated')
}
render = () => {
return (
<Dialog
active={this.visible}
theme={classes}
large
onEscKeyDown={this.handleVisibility}
onOverlayClick={this.handleVisibility}
title='SchemA application usage help'
style={{
overflow: 'auto',
height: '90%'
}}>
<div
style={{
overflow: 'auto',
minHeight: '80%',
maxHeight: '90%'
}}>
<div>
<strong>SchemA</strong> has been designed to be easy and straightforward to use. Some guidance to
its features is provided here to aid uncovering its full functionality.
</div>
<br />
<section>
<Tabs index={this.state.index} onChange={this.handleTabChange}>
<Tab label='General'>
<GeneralContent />
</Tab>
<Tab label='Top menu'>
<TopMenuContent />
</Tab>
<Tab label='Side navigation' onActive={this.handleActive}>
<SideNavigation />
</Tab>
<Tab label='Cards features(?)'>
<small>In progress</small>
</Tab>
<Tab label='List features(?)'>
<small>In progress</small>
</Tab>
<Tab label='Search'>
<SearchContent />
</Tab>
<Tab label='Settings'>
<AppSettingsContent />
</Tab>
</Tabs>
</section>
<Button
style={{
display: 'flex',
marginLeft: 'auto',
marginBottom: '10px'
}}
accent
label='X'
onClick={this.handleVisibility} />
</div>
</Dialog>
)
}
}
export default HelpDialog
|
client/app/components/Body/Body.js | sfabrizio/bloggy | import React from 'react';
import BlogStore from '../../stores/BlogStore';
import * as BlogActions from '../../actions/BlogActions';
import BlogItemRow from './BlogItemRow';
import BlogEntryCreator from './BlogEntryCreator';
import Loading from './Loading';
export default class Body extends React.Component {
constructor() {
super();
this.state = {
blogs: BlogStore.getAll()
};
}
componentWillMount() {
BlogStore.on('change', this.getBlogs.bind(this));
BlogActions.reloadBlogs(); // first get
this.autoReloadBlogs(); // auto reload every 5s
}
componentWillUnmount() {
BlogStore.removeListener('change', this.getBlogs);
}
getBlogs() {
this.setState({
blogs: BlogStore.getAll()
});
}
autoReloadBlogs() {
setInterval( () => {
/*eslint-disable*/
console.log('fetching...');
/*eslint-enable*/
BlogActions.reloadBlogs();
},5000);
}
render() {
const { blogs } = this.state,
BlogEntries = blogs.map((entry) => {
if (entry.title === 'loading') { return; } // prevent show empty item
return <BlogItemRow key={entry.id} id={entry.id} title={entry.title} content={entry.content}/>;
});
return (
<div className="body">
<div className="items-container">
{ BlogEntries }
{( () => {
if ( this.state.blogs.length && this.state.blogs[0].title === 'loading') { return <Loading/>; }
return <BlogEntryCreator createBlog={BlogActions.createBlog.bind(this)}/>;
}
)()}
</div>
</div>
);
}
}
|
public/javascripts/main.js | nicrou/react_js_playground | import React from 'react';
import ReactDOM from 'react-dom';
import Counter from './counter';
document.addEventListener('DOMContentLoaded', function() {
ReactDOM.render(
React.createElement(Counter),
document.getElementById('mount')
);
});
|
src/components/layout/SimpleLayout/SimpleLayout.js | jdbence/capstone-project | import React, { Component } from 'react';
import { Layout } from 'react-toolbox/components/index.js';
import { withRouter } from 'react-router';
export default function (Wrapped){
class SimpleLayout extends Component {
static propTypes = {
router: React.PropTypes.shape({
push: React.PropTypes.func.isRequired
}).isRequired
}
render() {
return (
<Layout>
<Wrapped {...this.props} role="main"/>
</Layout>
);
}
}
return withRouter(SimpleLayout, { withRef: true });
}
|
app/javascript/mastodon/features/reblogs/index.js | masto-donte-com-br/mastodon | import React from 'react';
import { connect } from 'react-redux';
import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import LoadingIndicator from '../../components/loading_indicator';
import { fetchReblogs } from '../../actions/interactions';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import AccountContainer from '../../containers/account_container';
import Column from '../ui/components/column';
import ScrollableList from '../../components/scrollable_list';
import Icon from 'mastodon/components/icon';
import ColumnHeader from '../../components/column_header';
const messages = defineMessages({
refresh: { id: 'refresh', defaultMessage: 'Refresh' },
});
const mapStateToProps = (state, props) => ({
accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]),
});
export default @connect(mapStateToProps)
@injectIntl
class Reblogs extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
multiColumn: PropTypes.bool,
intl: PropTypes.object.isRequired,
};
componentWillMount () {
if (!this.props.accountIds) {
this.props.dispatch(fetchReblogs(this.props.params.statusId));
}
}
componentWillReceiveProps(nextProps) {
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
this.props.dispatch(fetchReblogs(nextProps.params.statusId));
}
}
handleRefresh = () => {
this.props.dispatch(fetchReblogs(this.props.params.statusId));
}
render () {
const { intl, accountIds, multiColumn } = this.props;
if (!accountIds) {
return (
<Column>
<LoadingIndicator />
</Column>
);
}
const emptyMessage = <FormattedMessage id='status.reblogs.empty' defaultMessage='No one has boosted this post yet. When someone does, they will show up here.' />;
return (
<Column bindToDocument={!multiColumn}>
<ColumnHeader
showBackButton
multiColumn={multiColumn}
extraButton={(
<button className='column-header__button' title={intl.formatMessage(messages.refresh)} aria-label={intl.formatMessage(messages.refresh)} onClick={this.handleRefresh}><Icon id='refresh' /></button>
)}
/>
<ScrollableList
scrollKey='reblogs'
emptyMessage={emptyMessage}
bindToDocument={!multiColumn}
>
{accountIds.map(id =>
<AccountContainer key={id} id={id} withNote={false} />,
)}
</ScrollableList>
</Column>
);
}
}
|
packages/react-scripts/fixtures/kitchensink/src/features/syntax/DefaultParameters.js | dsopel94/create-react-app | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load(id = 0) {
return [
{ id: id + 1, name: '1' },
{ id: id + 2, name: '2' },
{ id: id + 3, name: '3' },
{ id: id + 4, name: '4' },
];
}
export default class extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-default-parameters">
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
}
|
packages/reactReduxFormBase/DEV/schemaData.js | daniloster/react-experiments | import React from 'react';
import { combineValidations } from '../src/formUtils';
export default {
'contacts[].value': combineValidations(({ data, path, value }) => {
const isValid = !!value;
const message = isValid ? null : (
<span key={`${path}-required`} className="react__form-item-validation-message">
Contact is required
</span>
);
return { data, isValid, message, path };
}),
'attributes[]': combineValidations(({ data, path, value }) => {
const isValid = !!value;
const message = isValid ? null : (
<span key={`${path}-required`} className="react__form-item-validation-message">
Attribute is required
</span>
);
return { data, isValid, message, path };
}),
age: combineValidations(({ data, path, value }) => {
const isValid = !!value && /\d+$/g.test(value);
const message = isValid ? null : (
<span key={`${path}-required-only-numbers`} className="react__form-item-validation-message">
Age is required and only accepts numbers
</span>
);
return { data, isValid, message, path };
}),
title: combineValidations(
({ data, path, value }) => {
const isValid = !!value && /^(([m][r])([s]?))/gi.test(value);
const message = isValid ? null : (
<span key={`${path}-only-mr-mrs`} className="react__form-item-validation-message">
The only allowed ones are {'"Mr"'} or {'"Mrs"'}.
</span>
);
return { data, isValid, message, path };
},
({ data, path, value }) => {
const isValid = !!value;
const message = isValid ? null : (
<span key={`${path}-required`} className="react__form-item-validation-message">
Title is required!
</span>
);
return { data, isValid, message, path };
},
),
firstname: combineValidations(({ data, path, value }) => {
const isValid = !!value;
const message = isValid ? null : (
<div key={`${path}-required`} className="react__form-item-validation-message">
Firstname is required
</div>
);
return { data, isValid, message, path };
}),
lastname: combineValidations(({ data, path, value }) => {
const isValid = !!value;
const message = isValid ? null : (
<div key={`${path}-required`} className="react__form-item-validation-message">
Lastname is required
</div>
);
return { data, isValid, message, path };
}),
'certificate.description': combineValidations(
({ data, path, value }) => {
const isValid = !!value && /^(((\w+)\s+){9}(\w+))/g.test(value);
const message = isValid ? null : (
<div key={`${path}-min-10-words`} className="react__form-item-validation-message">
It requires 10 words as description at least.
</div>
);
return { data, isValid, message, path };
},
({ data, path, value }) => {
const isValid = !!value;
const message = isValid ? null : (
<div key={`${path}-required`} className="react__form-item-validation-message">
Certificate description is required!
</div>
);
return { data, isValid, message, path };
},
),
};
|
jenkins-design-language/src/js/components/material-ui/svg-icons/communication/phonelink-lock.js | alvarolobato/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const CommunicationPhonelinkLock = (props) => (
<SvgIcon {...props}>
<path d="M19 1H9c-1.1 0-2 .9-2 2v3h2V4h10v16H9v-2H7v3c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm-8.2 10V9.5C10.8 8.1 9.4 7 8 7S5.2 8.1 5.2 9.5V11c-.6 0-1.2.6-1.2 1.2v3.5c0 .7.6 1.3 1.2 1.3h5.5c.7 0 1.3-.6 1.3-1.2v-3.5c0-.7-.6-1.3-1.2-1.3zm-1.3 0h-3V9.5c0-.8.7-1.3 1.5-1.3s1.5.5 1.5 1.3V11z"/>
</SvgIcon>
);
CommunicationPhonelinkLock.displayName = 'CommunicationPhonelinkLock';
CommunicationPhonelinkLock.muiName = 'SvgIcon';
export default CommunicationPhonelinkLock;
|
src/helpers/universalRouter.js | sylnp0201/react-redux-universal-hot-example | import React from 'react';
import Router from 'react-router';
import createRoutes from '../routes';
import {Provider} from 'react-redux';
const getFetchData = (component = {}) => {
return component.WrappedComponent ?
getFetchData(component.WrappedComponent) :
component.fetchData;
};
export function createTransitionHook(store) {
return (nextState, transition, callback) => {
const { params, location: { query } } = nextState;
const promises = nextState.branch
.map(route => route.component) // pull out individual route components
.filter((component) => getFetchData(component)) // only look at ones with a static fetchData()
.map(getFetchData) // pull out fetch data methods
.map(fetchData => fetchData(store, params, query || {})); // call fetch data methods and save promises
Promise.all(promises)
.then(() => {
callback(); // can't just pass callback to then() because callback assumes first param is error
}, (error) => {
callback(error);
});
};
}
export default function universalRouter(location, history, store) {
const routes = createRoutes(store);
return new Promise((resolve, reject) => {
Router.run(routes, location, [createTransitionHook(store)], (error, initialState, transition) => {
if (error) {
return reject(error);
}
if (transition && transition.redirectInfo) {
return resolve({
transition,
isRedirect: true
});
}
if (history) { // only on client side
initialState.history = history;
}
const component = (
<Provider store={store} key="provider">
{() => <Router {...initialState} children={routes}/>}
</Provider>
);
return resolve({
component,
isRedirect: false
});
});
});
}
|
src/svg-icons/maps/local-hotel.js | skarnecki/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsLocalHotel = (props) => (
<SvgIcon {...props}>
<path d="M7 13c1.66 0 3-1.34 3-3S8.66 7 7 7s-3 1.34-3 3 1.34 3 3 3zm12-6h-8v7H3V5H1v15h2v-3h18v3h2v-9c0-2.21-1.79-4-4-4z"/>
</SvgIcon>
);
MapsLocalHotel = pure(MapsLocalHotel);
MapsLocalHotel.displayName = 'MapsLocalHotel';
export default MapsLocalHotel;
|
src/app/components/media/AutoCompleteMediaItem.js | meedan/check-web | import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { makeStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Tooltip from '@material-ui/core/Tooltip';
import Checkbox from '@material-ui/core/Checkbox';
import Typography from '@material-ui/core/Typography';
import IconButton from '@material-ui/core/IconButton';
import TextField from '@material-ui/core/TextField';
import SettingsIcon from '@material-ui/icons/Settings';
import config from 'config'; // eslint-disable-line require-path-exists/exists
import { stringHelper } from '../../customHelpers';
import CheckArchivedFlags from '../../CheckArchivedFlags';
import SearchKeywordContainer from '../search/SearchKeywordConfig/SearchKeywordContainer';
import MediaItem from './Similarity/MediaItem';
import { black32 } from '../../styles/js/shared';
const useStyles = makeStyles(theme => ({
searchSettingsTitle: {
fontWeight: 'bold',
},
searchSettingsBox: {
borderLeft: `1px solid ${black32}`,
marginLeft: theme.spacing(1),
paddingLeft: theme.spacing(2),
width: 300,
},
autocompleteResults: {
overflow: 'auto',
maxHeight: 400,
paddingRight: theme.spacing(1),
marginTop: 12,
},
searchSettingsButton: {
marginTop: theme.spacing(0.5),
},
}));
// Return { jsonPromise, abort }.
//
// jsonPromise will reject as AbortError if aborted.
//
// jsonPromise will reject as Error if response status is not 200 or response
// is not valid JSON.
function fetchJsonEnsuringOkAllowingAbort(url, params) {
const controller = new AbortController();
const abort = () => controller.abort();
const { signal } = controller;
const jsonPromise = (async () => {
const httpResponse = await fetch(url, { signal, ...params }); // may throw
if (!httpResponse.ok) {
throw new Error('HTTP response not OK');
}
const jsonResponse = await httpResponse.json(); // may throw
return jsonResponse;
})();
return { jsonPromise, abort };
}
const AutoCompleteMediaItem = (props, context) => {
const classes = useStyles();
const teamSlug = context.store.getState().app.context.team.slug; // TODO make it a prop
const [anchorEl, setAnchorEl] = React.useState(null);
const [searchText, setSearchText] = React.useState('');
const [showFilters, setShowFilters] = React.useState(false);
const [keywordFields, setKeywordFields] = React.useState(null);
const [selectedProjectMediaDbid, setSelectedProjectMediaDbid] = React.useState(null);
// Object with { loading, items, error } (only one truthy), or `null`
const [searchResult, setSearchResult] = React.useState(null);
const handleKeyPress = React.useCallback((e) => {
// Avoid submitting form. TODO make Enter skip the timeout?
if (e.key === 'Enter') {
e.preventDefault();
}
}, []);
const handleSelectOne = (dbid) => {
const selProjectMedia = searchResult.items.find(projectMedia => projectMedia.dbid === dbid);
setSelectedProjectMediaDbid(dbid);
props.onSelect(selProjectMedia);
};
const handleSelectMany = (dbid, selected) => {
const selProjectMedia = searchResult.items.find(projectMedia => projectMedia.dbid === dbid);
props.onSelect(selProjectMedia, selected);
};
const handleChangeSearchText = React.useCallback((e) => {
setSearchText(e.target.value);
}, [setSearchText]);
const handleCloseFilters = () => {
setShowFilters(false);
setKeywordFields(null);
};
const handleChangeFilters = (filters) => {
setKeywordFields(filters.keyword_fields);
setShowFilters(false);
};
const handleSettingsButton = (event) => {
setAnchorEl(event.currentTarget);
setShowFilters(!showFilters);
};
const query = {
keyword: searchText,
show: props.typesToShow || ['claims', 'links', 'images', 'videos', 'audios'],
eslimit: 50,
archived: CheckArchivedFlags.NONE,
show_similar: Boolean(props.customFilter),
};
if (keywordFields) {
query.keyword_fields = keywordFields;
}
// Call setSearchResult() twice (loading ... results!) whenever `searchText` changes.
//
// After abort, we promise we won't call any more setSearchResult().
React.useEffect(() => {
// eslint-disable-next-line no-useless-escape
if (searchText.length < 3 && !/\p{Extended_Pictographic}/u.test(searchText)) {
setSearchResult(null);
return undefined; // no cleanup needed
}
const keystrokeWait = 1000;
setSearchResult({ loading: true, items: null, error: null });
let aborted = false;
let timer = null; // we'll set it below
let abortHttpRequest = null;
async function begin() {
timer = null;
if (aborted) { // paranoia?
return;
}
const encodedQuery = JSON.stringify(JSON.stringify(query));
const params = {
body: `query=query {
search(query: ${encodedQuery}) {
medias(first: 50) {
edges {
node {
id
dbid
title
description
picture
type
last_seen
requests_count
linked_items_count
report_status
is_confirmed_similar_to_another_item
}
}
}
team {
id
name
project_groups(first: 10000) {
edges {
node {
dbid
title
}
}
}
projects(first: 10000) {
edges {
node {
id
dbid
title
medias_count
search_id
}
}
}
}
}
}
`,
headers: {
Accept: '*/*',
'Content-Type': 'application/x-www-form-urlencoded',
'X-Check-Team': teamSlug,
...config.relayHeaders,
},
method: 'POST',
credentials: 'include',
referrerPolicy: 'no-referrer',
};
const { jsonPromise, abort } = fetchJsonEnsuringOkAllowingAbort(config.relayPath, params);
// abortAsyncStuff() should call this HTTP abort(). That will cause
// an AbortError from the HTTP response.
abortHttpRequest = abort;
let response;
try {
response = await jsonPromise;
} catch (err) {
if (aborted) {
return; // this is a healthy error and we should stop processing now
}
setSearchResult({ loading: false, items: null, error: err });
return;
}
if (aborted) {
// After HTTP response and before we started processing it, user aborted.
return;
}
// The rest of this code is synchronous, so it can't be aborted.
try {
const { team } = response.data.search;
let items = response.data.search.medias.edges.map(({ node }) => node);
if (props.customFilter) {
items = props.customFilter(items);
} else {
items = items
.filter(({ is_confirmed_similar_to_another_item }) =>
!is_confirmed_similar_to_another_item);
}
items = items
.filter(({ dbid }) => dbid !== props.dbid);
items = items.map(item => ({
...item,
text: item.title,
value: item.dbid,
isPublished: item.report_status === 'published',
}));
setSearchResult({
loading: false,
items,
team,
error: null,
});
} catch (err) {
// TODO nix catch-all error handler for errors we've likely never seen
console.error(err); // eslint-disable-line no-console
setSearchResult({ loading: false, items: null, error: err });
}
}
const abortAsyncStuff = () => {
aborted = true;
if (timer !== null) {
clearTimeout(timer);
timer = null;
}
if (abortHttpRequest !== null) {
abortHttpRequest();
abortHttpRequest = null;
}
};
timer = setTimeout(begin, keystrokeWait);
return abortAsyncStuff;
}, [searchText, setSearchResult, props.dbid, keywordFields]);
return (
<Box display="flex" alignItems="flex-start" className="autocomplete-media-item">
<Box flexGrow="1" width={1}>
<Box display="flex" alignItems="flex-start" flexGrow="1">
<TextField
id="autocomplete-media-item"
name="autocomplete-media-item"
label={
<FormattedMessage id="autoCompleteMediaItem.searchItem" defaultMessage="Search" />
}
onKeyPress={handleKeyPress}
onChange={handleChangeSearchText}
helperText={
searchResult ?
<React.Fragment>
{ searchResult.loading ?
<FormattedMessage id="autoCompleteMediaItem.searching" defaultMessage="Searching…" /> : null }
{ !searchResult.loading && !searchResult.error && !searchResult.items.length ?
<FormattedMessage id="autoCompleteMediaItem.notFound" defaultMessage="No matches found" /> : null }
{ searchResult.error ?
<FormattedMessage id="autoCompleteMediaItem.error" defaultMessage="Sorry, an error occurred while searching. Please try again and contact {supportEmail} if the condition persists." values={{ supportEmail: stringHelper('SUPPORT_EMAIL') }} /> : null }
{ searchResult.items && searchResult.items.length > 0 ?
<FormattedMessage id="autoCompleteMediaItem.results" defaultMessage="{count, plural, one {# result} other {# results}}" values={{ count: searchResult.items.length }} /> : null }
</React.Fragment> : null
}
variant="outlined"
fullWidth
/>
{ props.showFilters ?
<IconButton
onClick={handleSettingsButton}
className={classes.searchSettingsButton}
>
<SettingsIcon />
</IconButton> : null }
</Box>
{ searchResult ?
<Box>
{ searchResult.items && searchResult.items.length > 0 ?
<Box className={classes.autocompleteResults}>
{ searchResult.items.map(projectMedia => (
<Box
display="flex"
alignItems="center"
key={projectMedia.dbid}
className={props.multiple ? '' : 'autocomplete-media-item__select'}
>
{ props.multiple ?
<Tooltip
disableFocusListener
disableTouchListener
disableHoverListener={!projectMedia.isPublished || !props.disablePublished}
title={
<FormattedMessage
id="autoCompleteMediaItem.cantSelectPublished"
defaultMessage="Media cannot be imported from items that have their report published"
/>
}
>
<span>
<Checkbox
className="autocomplete-media-item__select"
disabled={projectMedia.isPublished && props.disablePublished}
onChange={(e, checked) => {
handleSelectMany(projectMedia.dbid, checked);
}}
/>
</span>
</Tooltip> : null
}
<MediaItem
team={searchResult.team}
projectMedia={projectMedia}
onSelect={props.multiple ? null : handleSelectOne}
isSelected={selectedProjectMediaDbid === projectMedia.dbid}
/>
</Box>
))}
</Box> : null }
</Box> : null }
</Box>
{ showFilters ?
<Box className={classes.searchSettingsBox}>
<Typography variant="subtitle1" className={classes.searchSettingsTitle}>
<FormattedMessage
id="autoCompleteMediaItem.searchSettings"
defaultMessage="Search settings"
/>
</Typography>
<SearchKeywordContainer
anchorEl={anchorEl}
teamSlug={teamSlug}
query={query}
onDismiss={handleCloseFilters}
onSubmit={handleChangeFilters}
/>
</Box> : null }
</Box>
);
};
AutoCompleteMediaItem.contextTypes = {
store: PropTypes.object, // TODO nix
};
AutoCompleteMediaItem.defaultProps = {
dbid: null,
typesToShow: ['claims', 'links', 'images', 'videos', 'audios'],
customFilter: null,
showFilters: false,
multiple: false,
disablePublished: false,
};
AutoCompleteMediaItem.propTypes = {
// onSelect: PropTypes.func.isRequired, // func({ value, text } or null) => undefined
dbid: PropTypes.number, // filter results: do _not_ select this number
typesToShow: PropTypes.arrayOf(PropTypes.string),
customFilter: PropTypes.func,
showFilters: PropTypes.bool,
multiple: PropTypes.bool,
disablePublished: PropTypes.bool,
};
export default AutoCompleteMediaItem;
|
packages/reactor-kitchensink/src/examples/Grid/GroupedGrid/GroupedGrid.js | dbuhrman/extjs-reactor | import React, { Component } from 'react';
import { Container, Grid, Toolbar, SegmentedButton, Button, Column } from '@extjs/ext-react';
import './data';
Ext.require([
'Ext.grid.cell.Number',
'Ext.grid.cell.Widget',
'Ext.grid.SummaryRow',
'Ext.ux.rating.Picker'
]);
export default class GroupedGridExample extends Component {
store = Ext.create('Ext.data.Store', {
autoLoad: true,
proxy: {
type: 'ajax',
url: '/KitchenSink/Restaurants'
},
sorters: ['cuisine', 'name'],
groupField: 'cuisine'
});
state = {
grouped: true
};
onToggleGrouping = on => this.setState({ grouped: on })
render() {
const { grouped } = this.state;
return (
<Container layout="vbox" padding="10">
<Toolbar margin="0 0 20 0" shadow>
<div style={{ marginRight: '10px' }}>Grouping:</div>
<SegmentedButton label="Grouping">
<Button ui="toolbar-default" pressed text="ON" handler={this.onToggleGrouping.bind(this, true)}/>
<Button ui="toolbar-default" text="OFF" handler={this.onToggleGrouping.bind(this, false)}/>
</SegmentedButton>
</Toolbar>
<Grid
flex={1}
title="Restaurants"
shadow
store={this.store}
grouped={grouped}
groupFooter={{
xtype: 'gridsummaryrow'
}}
>
<Column t
text="Name"
dataIndex="name"
flex={1}
groupHeaderTpl='{columnName}: {value:htmlEncode}'
/>
<Column
text="Cuisine"
dataIndex="cuisine"
flex={1}
/>
<Column
text="Rating"
dataIndex="rating"
summaryCell="numbercell"
groupHeaderTpl='{value:repeat("★")} ({value:plural("Star")})'
cell={{
xtype: 'widgetcell',
widget: {
xtype: 'rating',
tip: 'Set to {tracking:plural("Star")}'
}
}}
/>
</Grid>
</Container>
)
}
}
|
wwwroot/app/src/components/MyRecipesPage/MyRecipesPageContainer.js | AlinCiocan/FoodPlanApp | import React, { Component } from 'react';
import { ApiRequest } from '../../services/ApiRequest';
import Routes from '../../services/Routes';
import RecipeService from '../../services/RecipeService';
import TopBar from '../TopBar/TopBar';
import RecipesList from './RecipesList';
import ConfirmModal from '../base/modal/ConfirmModal';
import SearchInput from '../base/search/SearchInput';
import NavigationMenu from '../NavigationMenu';
import pages from '../../constants/pages';
export default class MyRecipesPageContainer extends Component {
constructor(props) {
super(props);
this.state = {
recipes: null,
message: null,
recipeIdToBeRemoved: null,
searchTerm: ''
};
}
componentDidMount() {
this.retrieveRecipes()
}
retrieveRecipes() {
this.setState({ message: this.getLoadingMessage() });
ApiRequest
.retrieveRecipes()
.then(
rsp => {
this.setState({ recipes: RecipeService.processRecipes(rsp.body), message: null })
},
err => {
this.setState({ message: this.getErrorMessage() })
});
}
getLoadingMessage() {
return (<h3> Loading your recipes... </h3>);
}
getRemovingYourRecipeMessage() {
return (<h3> Removing your recipe... </h3>);
}
getErrorMessage() {
return (
<h3 style={{ color: 'red' }}> There was an error with our server. Please try again! </h3>
);
}
onSearch(searchTerm) {
this.setState({ searchTerm });
}
getSearchedRecipes() {
const searchTerm = this.state.searchTerm.trim().toLocaleLowerCase();
if (!searchTerm) {
return this.state.recipes;
}
return this.state.recipes.filter(recipe => recipe.name.toLocaleLowerCase().indexOf(searchTerm) >= 0);
}
renderRecipes() {
if (this.state.recipes !== null) {
const searchedRecipes = this.getSearchedRecipes();
return (
<div>
<div className="my-recipe-container__search">
<SearchInput onChange={searchTerm => this.onSearch(searchTerm)} />
</div>
<RecipesList
title="Recipes"
recipes={searchedRecipes}
onRecipeClick={recipeId => this.props.router.push(Routes.viewRecipe(recipeId))}
onRecipeRemove={recipeId => this.setState({ recipeIdToBeRemoved: recipeId })}
/>
</div>
);
}
return null;
}
removeRecipe(recipeId) {
this.setState({ recipeIdToBeRemoved: null, message: this.getRemovingYourRecipeMessage() });
ApiRequest.removeRecipe(recipeId).then(response => {
const {isSuccess, message} = response.body;
if (!isSuccess) {
console.log(message);
}
this.retrieveRecipes();
}, err => {
// TODO: also make sure to treat the forbidden requests
console.log(err);
this.setState({ message: this.getErrorMessage() });
});
}
renderRemoveModal() {
const isRecipeToBeDeleted = !!this.state.recipeIdToBeRemoved;
const modalTitle = 'Are you sure you want to remove this recipe?';
return (
<ConfirmModal
isOpen={isRecipeToBeDeleted}
title={modalTitle}
cancelButtonText="Cancel"
onCancel={() => this.setState({ recipeIdToBeRemoved: null })}
actionButtonText="Remove"
onAction={() => this.removeRecipe(this.state.recipeIdToBeRemoved)}
/>
);
}
render() {
return (
<div>
<TopBar addButton addButtonOnClick={() => this.props.router.push(Routes.addMyRecipe())} />
<div className="pes-row">
{this.state.message}
{this.renderRecipes()}
</div>
{this.renderRemoveModal()}
<NavigationMenu activeItem={pages.RECIPES} />
</div>
);
}
} |
src/client/app/index.js | mapkiwiz/sectorisation | import React from 'react';
import ReactDOM from 'react-dom';
import {App} from './app';
import {Provider} from 'react-redux';
import {reducer} from './reducers/index';
import {loadProject, saveProject} from './shared/project';
import URLSearchParams from 'url-search-params';
const Redux = require('redux');
class Messenger {
message;
getMessage() {
return this.message;
}
setMessage(text, type) {
this.message = {
text: text,
type: type
};
}
clearMessages() {
this.message = undefined;
}
}
(function() {
let store;
let messenger = new Messenger();
if (window.location.search) {
let params = new URLSearchParams(window.location.search.slice(1));
let projectId = params.get('p');
if (projectId) {
let state = loadProject(projectId);
store = Redux.createStore(reducer, state);
messenger.setMessage('Projet ouvert : ' + (state.project.title || 'Sans titre'), 'success');
} else {
store = Redux.createStore(reducer);
messenger.setMessage('Nouveau projet', 'success');
}
} else {
store = Redux.createStore(reducer);
messenger.setMessage('Nouveau projet', 'success');
}
ReactDOM.render(
<Provider store={ store }>
<App messenger={ messenger }></App>
</Provider>,
document.getElementById('main')
);
window.onbeforeunload = function (e) {
// TODO saveProject(store.getState());
console.log(e);
let message = "Voulez-vous vraiment quitter l'application ?";
e = e || window.event;
// For IE and Firefox
if (e) {
console.log(e);
e.returnValue = message;
}
// For Safari
return message;
};
store.dispatch({
type: 'WORKER_RESET_FILTER'
});
store.dispatch({
type: 'GROUP_RESET_FILTER'
});
})();
|
src/svg-icons/maps/add-location.js | owencm/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsAddLocation = (props) => (
<SvgIcon {...props}>
<path d="M12 2C8.14 2 5 5.14 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.86-3.14-7-7-7zm4 8h-3v3h-2v-3H8V8h3V5h2v3h3v2z"/>
</SvgIcon>
);
MapsAddLocation = pure(MapsAddLocation);
MapsAddLocation.displayName = 'MapsAddLocation';
MapsAddLocation.muiName = 'SvgIcon';
export default MapsAddLocation;
|
fields/types/azurefile/AzureFileColumn.js | Redmart/keystone | import React from 'react';
var AzureFileColumn = React.createClass({
renderValue () {
var value = this.props.data.fields[this.props.col.path];
if (!value) return;
return <a href={value.url} target="_blank">{value.url}</a>;
},
render () {
return (
<td className="ItemList__col">
<div className="ItemList__value ItemList__value--azure-file">{this.renderValue()}</div>
</td>
);
},
});
module.exports = AzureFileColumn;
|
components/Login.js | HossamSamir/instagramClone | import React from 'react';
import {
AppRegistry,
StyleSheet,
Alert,
Text,
Button,
View,
Image,
TextInput,
TouchableOpacity,
TouchableHighlight
} from 'react-native';
export default () => (
<View style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}}>
<Image
source={{uri: 'https://scontent.faly1-1.fna.fbcdn.net/v/t34.0-12/20045864_498693043805931_133968181_n.png?oh=ff9c482106a4ab3859f01016b8667011&oe=5966C5DC'}}
style={
{
width: '100%',
height: '100%',
resizeMode: 'cover'
}
} />
<Image
source={{uri: 'https://scontent.faly1-1.fna.fbcdn.net/v/t34.0-12/19964723_498693020472600_152053877_n.png?oh=97002dc0c5c40cd9c49811145ba0340f&oe=5966BC87'}}
style={
{
width: '60%',
height: 115,
position: 'absolute',
resizeMode: 'contain',
top: 140
}
} />
<TextInput
placeholder="Username"
underlineColorAndroid="transparent"
placeholderTextColor='rgba(255, 255, 255, .4)'
style={{
position: 'absolute',
top: 250,
fontWeight: 'bold',
width: '80%',
fontSize: 20,
backgroundColor: 'rgba(255, 255, 255, .1)',
padding: 10,
borderRadius: 5
}}
/>
<TextInput
placeholder="Password"
underlineColorAndroid="transparent"
placeholderTextColor='rgba(255, 255, 255, .4)'
style={{
position: 'absolute',
top: 312,
width: '80%',
fontSize: 20,
backgroundColor: 'rgba(255, 255, 255, .1)',
padding: 10,
borderRadius: 5,
fontWeight: 'bold',
}}
/>
<TouchableOpacity style={{
position: 'absolute',
width: '80%',
top: 375,
backgroundColor: 'transparent',
borderColor: 'rgba(255, 255, 255, .1)',
borderWidth: 2,
padding: 10,
borderRadius: 5,
alignItems: 'center'
}}>
<Text style={{
fontSize: 18,
fontWeight: 'bold',
color: 'rgba(255, 255, 255, .3)'
}}>Login</Text>
</TouchableOpacity>
<View style={{
position: 'absolute',
width: '100%',
bottom: 0,
backgroundColor: 'transparent',
borderColor: 'rgba(255, 255, 255, .1)',
borderWidth: 2,
alignItems: 'center',
borderColor: 'transparent',
borderTopColor: 'rgba(255, 255, 255, .1)',
backgroundColor: 'rgba(255, 255, 255, .1)',
flexWrap: 'wrap',
alignItems: 'flex-start',
flexDirection:'row',
}}>
<Text style={{
padding: 20,
fontSize: 15,
fontWeight: 'bold',
opacity: .5,
color: 'white'
}}>
Don't have an account?
</Text>
</View>
</View>
);
|
src/svg-icons/av/volume-up.js | tan-jerene/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvVolumeUp = (props) => (
<SvgIcon {...props}>
<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>
</SvgIcon>
);
AvVolumeUp = pure(AvVolumeUp);
AvVolumeUp.displayName = 'AvVolumeUp';
AvVolumeUp.muiName = 'SvgIcon';
export default AvVolumeUp;
|
mxcube3/ui/containers/SampleViewContainer.js | meguiraun/mxcube3 | import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import SampleImage from '../components/SampleView/SampleImage';
import MotorControl from '../components/SampleView/MotorControl';
import PhaseInput from '../components/SampleView/PhaseInput';
import ApertureInput from '../components/SampleView/ApertureInput';
import ContextMenu from '../components/SampleView/ContextMenu';
import * as SampleViewActions from '../actions/sampleview';
import { showTaskForm } from '../actions/taskForm';
import BeamlineSetupContainer from './BeamlineSetupContainer';
import SampleQueueContainer from './SampleQueueContainer';
import { QUEUE_RUNNING } from '../constants';
import config from 'guiConfig';
class SampleViewContainer extends Component {
render() {
const { sourceScale, imageRatio, motorSteps } = this.props.sampleViewState;
const { sendMotorPosition, setStepSize, sendStopMotor } = this.props.sampleViewActions;
const sampleID = this.props.current.sampleID;
const [points, lines, grids] = [{}, {}, {}];
const selectedGrids = [];
Object.keys(this.props.shapes).forEach((key) => {
const shape = this.props.shapes[key];
if (shape.t === 'P') {
points[shape.id] = shape;
} else if (shape.t === 'L') {
lines[shape.id] = shape;
} else if (shape.t === 'G') {
grids[shape.id] = shape;
if (shape.selected) {
selectedGrids.push(shape);
}
}
});
const phaseControl = (
<div>
<p className="motor-name">Phase Control:</p>
<PhaseInput
phase={this.props.sampleViewState.currentPhase}
phaseList={this.props.sampleViewState.phaseList}
sendPhase={this.props.sampleViewActions.sendCurrentPhase}
/>
</div>);
const apertureControl = (
<div>
<p className="motor-name">Beam size:</p>
<ApertureInput
aperture={this.props.sampleViewState.currentAperture}
apertureList={this.props.sampleViewState.apertureList}
sendAperture={this.props.sampleViewActions.sendChangeAperture}
/>
</div>);
return (
<div className="row">
<div className="col-xs-12">
<div className="row">
<div className="col-xs-12">
<BeamlineSetupContainer />
</div>
</div>
<div className="row" style={ { display: 'flex', marginTop: '1em' } }>
<div className="col-xs-1"
style={ { paddingRight: '5px', paddingLeft: '1.5em' } }
>
{config.phaseControl ? phaseControl : null }
{apertureControl}
<MotorControl
save={sendMotorPosition}
saveStep={setStepSize}
motors={this.props.beamline.motors}
motorsDisabled={ this.props.beamline.motorInputDisable ||
this.props.queueState === QUEUE_RUNNING }
steps={motorSteps}
stop={sendStopMotor}
/>
</div>
<div className="col-xs-7">
<ContextMenu
{...this.props.contextMenu}
sampleActions={this.props.sampleViewActions}
beamline={this.props.beamline}
showForm={this.props.showForm}
sampleID={sampleID}
sampleData={this.props.sampleList[sampleID]}
defaultParameters={this.props.defaultParameters}
imageRatio={imageRatio * sourceScale}
workflows={this.props.workflows}
savedPointId={this.props.sampleViewState.savedPointId}
groupFolder={this.props.groupFolder}
clickCentring={this.props.sampleViewState.clickCentring}
/>
<SampleImage
sampleActions={this.props.sampleViewActions}
{...this.props.sampleViewState}
{...this.props.beamline}
imageRatio={imageRatio * sourceScale}
contextMenuVisible={this.props.contextMenu.show}
shapes={this.props.shapes}
points={points}
lines={lines}
grids={grids}
selectedGrids={selectedGrids}
cellCounting={this.props.cellCounting}
cellSpacing={this.props.cellSpacing}
current={this.props.current}
sampleList={this.props.sampleList}
proposal={this.props.proposal}
busy={this.props.queueState === QUEUE_RUNNING}
/>
</div>
<div className="col-xs-4" style={ { display: 'flex' } }>
<SampleQueueContainer />
</div>
</div>
</div>
</div>
);
}
}
function mapStateToProps(state) {
return {
sampleList: state.sampleGrid.sampleList,
current: state.queue.current,
groupFolder: state.queue.groupFolder,
queueState: state.queue.queueStatus,
sampleViewState: state.sampleview,
contextMenu: state.contextMenu,
beamline: state.beamline,
defaultParameters: state.taskForm.defaultParameters,
shapes: state.shapes.shapes,
workflows: state.workflow.workflows,
cellCounting: state.taskForm.defaultParameters.mesh.cell_counting,
cellSpacing: state.taskForm.defaultParameters.mesh.cell_spacing,
proposal: state.login.selectedProposal,
remoteAccess: state.remoteAccess
};
}
function mapDispatchToProps(dispatch) {
return {
sampleViewActions: bindActionCreators(SampleViewActions, dispatch),
showForm: bindActionCreators(showTaskForm, dispatch)
};
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(SampleViewContainer);
|
packages/icons/src/md/communication/ImportContacts.js | suitejs/suitejs | import React from 'react';
import IconBase from '@suitejs/icon-base';
function MdImportContacts(props) {
return (
<IconBase viewBox="0 0 48 48" {...props}>
<path d="M42 8c1.5.5 2.8 1.1 4 2v29.2c0 .5-.5 1-1 1-.2 0-.3 0-.5-.1-2.8-1.5-6.2-2.1-9.5-2.1-3.4 0-8.3 1.3-11 3-2.9-2.2-7.1-3-11-3-2.9 0-6.8.9-9.5 2.2-.2 0-.3.1-.5.1-.5 0-1-.5-1-1V10c2.9-2.2 7.1-3 11-3 3.9 0 8.1.8 11 3 2.9-2.2 7.1-3 11-3 2.34 0 4.79.3 7 1zm0 27V12c-2.2-.7-4.6-1-7-1-3.4 0-8.3 1.3-11 3v23c2.7-1.7 7.6-3 11-3 2.4 0 4.8.3 7 1z" />
</IconBase>
);
}
export default MdImportContacts;
|
actor-apps/app-web/src/app/components/SidebarSection.react.js | hmoraes/actor-platform | import React from 'react';
//import { Styles, Tabs, Tab } from 'material-ui';
//import ActorTheme from 'constants/ActorTheme';
import HeaderSection from 'components/sidebar/HeaderSection.react';
import RecentSection from 'components/sidebar/RecentSection.react';
//import ContactsSection from 'components/sidebar/ContactsSection.react';
//const ThemeManager = new Styles.ThemeManager();
class SidebarSection extends React.Component {
//static childContextTypes = {
// muiTheme: React.PropTypes.object
//};
//
//getChildContext() {
// return {
// muiTheme: ThemeManager.getCurrentTheme()
// };
//}
constructor(props) {
super(props);
//ThemeManager.setTheme(ActorTheme);
}
render() {
return (
<aside className="sidebar">
<HeaderSection/>
<RecentSection/>
{/*
<Tabs className="sidebar__tabs"
contentContainerClassName="sidebar__tabs__tab-content"
tabItemContainerClassName="sidebar__tabs__tab-items">
<Tab label="Recent">
<RecentSection/>
</Tab>
<Tab label="Contacts">
<ContactsSection/>
</Tab>
</Tabs>
*/}
</aside>
);
}
}
export default SidebarSection;
|
NavigationReactMobile/sample/isomorphic/server.js | grahammendick/navigation | import express from 'express';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import { NavigationHandler } from 'navigation-react';
import { NavigationMotion } from 'navigation-react-mobile';
import getStateNavigator from './getStateNavigator';
import Isomorphic from './Isomorphic';
var app = express();
app.use(express.static('js'))
app.get('/favicon.ico', function(req, res) {
res.statusCode = 404;
res.end();
});
app.get('*', function(req, res) {
var stateNavigator = getStateNavigator();
var { state, data } = stateNavigator.parseLink(req.url);
var url = stateNavigator.fluent()
.navigate('people')
.navigate(state.key, data).url;
stateNavigator.start(url);
res.send(`<html>
<head>
<title>Isomorphic Navigation Mobile</title>
<style>
table{border-collapse:collapse;}
table,td,th{border:1px #000 solid;}
.label{margin-left:50px;width:100px;float:left;}
body{overflow: hidden;}
.scene{position:fixed;left:0;right:0;top:0;bottom:0;overflow:auto;padding:10px;}
</style>
</head>
<body>
<div id="content">${ReactDOMServer.renderToString(
<NavigationHandler stateNavigator={stateNavigator}>
<Isomorphic />
</NavigationHandler>
)}</div>
<script src="/app.js" ></script>
</body>
</html>`);
});
app.listen(8080);
|
lib/index.js | gavindoughtie/multi-vendor-bundles | import React from 'react';
import ReactDOM from 'react-dom';
export default function entry() {
const reactRoot = document.createElement('div');
reactRoot.id = 'my-react-root';
document.body.appendChild(reactRoot);
ReactDOM.render(<h1>Loaded All Modules</h1>, reactRoot);
}
entry();
|
src/components/ThemeMenu.js | grommet/grommet-docs | // (C) Copyright 2014-2017 Hewlett Packard Enterprise Development LP
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Anchor from 'grommet/components/Anchor';
import Layer from 'grommet/components/Layer';
import Box from 'grommet/components/Box';
import Menu from 'grommet/components/Menu';
const THEMES = ['grommet', 'aruba', 'dxc', 'hpe', 'hpinc'];
export default class ThemeMenu extends Component {
constructor () {
super();
this._getThemeUrl = this._getThemeUrl.bind(this);
this._onOpen = this._onOpen.bind(this);
this._onClose = this._onClose.bind(this);
this.state = { theme: 'grommet', active: false };
}
componentDidMount () {
let theme = window.location.pathname.split('/')[1];
if (THEMES.indexOf(theme) === -1) {
theme = 'grommet';
}
const themeUrls = {};
THEMES.forEach((currentTheme) => {
themeUrls[currentTheme] = this._getThemeUrl(currentTheme);
});
const location = window.location.pathname;
this.setState({ theme, themeUrls, location });
}
componentDidUpdate() {
const location = window.location.pathname;
if (location !== this.state.location) {
const themeUrls = {};
THEMES.forEach((currentTheme) => {
themeUrls[currentTheme] = this._getThemeUrl(currentTheme);
});
this.setState({ location, themeUrls });
}
}
_getThemeUrl (theme) {
let prefix;
if ('grommet' === theme) {
prefix = '';
} else {
prefix = `/${theme}`;
}
let currentTheme = window.location.pathname.split('/')[1];
let path;
if (THEMES.indexOf(currentTheme) !== -1) {
path = window.location.pathname.slice(currentTheme.length + 1);
currentTheme = undefined;
} else {
path = window.location.pathname;
}
return `${prefix}${path}`;
}
_onOpen (event) {
event.preventDefault();
this.setState({ active: true });
}
_onClose () {
this.setState({ active: false });
}
render () {
const { align } = this.props;
const { active } = this.state;
let layer = <span />;
if (active) {
const links = THEMES.map(theme => (
<Anchor key={theme} href={this.state.themeUrls[theme]}>
{theme}
</Anchor>
), this);
layer = (
<Layer onClose={this._onClose} closer={true} align={align}>
<Box pad="medium" justify="end" full="vertical">
<Menu label="Theme" inline={true} direction="column">
{links}
</Menu>
</Box>
</Layer>
);
}
return (
<div>
<Anchor href="#" onClick={this._onOpen}>Theme</Anchor>
{layer}
</div>
);
}
};
ThemeMenu.propTypes = {
align: PropTypes.oneOf(['left', 'right'])
};
|
src/components/Roster/Roster.js | footballhackday/hackday-example | 'use strict';
import React, { Component } from 'react';
import Panel from 'react-bootstrap/lib/Panel';
import Player from './Player';
class Roster extends Component {
constructor(props) {
super(props);
this.state = { roster: null };
}
render() {
if(!this.state.roster) {
return null;
}
var roster = this.state.roster,
team = roster.team,
players = roster.players,
manager = roster.manager;
return (
<Panel header={team.name}>
<p>Manager: {manager.first_name} {manager.last_name}</p>
<ul>
{players.map( player => <Player key={player.id} player={player} /> )}
</ul>
</Panel>
);
}
}
export default Roster;
|
src/native/app/App.js | chad099/react-native-boilerplate | // @flow
import type { State } from '../../common/types';
import * as themes from '../themes';
import Menu from './Menu';
import Page from './Page';
import React from 'react';
import SideMenu from 'react-native-side-menu';
import common from '../../common/app/common';
import { Baseline } from '../components';
import { Box } from '../../common/components';
import { Match, Redirect } from 'react-router';
import { Platform, StatusBar } from 'react-native';
import { appShowMenu } from '../../common/app/actions';
import { compose } from 'ramda';
import { connect } from 'react-redux';
// Pages
import HomePage from '../home/HomePage';
import IntlPage from '../intl/IntlPage';
import MePage from '../me/MePage';
import OfflinePage from '../offline/OfflinePage';
import SignInPage from '../auth/SignInPage';
import TodosPage from '../todos/TodosPage';
import Contact from '../contact/Contact';
type AppProps = {
appMenuShown: boolean,
appShowMenu: typeof appShowMenu,
appStarted: boolean,
};
const App = (
{
appMenuShown,
appShowMenu,
appStarted,
}: AppProps,
) => {
// TODO: Add splash screen.
if (!appStarted) return null;
return (
<Box flex={1}>
{Platform.OS === 'ios' &&
<StatusBar
hidden={
appMenuShown // Because iOS StatusBar is an overlay.
}
/>}
<SideMenu isOpen={appMenuShown} menu={<Menu />} onChange={appShowMenu}>
<Page exactly pattern="/" component={HomePage} />
<Page pattern="/intl" component={IntlPage} />
<Page pattern="/offline" component={OfflinePage} />
<Page pattern="/todos" component={TodosPage} />
<Page pattern="/signin" component={SignInPage} />
<Page pattern="/contact" component={Contact} />
<Page authorized pattern="/me" component={MePage} />
<Match
pattern="/"
render={({ location: { pathname } }) => {
const urls = ['/', '/intl', '/offline', '/signin', '/contact', '/todos', '/me'];
if (urls.indexOf(pathname) !== -1) return null;
return <Redirect to="/" />;
}}
/>
</SideMenu>
<Baseline />
</Box>
);
};
export default compose(
common({ themes }),
connect(
(state: State) => ({
appMenuShown: state.app.menuShown,
appStarted: state.app.started,
}),
{ appShowMenu },
),
)(App);
|
Libraries/Components/Keyboard/Keyboard.js | naoufal/react-native | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Keyboard
* @flow
*/
'use strict';
const NativeEventEmitter = require('NativeEventEmitter');
const KeyboardObserver = require('NativeModules').KeyboardObserver;
const dismissKeyboard = require('dismissKeyboard');
const KeyboardEventEmitter = new NativeEventEmitter(KeyboardObserver);
// The following object exists for documentation purposes
// Actual work happens in
// https://github.com/facebook/react-native/blob/master/Libraries/EventEmitter/NativeEventEmitter.js
/**
* `Keyboard` component to control keyboard events.
*
* ### Usage
*
* The Keyboard component allows you to listen for native events and react to them, as
* well as make changes to the keyboard, like dismissing it.
*
*```
* import React, { Component } from 'react';
* import { Keyboard, TextInput } from 'react-native';
*
* class Example extends Component {
* componentWillMount () {
* this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
* this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
* }
*
* componentWillUnmount () {
* this.keyboardDidShowListener.remove();
* this.keyboardDidHideListener.remove();
* }
*
* _keyboardDidShow () {
* alert('Keyboard Shown');
* }
*
* _keyboardDidHide () {
* alert('Keyboard Hidden');
* }
*
* render() {
* return (
* <TextInput
* onSubmitEditing={Keyboard.dismiss}
* />
* );
* }
* }
*```
*/
module.exports = {
/**
* The `addListener` function connects a JavaScript function to an identified native
* keyboard notification event.
*
* This function then returns the reference to the listener.
*
* @param {string} nativeEvent The `nativeEvent` is the string that identifies the event you're listening for. This
*can be any of the following:
* - `keyboardWillShow`
* - `keyboardDidShow`
* - `keyboardWillHide`
* - `keyboardDidHide`
* - `keyboardWillChangeFrame`
* - `keyboardDidChangeFrame`
*
* @param {function} jsFunction function to be called when the event fires.
*/
addListener (nativeEvent: string, jsFunction: Function) {
return KeyboardEventEmitter.addListener(nativeEvent, jsFunction);
},
/**
* Removes all listeners for a specific event type.
*
* @param {string} eventType The native event string listeners are watching which will be removed.
*/
removeAllListeners (eventType: string) {
KeyboardEventEmitter.removeAllListeners(eventType);
},
/**
* Removes a specific subscription.
*
* @param {EmitterSubscription} subscription The subscription emitter to be removed.
*/
removeSubscription (subscription: Object) {
KeyboardEventEmitter.removeSubscription(subscription);
},
/**
* Dismisses the active keyboard and removes focus.
*/
dismiss () {
dismissKeyboard();
}
};
|
src/svg-icons/maps/edit-location.js | matthewoates/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsEditLocation = (props) => (
<SvgIcon {...props}>
<path d="M12 2C8.14 2 5 5.14 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.86-3.14-7-7-7zm-1.56 10H9v-1.44l3.35-3.34 1.43 1.43L10.44 12zm4.45-4.45l-.7.7-1.44-1.44.7-.7c.15-.15.39-.15.54 0l.9.9c.15.15.15.39 0 .54z"/>
</SvgIcon>
);
MapsEditLocation = pure(MapsEditLocation);
MapsEditLocation.displayName = 'MapsEditLocation';
MapsEditLocation.muiName = 'SvgIcon';
export default MapsEditLocation;
|
js/mutations/AddPlaylistMutation.js | ChrisMLee/relay-mongoose-plair | import Relay from 'react-relay';
import React from 'react';
export default class AddPlaylistMutation extends Relay.Mutation {
// static fragments = {
// user: () => Relay.QL`
// fragment on User {
// id
// }
// `
// };
getMutation () {
return Relay.QL`mutation { addPlaylist }`;
}
getVariables () {
return {
id: this.props.id,
title: this.props.title
}
}
getFatQuery () {
return Relay.QL`
fragment on CreatePlaylistPayload {
playlistEdge,
user {
playlists
}
}
`
}
getConfigs () {
return [{
type: 'FIELDS_CHANGE',
fieldIDs: {
user: this.props.id,
},
},
{
type: 'RANGE_ADD',
parentName: 'user',
parentID: this.props.id,
connectionName: 'playlists',
edgeName: 'playlistEdge',
rangeBehaviors: {
'': 'append',
},
}];
}
// getOptimisticResponse() {
// return {
// playlist: {
// id: this.props.id
// },
// }
// }
} |
src/routes/home/index.js | luanlv/comhoavang | import React from 'react';
import Home from './Home';
import fetch from '../../core/fetch';
import needFetch from '../../core/needFetch';
import Layout from '../../components/Layout';
import { setData } from '../../actions/data';
import { showLoading, hideLoading } from 'react-redux-loading-bar'
export default {
path: '/',
async action({ store, path }) {
// process.env.BROWSER
let seo = {}
if(!process.env.BROWSER || !store.getState().setting.ssr || (process.env.BROWSER && needFetch())) {
store.dispatch(showLoading())
const resp = await fetch('/graphql', {
method: 'post',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: '{seo(url: "'+ path +'"){url,title,description,og_title,og_image,og_description},getProducts{name, slug, price, coverUrl, description, saleOff, body, created_at}, getNews(page: 1 ){page,totalPage,data{title, slug, coverUrl, description}}, getFoodNews(page: 1 ){page,totalPage,data{title, slug, coverUrl, description}} }',
}),
credentials: 'include',
});
const {data} = await resp.json();
seo = data.seo || {}
if (!data) throw new Error('Failed to load the news feed.');
store.dispatch(setData(data))
store.dispatch(hideLoading())
}
return {
title: seo.title || 'Trang chủ',
description: seo.description || '',
seo: seo,
component: <Layout><Home data={store.getState().data} /></Layout>,
};
},
};
|
packages/ringcentral-widgets/components/SpinnerOverlay/index.js | u9520107/ringcentral-js-widget | import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import Spinner from '../Spinner';
import styles from './styles.scss';
export default function SpinnerOverlay({
className,
}) {
return (
<div className={classnames(styles.root, className)} >
<div className={styles.mask} />
<div className={styles.container} >
<Spinner />
</div>
</div>
);
}
SpinnerOverlay.propTypes = {
className: PropTypes.string,
};
SpinnerOverlay.defaultProps = {
className: undefined,
};
|
src/components/Body.js | Diane27/big-red-hacks-2017 | import React, { Component } from 'react';
export default class Body extends Component {
render() {
return (
<div className="body">
<p>We Are trip.edu</p>
</div>
);
}
}
|
src/components/Root.js | tolylya/octoberry | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Provider } from 'react-redux';
import routes from '../routes.tsx';
import { Router } from 'react-router';
export default class Root extends Component {
render() {
const { store, history } = this.props;
return (
<Provider store={store}>
<Router history={history} routes={routes} />
</Provider>
);
}
}
Root.propTypes = {
store: PropTypes.object.isRequired,
history: PropTypes.object.isRequired
};
|
src/desktop-index.js | ericyd/surfplotjs | /**
* This is used for the Electron build.
* The menu bar handles all other views,
* so we only need to mount the plotter.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import Plotter from './views/Plotter';
import './index.scss';
if (typeof window !== undefined) {
ReactDOM.render(
<Plotter />,
document.getElementById('root')
);
}
|
frontend/src/components/loader/loader.js | reabreu/discount-ascii-warehouse | import React from 'react';
import SpinningLoader from './loader_style';
export default function () {
return (
<SpinningLoader className="loader">Loading...</SpinningLoader>
);
}
|
templates/rubix/node-seed/server.babel.js | jeffthemaximum/jeffline | import path from 'path';
import express from 'express';
import compression from 'compression';
import cookieParser from 'cookie-parser';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import routes from './src/routes';
import { renderHTMLString } from '@sketchpixy/rubix/lib/node/router';
import RubixAssetMiddleware from '@sketchpixy/rubix/lib/node/RubixAssetMiddleware';
const port = process.env.PORT || 8080;
let app = express();
app.use(compression());
app.use(cookieParser());
app.use(express.static(path.join(process.cwd(), 'public')));
app.set('views', path.join(process.cwd(), 'views'));
app.set('view engine', 'pug');
function renderHTML(req, res) {
renderHTMLString(routes, req, (error, redirectLocation, html) => {
if (error) {
if (error.message === 'Not found') {
res.status(404).send(error.message);
} else {
res.status(500).send(error.message);
}
} else if (redirectLocation) {
res.redirect(302, redirectLocation.pathname + redirectLocation.search);
} else {
res.render('index', {
content: html
});
}
});
}
app.get('*', RubixAssetMiddleware('ltr'), (req, res, next) => {
renderHTML(req, res);
});
app.listen(port, () => {
console.log(`Node.js app is running at http://localhost:${port}/`);
});
|
src/view/components/pages/NotFoundPage.js | Danny-Robinson/bt-bingo | /**
* Created by 611218504 on 07/06/2017.
*/
import React from 'react';
const NotFoundPage = () =>
<div className="notFound">
<h3><font color="white">404 page not found</font></h3>
<p><font color="white">These aren't the pages you were looking for...</font></p>
<img src="data:image/jpeg;base64,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"/>
</div>
//<p>We are sorry but the page you are looking for does not exist.</p>
export default NotFoundPage; |
Neos.Media.Browser/packages/neos-media-browser/src/Variants/Original.js | kdambekalns/neos-development-collection | import React from 'react';
export default class Original extends React.PureComponent {
render() {
const {persistenceIdentifier, previewUri, width, height} = this.props;
return (
<ul className="neos-thumbnails">
<li className="asset" data-asset-identifier={persistenceIdentifier}
data-local-asset-identifier={persistenceIdentifier}>
<a>
<div className="neos-img-container">
<img src={previewUri} className="" alt=""/>
</div>
</a>
<div className="neos-img-label">
<span className="neos-caption asset-label">
<span className="neos-badge neos-pull-right">
<pre>W: {width}px <br/>H: {height}px</pre>
</span>
</span>
</div>
</li>
</ul>
);
}
}
|
website/core/SnackPlayer.js | doochik/react-native | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SnackPlayer
*/
'use strict';
var Prism = require('Prism');
var React = require('React');
const PropTypes = require('prop-types');
const LatestSDKVersion = '16.0.0';
var ReactNativeToExpoSDKVersionMap = {
'0.44': '17.0.0',
'0.43': '16.0.0',
'0.42': '15.0.0',
'0.41': '14.0.0',
};
/**
* Use the SnackPlayer by including a ```SnackPlayer``` block in markdown.
*
* Optionally, include url parameters directly after the block's language.
* Valid options are name, description, and platform.
*
* E.g.
* ```SnackPlayer?platform=android&name=Hello%20world!
* import React from 'react';
* import { Text } from 'react-native';
*
* export default class App extends React.Component {
* render() {
* return <Text>Hello World!</Text>;
* }
* }
* ```
*/
var SnackPlayer = React.createClass({
contextTypes: {
version: PropTypes.number.isRequired,
},
componentDidMount() {
window.ExpoSnack && window.ExpoSnack.initialize();
},
render() {
var code = encodeURIComponent(this.props.children);
var params = this.parseParams(this.props.params);
var platform = params.platform
? params.platform
: 'ios';
var name = params.name
? decodeURIComponent(params.name)
: 'Example';
var description = params.description
? decodeURIComponent(params.description)
: 'Example usage';
var optionalProps = {};
var { version } = this.context;
if (version === 'next') {
optionalProps[
'data-snack-sdk-version'
] = LatestSDKVersion;
} else {
optionalProps[
'data-snack-sdk-version'
] = ReactNativeToExpoSDKVersionMap[version] ||
LatestSDKVersion;
}
return (
<div className="snack-player">
<div
className="mobile-friendly-snack"
style={{ display: 'none' }}
>
<Prism>
{this.props.children}
</Prism>
</div>
<div
className="desktop-friendly-snack"
style={{ marginTop: 15, marginBottom: 15 }}
>
<div
data-snack-name={name}
data-snack-description={description}
data-snack-code={code}
data-snack-platform={platform}
data-snack-preview="true"
{...optionalProps}
style={{
overflow: 'hidden',
background: '#fafafa',
border: '1px solid rgba(0,0,0,.16)',
borderRadius: '4px',
height: '514px',
width: '880px',
}}
/>
</div>
</div>
);
},
parseParams: function(paramString) {
var params = {};
if (paramString) {
var pairs = paramString.split('&');
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split('=');
params[pair[0]] = pair[1];
}
}
return params;
},
});
module.exports = SnackPlayer;
|
src/PopupContainer.js | ericsoco/react-leaflet | import React from 'react';
import MapLayer from './MapLayer';
export default class PopupContainer extends MapLayer {
render() {
const children = this.getClonedChildrenWithMap({
popupContainer: this.leafletElement,
});
return <div style={{display: 'none'}}>{children}</div>;
}
}
|
antd-dva/dva-restart/src/components/AddTodo.js | JianmingXia/StudyTest | import React, { Component } from 'react';
import { Form, Input, Button } from 'antd';
const FormItem = Form.Item;
// const AddTodo = ({ onAdd }) => {
// const { getFieldDecorator } = this.props.form;
// function onSubmit() {
// console.log(this);
// }
// return (
// <div>
// <Form layout="inline" onSubmit={() => onSubmit()}>
// <FormItem>
// {getFieldDecorator('userName')(
// <Input size="large" placeholder="请输入任务名称" />
// )}
// </FormItem>
// <FormItem>
// <Button size="large" type="primary" htmlType="submit">添加</Button>
// </FormItem>
// </Form>
// </div>
// );
// };
class AddTodo extends Component {
handleSubmit(e) {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
this.props.onAdd(values);
this.props.form.setFieldsValue({ task_name: "" });
}
});
}
render() {
const { getFieldDecorator } = this.props.form;
return (
<div>
<Form layout="inline" onSubmit={this.handleSubmit.bind(this)}>
<FormItem>
{/* <Input size="large" placeholder="请输入任务名称" /> */}
{getFieldDecorator('task_name', {
rules: [{ required: true, message: '请输入任务名' }],
})(
<Input size="large" placeholder="请输入任务名称" />
)
}
</FormItem>
<FormItem>
<Button size="large" type="primary" htmlType="submit">添加</Button>
</FormItem>
</Form>
</div>
)
}
}
const NormalAddTodo = Form.create()(AddTodo);
export default NormalAddTodo; |
src/navbar/navbar.app.js | joeldenning/single-spa-examples | import React from 'react';
import ReactDOM from 'react-dom';
import singleSpaReact from 'single-spa-react';
import navbar from './navbar.component.js';
/* The navbar app is an app that is always active and is responsible for showing the top navbar.
* It is written in React and does not even use a router like react-router since it doesn't really
* care about what the url is -- it just shows the menu items regardless. If we wanted to have an active
* state for the menu item that is active, then we would need to either add in a hashchange listener or
* a router like react-router.
*
* This app runs concurrently with any and all apps that are also active. It resides in its own <div>
* and renders its content fixed to the page.
*
* This app is intended to show how simple a single-spa application can be.
*/
const reactLifecyles = singleSpaReact({
React,
ReactDOM,
domElementGetter,
rootComponent: navbar,
});
export const bootstrap = [
reactLifecyles.bootstrap,
];
export const mount = [
reactLifecyles.mount,
];
export const unmount = [
reactLifecyles.unmount,
];
function domElementGetter() {
return document.getElementById("navbar");
}
|
wrappers/toml.js | Cspeisman/cspeisman.github.io | import React from 'react'
import toml from 'toml-js'
import DocumentTitle from 'react-document-title'
import { config } from 'config'
module.exports = React.createClass({
propTypes () {
return {
route: React.PropTypes.object,
}
},
render () {
const data = this.props.route.page.data
return (
<DocumentTitle title={`${config.siteTitle} | ${data.title}`}>
<div>
<h1>{data.title}</h1>
<p>Raw view of toml file</p>
<pre dangerouslySetInnerHTML={{ __html: toml.dump(data) }} />
</div>
</DocumentTitle>
)
},
})
|
src/components/controls/stateless/AuctionListItemControl.js | mm-taigarevolution/tas_web_app | import React from 'react';
import PropTypes from 'prop-types';
import {Media, Container, Row, Col, Badge } from 'reactstrap';
import TimeRemainingControl from './TimeRemainingControl';
import WithTapAnimated from '../stateful/TapAnimator';
const containerStyle = {
margin: '15px 0px',
padding: '10px',
border: '1px dotted gray',
borderRadius: '5px',
boxShadow: '3px 2px 2px lightgray'
};
const titleStyle = {
fontWeight: 'bold',
fontSize: '20px',
color: 'gray',
margin: '0px',
padding: '0px'
};
const captionStyle = {
margin: '4px 0px 0px 0px',
fontWeight: 'normal',
fontSize: '14px',
color: 'gray'
};
const imgStyle = {
width: '120px',
height: '120px'
};
const bodyStyle = {
padding: '0px 15px'
};
const smallTitleStyle = {
fontSize: '14px',
color: 'gray',
margin: '0px',
padding: '0px'
};
const remarkStyle = {
fontSize: '18px',
fontWeight: 'bold',
color: 'gray',
margin: '4px 0px 0px 0px',
padding: '0px'
};
const timeRemainingEndingStyle = {
fontSize: '18px',
fontWeight: 'bold',
color: 'red',
margin: '4px 0px 0px 0px',
padding: '0px'
};
const placeholderStyle = {
height: '34px'
};
const AuctionListItemControl = ({auctionItem, onDetailsRequired}) => {
let numberOfBids = auctionItem.bids.length;
let currentPrice = auctionItem.currentPrice;
let auctionItemImg = auctionItem.imageUrls.length > 0 ? auctionItem.imageUrls[0] : null;
return (
<div style={containerStyle}>
<Media id="auctionListItemCard"
onClick={() => onDetailsRequired(auctionItem)}>
<Media left>
<Media object style={imgStyle} src={auctionItemImg} alt="image" />
</Media>
<Media right body>
<Container>
<Row>
<Col className="text-left" xs="auto">
<p style={titleStyle}>{auctionItem.title}</p>
<p style={captionStyle}>{auctionItem.itemLocation}</p>
</Col>
<Col className="text-right">
{!auctionItem.active &&
<Badge color="secondary">Closed</Badge>
}
{auctionItem.new &&
<Badge color="success">New</Badge>
}
{!auctionItem.new &&
auctionItem.active &&
auctionItem.recentlyUpdated &&
<Badge color="info">Updated 24H</Badge>
}
</Col>
</Row>
<Row style={placeholderStyle}>
</Row>
<Row>
<Col sm="6" className="text-left">
{auctionItem.active &&
<div>
{numberOfBids > 0 &&
<p style={smallTitleStyle}>{numberOfBids} bids</p>
}
{numberOfBids == 0 &&
<p style={smallTitleStyle}>Start price</p>
}
</div>
}
{!auctionItem.active &&
<p style={smallTitleStyle}>Final price</p>
}
<p style={remarkStyle}>{currentPrice} €</p>
</Col>
<Col className="text-right">
{auctionItem.active &&
<div>
<p style={smallTitleStyle}>Time remaining</p>
<TimeRemainingControl days={auctionItem.bid_time_remaining_days}
hours={auctionItem.bid_time_remaining_hours}
minutes={auctionItem.bid_time_remaining_minutes}
seconds={auctionItem.bid_time_remaining_seconds}
active={auctionItem.active}
activeStyle={remarkStyle}
endingStyle={timeRemainingEndingStyle}/>
</div>
}
</Col>
</Row>
</Container>
</Media>
</Media>
</div>
);
};
AuctionListItemControl.propTypes = {
auctionItem: PropTypes.object.isRequired,
onDetailsRequired: PropTypes.func.isRequired
};
export default WithTapAnimated(AuctionListItemControl);
|
blueocean-material-icons/src/js/components/svg-icons/places/beach-access.js | jenkinsci/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const PlacesBeachAccess = (props) => (
<SvgIcon {...props}>
<path d="M13.127 14.56l1.43-1.43 6.44 6.443L19.57 21zm4.293-5.73l2.86-2.86c-3.95-3.95-10.35-3.96-14.3-.02 3.93-1.3 8.31-.25 11.44 2.88zM5.95 5.98c-3.94 3.95-3.93 10.35.02 14.3l2.86-2.86C5.7 14.29 4.65 9.91 5.95 5.98zm.02-.02l-.01.01c-.38 3.01 1.17 6.88 4.3 10.02l5.73-5.73c-3.13-3.13-7.01-4.68-10.02-4.3z"/>
</SvgIcon>
);
PlacesBeachAccess.displayName = 'PlacesBeachAccess';
PlacesBeachAccess.muiName = 'SvgIcon';
export default PlacesBeachAccess;
|
node_modules/recompose/build/Recompose.js | ClaaziX/foodshare | (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["Recompose"] = factory(require("react"));
else
root["Recompose"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_3__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(29);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var createHelper = function createHelper(func, helperName) {
var setDisplayName = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];
var noArgs = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
if (false) {
var _ret = function () {
/* eslint-disable global-require */
var wrapDisplayName = require('./wrapDisplayName').default;
/* eslint-enable global-require */
if (noArgs) {
return {
v: function v(BaseComponent) {
var Component = func(BaseComponent);
Component.displayName = wrapDisplayName(BaseComponent, helperName);
return Component;
}
};
}
return {
v: function v() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length > func.length) {
/* eslint-disable */
console.error(
/* eslint-enable */
'Too many arguments passed to ' + helperName + '(). It should called ' + ('like so: ' + helperName + '(...args)(BaseComponent).'));
}
return function (BaseComponent) {
var Component = func.apply(undefined, args)(BaseComponent);
Component.displayName = wrapDisplayName(BaseComponent, helperName);
return Component;
};
}
};
}();
if (typeof _ret === "object") return _ret.v;
}
return func;
};
exports.default = createHelper;
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createEagerElementUtil = __webpack_require__(18);
var _createEagerElementUtil2 = _interopRequireDefault(_createEagerElementUtil);
var _isReferentiallyTransparentFunctionComponent = __webpack_require__(16);
var _isReferentiallyTransparentFunctionComponent2 = _interopRequireDefault(_isReferentiallyTransparentFunctionComponent);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var createFactory = function createFactory(type) {
var isReferentiallyTransparent = (0, _isReferentiallyTransparentFunctionComponent2.default)(type);
return function (p, c) {
return (0, _createEagerElementUtil2.default)(false, isReferentiallyTransparent, type, p, c);
};
};
exports.default = createFactory;
/***/ },
/* 3 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var mapProps = function mapProps(propsMapper) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
return function (props) {
return factory(propsMapper(props));
};
};
};
exports.default = (0, _createHelper2.default)(mapProps, 'mapProps');
/***/ },
/* 5 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var _config = {
fromESObservable: null,
toESObservable: null
};
var configureObservable = function configureObservable(c) {
_config = c;
};
var config = exports.config = {
fromESObservable: function fromESObservable(observable) {
return typeof _config.fromESObservable === 'function' ? _config.fromESObservable(observable) : observable;
},
toESObservable: function toESObservable(stream) {
return typeof _config.toESObservable === 'function' ? _config.toESObservable(stream) : stream;
}
};
exports.default = configureObservable;
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _shallowEqual = __webpack_require__(49);
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _shallowEqual2.default;
/***/ },
/* 7 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var getDisplayName = function getDisplayName(Component) {
if (typeof Component === 'string') {
return Component;
}
if (!Component) {
return undefined;
}
return Component.displayName || Component.name || 'Component';
};
exports.default = getDisplayName;
/***/ },
/* 8 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var isClassComponent = function isClassComponent(Component) {
return Boolean(Component && Component.prototype && typeof Component.prototype.isReactComponent === 'object');
};
exports.default = isClassComponent;
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var setStatic = function setStatic(key, value) {
return function (BaseComponent) {
/* eslint-disable no-param-reassign */
BaseComponent[key] = value;
/* eslint-enable no-param-reassign */
return BaseComponent;
};
};
exports.default = (0, _createHelper2.default)(setStatic, 'setStatic', false);
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(3);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var shouldUpdate = function shouldUpdate(test) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
return function (_Component) {
_inherits(_class, _Component);
function _class() {
_classCallCheck(this, _class);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
_class.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return test(this.props, nextProps);
};
_class.prototype.render = function render() {
return factory(this.props);
};
return _class;
}(_react.Component);
};
};
exports.default = (0, _createHelper2.default)(shouldUpdate, 'shouldUpdate');
/***/ },
/* 11 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var omit = function omit(obj, keys) {
var rest = _objectWithoutProperties(obj, []);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (rest.hasOwnProperty(key)) {
delete rest[key];
}
}
return rest;
};
exports.default = omit;
/***/ },
/* 12 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
var pick = function pick(obj, keys) {
var result = {};
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (obj.hasOwnProperty(key)) {
result[key] = obj[key];
}
}
return result;
};
exports.default = pick;
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/* global window */
'use strict';
module.exports = __webpack_require__(51)(global || window || this);
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.componentFromStreamWithConfig = undefined;
var _react = __webpack_require__(3);
var _changeEmitter = __webpack_require__(19);
var _symbolObservable = __webpack_require__(13);
var _symbolObservable2 = _interopRequireDefault(_symbolObservable);
var _setObservableConfig = __webpack_require__(5);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var componentFromStreamWithConfig = exports.componentFromStreamWithConfig = function componentFromStreamWithConfig(config) {
return function (propsToVdom) {
return function (_Component) {
_inherits(ComponentFromStream, _Component);
function ComponentFromStream() {
var _config$fromESObserva;
var _temp, _this, _ret;
_classCallCheck(this, ComponentFromStream);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { vdom: null }, _this.propsEmitter = (0, _changeEmitter.createChangeEmitter)(), _this.props$ = config.fromESObservable((_config$fromESObserva = {
subscribe: function subscribe(observer) {
var unsubscribe = _this.propsEmitter.listen(function (props) {
return observer.next(props);
});
return { unsubscribe: unsubscribe };
}
}, _config$fromESObserva[_symbolObservable2.default] = function () {
return this;
}, _config$fromESObserva)), _this.vdom$ = config.toESObservable(propsToVdom(_this.props$)), _temp), _possibleConstructorReturn(_this, _ret);
}
// Stream of props
// Stream of vdom
ComponentFromStream.prototype.componentWillMount = function componentWillMount() {
var _this2 = this;
// Subscribe to child prop changes so we know when to re-render
this.subscription = this.vdom$.subscribe({
next: function next(vdom) {
_this2.setState({ vdom: vdom });
}
});
this.propsEmitter.emit(this.props);
};
ComponentFromStream.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
// Receive new props from the owner
this.propsEmitter.emit(nextProps);
};
ComponentFromStream.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
return nextState.vdom !== this.state.vdom;
};
ComponentFromStream.prototype.componentWillUnmount = function componentWillUnmount() {
// Clean-up subscription before un-mounting
this.subscription.unsubscribe();
};
ComponentFromStream.prototype.render = function render() {
return this.state.vdom;
};
return ComponentFromStream;
}(_react.Component);
};
};
var componentFromStream = componentFromStreamWithConfig(_setObservableConfig.config);
exports.default = componentFromStream;
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createEagerElementUtil = __webpack_require__(18);
var _createEagerElementUtil2 = _interopRequireDefault(_createEagerElementUtil);
var _isReferentiallyTransparentFunctionComponent = __webpack_require__(16);
var _isReferentiallyTransparentFunctionComponent2 = _interopRequireDefault(_isReferentiallyTransparentFunctionComponent);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var createEagerElement = function createEagerElement(type, props, children) {
var isReferentiallyTransparent = (0, _isReferentiallyTransparentFunctionComponent2.default)(type);
/* eslint-disable */
var hasKey = props && props.hasOwnProperty('key');
/* eslint-enable */
return (0, _createEagerElementUtil2.default)(hasKey, isReferentiallyTransparent, type, props, children);
};
exports.default = createEagerElement;
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _isClassComponent = __webpack_require__(8);
var _isClassComponent2 = _interopRequireDefault(_isClassComponent);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var isReferentiallyTransparentFunctionComponent = function isReferentiallyTransparentFunctionComponent(Component) {
return Boolean(typeof Component === 'function' && !(0, _isClassComponent2.default)(Component) && !Component.defaultProps && !Component.contextTypes && !Component.propTypes);
};
exports.default = isReferentiallyTransparentFunctionComponent;
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _shouldUpdate = __webpack_require__(10);
var _shouldUpdate2 = _interopRequireDefault(_shouldUpdate);
var _shallowEqual = __webpack_require__(6);
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _pick = __webpack_require__(12);
var _pick2 = _interopRequireDefault(_pick);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var onlyUpdateForKeys = function onlyUpdateForKeys(propKeys) {
return (0, _shouldUpdate2.default)(function (props, nextProps) {
return !(0, _shallowEqual2.default)((0, _pick2.default)(nextProps, propKeys), (0, _pick2.default)(props, propKeys));
});
};
exports.default = (0, _createHelper2.default)(onlyUpdateForKeys, 'onlyUpdateForKeys');
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(3);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var createEagerElementUtil = function createEagerElementUtil(hasKey, isReferentiallyTransparent, type, props, children) {
if (!hasKey && isReferentiallyTransparent) {
if (children) {
return type(_extends({}, props, { children: children }));
}
return type(props);
}
var Component = type;
if (children) {
return _react2.default.createElement(
Component,
props,
children
);
}
return _react2.default.createElement(Component, props);
};
exports.default = createEagerElementUtil;
/***/ },
/* 19 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var createChangeEmitter = exports.createChangeEmitter = function createChangeEmitter() {
var currentListeners = [];
var nextListeners = currentListeners;
function ensureCanMutateNextListeners() {
if (nextListeners === currentListeners) {
nextListeners = currentListeners.slice();
}
}
function listen(listener) {
if (typeof listener !== 'function') {
throw new Error('Expected listener to be a function.');
}
var isSubscribed = true;
ensureCanMutateNextListeners();
nextListeners.push(listener);
return function () {
if (!isSubscribed) {
return;
}
isSubscribed = false;
ensureCanMutateNextListeners();
var index = nextListeners.indexOf(listener);
nextListeners.splice(index, 1);
};
}
function emit() {
currentListeners = nextListeners;
var listeners = currentListeners;
for (var i = 0; i < listeners.length; i++) {
listeners[i].apply(listeners, arguments);
}
}
return {
listen: listen,
emit: emit
};
};
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(3);
var _react2 = _interopRequireDefault(_react);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var branch = function branch(test, left, right) {
return function (BaseComponent) {
return function (_React$Component) {
_inherits(_class2, _React$Component);
function _class2(props, context) {
_classCallCheck(this, _class2);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
_this.LeftComponent = null;
_this.RightComponent = null;
_this.computeChildComponent(_this.props);
return _this;
}
_class2.prototype.computeChildComponent = function computeChildComponent(props) {
if (test(props)) {
this.leftFactory = this.leftFactory || (0, _createEagerFactory2.default)(left(BaseComponent));
this.factory = this.leftFactory;
} else {
this.rightFactory = this.rightFactory || (0, _createEagerFactory2.default)(right(BaseComponent));
this.factory = this.rightFactory;
}
};
_class2.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
this.computeChildComponent(nextProps);
};
_class2.prototype.render = function render() {
return this.factory(this.props);
};
return _class2;
}(_react2.default.Component);
};
};
exports.default = (0, _createHelper2.default)(branch, 'branch');
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _omit = __webpack_require__(11);
var _omit2 = _interopRequireDefault(_omit);
var _createEagerElement = __webpack_require__(15);
var _createEagerElement2 = _interopRequireDefault(_createEagerElement);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var componentFromProp = function componentFromProp(propName) {
var Component = function Component(props) {
return (0, _createEagerElement2.default)(props[propName], (0, _omit2.default)(props, [propName]));
};
Component.displayName = 'componentFromProp(' + propName + ')';
return Component;
};
exports.default = componentFromProp;
/***/ },
/* 22 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports.default = compose;
function compose() {
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
if (funcs.length === 0) {
return function (arg) {
return arg;
};
}
if (funcs.length === 1) {
return funcs[0];
}
var last = funcs[funcs.length - 1];
return function () {
var result = last.apply(undefined, arguments);
for (var i = funcs.length - 2; i >= 0; i--) {
var f = funcs[i];
result = f(result);
}
return result;
};
}
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.createEventHandlerWithConfig = undefined;
var _symbolObservable = __webpack_require__(13);
var _symbolObservable2 = _interopRequireDefault(_symbolObservable);
var _changeEmitter = __webpack_require__(19);
var _setObservableConfig = __webpack_require__(5);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var createEventHandlerWithConfig = exports.createEventHandlerWithConfig = function createEventHandlerWithConfig(config) {
return function () {
var _config$fromESObserva;
var emitter = (0, _changeEmitter.createChangeEmitter)();
var stream = config.fromESObservable((_config$fromESObserva = {
subscribe: function subscribe(observer) {
var unsubscribe = emitter.listen(function (value) {
return observer.next(value);
});
return { unsubscribe: unsubscribe };
}
}, _config$fromESObserva[_symbolObservable2.default] = function () {
return this;
}, _config$fromESObserva));
return {
handler: emitter.emit,
stream: stream
};
};
};
var createEventHandler = createEventHandlerWithConfig(_setObservableConfig.config);
exports.default = createEventHandler;
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(3);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var createSink = function createSink(callback) {
return function (_Component) {
_inherits(Sink, _Component);
function Sink() {
_classCallCheck(this, Sink);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
Sink.prototype.componentWillMount = function componentWillMount() {
callback(this.props);
};
Sink.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
callback(nextProps);
};
Sink.prototype.render = function render() {
return null;
};
return Sink;
}(_react.Component);
};
exports.default = createSink;
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var defaultProps = function defaultProps(props) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
var DefaultProps = function DefaultProps(ownerProps) {
return factory(ownerProps);
};
DefaultProps.defaultProps = props;
return DefaultProps;
};
};
exports.default = (0, _createHelper2.default)(defaultProps, 'defaultProps');
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var flattenProp = function flattenProp(propName) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
return function (props) {
return factory(_extends({}, props, props[propName]));
};
};
};
exports.default = (0, _createHelper2.default)(flattenProp, 'flattenProp');
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getContext = function getContext(contextTypes) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
var GetContext = function GetContext(ownerProps, context) {
return factory(_extends({}, ownerProps, context));
};
GetContext.contextTypes = contextTypes;
return GetContext;
};
};
exports.default = (0, _createHelper2.default)(getContext, 'getContext');
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _hoistNonReactStatics = __webpack_require__(50);
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var hoistStatics = function hoistStatics(higherOrderComponent) {
return function (BaseComponent) {
var NewComponent = higherOrderComponent(BaseComponent);
(0, _hoistNonReactStatics2.default)(NewComponent, BaseComponent);
return NewComponent;
};
};
exports.default = hoistStatics;
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.setObservableConfig = exports.createEventHandler = exports.mapPropsStream = exports.componentFromStream = exports.hoistStatics = exports.nest = exports.componentFromProp = exports.createSink = exports.createEagerFactory = exports.createEagerElement = exports.isClassComponent = exports.shallowEqual = exports.wrapDisplayName = exports.getDisplayName = exports.compose = exports.setDisplayName = exports.setPropTypes = exports.setStatic = exports.toClass = exports.lifecycle = exports.getContext = exports.withContext = exports.onlyUpdateForPropTypes = exports.onlyUpdateForKeys = exports.pure = exports.shouldUpdate = exports.renderNothing = exports.renderComponent = exports.branch = exports.withReducer = exports.withState = exports.flattenProp = exports.renameProps = exports.renameProp = exports.defaultProps = exports.withHandlers = exports.withPropsOnChange = exports.withProps = exports.mapProps = undefined;
var _mapProps2 = __webpack_require__(4);
var _mapProps3 = _interopRequireDefault(_mapProps2);
var _withProps2 = __webpack_require__(44);
var _withProps3 = _interopRequireDefault(_withProps2);
var _withPropsOnChange2 = __webpack_require__(45);
var _withPropsOnChange3 = _interopRequireDefault(_withPropsOnChange2);
var _withHandlers2 = __webpack_require__(43);
var _withHandlers3 = _interopRequireDefault(_withHandlers2);
var _defaultProps2 = __webpack_require__(25);
var _defaultProps3 = _interopRequireDefault(_defaultProps2);
var _renameProp2 = __webpack_require__(35);
var _renameProp3 = _interopRequireDefault(_renameProp2);
var _renameProps2 = __webpack_require__(36);
var _renameProps3 = _interopRequireDefault(_renameProps2);
var _flattenProp2 = __webpack_require__(26);
var _flattenProp3 = _interopRequireDefault(_flattenProp2);
var _withState2 = __webpack_require__(47);
var _withState3 = _interopRequireDefault(_withState2);
var _withReducer2 = __webpack_require__(46);
var _withReducer3 = _interopRequireDefault(_withReducer2);
var _branch2 = __webpack_require__(20);
var _branch3 = _interopRequireDefault(_branch2);
var _renderComponent2 = __webpack_require__(37);
var _renderComponent3 = _interopRequireDefault(_renderComponent2);
var _renderNothing2 = __webpack_require__(38);
var _renderNothing3 = _interopRequireDefault(_renderNothing2);
var _shouldUpdate2 = __webpack_require__(10);
var _shouldUpdate3 = _interopRequireDefault(_shouldUpdate2);
var _pure2 = __webpack_require__(34);
var _pure3 = _interopRequireDefault(_pure2);
var _onlyUpdateForKeys2 = __webpack_require__(17);
var _onlyUpdateForKeys3 = _interopRequireDefault(_onlyUpdateForKeys2);
var _onlyUpdateForPropTypes2 = __webpack_require__(33);
var _onlyUpdateForPropTypes3 = _interopRequireDefault(_onlyUpdateForPropTypes2);
var _withContext2 = __webpack_require__(42);
var _withContext3 = _interopRequireDefault(_withContext2);
var _getContext2 = __webpack_require__(27);
var _getContext3 = _interopRequireDefault(_getContext2);
var _lifecycle2 = __webpack_require__(30);
var _lifecycle3 = _interopRequireDefault(_lifecycle2);
var _toClass2 = __webpack_require__(41);
var _toClass3 = _interopRequireDefault(_toClass2);
var _setStatic2 = __webpack_require__(9);
var _setStatic3 = _interopRequireDefault(_setStatic2);
var _setPropTypes2 = __webpack_require__(40);
var _setPropTypes3 = _interopRequireDefault(_setPropTypes2);
var _setDisplayName2 = __webpack_require__(39);
var _setDisplayName3 = _interopRequireDefault(_setDisplayName2);
var _compose2 = __webpack_require__(22);
var _compose3 = _interopRequireDefault(_compose2);
var _getDisplayName2 = __webpack_require__(7);
var _getDisplayName3 = _interopRequireDefault(_getDisplayName2);
var _wrapDisplayName2 = __webpack_require__(48);
var _wrapDisplayName3 = _interopRequireDefault(_wrapDisplayName2);
var _shallowEqual2 = __webpack_require__(6);
var _shallowEqual3 = _interopRequireDefault(_shallowEqual2);
var _isClassComponent2 = __webpack_require__(8);
var _isClassComponent3 = _interopRequireDefault(_isClassComponent2);
var _createEagerElement2 = __webpack_require__(15);
var _createEagerElement3 = _interopRequireDefault(_createEagerElement2);
var _createEagerFactory2 = __webpack_require__(2);
var _createEagerFactory3 = _interopRequireDefault(_createEagerFactory2);
var _createSink2 = __webpack_require__(24);
var _createSink3 = _interopRequireDefault(_createSink2);
var _componentFromProp2 = __webpack_require__(21);
var _componentFromProp3 = _interopRequireDefault(_componentFromProp2);
var _nest2 = __webpack_require__(32);
var _nest3 = _interopRequireDefault(_nest2);
var _hoistStatics2 = __webpack_require__(28);
var _hoistStatics3 = _interopRequireDefault(_hoistStatics2);
var _componentFromStream2 = __webpack_require__(14);
var _componentFromStream3 = _interopRequireDefault(_componentFromStream2);
var _mapPropsStream2 = __webpack_require__(31);
var _mapPropsStream3 = _interopRequireDefault(_mapPropsStream2);
var _createEventHandler2 = __webpack_require__(23);
var _createEventHandler3 = _interopRequireDefault(_createEventHandler2);
var _setObservableConfig2 = __webpack_require__(5);
var _setObservableConfig3 = _interopRequireDefault(_setObservableConfig2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.mapProps = _mapProps3.default; // Higher-order component helpers
exports.withProps = _withProps3.default;
exports.withPropsOnChange = _withPropsOnChange3.default;
exports.withHandlers = _withHandlers3.default;
exports.defaultProps = _defaultProps3.default;
exports.renameProp = _renameProp3.default;
exports.renameProps = _renameProps3.default;
exports.flattenProp = _flattenProp3.default;
exports.withState = _withState3.default;
exports.withReducer = _withReducer3.default;
exports.branch = _branch3.default;
exports.renderComponent = _renderComponent3.default;
exports.renderNothing = _renderNothing3.default;
exports.shouldUpdate = _shouldUpdate3.default;
exports.pure = _pure3.default;
exports.onlyUpdateForKeys = _onlyUpdateForKeys3.default;
exports.onlyUpdateForPropTypes = _onlyUpdateForPropTypes3.default;
exports.withContext = _withContext3.default;
exports.getContext = _getContext3.default;
exports.lifecycle = _lifecycle3.default;
exports.toClass = _toClass3.default;
// Static property helpers
exports.setStatic = _setStatic3.default;
exports.setPropTypes = _setPropTypes3.default;
exports.setDisplayName = _setDisplayName3.default;
// Composition function
exports.compose = _compose3.default;
// Other utils
exports.getDisplayName = _getDisplayName3.default;
exports.wrapDisplayName = _wrapDisplayName3.default;
exports.shallowEqual = _shallowEqual3.default;
exports.isClassComponent = _isClassComponent3.default;
exports.createEagerElement = _createEagerElement3.default;
exports.createEagerFactory = _createEagerFactory3.default;
exports.createSink = _createSink3.default;
exports.componentFromProp = _componentFromProp3.default;
exports.nest = _nest3.default;
exports.hoistStatics = _hoistStatics3.default;
// Observable helpers
exports.componentFromStream = _componentFromStream3.default;
exports.mapPropsStream = _mapPropsStream3.default;
exports.createEventHandler = _createEventHandler3.default;
exports.setObservableConfig = _setObservableConfig3.default;
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(3);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var lifecycle = function lifecycle(spec) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
if (false) {
console.error('lifecycle() does not support the render method; its behavior is to ' + 'pass all props and state to the base component.');
}
/* eslint-disable react/prefer-es6-class */
return (0, _react.createClass)(_extends({}, spec, {
render: function render() {
return factory(_extends({}, this.props, this.state));
}
}));
/* eslint-enable react/prefer-es6-class */
};
};
exports.default = (0, _createHelper2.default)(lifecycle, 'lifecycle');
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.mapPropsStreamWithConfig = undefined;
var _symbolObservable = __webpack_require__(13);
var _symbolObservable2 = _interopRequireDefault(_symbolObservable);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _componentFromStream = __webpack_require__(14);
var _setObservableConfig = __webpack_require__(5);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var identity = function identity(t) {
return t;
};
var componentFromStream = (0, _componentFromStream.componentFromStreamWithConfig)({
fromESObservable: identity,
toESObservable: identity
});
var mapPropsStreamWithConfig = exports.mapPropsStreamWithConfig = function mapPropsStreamWithConfig(config) {
return function (transform) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
var fromESObservable = config.fromESObservable;
var toESObservable = config.toESObservable;
return componentFromStream(function (props$) {
var _ref;
return _ref = {
subscribe: function subscribe(observer) {
var subscription = toESObservable(transform(fromESObservable(props$))).subscribe({
next: function next(childProps) {
return observer.next(factory(childProps));
}
});
return {
unsubscribe: function unsubscribe() {
return subscription.unsubscribe();
}
};
}
}, _ref[_symbolObservable2.default] = function () {
return this;
}, _ref;
});
};
};
};
var mapPropsStream = mapPropsStreamWithConfig(_setObservableConfig.config);
exports.default = (0, _createHelper2.default)(mapPropsStream, 'mapPropsStream');
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var nest = function nest() {
for (var _len = arguments.length, Components = Array(_len), _key = 0; _key < _len; _key++) {
Components[_key] = arguments[_key];
}
var factories = Components.map(_createEagerFactory2.default);
var Nest = function Nest(_ref) {
var props = _objectWithoutProperties(_ref, []);
var children = _ref.children;
return factories.reduceRight(function (child, factory) {
return factory(props, child);
}, children);
};
if (false) {
/* eslint-disable global-require */
var getDisplayName = require('./getDisplayName').default;
/* eslint-enable global-require */
var displayNames = Components.map(getDisplayName);
Nest.displayName = 'nest(' + displayNames.join(', ') + ')';
}
return Nest;
};
exports.default = nest;
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _onlyUpdateForKeys = __webpack_require__(17);
var _onlyUpdateForKeys2 = _interopRequireDefault(_onlyUpdateForKeys);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var onlyUpdateForPropTypes = function onlyUpdateForPropTypes(BaseComponent) {
var propTypes = BaseComponent.propTypes;
if (false) {
/* eslint-disable global-require */
var getDisplayName = require('./getDisplayName').default;
/* eslint-enable global-require */
if (!propTypes) {
/* eslint-disable */
console.error('A component without any `propTypes` was passed to ' + '`onlyUpdateForPropTypes()`. Check the implementation of the ' + ('component with display name "' + getDisplayName(BaseComponent) + '".'));
/* eslint-enable */
}
}
var propKeys = Object.keys(propTypes || {});
var OnlyUpdateForPropTypes = (0, _onlyUpdateForKeys2.default)(propKeys)(BaseComponent);
return OnlyUpdateForPropTypes;
};
exports.default = (0, _createHelper2.default)(onlyUpdateForPropTypes, 'onlyUpdateForPropTypes', true, true);
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _shouldUpdate = __webpack_require__(10);
var _shouldUpdate2 = _interopRequireDefault(_shouldUpdate);
var _shallowEqual = __webpack_require__(6);
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var pure = (0, _shouldUpdate2.default)(function (props, nextProps) {
return !(0, _shallowEqual2.default)(props, nextProps);
});
exports.default = (0, _createHelper2.default)(pure, 'pure', true, true);
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _omit = __webpack_require__(11);
var _omit2 = _interopRequireDefault(_omit);
var _mapProps = __webpack_require__(4);
var _mapProps2 = _interopRequireDefault(_mapProps);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var renameProp = function renameProp(oldName, newName) {
return (0, _mapProps2.default)(function (props) {
var _extends2;
return _extends({}, (0, _omit2.default)(props, [oldName]), (_extends2 = {}, _extends2[newName] = props[oldName], _extends2));
});
};
exports.default = (0, _createHelper2.default)(renameProp, 'renameProp');
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _omit = __webpack_require__(11);
var _omit2 = _interopRequireDefault(_omit);
var _pick = __webpack_require__(12);
var _pick2 = _interopRequireDefault(_pick);
var _mapProps = __webpack_require__(4);
var _mapProps2 = _interopRequireDefault(_mapProps);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var keys = Object.keys;
var mapKeys = function mapKeys(obj, func) {
return keys(obj).reduce(function (result, key) {
var val = obj[key];
/* eslint-disable no-param-reassign */
result[func(val, key)] = val;
/* eslint-enable no-param-reassign */
return result;
}, {});
};
var renameProps = function renameProps(nameMap) {
return (0, _mapProps2.default)(function (props) {
return _extends({}, (0, _omit2.default)(props, keys(nameMap)), mapKeys((0, _pick2.default)(props, keys(nameMap)), function (_, oldName) {
return nameMap[oldName];
}));
});
};
exports.default = (0, _createHelper2.default)(renameProps, 'renameProps');
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// import React from 'react'
var renderComponent = function renderComponent(Component) {
return function (_) {
var factory = (0, _createEagerFactory2.default)(Component);
var RenderComponent = function RenderComponent(props) {
return factory(props);
};
// const RenderComponent = props => <Component {...props} />
if (false) {
/* eslint-disable global-require */
var wrapDisplayName = require('./wrapDisplayName').default;
/* eslint-enable global-require */
RenderComponent.displayName = wrapDisplayName(Component, 'renderComponent');
}
return RenderComponent;
};
};
exports.default = (0, _createHelper2.default)(renderComponent, 'renderComponent', false);
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var renderNothing = function renderNothing(_) {
var Nothing = function Nothing() {
return null;
};
Nothing.displayName = 'Nothing';
return Nothing;
};
exports.default = (0, _createHelper2.default)(renderNothing, 'renderNothing', false, true);
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _setStatic = __webpack_require__(9);
var _setStatic2 = _interopRequireDefault(_setStatic);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var setDisplayName = function setDisplayName(displayName) {
return (0, _setStatic2.default)('displayName', displayName);
};
exports.default = (0, _createHelper2.default)(setDisplayName, 'setDisplayName', false);
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _setStatic = __webpack_require__(9);
var _setStatic2 = _interopRequireDefault(_setStatic);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var setPropTypes = function setPropTypes(propTypes) {
return (0, _setStatic2.default)('propTypes', propTypes);
};
exports.default = (0, _createHelper2.default)(setPropTypes, 'setPropTypes', false);
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(3);
var _react2 = _interopRequireDefault(_react);
var _getDisplayName = __webpack_require__(7);
var _getDisplayName2 = _interopRequireDefault(_getDisplayName);
var _isClassComponent = __webpack_require__(8);
var _isClassComponent2 = _interopRequireDefault(_isClassComponent);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var toClass = function toClass(baseComponent) {
if ((0, _isClassComponent2.default)(baseComponent)) {
return baseComponent;
}
var ToClass = function (_Component) {
_inherits(ToClass, _Component);
function ToClass() {
_classCallCheck(this, ToClass);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
ToClass.prototype.render = function render() {
if (typeof baseComponent === 'string') {
return _react2.default.createElement('baseComponent', this.props);
}
return baseComponent(this.props, this.context);
};
return ToClass;
}(_react.Component);
ToClass.displayName = (0, _getDisplayName2.default)(baseComponent);
ToClass.propTypes = baseComponent.propTypes;
ToClass.contextTypes = baseComponent.contextTypes;
ToClass.defaultProps = baseComponent.defaultProps;
return ToClass;
};
exports.default = toClass;
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(3);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var withContext = function withContext(childContextTypes, getChildContext) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
var WithContext = function (_Component) {
_inherits(WithContext, _Component);
function WithContext() {
var _temp, _this, _ret;
_classCallCheck(this, WithContext);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.getChildContext = function () {
return getChildContext(_this.props);
}, _temp), _possibleConstructorReturn(_this, _ret);
}
WithContext.prototype.render = function render() {
return factory(this.props);
};
return WithContext;
}(_react.Component);
WithContext.childContextTypes = childContextTypes;
return WithContext;
};
};
exports.default = (0, _createHelper2.default)(withContext, 'withContext');
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(3);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var mapValues = function mapValues(obj, func) {
var result = [];
var i = 0;
/* eslint-disable no-restricted-syntax */
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
i += 1;
result[key] = func(obj[key], key, i);
}
}
/* eslint-enable no-restricted-syntax */
return result;
};
var withHandlers = function withHandlers(handlers) {
return function (BaseComponent) {
var _class, _temp2, _initialiseProps;
var factory = (0, _createEagerFactory2.default)(BaseComponent);
return _temp2 = _class = function (_Component) {
_inherits(_class, _Component);
function _class() {
var _temp, _this, _ret;
_classCallCheck(this, _class);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _initialiseProps.call(_this), _temp), _possibleConstructorReturn(_this, _ret);
}
_class.prototype.componentWillReceiveProps = function componentWillReceiveProps() {
this.cachedHandlers = {};
};
_class.prototype.render = function render() {
return factory(_extends({}, this.props, this.handlers));
};
return _class;
}(_react.Component), _initialiseProps = function _initialiseProps() {
var _this2 = this;
this.cachedHandlers = {};
this.handlers = mapValues(handlers, function (createHandler, handlerName) {
return function () {
var cachedHandler = _this2.cachedHandlers[handlerName];
if (cachedHandler) {
return cachedHandler.apply(undefined, arguments);
}
var handler = createHandler(_this2.props);
_this2.cachedHandlers[handlerName] = handler;
if (false) {
console.error('withHandlers(): Expected a map of higher-order functions. ' + 'Refer to the docs for more info.');
}
return handler.apply(undefined, arguments);
};
});
}, _temp2;
};
};
exports.default = (0, _createHelper2.default)(withHandlers, 'withHandlers');
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _mapProps = __webpack_require__(4);
var _mapProps2 = _interopRequireDefault(_mapProps);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var withProps = function withProps(input) {
return (0, _mapProps2.default)(function (props) {
return _extends({}, props, typeof input === 'function' ? input(props) : input);
});
};
exports.default = (0, _createHelper2.default)(withProps, 'withProps');
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(3);
var _pick = __webpack_require__(12);
var _pick2 = _interopRequireDefault(_pick);
var _shallowEqual = __webpack_require__(6);
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var withPropsOnChange = function withPropsOnChange(shouldMapOrKeys, propsMapper) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
var shouldMap = typeof shouldMapOrKeys === 'function' ? shouldMapOrKeys : function (props, nextProps) {
return !(0, _shallowEqual2.default)((0, _pick2.default)(props, shouldMapOrKeys), (0, _pick2.default)(nextProps, shouldMapOrKeys));
};
return function (_Component) {
_inherits(_class2, _Component);
function _class2() {
var _temp, _this, _ret;
_classCallCheck(this, _class2);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.computedProps = propsMapper(_this.props), _temp), _possibleConstructorReturn(_this, _ret);
}
_class2.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (shouldMap(this.props, nextProps)) {
this.computedProps = propsMapper(nextProps);
}
};
_class2.prototype.render = function render() {
return factory(_extends({}, this.props, this.computedProps));
};
return _class2;
}(_react.Component);
};
};
exports.default = (0, _createHelper2.default)(withPropsOnChange, 'withPropsOnChange');
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(3);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var withReducer = function withReducer(stateName, dispatchName, reducer, initialState) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
return function (_Component) {
_inherits(_class2, _Component);
function _class2() {
var _temp, _this, _ret;
_classCallCheck(this, _class2);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = {
stateValue: typeof initialState === 'function' ? initialState(_this.props) : initialState
}, _this.dispatch = function (action) {
return _this.setState(function (_ref) {
var stateValue = _ref.stateValue;
return {
stateValue: reducer(stateValue, action)
};
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_class2.prototype.render = function render() {
var _extends2;
return factory(_extends({}, this.props, (_extends2 = {}, _extends2[stateName] = this.state.stateValue, _extends2[dispatchName] = this.dispatch, _extends2)));
};
return _class2;
}(_react.Component);
};
};
exports.default = (0, _createHelper2.default)(withReducer, 'withReducer');
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(3);
var _createHelper = __webpack_require__(1);
var _createHelper2 = _interopRequireDefault(_createHelper);
var _createEagerFactory = __webpack_require__(2);
var _createEagerFactory2 = _interopRequireDefault(_createEagerFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var withState = function withState(stateName, stateUpdaterName, initialState) {
return function (BaseComponent) {
var factory = (0, _createEagerFactory2.default)(BaseComponent);
return function (_Component) {
_inherits(_class2, _Component);
function _class2() {
var _temp, _this, _ret;
_classCallCheck(this, _class2);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = {
stateValue: typeof initialState === 'function' ? initialState(_this.props) : initialState
}, _this.updateStateValue = function (updateFn, callback) {
return _this.setState(function (_ref) {
var stateValue = _ref.stateValue;
return {
stateValue: typeof updateFn === 'function' ? updateFn(stateValue) : updateFn
};
}, callback);
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_class2.prototype.render = function render() {
var _extends2;
return factory(_extends({}, this.props, (_extends2 = {}, _extends2[stateName] = this.state.stateValue, _extends2[stateUpdaterName] = this.updateStateValue, _extends2)));
};
return _class2;
}(_react.Component);
};
};
exports.default = (0, _createHelper2.default)(withState, 'withState');
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _getDisplayName = __webpack_require__(7);
var _getDisplayName2 = _interopRequireDefault(_getDisplayName);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var wrapDisplayName = function wrapDisplayName(BaseComponent, hocName) {
return hocName + '(' + (0, _getDisplayName2.default)(BaseComponent) + ')';
};
exports.default = wrapDisplayName;
/***/ },
/* 49 */
/***/ function(module, exports) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks
*
*/
/*eslint-disable no-self-compare */
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (is(objA, objB)) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
for (var i = 0; i < keysA.length; i++) {
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
/***/ },
/* 50 */
/***/ function(module, exports) {
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
var REACT_STATICS = {
childContextTypes: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
arguments: true,
arity: true
};
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent) {
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
var keys = Object.getOwnPropertyNames(sourceComponent);
for (var i=0; i<keys.length; ++i) {
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]]) {
try {
targetComponent[keys[i]] = sourceComponent[keys[i]];
} catch (error) {
}
}
}
}
return targetComponent;
};
/***/ },
/* 51 */
/***/ function(module, exports) {
'use strict';
module.exports = function symbolObservablePonyfill(root) {
var result;
var Symbol = root.Symbol;
if (typeof Symbol === 'function') {
if (Symbol.observable) {
result = Symbol.observable;
} else {
result = Symbol('observable');
Symbol.observable = result;
}
} else {
result = '@@observable';
}
return result;
};
/***/ }
/******/ ])
});
; |
src/entypo/RemoveUser.js | cox-auto-kc/react-entypo | import React from 'react';
import EntypoIcon from '../EntypoIcon';
const iconClass = 'entypo-svgicon entypo--RemoveUser';
let EntypoRemoveUser = (props) => (
<EntypoIcon propClass={iconClass} {...props}>
<path d="M15.989,19.129c0-2.246-2.187-3.389-4.317-4.307c-2.123-0.914-2.801-1.684-2.801-3.334c0-0.989,0.648-0.667,0.932-2.481c0.12-0.752,0.692-0.012,0.802-1.729c0-0.684-0.313-0.854-0.313-0.854s0.159-1.013,0.221-1.793c0.064-0.817-0.398-2.56-2.301-3.095C7.88,1.195,7.655,0.654,8.679,0.112c-2.24-0.104-2.761,1.068-3.954,1.93c-1.015,0.756-1.289,1.953-1.24,2.59c0.065,0.78,0.223,1.793,0.223,1.793s-0.314,0.17-0.314,0.854c0.11,1.718,0.684,0.977,0.803,1.729C4.481,10.822,5.13,10.5,5.13,11.489c0,1.65-0.212,2.21-2.336,3.124C0.663,15.53,0,17,0.011,19.129C0.014,19.766,0,20,0,20h16C16,20,15.989,19.766,15.989,19.129z M16,10.039l-2.299-2.398L12.64,8.702L15.039,11l-2.398,2.298l1.061,1.061L16,11.961l2.298,2.398l1.061-1.061L16.961,11l2.397-2.298l-1.061-1.061L16,10.039z"/>
</EntypoIcon>
);
export default EntypoRemoveUser;
|
examples/antd-demo/src/routes/IndexPage.js | zjxpcyc/xrc-form | import React from 'react';
import { connect } from 'dva';
import { Form, Input, Button, Modal } from 'antd';
import FormBody from '../../../../xrc-form/lib';
import styles from './IndexPage.css';
const WrapItem = (props) => {
return (
<Form.Item
labelCol={{
xs: { span: 24 },
sm: { span: 6 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 14 },
}}
label={props.label}
>
{props.children}
</Form.Item>
);
};
const UserLogIn = Form.create()((props) => {
const handleSubmit = (e) => {
e.preventDefault();
props.form.validateFields((err, values) => {
if (err) {
return false;
}
console.log('=============form data==============');
console.log(JSON.stringify(values));
console.log('====================================');
Modal.success({
title: '登录消息',
content: `登录成功, 您的登录信息: ${JSON.stringify(values)}`,
});
});
};
const items = [
{
label: '用户名',
name: 'user',
element: <Input />,
options: {
rules: [{
required: true,
message: '请填写用户名',
}],
},
},
{
label: '密码',
name: 'password',
element: <Input type="password" />,
options: {
rules: [{
required: true,
message: '请填写密码',
}],
},
},
{
name: 'token',
element: null,
options: {
initialValue: Math.random().toString(36).substr(2),
},
},
{
element: <Button type="primary" htmlType="submit">登录</Button>,
},
];
const formProps = {
items,
wrapItem: WrapItem,
form: props.form,
};
return (
<Form onSubmit={handleSubmit}>
<FormBody {...formProps} />
</Form>
);
});
function IndexPage() {
return (
<div className={styles.normal}>
<h1 className={styles.title}>antd demo</h1>
<UserLogIn />
</div>
);
}
IndexPage.propTypes = {
};
export default connect()(IndexPage);
|
src/svg-icons/image/audiotrack.js | manchesergit/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageAudiotrack = (props) => (
<SvgIcon {...props}>
<path d="M12 3v9.28c-.47-.17-.97-.28-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7z"/>
</SvgIcon>
);
ImageAudiotrack = pure(ImageAudiotrack);
ImageAudiotrack.displayName = 'ImageAudiotrack';
ImageAudiotrack.muiName = 'SvgIcon';
export default ImageAudiotrack;
|
src/components/Mousetrap.js | zebras-filming-videos/streamr-web | import React from 'react'
import forEach from 'lodash/forEach'
import mousetrap from 'mousetrap'
export default class Mousetrap extends React.Component {
componentDidMount () {
forEach(this.props.bindings || [], (callback, key) => {
mousetrap.bind(key, callback)
})
}
componentWillUnmount () {
forEach(this.props.bindings || [], (_, key) => {
mousetrap.unbind(key)
})
}
render () {
return null
}
}
|
src/components/fields/FieldErrors.js | zebras-filming-videos/streamr-web | import React from 'react'
export default ({
errors
}) => (
<ul className='field-errors'>
{errors.map((error) =>
<li className='field-error' key={error}>{error}</li>
)}
</ul>
)
|
src/entypo/ArrowWithCircleRight.js | cox-auto-kc/react-entypo | import React from 'react';
import EntypoIcon from '../EntypoIcon';
const iconClass = 'entypo-svgicon entypo--ArrowWithCircleRight';
let EntypoArrowWithCircleRight = (props) => (
<EntypoIcon propClass={iconClass} {...props}>
<path d="M10,0.4c-5.303,0-9.601,4.298-9.601,9.6c0,5.303,4.298,9.601,9.601,9.601c5.301,0,9.6-4.298,9.6-9.601C19.6,4.698,15.301,0.4,10,0.4z M9.999,17.6c-4.197,0-7.6-3.402-7.6-7.6s3.402-7.6,7.6-7.6S17.6,5.803,17.6,10S14.196,17.6,9.999,17.6z M10,8H6v4h4v2.5l4.5-4.5L10,5.5V8z"/>
</EntypoIcon>
);
export default EntypoArrowWithCircleRight;
|
modules/design/messages.js | liors/wix-chat-settings | import React from 'react';
import * as UI from 'editor-ui-lib';
class Messages extends React.Component {
render() {
return (
<div>
<UI.sectionDividerLabeled label="Messages"/>
<UI.fontPicker title="Message text"
wix-param="design_messageFont">
</UI.fontPicker>
<hr className="divider-long"/>
<UI.colorPickerSlider title="Message background"
wix-param="design_messageBackground"
startWithColor="color-11">
</UI.colorPickerSlider>
</div>
)
}
}
export default Messages; |
src/svg-icons/image/looks-5.js | rscnt/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageLooks5 = (props) => (
<SvgIcon {...props}>
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 6h-4v2h2c1.1 0 2 .89 2 2v2c0 1.11-.9 2-2 2H9v-2h4v-2H9V7h6v2z"/>
</SvgIcon>
);
ImageLooks5 = pure(ImageLooks5);
ImageLooks5.displayName = 'ImageLooks5';
export default ImageLooks5;
|
src/svg-icons/social/notifications-active.js | igorbt/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let 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 = pure(SocialNotificationsActive);
SocialNotificationsActive.displayName = 'SocialNotificationsActive';
SocialNotificationsActive.muiName = 'SvgIcon';
export default SocialNotificationsActive;
|
src/Picker/SelectField.js | skystebnicki/chamel | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import DropDownArrow from '../svg-icons/drop-down-arrow';
import Paper from '../Paper/Paper';
import Menu from '../Menu/Menu';
import Popover from '../Popover/Popover';
import ThemeService from '../styles/ChamelThemeService';
/**
* Component for displaying dropdowns
*/
class SelectField extends Component {
/**
* Class constructor takes properties and passes them to the parent/super
*/
constructor(props) {
super(props);
this.state = {
open: false,
anchorEl: null,
selectedIndex: props.selectedIndex || 0,
};
}
/**
* Popover has entered the dom
*/
componentDidMount() {
if (this.props.hasOwnProperty('selectedIndex')) {
this._setSelectedIndex(this.props);
}
}
/**
* Componenent is about to exit the dom
*/
componentWillReceiveProps(nextProps) {
if (this.props.hasOwnProperty('selectedIndex')) {
this._setSelectedIndex(nextProps);
}
}
/**
* Render Componenent
*/
render() {
// Determine which theme to use
let theme =
this.context.chamelTheme && this.context.chamelTheme.picker
? this.context.chamelTheme.picker
: ThemeService.defaultTheme.picker;
return (
<div className={theme.selectField}>
<div className={theme.selectFieldControl} onClick={this._onControlClick}>
<Paper zDepth={0}>
<div className={theme.selectFieldLabel}>
{this.props.menuItems[this.state.selectedIndex].text}
</div>
<DropDownArrow className={theme.selectFieldIcon} />
<div className={theme.selectFieldUnderline} />
</Paper>
</div>
<Popover
open={this.state.open}
anchorEl={this.state.anchorEl}
targetOrigin={{ horizontal: 'left', vertical: 'top' }}
onRequestClose={this._handleRequestClose}
relative={false}
>
<Menu
ref="menuItems"
autoWidth={this.props.autoWidth}
selectedIndex={this.state.selectedIndex}
menuItems={this.props.menuItems}
onItemClick={this._onMenuItemClick}
/>
</Popover>
</div>
);
}
/**
* Set which menu item is selected
*
* @private
* @param {Object} props The props we are setting
*/
_setSelectedIndex = props => {
const selectedIndex = props.selectedIndex;
if (process.env.NODE_ENV !== 'production' && selectedIndex < 0) {
console.warn('Cannot set selectedIndex to a negative index.', selectedIndex);
}
this.setState({ selectedIndex: selectedIndex > -1 ? selectedIndex : 0 });
};
/**
* Meny control clicked handler
*
* @private
* @param {DOMEvent} e The click event fired
*/
_onControlClick = e => {
e.preventDefault();
this.setState({
open: !this.state.open,
anchorEl: e.currentTarget,
});
};
/**
* Triggered when a menu item gets clicked
*
* @private
* @param {DOMEvent} e The event fired through
* @param {int} key The index of the item clicked - this will be deprecated soon
* @param {Object} payload Whatever payload was passed to the menu
*/
_onMenuItemClick = (e, key, payload) => {
if (this.props.onChange && this.state.selectedIndex !== key) {
this.props.onChange(e, key, payload);
}
this.setState({
selectedIndex: key,
open: false,
});
// Prevent ghost clicks
e.preventDefault();
e.stopPropagation();
// TODO: Not sure if this is needed with the above being called
e.nativeEvent.stopImmediatePropagation();
};
/**
* Handle when the popover gets closed
*
* @private
* @param {DOMEvent} e The click event fired
*/
_handleRequestClose = e => {
this.setState({
open: false,
});
};
}
/**
* Set accepted properties
*/
SelectField.propTypes = {
autoWidth: PropTypes.bool,
onChange: PropTypes.func,
selectedIndex: PropTypes.number,
menuItems: PropTypes.array.isRequired,
};
/**
* An alternate theme may be passed down by a provider
*/
SelectField.contextTypes = {
chamelTheme: PropTypes.object,
};
/**
* Set property defaults
*/
SelectField.defaultProps = {
autoWidth: true,
};
export default SelectField;
|
react-flux-mui/js/material-ui/src/svg-icons/device/signal-wifi-4-bar-lock.js | pbogdan/react-flux-mui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let DeviceSignalWifi4BarLock = (props) => (
<SvgIcon {...props}>
<path d="M23 16v-1.5c0-1.4-1.1-2.5-2.5-2.5S18 13.1 18 14.5V16c-.5 0-1 .5-1 1v4c0 .5.5 1 1 1h5c.5 0 1-.5 1-1v-4c0-.5-.5-1-1-1zm-1 0h-3v-1.5c0-.8.7-1.5 1.5-1.5s1.5.7 1.5 1.5V16zm-6.5-1.5c0-2.8 2.2-5 5-5 .4 0 .7 0 1 .1L23.6 7c-.4-.3-4.9-4-11.6-4C5.3 3 .8 6.7.4 7L12 21.5l3.5-4.4v-2.6z"/>
</SvgIcon>
);
DeviceSignalWifi4BarLock = pure(DeviceSignalWifi4BarLock);
DeviceSignalWifi4BarLock.displayName = 'DeviceSignalWifi4BarLock';
DeviceSignalWifi4BarLock.muiName = 'SvgIcon';
export default DeviceSignalWifi4BarLock;
|
src/svg-icons/image/rotate-left.js | pradel/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageRotateLeft = (props) => (
<SvgIcon {...props}>
<path d="M7.11 8.53L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z"/>
</SvgIcon>
);
ImageRotateLeft = pure(ImageRotateLeft);
ImageRotateLeft.displayName = 'ImageRotateLeft';
export default ImageRotateLeft;
|
wwwroot/app/src/components/TopBar/TopBar.js | AlinCiocan/FoodPlanApp | import React, { Component } from 'react';
import { Link } from 'react-router';
import logo from './logo.svg';
export default class TopBar extends Component {
renderAddButton() {
if (this.props.addButton) {
return (
<button
className="top-bar__side top-bar__side--right top-bar__add-button"
onClick={this.props.addButtonOnClick}>
ADD
</button>
);
}
return null;
}
renderSaveButton() {
if (this.props.saveButton) {
return (
<div
className="top-bar__side top-bar__side--right top-bar__save-button"
onClick={this.props.saveButtonOnClick}>
SAVE
</div>
);
}
return null;
}
renderEditButton() {
if (this.props.editButton) {
return (
<div
className="top-bar__side top-bar__side--right top-bar__edit-button"
onClick={this.props.editButtonOnClick}>
EDIT
</div>
);
}
return null;
}
renderBackButton() {
if (this.props.backButton) {
return (
<div className="top-bar__side top-bar__side--left" onClick={this.props.backButtonOnClick}>
<i className="fa fa-arrow-left" aria-hidden="true"></i>
{this.props.backButtonText}
</div>
);
}
return null;
}
renderLogo() {
if (this.props.hideLogo) {
return null;
}
return (
<Link to="/" className="top-bar__logo">
<img src={logo} alt="logo" />
</Link>
);
}
render() {
return (
<div className="top-bar">
{this.renderBackButton()}
{this.renderLogo()}
{this.renderAddButton()}
{this.renderSaveButton()}
{this.renderEditButton()}
</div>
);
}
}
|
fields/types/textarea/TextareaFilter.js | lojack/keystone | import _ from 'underscore';
import classNames from 'classnames';
import React from 'react';
import { FormField, FormInput, FormSelect } from 'elemental';
const CONTROL_OPTIONS = [
{ label: 'Matches', value: 'matches' },
{ label: 'Contains', value: 'contains' },
{ label: 'Begins with', value: 'beginsWith' },
{ label: 'Ends with', value: 'endsWith' },
{ label: 'Is', value: 'is' },
{ label: 'Is not', value: 'isNot' }
];
var TextareaFilter = React.createClass({
getInitialState () {
return {
modeValue: CONTROL_OPTIONS[0].value, // 'matches'
modeLabel: CONTROL_OPTIONS[0].label, // 'Matches'
value: ''
};
},
componentDidMount () {
// focus the text input
React.findDOMNode(this.refs.input).focus();
},
toggleMode (mode) {
// TODO: implement w/o underscore
this.setState({
modeValue: mode,
modeLabel: _.findWhere(CONTROL_OPTIONS, { value: mode }).label
});
// focus the text input after a mode selection is made
React.findDOMNode(this.refs.input).focus();
},
renderMode () {
// JM: this toggle looks good but is very limited
// restricted to the width of the popup (wrapping looks terrible)
// no support for multi selection
// i've opted for a simple select
// @jedwatson thoughts?
let containClass = classNames('popout__toggle__action', { 'is-selected': this.state.mode === 'partial' });
let matchClass = classNames('popout__toggle__action', { 'is-selected': this.state.mode === 'match' });
return (
<div className="popout__toggle">
<span className="popout__toggle__item">
<button type="button" onClick={() => { this.toggleMode('partial'); }} className={containClass}>Contains</button>
</span>
<span className="popout__toggle__item">
<button type="button" onClick={() => { this.toggleMode('match'); }} className={matchClass}>Matches</button>
</span>
</div>
);
},
render () {
let { field } = this.props;
let { modeLabel, modeValue } = this.state;
let placeholder = field.label + ' ' + modeLabel.toLowerCase() + '...';
return (
<div>
<FormSelect options={CONTROL_OPTIONS} onChange={this.toggleMode} value={modeValue} />
<FormField>
<FormInput ref="input" placeholder={placeholder} />
</FormField>
</div>
);
}
});
module.exports = TextareaFilter;
|
app/components/PointMap/index.js | GuiaLa/guiala-web-app | /**
*
* PointMap
*
*/
import React from 'react';
import styles from './styles.css';
class PointMap extends React.Component {
render() {
return (
<div className={ styles.pointMap }>
<h1>MAPAAAA</h1>
</div>
);
}
}
export default PointMap;
|
src/api/index.js | DigitalGlobe/jetset | import React from 'react';
import PropTypes from 'prop-types';
import logger, { formatBranchArgs } from '../lib/log';
import createActions from './main';
import store from '../store';
export default class Api extends React.Component {
static propTypes = {
url: PropTypes.string.isRequired,
// see https://github.com/github/fetch#sending-cookies for reference
credentials: PropTypes.oneOf( [ 'same-origin', 'include' ] ),
token: PropTypes.string,
auth: PropTypes.string,
authorization: PropTypes.string
}
subscriptions = []
constructor( props ) {
super( props );
this.api = createActions( props );
this.state = { cache: null };
}
componentWillMount() {
this.subscriptions = Object.keys( this.api ).map( key =>
store.subscribeTo( this.api[ key ].subscribePath, state => {
logger(`\uD83C\uDF00 <Api> is re-rendering based on state changes on branch: %c${formatBranchArgs( this.api[ key ].subscribePath )}`, 'color: #5B4532' );
this.setState({ cache: state });
})
);
}
componentWillReceiveProps( nextProps ) {
if ( this.props !== nextProps ) {
this.api = createActions( nextProps );
}
}
componentWillUnmount() {
this.subscriptions.forEach( subscription => store.unsubscribe( subscription ) );
}
// TODO: allow for multiple children (look into fragments)
render() {
const { children, ...props } = this.props;
const isValidChild = children && typeof children.type === 'function';
if ( isValidChild ) {
return React.cloneElement( children, { ...props, ...this.api } );
} else {
logger( '\u26A0 Warning: You have passed a child into <Api> that cannot receive its props. Be sure your custom component(s) are the only children of <Api>', children );
return null;
}
}
}
|
app/components/SubredditDescription.js | nantaphop/redd | import React from 'react'
import Paper from 'material-ui/Paper'
import styled from 'styled-components'
import { compose, withHandlers, setDisplayName } from 'recompose'
import { inject, observer } from 'mobx-react'
import Typography from 'material-ui/Typography'
import { CircularProgress } from 'material-ui/Progress';
import Card, { CardActions, CardContent, CardMedia } from 'material-ui/Card';
import ContentBody from './ContentBody'
const enhance = compose(
inject('subredditStore'),
withHandlers({
}),
observer,
)
const Container = styled(Paper)`
margin-left: 8px !important;
padding: 80px 16px 16px 16px !important;
overflow-y: auto;
height: calc(100vh - 64px);
`
const LoadingContainer = styled.div`
width: 100%;
display: flex;
justify-content: center;
padding-top: 16px;
`
export default enhance((props) => {
return (
<Container color="white">
<ContentBody html={props.subredditStore.subreddit.description_html} />
</Container>
)
})
|
src/organisms/cards/PolicyCard/PolicyActions.js | policygenius/athenaeum | import React from 'react';
import PropTypes from 'prop-types';
import accounting from 'accounting';
import Text from 'atoms/Text';
import Layout from 'atoms/Layout';
import Button from 'atoms/Button';
import Hide from 'wrappers/Hide';
import Spacer from 'atoms/Spacer';
import styles from './policy_card.module.scss';
const ResponsiveText = ({ text, offset, size }) => (
<svg
width='100%'
viewBox={`${offset} 0 ${size} 15`}
className={styles['svg-text']}
>
<text x='0' y='12'>{text}</text>
</svg>
);
export const PolicyActions = (props) => {
const {
premium,
discount,
onContinue,
onCompare
} = props;
const formattedPremium = accounting.formatMoney(premium.price);
return (
<div className={styles['actions']}>
{ premium.price ? (
<div>
<Text size={11} font='a' color='neutral-2' bold>
<Text size={4} font='a' color='primary-3' bold>{formattedPremium}</Text>
{'/'}
{premium.format.toUpperCase()}
</Text>
{discount && discount}
</div>
)
:
premium.defaultText}
<Spacer spacer={3} />
<Layout smallCols={[ 12 ]} style={{ width: '100%' }}>
<Button onClick={onContinue} className={styles['view-policy']}>
Continue
</Button>
<Hide hideOn='tablet desktop'>
<Button
onClick={onCompare}
>
Compare
</Button>
</Hide>
</Layout>
</div>
);
};
PolicyActions.propTypes = {
premium: PropTypes.shape({
price: PropTypes.number,
format: PropTypes.string,
defaultText: PropTypes.node,
}),
discount: PropTypes.node,
onContinue: PropTypes.func,
onCompare: PropTypes.func,
};
ResponsiveText.propTypes = {
text: PropTypes.string.isRequired,
offset: PropTypes.number,
size: PropTypes.number
};
export default PolicyActions;
|
ui/src/containers/ModelAutoComplete/index.js | LearningLocker/learninglocker | import React from 'react';
import { Map } from 'immutable';
import { compose, withProps, withState } from 'recompose';
import AutoComplete2 from 'ui/components/AutoComplete2';
import ModelInput from 'ui/components/AutoComplete2/Inputs/SingleInput/ModelInput';
import ModelOptionList from 'ui/components/AutoComplete2/Options/ModelOptionList/ModelOptionList';
const withSelectedOption = compose(
withState('selectedId', 'setSelectedId'),
withProps(({ setSelectedId, onChange }) => ({
selectOption: (option) => {
onChange(option);
setSelectedId(option.get('_id'));
},
deselectOption: () => {
onChange(null);
setSelectedId(null);
}
}))
);
// stores a filter based on search input, merges it with any existing filters
const withSearchFilter = compose(
withState('searchFilter', 'setSearchFilter'),
withProps(({ filter = new Map(), searchFilter = new Map() }) => ({
filter: filter.mergeDeep(searchFilter)
}))
);
const ModelAutoComplete = ({
schema,
filter,
sort,
id,
setSearchFilter,
searchFilter,
selectOption,
deselectOption,
selectedId,
parseOption,
parseOptionString,
parseOptionTooltip,
searchStringToFilter,
searchFilterToString = searchFilter2 => searchFilter2 && searchFilter2.first() && searchFilter2.first().get('$regex') || '',
displayCount,
fields,
placeholder,
defaultValues,
defaultNewValues,
canEdit = () => true,
}) => {
const searchString = searchFilterToString(searchFilter);
return (
<AutoComplete2
renderInput={({ hasFocus, onFocus }) => (
<ModelInput
onFocus={onFocus}
placeholder={placeholder}
fields={fields}
defaultValues={defaultValues}
parseOption={option => (option ? ((parseOptionString && parseOptionString(option)) || parseOption(option)) : '')}
parseOptionTooltip={option => (option ? parseOptionTooltip(option) : '')}
schema={schema}
id={id || selectedId}
deselectOption={deselectOption}
hasFocus={hasFocus}
searchStringToFilter={searchStringToFilter}
onChangeFilter={searchFilter2 => setSearchFilter(searchFilter2)}
searchString={searchString}
canEdit={canEdit} />
)}
renderOptions={({ onBlur }) => (
<ModelOptionList
fields={fields}
sort={sort}
defaultValues={defaultValues}
defaultNewValues={defaultNewValues}
onSelectOption={(option) => { selectOption(option); onBlur(); }}
deselectOption={() => { deselectOption(); onBlur(); }}
parseOption={option => (option ? parseOption(option) : '')}
parseOptionTooltip={option => (option ? parseOptionTooltip(option) : '')}
filter={filter}
schema={schema}
displayCount={displayCount}
canEdit={canEdit} />
)} />
);
};
export default compose(
withSelectedOption,
withSearchFilter
)(ModelAutoComplete);
|
client/src/app/install/install-step-3-database.js | opensupports/opensupports | import React from 'react';
import _ from 'lodash';
import history from 'lib-app/history';
import i18n from 'lib-app/i18n';
import API from 'lib-app/api-call';
import Button from 'core-components/button';
import Header from 'core-components/header';
import Form from 'core-components/form';
import FormField from 'core-components/form-field';
import SubmitButton from 'core-components/submit-button';
import Message from 'core-components/message';
class InstallStep3Database extends React.Component {
state = {
loading: false,
error: false,
showErrorMessage: true,
errorMessage: ''
};
render() {
const { loading } = this.state;
return (
<div className="install-step-3">
<Header title={i18n('STEP_TITLE', {title: i18n('DATABASE_CONFIGURATION'), current: 3, total: 6})} description={i18n('STEP_3_DESCRIPTION')} />
{this.renderMessage()}
<Form loading={loading} onSubmit={this.onSubmit.bind(this)}>
<FormField name="dbHost" label={i18n('DATABASE_HOST')} fieldProps={{size: 'large'}} required/>
<FormField name="dbPort" label={i18n('DATABASE_PORT')} fieldProps={{size: 'large'}} infoMessage={i18n('DEFAULT_PORT')}/>
<FormField name="dbName" label={i18n('DATABASE_NAME')} fieldProps={{size: 'large'}} infoMessage={i18n('LEFT_EMPTY_DATABASE')}/>
<FormField name="dbUser" label={i18n('DATABASE_USER')} fieldProps={{size: 'large'}} required/>
<FormField name="dbPassword" label={i18n('DATABASE_PASSWORD')} fieldProps={{size: 'large', password: true}}/>
<div className="install-step-3__buttons">
<Button className="install-step-3__previous" disabled={loading} size="medium" onClick={this.onPreviousClick.bind(this)}>{i18n('PREVIOUS')}</Button>
<SubmitButton className="install-step-3__next" size="medium" type="secondary">{i18n('NEXT')}</SubmitButton>
</div>
</Form>
</div>
);
}
renderMessage() {
const { error, errorMessage, showErrorMessage } = this.state;
return (
error ?
<Message
showMessage={showErrorMessage}
onCloseMessage={this.onCloseMessage.bind(this, "showErrorMessage")}
className="install-step-3__message"
type="error">
{i18n('ERROR_UPDATING_SETTINGS')}: {errorMessage}
</Message> :
null
);
}
onPreviousClick(event) {
event.preventDefault();
history.push('/install/step-2');
}
onSubmit(form) {
this.setState({
loading: true
}, () => {
API.call({
path: '/system/init-database',
data: _.extend({}, form, {dbPort: form.dbPort || 3306})
})
.then(() => history.push('/install/step-4'))
.catch(({message}) => this.setState({
loading: false,
error: true,
showErrorMessage: true,
errorMessage: message
}));
});
}
onCloseMessage(showMessage) {
this.setState({
[showMessage]: false
});
}
}
export default InstallStep3Database;
|
src/SubcategoryList/index.js | DuckyTeam/ducky-components | import React from 'react';
import PropTypes from 'prop-types';
import Spacer from '../Spacer';
import ProgressbarLabeledPercentage from '../ProgressbarLabeledPercentage';
import Typography from '../Typography';
import Wrapper from '../Wrapper';
import styles from './styles.css';
class SubcategoryList extends React.Component {
renderBar() {
const sortedCategories = this.props.sortedCategories;
return sortedCategories.map((category, index) => {
return (
<div
key={index}
>
<ProgressbarLabeledPercentage
categoryText={category.label}
color={category.color}
percent={category.percent}
scaledPercent={category.scaledPercent}
/>
<Spacer size="double" />
</div>
);
});
}
render() {
return (
<Wrapper
className={styles.wrapper}
size="standard"
>
<Typography
type="bodyTextNormal"
>
{this.props.title}
</Typography>
<Spacer size="double" />
{this.renderBar()}
</Wrapper>
);
}
}
SubcategoryList.propTypes = {
sortedCategories: PropTypes.array,
title: PropTypes.string
};
export default SubcategoryList;
|
src/lib/middlewares/htmlView.js | kaishui/pwfe-server | import React from 'react'
import RenderFacade from './util/facade'
import cache from '../common/cache'
import env from '../common/env'
const App = env.getParam('app')
/**
* 进行html模板渲染的组件。
* @param ctx
* @param next
*/
async function htmlView(ctx, next) {
if (ctx.isMatch) {
//获取React静态文本和redux状态数据
const data = getData(ctx)
writeCache(ctx) //写缓存
await ctx.render('index', {
title: ctx.initName || env.getParam('defPageName'),
root: data.document,//初始化Html
state: data.state, //redux数据
seo: data.seo, //seo数据
params: { //服务器参数
initPath: ctx.url, //初始化访问的URL
initId: ctx.initId //初始化访问的页面组件id
}
})
} else {
return next()
}
}
/**
* 从上下文获取数据
* @param {object} ctx koa单次请求的上下文(request context)
* @returns {object} {document:React渲染的HTML文本, state:store中的状态数据}
*/
const getData = (ctx) => {
return ctx.isRender ? {document: ctx.reactDom, state: ctx.fluxStore.getState(), seo: ctx.seo} : {document: '', state: {}, seo :{}}
}
/**
* 写缓存
* @param ctx
*/
const writeCache = (ctx) => {
if (ctx.isCache) {
const key = ctx.originalUrl
//写缓存,缓存结构{html:,store:,component:}
cache.get(key) || cache.set(key, {
html: ctx.reactDom,
store: ctx.fluxStore,
component: {comp: ctx.initComp , id: ctx.initId},
dispathCount: ctx.dispathCount,
seo : ctx.seo
}, ctx.isCache.ttl)
}
}
module.exports = htmlView
|
src/CarouselItem.js | omerts/react-bootstrap | import React from 'react';
import classNames from 'classnames';
import TransitionEvents from './utils/TransitionEvents';
const CarouselItem = React.createClass({
propTypes: {
direction: React.PropTypes.oneOf(['prev', 'next']),
onAnimateOutEnd: React.PropTypes.func,
active: React.PropTypes.bool,
animateIn: React.PropTypes.bool,
animateOut: React.PropTypes.bool,
caption: React.PropTypes.node,
index: React.PropTypes.number
},
getInitialState() {
return {
direction: null
};
},
getDefaultProps() {
return {
animation: true
};
},
handleAnimateOutEnd() {
if (this.props.onAnimateOutEnd && this.isMounted()) {
this.props.onAnimateOutEnd(this.props.index);
}
},
componentWillReceiveProps(nextProps) {
if (this.props.active !== nextProps.active) {
this.setState({
direction: null
});
}
},
componentDidUpdate(prevProps) {
if (!this.props.active && prevProps.active) {
TransitionEvents.addEndEventListener(
React.findDOMNode(this),
this.handleAnimateOutEnd
);
}
if (this.props.active !== prevProps.active) {
setTimeout(this.startAnimation, 20);
}
},
startAnimation() {
if (!this.isMounted()) {
return;
}
this.setState({
direction: this.props.direction === 'prev' ?
'right' : 'left'
});
},
render() {
let classes = {
item: true,
active: (this.props.active && !this.props.animateIn) || this.props.animateOut,
next: this.props.active && this.props.animateIn && this.props.direction === 'next',
prev: this.props.active && this.props.animateIn && this.props.direction === 'prev'
};
if (this.state.direction && (this.props.animateIn || this.props.animateOut)) {
classes[this.state.direction] = true;
}
return (
<div {...this.props} className={classNames(this.props.className, classes)}>
{this.props.children}
{this.props.caption ? this.renderCaption() : null}
</div>
);
},
renderCaption() {
return (
<div className="carousel-caption">
{this.props.caption}
</div>
);
}
});
export default CarouselItem;
|
3-lifecycle-events/src/TodoList.js | mariusz-malinowski/tutorial-react | import React, { Component } from 'react';
import TodoItem from './TodoItem';
import AddTodo from './AddTodo';
class TodoList extends Component {
constructor(props) {
super(props);
this.state = {
todos: props.todos
};
}
onAddTodo = (todoName) => {
this.setState({
todos: [{
name: todoName,
completed: false
},
...this.state.todos]
});
}
render() {
return (
<div>
<AddTodo onAddTodo={this.onAddTodo} />
<ul>
{this.state.todos.map((todo, index) => <TodoItem key={index} todo={todo}/>)}
</ul>
</div>
);
}
componentWillMount = () => {
console.log('componentWillMount');
}
componentDidMount = () => {
console.log('componentDidMount');
}
componentWillReceiveProps = (nextProps) => {
console.log('componentWillReceiveProps');
// console.log('nextProps: ' + JSON.stringify(nextProps));
}
shouldComponentUpdate = (nextProps, nextState) => {
console.log('shouldComponentUpdate');
// console.log('nextProps: ' + JSON.stringify(nextProps));
// console.log('nextState: ' + JSON.stringify(nextState));
return true;
}
componentWillUpdate = (nextProps, nextState) => {
console.log('componentWillUpdate');
// console.log('nextProps: ' + JSON.stringify(nextProps));
// console.log('nextState: ' + JSON.stringify(nextState));
}
componentDidUpdate = (prevProps, prevState) => {
console.log('componentDidUpdate');
// console.log('prevProps: ' + JSON.stringify(prevProps));
// console.log('prevState: ' + JSON.stringify(prevState));
}
componentWillUnmount = () => {
console.log('componentWillUnmount');
}
}
export default TodoList;
|
react-fundamentals-es6/lessons/06-refs/App.js | 3mundi/React-Bible | // https://jsbin.com/qiwoxax/edit?js,output
import React from 'react';
import ReactDOM from 'react-dom';
class App extends React.Component {
constructor(){
super();
this.state = {
red: 0,
green: 0,
blue: 0
}
this.update = this.update.bind(this)
}
update(e){
this.setState({
red: ReactDOM.findDOMNode(this.refs.red.refs.inp).value,
green: ReactDOM.findDOMNode(this.refs.green.refs.inp).value,
blue: ReactDOM.findDOMNode(this.refs.blue.refs.inp).value
})
}
render(){
return (
<div>
<Slider ref="red" update={this.update} />
{this.state.red}
<br />
<Slider ref="green" update={this.update} />
{this.state.green}
<br />
<Slider ref="blue" update={this.update} />
{this.state.blue}
<br />
</div>
);
}
}
class Slider extends React.Component {
render(){
return (
<div>
<input ref="inp" type="range"
min="0"
max="255"
onChange={this.props.update} />
</div>
);
}
}
export default App
|
app/src/Frontend/modules/mission/components/page/index.js | ptphp/ptphp |
/**
* Created by jf on 15/12/10.
*/
"use strict";
import React from 'react';
var Tappable = require('react-tappable');
import './index.less';
export default React.createClass( {
componentDidMount(){
const {title} = this.props;
Utils.set_site_title(title);
},
render() {
const {title, subTitle, spacing, className, children,goBack,hideHeader} = this.props;
let goBackFunc = ()=>{history.go(-1)};
if(typeof goBack == 'function') goBackFunc = goBack;
//let h_style = Utils.is_weixin_browser() ? {display:"none"}:{};
let h_style = {};
if(hideHeader) h_style.display = "none";
return (
<section className={`page ${className}`}>
<header style={h_style}>
{
goBack ?
<Tappable component="button" onTap={goBackFunc} className="NavigationBarLeftButton has-arrow">
<span className="NavigationBarLeftArrow" ></span>
</Tappable>:null
}
<h1 className="title">{title}</h1>
<Tappable component="button" className="NavigationBarRightButton" />
</header>
<div className={`bd ${spacing ? 'spacing' : ''}`}>
{children}
</div>
</section>
);
}
}); |
packages/react-scripts/fixtures/kitchensink/src/features/webpack/CssInclusion.js | TondaHack/create-react-app | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
import React from 'react';
import './assets/style.css';
export default () => <p id="feature-css-inclusion">We love useless text.</p>;
|
src/style-controls-block.js | ryapapap/draft-editor | import React, { Component } from 'react';
import { EditorState, RichUtils } from 'draft-js';
import { StyleControls } from './style-controls-base';
export default class BlockStyleControls extends Component {
static propTypes = {
editorState: React.PropTypes.instanceOf(EditorState).isRequired,
onChange: React.PropTypes.func.isRequired,
}
toggleBlockType = (type) => {
this.props.onChange(
RichUtils.toggleBlockType(
this.props.editorState,
type
)
);
}
isBlockActive = (type) => {
const selection = this.props.editorState.getSelection();
const blockType = this.props.editorState
.getCurrentContent()
.getBlockForKey(selection.getStartKey())
.getType();
return type === blockType;
}
render() {
return (
<StyleControls
buttons={[
{ icon: 'glyphicon glyphicon-header', style: 'header-two' },
{ icon: 'glyphicon glyphicon-comment', style: 'blockquote' },
{ icon: 'glyphicon glyphicon-list', style: 'unordered-list-item' },
{ icon: 'glyphicon glyphicon-list-alt', style: 'ordered-list-item' },
{ icon: 'glyphicon glyphicon-console', style: 'code-block' },
]}
isActive={this.isBlockActive}
onToggle={this.toggleBlockType}
/>
);
}
}
|
client/src/pages/Home.react.js | wenhao/fixed-asset | import React from 'react'
import {
RaisedButton,
FontIcon,
Paper,
TextField
} from 'material-ui'
import {
State
} from 'react-router'
import userApi from '../services/user'
var Home = React.createClass({
mixins: [State],
getInitialState() {
return {
title: ''
}
},
render() {
return (
<Paper zDepth={1} className="page-auth">
<div className="login-group">
<RaisedButton className="login-button" secondary={true} onClick={this._login}>
<FontIcon className="muidocs-icon-custom-github example-button-icon"/>
<span className="mui-raised-button-label example-icon-button-label">Log in</span>
</RaisedButton>
</div>
</Paper>
)
},
_login(){
this.context.router.transitionTo('login');
}
});
export default Home
|
example/examples/Callouts.js | jiaminglu/react-native-maps | import React from 'react';
import {
StyleSheet,
View,
Text,
Dimensions,
TouchableOpacity,
} from 'react-native';
import MapView from 'react-native-maps';
import CustomCallout from './CustomCallout';
const { width, height } = Dimensions.get('window');
const ASPECT_RATIO = width / height;
const LATITUDE = 31.23295;
const LONGITUDE = 121.3822;
const LATITUDE_DELTA = 0.0922;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;
const SPACE = 0.01;
class Callouts extends React.Component {
constructor(props) {
super(props);
this.state = {
region: {
latitude: LATITUDE,
longitude: LONGITUDE,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
},
markers: [
{
coordinate: {
latitude: LATITUDE + SPACE,
longitude: LONGITUDE + SPACE,
},
},
{
coordinate: {
latitude: LATITUDE,
longitude: LONGITUDE,
},
},
{
coordinate: {
latitude: LATITUDE + SPACE,
longitude: LONGITUDE - SPACE,
},
},
],
};
}
show() {
this.marker1.showCallout();
}
hide() {
this.marker1.hideCallout();
}
render() {
const { region, markers } = this.state;
return (
<View style={styles.container}>
<MapView
provider={this.props.provider}
style={styles.map}
initialRegion={region}
>
<MapView.Marker
ref={ref => { this.marker1 = ref; }}
coordinate={markers[0].coordinate}
title="This is a native view"
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation" // eslint-disable-line max-len
/>
<MapView.Marker
coordinate={markers[1].coordinate}
>
<MapView.Callout style={styles.plainView}>
<View>
<Text>This is a plain view</Text>
</View>
</MapView.Callout>
</MapView.Marker>
<MapView.Marker
coordinate={markers[2].coordinate}
calloutOffset={{ x: -8, y: 28 }}
calloutAnchor={{ x: 0.5, y: 0.4 }}
>
<MapView.Callout tooltip style={styles.customView}>
<CustomCallout>
<Text>This is a custom callout bubble view</Text>
</CustomCallout>
</MapView.Callout>
</MapView.Marker>
</MapView>
<View style={styles.buttonContainer}>
<View style={styles.bubble}>
<Text>Tap on markers to see different callouts</Text>
</View>
</View>
<View style={styles.buttonContainer}>
<TouchableOpacity onPress={() => this.show()} style={[styles.bubble, styles.button]}>
<Text>Show</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.hide()} style={[styles.bubble, styles.button]}>
<Text>Hide</Text>
</TouchableOpacity>
</View>
</View>
);
}
}
Callouts.propTypes = {
provider: MapView.ProviderPropType,
};
const styles = StyleSheet.create({
customView: {
width: 140,
height: 100,
},
plainView: {
width: 60,
},
container: {
...StyleSheet.absoluteFillObject,
justifyContent: 'flex-end',
alignItems: 'center',
},
map: {
...StyleSheet.absoluteFillObject,
},
bubble: {
flex: 1,
backgroundColor: 'rgba(255,255,255,0.7)',
paddingHorizontal: 18,
paddingVertical: 12,
borderRadius: 20,
},
latlng: {
width: 200,
alignItems: 'stretch',
},
button: {
width: 80,
paddingHorizontal: 12,
alignItems: 'center',
marginHorizontal: 10,
},
buttonContainer: {
flexDirection: 'row',
marginVertical: 20,
backgroundColor: 'transparent',
},
});
module.exports = Callouts;
|
src/Parser/Warlock/Demonology/CHANGELOG.js | enragednuke/WoWAnalyzer | import React from 'react';
import { Chizu } from 'MAINTAINERS';
import Wrapper from 'common/Wrapper';
import ItemLink from 'common/ItemLink';
import ITEMS from 'common/ITEMS';
import SPELLS from 'common/SPELLS';
import SpellLink from 'common/SpellLink';
export default [
{
date: new Date('2017-09-30'),
changes: <Wrapper>Added <ItemLink id={ITEMS.KAZZAKS_FINAL_CURSE.id} icon/> and <ItemLink id={ITEMS.WILFREDS_SIGIL_OF_SUPERIOR_SUMMONING.id} icon/> modules.</Wrapper>,
contributors: [Chizu],
},
{
date: new Date('2017-09-30'),
changes: <Wrapper>Added <ItemLink id={ITEMS.WAKENERS_LOYALTY.id} icon/>, <ItemLink id={ITEMS.RECURRENT_RITUAL.id} icon/>, <ItemLink id={ITEMS.SINDOREI_SPITE.id} icon/> modules.</Wrapper>,
contributors: [Chizu],
},
{
date: new Date('2017-09-29'),
changes: <Wrapper>Added T20 set bonuses.</Wrapper>,
contributors: [Chizu],
},
{
date: new Date('2017-09-25'),
changes: <Wrapper>Added rest of the talent modules - <SpellLink id={SPELLS.HAND_OF_DOOM_TALENT.id} icon/>, <SpellLink id={SPELLS.GRIMOIRE_OF_SACRIFICE_TALENT.id} icon/>, <SpellLink id={SPELLS.GRIMOIRE_OF_SYNERGY_TALENT.id} icon/>, <SpellLink id={SPELLS.SUMMON_DARKGLARE_TALENT.id} icon/> and <SpellLink id={SPELLS.DEMONBOLT_TALENT.id} icon/>.</Wrapper>,
contributors: [Chizu],
},
{
date: new Date('2017-09-23'),
changes: <Wrapper>Added second talent row modules - <SpellLink id={SPELLS.IMPENDING_DOOM_TALENT.id} icon/>, <SpellLink id={SPELLS.IMPROVED_DREADSTALKERS_TALENT.id} icon/> and <SpellLink id={SPELLS.IMPLOSION_TALENT.id} icon/>.</Wrapper>,
contributors: [Chizu],
},
{
date: new Date('2017-09-19'),
changes: <Wrapper>Added first talent row modules - <SpellLink id={SPELLS.SHADOWY_INSPIRATION_TALENT.id} icon/>, <SpellLink id={SPELLS.SHADOWFLAME_TALENT.id} icon/> and <SpellLink id={SPELLS.DEMONIC_CALLING_TALENT.id} icon/>.</Wrapper>,
contributors: [Chizu],
},
{
date: new Date('2017-09-19'),
changes: <Wrapper>Added the Soul Shard tracker.</Wrapper>,
contributors: [Chizu],
},
];
|
src/components/CheckoutPane.js | longyarnz/WelFurnish-E-Commerce | import React, { Component } from 'react';
export default class CheckoutPane extends Component {
constructor(props){
super(props);
this._click = this._click.bind(this);
this.state = { pane: "pane", mount: true }
}
_click(){
this.setState({pane: "delete-node"});
setTimeout(()=>this.props.remove(this.props.item), 800);
}
render(){
const { item, reNumber } = this.props;
return !this.state.mount ? null : (
<div className={this.state.pane}>
<aside className="checkout left-checkout">
<div>{item.title}</div>
<div>₦ {reNumber(item.price)} × {item.qty}pcs</div>
</aside>
<aside className="checkout right-checkout">
<div>₦ {reNumber(item.price * item.qty)}</div>
</aside>
<aside className="checkout right-checkout final-checkout" onClick={this._click}>
<div><i className="fa fa-times-circle" /></div>
</aside>
</div>
)
}
}
|
app/containers/HomePage/index.js | jilla720/messidge | /*
* HomePage
*
* This is the first thing users see of our App, at the '/' route
*
* NOTE: while this component should technically be a stateless functional
* component (SFC), hot reloading does not currently support SFCs. If hot
* reloading is not a necessity for you then you can refactor it and remove
* the linting exception.
*/
import React from 'react';
// import Spinner from 'components/Spinner';
import Auth from 'containers/Auth';
import { LandingContainer } from './styled';
export default class HomePage extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<div>
<LandingContainer>
<Auth />
</LandingContainer>
<div>
zhjdkjhdjkjhsd
</div>
</div>
);
}
}
|
docs/src/app/components/pages/components/IconMenu/Page.js | tan-jerene/material-ui | import React from 'react';
import Title from 'react-title-component';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';
import iconMenuReadmeText from './README';
import IconMenuExampleSimple from './ExampleSimple';
import iconMenuExampleSimpleCode from '!raw!./ExampleSimple';
import IconMenuExampleControlled from './ExampleControlled';
import iconMenuExampleControlledCode from '!raw!./ExampleControlled';
import IconMenuExampleScrollable from './ExampleScrollable';
import iconMenuExampleScrollableCode from '!raw!./ExampleScrollable';
import IconMenuExampleNested from './ExampleNested';
import iconMenuExampleNestedCode from '!raw!./ExampleNested';
import iconMenuCode from '!raw!material-ui/IconMenu/IconMenu';
const descriptions = {
simple: 'Simple Icon Menus demonstrating some of the layouts possible using the `anchorOrigin` and `' +
'targetOrigin` properties.',
controlled: 'Three controlled examples, the first allowing a single selection, the second multiple selections,' +
' the third using internal state.',
scrollable: 'The `maxHeight` property limits the height of the menu, above which it will be scrollable.',
nested: 'Example of nested menus within an IconMenu.',
};
const IconMenusPage = () => (
<div>
<Title render={(previousTitle) => `Icon Menu - ${previousTitle}`} />
<MarkdownElement text={iconMenuReadmeText} />
<CodeExample
title="Icon Menu positioning"
description={descriptions.simple}
code={iconMenuExampleSimpleCode}
>
<IconMenuExampleSimple />
</CodeExample>
<CodeExample
title="Controlled Icon Menus"
description={descriptions.controlled}
code={iconMenuExampleControlledCode}
>
<IconMenuExampleControlled />
</CodeExample>
<CodeExample
title="Scrollable Icon Menu"
description={descriptions.scrollable}
code={iconMenuExampleScrollableCode}
>
<IconMenuExampleScrollable />
</CodeExample>
<CodeExample
title="Nested Icon Menus"
description={descriptions.nested}
code={iconMenuExampleNestedCode}
>
<IconMenuExampleNested />
</CodeExample>
<PropTypeDescription code={iconMenuCode} />
</div>
);
export default IconMenusPage;
|
server/frontend/src/index.js | cs472-spots/spots | // src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import { hashHistory } from 'react-router';
import { Provider } from 'nectarine';
// eslint-disable-next-line
import Store from './store/Store.js';
import Routes from './routes/index.js';
import './index.css';
//Renders the components passed by
ReactDOM.render(
<Provider store={Store}>
<Routes history={hashHistory} />
</Provider>,
document.getElementById('root')
);
|
webapp/client/src/TourPage.js | mikemag/MonkeyCAM | /*
* Copyright 2013-2017 Michael M. Magruder (https://github.com/mikemag)
*
* This source code is licensed under the Apache license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import { Grid, Row, Col, Panel, Thumbnail } from 'react-bootstrap';
import example_input_png from './media/Example_Input.png';
import example_results_png from './media/Example_Results.png';
import example_overview_svg from './media/Example_Overview.svg';
import example_core_jpg from './media/Example_Core.jpg';
class TourPage extends Component {
componentDidMount() {
window.scrollTo(0, 0);
}
render() {
return (
<Grid>
<Row>
<Col sm={12}>
<Panel header="How does it work?" bsStyle="primary">
<Row>
<Col sm={12}>
<h3 className="text-center">
Spend time building boards, not fiddling with CAD/CAM
</h3>
<br />
</Col>
</Row>
<Row>
<Col sm={4}>
<Panel>
<h4>1. Design</h4>
Enter your board design, binding layout, and CNC
machine/materials config, then hit Run MonkeyCAM.
</Panel>
</Col>
<Col sm={4}>
<Panel>
<h4>2. Download</h4>
Confirm your design with the Results Overview, then download
a .zip of all the G-Code files.
</Panel>
</Col>
<Col sm={4}>
<Panel>
<h4>3. Build!</h4>
Cut the core, base, and nose/tail fill with your CNC machine
and get building!
</Panel>
</Col>
</Row>
<Row>
<Col sm={8} smOffset={2}>
<br />
<p className="text-center">
MonkeyCAM creates nine G-Code programs to cut all parts of a
ski or snowboard on your CNC machine. For a real example of
the results, see{' '}
<span style={{ wordWrap: 'break-word' }}>
<a href="https://monkeycam.org/results/5744863563743232">
https://monkeycam.org/results/5744863563743232
</a>
</span>
</p>
<br />
</Col>
</Row>
</Panel>
</Col>
</Row>
<Row>
<Col sm={10} smOffset={1}>
<Panel>
<img
style={{ maxWidth: '100%' }}
src={example_input_png}
alt="Example MonkeyCAM Input"
/>
<h3>Design</h3>
<p>
Enter your board design, binding layout, and machine/materials
configuration in JSON format. Start with a sample ski,
snowboard, or splitboard to make it easier.
</p>
<p>
When you're ready, hit Run MonkeyCAM. The results will be ready
in seconds.
</p>
</Panel>
</Col>
</Row>
<Row>
<Col sm={10} smOffset={1}>
<Panel>
<center>
<img
style={{ maxWidth: '100%' }}
src={example_results_png}
alt="Example MonkeyCAM Results"
/>
</center>
<img
width={'100%'}
src={example_overview_svg}
alt="Example MonkeyCAM Overview"
/>
<h3>Download</h3>
<p>
Check your output in the Results Overview, which shows the
overall shape of the board and core, and a 2D visualization of
every G-Code program. If you need to make adjustments, hit
'Change Design and Run Again' and tweak your design.
</p>
<p>
When you're happy with the results, download a .zip of all of
the G-Code files. These are kept in permanent storage at Google,
so you can always go back and get them again.
</p>
</Panel>
</Col>
</Row>
<Row>
<Col sm={10} smOffset={1}>
<Thumbnail style={{ maxWidth: '100%' }} src={example_core_jpg}>
<h3>Build!</h3>
<p>
You get G-Code programs to cut the base, nose & tail spacers,
and the core. Cut the parts with your CNC machine, and they'll
all fit together perfectly!
</p>
<p>
You'll be able to spend your time building boards and riding
them.
</p>
</Thumbnail>
</Col>
</Row>
</Grid>
);
}
}
export default TourPage;
|
classic/src/scenes/wbfa/generated/FARBolt.pro.js | wavebox/waveboxapp | import React from 'react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faBolt } from '@fortawesome/pro-regular-svg-icons/faBolt'
export default class FARBolt extends React.Component {
render () {
return (<FontAwesomeIcon {...this.props} icon={faBolt} />)
}
}
|
packages/vulcan-i18n/lib/modules/message.js | VulcanJS/Vulcan | import React, { Component } from 'react';
import { intlShape } from './shape';
import { registerComponent } from 'meteor/vulcan:lib';
const FormattedMessage = ({ id, values, defaultMessage = '', html = false, className = '' }, { intl }) => {
let message = intl.formatMessage({ id, defaultMessage }, values);
const cssClass = `i18n-message ${className}`;
// if message is empty, use [id]
if (message === '') {
message = `[${id}]`;
}
return html ?
<span data-key={id} className={cssClass} dangerouslySetInnerHTML={{__html: message}}/> :
<span data-key={id} className={cssClass}>{message}</span>;
};
FormattedMessage.contextTypes = {
intl: intlShape
};
registerComponent('FormattedMessage', FormattedMessage);
export default FormattedMessage; |
src/TPA/Label/Label.js | skyiea/wix-style-react | import React from 'react';
import {string} from 'prop-types';
import classNames from 'classnames';
import WixComponent from '../../BaseComponents/WixComponent';
import tpaStyleInjector from '../TpaStyleInjector';
let styles = {locals: {}};
try {
styles = require('!css-loader?modules&camelCase&localIdentName="[path][name]__[local]__[hash:base64:5]"!sass-loader!./Label.scss');
} catch (e) {
}
class Label extends WixComponent {
static propTypes = {
LabelClassName: string
};
static defaultProps = {
LabelClassName: ''
};
constructor(props) {
super(props);
//Used for testing enviorment, to mock the styles
//TODO: remove this line once css loader mock solution will be found
styles = props.styles || styles;
}
render() {
return <label className={classNames(styles.locals.label, this.props.labelClassName)} htmlFor={this.props.for}>{this.props.children}</label>;
}
}
Label.displayName = 'Label';
export default tpaStyleInjector(Label, styles);
|
src/components/views/globals/NewVersionBar.js | martindale/vector | /*
Copyright 2015, 2016 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
'use strict';
import React from 'react';
import sdk from 'matrix-react-sdk';
import Modal from 'matrix-react-sdk/lib/Modal';
import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
import { _t } from 'matrix-react-sdk/lib/languageHandler';
/**
* Check a version string is compatible with the Changelog
* dialog ([vectorversion]-react-[react-sdk-version]-js-[js-sdk-version])
*/
function checkVersion(ver) {
const parts = ver.split('-');
return parts.length == 5 && parts[1] == 'react' && parts[3] == 'js';
}
export default React.createClass({
propTypes: {
version: React.PropTypes.string.isRequired,
newVersion: React.PropTypes.string.isRequired,
releaseNotes: React.PropTypes.string,
},
displayReleaseNotes: function(releaseNotes) {
const QuestionDialog = sdk.getComponent('dialogs.QuestionDialog');
Modal.createTrackedDialog('Display release notes', '', QuestionDialog, {
title: _t("What's New"),
description: <pre className="changelog_text">{releaseNotes}</pre>,
button: _t("Update"),
onFinished: (update) => {
if(update && PlatformPeg.get()) {
PlatformPeg.get().installUpdate();
}
}
});
},
displayChangelog: function() {
const ChangelogDialog = sdk.getComponent('dialogs.ChangelogDialog');
Modal.createTrackedDialog('Display Changelog', '', ChangelogDialog, {
version: this.props.version,
newVersion: this.props.newVersion,
onFinished: (update) => {
if(update && PlatformPeg.get()) {
PlatformPeg.get().installUpdate();
}
}
});
},
onUpdateClicked: function() {
PlatformPeg.get().installUpdate();
},
render: function() {
let action_button;
// If we have release notes to display, we display them. Otherwise,
// we display the Changelog Dialog which takes two versions and
// automatically tells you what's changed (provided the versions
// are in the right format)
if (this.props.releaseNotes) {
action_button = (
<button className="mx_MatrixToolbar_action" onClick={this.displayReleaseNotes}>
{ _t("What's new?") }
</button>
);
} else if (checkVersion(this.props.version) && checkVersion(this.props.newVersion)) {
action_button = (
<button className="mx_MatrixToolbar_action" onClick={this.displayChangelog}>
{ _t("What's new?") }
</button>
);
} else if (PlatformPeg.get()) {
action_button = (
<button className="mx_MatrixToolbar_action" onClick={this.onUpdateClicked}>
{ _t("Update") }
</button>
);
}
return (
<div className="mx_MatrixToolbar">
<img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="Warning"/>
<div className="mx_MatrixToolbar_content">
{_t("A new version of Riot is available.")}
</div>
{action_button}
</div>
);
}
});
|
app/javascript/mastodon/features/blocks/index.js | amazedkoumei/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']),
});
@connect(mapStateToProps)
@injectIntl
export default class Blocks extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
shouldUpdateScroll: PropTypes.func,
accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired,
};
componentWillMount () {
this.props.dispatch(fetchBlocks());
}
handleLoadMore = debounce(() => {
this.props.dispatch(expandBlocks());
}, 300, { leading: true });
render () {
const { intl, accountIds, shouldUpdateScroll } = 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}
shouldUpdateScroll={shouldUpdateScroll}
emptyMessage={emptyMessage}
>
{accountIds.map(id =>
<AccountContainer key={id} id={id} />
)}
</ScrollableList>
</Column>
);
}
}
|
lib/component.js | bekher/hyperterm | import React from 'react';
import { StyleSheet, css } from 'aphrodite-simple';
import { shouldComponentUpdate } from 'react-addons-pure-render-mixin';
export default class Component extends React.Component {
constructor () {
super();
this.styles_ = this.createStyleSheet();
this.cssHelper = this.cssHelper.bind(this);
if (!this.shouldComponentUpdate) {
this.shouldComponentUpdate = shouldComponentUpdate.bind(this);
}
}
createStyleSheet () {
if (!this.styles) {
return {};
}
const styles = this.styles();
if ('object' !== typeof styles) {
throw new TypeError('Component `styles` returns a non-object');
}
return StyleSheet.create(this.styles());
}
// wrap aphrodite's css helper for two reasons:
// - we can give the element an unaltered global classname
// that can be used to introduce global css side effects
// for example, through the configuration, web inspector
// or user agent extensions
// - the user doesn't need to keep track of both `css`
// and `style`, and we make that whole ordeal easier
cssHelper (...args) {
const classes = args
.map((c) => {
if (c) {
// we compute the global name from the given
// css class and we prepend the component name
// it's important classes never get mangled by
// uglifiers so that we can avoid collisions
const component = this.constructor.name
.toString()
.toLowerCase();
const globalName = `${component}_${c}`;
return [globalName, css(this.styles_[c])];
}
})
// skip nulls
.filter((v) => !!v)
// flatten
.reduce((a, b) => a.concat(b));
return classes.length ? classes.join(' ') : null;
}
render () {
// convert static objects from `babel-plugin-transform-jsx`
// to `React.Element`.
if (!this.template) {
throw new TypeError("Component doesn't define `template`");
}
// invoke the template creator passing our css helper
return this.template(this.cssHelper);
}
}
|
test/components/Markdown-test.js | primozs/grommet | // (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP
import {test} from 'tape';
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import Markdown from '../../src/js/components/Markdown';
test('loads a paragraph Markdown', (t) => {
t.plan(3);
const shallowRenderer = TestUtils.createRenderer();
shallowRenderer.render(React.createElement(Markdown, {
content: 'test',
components: {
p: {
props: {
className: 'testing',
size: 'large'
}
}
}
}));
const markdownElement = shallowRenderer.getRenderOutput();
t.equal(
markdownElement.props.children.length, 1,
'Markdown has one children'
);
const paragraph = markdownElement.props.children[0];
if (paragraph.props.className.indexOf('testing') > -1) {
t.pass('Markdown paragraph has custom class');
} else {
t.fail('Markdown paragraph does not have custom class');
}
t.equal(paragraph.props.size, 'large', 'Markdown paragraph is large');
});
|
app/containers/LanguageProvider/index.js | shafeeqonline/xt-quiz-app | /*
*
* LanguageProvider
*
* this component connects the redux state language locale to the
* IntlProvider component and i18n messages (loaded from `app/translations`)
*/
import React from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { IntlProvider } from 'react-intl';
import { makeSelectLocale } from './selectors';
export class LanguageProvider extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}>
{React.Children.only(this.props.children)}
</IntlProvider>
);
}
}
LanguageProvider.propTypes = {
locale: React.PropTypes.string,
messages: React.PropTypes.object,
children: React.PropTypes.element.isRequired,
};
const mapStateToProps = createSelector(
makeSelectLocale(),
(locale) => ({ locale })
);
function mapDispatchToProps(dispatch) {
return {
dispatch,
};
}
export default connect(mapStateToProps, mapDispatchToProps)(LanguageProvider);
|
docs/src/sections/TransitionSection.js | mmarcant/react-bootstrap | import React from 'react';
import Anchor from '../Anchor';
import PropTable from '../PropTable';
import ReactPlayground from '../ReactPlayground';
import Samples from '../Samples';
export default function TransitionSection() {
return (
<div className="bs-docs-section">
<h2 className="page-header">
<Anchor id="transitions">Transitions</Anchor> <small>Collapse, Fade</small>
</h2>
<p>Transition components animate their children transitioning in and out.</p>
<h3>
<Anchor id="transitions-collapse">Collapse</Anchor>
</h3>
<p>Add a collapse toggle animation to an element or component.</p>
<div className="bs-callout bs-callout-info">
<h4>Smoothing animations</h4>
<p>
If you're noticing choppy animations,
and the component that's being collapsed
has non-zero margin or padding,
try wrapping the contents
of your <code><Collapse></code>
{" "}inside a node with no margin or padding,
like the <code><div></code> in the example below.
This will allow the height to be computed properly,
so the animation can proceed smoothly.
</p>
</div>
<ReactPlayground codeText={Samples.Collapse} />
<h4><Anchor id="transitions-collapse-props">Props</Anchor></h4>
<PropTable component="Collapse"/>
<h3>
<Anchor id="transitions-fade">Fade</Anchor>
</h3>
<p>Add a fade animation to a child element or component.</p>
<ReactPlayground codeText={Samples.Fade} />
<h4><Anchor id="transitions-fade-props">Props</Anchor></h4>
<PropTable component="Fade"/>
</div>
);
}
|
fluxArchitecture/src/js/main.js | 3mundi/React-Bible | import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/app'
ReactDOM.render(<App />, document.getElementById('main'));
|
src/BootstrapMixin.js | kwnccc/react-bootstrap | import React from 'react';
import styleMaps from './styleMaps';
import CustomPropTypes from './utils/CustomPropTypes';
const BootstrapMixin = {
propTypes: {
/**
* bootstrap className
* @private
*/
bsClass: CustomPropTypes.keyOf(styleMaps.CLASSES),
/**
* Style variants
* @type {("default"|"primary"|"success"|"info"|"warning"|"danger"|"link")}
*/
bsStyle: React.PropTypes.oneOf(styleMaps.STYLES),
/**
* Size variants
* @type {("xsmall"|"small"|"medium"|"large"|"xs"|"sm"|"md"|"lg")}
*/
bsSize: CustomPropTypes.keyOf(styleMaps.SIZES)
},
getBsClassSet() {
let classes = {};
let bsClass = this.props.bsClass && styleMaps.CLASSES[this.props.bsClass];
if (bsClass) {
classes[bsClass] = true;
let prefix = bsClass + '-';
let bsSize = this.props.bsSize && styleMaps.SIZES[this.props.bsSize];
if (bsSize) {
classes[prefix + bsSize] = true;
}
if (this.props.bsStyle) {
if (styleMaps.STYLES.indexOf(this.props.bsStyle) >= 0) {
classes[prefix + this.props.bsStyle] = true;
} else {
classes[this.props.bsStyle] = true;
}
}
}
return classes;
},
prefixClass(subClass) {
return styleMaps.CLASSES[this.props.bsClass] + '-' + subClass;
}
};
export default BootstrapMixin;
|
web/react/src/client/pages/BadOS/BadOS.js | JamesMillercus/Portfolio-Website | import React, { Component } from 'react';
import Error from './../../components/locs/Error/Error';
class BadOS extends Component {
render() {
/** LOGIC FOR DISPLAYING CONTENT CORRECLTY ON DEVICE + BROWSER **/
const htext = "This website can't be displayed on old devices";
const ptext = 'Please update your device so it is running either iOS version 10.3 or Android version 4 (or higher). Alternatively please view this site on a newer device.';
return <Error header={htext} paragraph={ptext} />;
}
}
// take props from admins and pass them into require Auth
export default BadOS;
|
docs/src/stories/SubComponents.js | byumark/react-table | /* eslint-disable import/no-webpack-loader-syntax */
import React from 'react'
import _ from 'lodash'
import namor from 'namor'
import ReactTable from '../../../lib/index'
class Story extends React.PureComponent {
constructor (props) {
super(props)
const data = _.map(_.range(5553), d => {
return {
firstName: namor.generate({words: 1, numLen: 0}),
lastName: namor.generate({words: 1, numLen: 0}),
age: Math.floor(Math.random() * 30)
}
})
this.state = {
tableOptions: {
loading: false,
showPagination: true,
showPageSizeOptions: true,
showPageJump: true,
collapseOnSortingChange: true,
collapseOnPageChange: true,
collapseOnDataChange: true,
freezeWhenExpanded: false,
filterable: false,
sortable: true,
resizable: true
},
data: data
}
this.setTableOption = this.setTableOption.bind(this)
}
render () {
const columns = [{
Header: 'Name',
columns: [{
Header: 'First Name',
accessor: 'firstName'
}, {
Header: 'Last Name',
id: 'lastName',
accessor: d => d.lastName
}]
}, {
Header: 'Info',
columns: [{
Header: 'Age',
accessor: 'age'
}]
}]
return (
<div>
<div>
<h1>Table Options</h1>
<table>
<tbody>
{
Object.keys(this.state.tableOptions).map(optionKey => {
const optionValue = this.state.tableOptions[optionKey]
return (
<tr key={optionKey}>
<td>{optionKey}</td>
<td style={{paddingLeft: 10, paddingTop: 5}}>
<input type='checkbox'
name={optionKey}
checked={optionValue}
onChange={this.setTableOption}
/>
</td>
</tr>
)
})
}
</tbody>
</table>
</div>
<div className='table-wrap'>
<ReactTable
className='-striped -highlight'
data={this.state.data}
columns={columns}
defaultPageSize={10}
{...this.state.tableOptions}
SubComponent={(row) => {
return (
<div style={{padding: '20px'}}>
<em>You can put any component you want here, even another React Table!</em>
<br />
<br />
<ReactTable
data={this.state.data}
columns={columns}
defaultPageSize={3}
showPagination={false}
SubComponent={(row) => {
return (
<div style={{padding: '20px'}}>
<em>It even has access to the row data: </em>
<CodeHighlight>{() => JSON.stringify(row, null, 2)}</CodeHighlight>
</div>
)
}}
/>
</div>
)
}}
/>
</div>
<div style={{textAlign: 'center'}}>
<br />
<em>Tip: Hold shift when sorting to multi-sort!</em>
</div>
</div>
)
}
setTableOption (event) {
const target = event.target
const value = target.type === 'checkbox' ? target.checked : target.value
const name = target.name
this.setState({
tableOptions: {
...this.state.tableOptions,
[name]: value
}
})
}
}
// Source Code
const CodeHighlight = require('./components/codeHighlight').default
const source = require('!raw!./SubComponents')
export default () => (
<div>
<Story />
<CodeHighlight>{() => source}</CodeHighlight>
</div>
)
|
web/src/modules/icons/Museum.js | HobartMakers/DigitalWalkingTours | import React from 'react'
const MuseumIcon = props => <svg
width="15px" height="15px"
viewBox="0 0 15 15"
style={{enableBackground: 'new 0 0 15 15',}}
{...props}
>
<path id="path7509" d="M7.5,0L1,3.4453V4h13V3.4453L7.5,0z M2,5v5l-1,1.5547V13h13v-1.4453L13,10
V5H2z M4.6152,6c0.169-0.0023,0.3318,0.0639,0.4512,0.1836L7.5,8.6172l2.4336-2.4336c0.2445-0.2437,0.6402-0.2432,0.884,0.0013
C10.9341,6.3017,10.9997,6.46,11,6.625v4.2422c0.0049,0.3452-0.271,0.629-0.6162,0.6338c-0.3452,0.0049-0.629-0.271-0.6338-0.6162
c-0.0001-0.0059-0.0001-0.0118,0-0.0177V8.1328L7.9414,9.9414c-0.244,0.2433-0.6388,0.2433-0.8828,0L5.25,8.1328v2.7344
c0.0049,0.3452-0.271,0.629-0.6162,0.6338C4.2887,11.5059,4.0049,11.2301,4,10.8849c-0.0001-0.0059-0.0001-0.0118,0-0.0177V6.625
C4,6.2836,4.2739,6.0054,4.6152,6z"/>
</svg>
export default MuseumIcon
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.