This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| // Usage: | |
| // | |
| // @Stateful({ | |
| // initialize(props) { | |
| // return { | |
| // count: 0 | |
| // }; | |
| // }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { configureDragDrop, configureDragDropContext } from 'react-dnd'; | |
| import HTML5Backend from 'react-dnd/modules/backends/HTML5'; | |
| // Note: @configureDragDropContext is called a “decorator”. | |
| // This desugars roughly as class App { ... } App = configureDragDropContext(HTML5Backend)(App); | |
| // You can enable decorators by putting { "stage": 1 } in your .babelrc. | |
| @configureDragDropContext(HTML5Backend) | |
| export default class App extends React.Component { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default { | |
| getInitialState() { | |
| const data = {}; | |
| this.subscribe(this.props, this.context, (key, value) => { | |
| data[key] = value; | |
| }); | |
| this.unsubscribe(); | |
| return { data }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let BlogPostPage = React.createClass({ | |
| render() { | |
| <div> | |
| <SiteNavigation /> | |
| <MainContentArea> | |
| {connectToStores({ | |
| posts: store => ({ | |
| post: store.getPost(this.props.postId), | |
| nextPost: store.getPostAfter(this.props.postId) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var { union, find, without, clone } = require('underscore'), | |
| invariant = require('react/lib/invariant'); | |
| class PaginatedList { | |
| constructor(ids) { | |
| this._ids = ids || []; | |
| this._pageCount = 0; | |
| this._nextPageUrl = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var React = require('react'), | |
| PureRenderMixin = require('../mixins/PureRenderMixin'), | |
| getSupportedTransformProperty = require('../utils/getSupportedTransformProperty'), | |
| { PropTypes, Children } = React; | |
| const transformProperty = getSupportedTransformProperty(); | |
| const styles = { | |
| root: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var TRANSFORM_VARIANTS = { | |
| 'WebkitTransform': '-webkit-transform', | |
| 'Transform': 'transform' | |
| }; | |
| function test() { | |
| var testEl = document.createElement('div'), | |
| style = testEl.style; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var ScreenSizeStore = require('../stores/ScreenSizeStore'); | |
| var ScreenSizeMixin = { | |
| getInitialState() { | |
| return this.getScreenSizeState(); | |
| }, | |
| getScreenSize() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var AppDispatcher = require('../dispatcher/AppDispatcher'), | |
| ActionTypes = require('../constants/ActionTypes'), | |
| ScreenSizes = require('../constants/ScreenSizes'), | |
| { createStore } = require('../utils/StoreUtils'); | |
| function getScreenSize() { | |
| if (window.matchMedia('(min-width: 100em)').matches) { | |
| return ScreenSizes.EXTRA_LARGE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| /** | |
| * Adapted from https://github.com/Khan/react-components/blob/master/js/timeout-transition-group.jsx | |
| * with the following additions: | |
| * | |
| * - Use BEM-ish modifiers (--enter, --enter--active, --leave, --leave--active) | |
| * - Work better with rAF batching strategy (see https://github.com/facebook/react/issues/2292) | |
| * | |
| * The CSSTransitionGroup component uses the 'transitionend' event, which |