Skip to content

Commit ca33fb9

Browse files
authored
Revert "Updated form to use "Add Recipient Address"" (#200)
1 parent 0e41f62 commit ca33fb9

File tree

2 files changed

+18
-82
lines changed

2 files changed

+18
-82
lines changed

packages/create-invoice-form/src/lib/invoice/form.svelte

Lines changed: 17 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// Icons
1010
import Trash from "@requestnetwork/shared-icons/trash.svelte";
1111
import Plus from "@requestnetwork/shared-icons/plus.svelte";
12-
import Close from "@requestnetwork/shared-icons/close.svelte";
1312
1413
// Types
1514
import type { IConfig, CustomFormData } from "@requestnetwork/shared-types";
@@ -50,8 +49,11 @@
5049
},
5150
};
5251
53-
let creatorId = formData.creatorId || "";
54-
let showPayeeAddressInput = false;
52+
let creatorId = "";
53+
54+
$: {
55+
creatorId = formData.creatorId;
56+
}
5557
5658
const validateEmail = (email: string, type: "sellerInfo" | "buyerInfo") => {
5759
validationErrors[`${type}`].email = !isEmail(email);
@@ -152,17 +154,6 @@
152154
const removeInvoiceItem = (index: number) => {
153155
formData.invoiceItems = formData.invoiceItems.filter((_, i) => i !== index);
154156
};
155-
156-
const togglePayeeAddress = () => {
157-
showPayeeAddressInput = !showPayeeAddressInput;
158-
if (!showPayeeAddressInput) {
159-
formData.payeeAddress = creatorId;
160-
}
161-
};
162-
163-
$: if (!showPayeeAddressInput && creatorId) {
164-
formData.payeeAddress = creatorId;
165-
}
166157
</script>
167158

168159
<form class="invoice-form">
@@ -191,38 +182,6 @@
191182
label="From"
192183
placeholder="Connect wallet to populate"
193184
/>
194-
{#if !showPayeeAddressInput}
195-
<Button
196-
text="+ Add Recipient Address"
197-
type="button"
198-
onClick={togglePayeeAddress}
199-
className="invoice-form-add-recipient-button"
200-
/>
201-
{:else}
202-
<div class="payee-address-container">
203-
<Input
204-
label="Where do you want to receive your payment?"
205-
id="payeeAddress"
206-
type="text"
207-
value={formData.payeeAddress}
208-
placeholder="0x..."
209-
{handleInput}
210-
onBlur={checkPayeeAddress}
211-
error={validationErrors.payeeAddress
212-
? "Please enter a valid Ethereum address"
213-
: ""}
214-
/>
215-
<Button
216-
type="button"
217-
onClick={togglePayeeAddress}
218-
className="invoice-form-close-recipient-button"
219-
>
220-
<div slot="icon" style="padding: 7px;">
221-
<Close />
222-
</div>
223-
</Button>
224-
</div>
225-
{/if}
226185
<Accordion title="Add Your Info">
227186
<div class="invoice-form-info">
228187
<Input
@@ -440,6 +399,18 @@
440399
}))}
441400
onchange={handleCurrencyChange}
442401
/>
402+
<Input
403+
label="Where do you want to receive your payment?"
404+
id="payeeAddress"
405+
type="text"
406+
value={formData.payeeAddress}
407+
placeholder="0x..."
408+
{handleInput}
409+
onBlur={checkPayeeAddress}
410+
error={validationErrors.payeeAddress
411+
? "Please enter a valid Ethereum address"
412+
: ""}
413+
/>
443414
</div>
444415
</div>
445416
<div class="invoice-form-dates">
@@ -668,20 +639,6 @@
668639
gap: 20px;
669640
}
670641
671-
:global(.invoice-form-add-recipient-button) {
672-
background-color: transparent !important;
673-
color: var(--mainColor) !important;
674-
text-transform: uppercase;
675-
transform: none !important;
676-
font-weight: 500;
677-
font-size: 14px !important;
678-
width: fit-content;
679-
}
680-
681-
:global(.invoice-form-add-recipient-button:hover) {
682-
color: var(--secondaryColor) !important;
683-
}
684-
685642
.invoice-form-section {
686643
display: flex;
687644
flex-direction: column;
@@ -838,25 +795,4 @@
838795
width: 12px;
839796
height: 12px;
840797
}
841-
842-
.payee-address-container {
843-
position: relative;
844-
display: flex;
845-
align-items: flex-start;
846-
gap: 10px;
847-
}
848-
849-
.payee-address-container :global(.input-wrapper) {
850-
flex: 1;
851-
}
852-
853-
:global(.invoice-form-close-recipient-button) {
854-
position: absolute;
855-
right: 0;
856-
top: -4px;
857-
}
858-
859-
:global(.invoice-form-close-recipient-button div) {
860-
padding: 4px !important;
861-
}
862798
</style>

shared/components/button.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{type}
1818
{disabled}
1919
on:click={onClick}
20-
class={`button ${padding} main-button ${className}`}
20+
class={`button ${padding} ${className} main-button`}
2121
>
2222
{#if icon}
2323
<i class={icon.class} style={icon.style}></i>

0 commit comments

Comments
 (0)