wip added svg icons into description strings

This commit is contained in:
Mashy
2019-08-14 00:51:01 +10:00
parent fe56528b3f
commit 8a74d9e3c4
4 changed files with 71 additions and 56 deletions
+5
View File
@@ -55,6 +55,11 @@
text-transform: uppercase;
}
.instance .info svg {
display: inline;
height: 1.25em;
}
.instance .constructs {
grid-area: constructs;
}
+1
View File
@@ -28,6 +28,7 @@
"preact-compat": "^3.19.0",
"preact-context": "^1.1.3",
"preact-redux": "^2.1.0",
"react-string-replace": "^0.4.4",
"react-stripe-elements": "^3.0.0",
"redux": "^4.0.0"
},
+12 -2
View File
@@ -1,5 +1,6 @@
const preact = require('preact');
const range = require('lodash/range');
const reactStringReplace = require('react-string-replace');
const { INFO } = require('./../constants');
const { convertItem } = require('../utils');
@@ -24,10 +25,15 @@ function InfoComponent(args) {
const isSpec = fullInfo.spec;
if (isSkill) {
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => {
return shapes[match]();
});
return (
<div class="info-skill">
<h2>{fullInfo.item}</h2>
<div>{fullInfo.description}</div>
<div> {infoDescription} </div>
</div>
);
}
@@ -103,11 +109,15 @@ function InfoComponent(args) {
</div>
);
});
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => {
return shapes[match]();
});
return (
<div class="info-spec">
<h2>{info}</h2>
<div>{fullInfo.description}</div>
<div>{infoDescription}</div>
<div class="thresholds">
{thresholds}
</div>