@selfcommunity/react-ui
Version:
React UI Components to integrate a Community created with SelfCommunity Platform.
76 lines (63 loc) • 3.39 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from 'react';
import { Box, CardContent, CardHeader, Skeleton, useTheme } from '@mui/material';
import { styled } from '@mui/material/styles';
import Widget from '../Widget';
import { PREFIX } from './constants';
const messageClasses = {
root: `${PREFIX}-message-skeleton-root`,
header: `${PREFIX}-header`,
title: `${PREFIX}-title`,
media: `${PREFIX}-media`,
content: `${PREFIX}-content`
};
const MessageSkeletonRoot = styled(Widget, {
name: PREFIX,
slot: 'MessageSkeletonRoot'
})(() => ({}));
/**
* > API documentation for the Community-JS Broadcast Message Skeleton component. Learn about the available props and the CSS API.
#### Import
```jsx
import {MessageSkeleton} from '@selfcommunity/react-ui';
```
#### Component Name
The name `SCBroadcastMessages-message-skeleton-root` can be used when providing style overrides in the theme.
#### CSS
|Rule Name|Global class|Description|
|---|---|---|
|root|.SCBroadcastMessages-message-skeleton-root|Styles applied to the root element.|
|header|.SCBroadcastMessages-header|Styles applied to the header element.|
|title|.SCBroadcastMessages-title|Styles applied to the title element.|
|media|.SCBroadcastMessages-media|Styles applied to the media element.|
|content|.SCBroadcastMessages-content|Styles applied to the content section.|
*
*/
export function MessageSkeleton(props) {
const theme = useTheme();
return (_jsxs(MessageSkeletonRoot, Object.assign({ className: messageClasses.root }, { children: [_jsx(CardHeader, { className: messageClasses.header, avatar: _jsx(Skeleton, { animation: "wave", variant: "circular", width: theme.selfcommunity.user.avatar.sizeMedium, height: theme.selfcommunity.user.avatar.sizeMedium }), title: _jsx(Skeleton, { animation: "wave", variant: "rectangular", width: 60, height: 20 }) }), _jsx(CardContent, Object.assign({ className: messageClasses.title }, { children: _jsx(React.Fragment, { children: _jsx(Skeleton, { animation: "wave", height: 10, width: "80%" }) }) })), _jsx(Box, Object.assign({ className: messageClasses.media }, { children: _jsx(Skeleton, { height: 190, animation: "wave", variant: "rectangular" }) })), _jsx(CardContent, Object.assign({ className: messageClasses.content }, { children: _jsxs(React.Fragment, { children: [_jsx(Skeleton, { animation: "wave", height: 10, width: "80%" }), _jsx(Skeleton, { animation: "wave", height: 10, width: 60 })] }) }))] })));
}
const classes = {
root: `${PREFIX}-skeleton-root`
};
const Root = styled(Box, {
name: PREFIX,
slot: 'SkeletonRoot'
})(() => ({}));
/**
* > API documentation for the Community-JS Broadcast Messages Skeleton component. Learn about the available props and the CSS API.
#### Import
```jsx
import {BroadcastMessagesSkeleton} from '@selfcommunity/react-ui';
```
#### Component Name
The name `SCBroadcastMessages-skeleton-root` can be used when providing style overrides in the theme.
#### CSS
|Rule Name|Global class|Description|
|---|---|---|
|root|.SCBroadcastMessages-skeleton-root|Styles applied to the root element.|
*
*/
export default function BroadcastMessagesSkeleton(props) {
return (_jsxs(Root, Object.assign({ className: classes.root }, props, { children: [_jsx(MessageSkeleton, {}), _jsx(MessageSkeleton, {}), _jsx(MessageSkeleton, {})] })));
}