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
12 changes: 12 additions & 0 deletions src/organisms/Calendar/EventsList/EventsList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,16 @@ describe('EventsList', () => {
expect(screen.queryByText('Curso:')).not.toBeInTheDocument()
expect(screen.getByText('Curso demo')).toBeInTheDocument()
})

it('adds isCourse class when course label is shown', () => {
renderComponent(undefined, { text: '' })

expect(screen.getByTestId('event-course')).toHaveClass('isCourse')
})

it('does not add isCourse class when course label is hidden for cv-events', () => {
renderComponent(undefined, { text: '', type: 'cv-events' })

expect(screen.getByTestId('event-course')).not.toHaveClass('isCourse')
})
})
16 changes: 13 additions & 3 deletions src/organisms/Calendar/EventsList/EventsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export const EventsList = ({
const hoverBg = vars('colors-neutral-cultured2') ?? '#F8F8F8'
const isCpr = type === 'cpr'
const showEventLocation = !isCpr || Boolean(headquartersAddress)
const courseLabel = text || 'Curso'
const showCourseLabel = type !== 'cv-events'
const isCourse = showCourseLabel && courseLabel === 'Curso'

const showEventDuration =
['online', 'in-person', 'cpr'].includes(type) && duration !== undefined && duration > 0
Expand All @@ -68,6 +71,9 @@ export const EventsList = ({
display: 'flex',
gap: '4px',
lineHeight: 'normal',
'&.isCourse': {
alignItems: 'self-start',
},
}

const eventIconStyle = {
Expand Down Expand Up @@ -134,9 +140,13 @@ export const EventsList = ({
</Box>

{showCourse && !initOrEnd && (
<Box as="span" sx={detailTextStyle}>
{type === 'cv-events' ? <></> : <strong>{text ? `${text}:` : 'Curso:'}</strong>}{' '}
{courseName}
<Box
as="span"
className={isCourse ? 'isCourse' : undefined}
data-testid="event-course"
sx={detailTextStyle}
>
{showCourseLabel && <strong>{courseLabel}:</strong>} {courseName}
</Box>
)}

Expand Down
Loading