Skip to content

Commit

Permalink
#72 Вёрстка уведомления
Browse files Browse the repository at this point in the history
  • Loading branch information
xaota committed Jul 18, 2017
1 parent 4628e1f commit 58fe833
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,14 @@ <h3>Добавить тег</h3>
</div>
</article>


<div id="notify" class="state active info">
<h5>Заголовок уведомления</h5>
<div>
<p>Текст уведомления из нескольких строк</p>
<p>вторая строка</p>
<p>Третья строка</p>
</div>
</div>
</body>
</html>
3 changes: 3 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@

/** @section INIT */
$.ready(_ => ui.ready());
$.ready(function() {
UI.notify('Тест','текст').info();
});

})(window, document);
17 changes: 17 additions & 0 deletions script/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ class UI {
static value(input) { // ?
return $(input).value();
}

static notify(header = '', ...text) {
return {
info() {
show();
}
}

function show() {
$('#notify > h5').text(header);
$('#notify > div').clear().loop(init, text.length, text);
}

function init(index, string) {
this.add('p').text(string);
}
}
}

class Controller {
Expand Down
1 change: 1 addition & 0 deletions style.less
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ input.splash { display: none;
#layer-editor-toggle:checked ~ #splash > label[for="layer-editor-toggle"] { display: block; }

@import "style/control.less";
@import "style/notify.less";
15 changes: 15 additions & 0 deletions style/notify.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#notify {
.font(1em);
.color(@color-second, @color-black);
.edge(@color-accent);
.shadow(@shadow-offset, @shadow-offset, @shadow-blur, @color-shadow);
width: 320px;
min-height: 4em;
position: fixed;
left: 1em;
bottom: 1em;
padding: 1em;
}
#notify > h5 {
.font(1em, bold);
}

0 comments on commit 58fe833

Please sign in to comment.