diff --git a/ai/README.md b/ai/README.md
index b341dd0b3..57b026bb7 100644
--- a/ai/README.md
+++ b/ai/README.md
@@ -4,7 +4,7 @@ Componentes React de eClass sobre Chakra UI 1.8. Funcionan desde React 16.8. Tod
desde el paquete:
```tsx
-import { ModalMultiple, ModalContent, ModalButtons, BtnPrimary, vars } from '@eclass/ui-kit'
+import { ModalMultiple, ModalContent, ModalButtons, BtnPrimary, BoxLearningPath, vars } from '@eclass/ui-kit'
```
## Reglas rápidas
@@ -28,6 +28,8 @@ cómo reconocerlo en un diseño.
| `BtnTertiary` | Acción de baja jerarquía: texto gris subrayado con ícono azul | [botones](components/botones.md) |
| `BtnLink` | Acción con aspecto de enlace | [botones](components/botones.md) |
| `Btn` | Botón base; preferir las variantes de arriba | [botones](components/botones.md) |
+| `BoxLearningPath` | Caja para rutas de aprendizaje. |
+[ruta-aprendizaje](components/ruta-aprendizaje.md) |
| `Modal` | Modal con cabecera azul, título, contenido y botones | [modales](components/modales.md) |
| `ModalMultiple` | Un solo modal que cambia entre contenido, alerta y carga | [modales](components/modales.md) |
| `ModalContent` | Cuerpo de `Modal`/`ModalMultiple` | [modales](components/modales.md) |
diff --git a/ai/components/ruta-aprendizaje.md b/ai/components/ruta-aprendizaje.md
new file mode 100644
index 000000000..b6bb9dce1
--- /dev/null
+++ b/ai/components/ruta-aprendizaje.md
@@ -0,0 +1,55 @@
+# BoxLearningPath
+
+Exports: `BoxLearningPath`.
+Tipos: `dist/organisms/CourseList/Boxes/BoxLearningPath.tsx` (`IBoxLearningPath`, no
+exportado).
+
+## Cuándo usarlo
+
+Casos en que hay rutas de aprendizaje.
+
+## Ejemplo
+
+```tsx
+import { BoxLearningPath } from '@eclass/ui-kit'
+
+export function RutaAprendizaje({ learningPath }: { courses: any[] }): JSX.Element {
+ return (
+ <>
+ {learningPath.map((path, index) => (
+
+ ))}
+ >
+ )
+}
+```
+
+## Props clave
+
+- `headerImage`, `title` y `coursesCount` (obligatorios): imagen, nombre y cantidad de cursos de la ruta.
+- `progress`: porcentaje de avance (0-100).
+- `start`: información sobre curso inicial o curso con última actividad.
+- `buttonLabel`: texto del botón, por defecto: "Ver ruta de aprendizaje".
+- `pathHref`: href para navegar a vista de ruta.
+- `hasFinished`: valor booleano que indica si la ruta ha finalizado.
+
+
+## Cómo se ve (para reconocerlo en un diseño)
+
+- Caja parecida a caja curso tradicional.
+- Header con imagen y texto sobrepuesto con título de la ruta.
+- Barra de progreso que muestra porcentaje de avance.
+- Sección con fondo gris que indica curso por el cual comenzar o retomar, o alerta info de curso finalizado.
diff --git a/src/atoms/Icons/LearningPath.tsx b/src/atoms/Icons/LearningPath.tsx
new file mode 100644
index 000000000..0f4642f5e
--- /dev/null
+++ b/src/atoms/Icons/LearningPath.tsx
@@ -0,0 +1,23 @@
+import { Base, BaseProps } from './Base'
+
+export function LearningPath(props: BaseProps): JSX.Element {
+ return (
+
+
+
+ )
+}
+
+LearningPath.displayName = 'LearningPath'
diff --git a/src/atoms/Icons/index.tsx b/src/atoms/Icons/index.tsx
index 8448d3f91..5ce07ae0e 100644
--- a/src/atoms/Icons/index.tsx
+++ b/src/atoms/Icons/index.tsx
@@ -13,6 +13,7 @@ export * from './GoBack'
export * from './Loader'
export * from './MapIndicator'
export * from './Multimedia'
+export * from './LearningPath'
export * from './Profile'
export * from './Remote'
export * from './Schedule'
diff --git a/src/index.ts b/src/index.ts
index 28f42ad1b..70cd88f37 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -20,7 +20,14 @@ export { UserWay } from './molecules/UserWay/UserWay'
export { UserWayCookie } from './molecules/UserWay/UserWayCookie'
// Organismos
-export { CourseList, CourseStatus, dataFake, maxWidthCoursesList } from './organisms/CourseList'
+export {
+ BoxLearningPath,
+ CourseList,
+ CourseStatus,
+ dataFake,
+ maxWidthCoursesList,
+} from './organisms/CourseList'
+export type { IBoxLearningPath, LearningPathStart } from './organisms/CourseList'
export { Alert, FlashNotification, useFlashNotification } from './organisms/Alerts'
export {
Modal,
diff --git a/src/organisms/CourseList/Boxes/BoxLearningPath.tsx b/src/organisms/CourseList/Boxes/BoxLearningPath.tsx
new file mode 100644
index 000000000..513d27aa1
--- /dev/null
+++ b/src/organisms/CourseList/Boxes/BoxLearningPath.tsx
@@ -0,0 +1,188 @@
+import {
+ Box,
+ keyframes,
+ LinkBox,
+ LinkBoxProps,
+ LinkOverlay,
+ LinkOverlayProps,
+} from '@chakra-ui/react'
+import { useState } from 'react'
+
+import { vars } from '@theme'
+import { PathHeader } from '../components/LearningPath/PathHeader'
+import { PathProgress } from '../components/LearningPath/PathProgress'
+import { PathCourseLink } from '../components/LearningPath/PathCourseLink'
+import { IBoxLearningPath } from '../types'
+
+const StyledLinkBox = LinkBox as React.FC
+const StyledLinkOverlay = LinkOverlay as React.FC
+
+// Desplazamiento de las tarjetas apiladas al bajar y al subir (atrás y adelante)
+const BACK_PEEK = 8
+const FRONT_PEEK = 4
+
+/**
+ * Subida de las tarjetas apiladas al hacer hover: bajan `peek` px y suben hasta
+ * `peek` px por sobre su posición inicial. Con `both`, la tarjeta de atrás espera su
+ * retraso en la posición inicial y al terminar ambas se quedan arriba.
+ */
+const stackBounce = (peek: number): string => keyframes`
+ 0% { transform: translateY(0); }
+ 40% { transform: translateY(${peek}px); }
+ 100% { transform: translateY(-${peek}px); }
+`
+
+/** Bajada de las tarjetas apiladas a su posición inicial al salir el cursor */
+const stackDrop = (peek: number): string => keyframes`
+ from { transform: translateY(-${peek}px); }
+ to { transform: translateY(0); }
+`
+
+const stackAnimations = {
+ back: {
+ rise: `${stackBounce(BACK_PEEK)} 680ms ease-in-out 90ms both`,
+ drop: `${stackDrop(BACK_PEEK)} 300ms ease-in-out both`,
+ },
+ front: {
+ rise: `${stackBounce(FRONT_PEEK)} 680ms ease-in-out both`,
+ drop: `${stackDrop(FRONT_PEEK)} 300ms ease-in-out both`,
+ },
+}
+
+/**
+ * Fases de las tarjetas apiladas:
+ * - `rest`: en su posición inicial (sin animación).
+ * - `rising`: animación de subida en curso; siempre se completa, aunque el cursor salga.
+ * - `raised`: subida terminada y el cursor sigue en la caja; se quedan arriba.
+ * - `dropping`: bajando o ya abajo tras salir el cursor.
+ */
+type StackPhase = 'rest' | 'rising' | 'raised' | 'dropping'
+
+/** Animación CSS de una tarjeta apilada según la fase */
+const stackAnimation = (
+ phase: StackPhase,
+ animations: { rise: string; drop: string }
+): string | undefined => {
+ if (phase === 'rising' || phase === 'raised') return animations.rise
+ if (phase === 'dropping') return animations.drop
+ return undefined
+}
+
+export const BoxLearningPath = ({
+ headerImage,
+ title,
+ coursesCount,
+ progress = 0,
+ start,
+ buttonLabel = 'Ver ruta de aprendizaje',
+ pathHref,
+ hasFinished = false,
+}: IBoxLearningPath): JSX.Element => {
+ const safeProgress = Math.min(100, Math.max(0, progress))
+ const [isHovered, setIsHovered] = useState(false)
+ const [stackPhase, setStackPhase] = useState('rest')
+
+ return (
+ {
+ setIsHovered(true)
+ if (stackPhase === 'rest' || stackPhase === 'dropping') setStackPhase('rising')
+ }}
+ onMouseLeave={() => {
+ setIsHovered(false)
+ // Si la subida sigue en curso, la bajada parte en onAnimationEnd
+ if (stackPhase === 'raised') setStackPhase('dropping')
+ }}
+ >
+ {/* Efecto de tarjetas apiladas detrás; rebotan al pasar el mouse por la caja */}
+ {
+ if (stackPhase === 'rising') setStackPhase(isHovered ? 'raised' : 'dropping')
+ }}
+ />
+
+
+ {/* position relative: la caja queda por encima de las tarjetas cuando bajan */}
+
+ {/* Header */}
+
+
+ {/* Progreso */}
+
+
+ {/* Comenzar/Continuar con */}
+
+
+ {/* Botón para ver ruta */}
+
+ {buttonLabel}
+
+
+
+ )
+}
diff --git a/src/organisms/CourseList/components/LearningPath/PathCourseLink.tsx b/src/organisms/CourseList/components/LearningPath/PathCourseLink.tsx
new file mode 100644
index 000000000..d1b4e1f0a
--- /dev/null
+++ b/src/organisms/CourseList/components/LearningPath/PathCourseLink.tsx
@@ -0,0 +1,92 @@
+import { Icon } from '@/atoms/Icon'
+import { BtnLink } from '@/molecules'
+import { vars } from '@/theme'
+import { Box, Flex, FlexProps, Image, ImageProps, Text, TextProps } from '@chakra-ui/react'
+
+const StyledFlex = Flex as React.FC
+const StyledImage = Image as React.FC
+const StyledText = Text as React.FC
+
+interface PathCourseLinkProps {
+ title: string
+ finished?: boolean
+ progress: number
+ start: {
+ level: string
+ courseTitle: string
+ courseHref: string
+ thumbnail: string
+ thumbnailAlt?: string
+ }
+}
+
+export const PathCourseLink = ({
+ title,
+ finished,
+ progress,
+ start,
+}: PathCourseLinkProps): JSX.Element => {
+ const completedCourse = progress === 100
+ const finishedCourse = progress < 100 && finished
+
+ return (
+
+ {completedCourse ? (
+
+
+
+ ¡Has completado tu Ruta de aprendizaje!
+
+
+ ) : finishedCourse ? (
+
+
+
+ Tu Ruta de aprendizaje ha finalizado
+
+
+ ) : (
+ <>
+
+ {title}
+
+
+
+
+
+ {start.level}
+
+
+
+ {start.courseTitle}
+
+
+
+
+ >
+ )}
+
+ )
+}
diff --git a/src/organisms/CourseList/components/LearningPath/PathHeader.tsx b/src/organisms/CourseList/components/LearningPath/PathHeader.tsx
new file mode 100644
index 000000000..8e7ad8d3f
--- /dev/null
+++ b/src/organisms/CourseList/components/LearningPath/PathHeader.tsx
@@ -0,0 +1,48 @@
+import { Icons } from '@/atoms'
+import { Flex, FlexProps, Heading, HeadingProps, Text, TextProps } from '@chakra-ui/react'
+
+const StyledFlex = Flex as React.FC
+const StyledHeading = Heading as React.FC
+const StyledText = Text as React.FC
+
+interface PathHeaderProps {
+ headerImage: string
+ title: string
+ coursesCount: number
+}
+
+export const PathHeader = ({ headerImage, title, coursesCount }: PathHeaderProps): JSX.Element => {
+ return (
+
+
+
+
+ Ruta de aprendizaje | {coursesCount} cursos
+
+
+
+
+ {title}
+
+
+ )
+}
diff --git a/src/organisms/CourseList/components/LearningPath/PathProgress.tsx b/src/organisms/CourseList/components/LearningPath/PathProgress.tsx
new file mode 100644
index 000000000..2d98093cb
--- /dev/null
+++ b/src/organisms/CourseList/components/LearningPath/PathProgress.tsx
@@ -0,0 +1,31 @@
+import { vars } from '@/theme'
+import { Box, Progress, Text, TextProps } from '@chakra-ui/react'
+
+const StyledText = Text as React.FC
+
+interface PathProgressProps {
+ progress: number
+}
+
+export const PathProgress = ({ progress }: PathProgressProps): JSX.Element => {
+ return (
+
+
+ {progress}% de avance
+
+
+ )
+}
diff --git a/src/organisms/CourseList/index.ts b/src/organisms/CourseList/index.ts
index 45ff4f396..eb107b7b9 100644
--- a/src/organisms/CourseList/index.ts
+++ b/src/organisms/CourseList/index.ts
@@ -1,3 +1,5 @@
export { CourseList } from './CourseList'
+export { BoxLearningPath } from './Boxes/BoxLearningPath'
+export type { IBoxLearningPath, LearningPathStart } from './types'
export { CourseStatus } from './components/CourseStatus'
export { dataFake, maxWidthCoursesList } from './utils'
diff --git a/src/organisms/CourseList/types.d.ts b/src/organisms/CourseList/types.d.ts
index 79b2aa61b..3744c3cf1 100644
--- a/src/organisms/CourseList/types.d.ts
+++ b/src/organisms/CourseList/types.d.ts
@@ -45,6 +45,29 @@ export interface WrapperCoursesProps {
typeBox?: 'TRADITIONAL' | 'TRADITIONAL_LANDSCAPE' | 'IMAGE_LARGE' | 'IMAGE_SMALL'
}
+export interface LearningPathStart {
+ level: string
+ courseTitle: string
+ courseHref: string
+ thumbnail: string
+ thumbnailAlt?: string
+}
+
+export interface IBoxLearningPath {
+ headerImage: string
+ title: string
+ coursesCount: number
+ /** Porcentaje de avance (0-100) */
+ progress?: number
+ /** Curso con el que se recomienda comenzar */ // Revisar cuando este la estructura de datos definida
+ start: LearningPathStart
+ /** Texto del botón. Por defecto: "Ver ruta de aprendizaje" */
+ buttonLabel: string
+ /** href para navegar a vista de ruta */
+ pathHref: string
+ hasFinished?: boolean
+}
+
export interface FooterProps {
modalPaymentText?: PaymentText
}
diff --git a/src/organisms/SimpleCourseBox/SimpleCourseBox.tsx b/src/organisms/SimpleCourseBox/SimpleCourseBox.tsx
index 9b6e6c2bb..438b39ba5 100644
--- a/src/organisms/SimpleCourseBox/SimpleCourseBox.tsx
+++ b/src/organisms/SimpleCourseBox/SimpleCourseBox.tsx
@@ -8,26 +8,36 @@ import {
LinkBoxProps,
LinkOverlay,
LinkOverlayProps,
+ Text,
+ TextProps,
useMediaQuery,
} from '@chakra-ui/react'
import { ArrowRight } from '@/atoms/Icons'
import { IconSelection } from '../CourseList/components/IconSelection'
import { vars } from '@theme'
+import { TinyAlert } from '@/atoms'
interface SimpleCourseBoxProps {
+ alert?: {
+ status: 'success' | 'error' | 'info' | 'warning' | 'answered' | 'pending' | 'omitted' | 'new'
+ text: string
+ }
courseName: string
+ finishDate?: string
grade?: string
href?: string
img: string
icon?: string
isApproved?: boolean
- label?: string
isEnabled?: boolean
+ label?: string
noBorder?: boolean
+ p?: string
}
const StyledFlex = Flex as React.FC
+const StyledText = Text as React.FC
const StyledImage = Image as React.FC
const StyledLinkBox = LinkBox as React.FC
const StyledLinkOverlay = LinkOverlay as React.FC
@@ -36,7 +46,9 @@ const StyledLinkOverlay = LinkOverlay as React.FC
// Creado para listar prerrequerimientos de cursos dentro de un modal
export const SimpleCourseBox = ({
+ alert,
courseName,
+ finishDate,
grade,
href,
img,
@@ -45,13 +57,16 @@ export const SimpleCourseBox = ({
label,
isEnabled = true,
noBorder = false,
+ p = '16px 24px',
}: SimpleCourseBoxProps): JSX.Element => {
const link = !isEnabled || !href || href === '' ? undefined : href
const [isDesktop] = useMediaQuery('(min-width: 768px)')
+ const defaultPadding = isDesktop ? '16px 24px' : '16px'
+
return (
-
+
- {courseName}
+ {alert && }
+ {finishDate && (
+
+ {finishDate}
+
+ )}
+
+ {courseName}
+
{icon && label && (