Skip to content

Commit

Permalink
Fix video cover
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Dec 6, 2024
1 parent 5e840a2 commit ed345ee
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Binary file added frontend/public/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions frontend/src/assets/css/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ div.home div.home-content video {
object-fit: cover;
}

div.home div.home-content div.video-background {
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
background-image: url('/cover.png');
background-repeat: no-repeat;
background-size: cover;
background-position: 50%;
}

/* div.home div.home-content::before {
position: absolute;
top: 0;
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const Home = () => {
const [locations, setLocations] = useState<bookcarsTypes.Location[]>([])
const [ranges, setRanges] = useState([bookcarsTypes.CarRange.Mini, bookcarsTypes.CarRange.Midi])
const [openRangeSearchFormDialog, setOpenRangeSearchFormDialog] = useState(false)
const [videoLoaded, setVideoLoaded] = useState(false)

const handleTabChange = (_event: React.SyntheticEvent, newValue: number) => {
setTabValue(newValue)
Expand Down Expand Up @@ -87,10 +88,14 @@ const Home = () => {
loop
playsInline
disablePictureInPicture
onLoadedData={() => {
setVideoLoaded(true)
}}
>
<source src="cover.mp4" type="video/mp4" />
<track kind="captions" />
</video>
{!videoLoaded && <div className="video-background" />}
</div>

<div className="home-title">{strings.TITLE}</div>
Expand Down

0 comments on commit ed345ee

Please sign in to comment.