UNPKG

@selfcommunity/react-ui

Version:

React UI Components to integrate a Community created with SelfCommunity Platform.

142 lines (134 loc) 3.88 kB
import { CommentObjectProps } from '../CommentObject'; import { SCCommentsOrderBy } from '../../types/comments'; import { CacheStrategies } from '@selfcommunity/utils'; import { SCCommentType, SCContributionType, SCFeedObjectType } from '@selfcommunity/types'; export interface CommentsFeedObjectProps { /** * Id of the CommentsObject * @default `comments_object_<feedObjectType>_<feedObjectId | feedObject.id>` */ id?: string; /** * Overrides or extends the styles applied to the component. * @default null */ className?: string; /** * Id of feed object * @default null */ feedObjectId?: number; /** * Feed object * @default null */ feedObject?: SCFeedObjectType; /** * Type of feed object * @default SCContributionType.POST */ feedObjectType?: Exclude<SCContributionType, SCContributionType.COMMENT>; /** * Id of the comment object * @default null */ commentObjectId?: number; /** * Comment object * @default null */ commentObject?: SCCommentType; /** * CommentComponent component * Useful to override the single Comment render component * @default CommentObject */ CommentComponent?: (inProps: CommentObjectProps) => JSX.Element; /** * Props to spread to CommentObject component * @default {variant: 'outlined} */ CommentComponentProps?: CommentObjectProps; /** * Props to spread to CommentObject component * @default {elevation: 0, variant: 'outlined'} */ CommentObjectSkeletonProps?: any; /** * renderNoComment function * invoked when no comments founds * @default null */ renderNoComments?: () => JSX.Element; /** * renderCommentNotFound function * invoked when comment not found * @default null */ renderCommentNotFound?: () => JSX.Element; /** * page * @default 1 */ page?: number; /** * comments per page * @default null */ commentsPageCount?: number; /** * comments orderBy * @default SCCommentsOrderBy.ADDED_AT_DESC */ commentsOrderBy?: SCCommentsOrderBy; /** * show title (number of comments) */ showTitle?: boolean; /** * enable/disable infinite scrolling * @default true */ infiniteScrolling?: boolean; /** * additional comments to show in the header/footer * useful when from a feedObject publish a comment * @default [] */ comments?: SCCommentType[]; /** * Callback invoked when load comments page * Usefull to sync location path for SEO optimization * @param page */ onChangePage?: (page: any) => any; /** * Caching strategies */ cacheStrategy?: CacheStrategies; /** * Other props */ [p: string]: any; } /** * > API documentation for the Community-JS Comments Feed Object component. Learn about the available props and the CSS API. * * * This component renders a list of comment items. * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/CommentsFeedObject) #### Import ```jsx import {CommentsFeedObject} from '@selfcommunity/react-ui'; ``` #### Component Name The name `SCCommentsFeedObject` can be used when providing style overrides in the theme. #### CSS |Rule Name|Global class|Description| |---|---|---| |root|.SCCommentsFeedObject-root|Styles applied to the root element.| |noComments|.SCCommentsFeedObject-no-comments|Styles applied to the 'no comments' section.| |commentNotFound|.SCCommentsFeedObject-comment-not-found|Styles applied to the label 'Comment not found'.| * @param inProps */ export default function CommentsFeedObject(inProps: CommentsFeedObjectProps): JSX.Element;