Skip to content

Commit

Permalink
style: smooth video edges
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoSoaress committed Jul 8, 2024
1 parent 164cb1e commit e57d154
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/components/GasStation/Hero/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import type { BaseBlock } from '@/components/Home/types'
import Slider from '@/components/GasStation/Slider'
import css from './styles.module.css'
import { Button, Typography } from '@mui/material'
import clsx from 'clsx'
import css from './styles.module.css'

const Hero = ({ title, text, link }: BaseBlock) => {
return (
<div className={css.videoWrapper}>
<div className={css.gradientBase} />
<video autoPlay muted playsInline loop poster="/images/GasStation/gas-station.png" className={css.video}>
<source src="/videos/GasStation/gas-station.webm" type="video/webm" />
<source src="/videos/GasStation/gas-station.mp4" type="video/mp4" />
Expand All @@ -27,7 +29,7 @@ const Hero = ({ title, text, link }: BaseBlock) => {
</Button>
)}
</div>
<div className={css.gradient} />
<div className={clsx(css.gradientBase, css.gradientFlipped)} />
</div>
)
}
Expand Down
18 changes: 13 additions & 5 deletions src/components/GasStation/Hero/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.videoWrapper {
position: relative;
z-index: -1;
}

.video {
Expand All @@ -16,17 +17,24 @@
}

@media (min-width: 900px) {
.gradient {
.gradientBase {
position: absolute;
width: 138px;
width: 94px;
top: 0;
right: 0;
bottom: 39px;
bottom: 38px;
left: 0;
background: linear-gradient(270deg, rgba(18, 19, 18, 0) 0%, var(--mui-palette-background-default) 100%);
transform: scaleX(-1.005); /* prevent 1px gap glitch */
z-index: 1;
}

.gradientFlipped {
left: auto;
right: 0;
bottom: 38px;
width: 138px;
transform: scaleX(-1);
}

.videoWrapper {
margin-top: calc(-1 * var(--header-height));
}
Expand Down

0 comments on commit e57d154

Please sign in to comment.