|
1 | 1 | <script lang="ts">
|
2 |
| - import { formatCurrency } from '$lib/helpers/numbers'; |
| 2 | + import { Button } from '$lib/elements/forms'; |
3 | 3 | import type { Coupon } from '$lib/sdk/billing';
|
4 |
| - import { Tooltip } from '@appwrite.io/pink-svelte'; |
| 4 | + import { formatCurrency } from '$lib/helpers/numbers'; |
| 5 | + import { IconTag, IconX } from '@appwrite.io/pink-icons-svelte'; |
| 6 | + import { Badge, Icon, Layout, Tooltip, Typography } from '@appwrite.io/pink-svelte'; |
5 | 7 |
|
6 | 8 | export let couponData: Partial<Coupon> = {
|
7 | 9 | code: null,
|
8 | 10 | status: null,
|
9 | 11 | credits: null
|
10 | 12 | };
|
| 13 | +
|
11 | 14 | export let fixedCoupon = false;
|
12 | 15 | </script>
|
13 | 16 |
|
14 | 17 | {#if couponData?.credits}
|
15 |
| - <span class="u-flex u-main-space-between"> |
16 |
| - <div class="u-flex u-cross-center u-gap-4"> |
17 |
| - <p class="text"> |
18 |
| - <span class="icon-tag u-color-text-success" aria-hidden="true"></span> |
| 18 | + <Layout.Stack direction="row" justifyContent="space-between"> |
| 19 | + <Layout.Stack inline direction="row" gap="s" alignItems="center" alignContent="center"> |
| 20 | + <Layout.Stack |
| 21 | + inline |
| 22 | + direction="row" |
| 23 | + gap="xxs" |
| 24 | + alignItems="center" |
| 25 | + alignContent="center"> |
| 26 | + <Icon icon={IconTag} color="--fgcolor-success" size="s" /> |
19 | 27 | {#if couponData.credits >= 100}
|
20 | 28 | {couponData?.code?.toUpperCase()}
|
21 | 29 | {:else}
|
22 |
| - <span |
23 |
| - ><Tooltip |
24 |
| - >Credits applied <span slot="tooltip" |
25 |
| - >{couponData?.code?.toUpperCase()}</span |
26 |
| - ></Tooltip |
27 |
| - ></span> |
| 30 | + <Tooltip> |
| 31 | + <Typography.Text color="--fgcolor-neutral-primary" |
| 32 | + >Credits applied</Typography.Text> |
| 33 | + <span slot="tooltip">{couponData?.code?.toUpperCase()}</span> |
| 34 | + </Tooltip> |
28 | 35 | {/if}
|
29 |
| - </p> |
| 36 | + </Layout.Stack> |
| 37 | + |
30 | 38 | {#if !fixedCoupon}
|
31 |
| - <button |
32 |
| - type="button" |
33 |
| - class="button is-text is-only-icon" |
34 |
| - style="--button-size:1.5rem;" |
35 |
| - aria-label="Close" |
36 |
| - title="Close" |
37 |
| - on:click={() => |
38 |
| - (couponData = { |
| 39 | + <Button |
| 40 | + extraCompact |
| 41 | + icon |
| 42 | + on:click={() => { |
| 43 | + couponData = { |
39 | 44 | code: null,
|
40 | 45 | status: null,
|
41 | 46 | credits: null
|
42 |
| - })}> |
43 |
| - <span class="icon-x" aria-hidden="true"></span> |
44 |
| - </button> |
| 47 | + }; |
| 48 | + }}> |
| 49 | + <Icon icon={IconX} size="s" /> |
| 50 | + </Button> |
45 | 51 | {/if}
|
46 |
| - </div> |
| 52 | + </Layout.Stack> |
| 53 | + |
47 | 54 | {#if couponData.credits >= 100}
|
48 |
| - <p class="inline-tag">Credits applied</p> |
| 55 | + <Badge variant="secondary" content="Credits applied" /> |
49 | 56 | {:else}
|
50 |
| - <span class="u-color-text-success">-{formatCurrency(couponData.credits)}</span> |
| 57 | + <Typography.Text color="--fgcolor-success" |
| 58 | + >-{formatCurrency(couponData.credits)}</Typography.Text> |
51 | 59 | {/if}
|
52 |
| - </span> |
| 60 | + </Layout.Stack> |
53 | 61 | {/if}
|
0 commit comments