UNPKG

@selfcommunity/react-ui

Version:

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

218 lines (209 loc) 7.84 kB
import { CardProps } from '@mui/material'; import { FeedObjectSkeletonProps } from './Skeleton'; import { ActionsProps } from './Actions'; import { PollObjectProps } from './Poll'; import { ContributorsFeedObjectProps } from './Contributors'; import { SCFeedObjectActivitiesType, SCFeedObjectTemplateType } from '../../types/feedObject'; import { ContributionActionsMenuProps } from '../../shared/ContributionActionsMenu'; import { FollowProps } from './Actions/Follow'; import { ActivitiesProps } from './Activities'; import { CommentObjectReplyProps } from '../CommentObjectReply'; import { CommentObjectProps } from '../CommentObject'; import { SCContributionType, SCFeedObjectType } from '@selfcommunity/types'; import { CacheStrategies } from '@selfcommunity/utils'; import { VirtualScrollerItemProps } from '../../types/virtualScroller'; import { FeedObjectMediaPreviewProps } from '../FeedObjectMediaPreview'; export interface FeedObjectProps extends CardProps, VirtualScrollerItemProps { /** * Id of the feedObject * @default `feed_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; /** * Feed Object type * @default 'post' */ feedObjectType?: Exclude<SCContributionType, SCContributionType.COMMENT>; /** * Mark the FeedObject as read when enter in viewport * @default false */ markRead?: boolean; /** * Feed Object latest activities * @default null */ feedObjectActivities?: any[]; /** * Feed Object template type * @default 'preview' */ template?: SCFeedObjectTemplateType; /** * Hide follow action object * @default false */ hideFollowAction?: boolean; /** * Show all summary initially (otherwise it will be truncated) * @default false */ summaryExpanded?: boolean; /** * Show activities as default * @default false */ activitiesExpanded?: boolean; /** * Activities type shown initially. If not set, they are shown in order: * RELEVANCE_ACTIVITIES, RECENT_COMMENTS * If the obj has no comments/activites, or activitiesExpanded == false * nothing will be shown */ activitiesExpandedType?: SCFeedObjectActivitiesType; /** * Hide Participants preview * @default false */ hideParticipantsPreview?: boolean; /** * Show poll as default if exist * @default false */ pollVisible?: boolean; /** * Props to spread to ContributionActionsMenu component * @default {elevation: 0} */ FeedObjectSkeletonProps?: FeedObjectSkeletonProps; /** * Props to spread to Follow button component * @default {} */ FollowButtonProps?: FollowProps; /** * Props to spread to Actions component * @default {} */ ActionsProps?: ActionsProps; /** * Props to spread to ContributionActionsMenu component * @default {} */ ContributionActionsMenuProps?: ContributionActionsMenuProps; /** * Props to spread to Activities component * @default {} */ ActivitiesProps?: ActivitiesProps; /** * Props to spread to MediasPreview component * @default {} */ FeedObjectMediaPreviewProps?: FeedObjectMediaPreviewProps; /** * Props to spread to PollObject component * @default {} */ PollObjectProps?: PollObjectProps; /** * CommentObjectReplyComponent component * Usefull to override the single CommentObjectReply render component * @default CommentObject */ CommentObjectReplyComponent?: (inProps: CommentObjectReplyProps) => JSX.Element; /** * Props to spread to single reply comment object * @default {variant: 'outlined'} */ CommentObjectReplyComponentProps?: CommentObjectReplyProps; /** * Props to spread to ContributorsFeedObject component * @default {elevation: 0} */ ContributorsFeedObjectProps?: ContributorsFeedObjectProps; /** * Props to spread to CommentObject component * @default {variant: 'outlined} */ CommentComponentProps?: CommentObjectProps; /** * Props to spread to CommentObject component * @default {elevation: 0, variant: 'outlined'} */ CommentObjectSkeletonProps?: any; /** * Callback on reply * @param SCCommentType */ onReply?: (SCCommentType: any) => void; /** * Caching strategies * @default CacheStrategies.CACHE_FIRST */ cacheStrategy?: CacheStrategies; /** * Other props */ [p: string]: any; } /** * > API documentation for the Community-JS Feed Object component. Learn about the available props and the CSS API. * * * This component renders a feed object item (post, discussion or status). * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/FeedObject) #### Import ```jsx import {FeedObject} from '@selfcommunity/react-ui'; ``` #### Component Name The name `SCFeedObject` can be used when providing style overrides in the theme. #### CSS |Rule Name|Global class|Description| |---|---|---| |root|.SCFeedObject-root|Styles applied to the root element.| |deleted|.SCFeedObject-deleted|Styles applied to the feed obj when is deleted (visible only for admin and moderator).| |header|.SCFeedObject-header|Styles applied to the header of the card.| |category|.SCFeedObject-category|Styles applied to the category element.| |event|.SCFeedObject-event|Styles applied to the event element.| |group|.SCFeedObject-group|Styles applied to the group element.| |avatar|.SCFeedObject-avatar|Styles applied to the avatar element.| |username|.SCFeedObject-username|Styles applied to the username element.| |activityAt|.SCFeedObject-activity-at|Styles applied to the activity at section.| |tag|.SCFeedObject-tag|Styles applied to the tag element.| |location|.SCFeedObject-location|Styles applied to the location element.| |content|.SCFeedObject-content|Styles applied to the content section. Content section include: title-section, text-section, snippetContent, subContent, medias-section, polls-section, info-section.| |error|.SCFeedObject-error|Styles applied to the error element.| |title-section|.SCFeedObject-title-section|Styles applied to the title section.| |title|.SCFeedObject-title|Styles applied to the title element.| |text-section|.SCFeedObject-text-section|Styles applied to the text section.| |text|.SCFeedObject-text|Styles applied to the text element.| |snippet|.SCFeedObject-snippet|Styles applied to snippet element.| |snippet-content|.SCFeedObject-snippet-content|Styles applied to snippet content element.| |medias-section|.SCFeedObject-medias-section|Styles applied to the medias section.| |polls-section|.SCFeedObject-polls-section|Styles applied to the polls section.| |info-section|.SCFeedObject-info-section|Styles applied to the info section.| |actions-section|.SCFeedObject-actions-section|Styles applied to the actions container.| |reply-content|.SCFeedObject-reply-content|Styles applied to the reply box.| |activitiesSection|.SCFeedObject-activities-section|Styles applied to the activities section element.| |activitiesContent|.SCFeedObject-activities-content|Styles applied to the activities content element.| |followButton|.SCFeedObject-follow-button|Styles applied to the follow button element.| * @param inProps */ export default function FeedObject(inProps: FeedObjectProps): JSX.Element;