UNPKG

react-newsfeed

Version:

A customizable social media post component for React applications that mimics popular social media feeds with features like likes, comments, and image galleries.

155 lines (141 loc) 5.44 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import { ReactNode } from 'react'; interface Reply$1 { id: string; author: string; avatar: string; content: string; canDelete?: boolean; timestamp: string; likes: number; liked: boolean; } interface DropdownOption { title: string; action: () => void; icon?: React.ReactNode; } interface Comment$1 { id: string; author: string; avatar: string; content: string; timestamp: string; likes: number; liked: boolean; canDelete?: boolean; replies: Reply$1[]; showReplies: boolean; showReplyInput: boolean; } interface PostImage { id: string; url: string; alt: string; type?: "image" | "video" | "youtube"; } interface Author { name: string; avatar: string; timeAgo: string; } interface PostProps { author: Author; content: string; tags?: string[]; options?: DropdownOption[]; images?: PostImage[]; extraComponent?: ReactNode; initialLiked?: boolean; initialLikeCount?: number; initialComments?: Comment$1[]; showTranslation?: boolean; onLikePost?: (liked: boolean) => void; onAddComment?: (content: string) => Comment$1 | void; onLikeComment?: (commentId: string) => void; onDeleteComment?: (commentId: string) => void; onAddReply?: (commentId: string, content: string) => Reply$1 | void; onLikeReply?: (commentId: string, replyId: string) => void; onDeleteReply?: (commentId: string, replyId: string) => void; onClickShare?: () => void; } interface CommentProps { comment: Comment$1; onLike: () => void; onDelete: () => void; onLikeReply: (replyId: string) => void; onDeleteReply: (replyId: string) => void; onToggleReplies: () => void; onToggleReplyInput: () => void; onPostReply: (content: string) => void; } interface CommentInputProps { value: string; onChange: (value: string) => void; onSubmit: () => void; placeholder?: string; } interface ReplyProps { reply: Reply$1; onLike: () => void; onDelete: () => void; } declare function Post({ author, content, tags, images, extraComponent, options, initialLiked, initialLikeCount, initialComments, showTranslation, onLikePost, onAddComment, onLikeComment, onDeleteComment, onAddReply, onLikeReply, onDeleteReply, onClickShare, }: PostProps): react_jsx_runtime.JSX.Element; declare function Comment({ comment, onLike, onDelete, onLikeReply, onDeleteReply, onToggleReplies, onToggleReplyInput, onPostReply, }: CommentProps): react_jsx_runtime.JSX.Element; interface CommentListProps { comments: Comment$1[]; onLikeComment: (commentId: string) => void; onDeleteComment: (commentId: string) => void; onLikeReply: (commentId: string, replyId: string) => void; onDeleteReply: (commentId: string, replyId: string) => void; onToggleReplies: (commentId: string) => void; onToggleReplyInput: (commentId: string) => void; onPostReply: (commentId: string, content: string) => void; } declare function CommentList({ comments, onLikeComment, onDeleteComment, onLikeReply, onDeleteReply, onToggleReplies, onToggleReplyInput, onPostReply, }: CommentListProps): react_jsx_runtime.JSX.Element; declare function CommentInput({ value, onChange, onSubmit, placeholder, }: CommentInputProps): react_jsx_runtime.JSX.Element; declare function Reply({ reply, onLike, onDelete }: ReplyProps): react_jsx_runtime.JSX.Element; interface ReplyListProps { replies: Reply$1[]; showReplies: boolean; onToggleReplies: () => void; onLikeReply: (replyId: string) => void; onDeleteReply: (replyId: string) => void; } declare function ReplyList({ replies, showReplies, onToggleReplies, onLikeReply, onDeleteReply, }: ReplyListProps): react_jsx_runtime.JSX.Element; interface ReplyInputProps { value: string; onChange: (value: string) => void; onSubmit: () => void; placeholder?: string; } declare function ReplyInput({ value, onChange, onSubmit, placeholder, }: ReplyInputProps): react_jsx_runtime.JSX.Element; interface AvatarProps { src: string; alt: string; size?: "sm" | "md" | "lg" | "xs"; } declare function Avatar({ src, alt, size }: AvatarProps): react_jsx_runtime.JSX.Element; interface LikeButtonProps { liked: boolean; count: number; onClick: () => void; } declare function LikeButton({ liked, count, onClick }: LikeButtonProps): react_jsx_runtime.JSX.Element; interface TimeStampProps { time: string; } declare function TimeStamp({ time }: TimeStampProps): react_jsx_runtime.JSX.Element; declare function LikeIcon({ filled }: { filled?: boolean; }): react_jsx_runtime.JSX.Element; declare function ChevronIcon({ direction }: { direction?: string; }): react_jsx_runtime.JSX.Element; declare function CommentIcon(): react_jsx_runtime.JSX.Element; declare function ShareIcon(): react_jsx_runtime.JSX.Element; declare function MoreOptionsIcon(): react_jsx_runtime.JSX.Element; declare function PublicIcon(): react_jsx_runtime.JSX.Element; declare function SendIcon(): react_jsx_runtime.JSX.Element; export { Avatar, ChevronIcon, Comment, CommentIcon, CommentInput, CommentList, LikeButton, LikeIcon, MoreOptionsIcon, Post, PublicIcon, Reply, ReplyInput, ReplyList, SendIcon, ShareIcon, TimeStamp }; export type { Author, CommentInputProps, CommentProps, DropdownOption, PostImage, PostProps, ReplyProps };