File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,7 @@ import {
2323} from './types' ;
2424
2525const BOX_POSITION_OFFSET = 26 ;
26- const HOUR_TO_DECIMAL = 1.666666667 ;
27- const MIN_BOX_SIZE = 40 ;
26+ const SCROLL_TO_ROW = 19 ;
2827const TURQUOISE = '#36CFC9' ;
2928const ALL_DAY_ROW = 0 ;
3029
@@ -81,6 +80,14 @@ function Calendar<T extends GenericEvent>({
8180 onEventClick,
8281 weekends,
8382} : CalendarBodyProps < T > ) {
83+ const rowRef = useRef < null | HTMLDivElement > ( null ) ;
84+
85+ useEffect ( ( ) => {
86+ if ( rowRef . current ) {
87+ rowRef . current ?. scrollIntoView ( ) ;
88+ }
89+ } , [ rowRef ] ) ;
90+
8491 const getDayHoursEvents = (
8592 value : GetWeekDates ,
8693 weekObject : WeekObject < T > | undefined
@@ -213,12 +220,17 @@ function Calendar<T extends GenericEvent>({
213220 dataIndex : 'hour' ,
214221 key : 'hour' ,
215222 width : 1 ,
216- render : ( hour : ColumnNode < T > ) => {
223+ render : ( hour : ColumnNode < T > , { } , id : number ) => {
217224 return {
218225 props : {
219226 style : { width : '10%' } ,
220227 } ,
221- children : < div > { hour } </ div > ,
228+ children :
229+ SCROLL_TO_ROW === id ? (
230+ < div ref = { rowRef } > { hour } </ div >
231+ ) : (
232+ < div > { hour } </ div >
233+ ) ,
222234 } ;
223235 } ,
224236 } ;
You can’t perform that action at this time.
0 commit comments