2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-08-17 18:04:11 +08:00

DEV: Simple refactor of button markup (#34256)

This commit is contained in:
Jordan Vidrine 2025-08-12 13:00:32 -05:00 committed by GitHub
parent ff57cadd69
commit e8cda50573
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 28 deletions

View file

@ -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}}

View file

@ -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")

View file

@ -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>