Skip to content

Commit

Permalink
assign default tagName value
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Apr 1, 2024
1 parent 24ac36a commit 045956e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/post-title/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { useSelect } from '@wordpress/data';
import { usePost } from '../../hooks';

interface PostTitleProps<TElementType extends React.ElementType> {
tagName?: TElementType;
tagName?: TElementType | keyof JSX.IntrinsicElements;
}

type PostTitlePropsWithOmit<TElementType extends React.ElementType> = PostTitleProps<TElementType> & Omit<React.ComponentPropsWithoutRef<TElementType>, keyof PostTitleProps<TElementType>>;

export const PostTitle = <TElementType extends React.ElementType = 'h1'>({
tagName,
tagName = 'h1',
...rest
}: PostTitlePropsWithOmit<TElementType> ) => {
const { postId, postType, isEditable } = usePost();
Expand All @@ -27,7 +27,7 @@ export const PostTitle = <TElementType extends React.ElementType = 'h1'>({
[],
);

const TagName = tagName ?? 'h1';
const TagName = tagName;

if (!isEditable) {
// eslint-disable-next-line react/no-danger
Expand Down

0 comments on commit 045956e

Please sign in to comment.