UNPKG

@selfcommunity/react-ui

Version:

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

55 lines (48 loc) 4.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = tslib_1.__importDefault(require("react")); const Widget_1 = tslib_1.__importDefault(require("../Widget")); const styles_1 = require("@mui/material/styles"); const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton")); const feedObject_1 = require("../../types/feedObject"); const material_1 = require("@mui/material"); const classnames_1 = tslib_1.__importDefault(require("classnames")); const constants_1 = require("./constants"); const classes = { root: `${constants_1.PREFIX}-skeleton-root`, media: `${constants_1.PREFIX}-media` }; const Root = (0, styles_1.styled)(Widget_1.default, { name: constants_1.PREFIX, slot: 'SkeletonRoot' })(() => ({})); /** * > API documentation for the Community-JS Feed Object Skeleton component. Learn about the available props and the CSS API. #### Import ```jsx import {FeedObjectSkeleton} from '@selfcommunity/react-ui'; ``` #### Component Name The name `SCFeedObject-skeleton-root` can be used when providing style overrides in the theme. #### CSS |Rule Name|Global class|Description| |---|---|---| |root|.SCFeedObject-skeleton-root|Styles applied to the root element.| |media|.SCFeedObject-media|Styles applied to the media element.| * */ function FeedObjectSkeleton(props) { const { template = feedObject_1.SCFeedObjectTemplateType.SNIPPET } = props, rest = tslib_1.__rest(props, ["template"]); const theme = (0, material_1.useTheme)(); let obj; if (template === feedObject_1.SCFeedObjectTemplateType.PREVIEW || template === feedObject_1.SCFeedObjectTemplateType.DETAIL || template === feedObject_1.SCFeedObjectTemplateType.SEARCH) { obj = ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.CardHeader, { avatar: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: theme.selfcommunity.user.avatar.sizeMedium, height: theme.selfcommunity.user.avatar.sizeMedium }), title: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "80%", style: { marginBottom: 6 } }), subheader: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "40%" }) }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "rectangular", className: classes.media }), (0, jsx_runtime_1.jsx)(material_1.CardContent, { children: (0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, style: { marginBottom: 6 } }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "80%", style: { marginBottom: 6 } }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "60%" })] }) })] })); } else { obj = ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.CardHeader, { avatar: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: theme.selfcommunity.user.avatar.sizeMedium, height: theme.selfcommunity.user.avatar.sizeMedium }), title: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "80%", style: { marginBottom: 6 } }), subheader: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "40%" }) }), (0, jsx_runtime_1.jsx)(material_1.CardContent, { children: (0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, style: { marginBottom: 6 } }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "80%", style: { marginBottom: 6 } }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "60%", style: { marginBottom: 6 } })] }) })] })); } return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, `${constants_1.PREFIX}-${template}`) }, rest, { children: obj }))); } exports.default = FeedObjectSkeleton;