pagamio-frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
9 lines (8 loc) • 1.03 kB
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, change, loading, isEmpty, error, refresh, }) => {
return (_jsx(Card, { title: title, children: _jsx(ChartWrapper, { loading: loading, error: error, isEmpty: isEmpty, onRetry: refresh, children: _jsxs("div", { className: "flex justify-between", style: { height: '50px' }, children: [_jsxs("div", { children: [_jsx("div", { className: "text-xl font-400", children: formatValue(value, format) }), previousValue !== undefined && (_jsxs("div", { className: "text-gray-400 text-sm", children: ["Prev: ", formatValue(previousValue, format)] }))] }), change !== undefined && (_jsxs("div", { className: `text-lg ${change >= 0 ? 'text-green-500' : 'text-red-500'}`, children: [change >= 0 ? '+' : '', change, "%"] }))] }) }) }));
};
export default MetricSummaryCard;