How to use the react-router-dom.withRouter.propTypes function in react-router-dom

To help you get started, we’ve selected a few react-router-dom 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 cncjs / cncjs / src / app / containers / Header / Header.jsx View on Github external
const releases = 'https://github.com/cncjs/cncjs/releases';

const newUpdateAvailableTooltip = () => {
    return (
        
            <div>{i18n._('New update available')}</div>
        
    );
};

class Header extends PureComponent {
    static propTypes = {
        ...withRouter.propTypes
    };

    state = this.getInitialState();

    actions = {
        requestPushPermission: () =&gt; {
            const onGranted = () =&gt; {
                this.setState({ pushPermission: Push.Permission.GRANTED });
            };
            const onDenied = () =&gt; {
                this.setState({ pushPermission: Push.Permission.DENIED });
            };
            // Note that if "Permission.DEFAULT" is returned, no callback is executed
            const permission = Push.Permission.request(onGranted, onDenied);
            if (permission === Push.Permission.DEFAULT) {
                this.setState({ pushPermission: Push.Permission.DEFAULT });
github cncjs / cncjs / src / app / containers / Workspace / Workspace.jsx View on Github external
const WAIT = '%wait';

const startWaiting = () =&gt; {
    // Adds the 'wait' class to 
    const root = document.documentElement;
    root.classList.add('wait');
};
const stopWaiting = () =&gt; {
    // Adds the 'wait' class to 
    const root = document.documentElement;
    root.classList.remove('wait');
};

class Workspace extends PureComponent {
    static propTypes = {
        ...withRouter.propTypes
    };

    state = {
        mounted: false,
        port: '',
        modal: {
            name: MODAL_NONE,
            params: {}
        },
        isDraggingFile: false,
        isDraggingWidget: false,
        isUploading: false,
        showPrimaryContainer: store.get('workspace.container.primary.show'),
        showSecondaryContainer: store.get('workspace.container.secondary.show'),
        inactiveCount: _.size(widgetManager.getInactiveWidgets())
    };
github cncjs / cncjs / src / app / containers / Settings / Settings.jsx View on Github external
import Workspace from './Workspace';
import MachineProfiles from './MachineProfiles';
import UserAccounts from './UserAccounts';
import Controller from './Controller';
import Commands from './Commands';
import Events from './Events';
import About from './About';
import styles from './index.styl';

const mapSectionPathToId = (path = '') =&gt; {
    return _camelCase(path.split('/')[0] || '');
};

class Settings extends PureComponent {
    static propTypes = {
        ...withRouter.propTypes
    };

    sections = [
        {
            id: 'general',
            path: 'general',
            title: i18n._('General'),
            component: (props) =&gt; 
        },
        {
            id: 'workspace',
            path: 'workspace',
            title: i18n._('Workspace'),
            component: (props) =&gt; 
        },
        {
github cncjs / cncjs / src / app / containers / Login / Login.jsx View on Github external
import React, { PureComponent } from 'react';
import { withRouter, Redirect } from 'react-router-dom';
import Anchor from 'app/components/Anchor';
import { Notification } from 'app/components/Notifications';
import Space from 'app/components/Space';
import settings from 'app/config/settings';
import controller from 'app/lib/controller';
import i18n from 'app/lib/i18n';
import log from 'app/lib/log';
import * as user from 'app/lib/user';
import store from 'app/store';
import styles from './index.styl';

class Login extends PureComponent {
    static propTypes = {
        ...withRouter.propTypes
    };

    state = this.getDefaultState();

    actions = {
        showAlertMessage: (msg) => {
            this.setState({ alertMessage: msg });
        },
        clearAlertMessage: () => {
            this.setState({ alertMessage: '' });
        },
        handleSignIn: (event) => {
            event.preventDefault();

            this.setState({
                alertMessage: '',
github cncjs / cncjs / src / app / components / ProtectedRoute / index.jsx View on Github external
return (
                
            );
        }}
    /&gt;
);

ProtectedRoute.propTypes = {
    ...withRouter.propTypes
};

export default ProtectedRoute;
github cncjs / cncjs / src / app / containers / App.jsx View on Github external
import React, { PureComponent } from 'react';
import { Redirect, withRouter } from 'react-router-dom';
import { trackPage } from '../lib/analytics';
import Header from './Header';
import Sidebar from './Sidebar';
import Workspace from './Workspace';
import Settings from './Settings';
import styles from './App.styl';

class App extends PureComponent {
    static propTypes = {
        ...withRouter.propTypes
    };

    render() {
        const { location } = this.props;
        const accepted = ([
            '/workspace',
            '/settings',
            '/settings/general',
            '/settings/workspace',
            '/settings/machine-profiles',
            '/settings/user-accounts',
            '/settings/controller',
            '/settings/commands',
            '/settings/events',
            '/settings/about'
        ].indexOf(location.pathname) >= 0);
github cncjs / cncjs / src / web / containers / Sidebar / Sidebar.jsx View on Github external
import classNames from 'classnames';
import React, { PureComponent } from 'react';
import { Link, withRouter } from 'react-router-dom';
import i18n from '../../lib/i18n';
import styles from './index.styl';

class Sidebar extends PureComponent {
    static propTypes = {
        ...withRouter.propTypes
    };

    render() {
        const { pathname = '' } = this.props.location;

        return (
            <nav>
                <ul>
                    <li>
                        
                            </li></ul></nav>