mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 20:01:59 +00:00
Fix all comments
This commit is contained in:
@@ -1,26 +1,29 @@
|
||||
import { forwardRef } from 'react';
|
||||
import { MutableRefObject, ReactNode, forwardRef } from 'react';
|
||||
|
||||
// Styled
|
||||
import { StyledBody, StyledDialog, StyledTitle } from './styled';
|
||||
|
||||
// Type
|
||||
import { Nullable } from '../../globals/types';
|
||||
|
||||
export interface IDialogProps {
|
||||
title?: string;
|
||||
children?: JSX.Element[] | JSX.Element;
|
||||
children?: ReactNode;
|
||||
onClose?: () => void;
|
||||
ref?: React.MutableRefObject<HTMLDialogElement | null>;
|
||||
ref?: MutableRefObject<Nullable<HTMLDialogElement>>;
|
||||
}
|
||||
|
||||
const Dialog = forwardRef((props: IDialogProps, ref) => {
|
||||
const { title, children, onClose } = props;
|
||||
return (
|
||||
<StyledDialog
|
||||
ref={ref as React.LegacyRef<HTMLDialogElement> | undefined}
|
||||
onClose={onClose}
|
||||
>
|
||||
<StyledTitle>{title}</StyledTitle>
|
||||
<StyledBody>{children}</StyledBody>
|
||||
</StyledDialog>
|
||||
);
|
||||
});
|
||||
const Dialog = forwardRef<HTMLDialogElement, IDialogProps>(
|
||||
(props: IDialogProps, ref) => {
|
||||
const { title, children, onClose } = props;
|
||||
|
||||
return (
|
||||
<StyledDialog ref={ref} onClose={onClose}>
|
||||
<StyledTitle>{title}</StyledTitle>
|
||||
<StyledBody>{children}</StyledBody>
|
||||
</StyledDialog>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
export default Dialog;
|
||||
|
||||
Reference in New Issue
Block a user