This commit is contained in:
ntr
2019-03-29 13:33:48 +11:00
parent 1b01fa5bea
commit 4900e9d31e
4 changed files with 61 additions and 27 deletions
@@ -1,24 +1,33 @@
const preact = require('preact');
// const key = require('keymaster');
const range = require('lodash/range');
const VboxContainer = require('./vbox.container');
const molecule = require('./molecule');
const saw = require('./saw.component');
function Cryp(cryp) {
const skills = cryp.skills.map((s, i) => (
<button key={i} className="cryp-skill-btn" >{s.skill}</button>
));
const skills = range(0, 4).map((i) => {
const s = cryp.skills[i]
? cryp.skills[i].skill
: (<span>&nbsp;</span>);
return <button key={i} className="cryp-skill-btn" >{s}</button>;
});
const stats = [
'hp',
'green_damage',
'red_shield',
'red_damage',
'blue_damage',
'blue_shield',
'speed',
{ stat: 'hp', colour: '#1FF01F' },
{ stat: 'green_damage', colour: '#1FF01F' },
{ stat: 'red_shield', colour: '#a52a2a' },
{ stat: 'red_damage', colour: '#a52a2a' },
{ stat: 'blue_shield', colour: '#3498db' },
{ stat: 'blue_damage', colour: '#3498db' },
{ stat: 'speed', colour: '#FFD123' },
].map((s, i) => (
<span key={i} >{cryp[s].stat} {cryp[s].value}</span>
<figure key={i} >
{saw(s.colour)}
<figcaption>{cryp[s.stat].value}</figcaption>
</figure>
));
return (
@@ -46,7 +55,7 @@ function InstanceComponent(args) {
if (!instance) return <div>...</div>;
let cryps = instance.cryps.map(Cryp);
const cryps = instance.cryps.map(Cryp);
return (
<section>
@@ -1,14 +1,13 @@
// eslint-disable-next-line
const preact = require('preact');
const saw = require('./saw.component');
function renderLogin({ account, submitLogin, submitRegister }) {
if (account) return (
<div className="header-status">
<h3 className="header-username">{account.name}</h3>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" className="ping-svg">
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
</svg>
{saw('whitesmoke')}
</div>
);
@@ -0,0 +1,10 @@
const preact = require('preact');
module.exports = function saw(colour) {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" style={{ stroke: colour }}>
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
</svg>
);
}