From d1da98a9e40d7db52a9e27a66bad64a292d0f588 Mon Sep 17 00:00:00 2001
From: Marvin Sextro
Date: Sat, 25 Dec 2021 23:58:45 +0100
Subject: [PATCH] Improve add to wallet button
---
components/Button.tsx | 24 +++++++++++++++++++++---
components/Form.tsx | 17 +++--------------
components/Page.tsx | 2 +-
src/process.ts | 2 --
4 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/components/Button.tsx b/components/Button.tsx
index 2346a43..b9e53be 100644
--- a/components/Button.tsx
+++ b/components/Button.tsx
@@ -1,18 +1,36 @@
interface ButtonProps {
text?: string,
icon?: string,
- onClick: () => void,
+ onClick?: () => void,
+ loading?: boolean,
+ type?: ButtonType,
+}
+
+export enum ButtonType {
+ submit = 'submit',
+ button = 'button',
}
function Button(props: ButtonProps): JSX.Element {
return (
)
diff --git a/components/Form.tsx b/components/Form.tsx
index 059c93c..40500ef 100644
--- a/components/Form.tsx
+++ b/components/Form.tsx
@@ -13,7 +13,7 @@ import {getPayloadBodyFromFile, getPayloadBodyFromQR} from "../src/process";
import {PassData} from "../src/pass";
import {COLORS} from "../src/colors";
import Colors from './Colors';
-import Button from './Button';
+import Button, { ButtonType } from './Button';
function Form(): JSX.Element {
const {t} = useTranslation(['index', 'errors', 'common']);
@@ -274,19 +274,8 @@ function Form(): JSX.Element {
.
-
-
-
+
+
}/>
diff --git a/components/Page.tsx b/components/Page.tsx
index 0a62b5e..97f52e3 100644
--- a/components/Page.tsx
+++ b/components/Page.tsx
@@ -12,7 +12,7 @@ function Page(props: PageProps): JSX.Element {
const { t } = useTranslation('common');
return (
-
+
{t('common:title')}
diff --git a/src/process.ts b/src/process.ts
index a38c61e..5388bb1 100644
--- a/src/process.ts
+++ b/src/process.ts
@@ -12,7 +12,6 @@ export async function getPayloadBodyFromFile(file: File, color: COLORS): Promise
switch (file.type) {
case 'application/pdf':
- console.log('pdf')
// Read file
const fileBuffer = await file.arrayBuffer();
imageData = await getImageDataFromPdf(fileBuffer)
@@ -21,7 +20,6 @@ export async function getPayloadBodyFromFile(file: File, color: COLORS): Promise
case 'image/jpeg':
case 'image/webp':
case 'image/gif':
- console.log(`image ${file.type}`)
imageData = await getImageDataFromImage(file)
break
default: