fix some prop type errors on the home page (#15314)
This commit is contained in:
parent
a6f08ae215
commit
1dda5b4058
6 changed files with 25 additions and 28 deletions
|
|
@ -1,8 +1,6 @@
|
|||
import { h } from 'preact';
|
||||
import {
|
||||
articlePropTypes,
|
||||
organizationPropType,
|
||||
} from '../../common-prop-types';
|
||||
import PropTypes from 'prop-types';
|
||||
import { articlePropTypes } from '../../common-prop-types';
|
||||
import { MinimalProfilePreviewCard } from '../../profilePreviewCards/MinimalProfilePreviewCard';
|
||||
import { PublishDate } from './PublishDate';
|
||||
|
||||
|
|
@ -97,7 +95,11 @@ Meta.defaultProps = {
|
|||
|
||||
Meta.propTypes = {
|
||||
article: articlePropTypes.isRequired,
|
||||
organization: organizationPropType,
|
||||
organization: PropTypes.shape({
|
||||
name: PropTypes.string.isRequired,
|
||||
profile_image_90: PropTypes.string.isRequired,
|
||||
slug: PropTypes.string.isRequired,
|
||||
}),
|
||||
};
|
||||
|
||||
Meta.displayName = 'Meta';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import { organizationPropType } from './organization-prop-type';
|
||||
|
||||
export const articleSnippetResultPropTypes = PropTypes.shape({
|
||||
body_text: PropTypes.arrayOf(PropTypes.string),
|
||||
|
|
@ -30,7 +29,11 @@ export const articlePropTypes = PropTypes.shape({
|
|||
username: PropTypes.string.isRequired,
|
||||
name: PropTypes.string.isRequired,
|
||||
}),
|
||||
organization: organizationPropType,
|
||||
organization: PropTypes.shape({
|
||||
name: PropTypes.string.isRequired,
|
||||
profile_image_90: PropTypes.string.isRequired,
|
||||
slug: PropTypes.string.isRequired,
|
||||
}),
|
||||
highlight: articleSnippetResultPropTypes,
|
||||
public_reactions_count: PropTypes.number,
|
||||
reactions_count: PropTypes.number,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
export * from './user-prop-types';
|
||||
export * from './default-children-prop-types';
|
||||
export * from './organization-prop-type';
|
||||
export * from './article-prop-types';
|
||||
export * from './selected-tags-prop-types';
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
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,
|
||||
});
|
||||
|
|
@ -10,20 +10,20 @@ export const TagsFollowed = ({ tags = [] }) => {
|
|||
|
||||
return (
|
||||
<Fragment>
|
||||
{tags.map((tag) =>
|
||||
tag.points >= 1 ? (
|
||||
{tags.map(({ name, id, points }) =>
|
||||
points >= 1 ? (
|
||||
<div
|
||||
key={tag.id}
|
||||
key={id}
|
||||
className="sidebar-nav-element"
|
||||
id={`sidebar-element-${tag.name}`}
|
||||
id={`sidebar-element-${name}`}
|
||||
>
|
||||
<a
|
||||
title={`${tag.name} tag`}
|
||||
title={`${name} tag`}
|
||||
onClick={trackSidebarTagClick}
|
||||
className="crayons-link crayons-link--block"
|
||||
href={`/t/${tag.name}`}
|
||||
href={`/t/${name}`}
|
||||
>
|
||||
{`#${tag.name}`}
|
||||
{`#${name}`}
|
||||
</a>
|
||||
</div>
|
||||
) : null,
|
||||
|
|
@ -38,10 +38,7 @@ TagsFollowed.propTypes = {
|
|||
PropTypes.shape({
|
||||
id: PropTypes.number.isRequired,
|
||||
name: PropTypes.string.isRequired,
|
||||
hotness_score: PropTypes.number.isRequired,
|
||||
points: PropTypes.number.isRequired,
|
||||
bg_color_hex: PropTypes.string.isRequired,
|
||||
text_color_hex: PropTypes.string.isRequired,
|
||||
}),
|
||||
),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { h } from 'preact';
|
||||
import PropTypes from 'prop-types';
|
||||
import { organizationPropType } from '../common-prop-types';
|
||||
|
||||
const orgOptions = (organizations, organizationId, emptyLabel) => {
|
||||
const orgs = organizations.map((organization) => {
|
||||
|
|
@ -60,5 +59,10 @@ OrganizationPicker.propTypes = {
|
|||
emptyLabel: PropTypes.string,
|
||||
onToggle: PropTypes.func.isRequired,
|
||||
organizationId: PropTypes.number.isRequired,
|
||||
organizations: PropTypes.arrayOf(organizationPropType).isRequired,
|
||||
organizations: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
id: PropTypes.isRequired,
|
||||
name: PropTypes.string.isRequired,
|
||||
}),
|
||||
).isRequired,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue