UX: better like button

Co-authored-by: jjaffeux <j.jaffeux@gmail.com>
This commit is contained in:
Arpit Jalan 2018-03-30 17:27:07 +05:30
parent a0386655a6
commit 4760f0e7a9
3 changed files with 58 additions and 17 deletions

View File

@ -285,15 +285,18 @@ export default createWidget('post-menu', {
replaceButton(orderedButtons, 'reply', 'wiki-edit');
}
orderedButtons.forEach(i => {
const button = this.attachButton(i, attrs);
if (button) {
allButtons.push(button);
orderedButtons
.filter(x => x !== "like-count" && x !== "like")
.forEach(i => {
const button = this.attachButton(i, attrs);
if ((attrs.yours && button.attrs.alwaysShowYours) || (hiddenButtons.indexOf(i) === -1)) {
visibleButtons.push(button);
if (button) {
allButtons.push(button);
if ((attrs.yours && button.attrs.alwaysShowYours) || (hiddenButtons.indexOf(i) === -1)) {
visibleButtons.push(button);
}
}
}
});
if (!this.settings.collapseButtons) {
@ -350,6 +353,11 @@ export default createWidget('post-menu', {
}
});
visibleButtons.unshift(h('div.like-button', [
this.attachButton("like-count", attrs),
this.attachButton("like", attrs)
]));
const postControls = [];
const repliesButton = this.attachButton('replies', attrs);

View File

@ -54,17 +54,50 @@ nav.post-controls {
padding: 0;
.like-count {
font-size: $font-up-1;
i.fa-heart {
padding-left: 5px;
color: dark-light-choose($primary-low-mid, $secondary-high);
.like-button {
display: inline-block;
.widget-button {
background: none;
}
&.my-likes {
margin-right: -2px;
&:hover {
background: $primary-low;
.d-hover {
background: none;
}
}
&.regular-likes {
margin-right: -15px;
&:active {
box-shadow: inset 0 1px 3px rgba(0,0,0, .4);
.widget-button {
box-shadow: none;
}
}
.like {
&:focus {
background: none;
}
}
.like-count {
font-size: $font-up-1;
i.fa-heart {
padding-left: 5px;
color: dark-light-choose($primary-low-mid, $secondary-high);
}
&.my-likes {
margin-right: -2px;
}
&.regular-likes {
margin-right: -12px;
}
}
.toggle-like {
padding: 8px 8px;
}
}

View File

@ -72,7 +72,7 @@ span.badge-posts {
margin-right: 5px;
}
&.regular-likes {
margin-right: -8px;
margin-right: -5px;
}
}
}