How to use create-react-class - 10 common examples

To help you get started, we’ve selected a few create-react-class examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github getsentry / sentry / src / sentry / static / sentry / app / views / organizationTeams / allTeamsRow.jsx View on Github external
import PropTypes from 'prop-types';
import React from 'react';
import createReactClass from 'create-react-class';
import {Link} from 'react-router';

import ApiMixin from 'app/mixins/apiMixin';
import IndicatorStore from 'app/stores/indicatorStore';
import {joinTeam, leaveTeam} from 'app/actionCreators/teams';
import {t} from 'app/locale';

// TODO(dcramer): this isnt great UX

const AllTeamsRow = createReactClass({
  displayName: 'AllTeamsRow',

  propTypes: {
    access: PropTypes.object.isRequired,
    organization: PropTypes.object.isRequired,
    team: PropTypes.object.isRequired,
    openMembership: PropTypes.bool.isRequired,
  },

  mixins: [ApiMixin],

  getInitialState() {
    return {
      loading: false,
      error: false,
    };
github TerriaJS / terriajs / lib / ReactViews / Map / TerriaViewerWrapper.jsx View on Github external
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

import Cartesian2 from 'terriajs-cesium/Source/Core/Cartesian2';
import Styles from './terria-viewer-wrapper.scss';

import Splitter from './Splitter';
import ObserveModelMixin from '../ObserveModelMixin';
import TerriaViewer from '../../ViewModels/TerriaViewer';

const TerriaViewerWrapper = createReactClass({
    displayName: 'TerriaViewerWrapper',
    mixins: [ObserveModelMixin],

    lastMouseX: -1,
    lastMouseY: -1,

    propTypes: {
        terria: PropTypes.object.isRequired,
        viewState: PropTypes.object.isRequired
    },

    componentDidMount() {
        // Create the map/globe.
        this.terriaViewer = TerriaViewer.create(this.props.terria, {
            terrain: this.props.terria.configParameters.cesiumTerrainUrl,
            developerAttribution: {
github getsentry / sentry / src / sentry / static / sentry / app / views / groupDetails / project / groupEvents.jsx View on Github external
getQueryStringWithoutEnvironment,
} from 'app/utils/queryString';
import {setActiveEnvironmentName} from 'app/actionCreators/environments';
import {t, tct} from 'app/locale';
import withApi from 'app/utils/withApi';
import EmptyStateWarning from 'app/components/emptyStateWarning';
import EventsTable from 'app/components/eventsTable/eventsTable';
import LoadingError from 'app/components/loadingError';
import LoadingIndicator from 'app/components/loadingIndicator';
import Pagination from 'app/components/pagination';
import SearchBar from 'app/components/searchBar';
import SentryTypes from 'app/sentryTypes';
import parseApiError from 'app/utils/parseApiError';
import withEnvironmentInQueryString from 'app/utils/withEnvironmentInQueryString';

const GroupEvents = createReactClass({
  displayName: 'GroupEvents',

  propTypes: {
    api: PropTypes.object,
    group: SentryTypes.Group,
    environment: SentryTypes.Environment,
  },

  getInitialState() {
    const queryParams = this.props.location.query;

    const initialState = {
      eventList: [],
      loading: true,
      error: false,
      pageLinks: '',
github getsentry / sentry / src / sentry / static / sentry / app / views / settings / account / accountAvatar.jsx View on Github external
import createReactClass from 'create-react-class';
import styled from 'react-emotion';

import {addErrorMessage, addSuccessMessage} from 'app/actionCreators/indicator';
import {t} from 'app/locale';
import withApi from 'app/utils/withApi';
import Avatar from 'app/components/avatar';
import AvatarCropper from 'app/components/avatarCropper';
import LoadingError from 'app/components/loadingError';
import LoadingIndicator from 'app/components/loadingIndicator';
import {Panel, PanelBody, PanelHeader} from 'app/components/panels';
import RadioGroup from 'app/views/settings/components/forms/controls/radioGroup';
import SentryTypes from 'app/sentryTypes';
import Well from 'app/components/well';

const AccountAvatar = createReactClass({
  displayName: 'AccountAvatar',

  propTypes: {
    api: PropTypes.object,
    userId: PropTypes.number,
    user: SentryTypes.User,
    onSave: PropTypes.func,
  },

  getDefaultProps() {
    return {
      onSave: () => {},
    };
  },

  getInitialState() {
github airbus-cyber / graylog-plugin-alert-wizard / src / web / wizard / CreateAlertInput.jsx View on Github external
grouping_fields: [],
            distinction_fields: [],
            field: '',
            type: ''
        },
        stream: {
            matching_type: '',
            field_rule: [{field: '', type: '', value: ''}],
        },
        second_stream: {
            matching_type: '',
            field_rule: [{field: '', type: '', value: ''}],
        },
    };

const CreateAlertInput = createReactClass({
    displayName: 'CreateAlertInput',

    propTypes: {
        alert: PropTypes.object,
        create: PropTypes.bool.isRequired,
    },
    contextTypes: {
        intl: PropTypes.object.isRequired,
    },
    componentWillMount(){
        const messages = {
                titlePopup: this.context.intl.formatMessage({id: "wizard.titlePopup", defaultMessage: "Alert rule is saved"}),
                messagePopup: this.context.intl.formatMessage({id: "wizard.messagePopup", defaultMessage: "Go to Advanced settings?"}),
                advancedSettings: this.context.intl.formatMessage({id: "wizard.advancedSettings", defaultMessage: "Advanced settings"}),
                done: this.context.intl.formatMessage({id: "wizard.done", defaultMessage: "I'm done!"}),
                placeholderTitle: this.context.intl.formatMessage({id: "wizard.placeholderTitle", defaultMessage: "Title of the alert rule                 "}),
github lore / lore / packages / lore-auth / src / generators / AuthenticationGenerator.js View on Github external
return function (DecoratedComponent) {
    const decoratorDisplayName = options.displayName || 'UserIsAuthenticated';
    const displayName = getDisplayName(DecoratedComponent);

    return createReactClass(_.defaults({}, options, {
      displayName: `${decoratorDisplayName}(${displayName})`,

      propTypes: {
        router: PropTypes.object.isRequired
      },

      componentWillMount() {
        const isAuthenticated = this.isAuthenticated();

        if (!isAuthenticated) {
          this.redirect();
        }

        this.setState({
          isAuthenticated: isAuthenticated
        });
github reach / router / examples / react-router-v3-compat / src / master-detail / app.js View on Github external
render() {
    return (
      <form onSubmit={this.createContact}>
        <p>
          <input type="text" ref="first" placeholder="First name" />
          <input type="text" ref="last" placeholder="Last name" />
        </p>
        <p>
          <button type="submit">Save</button> <Link to="/">Cancel</Link>
        </p>
      </form>
    );
  }
});

const NotFound = createReactClass({
  render() {
    return <h2>Not found</h2>;
  }
});

render(
  <Router history={browserHistory}>
    <Route path="/" component={App}>
      <IndexRoute component={Index} />
      <Route path="contact/new" component={NewContact} />
      <Route path="contact/:id" component={Contact} />
      <Route path="*" component={NotFound} />
    </Route>
  </Router>,
  document.getElementById("root")
);
github Graylog2 / graylog2-server / graylog2-web-interface / src / views / components / views / ViewList.jsx View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import { ButtonToolbar, DropdownButton, MenuItem } from 'components/graylog';

import { PaginatedList, SearchForm, Spinner, EntityList } from 'components/common';
import View from './View';

const ViewList = createReactClass({
  propTypes: {
    views: PropTypes.arrayOf(PropTypes.object),
    pagination: PropTypes.shape({
      total: PropTypes.number.isRequired,
      page: PropTypes.number.isRequired,
      perPage: PropTypes.number.isRequired,
    }).isRequired,
    handleSearch: PropTypes.func.isRequired,
    handleViewDelete: PropTypes.func.isRequired,
  },

  getDefaultProps() {
    return {
      views: undefined,
    };
  },
github Graylog2 / graylog2-server / graylog2-web-interface / src / components / dashboard / AddToDashboardMenu.jsx View on Github external
import Immutable from 'immutable';

import CombinedProvider from 'injection/CombinedProvider';
import StoreProvider from 'injection/StoreProvider';

import PermissionsMixin from 'util/PermissionsMixin';
import { WidgetCreationModal } from 'components/widgets';
import { EditDashboardModal } from 'components/dashboard';

import style from './AddToDashboardMenu.css';

const SearchStore = StoreProvider.getStore('Search');
const { DashboardsStore } = CombinedProvider.get('Dashboards');
const WidgetsStore = StoreProvider.getStore('Widgets');

const AddToDashboardMenu = createReactClass({
  displayName: 'AddToDashboardMenu',

  propTypes: {
    widgetType: PropTypes.string.isRequired,
    title: PropTypes.string.isRequired,
    permissions: PropTypes.arrayOf(PropTypes.string).isRequired,
    bsStyle: PropTypes.string,
    configuration: PropTypes.object,
    fields: PropTypes.array,
    hidden: PropTypes.bool,
    pullRight: PropTypes.bool,
    appendMenus: PropTypes.oneOfType([
      PropTypes.arrayOf(PropTypes.element),
      PropTypes.element,
    ]),
    children: PropTypes.oneOfType([
github TerriaJS / terriajs / lib / ReactViews / Loader.jsx View on Github external
"use strict";
import ObserveModelMixin from "./ObserveModelMixin";
import React from "react";
import createReactClass from "create-react-class";
import PropTypes from "prop-types";
import Icon from "./Icon.jsx";

import Styles from "./loader.scss";

const Loader = createReactClass({
  displayName: "Loader",
  mixins: [ObserveModelMixin],

  getDefaultProps() {
    return {
      className: "",
      message: "Loading..."
    };
  },

  propTypes: {
    message: PropTypes.string,
    className: PropTypes.string
  },

  render() {

create-react-class

Legacy API for creating React components.

MIT
Latest version published 2 years ago

Package Health Score

88 / 100
Full package analysis

Popular create-react-class functions