Adding a shift property.
This commit is contained in:
parent
5a663d84d8
commit
04c2c12117
|
@ -19,14 +19,13 @@ import '@ionic/react/css/display.css';
|
|||
/* Theme variables */
|
||||
import './theme/variables.css';
|
||||
|
||||
|
||||
import Background from './components/background';
|
||||
|
||||
setupIonicReact();
|
||||
|
||||
const App: React.FC = () => (
|
||||
<IonApp>
|
||||
<Background />
|
||||
<Background shift={{ x: 1000, y: 1000 }} />
|
||||
</IonApp>
|
||||
);
|
||||
|
||||
|
|
|
@ -2,10 +2,17 @@ import react from 'react';
|
|||
|
||||
import '../theme/background.css';
|
||||
|
||||
const Background: react.FC = () => {
|
||||
const Background: react.FC<{ shift: { x: number; y: number } }> = (props: {
|
||||
shift: { x: number; y: number };
|
||||
}) => {
|
||||
return (
|
||||
<div className='background'>
|
||||
<img src='/assets/background.jpg' />
|
||||
<div
|
||||
className='background'
|
||||
style={{
|
||||
transform: `translate(${-props.shift.x}px, ${-props.shift.y}px)`,
|
||||
}}
|
||||
>
|
||||
<img src='/assets/background.jpg' alt='' />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue