@selfcommunity/react-ui
Version:
React UI Components to integrate a Community created with SelfCommunity Platform.
14 lines (13 loc) • 1.03 kB
JavaScript
import { __rest } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import { Button, Typography } from '@mui/material';
import { FormattedMessage } from 'react-intl';
import { Link } from '@selfcommunity/react-core';
import { LoadingButton } from '@mui/lab';
export default function ActionButton(props) {
const { labelId, to, size = 'small', color = 'primary', variant = 'contained' } = props, rest = __rest(props, ["labelId", "to", "size", "color", "variant"]);
if (to) {
return (_jsx(Button, Object.assign({ component: Link, to: to, size: size, color: color, variant: variant }, rest, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: labelId, defaultMessage: labelId }) })) })));
}
return (_jsx(LoadingButton, Object.assign({ size: size, color: color, variant: variant }, rest, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: labelId, defaultMessage: labelId }) })) })));
}