Skip to content

Commit

Permalink
Merge pull request #199 from 10up/fix/undefined-default-props
Browse files Browse the repository at this point in the history
fix add back inline default value to prevent undefined error
  • Loading branch information
fabiankaegy authored Feb 22, 2023
2 parents d5590e5 + f92673c commit bc2e398
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions components/author/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { AuthorContext } from './context';
*/

export const Name = (props) => {
const { tagName: TagName, ...rest } = props;
const { tagName: TagName = 'span', ...rest } = props;

/**
* @type {Author}
Expand All @@ -47,7 +47,7 @@ Name.defaultProps = {
};

export const FirstName = (props) => {
const { tagName: TagName, ...rest } = props;
const { tagName: TagName = 'span', ...rest } = props;

/**
* @type {Author}
Expand All @@ -66,7 +66,7 @@ FirstName.defaultProps = {
};

export const LastName = (props) => {
const { tagName: TagName, ...rest } = props;
const { tagName: TagName = 'span', ...rest } = props;

/**
* @type {Author}
Expand Down
2 changes: 1 addition & 1 deletion components/post-date/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PostDatePicker.propTypes = {
};

export const PostDate = (props) => {
const { placeholder, format, ...rest } = props;
const { placeholder = __('No date set', 'tenup'), format, ...rest } = props;

const { postId, postType, isEditable } = usePost();

Expand Down
2 changes: 1 addition & 1 deletion components/post-excerpt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import { usePost } from '../../hooks';

export const PostExcerpt = (props) => {
const { placeholder, ...rest } = props;
const { placeholder = __('Enter excerpt...', 'tenup'), ...rest } = props;
const { postId, postType, isEditable } = usePost();

const [rawExcerpt = '', setExcerpt, fullExcerpt] = useEntityProp(
Expand Down
2 changes: 1 addition & 1 deletion components/post-meta/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PostMeta.propTypes = {
};

const MetaString = (props) => {
const { metaKey, tagName } = props;
const { metaKey, tagName = 'p' } = props;
const [metaValue, setMetaValue] = usePostMetaValue(metaKey);

return <RichText value={metaValue} onChange={setMetaValue} tagName={tagName} {...props} />;
Expand Down
7 changes: 6 additions & 1 deletion components/post-primary-term/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import PropTypes from 'prop-types';
import { usePrimaryTerm } from '../../hooks';

export const PostPrimaryTerm = (props) => {
const { taxonomyName, placeholder, isLink, ...rest } = props;
const {
taxonomyName = 'category',
placeholder = __('Select a term', 'tenup'),
isLink = true,
...rest
} = props;

const [primaryTerm, isSupportedTaxonomy] = usePrimaryTerm(taxonomyName);

Expand Down
2 changes: 1 addition & 1 deletion components/post-term-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { PostTermContext } from './context';
import { ListItem, TermLink } from './item';

export const PostTermList = (props) => {
const { tagName: TagName, taxonomyName, children, ...rest } = props;
const { tagName: TagName = 'ul', taxonomyName, children, ...rest } = props;

const { isEditable } = usePost();

Expand Down
2 changes: 1 addition & 1 deletion components/post-term-list/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { PostTermContext } from './context';

export const ListItem = (props) => {
const { tagName: TagName, children, ...rest } = props;
const { tagName: TagName = 'li', children, ...rest } = props;

return <TagName {...rest}>{children}</TagName>;
};
Expand Down
2 changes: 1 addition & 1 deletion components/post-title/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import { usePost } from '../../hooks';

export const PostTitle = (props) => {
const { tagName: TagName, ...rest } = props;
const { tagName: TagName = 'h1', ...rest } = props;
const { postId, postType, isEditable } = usePost();

const [rawTitle = '', setTitle, fullTitle] = useEntityProp(
Expand Down

0 comments on commit bc2e398

Please sign in to comment.