A platform for community discussion. Free, open, simple.
UX: better like button
Arpit Jalan4760f0e7a97e
diff --git a/app/assets/javascripts/discourse/widgets/post-menu.js.es6 b/app/assets/javascripts/discourse/widgets/post-menu.js.es6index be2fdc0569a..10505a8d55a 100644--- a/app/assets/javascripts/discourse/widgets/post-menu.js.es6+++ b/app/assets/javascripts/discourse/widgets/post-menu.js.es6@@ -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);diff --git a/app/assets/stylesheets/desktop/topic-post.scss b/app/assets/stylesheets/desktop/topic-post.scssindex 3c3726c2ea7..3f367297aed 100644--- a/app/assets/stylesheets/desktop/topic-post.scss+++ b/app/assets/stylesheets/desktop/topic-post.scss@@ -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;}}diff --git a/app/assets/stylesheets/mobile/topic-post.scss b/app/assets/stylesheets/mobile/topic-post.scssindex 7c7cba6997f..f9b20e51c86 100644--- a/app/assets/stylesheets/mobile/topic-post.scss+++ b/app/assets/stylesheets/mobile/topic-post.scss@@ -72,7 +72,7 @@ span.badge-posts {margin-right: 5px;}&.regular-likes {- margin-right: -8px;+ margin-right: -5px;}}}