Skip to content

Commit c3f746c

Browse files
committed
fix update gaping and component
1 parent e2cc4f6 commit c3f746c

File tree

2 files changed

+58
-50
lines changed

2 files changed

+58
-50
lines changed

src/lib/components/billing/paymentModal.svelte

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -101,34 +101,33 @@
101101
bind:error
102102
onSubmit={handleSubmit}>
103103
<slot />
104-
<InputText
105-
id="name"
106-
required
107-
autofocus={true}
108-
bind:value={name}
109-
label="Cardholder name"
110-
placeholder="Cardholder name" />
111-
112-
<div class="aw-stripe-container" data-private>
113-
{#if isLoading}
114-
<div class="loader-element">
115-
<Spinner />
116-
</div>
117-
{/if}
118-
{#if showState}
119-
<div class="state-element">
120-
<!-- input select for state picker -->
121-
<StatePicker card={paymentMethod} bind:state />
122-
</div>
123-
{:else}
104+
{#if showState}
105+
<div class="state-element">
106+
<!-- input select for state picker -->
107+
<StatePicker card={paymentMethod} bind:state />
108+
</div>
109+
{:else}
110+
<InputText
111+
id="name"
112+
required
113+
autofocus={true}
114+
bind:value={name}
115+
label="Cardholder name"
116+
placeholder="Cardholder name" />
117+
<div class="aw-stripe-container" data-private>
118+
{#if isLoading}
119+
<div class="loader-element">
120+
<Spinner />
121+
</div>
122+
{/if}
124123
<div
125124
style:display={isLoading ? 'none' : 'initial'}
126125
class="stripe-element"
127126
bind:this={element}>
128127
<!-- Stripe will create form elements here -->
129128
</div>
130-
{/if}
131-
</div>
129+
</div>
130+
{/if}
132131
<slot name="end"></slot>
133132
<svelte:fragment slot="footer">
134133
<Button secondary on:click={() => (show = false)}>Cancel</Button>

src/lib/components/billing/statePicker.svelte

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,50 @@
22
import { states } from './states.js';
33
import { InputSelect } from '$lib/elements/forms';
44
import type { PaymentMethod } from '@stripe/stripe-js';
5-
import Card from '../card.svelte';
6-
import { Alert, Layout, Typography } from '@appwrite.io/pink-svelte';
5+
import { Alert, Card, Layout, Typography } from '@appwrite.io/pink-svelte';
76
import { CreditCardBrandImage } from '../index.js';
87
98
export let state: string = '';
109
export let card: PaymentMethod | null = null;
1110
</script>
1211

13-
{#if card}
14-
<Card>
15-
<Layout.Stack direction="row" alignItems="center" gap="s">
16-
<CreditCardBrandImage brand={card.card?.brand} />
17-
<span>ending in {card.card?.last4}</span>
18-
</Layout.Stack>
12+
<div class="state-picker-container">
13+
{#if card}
14+
<Card.Base variant="secondary" padding="s">
15+
<Layout.Stack direction="row" alignItems="center" gap="s">
16+
<CreditCardBrandImage brand={card.card?.brand} />
17+
<span>ending in {card.card?.last4}</span>
18+
</Layout.Stack>
19+
<Typography.Text size="s">
20+
{card.card.country}
21+
{card.billing_details.address.postal_code}
22+
</Typography.Text>
23+
</Card.Base>
24+
{/if}
25+
26+
<Alert.Inline status="info" title="State is required for US payment methods">
1927
<Typography.Text size="s">
20-
{card.card.country}
21-
{card.billing_details.address.postal_code}
28+
To complete the billing information, select your state so we can apply the correct taxes
29+
and meet U.S. legal requirements.
2230
</Typography.Text>
23-
</Card>
24-
{/if}
31+
</Alert.Inline>
2532

26-
<Alert.Inline status="info" title="State is required for US payment methods">
27-
<Typography.Text size="s">
28-
To complete the billing information, select your state so we can apply the correct taxes and
29-
meet U.S. legal requirements.
30-
</Typography.Text>
31-
</Alert.Inline>
33+
<InputSelect
34+
bind:value={state}
35+
label="State"
36+
placeholder="Select a state"
37+
id="state-picker"
38+
options={states.map((state) => ({
39+
label: state.name,
40+
value: state.abbreviation,
41+
id: state.abbreviation.toLowerCase()
42+
}))} />
43+
</div>
3244

33-
<InputSelect
34-
bind:value={state}
35-
label="State"
36-
placeholder="Select a state"
37-
id="state-picker"
38-
options={states.map((state) => ({
39-
label: state.name,
40-
value: state.abbreviation,
41-
id: state.abbreviation.toLowerCase()
42-
}))} />
45+
<style>
46+
.state-picker-container {
47+
display: flex;
48+
flex-direction: column;
49+
gap: 1rem;
50+
}
51+
</style>

0 commit comments

Comments
 (0)