chore: lint

This commit is contained in:
cha0s 2021-01-06 22:11:12 -06:00
parent a6436dfc8a
commit d545a8d394
4 changed files with 38 additions and 14 deletions

View File

@ -39,6 +39,7 @@
"@latus/user": "2.0.0", "@latus/user": "2.0.0",
"dotenv": "8.2.0", "dotenv": "8.2.0",
"pixi.js": "^5.3.7", "pixi.js": "^5.3.7",
"prop-types": "^15.7.2",
"react": "^17.0.1", "react": "^17.0.1",
"react-hot-loader": "4.13.0" "react-hot-loader": "4.13.0"
}, },

View File

@ -1,5 +1,5 @@
import {Color, Renderer, Primitives} from '@avocado/graphics'; import {Color, Primitives} from '@avocado/graphics';
import {PixiComponent} from '@inlet/react-pixi' import {PixiComponent} from '@inlet/react-pixi';
const primitives = new Primitives(); const primitives = new Primitives();
primitives.drawCircle( primitives.drawCircle(
@ -12,7 +12,5 @@ primitives.drawCircle(
); );
export default PixiComponent('Humus', { export default PixiComponent('Humus', {
create: props => { create: () => primitives.internal,
return primitives.internal
},
}); });

View File

@ -1,17 +1,30 @@
import './stage.scss'; import './stage.scss';
import {Stage} from '@inlet/react-pixi' import {Stage as PStage} from '@inlet/react-pixi';
import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import Renderer from './renderer'; import Renderer from './renderer';
export default ({width = 800, height = 450}) => ( const Stage = ({width, height}) => (
<div className="stage"> <div className="stage">
<Stage <PStage
width={width} width={width}
height={height} height={height}
> >
<Renderer /> <Renderer />
</Stage> </PStage>
</div> </div>
); );
Stage.defaultProps = {
height: 450,
width: 800,
};
Stage.propTypes = {
height: PropTypes.number,
width: PropTypes.number,
};
export default Stage;

View File

@ -1,16 +1,16 @@
import './ui.scss'; import './ui.scss';
import PropTypes from 'prop-types';
import React, {useEffect, useRef} from 'react'; import React, {useEffect, useRef} from 'react';
export default ({width = 800, height = 450}) => { const Ui = ({width, height}) => {
const RATIO = width / height;
const $ui = useRef(); const $ui = useRef();
useEffect(() => { useEffect(() => {
if (!$ui.current) { if (!$ui.current) {
return undefined; return undefined;
} }
const onResize = () => { const onResize = () => {
const {overflow} = window.document.documentElement.style; const RATIO = width / height;
const {innerWidth, innerHeight} = window; const {innerWidth, innerHeight} = window;
const ratio = innerWidth / innerHeight; const ratio = innerWidth / innerHeight;
let scale; let scale;
@ -28,7 +28,7 @@ export default ({width = 800, height = 450}) => {
window.addEventListener('resize', onResize); window.addEventListener('resize', onResize);
onResize(); onResize();
return () => window.removeEventListener('resize', onResize); return () => window.removeEventListener('resize', onResize);
}, $ui); }, [$ui, height, width]);
return ( return (
<div <div
className="ui" className="ui"
@ -38,7 +38,19 @@ export default ({width = 800, height = 450}) => {
width: `${width}px`, width: `${width}px`,
}} }}
> >
<button>Login</button> <button type="button">Login</button>
</div> </div>
); );
}; };
Ui.defaultProps = {
height: 450,
width: 800,
};
Ui.propTypes = {
height: PropTypes.number,
width: PropTypes.number,
};
export default Ui;