-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🩹 Make FieldSelector static waves work on any screen ratio
- Loading branch information
Showing
6 changed files
with
126 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,41 @@ | ||
import { FC } from 'react'; | ||
import { FC, useEffect, useState } from 'react'; | ||
|
||
import { NoiseSvg } from './NoiseSvg'; // Assuming it's another SVG file | ||
import WaveStaticSvg from './WaveStaticSvg'; // Assuming it's an SVG file | ||
import { WaveStaticSvg } from './WaveStaticSvg'; // Assuming it's an SVG file | ||
|
||
export const WaveStatic: FC = () => ( | ||
<svg | ||
width="1920" | ||
height="1080" | ||
viewBox="0 0 1920 1080" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
{/* Render the WaveStaticSvg */} | ||
<WaveStaticSvg /> | ||
export const WaveStatic: FC = () => { | ||
const [viewBox, setViewBox] = useState( | ||
`0 0 ${window.innerWidth} ${window.innerHeight - 64}` | ||
); | ||
|
||
{/* Render the NoiseSvg with blend mode "multiply" */} | ||
<g style={{ filter: 'grayscale(1)', mixBlendMode: 'color-burn' }}> | ||
<NoiseSvg /> | ||
</g> | ||
</svg> | ||
); | ||
useEffect(() => { | ||
const resizeHandler = (event: Event) => { | ||
const target = event.target as Window; | ||
console.log(target); | ||
setViewBox(`0 0 ${target.innerWidth} ${target.innerHeight - 64}`); | ||
}; | ||
|
||
window.addEventListener('resize', resizeHandler); | ||
|
||
return () => { | ||
window.removeEventListener('resize', resizeHandler); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<svg | ||
width="100%" | ||
height="100%" | ||
viewBox={viewBox} | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
{/* Render the WaveStaticSvg */} | ||
<WaveStaticSvg viewBox={viewBox} /> | ||
|
||
{/* Render the NoiseSvg with blend mode "multiply" */} | ||
<g style={{ filter: 'grayscale(1)', mixBlendMode: 'color-burn' }}> | ||
<NoiseSvg viewBox={viewBox} /> | ||
</g> | ||
</svg> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,8 @@ export const Container = styled.div` | |
); | ||
> svg { | ||
position: absolute; | ||
z-index: 0; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters