|
2 | 2 | import { states } from './states.js';
|
3 | 3 | import { InputSelect } from '$lib/elements/forms';
|
4 | 4 | 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'; |
7 | 6 | import { CreditCardBrandImage } from '../index.js';
|
8 | 7 |
|
9 | 8 | export let state: string = '';
|
10 | 9 | export let card: PaymentMethod | null = null;
|
11 | 10 | </script>
|
12 | 11 |
|
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"> |
19 | 27 | <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. |
22 | 30 | </Typography.Text>
|
23 |
| - </Card> |
24 |
| -{/if} |
| 31 | + </Alert.Inline> |
25 | 32 |
|
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> |
32 | 44 |
|
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