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:
parent
ff57cadd69
commit
e8cda50573
3 changed files with 23 additions and 28 deletions
|
@ -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}}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue