@@ -8,12 +8,10 @@ import {
88 useState ,
99 useContext ,
1010 useId ,
11- Fragment ,
1211 Suspense ,
1312 useEffect ,
1413 useRef ,
1514 useTransition ,
16- useReducer ,
1715} from 'react' ;
1816import cn from 'classnames' ;
1917import NextLink from 'next/link' ;
@@ -26,7 +24,6 @@ import {IconSearch} from 'components/Icon/IconSearch';
2624import { Logo } from 'components/Logo' ;
2725import Link from 'components/MDX/Link' ;
2826import CodeBlock from 'components/MDX/CodeBlock' ;
29- import { IconNavArrow } from 'components/Icon/IconNavArrow' ;
3027import { ExternalLink } from 'components/ExternalLink' ;
3128import sidebarBlog from '../../sidebarBlog.json' ;
3229
@@ -67,14 +64,6 @@ function Para({children}) {
6764 ) ;
6865}
6966
70- function Left ( { children} ) {
71- return (
72- < div className = "px-5 lg:px-0 max-w-4xl lg:text-left text-white text-opacity-80" >
73- { children }
74- </ div >
75- ) ;
76- }
77-
7867function Center ( { children} ) {
7968 return (
8069 < div className = "px-5 lg:px-0 max-w-4xl lg:text-center text-white text-opacity-80 flex flex-col items-center justify-center" >
@@ -90,19 +79,23 @@ function FullBleed({children}) {
9079}
9180
9281function CurrentTime ( ) {
93- const msPerMinute = 60 * 1000 ;
94- const date = new Date ( ) ;
95- let nextMinute = Math . floor ( + date / msPerMinute + 1 ) * msPerMinute ;
96-
82+ const [ date , setDate ] = useState ( new Date ( ) ) ;
9783 const currentTime = date . toLocaleTimeString ( [ ] , {
9884 hour : 'numeric' ,
9985 minute : 'numeric' ,
10086 } ) ;
101- let [ , forceUpdate ] = useReducer ( ( n ) => n + 1 , 0 ) ;
10287 useEffect ( ( ) => {
103- const timeout = setTimeout ( forceUpdate , nextMinute - Date . now ( ) ) ;
88+ const msPerMinute = 60 * 1000 ;
89+ let nextMinute = Math . floor ( + date / msPerMinute + 1 ) * msPerMinute ;
90+
91+ const timeout = setTimeout ( ( ) => {
92+ if ( Date . now ( ) > nextMinute ) {
93+ setDate ( new Date ( ) ) ;
94+ }
95+ } , nextMinute - Date . now ( ) ) ;
10496 return ( ) => clearTimeout ( timeout ) ;
10597 } , [ date ] ) ;
98+
10699 return < span suppressHydrationWarning > { currentTime } </ span > ;
107100}
108101
@@ -831,7 +824,7 @@ function ExampleLayout({
831824 . filter ( ( s ) => s !== null ) ;
832825 setOverlayStyles ( nextOverlayStyles ) ;
833826 }
834- } , [ activeArea ] ) ;
827+ } , [ activeArea , hoverTopOffset ] ) ;
835828 return (
836829 < div className = "lg:pl-10 lg:pr-5 w-full" >
837830 < div className = "mt-12 mb-2 lg:my-16 max-w-7xl mx-auto flex flex-col w-full lg:rounded-2xl lg:bg-card lg:dark:bg-card-dark" >
@@ -1211,7 +1204,7 @@ function useNestedScrollLock(ref) {
12111204 window . removeEventListener ( 'scroll' , handleScroll ) ;
12121205 clearInterval ( interval ) ;
12131206 } ;
1214- } , [ ] ) ;
1207+ } , [ ref ] ) ;
12151208}
12161209
12171210function ExamplePanel ( {
@@ -1220,7 +1213,6 @@ function ExamplePanel({
12201213 noShadow,
12211214 height,
12221215 contentMarginTop,
1223- activeArea,
12241216} ) {
12251217 return (
12261218 < div
0 commit comments