DEV: Refactor payment plan buttons (#131)

This commit is contained in:
Penar Musaraj 2022-09-14 18:32:22 -04:00 committed by GitHub
parent a78b92ddcc
commit 39b7253c08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 23 deletions

View File

@ -1,12 +0,0 @@
import Button from "discourse/components/d-button";
export default Button.extend({
seleted: false,
init() {
this._super(...arguments);
this.classNameBindings = this.classNameBindings.concat(
"selected:btn-primary"
);
},
});

View File

@ -5,8 +5,8 @@ const RECURRING = "recurring";
export default Component.extend({ export default Component.extend({
@discourseComputed("selectedPlan") @discourseComputed("selectedPlan")
selected(planId) { selectedClass(planId) {
return planId === this.plan.id; return planId === this.plan.id ? "btn-primary" : "";
}, },
@discourseComputed("plan.type") @discourseComputed("plan.type")

View File

@ -1,14 +1,11 @@
{{#ds-button <DButton
action=(action "planClick") @action={{action "planClick"}} @class={{concat "btn-discourse-subscriptions-subscribe " selectedClass}}>
selected=selected
class="btn-discourse-subscriptions-subscribe"
}}
<div class="interval"> <div class="interval">
{{#if recurringPlan}} {{#if this.recurringPlan}}
{{i18n {{i18n
(concat (concat
"discourse_subscriptions.plans.interval.adverb." "discourse_subscriptions.plans.interval.adverb."
plan.recurring.interval this.plan.recurring.interval
) )
}} }}
{{else}} {{else}}
@ -17,6 +14,6 @@
</div> </div>
<span class="amount"> <span class="amount">
{{format-currency plan.currency plan.amountDollars}} {{format-currency this.plan.currency this.plan.amountDollars}}
</span> </span>
{{/ds-button}} </DButton>