pagamio-frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
9 lines (8 loc) • 927 B
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import Card from '../components/CardWrapper';
import ChartWrapper from '../components/ChartWrapper';
import { formatValue } from '../utils';
const MetricSummaryCard = ({ title, format, value, previousValue, loading, isEmpty, currency, error, refresh, }) => {
return (_jsx(Card, { title: title, children: _jsx(ChartWrapper, { loading: loading, error: error, isEmpty: isEmpty, onRetry: refresh, children: _jsx("div", { className: "flex justify-between", style: { height: '50px' }, children: _jsxs("div", { children: [_jsx("div", { className: "text-xl font-400", children: formatValue(value, format, { currency, locale: 'en-US' }) }), previousValue !== undefined && (_jsxs("div", { className: "text-gray-400 text-sm", children: ["Prev: ", formatValue(previousValue, format, { currency, locale: 'en-US' })] }))] }) }) }) }));
};
export default MetricSummaryCard;