diff --git a/html-client/cryps.css b/html-client/cryps.css index 275e03cb..ad8ae80c 100755 --- a/html-client/cryps.css +++ b/html-client/cryps.css @@ -241,6 +241,11 @@ button:hover { padding: 0.25em 0; } +.cryp-box .stats figcaption { + font-size: 75%; +} + + .cryp-box .stats svg { height: 1.5em; stroke-width: 2px; diff --git a/html-client/src/components/cryp.list.component.jsx b/html-client/src/components/cryp.list.component.jsx new file mode 100644 index 00000000..b42a8789 --- /dev/null +++ b/html-client/src/components/cryp.list.component.jsx @@ -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
not ready
; + + // 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 ( +
+
selectCryp(cryp.id)} > +
+ {molecule} +
+

{cryp.name}

+
+
+ ); + }); + + return ( +
+ {crypPanels} +
+ ); +} + +module.exports = CrypList; diff --git a/html-client/src/components/vbox.component.jsx b/html-client/src/components/vbox.component.jsx index 339fb50c..316ada0a 100644 --- a/html-client/src/components/vbox.component.jsx +++ b/html-client/src/components/vbox.component.jsx @@ -108,7 +108,7 @@ function Vbox(args) { {combinerElement}