mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Add missing propTypes
This commit is contained in:
parent
f5779f63f4
commit
1263525800
12 changed files with 99 additions and 28 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Match, Miss, Redirect } from 'react-router';
|
||||
import {
|
||||
AuthenticationPage,
|
||||
|
|
@ -43,6 +43,7 @@ export const fakeAuth = {
|
|||
},
|
||||
};
|
||||
|
||||
/* eslint-disable react/prop-types, arrow-body-style */
|
||||
// User must be authenticated before he can see certain pages
|
||||
export const MatchWhenAuthorized = ({ component: Component, ...rest }) => (
|
||||
<Match
|
||||
|
|
@ -54,6 +55,7 @@ export const MatchWhenAuthorized = ({ component: Component, ...rest }) => (
|
|||
}}
|
||||
/>
|
||||
);
|
||||
/* eslint-enable react/prop-types, arrow-body-style */
|
||||
|
||||
class Routes extends React.Component {
|
||||
getChildContext() {
|
||||
|
|
@ -184,6 +186,9 @@ class Routes extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
const { any } = PropTypes;
|
||||
|
||||
Routes.propTypes = { router: any.isRequired };
|
||||
Routes.childContextTypes = { router: React.PropTypes.object };
|
||||
|
||||
export default Routes;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import ReactDOMServer from 'react-dom/server';
|
||||
import Helmet from 'react-helmet';
|
||||
import { BrowserRouter, ServerRouter } from 'react-router';
|
||||
|
|
@ -6,6 +6,10 @@ import Routes from './Routes';
|
|||
|
||||
const RoutesWithRouterProp = ({ router }) => <Routes router={router} />;
|
||||
|
||||
const { any, string } = PropTypes;
|
||||
|
||||
RoutesWithRouterProp.propTypes = { router: any.isRequired };
|
||||
|
||||
export const ClientApp = () => (
|
||||
<BrowserRouter>
|
||||
{RoutesWithRouterProp}
|
||||
|
|
@ -21,6 +25,8 @@ export const ServerApp = props => {
|
|||
);
|
||||
};
|
||||
|
||||
ServerApp.propTypes = { url: string.isRequired, context: any.isRequired };
|
||||
|
||||
/**
|
||||
* Render the given route.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, { Component } from 'react';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import { Link, Redirect } from 'react-router';
|
||||
import { Page } from '../../components';
|
||||
import { fakeAuth } from '../../Routes';
|
||||
|
|
@ -46,4 +46,11 @@ class AuthenticationPage extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
const { shape, string, oneOf } = PropTypes;
|
||||
|
||||
AuthenticationPage.propTypes = {
|
||||
location: shape({ state: string }).isRequired,
|
||||
tab: oneOf([ 'login', 'signup' ]).isRequired,
|
||||
};
|
||||
|
||||
export default AuthenticationPage;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { Page } from '../../components';
|
||||
|
||||
export default ({ params }) => (
|
||||
const CheckoutPage = ({ params }) => (
|
||||
<Page title={`Checkout page: ${params.listingId}`}>
|
||||
<Link to={`/order/12345`}><button>Pay</button></Link>
|
||||
</Page>
|
||||
)
|
||||
);
|
||||
|
||||
const { shape, string } = PropTypes;
|
||||
|
||||
CheckoutPage.propTypes = { params: shape({ listingId: string.isRequired }).isRequired };
|
||||
|
||||
export default CheckoutPage;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Page } from '../../components';
|
||||
|
||||
export default props => {
|
||||
const ConversationPage = props => {
|
||||
const { params } = props;
|
||||
return (
|
||||
<Page title="Conversation page">
|
||||
<p>Conversation id: {params.id}</p>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const { shape, string } = PropTypes;
|
||||
|
||||
ConversationPage.propTypes = { params: shape({ id: string.isRequired }).isRequired };
|
||||
|
||||
export default ConversationPage;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Page } from '../../components';
|
||||
|
||||
export default (props, context) => {
|
||||
const EditProfilePage = (props, context) => {
|
||||
const { params } = props;
|
||||
return (
|
||||
<Page title={`Edit profile page with display name: ${params.displayName}`}>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const { shape, string } = PropTypes;
|
||||
|
||||
EditProfilePage.propTypes = { params: shape({ displayName: string.isRequired }).isRequired };
|
||||
|
||||
export default EditProfilePage;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { Page } from '../../components';
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ const toPath = (filter, id) => {
|
|||
}
|
||||
};
|
||||
|
||||
export default props => {
|
||||
const InboxPage = props => {
|
||||
const { filter } = props;
|
||||
return (
|
||||
<Page title={`${filter} page`}>
|
||||
|
|
@ -22,4 +22,11 @@ export default props => {
|
|||
</ul>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const { string } = PropTypes;
|
||||
|
||||
// TODO: should the filter an enum?
|
||||
InboxPage.propTypes = { filter: string.isRequired };
|
||||
|
||||
export default InboxPage;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { Page } from '../../components';
|
||||
|
||||
export default ({ params }) => {
|
||||
const ListingPage = ({ params }) => {
|
||||
// Listing id should be located either in the end of slug
|
||||
// - https://example.com/l/listing-title-as-slug-12345
|
||||
// - https://example.com/l/12345
|
||||
|
|
@ -16,4 +16,10 @@ export default ({ params }) => {
|
|||
<Link to={`/checkout/${id}`}><button>Book</button></Link>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const { shape, string } = PropTypes;
|
||||
|
||||
ListingPage.propTypes = { params: shape({ slug: string.isRequired }).isRequired };
|
||||
|
||||
export default ListingPage;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/* eslint-disable react/no-unescaped-entities */
|
||||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { Page } from '../../components';
|
||||
|
||||
export default props => {
|
||||
const OrderPage = props => {
|
||||
const { params } = props;
|
||||
return (
|
||||
<Page title="Order page">
|
||||
|
|
@ -19,4 +19,10 @@ export default props => {
|
|||
</p>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const { shape, string } = PropTypes;
|
||||
|
||||
OrderPage.propTypes = { params: shape({ id: string.isRequired }).isRequired };
|
||||
|
||||
export default OrderPage;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Page } from '../../components';
|
||||
|
||||
export default ({ params }) => (
|
||||
const ProfilePage = ({ params }) => (
|
||||
<Page title={`Profile page with display name: ${params.displayName}`}>
|
||||
</Page>
|
||||
)
|
||||
);
|
||||
|
||||
const { shape, string } = PropTypes;
|
||||
|
||||
ProfilePage.propTypes = { params: shape({ displayName: string.isRequired }).isRequired };
|
||||
|
||||
export default ProfilePage;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/* eslint-disable react/no-unescaped-entities */
|
||||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { Page } from '../../components';
|
||||
|
||||
export default props => {
|
||||
const SalesConversationPage = props => {
|
||||
const { params } = props;
|
||||
return (
|
||||
<Page title="Sales conversation page">
|
||||
|
|
@ -19,4 +19,10 @@ export default props => {
|
|||
</p>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const { shape, string } = PropTypes;
|
||||
|
||||
SalesConversationPage.propTypes = { params: shape({ id: string.isRequired }).isRequired };
|
||||
|
||||
export default SalesConversationPage;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React from 'react';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { fakeAuth } from '../../Routes';
|
||||
import css from './Topbar.css';
|
||||
|
|
@ -13,6 +13,10 @@ const SignoutButton = props => {
|
|||
return <button onClick={handleClick}>Sign out</button>;
|
||||
};
|
||||
|
||||
const { any } = PropTypes;
|
||||
|
||||
SignoutButton.propTypes = { router: any.isRequired };
|
||||
|
||||
const Topbar = (props, context) => {
|
||||
const linkProps = { className: css.link };
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue