Skip to content

Commit

Permalink
Merge pull request #450 from Automattic/update/component-types
Browse files Browse the repository at this point in the history
Update some component types to accept relevant html attributes
  • Loading branch information
brookewp authored Oct 28, 2024
2 parents cc7b268 + 14c86e9 commit b2521fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/system/Code/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import classNames, { Argument } from 'classnames';
import React, { ReactNode, createRef, useState } from 'react';
import { MdContentCopy } from 'react-icons/md';

export interface CodeProps {
export type CodeProps = React.ComponentPropsWithoutRef< 'code' > & {
prompt?: boolean;
showCopy?: boolean;
onCopy?: () => void;
className?: Argument;
children?: ReactNode;
}
};

const Code = React.forwardRef< HTMLDivElement, CodeProps >(
( { prompt = false, showCopy = false, onCopy, className, ...props }: CodeProps, forwardRef ) => {
Expand Down
4 changes: 2 additions & 2 deletions src/system/NewForm/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*/
import classNames from 'classnames';
import React from 'react';
export interface FormProps {
export type FormProps = React.ComponentPropsWithoutRef< 'form' > & {
children?: React.ReactNode;
className?: string;
}
};
export const Form = React.forwardRef< HTMLFormElement, FormProps >(
( { children, className, ...props }, forwardRef ) => (
<form
Expand Down
4 changes: 2 additions & 2 deletions src/system/Notice/Notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ interface NoticeIconProps {
variant: ColorVariants;
}

export interface NoticeProps {
export type NoticeProps = React.HTMLAttributes< HTMLDivElement > & {
children: React.ReactNode;
inline?: boolean;
sx?: ThemeUIStyleObject;
title?: React.ReactNode;
variant?: ColorVariants;
headingVariant?: React.ElementType;
className?: string;
}
};
type ColorVariants = 'warning' | 'error' | 'alert' | 'success' | 'info';

const NoticeIcon = ( { color, variant }: NoticeIconProps ) => {
Expand Down

0 comments on commit b2521fd

Please sign in to comment.