mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-03-06 09:39:51 +00:00
FIX: set Discourse consistent styles on Stripe card element (#124)
* FIX: set Discourse consistent styles on Stripe card element * use correct placeholder color * applied prettier * mock update method for cardElement * minor formatting
This commit is contained in:
parent
8762d6742e
commit
392b88265b
@ -4,6 +4,25 @@ export default Component.extend({
|
|||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.cardElement.mount("#card-element");
|
this.cardElement.mount("#card-element");
|
||||||
|
this.setCardElementStyles();
|
||||||
|
},
|
||||||
|
|
||||||
|
setCardElementStyles() {
|
||||||
|
const root = document.querySelector(":root");
|
||||||
|
const computedStyle = getComputedStyle(root);
|
||||||
|
const primaryColor = computedStyle.getPropertyValue("--primary");
|
||||||
|
const placeholderColor =
|
||||||
|
computedStyle.getPropertyValue("--secondary-medium");
|
||||||
|
this.cardElement.update({
|
||||||
|
style: {
|
||||||
|
base: {
|
||||||
|
color: primaryColor,
|
||||||
|
"::placeholder": {
|
||||||
|
color: placeholderColor,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
},
|
},
|
||||||
didDestroyElement() {},
|
didDestroyElement() {},
|
||||||
});
|
});
|
||||||
|
@ -15,6 +15,7 @@ export function stubStripe() {
|
|||||||
on() {},
|
on() {},
|
||||||
card() {},
|
card() {},
|
||||||
mount() {},
|
mount() {},
|
||||||
|
update() {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user