(index)
| 960 | } |
| 961 | |
| 962 | renderWeekHeader(index) { |
| 963 | const { |
| 964 | daySize, |
| 965 | horizontalMonthPadding, |
| 966 | orientation, |
| 967 | renderWeekHeaderElement, |
| 968 | styles, |
| 969 | } = this.props; |
| 970 | |
| 971 | const { calendarMonthWidth } = this.state; |
| 972 | |
| 973 | const verticalScrollable = orientation === VERTICAL_SCROLLABLE; |
| 974 | |
| 975 | const horizontalStyle = { |
| 976 | left: index * calendarMonthWidth, |
| 977 | }; |
| 978 | const verticalStyle = { |
| 979 | marginLeft: -calendarMonthWidth / 2, |
| 980 | }; |
| 981 | |
| 982 | let weekHeaderStyle = {}; // no styles applied to the vertical-scrollable orientation |
| 983 | if (this.isHorizontal()) { |
| 984 | weekHeaderStyle = horizontalStyle; |
| 985 | } else if (this.isVertical() && !verticalScrollable) { |
| 986 | weekHeaderStyle = verticalStyle; |
| 987 | } |
| 988 | |
| 989 | const weekHeaders = this.getWeekHeaders(); |
| 990 | const header = weekHeaders.map((day) => ( |
| 991 | <li key={day} {...css(styles.DayPicker_weekHeader_li, { width: daySize })}> |
| 992 | {renderWeekHeaderElement ? renderWeekHeaderElement(day) : <small>{day}</small>} |
| 993 | </li> |
| 994 | )); |
| 995 | |
| 996 | return ( |
| 997 | <div |
| 998 | {...css( |
| 999 | styles.DayPicker_weekHeader, |
| 1000 | this.isVertical() && styles.DayPicker_weekHeader__vertical, |
| 1001 | verticalScrollable && styles.DayPicker_weekHeader__verticalScrollable, |
| 1002 | weekHeaderStyle, |
| 1003 | { padding: `0 ${horizontalMonthPadding}px` }, |
| 1004 | )} |
| 1005 | key={`week-${index}`} |
| 1006 | > |
| 1007 | <ul {...css(styles.DayPicker_weekHeader_ul)}> |
| 1008 | {header} |
| 1009 | </ul> |
| 1010 | </div> |
| 1011 | ); |
| 1012 | } |
| 1013 | |
| 1014 | render() { |
| 1015 | const { |
no test coverage detected