File tree Expand file tree Collapse file tree 5 files changed +35
-2
lines changed Expand file tree Collapse file tree 5 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { Routes } from 'react-router-dom'
33import { toast , ToastContainer } from 'react-toastify'
44
55import { Header } from './header'
6- import { routeContext , RouteContextData } from './lib'
6+ import { routeContext , RouteContextData , useViewportUnitsFix } from './lib'
77
88const App : FC < { } > = ( ) => {
99
@@ -12,6 +12,8 @@ const App: FC<{}> = () => {
1212 const routeElements : Array < ReactElement > = allRoutes
1313 . map ( route => getRouteElement ( route ) )
1414
15+ useViewportUnitsFix ( )
16+
1517 return (
1618 < >
1719 < Header />
Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ export * from './use-check-is-mobile.hook'
22export * from './use-click-outside.hook'
33export * from './use-on-hover-element.hook'
44export * from './use-storage.hook'
5+ export * from './use-viewport-units-fix.hook'
56export * from './use-window-size.hook'
Original file line number Diff line number Diff line change 1+ import { MutableRefObject , useRef } from 'react'
2+
3+ import { useWindowSize , WindowSize } from './use-window-size.hook'
4+
5+ /**
6+ * On mobile, vh units are not consistent accross devices/browsers,
7+ * this hook listen to window resize and fixes sets a --vh CSS variable
8+ * on the document root, so we can access it everywhere
9+ *
10+ * @see https://css-tricks.com/the-trick-to-viewport-units-on-mobile
11+ */
12+ export function useViewportUnitsFix ( ) : void {
13+ const { height } : WindowSize = useWindowSize ( )
14+ const wasHeight : MutableRefObject < number > = useRef ( height )
15+
16+ if ( wasHeight . current !== height ) {
17+ // We execute the same script as before
18+ const vh : number = window . innerHeight * 0.01
19+ document . documentElement . style . setProperty ( '--vh' , `${ vh } px` )
20+ }
21+ }
Original file line number Diff line number Diff line change 1010 display : flex ;
1111 flex-direction : column ;
1212 width : 100vw ;
13- height : 100 vh ;
13+ height : calc ( var ( --vh , 1 vh ) * 100 ) ;
1414 margin : auto ;
1515 border-radius : 0 ;
1616 padding : $space-xxl $space-xxxxl $space-xxxxl ;
Original file line number Diff line number Diff line change @@ -82,6 +82,15 @@ const CertificationDetailsSidebar: FC<CertificationDetailsSidebarProps> = (props
8282 </ span >
8383 < span className = 'quote-main' >
8484 < CompletionTimeRange range = { props . certification . completionTimeRange } />
85+ < Tooltip
86+ content = { renderTooltipContents ( < IconSolid . ClockIcon /> , [
87+ 'Assuming 4 hour' ,
88+ 'learning per day' ,
89+ ] ) }
90+ place = 'bottom'
91+ trigger = { < IconOutline . InformationCircleIcon /> }
92+ triggerOn = 'hover'
93+ />
8594 </ span >
8695 </ li >
8796 { ! props . certProgress && (
You can’t perform that action at this time.
0 commit comments