Skip to content

A platform for community discussion. Free, open, simple.

DEV: Simple refactor of button markup (#34256)

Jordan Vidrinee8cda50573c2
diff --git a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-counter.gjs b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-counter.gjs
index 188b15697ef..874665731ed 100644
--- a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-counter.gjs
+++ b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-counter.gjs
@@ -5,7 +5,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { TrackedObject } from "@ember-compat/tracked-built-ins";
import { and } from "truth-helpers";
-import icon from "discourse/helpers/d-icon";
+import DButton from "discourse/components/d-button";
import { bind } from "discourse/lib/decorators";
import closeOnClickOutside from "discourse/modifiers/close-on-click-outside";
import CustomReaction from "../models/discourse-reactions-custom-reaction";
@@ -203,12 +203,10 @@ export default class DiscourseReactionsCounter extends Component {
{{#if (and @post.yours this.onlyOneMainReaction)}}
<div class="discourse-reactions-reaction-button my-likes">
- <button
- type="button"
- class="btn-toggle-reaction-like btn-icon no-text reaction-button"
- >
- {{icon this.siteSettings.discourse_reactions_like_icon}}
- </button>
+ <DButton
+ class="btn-toggle-reaction-like btn-flat btn-icon no-text reaction-button"
+ @icon={{this.siteSettings.discourse_reactions_like_icon}}
+ />
</div>
{{/if}}
{{/if}}
diff --git a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-picker.gjs b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-picker.gjs
index 15b02154c1e..d36d597e84b 100644
--- a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-picker.gjs
+++ b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-picker.gjs
@@ -134,6 +134,7 @@ export default class DiscourseReactionsPicker extends Component {
{{#each this.reactionInfo as |reaction|}}
<DButton
class={{concatClass
+ "btn-flat"
"pickable-reaction"
reaction.id
(if reaction.canUndo "can-undo")
diff --git a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-reaction-button.gjs b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-reaction-button.gjs
index 84844708a3d..2569e2a8290 100644
--- a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-reaction-button.gjs
+++ b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-reaction-button.gjs
@@ -4,7 +4,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { isBlank } from "@ember/utils";
-import icon from "discourse/helpers/d-icon";
+import DButton from "discourse/components/d-button";
import { emojiUrlFor } from "discourse/lib/text";
import { i18n } from "discourse-i18n";
@@ -115,35 +115,31 @@ export default class ReactionsReactionButton extends Component {
title={{this.title}}
>
{{#if @post.current_user_used_main_reaction}}
- <button
- type="button"
- class="btn-toggle-reaction-like btn-icon no-text reaction-button"
- title={{this.title}}
- >
- {{icon this.siteSettings.discourse_reactions_like_icon}}
- </button>
+ <DButton
+ class="btn-toggle-reaction-like btn-flat btn-icon no-text reaction-button"
+ @translatedTitle={{this.title}}
+ @icon={{this.siteSettings.discourse_reactions_like_icon}}
+ />
{{else if @post.current_user_reaction}}
- <button
- type="button"
- class="btn-icon no-text reaction-button"
- title={{this.title}}
+ <DButton
+ class="btn-icon no-text btn-flat reaction-button"
+ @translatedTitle={{this.title}}
>
<img
class="btn-toggle-reaction-emoji reaction-button"
src={{emojiUrlFor @post.current_user_reaction.id}}
alt={{concat ":" @post.current_user_reaction.id}}
/>
- </button>
+ </DButton>
{{else}}
- <button
- type="button"
- class="btn-toggle-reaction-like btn-icon no-text reaction-button"
- title={{this.title}}
- >
- {{icon
- (concat "far-" this.siteSettings.discourse_reactions_like_icon)
+ <DButton
+ class="btn-toggle-reaction-like btn-flat btn-icon no-text reaction-button"
+ @translatedTitle={{this.title}}
+ @icon={{concat
+ "far-"
+ this.siteSettings.discourse_reactions_like_icon
}}
- </button>
+ />
{{/if}}
</div>
</template>