@selfcommunity/react-ui
Version:
React UI Components to integrate a Community created with SelfCommunity Platform.
56 lines (49 loc) • 2.67 kB
JavaScript
import { __rest } from "tslib";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box, CardActions, CardMedia, Icon, styled } from '@mui/material';
import { useThemeProps } from '@mui/system';
import classNames from 'classnames';
import Widget from '../Widget';
import { PREFIX } from './constants';
import { SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
import CreateCourseButton from '../CreateCourseButton';
const classes = {
root: `${PREFIX}-create-placeholder-root`,
imageWrapper: `${PREFIX}-create-placeholder-image-wrapper`,
image: `${PREFIX}-create-placeholder-image`,
icon: `${PREFIX}-create-placeholder-icon`,
actions: `${PREFIX}-create-placeholder-actions`
};
const Root = styled(Widget, {
name: PREFIX,
slot: 'CreatePlaceholderRoot'
})(() => ({}));
/**
* > API documentation for the Community-JS Course Placeholder component. Learn about the available props and the CSS API.
#### Import
```jsx
import {CourseCreatePlaceholder} from '@selfcommunity/react-ui';
```
#### Component Name
The name `SCCourse-placeholder-root` can be used when providing style overrides in the theme.
#### CSS
|Rule Name|Global class|Description|
|---|---|---|
|root|.SCCourse-create-placeholder-root|Styles applied to the root element.|
|imageWrapper|.SCCourse-create-placeholder-image|Styles applied to the image wrapper section.|
|image|.SCCourse-create-placeholder-image|Styles applied to the image element.|
|icon|.SCCourse-create-placeholder-icon|Styles applied to the course icon element.|
|actions|.SCCourse-create-placeholder-actions|Styles applied to action section.|
*
*/
export default function CourseCreatePlaceholder(inProps) {
// PROPS
const props = useThemeProps({
props: inProps,
name: PREFIX
});
const { CreateCourseButtonComponentProps = {}, className } = props, rest = __rest(props, ["CreateCourseButtonComponentProps", "className"]);
// HOOK
const { preferences } = useSCPreferences();
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsxs(Box, Object.assign({ position: "relative", className: classes.imageWrapper }, { children: [_jsx(CardMedia, { component: "img", image: `${preferences[SCPreferences.IMAGES_USER_DEFAULT_COVER].value}`, alt: "placeholder image", className: classes.image }), _jsx(Icon, Object.assign({ className: classes.icon, fontSize: "large" }, { children: "courses" }))] })), _jsx(CardActions, Object.assign({ className: classes.actions }, { children: _jsx(CreateCourseButton, Object.assign({}, CreateCourseButtonComponentProps)) }))] })));
}