Skip to content

Commit ac3cf3c

Browse files
Merge pull request #1978 from appwrite/migrate-pink2
Migrate component to pink2.
2 parents 39428e5 + 9936bf9 commit ac3cf3c

File tree

1 file changed

+36
-28
lines changed

1 file changed

+36
-28
lines changed
Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,61 @@
11
<script lang="ts">
2-
import { formatCurrency } from '$lib/helpers/numbers';
2+
import { Button } from '$lib/elements/forms';
33
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';
57
68
export let couponData: Partial<Coupon> = {
79
code: null,
810
status: null,
911
credits: null
1012
};
13+
1114
export let fixedCoupon = false;
1215
</script>
1316

1417
{#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" />
1927
{#if couponData.credits >= 100}
2028
{couponData?.code?.toUpperCase()}
2129
{: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>
2835
{/if}
29-
</p>
36+
</Layout.Stack>
37+
3038
{#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 = {
3944
code: null,
4045
status: null,
4146
credits: null
42-
})}>
43-
<span class="icon-x" aria-hidden="true"></span>
44-
</button>
47+
};
48+
}}>
49+
<Icon icon={IconX} size="s" />
50+
</Button>
4551
{/if}
46-
</div>
52+
</Layout.Stack>
53+
4754
{#if couponData.credits >= 100}
48-
<p class="inline-tag">Credits applied</p>
55+
<Badge variant="secondary" content="Credits applied" />
4956
{:else}
50-
<span class="u-color-text-success">-{formatCurrency(couponData.credits)}</span>
57+
<Typography.Text color="--fgcolor-success"
58+
>-{formatCurrency(couponData.credits)}</Typography.Text>
5159
{/if}
52-
</span>
60+
</Layout.Stack>
5361
{/if}

0 commit comments

Comments
 (0)