@nodeject/ui-components
Version:
UI library for non-trivial components
54 lines (53 loc) • 1.48 kB
TypeScript
/// <reference types="react" />
import { RichTextEditorProps } from '@/rich-text-editor';
interface Author {
display: string;
id: string;
picture: string;
}
export interface CommentType {
id: string;
createdAt: string;
author: Author;
body: string;
parent?: string;
}
export interface CommentProps extends CommentType {
className?: string;
showHeader?: boolean;
showSider?: boolean;
style?: React.CSSProperties;
actions?: {
onReplyToClick?: (replyToCommentId: string) => void;
};
}
interface Order {
order: 'asc' | 'desc';
}
export interface CommentListProps extends Order {
bottomRef?: React.MutableRefObject<HTMLDivElement>;
topRef?: React.MutableRefObject<HTMLDivElement>;
align?: 'top' | 'bottom';
}
export interface CommentListComposition {
Comment: React.FC<CommentProps>;
}
export interface ThreadComposition {
CommmentList: React.FC<CommentListProps> & CommentListComposition;
}
export interface ThreadUIProps {
fixedHeight?: boolean;
}
export declare type SaveComment = (args: {
body: string;
id?: string;
parent?: string;
}) => void;
export interface ThreadProps extends Order, ThreadUIProps {
author: Author;
commentList: CommentType[];
saveComment?: SaveComment;
toolbarButtons?: RichTextEditorProps['toolbarButtons'];
toolbarPosition?: RichTextEditorProps['toolbarPosition'];
}
export {};