UNPKG

@selfcommunity/react-ui

Version:

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

23 lines (22 loc) 1.32 kB
import { __rest } from "tslib"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import LinearProgress from '@mui/material/LinearProgress'; import { Box, Typography } from '@mui/material'; import { styled } from '@mui/material/styles'; import classNames from 'classnames'; const PREFIX = 'SCProgressBar'; const classes = { root: `${PREFIX}-root`, bar: `${PREFIX}-bar`, progress: `${PREFIX}-progress`, message: `${PREFIX}-message` }; const Root = styled(Box, { name: PREFIX, slot: 'Root', overridesResolver: (props, styles) => styles.root })(() => ({})); export default function ProgressBar(props) { const { className, value, loadingMessage = null, hideBar = false } = props, rest = __rest(props, ["className", "value", "loadingMessage", "hideBar"]); return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Box, Object.assign({ className: classes.message }, { children: loadingMessage })), !hideBar && _jsx(LinearProgress, Object.assign({ variant: "determinate", color: "success", className: classes.bar, value: value }, rest)), _jsx(Box, Object.assign({ className: classes.progress }, { children: _jsx(Typography, Object.assign({ variant: "h4", color: "secondary" }, { children: `${Math.round(value)}%` })) }))] }))); }