style(subscription): prioritize default payment option
Docker Image / Build and Push Docker Image (push) Successful in 3m34s

This commit is contained in:
2026-07-08 14:49:08 +08:00
parent b4f01cdffb
commit 18aa69bdd9
2 changed files with 11 additions and 1 deletions
@@ -24,6 +24,7 @@ const PAYMENT_METHODS: Array<{
export interface SubscriptionPaymentMethodProps { export interface SubscriptionPaymentMethodProps {
value: PayChannel; value: PayChannel;
defaultChannel?: PayChannel;
disabled?: boolean; disabled?: boolean;
caption?: string; caption?: string;
onChange: (channel: PayChannel) => void; onChange: (channel: PayChannel) => void;
@@ -31,10 +32,18 @@ export interface SubscriptionPaymentMethodProps {
export function SubscriptionPaymentMethod({ export function SubscriptionPaymentMethod({
value, value,
defaultChannel = "stripe",
disabled = false, disabled = false,
caption = "Stripe by default", caption = "Stripe by default",
onChange, onChange,
}: SubscriptionPaymentMethodProps) { }: SubscriptionPaymentMethodProps) {
const paymentMethods =
defaultChannel === "ezpay"
? [...PAYMENT_METHODS].sort((a, b) =>
a.channel === "ezpay" ? -1 : b.channel === "ezpay" ? 1 : 0,
)
: PAYMENT_METHODS;
return ( return (
<section className={styles.root} aria-labelledby="payment-method-title"> <section className={styles.root} aria-labelledby="payment-method-title">
<div className={styles.header}> <div className={styles.header}>
@@ -44,7 +53,7 @@ export function SubscriptionPaymentMethod({
<span className={styles.caption}>{caption}</span> <span className={styles.caption}>{caption}</span>
</div> </div>
<div className={styles.options}> <div className={styles.options}>
{PAYMENT_METHODS.map((method) => { {paymentMethods.map((method) => {
const selected = method.channel === value; const selected = method.channel === value;
const classes = [ const classes = [
styles.option, styles.option,
@@ -211,6 +211,7 @@ export function SubscriptionScreen({
<section className={styles.paymentMethodSlot}> <section className={styles.paymentMethodSlot}>
<SubscriptionPaymentMethod <SubscriptionPaymentMethod
value={payment.payChannel} value={payment.payChannel}
defaultChannel={resolvedInitialPayChannel}
disabled={isPaymentBusy} disabled={isPaymentBusy}
caption="GCash by default in the Philippines" caption="GCash by default in the Philippines"
onChange={(payChannel) => { onChange={(payChannel) => {