components.widgets.Calendar.CalendarEvent.tsx Maven / Gradle / Ivy
import React from 'react'
import get from 'lodash/get'
import dayjs from 'dayjs'
import classNames from 'classnames'
import { eventLessHour, isAllDay, mapStyle, monthEventStyle } from './utils'
import { CalendarEventProps } from './types'
export function CalendarEvent({
style,
event,
accessors,
cellColorAccessor,
setResolve,
onSelectEvent,
dispatch,
}: CalendarEventProps) {
const tooltip = accessors.tooltip(event)
const title = accessors.title(event)
const color = event[cellColorAccessor] || '#3174ad'
const lessHour = eventLessHour(get(event, 'date'), get(event, 'step'))
const begin = get(event, 'date.begin')
const end = get(event, 'date.end')
const disabled = get(event, 'disabled', false)
const handleClick = () => {
setResolve({ id: get(event, 'id') })
dispatch(onSelectEvent)
}
return (
{title}
{!isAllDay(begin, end) ? dayjs(begin).format('HH:mm') : null}
)
}
export default CalendarEvent
© 2015 - 2025 Weber Informatics LLC | Privacy Policy