UNPKG

analytica-frontend-lib

Version:

Repositório público dos componentes utilizados nas plataformas da Analytica Ensino

112 lines (101 loc) 3.59 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _chunkANT66KVKjs = require('./chunk-ANT66KVK.js'); var _chunkTN3AYOMVjs = require('./chunk-TN3AYOMV.js'); // src/components/shared/RankingShared.tsx var _Trophy = require('@phosphor-icons/react/dist/csr/Trophy'); var _Warning = require('@phosphor-icons/react/dist/csr/Warning'); var _jsxruntime = require('react/jsx-runtime'); var CARD_BACKGROUND_CLASSES = { highlight: { 1: "bg-success-200", 2: "bg-success-100", 3: "bg-success-background" }, attention: { 1: "bg-error-200", 2: "bg-error-100", 3: "bg-error-background" } }; var BADGE_BACKGROUND_CLASSES = { highlight: "bg-indicator-positive", attention: "bg-indicator-negative" }; var PERCENTAGE_BADGE_CLASSES = { highlight: "bg-success-700", attention: "bg-indicator-negative" }; var HEADER_BADGE_CLASSES = BADGE_BACKGROUND_CLASSES; var getPositionBackgroundClass = (variant, position) => { const positionKey = Math.max(1, Math.min(position, 3)); return CARD_BACKGROUND_CLASSES[variant][positionKey]; }; function BaseRankingCard({ title, variant, items, renderItem, headerIcon, className, ...props }) { const DefaultIcon = variant === "highlight" ? _Trophy.TrophyIcon : _Warning.WarningIcon; return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkTN3AYOMVjs.cn.call(void 0, "flex flex-col flex-1 min-h-[254px] p-5 gap-4 bg-background border border-border-50 rounded-xl", className ), ...props, children: [ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-row justify-between items-center h-6 gap-4", children: [ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { as: "h3", size: "lg", weight: "bold", className: "text-text-950 tracking-[0.2px]", children: title } ), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _chunkTN3AYOMVjs.cn.call(void 0, "w-6 h-6 rounded-full flex items-center justify-center", HEADER_BADGE_CLASSES[variant] ), children: _nullishCoalesce(headerIcon, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultIcon, { size: 14, weight: "fill", className: variant === "highlight" ? "text-text-950" : "text-text" } ))) } ) ] }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col gap-2", children: items.map((item, index) => renderItem(item, variant, index)) }) ] } ); } function RankingLayout({ children, className, ...props }) { return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunkTN3AYOMVjs.cn.call(void 0, "grid grid-cols-1 sm:grid-cols-2 w-full gap-4", className), ...props, children } ); } exports.BADGE_BACKGROUND_CLASSES = BADGE_BACKGROUND_CLASSES; exports.PERCENTAGE_BADGE_CLASSES = PERCENTAGE_BADGE_CLASSES; exports.getPositionBackgroundClass = getPositionBackgroundClass; exports.BaseRankingCard = BaseRankingCard; exports.RankingLayout = RankingLayout; //# sourceMappingURL=chunk-4E56FKY7.js.map