This commit is contained in:
ntr 2019-03-31 14:56:32 +11:00
parent 5f8490d8e2
commit 5e31f2f842
3 changed files with 63 additions and 1 deletions

View File

@ -241,6 +241,11 @@ button:hover {
padding: 0.25em 0; padding: 0.25em 0;
} }
.cryp-box .stats figcaption {
font-size: 75%;
}
.cryp-box .stats svg { .cryp-box .stats svg {
height: 1.5em; height: 1.5em;
stroke-width: 2px; stroke-width: 2px;

View File

@ -0,0 +1,57 @@
const preact = require('preact');
const { stringSort } = require('./../utils');
const molecule = require('./molecule');
const idSort = stringSort('id');
const COLOURS = [
'#a52a2a',
'#1FF01F',
'#3498db',
];
function CrypList({ cryps, selectedCryps, setSelectedCryps }) {
if (!cryps) return <div>not ready</div>;
// redux limitation + suggested workaround
// so much for dumb components
function selectCryp(id) {
if (selectedCryps.length < 3) {
selectedCryps.push(id);
return setSelectedCryps(selectedCryps);
}
return false;
}
const crypPanels = cryps.sort(idSort).map(cryp => {
const colour = selectedCryps.indexOf(cryp.id);
const selected = colour > -1;
const borderColour = selected ? COLOURS[colour] : '#000000';
return (
<div
key={cryp.id}
className="menu-cryp-ctr">
<div
className="menu-cryp"
style={ { 'border-color': borderColour || 'whitesmoke' } }
onClick={() => selectCryp(cryp.id)} >
<figure className="img">
{molecule}
</figure>
<h2>{cryp.name}</h2>
</div>
</div>
);
});
return (
<div className="menu-cryps">
{crypPanels}
</div>
);
}
module.exports = CrypList;

View File

@ -108,7 +108,7 @@ function Vbox(args) {
<button <button
className="instance-btn instance-ui-btn vbox-btn" className="instance-btn instance-ui-btn vbox-btn"
onClick={() => sendVboxCombine()}> onClick={() => sendVboxCombine()}>
combine repurpose
</button> </button>
{combinerElement} {combinerElement}
</div> </div>