mostly working

This commit is contained in:
Mashy 2019-05-17 23:48:37 +10:00
parent 0b026a2cdc
commit 90fd71ede7
4 changed files with 124 additions and 56 deletions

View File

@ -125,11 +125,11 @@
.cryp-list { .cryp-list {
grid-area: cryps; grid-area: cryps;
display: grid; display: flex;
grid-template-columns: 1fr 1fr 1fr; flex: 1 1 auto;
} }
.instance-cryp { .instance-cryp, .instance-cryp-active {
display: grid; display: grid;
grid-template-rows: min-content min-content min-content 250px min-content; grid-template-rows: min-content min-content min-content 250px min-content;
grid-template-areas: grid-template-areas:
@ -152,49 +152,50 @@
margin-left: 0; margin-left: 0;
} }
.instance-cryp .name { .cryp-list .name {
grid-area: name; grid-area: name;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
.instance-cryp .avatar { .cryp-list .avatar {
grid-area: avatar; grid-area: avatar;
display: flex; display: flex;
flex: 1 1 auto; flex: 1 1 auto;
} }
.instance-cryp img { .cryp-list img {
justify-self: center; justify-self: center;
grid-area: avatar; grid-area: avatar;
min-width: 150px; min-width: 150px;
} }
.instance-cryp .name { .cryp-list .name {
text-align: center; text-align: center;
} }
.instance-cryp .avatar figure { .cryp-list .avatar figure {
margin: 0; margin: 0;
height: 80%; height: 80%;
text-align: center; text-align: center;
box-sizing: border-box; box-sizing: border-box;
} }
.instance-cryp .avatar figcaption { .cryp-list .avatar figcaption {
font-size: 90%; font-size: 90%;
} }
.instance-cryp .skills { .cryp-list .skills {
grid-area: skills; grid-area: skills;
display: flex; display: flex;
border-width: 0px; border-width: 0px;
} }
.instance-cryp .skills button { .cryp-list .skills button {
flex: 1; flex: 1;
border-width: 0px; border-width: 0px;
} }
/*button.action { /*button.action {
animation: action 1s infinite ease-in-out alternate; animation: action 1s infinite ease-in-out alternate;
} }
@ -208,7 +209,7 @@
} }
} }
*/ */
.instance-cryp .specs { .cryp-list .specs {
margin-top: 1em; margin-top: 1em;
grid-area: specs; grid-area: specs;
display: flex; display: flex;
@ -217,18 +218,18 @@
border-width: 0px; border-width: 0px;
} }
.instance-cryp .specs figure { .cryp-list .specs figure {
flex: 1; flex: 1;
border: 0; border: 0;
align-items: center; align-items: center;
text-align: center; text-align: center;
} }
.instance-cryp .specs figcaption { .cryp-list .specs figcaption {
font-size: 75%; font-size: 75%;
} }
.instance-cryp .stats { .cryp-list .stats {
grid-area: stats; grid-area: stats;
display: grid; display: grid;
grid-template-rows: 1fr 3fr; grid-template-rows: 1fr 3fr;
@ -239,11 +240,11 @@
border-width: 0px; border-width: 0px;
} }
.instance-cryp .stats figcaption { .cryp-list .stats figcaption {
font-size: 75%; font-size: 75%;
} }
.instance-cryp .stats .icons { .cryp-list .stats .icons {
grid-area: st; grid-area: st;
display: flex; display: flex;
flex-flow: row; flex-flow: row;
@ -261,25 +262,25 @@
fill: none; fill: none;
} }
.instance-cryp .stat-icon { .cryp-list .stat-icon {
width: 100%; width: 100%;
} }
.instance-cryp .stats .damage-label { .cryp-list .stats .damage-label {
grid-area: dl; grid-area: dl;
display: flex; display: flex;
justify-content: center; justify-content: center;
color: #666; color: #666;
} }
.instance-cryp .stats .speed-label { .cryp-list .stats .speed-label {
grid-area: sl; grid-area: sl;
display: flex; display: flex;
justify-content: center; justify-content: center;
color: #666; color: #666;
} }
.instance-cryp .stats .life-label { .cryp-list .stats .life-label {
grid-area: ll; grid-area: ll;
display: flex; display: flex;
justify-content: center; justify-content: center;

View File

@ -2,42 +2,17 @@
.instance { .instance {
display: grid; display: grid;
grid-template-columns: 100%; grid-template-columns: 100%;
grid-template-rows: min-content min-content min-content min-content; grid-template-rows: repeat(4, min-content);
grid-template-areas: grid-template-areas:
"top" "top"
"controls" "controls"
"first" "first"
"second" "second"
} }
/* Default view */
.instance .equip { display: none; } .instance .equip { display: none; }
.instance .info { display: none; } .instance .info { display: none; }
.instance .cryp-list { display: none; } .instance .cryp-list { display: none; }
#toggle-vbox-label {
text-align: center;
border: 2px solid #555;
}
#toggle-vbox-label:after{
content: "Cryps";
}
#toggle-vbox:checked ~ #toggle-vbox-label:after{
content: "Vbox";
}
#toggle-vbox:checked ~ .vbox { display: none; }
#toggle-vbox:checked ~ .cryp-list {
display: initial;
grid-area: second;
}
#toggle-vbox:checked ~ .equip {
display: initial;
grid-area: first;
}
.vbox { .vbox {
grid-area: first; grid-area: first;
display: grid; display: grid;
@ -56,6 +31,34 @@
.vbox-combiner { .vbox-combiner {
margin-left: 0; margin-left: 0;
} }
/* Toggled view (cryps)*/
#toggle-vbox-label {
text-align: center;
border: 2px solid #555;
}
#toggle-vbox-label:after{
content: "Cryps";
}
#toggle-vbox:checked ~ #toggle-vbox-label:after{
content: "Vbox";
}
#toggle-vbox:checked ~ .vbox { display: none; }
#toggle-vbox:checked ~ .equip {
grid-area: first;
display: initial;
}
#toggle-vbox:checked ~ .cryp-list {
grid-area: second;
display: flex;
justify-content: center;
flex-flow: row wrap;
flex: 1;
width: 100%;
}
#toggle-vbox { display: none; } #toggle-vbox { display: none; }
@ -69,5 +72,69 @@
margin-right: 0.5em; margin-right: 0.5em;
} }
.cryp-list .skills {
flex-flow: row;
align-items: stretch;
}
.instance-cryp {
flex: 1;
display: grid;
grid-template-rows: min-content min-content;
grid-template-areas:
"name "
"avatar "
/*margin: 0 2em;*/
padding: 0.5em;
border: 2px solid #222;
transition-property: all;
transition-duration: 0.5s;
transition-delay: 0;
transition-timing-function: ease;
}
.instance-cryp img {
width: 35px;
}
.instance-cryp .skills {
display: none;
}
.instance-cryp .specs {
display: none;
}
.instance-cryp .stats {
display: none;
}
.instance-cryp-active {
flex: 1;
order: 3;
display: grid;
grid-template-rows: min-content min-content min-content min-content min-content;
grid-template-areas:
"name "
"skills "
"specs "
"avatar "
"stats ";
/*margin: 0 2em;*/
padding: 0.5em;
border: 2px solid #222;
transition-property: all;
transition-duration: 0.5s;
transition-delay: 0;
transition-timing-function: ease;
}
.instance-cryp-active img {
width: 55px;
}
/* Cryp Stuff */
} }

View File

@ -508,10 +508,6 @@ main .top {
svg { svg {
height: 1em; height: 1em;
} }
.instance-cryp .skills {
flex-flow: column;
}
} }
/* Mobile Nav*/ /* Mobile Nav*/

View File

@ -8,7 +8,7 @@ const actions = require('../actions');
const addState = connect( const addState = connect(
function receiveState(state) { function receiveState(state) {
const { ws, instance, player, account, vboxHidden, vboxInfo, activeVar } = state; const { ws, instance, player, account, vboxHidden, vboxInfo, activeVar, activeCryp } = state;
function sendInstanceReady() { function sendInstanceReady() {
return ws.sendInstanceReady(instance.id); return ws.sendInstanceReady(instance.id);
@ -18,7 +18,7 @@ const addState = connect(
return ws.sendVboxApply(instance.id, crypId, i); return ws.sendVboxApply(instance.id, crypId, i);
} }
return { instance, player, account, sendInstanceReady, sendVboxApply, vboxHidden, vboxInfo, activeVar }; return { instance, player, account, sendInstanceReady, sendVboxApply, vboxHidden, vboxInfo, activeVar, activeCryp };
}, },
function receiveDispatch(dispatch) { function receiveDispatch(dispatch) {
@ -49,6 +49,7 @@ const addState = connect(
function Cryp(props) { function Cryp(props) {
const { const {
activeCryp,
activeVar, activeVar,
cryp, cryp,
player, player,
@ -137,6 +138,8 @@ function Cryp(props) {
<figcaption>{cryp[s.stat].value}</figcaption> <figcaption>{cryp[s.stat].value}</figcaption>
</figure> </figure>
)); ));
const activeId = activeCryp ? activeCryp.id : false;
const crypClass = activeId === cryp.id ? 'instance-cryp-active' : 'instance-cryp';
// const cTotal = cryp.colours.red + cryp.colours.blue + cryp.colours.green; // const cTotal = cryp.colours.red + cryp.colours.blue + cryp.colours.green;
// const colours = mapValues(cryp.colours, c => { // const colours = mapValues(cryp.colours, c => {
@ -152,7 +155,7 @@ function Cryp(props) {
// }; // };
// const border = { border: `${thickness(cTotal)}px solid rgba(${colours.red}, ${colours.green}, ${colours.blue}, ${alpha})` }; // const border = { border: `${thickness(cTotal)}px solid rgba(${colours.red}, ${colours.green}, ${colours.blue}, ${alpha})` };
return ( return (
<div key={cryp.id} className="instance-cryp" onClick={onClick} > <div key={cryp.id} className={crypClass} onClick={onClick} >
{crypAvatar(cryp.name)} {crypAvatar(cryp.name)}
<h2 className="name" >{cryp.name}</h2> <h2 className="name" >{cryp.name}</h2>
<div className="skills"> <div className="skills">
@ -181,6 +184,7 @@ function Cryp(props) {
function InstanceCryps(props) { function InstanceCryps(props) {
const { const {
activeCryp,
activeVar, activeVar,
player, player,
instance, instance,
@ -198,7 +202,7 @@ function InstanceCryps(props) {
if (instance.phase === 'Lobby') return false; if (instance.phase === 'Lobby') return false;
const cryps = player.cryps.map((c, i) => Cryp({ const cryps = player.cryps.map((c, i) => Cryp({
activeVar, cryp: c, player, sendVboxApply, setInfo, setActiveCryp, vboxInfo, setVboxHighlight, activeCryp, activeVar, cryp: c, player, sendVboxApply, setInfo, setActiveCryp, vboxInfo, setVboxHighlight,
})); }));
const classes = `cryp-list ${vboxHidden ? '' : 'hidden'}`; const classes = `cryp-list ${vboxHidden ? '' : 'hidden'}`;