Skip to content

Commit 1c8aed2

Browse files
committed
added videos to WelcomePageButtons
1 parent d5c5a97 commit 1c8aed2

File tree

9 files changed

+30
-11
lines changed

9 files changed

+30
-11
lines changed
Binary file not shown.
Loading
Loading
Binary file not shown.

src/Components/Core/Presentation/React/ReactRelated/ReactEntryPoint/WelcomePage.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { useTranslation } from "react-i18next";
66
import LogoutComponent from "~ReactComponents/WelcomePage/SignInAndOutComponent/LogoutComponent";
77
import WelcomePageButton from "~ReactComponents/WelcomePage/WelcomePageButton/WelcomePageButtonView";
88
import LMSButton from "~ReactComponents/WelcomePage/LMSButton/LMSButtonView";
9+
import learningWorldButtonBackgroundVideo from "../../../../../../Assets/misc/WelcomeScreenButtonBackgrounds/BackgroundVideoLernweltButton.mp4";
10+
import avatarEditorButtonBackgroundVideo from "../../../../../../Assets/misc/WelcomeScreenButtonBackgrounds/BackgroundVideoAvatarEditorButton.mp4";
911

1012
export default function WelcomePage() {
1113
const { t: translate } = useTranslation("start");
@@ -29,12 +31,12 @@ export default function WelcomePage() {
2931

3032
<section className="flex items-center justify-around col-span-6 col-start-2 row-span-3 row-start-3 gap-4 mb-4 portrait:h-full portrait:flex-col portrait:row-start-3 portrait:row-span-3 portrait:col-start-2 portrait:gap-6">
3133
<WelcomePageButton
32-
backgroundImage="!bg-learningworldbg"
34+
backgroundVideo={learningWorldButtonBackgroundVideo}
3335
historyPath="/worldmenu"
3436
label={translate("learningWorldButton")}
3537
/>
3638
<WelcomePageButton
37-
backgroundImage="!bg-avatarcreatorbg"
39+
backgroundVideo={avatarEditorButtonBackgroundVideo}
3840
historyPath="/avatarEditor"
3941
label={translate("avatarEditorButton")}
4042
/>

src/Components/Core/Presentation/React/WelcomePage/WelcomePageButton/WelcomePageButtonView.tsx

+24-7
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import useObservable from "~ReactComponents/ReactRelated/CustomHooks/useObservab
77
import { useInjection } from "inversify-react";
88
import IGetLoginStatusUseCase from "src/Components/Core/Application/UseCases/GetLoginStatus/IGetLoginStatusUseCase";
99
import USECASE_TYPES from "~DependencyInjection/UseCases/USECASE_TYPES";
10-
import { useEffect } from "react";
1110
import { AdLerUIComponent } from "src/Components/Core/Types/ReactTypes";
1211
import tailwindMerge from "../../../Utils/TailwindMerge";
12+
import React, { useEffect, useRef } from "react";
1313

1414
type WelcomePageButtonProps = {
15-
backgroundImage: string;
15+
backgroundVideo: string;
1616
historyPath: string;
1717
label: string;
1818
} & AdLerUIComponent;
@@ -29,29 +29,46 @@ export default function WelcomePageButton(props: WelcomePageButtonProps) {
2929
viewModel?.userLoggedIn,
3030
);
3131

32+
const videoRef = useRef<HTMLVideoElement>(null);
33+
3234
useEffect(() => {
3335
setUserLoggedIn(getLoginStatusUseCase.execute().isLoggedIn);
3436
}, [getLoginStatusUseCase, setUserLoggedIn]);
3537

3638
return (
3739
<StyledButton
3840
shape="freeFloatCenterNoPadding"
39-
containerClassName=" w-full lg:w-1/2 h-full"
41+
containerClassName="w-full lg:w-1/2 h-full"
4042
onClick={() => history.push(props.historyPath)}
4143
disabled={!userLoggedIn}
4244
className={tailwindMerge(
4345
`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,
4547
props.className ?? "",
4648
)}
4749
>
48-
{userLoggedIn && (
50+
{userLoggedIn ? (
4951
<>
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 ">
5261
{props.label}
5362
</p>
5463
</>
64+
) : (
65+
<>
66+
<video
67+
ref={videoRef}
68+
src={props.backgroundVideo}
69+
className="w-full h-full object-cover grayscale"
70+
></video>
71+
</>
5572
)}
5673
</StyledButton>
5774
);

tailwind.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ module.exports = {
1515
extend: {
1616
backgroundImage: {
1717
learningworldbg:
18-
"url('/src/Assets/misc/WelcomeScreenButtonBackgrounds/LearningWorldButtonBackground.png')",
18+
"url('/src/Assets/misc/WelcomeScreenButtonBackgrounds/LearningWorldButtonBackground.jpg')",
1919
avatarcreatorbg:
20-
"url('/src/Assets/misc/WelcomeScreenButtonBackgrounds/AvatarCreatorButtonBackground.png')",
20+
"url('/src/Assets/misc/WelcomeScreenButtonBackgrounds/AvatarEditorButtonBackground.jpg')",
2121
},
2222
keyframes: {
2323
wiggle: {

0 commit comments

Comments
 (0)