Add exports for custom propTypes as shape specs rather than the complete shape

Allows easier composition of the shapes in case we need to extend them
in components later
This commit is contained in:
Brett Sun 2016-06-27 11:30:32 +02:00
parent 67f56768b8
commit 2706f04f3a
3 changed files with 16 additions and 6 deletions

View File

@ -3,10 +3,15 @@ import React from 'react';
const { number, object, shape, string } = React.PropTypes;
export default shape({
const currentUserShapeSpec = {
acl: object,
email: string,
id: number,
profile: object,
username: string
});
};
export default shape(currentUserShapeSpec);
export {
currentUserShapeSpec
};

View File

@ -1,5 +1,5 @@
export { default as currentUserShape } from './current_user_shape';
export { default as whitelabelShape } from './whitelabel_shape';
export currentUserShape from './current_user_shape';
export whitelabelShape from './whitelabel_shape';
// Re-export PropTypes from react-router
export { locationShape, routerShape } from 'react-router/es6/PropTypes';

View File

@ -3,9 +3,14 @@ import React from 'react';
const { shape, string } = React.PropTypes;
export default shape({
const whitelabelShapeSpec = {
name: string,
subdomain: string,
title: string,
user: string
});
};
export default shape(whitelabelShapeSpec);
export {
whitelabelShapeSpec
};