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({
@discourseComputed("selectedPlan")
selected(planId) {
return planId === this.plan.id;
selectedClass(planId) {
return planId === this.plan.id ? "btn-primary" : "";
},
@discourseComputed("plan.type")

View File

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