Updates/adds to prop-types for homepage feed makeover. (#6128)

This commit is contained in:
Nick Taylor 2020-02-18 09:09:50 -05:00 committed by GitHub
parent 21d88399be
commit bd24cf2a05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,42 @@
import PropTypes from 'prop-types';
import { tagPropTypes } from './tag-prop-types';
import { organizationPropType } from './organization-prop-type';
export const articleSnippetResultPropTypes = PropTypes.shape({
body_text: PropTypes.shape({
matchLevel: PropTypes.oneOf(['full', 'none']),
value: PropTypes.string.isRequired,
}),
comments_blob: PropTypes.shape({
matchLevel: PropTypes.oneOf(['full', 'none']),
value: PropTypes.string.isRequired,
}),
});
export const articlePropTypes = PropTypes.shape({
id: PropTypes.number.isRequired,
title: PropTypes.string.isRequired,
path: PropTypes.string.isRequired,
cloudinary_video_url: PropTypes.string,
video_duration_in_minutes: PropTypes.number,
type_of: PropTypes.oneOf(['podcast_episodes']),
class_name: PropTypes.oneOf(['PodcastEpisode', 'User', 'Article']),
flare_tag: tagPropTypes,
tag_list: PropTypes.arrayOf(PropTypes.string),
cached_tag_list_array: PropTypes.arrayOf(PropTypes.string),
podcast: PropTypes.shape({
slug: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
image_url: PropTypes.string.isRequired,
}),
user_id: PropTypes.string.isRequired,
user: PropTypes.shape({
username: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
}),
organization: organizationPropType,
_snippetResult: articleSnippetResultPropTypes,
positive_reactions_count: PropTypes.number,
reactions_count: PropTypes.number,
comments_count: PropTypes.number,
});

View file

@ -2,3 +2,4 @@ export * from './user-prop-types';
export * from './default-children-prop-types';
export * from './organization-prop-type';
export * from './tag-prop-types';
export * from './article-prop-types';

View file

@ -3,4 +3,6 @@ import PropTypes from 'prop-types';
export const organizationPropType = PropTypes.shape({
id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
slug: PropTypes.string.isRequired,
profile_image_90: PropTypes.string.isRequired,
});