The background component is now a container (and should probably be renamed overlay).
This commit is contained in:
parent
6887cd0102
commit
e0b6c69cfc
|
@ -5,17 +5,25 @@ import '../theme/background.css';
|
|||
const Background: react.FC<{
|
||||
shift: { x: number; y: number };
|
||||
zoom: number;
|
||||
}> = (props: { shift: { x: number; y: number }; zoom: number }) => {
|
||||
console.log(`--- Rendering background, props: ${JSON.stringify(props)} ---`);
|
||||
children?: JSX.Element;
|
||||
}> = (props: {
|
||||
shift: { x: number; y: number };
|
||||
zoom: number;
|
||||
children?: JSX.Element;
|
||||
}) => {
|
||||
const {children: children, ...argProps} = props;
|
||||
console.log(`--- Rendering background, props: ${JSON.stringify(argProps)} ---`);
|
||||
|
||||
return (
|
||||
<div
|
||||
className='background'
|
||||
style={{
|
||||
transform: `translate(${-props.shift.x}px, ${-props.shift.y}px) scale(${props.zoom})`,
|
||||
transform: `translate(${-props.shift.x}px, ${-props.shift.y}px) scale(${
|
||||
props.zoom
|
||||
})`,
|
||||
}}
|
||||
>
|
||||
<img src='/assets/background.jpg' alt='' />
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -221,7 +221,9 @@ const Viewport: react.FC<{}> = (props: {}) => {
|
|||
onTouchEnd={touchEndHandler}
|
||||
onTouchCancel={mouseLeaveHandler}
|
||||
>
|
||||
<Background shift={shift} zoom={zoom}/>
|
||||
<Background shift={shift} zoom={zoom}>
|
||||
<img src='/assets/background.jpg' alt='' />
|
||||
</Background>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -5,7 +5,3 @@
|
|||
z-index: -1;
|
||||
}
|
||||
|
||||
.background img {
|
||||
width: 4032px;
|
||||
height: 2268px;
|
||||
}
|
||||
|
|
|
@ -3,3 +3,9 @@
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.background img {
|
||||
width: 4032px;
|
||||
height: 2268px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue