Skip to content

Commit 5b099a0

Browse files
fix(app): improve share modal mobile readability (anomalyco#672)
1 parent dc935f9 commit 5b099a0

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

‎packages/app/src/app/components/share-workspace-modal.tsx‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { For, Show, createEffect, createMemo, createSignal } from "solid-js";
1+
import { For, Show, createEffect, createMemo, createSignal, onCleanup } from "solid-js";
22

33
import { Copy, X } from "lucide-solid";
44

@@ -51,6 +51,17 @@ export default function ShareWorkspaceModal(props: {
5151
requestAnimationFrame(() => firstCopyRef?.focus());
5252
});
5353

54+
createEffect(() => {
55+
if (!props.open) return;
56+
const handleKeyDown = (event: KeyboardEvent) => {
57+
if (event.key !== "Escape") return;
58+
event.preventDefault();
59+
props.onClose();
60+
};
61+
window.addEventListener("keydown", handleKeyDown);
62+
onCleanup(() => window.removeEventListener("keydown", handleKeyDown));
63+
});
64+
5465
const maskValue = (value: string) => (value ? "************" : "");
5566

5667
const handleCopy = async (value: string, key: string) => {
@@ -69,7 +80,7 @@ export default function ShareWorkspaceModal(props: {
6980
<Show when={props.open}>
7081
<div class="fixed inset-0 z-50 flex items-center justify-center bg-gray-1/60 backdrop-blur-sm p-4 animate-in fade-in duration-200">
7182
<div
72-
class="bg-gray-2 border border-gray-6 w-full max-w-lg rounded-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]"
83+
class="bg-gray-2 border border-gray-6 w-full max-w-2xl rounded-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]"
7384
role="dialog"
7485
aria-modal="true"
7586
>
@@ -109,17 +120,17 @@ export default function ShareWorkspaceModal(props: {
109120
isSecret() && !revealed() ? maskValue(field.value) : field.value;
110121

111122
return (
112-
<div class="flex items-center justify-between bg-gray-1 p-3 rounded-xl border border-gray-6 gap-3">
123+
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between bg-gray-1 p-3 rounded-xl border border-gray-6 gap-3">
113124
<div class="min-w-0">
114125
<div class="text-xs font-medium text-gray-11">{field.label}</div>
115-
<div class="text-xs text-gray-7 font-mono truncate">
126+
<div class="text-xs text-gray-7 font-mono break-all sm:break-normal sm:truncate">
116127
{shownValue() || field.placeholder || "-"}
117128
</div>
118129
<Show when={field.hint && field.hint.trim()}>
119130
<div class="text-[11px] text-gray-8 mt-1">{field.hint}</div>
120131
</Show>
121132
</div>
122-
<div class="flex items-center gap-2 shrink-0">
133+
<div class="flex items-center gap-2 shrink-0 self-end sm:self-auto">
123134
<Show when={isSecret()}>
124135
<Button
125136
variant="outline"

0 commit comments

Comments
 (0)