analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
134 lines (132 loc) • 3.32 kB
JavaScript
import {
BADGE_BACKGROUND_CLASSES,
BaseRankingCard,
PERCENTAGE_BADGE_CLASSES,
RankingLayout,
getPositionBackgroundClass
} from "./chunk-Z7JWDZES.mjs";
import {
Text_default
} from "./chunk-IMCIR6TJ.mjs";
import {
cn
} from "./chunk-53ICLDGS.mjs";
// src/components/StudentRanking/StudentRanking.tsx
import { TrendUpIcon } from "@phosphor-icons/react/dist/csr/TrendUp";
import { TrendDownIcon } from "@phosphor-icons/react/dist/csr/TrendDown";
import { jsx, jsxs } from "react/jsx-runtime";
var StudentCard = ({
student,
variant
}) => {
const TrendIcon = variant === "highlight" ? TrendUpIcon : TrendDownIcon;
const backgroundClass = getPositionBackgroundClass(variant, student.position);
return /* @__PURE__ */ jsxs(
"div",
{
className: cn(
"flex flex-row items-center w-full p-4 gap-2 rounded-xl",
backgroundClass
),
children: [
/* @__PURE__ */ jsx(
Text_default,
{
size: "xs",
weight: "bold",
"aria-label": `Posi\xE7\xE3o ${student.position}`,
className: cn(
"w-5 h-5 rounded-full flex items-center justify-center text-text",
BADGE_BACKGROUND_CLASSES[variant]
),
children: student.position
}
),
/* @__PURE__ */ jsx(
Text_default,
{
size: "sm",
weight: "bold",
className: "flex-1 min-w-0 text-text-950 tracking-[0.2px] truncate",
children: student.name
}
),
/* @__PURE__ */ jsxs(
Text_default,
{
size: "xs",
weight: "bold",
"aria-label": `Desempenho ${student.percentage}%`,
className: cn(
"flex flex-row items-center h-[22px] px-2 gap-1 rounded text-text",
PERCENTAGE_BADGE_CLASSES[variant]
),
children: [
/* @__PURE__ */ jsx(TrendIcon, { size: 16, weight: "bold", "aria-hidden": "true" }),
student.percentage,
"%"
]
}
)
]
}
);
};
var RankingCard = ({
title,
variant,
students,
className,
...props
}) => /* @__PURE__ */ jsx(
BaseRankingCard,
{
title,
variant,
items: students,
renderItem: (student, v, index) => /* @__PURE__ */ jsx(
StudentCard,
{
student,
variant: v
},
`${v}-${index}-${student.position}`
),
className,
...props
}
);
var StudentRanking = ({
highlightTitle = "Estudantes em destaque",
attentionTitle = "Estudantes precisando de aten\xE7\xE3o",
highlightStudents,
attentionStudents,
className,
...props
}) => {
return /* @__PURE__ */ jsxs(RankingLayout, { className, ...props, children: [
/* @__PURE__ */ jsx(
RankingCard,
{
title: highlightTitle,
variant: "highlight",
students: highlightStudents
}
),
/* @__PURE__ */ jsx(
RankingCard,
{
title: attentionTitle,
variant: "attention",
students: attentionStudents
}
)
] });
};
var StudentRanking_default = StudentRanking;
export {
RankingCard,
StudentRanking,
StudentRanking_default
};
//# sourceMappingURL=chunk-PRKMGOHO.mjs.map