diff --git a/ui/wolf.ui.css b/ui/wolf.ui.css index 1dbb64a..da547db 100644 --- a/ui/wolf.ui.css +++ b/ui/wolf.ui.css @@ -81,16 +81,17 @@ border-radius: 2px; display: inline-block; height: 2.5rem; - line-height: 36px; + line-height: unset; padding: 0 16px; vertical-align: middle; -webkit-tap-highlight-color: transparent; margin-left: 0.5rem; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.12), 0 1px 5px 0 rgba(0, 0, 0, 0.2); + user-select: none; } -.wolf-dialog-buttons button .material-icons { - line-height: unset; +.wolf-dialog-buttons button>i.icon.with-text { + margin-right: 0.3rem; } .wolf-dialog-buttons button.cancel { @@ -100,4 +101,21 @@ .wolf-dialog-buttons button:hover { box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.14), 0 1px 7px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -1px rgba(0, 0, 0, 0.2); background-color: #2bbbad; +} + +/* === Icons (using material) === */ + +i.icon { + font-family: 'Material Icons'; + font-weight: normal; + font-style: normal; + font-size: 1.5em; + line-height: unset; + letter-spacing: normal; + text-transform: none; + display: inline-block; + white-space: nowrap; + direction: ltr; + -webkit-font-smoothing: antialiased; + vertical-align: middle; } \ No newline at end of file diff --git a/ui/wolf.ui.js b/ui/wolf.ui.js index c3ed3df..83e1180 100644 --- a/ui/wolf.ui.js +++ b/ui/wolf.ui.js @@ -96,7 +96,14 @@ } else for (var k in uidef) { var def = uidef[k]; - var button = UI.instanceTemplate({ type: "button", a: {}, w: {}, c: [{ value: def.text }] }, { parent: dialog })[0]; + if (!def) + continue; //def can be null in order to cancel a button in json strucutres + var btcontent = []; + if (def.icon) + btcontent.push({ type: "i", a: { class: "icon" + (def.text ? " with-text" : "") }, w: {}, c: [{ value: def.icon }] }); + if (def.text) + btcontent.push({ value: def.text }); + var button = UI.instanceTemplate({ type: "button", a: {}, w: {}, c: btcontent }, { parent: dialog })[0]; if (def.default) button.classList.add("default"); if (def.cancel)