Skip to content

Commit e519f9c

Browse files
authored
docs: improve demo on mobile, remove heyo (blo-1013) (#2590)
* improve demo on mobile, remove heyo * chore: Add `.claude` to `.gitignore`.
1 parent af3737a commit e519f9c

File tree

5 files changed

+66
-46
lines changed

5 files changed

+66
-46
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ release
4040
.nx/
4141
# Nightshift plan artifacts (keep out of version control)
4242
.nightshift-plan
43+
.claude

docs/app/demo/_components/DemoEditor.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function DemoEditor() {
119119
: "";
120120

121121
const content = !roomId ? (
122-
<div className="flex h-[700px] w-full max-w-5xl flex-col overflow-hidden rounded-xl border border-stone-200 bg-white shadow-xl">
122+
<div className="flex h-[500px] w-full max-w-5xl flex-col overflow-hidden rounded-xl border border-stone-200 bg-white shadow-xl sm:h-[700px]">
123123
<EditorMenu
124124
onExport={() => {}}
125125
user={HARDCODED_USERS[0]}
@@ -138,15 +138,15 @@ export function DemoEditor() {
138138

139139
return (
140140
<div className="flex w-full max-w-5xl flex-col gap-4">
141-
<div className="flex w-full items-center justify-between rounded-lg border border-stone-200 bg-white p-3 shadow-sm">
141+
<div className="flex w-full flex-col gap-2 rounded-lg border border-stone-200 bg-white p-3 shadow-sm sm:flex-row sm:items-center sm:justify-between">
142142
<span className="text-sm font-medium text-stone-600">
143143
⚡️ Collaborate live! Share this URL:
144144
</span>
145-
<div className="flex flex-1 items-center gap-2 px-4">
145+
<div className="flex flex-1 items-center gap-2 sm:px-4">
146146
<input
147147
readOnly
148148
value={url}
149-
className="w-full rounded-md border border-stone-200 bg-stone-50 px-3 py-1.5 text-sm text-stone-600 outline-none focus:border-stone-400"
149+
className="min-w-0 flex-1 rounded-md border border-stone-200 bg-stone-50 px-3 py-1.5 text-sm text-stone-600 outline-none focus:border-stone-400"
150150
onClick={(e) => e.currentTarget.select()}
151151
/>
152152
<button
@@ -187,7 +187,10 @@ function DemoEditorInner({
187187
const { resolvedTheme } = useTheme();
188188
// const [mounted, setMounted] = useState(false);
189189
const [activeUser, setActiveUser] = useState(HARDCODED_USERS[0]);
190-
const [sidebarOpen, setSidebarOpen] = useState(true);
190+
const [sidebarOpen, setSidebarOpen] = useState(() => {
191+
if (typeof window === "undefined") return true;
192+
return window.innerWidth >= 768;
193+
});
191194

192195
const { doc, provider } = useMemo(() => {
193196
const doc = new Y.Doc();
@@ -359,7 +362,7 @@ function DemoEditorInner({
359362
}
360363

361364
return (
362-
<div className="flex h-[700px] w-full max-w-5xl flex-col overflow-hidden rounded-xl border border-stone-200 bg-white shadow-xl">
365+
<div className="flex h-[500px] w-full max-w-5xl flex-col overflow-hidden rounded-xl border border-stone-200 bg-white shadow-xl sm:h-[700px]">
363366
<div className="relative z-30">
364367
<EditorMenu
365368
onExport={handleExport}

docs/app/demo/_components/EditorMenu.tsx

Lines changed: 56 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Download, PanelRight, Share, User } from "lucide-react";
2+
import { useRef, useState } from "react";
23
import { HARDCODED_USERS } from "./utils";
34

45
interface EditorMenuProps {
@@ -23,21 +24,31 @@ export function EditorMenu({
2324
onToggleSidebar,
2425
disabled,
2526
}: EditorMenuProps) {
27+
const [exportOpen, setExportOpen] = useState(false);
28+
const exportRef = useRef<HTMLDivElement>(null);
29+
30+
// Close on outside click via onBlur with a relatedTarget check
31+
const handleBlur = (e: React.FocusEvent) => {
32+
if (!exportRef.current?.contains(e.relatedTarget as Node)) {
33+
setExportOpen(false);
34+
}
35+
};
36+
2637
return (
27-
<div className="flex items-center justify-between border-b border-stone-200 bg-stone-50 px-4 py-2">
28-
<div className="flex gap-1.5">
38+
<div className="flex items-center justify-between border-b border-stone-200 bg-stone-50 px-2 py-2 sm:px-4">
39+
<div className="hidden gap-1.5 sm:flex">
2940
<div className="h-3 w-3 rounded-full bg-red-400" />
3041
<div className="h-3 w-3 rounded-full bg-amber-400" />
3142
<div className="h-3 w-3 rounded-full bg-green-400" />
3243
</div>
3344

34-
<div className="flex items-center gap-2">
45+
<div className="flex items-center gap-1 sm:gap-2">
3546
<div
36-
className={`flex items-center gap-2 rounded-md border border-stone-200 bg-white px-2 py-1 ${disabled ? "opacity-50" : ""}`}
47+
className={`flex items-center gap-1 rounded-md border border-stone-200 bg-white px-2 py-1 sm:gap-2 ${disabled ? "opacity-50" : ""}`}
3748
>
3849
<User className="h-3 w-3 text-stone-500" />
3950
<select
40-
className="w-[100px] bg-transparent text-xs outline-none"
51+
className="w-[80px] bg-transparent text-xs outline-none sm:w-[100px]"
4152
value={user.id}
4253
onChange={(e) => {
4354
const u = HARDCODED_USERS.find((u) => u.id === e.target.value);
@@ -53,7 +64,7 @@ export function EditorMenu({
5364
</select>
5465
</div>
5566

56-
<div className="mx-2 h-4 w-px bg-stone-300" />
67+
<div className="mx-1 h-4 w-px bg-stone-300 sm:mx-2" />
5768

5869
<div
5970
className={`flex gap-1 ${disabled ? "pointer-events-none opacity-50" : ""}`}
@@ -62,46 +73,59 @@ export function EditorMenu({
6273
className="flex items-center gap-1 rounded-md border border-stone-200 bg-white px-2 py-1 text-xs hover:bg-stone-50"
6374
onClick={() => {
6475
navigator.clipboard.writeText(window.location.href);
65-
alert("URL copied to clipboard!");
6676
}}
6777
disabled={disabled}
6878
>
69-
<Share className="h-3 w-3" /> Share
79+
<Share className="h-3 w-3" />
80+
<span className="hidden sm:inline">Share</span>
7081
</button>
71-
<div className="group relative">
82+
<div className="relative" ref={exportRef} onBlur={handleBlur}>
7283
<button
7384
className="flex items-center gap-1 rounded-md border border-stone-200 bg-white px-2 py-1 text-xs hover:bg-stone-50"
7485
disabled={disabled}
86+
onClick={() => setExportOpen(!exportOpen)}
7587
>
76-
<Download className="h-3 w-3" /> Export
88+
<Download className="h-3 w-3" />
89+
<span className="hidden sm:inline">Export</span>
7790
</button>
78-
<div className="absolute right-0 top-full z-10 hidden w-20 flex-col rounded-md border border-stone-200 bg-white py-1 shadow-md group-hover:flex">
79-
<button
80-
className="px-3 py-1 text-left text-xs hover:bg-stone-50"
81-
onClick={() => onExport("pdf")}
82-
>
83-
PDF
84-
</button>
85-
<button
86-
className="px-3 py-1 text-left text-xs hover:bg-stone-50"
87-
onClick={() => onExport("docx")}
88-
>
89-
DOCX
90-
</button>
91-
<button
92-
className="px-3 py-1 text-left text-xs hover:bg-stone-50"
93-
onClick={() => onExport("odt")}
94-
>
95-
ODT
96-
</button>
97-
</div>
91+
{exportOpen && (
92+
<div className="absolute right-0 top-full z-10 flex w-20 flex-col rounded-md border border-stone-200 bg-white py-1 shadow-md">
93+
<button
94+
className="px-3 py-1 text-left text-xs hover:bg-stone-50"
95+
onClick={() => {
96+
onExport("pdf");
97+
setExportOpen(false);
98+
}}
99+
>
100+
PDF
101+
</button>
102+
<button
103+
className="px-3 py-1 text-left text-xs hover:bg-stone-50"
104+
onClick={() => {
105+
onExport("docx");
106+
setExportOpen(false);
107+
}}
108+
>
109+
DOCX
110+
</button>
111+
<button
112+
className="px-3 py-1 text-left text-xs hover:bg-stone-50"
113+
onClick={() => {
114+
onExport("odt");
115+
setExportOpen(false);
116+
}}
117+
>
118+
ODT
119+
</button>
120+
</div>
121+
)}
98122
</div>
99123
</div>
100124

101-
<div className="mx-2 h-4 w-px bg-stone-300" />
125+
<div className="mx-1 hidden h-4 w-px bg-stone-300 sm:block sm:mx-2" />
102126

103127
<button
104-
className={`flex items-center gap-1 rounded-md border border-stone-200 px-2 py-1 text-xs hover:bg-stone-50 ${
128+
className={`hidden items-center gap-1 rounded-md border border-stone-200 px-2 py-1 text-xs hover:bg-stone-50 sm:flex ${
105129
sidebarOpen
106130
? "bg-stone-100 text-stone-900"
107131
: "bg-white text-stone-500"

docs/app/demo/page.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ export default function DemoPage() {
99
</h1>
1010
</div>
1111
<DemoEditor />
12-
<script
13-
async
14-
src="https://heyo.so/embed/script?projectId=6982d5659ff7b5fcebeeff26"
15-
></script>
1612
</main>
1713
);
1814
}

docs/app/pricing/page.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,6 @@ export default function Pricing() {
207207
{/* FAQ */}
208208
<FAQ />
209209
</div>
210-
<script
211-
async
212-
src="https://heyo.so/embed/script?projectId=6982d5659ff7b5fcebeeff26"
213-
></script>
214210
</div>
215211
);
216212
}

0 commit comments

Comments
 (0)