Skip to content

Commit

Permalink
fix only spread rest props to child components
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiankaegy committed Nov 20, 2024
1 parent eab8e78 commit ace2670
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions components/post-meta/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface MetaStringProps
}

const MetaString: React.FC<MetaStringProps> = (props) => {
const { metaKey, tagName = 'p' } = props;
const { metaKey, tagName = 'p', ...rest } = props;
const [metaValue, setMetaValue] = usePostMetaValue<string>(metaKey);
const { isEditable } = usePost();

Expand All @@ -29,7 +29,7 @@ const MetaString: React.FC<MetaStringProps> = (props) => {
value={metaValue ?? ''}
onChange={(value: string) => setMetaValue(value)}
tagName={tagName}
{...props}
{...rest}
/>
);
};
Expand All @@ -42,7 +42,7 @@ interface MetaNumberProps {
}

const MetaNumber: React.FC<MetaNumberProps> = (props) => {
const { metaKey } = props;
const { metaKey, ...rest } = props;
const [metaValue, setMetaValue] = usePostMetaValue<number>(metaKey);
const { isEditable } = usePost();

Expand All @@ -51,7 +51,7 @@ const MetaNumber: React.FC<MetaNumberProps> = (props) => {
value={metaValue}
onChange={(value) => setMetaValue(parseInt(value ?? '', 10))}
disabled={!isEditable}
{...props}
{...rest}
/>
);
};
Expand All @@ -64,7 +64,7 @@ interface MetaBooleanProps extends Pick<ToggleControlProps, 'label'> {
}

const MetaBoolean: React.FC<MetaBooleanProps> = (props) => {
const { metaKey } = props;
const { metaKey, ...rest } = props;
const [metaValue, setMetaValue] = usePostMetaValue<boolean>(metaKey);
const { isEditable } = usePost();

Expand All @@ -73,7 +73,7 @@ const MetaBoolean: React.FC<MetaBooleanProps> = (props) => {
checked={metaValue}
onChange={setMetaValue}
disabled={!isEditable}
{...props}
{...rest}
/>
);
};
Expand Down

0 comments on commit ace2670

Please sign in to comment.