Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/documentation/pages/Organisms/CalendarDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ interface ICalendarDropdown {
<MyText>
El prop <strong>onClickEvent</strong> es opcional. Si se envía, se ejecuta al presionar un
evento del dropdown siempre que ese evento también tenga <strong>url</strong>, y entrega
hacia arriba la información completa del evento seleccionado. Los eventos sin URL se
muestran como no disponibles y no ejecutan el callback.
hacia arriba la información completa del evento seleccionado. Los eventos sin URL no
ejecutan el callback.
</MyText>
<Code
text={`
Expand Down
5 changes: 2 additions & 3 deletions src/documentation/pages/Organisms/EventsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export const EventsListPage = (): JSX.Element => {

<MyText>
El evento solo se comporta como clickeable cuando recibe tanto <strong>onClick</strong> como{' '}
<strong>url</strong>. Si <strong>url</strong> llega vacío o nulo, se muestra el estado{' '}
<strong>Aún no disponible</strong> y se deshabilita la interacción.
<strong>url</strong>. Si <strong>url</strong> llega vacío o nulo, se deshabilita la
interacción.
</MyText>

<Box border={`1px solid ${vars('colors-neutral-platinum')}`} borderTop="none">
Expand Down Expand Up @@ -160,7 +160,6 @@ interface IEventList {
unitName?: string // Nombre de la unidad
text: string // "Curso"
type: string // Identificador del tipo de evento
unavailableLabel?: string // Texto del estado no disponible
url?: string | null // URL requerida junto a onClick para habilitar interacción
}
`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ const renderComponent = (event: Event, onClickEvent = jest.fn()): RenderResult =
)

describe('EventsGroup', () => {
it('renders unavailable event label and does not call onClickEvent when url is empty', async () => {
it('does not render unavailable event label and does not call onClickEvent when url is empty', async () => {
const user = userEvent.setup()
const onClickEvent = jest.fn()

renderComponent(baseEvent, onClickEvent)

expect(screen.getByText('Aún no disponible')).toBeInTheDocument()
expect(screen.queryByText('Aún no disponible')).not.toBeInTheDocument()

await user.click(screen.getByText('Se habilita para responder “Evaluación 2”'))

Expand Down
4 changes: 2 additions & 2 deletions src/organisms/Calendar/EventsList/EventsList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ describe('EventsList', () => {
expect(screen.getByText('Evento demo')).toBeInTheDocument()
})

it('renders unavailable label and does not call onClick when url is empty', async () => {
it('does not render unavailable label and does not call onClick when url is empty', async () => {
const onClick = jest.fn()
const user = userEvent.setup()

renderComponent(onClick, { url: '' })

expect(screen.getByText('Aún no disponible')).toBeInTheDocument()
expect(screen.queryByText('Aún no disponible')).not.toBeInTheDocument()

await user.click(screen.getByText('Evento demo'))

Expand Down
21 changes: 1 addition & 20 deletions src/organisms/Calendar/EventsList/EventsList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TinyAlert } from '@/atoms'
import { MapIndicator, Remote, Time } from '@/atoms/Icons'
import { Box } from '@chakra-ui/react'
import { vars } from '@theme'
Expand All @@ -21,7 +20,6 @@ export interface IEventList {
text: string
type: string
unitName?: string
unavailableLabel?: string
url?: string | null
}

Expand All @@ -41,16 +39,13 @@ export const EventsList = ({
text,
type,
unitName,
unavailableLabel = 'Aún no disponible',
url,
}: IEventList): JSX.Element => {
const border = `1px solid ${vars('colors-neutral-platinum') ?? '#E8E8E8'}`
const hoverBg = vars('colors-neutral-cultured2') ?? '#F8F8F8'
const hasUrl = Boolean(url)
const isAvailable = url === undefined ? true : hasUrl
const eventClicksEnabled = false
const isClickable = eventClicksEnabled && Boolean(onClick) && hasUrl
const disabledOpacity = isAvailable ? 1 : 0.5
const isCpr = type === 'cpr'
const showEventLocation = !isCpr || Boolean(headquartersAddress)

Expand Down Expand Up @@ -111,7 +106,6 @@ export const EventsList = ({
display="flex"
flexDirection="column"
justifyContent="space-around"
opacity={disabledOpacity}
>
<Box as="span" sx={dateTextStyle}>
{day}
Expand All @@ -123,20 +117,7 @@ export const EventsList = ({
</Box>

<Box display="flex" flexDirection="column" gap="8px" w="100%">
{!isAvailable && (
<TinyAlert
status="warning"
text={unavailableLabel}
sx={{
padding: '4px 6px',
'> span': {
fontSize: '12px',
},
}}
/>
)}

<Box display="flex" flexDirection="column" gap="8px" opacity={disabledOpacity}>
<Box display="flex" flexDirection="column" gap="8px">
<Box
alignItems="center"
display="flex"
Expand Down
Loading