Skip to content

Commit 80cc506

Browse files
committed
Fix design
1 parent 4908405 commit 80cc506

File tree

1 file changed

+26
-50
lines changed

1 file changed

+26
-50
lines changed

web/src/components/transactions/NewTransactionModal.tsx

Lines changed: 26 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import {
1414
IconPhoto,
1515
IconPlus,
1616
IconSelector,
17-
IconSwitch3,
18-
IconX
17+
IconSwitch3
1918
} from "@tabler/icons-solidjs"
2019
import { Component, createEffect, createSignal, createUniqueId, For, Show } from "solid-js"
2120
import toast from "solid-toast"
@@ -29,7 +28,7 @@ import { useFavouriteTransactionsQuery } from "../../graphql/queries/favouriteTr
2928
import { CATEGORY_BACKGROUND_COLORS, CategoryColor } from "../../utils/categoryColors"
3029
import { stripTime } from "../../utils/date"
3130
import { AccountSelect } from "../accounts/AccountSelect"
32-
import { Button } from "../base/Button"
31+
import { Button, buttonClasses } from "../base/Button"
3332
import { InputAddon } from "../base/InputGroup"
3433
import { Modal, ModalCloseButton, ModalContent, ModalTitle } from "../base/Modal"
3534
import { CurrencySelect } from "../currencies/CurrencySelect"
@@ -248,53 +247,6 @@ export const NewTransactionModal: Component<{
248247

249248
<FormInput placeholderLabel={true} of={form} label="What?" name="memo" />
250249

251-
<div class="flex flex-col gap-2">
252-
<label class="flex cursor-pointer items-center gap-2 rounded border border-gray-200 bg-white px-3 py-2 text-sm hover:border-gray-300">
253-
<IconPhoto size="1.25em" class="text-gray-500" />
254-
<span class="text-gray-700">
255-
{receiptImages().length > 0
256-
? `${receiptImages().length} receipt${
257-
receiptImages().length > 1 ? "s" : ""
258-
} selected`
259-
: "Add receipt images"}
260-
</span>
261-
<input
262-
type="file"
263-
multiple
264-
accept="image/*"
265-
class="hidden"
266-
onChange={(e) => {
267-
const files = Array.from(e.target.files || [])
268-
setReceiptImages(files)
269-
}}
270-
/>
271-
</label>
272-
<Show when={receiptImages().length > 0}>
273-
<div class="flex flex-wrap gap-2">
274-
<For each={receiptImages()}>
275-
{(file, index) => (
276-
<div class="relative">
277-
<div class="flex items-center gap-1 rounded bg-gray-100 px-2 py-1 text-xs">
278-
<span class="max-w-32 truncate">{file.name}</span>
279-
<button
280-
type="button"
281-
onClick={() => {
282-
setReceiptImages(
283-
receiptImages().filter((_, i) => i !== index())
284-
)
285-
}}
286-
class="text-gray-500 hover:text-gray-700"
287-
>
288-
<IconX size="0.875em" />
289-
</button>
290-
</div>
291-
</div>
292-
)}
293-
</For>
294-
</div>
295-
</Show>
296-
</div>
297-
298250
<Show
299251
when={getValue(form, "shopCurrencyId")}
300252
fallback={
@@ -463,6 +415,30 @@ export const NewTransactionModal: Component<{
463415
</CurrencySelect>
464416
)}
465417
</Field>
418+
419+
<label class="cursor-pointer">
420+
<span
421+
class={`${buttonClasses({
422+
size: "custom",
423+
variant: "ghost"
424+
})} whitespace-nowrap rounded-sm border border-gray-100 px-4 py-2 text-xs text-gray-700`}
425+
>
426+
<IconPhoto class="mr-1" />
427+
{receiptImages().length > 0
428+
? `${receiptImages().length} file${receiptImages().length > 1 ? "s" : ""}`
429+
: "Receipt"}
430+
</span>
431+
<input
432+
type="file"
433+
multiple
434+
accept="image/*"
435+
class="hidden"
436+
onChange={(e) => {
437+
const files = Array.from(e.target.files || [])
438+
setReceiptImages(files)
439+
}}
440+
/>
441+
</label>
466442
</div>
467443

468444
<Button

0 commit comments

Comments
 (0)