Skip to content

Commit 8543055

Browse files
committed
Merge branch 'layout-fixes' of github.com:ordinalspractice/bip322 into layout-fixes
2 parents 10c1ced + 0c6f243 commit 8543055

File tree

8 files changed

+54
-35
lines changed

8 files changed

+54
-35
lines changed

www/src/App.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ function App() {
3838

3939
<main className="w-full">
4040
<div className="w-[95%] md:w-[65vw] mx-auto">
41-
<div className="flex flex-col lg:flex-row gap-[calc(var(--size)*0.1)] min-h-[50vh] items-center">
42-
<div className="flex-1 w-full flex justify-center items-center">
41+
<div className="flex flex-col lg:flex-row gap-[calc(var(--size)*0.2)] lg:gap-[calc(var(--size)*0.1)] min-h-[50vh] items-center">
42+
<div className="flex-1 w-full flex justify-center items-end lg:items-center">
4343
<SignMessageForm
4444
message={signState.message}
4545
signedData={signState.signedData}
@@ -54,7 +54,7 @@ function App() {
5454
/>
5555
</div>
5656

57-
<div className="flex-1 w-full flex justify-center items-center">
57+
<div className="flex-1 w-full flex justify-center items-start lg:items-center">
5858
<VerifyForm
5959
formData={verifyState}
6060
verificationResult={verifyState.verificationResult}

www/src/bip322_bg.wasm

-896 Bytes
Binary file not shown.

www/src/components/SignMessage.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,17 @@ const SignMessageForm = ({
7272
disabled
7373
tooltipLabel="address"
7474
/>
75+
7576
<BaseTextarea
7677
placeholder="message"
7778
value={signedData ? signedData.message : message}
7879
onChange={(e) => !signedData && onMessageChange(e.target.value)}
7980
required
8081
disabled={signedData !== null}
8182
tooltipLabel="message"
83+
variant="three-lines"
8284
/>
85+
8386
{signedData ? (
8487
<BaseInput
8588
type="text"

www/src/components/TooltipWrapper.tsx

+17-21
Original file line numberDiff line numberDiff line change
@@ -56,32 +56,28 @@ export const TooltipWrapper = ({
5656
return (
5757
<TooltipProvider>
5858
<Tooltip open={isTooltipOpen} onOpenChange={setIsTooltipOpen}>
59-
<div className="relative w-full">
60-
<TooltipTrigger
61-
className="w-full"
62-
onClick={(e) => {
63-
e.preventDefault();
64-
if (clickToCopy) handleCopy();
65-
}}
59+
<TooltipTrigger
60+
asChild
61+
onClick={(e) => {
62+
e.preventDefault();
63+
if (clickToCopy) handleCopy();
64+
}}
65+
>
66+
<div
67+
className={`tooltip-wrapper ${clickToCopy ? "cursor-pointer" : ""}`}
6668
>
6769
<div
68-
className={`tooltip-wrapper ${
69-
clickToCopy ? "cursor-pointer" : ""
70+
className={`tooltip-wrapper-inner ${
71+
clickToCopy ? "copy-enabled" : ""
7072
}`}
7173
>
72-
<div
73-
className={`tooltip-wrapper-inner ${
74-
clickToCopy ? "copy-enabled" : ""
75-
}`}
76-
>
77-
{children}
78-
</div>
74+
{children}
7975
</div>
80-
</TooltipTrigger>
81-
<TooltipContent sideOffset={5}>
82-
<p className="tooltip-text">{getTooltipText()}</p>
83-
</TooltipContent>
84-
</div>
76+
</div>
77+
</TooltipTrigger>
78+
<TooltipContent sideOffset={5}>
79+
<p className="text-xs">{getTooltipText()}</p>
80+
</TooltipContent>
8581
</Tooltip>
8682
</TooltipProvider>
8783
);

www/src/components/VerifyForm.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ import FormWrapper from "@/components/FormWrapper";
33
import { BaseInput } from "@/components/ui/base-input";
44
import { BaseButton } from "@/components/ui/base-button";
55
import type { VerifyFormState } from "@/hooks/useVerifyMessage";
6+
import { BaseTextarea } from "./ui/base-textarea";
67

78
interface VerifyFormProps {
89
formData: VerifyFormState;
910
verificationResult: string | null;
1011
onSubmit: (e: React.FormEvent) => void;
11-
onInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
12+
onInputChange: (
13+
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
14+
) => void;
1215
onReset: () => void;
1316
}
1417

@@ -53,8 +56,7 @@ const VerifyForm = ({
5356
tooltipLabel="address"
5457
/>
5558

56-
<BaseInput
57-
type="text"
59+
<BaseTextarea
5860
id="message"
5961
placeholder="message"
6062
value={formData.message}
@@ -63,6 +65,7 @@ const VerifyForm = ({
6365
required
6466
disabled={verificationResult !== null}
6567
tooltipLabel="message"
68+
variant="two-lines"
6669
/>
6770

6871
<BaseInput

www/src/components/ui/base-textarea.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@ import { cn } from "@/lib/utils";
33
import { Textarea } from "@/components/ui/textarea";
44
import { TooltipWrapper } from "@/components/TooltipWrapper";
55

6+
type TextareaVariant = "default" | "two-lines" | "three-lines";
7+
68
interface BaseTextareaProps
79
extends React.ComponentPropsWithoutRef<typeof Textarea> {
10+
variant?: TextareaVariant;
811
tooltipLabel?: string;
912
}
1013

1114
const BaseTextarea = React.forwardRef<HTMLTextAreaElement, BaseTextareaProps>(
12-
({ className, tooltipLabel, disabled, ...props }, ref) => {
15+
(
16+
{ className, variant = "default", tooltipLabel, disabled, ...props },
17+
ref
18+
) => {
1319
return (
1420
<TooltipWrapper
1521
value={props.value}
@@ -21,6 +27,8 @@ const BaseTextarea = React.forwardRef<HTMLTextAreaElement, BaseTextareaProps>(
2127
className={cn(
2228
"common-component",
2329
"common-textarea",
30+
variant === "two-lines" && "two-lines",
31+
variant === "three-lines" && "three-lines",
2432
disabled && "pointer-events-none cursor-pointer",
2533
className
2634
)}
@@ -36,4 +44,4 @@ const BaseTextarea = React.forwardRef<HTMLTextAreaElement, BaseTextareaProps>(
3644
BaseTextarea.displayName = "BaseTextarea";
3745

3846
export { BaseTextarea };
39-
export type { BaseTextareaProps };
47+
export type { BaseTextareaProps, TextareaVariant };

www/src/hooks/useVerifyMessage.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface VerifyFormState {
99
}
1010

1111
interface VerifyMessageActions {
12-
handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
12+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
1313
handleVerify: (e: React.FormEvent) => void;
1414
reset: () => void;
1515
}
@@ -22,7 +22,7 @@ export const useVerifyMessage = (): [VerifyFormState, VerifyMessageActions] => {
2222
verificationResult: null,
2323
});
2424

25-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
25+
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
2626
setState(prev => ({
2727
...prev,
2828
[e.target.id]: e.target.value,

www/src/index.css

+13-4
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ body {
183183
.button-icon {
184184
background-color: transparent;
185185
aspect-ratio: 1;
186-
padding: calc(var(--font-sm) * 1.2);
186+
padding: calc(var(--font-sm) * 1.8) calc(var(--font-sm) * 1.2);
187187
transition: all 0.3s ease;
188188
background-color: hsl(var(--primary) / 0.05) !important;
189189
}
@@ -194,8 +194,8 @@ body {
194194
}
195195

196196
.button-icon svg {
197-
width: calc(var(--font-md) * 1.1) !important;
198-
height: calc(var(--font-md) * 1.1) !important;
197+
width: calc(var(--font-md) * 1.4) !important;
198+
height: calc(var(--font-md) * 1.4) !important;
199199
}
200200

201201

@@ -233,12 +233,21 @@ body {
233233
.common-textarea {
234234
resize: none;
235235
font-size: var(--font-xs) !important;
236-
height: calc(var(--font-sm) * 6);
237236
padding: calc(var(--font-sm) * 0.8) calc(var(--font-sm) * 0.6);
238237
color: hsl(var(--primary) / 0.8);
239238
text-shadow: var(--glow-sm);
240239
}
241240

241+
.common-textarea.two-lines {
242+
height: calc(var(--font-sm) * 6);
243+
min-height: calc(var(--font-sm) * 6);
244+
}
245+
246+
.common-textarea.three-lines {
247+
height: calc(var(--font-sm) * 9.2);
248+
min-height: calc(var(--font-sm) * 9.2);
249+
}
250+
242251
.verification-input {
243252
text-align: center;
244253
cursor: default;

0 commit comments

Comments
 (0)