Skip to content

Commit

Permalink
use js strings for svg icons (colorizable)
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Aug 25, 2019
1 parent 1ca8695 commit 31c7b38
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 24 deletions.
15 changes: 13 additions & 2 deletions bin/app.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion icons/bar-chart.svg

This file was deleted.

1 change: 0 additions & 1 deletion icons/clipboard.svg

This file was deleted.

1 change: 0 additions & 1 deletion icons/corner-up-left.svg

This file was deleted.

1 change: 0 additions & 1 deletion icons/list.svg

This file was deleted.

1 change: 0 additions & 1 deletion icons/move.svg

This file was deleted.

1 change: 0 additions & 1 deletion icons/plus-circle.svg

This file was deleted.

1 change: 0 additions & 1 deletion icons/trash-2.svg

This file was deleted.

1 change: 0 additions & 1 deletion icons/x.svg

This file was deleted.

10 changes: 10 additions & 0 deletions src/Icons.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/Utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var Icons = require("./Icons")

module.exports = {
upperCaseFirst: (str, separator = " ") => {
var strArr = str.indexOf(separator) !== -1 ? str.split(separator) : [str]
Expand All @@ -19,7 +21,7 @@ module.exports = {
return str && str[0].match(/\d/)
},
getIcon: name => {
return `<img src="./icons/${name}.svg" class="icon"/>`
return Icons[name]
},
copyToClipboard: el => {
var range, selection;
Expand Down
27 changes: 14 additions & 13 deletions styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ form.property-row button {
padding: 0.5rem;
}

.property-rows .icon {
.property-rows svg {
width: 1rem;
height: auto;
display: block;
Expand Down Expand Up @@ -342,34 +342,35 @@ button[disabled] {
}

.button-transparent.active,
.button-transparent:hover {
.button-transparent:not([disabled]):hover {
background: transparent;
color: var(--link-color);
}

.btnViewToggle.active {
filter: invert(1);
background: #FE9563;
}

[class*="head-"] button {
float: right;
margin: -0.2rem -0.33rem 0 1rem;
padding: 0.33rem 0.5rem !important;
}

[class*="head-"] button:hover {
filter: invert(1);
background: #FE9563;
background: transparent;
}

[class*="head-"] button:not([disabled]):hover svg * {
color: var(--link-color);
}

[class*="head-"] button[disabled]:hover {
background: transparent;
filter: none;
}

[class*="head-"] button:hover .icon {
filter: sepia(2) hue-rotate(80deg);
[class*="head-"] button.active {
background: var(--link-color) !important;
}

[class*="head-"] button.active svg * {
color: white !important;
}

.btnAdd::before {
Expand Down Expand Up @@ -421,7 +422,7 @@ code:empty::after {
text-transform: uppercase;
}

.icon {
svg {
width: 1.08rem;
height: auto;
user-select: none;
Expand Down

0 comments on commit 31c7b38

Please sign in to comment.