@@ -7,12 +7,12 @@ import useObservable from "~ReactComponents/ReactRelated/CustomHooks/useObservab
7
7
import { useInjection } from "inversify-react" ;
8
8
import IGetLoginStatusUseCase from "src/Components/Core/Application/UseCases/GetLoginStatus/IGetLoginStatusUseCase" ;
9
9
import USECASE_TYPES from "~DependencyInjection/UseCases/USECASE_TYPES" ;
10
- import { useEffect } from "react" ;
11
10
import { AdLerUIComponent } from "src/Components/Core/Types/ReactTypes" ;
12
11
import tailwindMerge from "../../../Utils/TailwindMerge" ;
12
+ import React , { useEffect , useRef } from "react" ;
13
13
14
14
type WelcomePageButtonProps = {
15
- backgroundImage : string ;
15
+ backgroundVideo : string ;
16
16
historyPath : string ;
17
17
label : string ;
18
18
} & AdLerUIComponent ;
@@ -29,29 +29,46 @@ export default function WelcomePageButton(props: WelcomePageButtonProps) {
29
29
viewModel ?. userLoggedIn ,
30
30
) ;
31
31
32
+ const videoRef = useRef < HTMLVideoElement > ( null ) ;
33
+
32
34
useEffect ( ( ) => {
33
35
setUserLoggedIn ( getLoginStatusUseCase . execute ( ) . isLoggedIn ) ;
34
36
} , [ getLoginStatusUseCase , setUserLoggedIn ] ) ;
35
37
36
38
return (
37
39
< StyledButton
38
40
shape = "freeFloatCenterNoPadding"
39
- containerClassName = " w-full lg:w-1/2 h-full"
41
+ containerClassName = "w-full lg:w-1/2 h-full"
40
42
onClick = { ( ) => history . push ( props . historyPath ) }
41
43
disabled = { ! userLoggedIn }
42
44
className = { tailwindMerge (
43
45
`relative !px-0 !py-0 flex flex-col items-center justify-end !w-full !h-full col-span-3 col-start-6 bg-cover` ,
44
- props . backgroundImage ,
46
+ props . backgroundVideo ,
45
47
props . className ?? "" ,
46
48
) }
47
49
>
48
- { userLoggedIn && (
50
+ { userLoggedIn ? (
49
51
< >
50
- < div className = "w-full h-full bg-black opacity-30 hover:opacity-20" />
51
- < p className = "absolute p-4 mx-auto text-2xl font-bold rounded-lg text-center bg-buttonbgblue lg:bottom-[42%] portrait:bottom-[20%] portrait:text-lg bottom-32 text-adlerdarkblue" >
52
+ < video
53
+ ref = { videoRef }
54
+ src = { props . backgroundVideo }
55
+ onMouseEnter = { ( ) => videoRef . current ?. play ( ) }
56
+ onMouseLeave = { ( ) => videoRef . current ?. pause ( ) }
57
+ loop
58
+ className = "w-full h-full object-cover"
59
+ > </ video >
60
+ < p className = "absolute p-4 mx-auto text-2xl font-bold rounded-lg text-center bg-buttonbgblue lg:bottom-[42%] portrait:bottom-[20%] portrait:text-lg bottom-32 text-adlerdarkblue " >
52
61
{ props . label }
53
62
</ p >
54
63
</ >
64
+ ) : (
65
+ < >
66
+ < video
67
+ ref = { videoRef }
68
+ src = { props . backgroundVideo }
69
+ className = "w-full h-full object-cover grayscale"
70
+ > </ video >
71
+ </ >
55
72
) }
56
73
</ StyledButton >
57
74
) ;
0 commit comments