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 */
|
/* Theme variables */
|
||||||
import './theme/variables.css';
|
import './theme/variables.css';
|
||||||
|
|
||||||
|
|
||||||
import Background from './components/background';
|
import Background from './components/background';
|
||||||
|
|
||||||
setupIonicReact();
|
setupIonicReact();
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<IonApp>
|
<IonApp>
|
||||||
<Background />
|
<Background shift={{ x: 1000, y: 1000 }} />
|
||||||
</IonApp>
|
</IonApp>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,17 @@ import react from 'react';
|
||||||
|
|
||||||
import '../theme/background.css';
|
import '../theme/background.css';
|
||||||
|
|
||||||
const Background: react.FC = () => {
|
const Background: react.FC<{ shift: { x: number; y: number } }> = (props: {
|
||||||
|
shift: { x: number; y: number };
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div className='background'>
|
<div
|
||||||
<img src='/assets/background.jpg' />
|
className='background'
|
||||||
|
style={{
|
||||||
|
transform: `translate(${-props.shift.x}px, ${-props.shift.y}px)`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img src='/assets/background.jpg' alt='' />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue