Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label to all thursdays beside events in react big calendar #2626

Open
2 of 3 tasks
Faraz1995 opened this issue Jul 21, 2024 · 0 comments
Open
2 of 3 tasks

Add label to all thursdays beside events in react big calendar #2626

Faraz1995 opened this issue Jul 21, 2024 · 0 comments

Comments

@Faraz1995
Copy link

Clear and concise description of the problem

i am using react big calendar, i want to add a custom label to all thusdays. i use components date header but it removes all events in calendar here is my code

      <Calendar
        selectable={true}
        localizer={newLocalizer}
        culture={'fa'}
        startAccessor='start'
        endAccessor='end'
        style={{ height: 500 }}
        formats={configs.formats}
        messages={configs.messages}
        views={configs.views}
        rtl={configs.rtl}
        events={events}
        onSelectSlot={handleSlotSelect}
        eventPropGetter={eventStyleGetter}
        components={{
          event: MyMonthEvent,
          month: {
            dateHeader: MyMonthDateHeader,
            event: MyMonthEvent
          }
        }}
      />
import React from 'react'

function MyMonthDateHeader(props) {
  const dayOfWeek = props.date.getDay()
  const style = {
    color: dayOfWeek === 5 ? 'red' : 'black'
  }
  return (
    <div style={style}>
      {props.label}
      {dayOfWeek === 4 && (
        <div>
          <p>gym day</p>
        </div>
      )}
    </div>
  )
}

export default MyMonthDateHeader

Suggested solution

in dateHeader component we can add static labels for example for every thursday, not in event array

Alternative

No response

Additional context

No response

Validations

  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this feature?

  • I'm willing to open a PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant