Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d7a54d6
fix(example-app): enable ref forwarding in GlassCard React component
Ryan-Millard Mar 7, 2026
d1199d5
feat(example-app): (React) Editor page controls
Ryan-Millard Mar 7, 2026
365797b
refactor(example-app): (React) make navbar hamburger reusable
Ryan-Millard Mar 8, 2026
b2c1018
feat(example-app): (React) improve UI and make reusable HamburgerMenu
Ryan-Millard Mar 11, 2026
ccd105a
feat(example-app): (React) add print feature
Ryan-Millard Mar 11, 2026
150959e
refactor(example-app): (React) move printing to its own function
Ryan-Millard Mar 11, 2026
410abe4
perf(example-app): (React) use pointerrawupdate for faster mouse drags
Ryan-Millard Mar 11, 2026
097a64f
feat(example-app): (React) undo and redo with history tracking
Ryan-Millard Mar 11, 2026
0b436bc
chore(example-app): (React) clean up styles
Ryan-Millard Mar 11, 2026
722e688
feat(example-app): add confirmation dialog for resets
Ryan-Millard Mar 11, 2026
9120639
feat(example-app): hide save buttons behind a modal and prompt for co…
Ryan-Millard Mar 11, 2026
d6dbf96
fix(example-app): (React) Modal displayed under other elements & adde…
Ryan-Millard Mar 12, 2026
0006934
fix(example-app): (React) editor page keybindings now support Mac
Ryan-Millard Mar 12, 2026
fd580a6
feat(example-app): (React) improve Editor page styles
Ryan-Millard Mar 20, 2026
6389ea8
refactor(example-app): (React) reuse download function and clean up CSS
Ryan-Millard Mar 21, 2026
184e7ca
feat(example-app): (React) improve editor page reset confirmation mod…
Ryan-Millard Mar 21, 2026
ff4bd80
fix(example-app): (React) unrevoked Blob URL
Ryan-Millard Mar 21, 2026
a762bcb
fix(example-app): (React) fix history bug where resetting doesn't cle…
Ryan-Millard Mar 21, 2026
27d6df7
fix(example-app): (React) Skip history writes when the tap doesn't ch…
Ryan-Millard Mar 21, 2026
e98b0fa
fix(example-app): (React) Don't swallow every Ctrl/Cmd shortcut, and …
Ryan-Millard Mar 21, 2026
b604158
ci(fix-checkouts): include recursive checkouts to include submodules…
Ryan-Millard Mar 21, 2026
6b0343c
Merge branch 'main' into feat/example-app/react/download-svg
Ryan-Millard Mar 21, 2026
ec0bfb1
Merge branch 'main' into feat/example-app/react/download-svg
Ryan-Millard Mar 21, 2026
cb44b7e
fix(example-app): (React) use pointermove when pointerrawupdate is un…
Ryan-Millard Mar 25, 2026
050bdde
fix(example-app): (React) revokeObjectURL on SVG in Editor page
Ryan-Millard Mar 25, 2026
3d8ca26
Merge branch 'main' into feat/example-app/react/download-svg
Ryan-Millard Mar 31, 2026
23faea3
Merge branch 'main' into feat/example-app/react/download-svg
Ryan-Millard Apr 1, 2026
2e489c1
style(example-app): format all files
Ryan-Millard Apr 1, 2026
01cbb1e
fix(react-js): resolve ESLint warnings in Editor components
Ryan-Millard Apr 1, 2026
35c0ea1
Merge branch 'main' into feat/example-app/react/download-svg
Ryan-Millard Apr 3, 2026
1aa1674
chore(file-resets): reset gpu.h and pr-auto-label.yml back to main's …
Ryan-Millard Apr 4, 2026
801584e
feat(editor): add fullscreen and improve zoom behavior
Ryan-Millard Apr 4, 2026
623e83f
style(example-app): (React) format all files
Ryan-Millard Apr 4, 2026
f56519f
refactor(example-app): (React) fix eslint warnings & tooltip positions
Ryan-Millard Apr 4, 2026
f736879
style(format): format all files
Ryan-Millard Apr 4, 2026
b6a40d3
Merge branch 'main' into feat/example-app/react/download-svg
Ryan-Millard Apr 4, 2026
20855b7
fix(example-app): (React) used functionbefore defined
Ryan-Millard Apr 4, 2026
843af6b
fix(useFullscreen): push/pop history on fullscreenchange instead of o…
Ryan-Millard Apr 4, 2026
4931be6
feat(editor): add raster (PNG/JPG) and PDF export to EditorControls
Ryan-Millard Apr 4, 2026
7b18ad8
style(format): format all files
Ryan-Millard Apr 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
context: .
dockerfile: Dockerfile.dev
container_name: img2num-dev
image: ryanmillard/img2num-dev:latest
working_dir: /usr/src/app
volumes:
- .:/usr/src/app:cached
Expand Down
7 changes: 4 additions & 3 deletions example-apps/react-js/src/components/GlassCard.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { forwardRef } from 'react';
import PropTypes from "prop-types";
import styles from "./GlassCard.module.css";

// eslint-disable-next-line no-unused-vars
const GlassCard = ({ as: Tag = "div", children, ...rest }) => (
<Tag {...rest} className={`text-center glass ${styles.card} ${rest.className || ""}`}>
const GlassCard = forwardRef( ({ as: Tag = "div", children, ...rest }, ref) => (
<Tag {...rest} className={`text-center glass ${styles.card} ${rest.className || ""}`} ref={ref}>
{children}
</Tag>
);
));

GlassCard.propTypes = {
as: PropTypes.oneOf([
Expand Down
69 changes: 69 additions & 0 deletions example-apps/react-js/src/components/GlassModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { useEffect } from "react";
import { createPortal } from "react-dom";
import PropTypes from "prop-types";
import GlassCard from "@components/GlassCard";
import styles from "./GlassModal.module.css";
import { X } from "lucide-react";

export default function GlassModal({
isOpen,
onClose,
children,
size = "lg", // sm | md | lg | any CSS width
showCloseButton = true,
closeOnBackdropClick = true,
className = "",
style = {}
}) {
useEffect(() => {
const handleKey = (e) => {
if (e.key === "Escape") onClose?.();
};
if (isOpen) window.addEventListener("keydown", handleKey);
return () => window.removeEventListener("keydown", handleKey);
}, [isOpen, onClose]);

if (!isOpen) return null;

const handleBackdropClick = (e) => {
if (e.target === e.currentTarget && closeOnBackdropClick) {
onClose?.();
}
};

const width = size === "sm" ? "300px"
: size === "md" ? "500px"
: size === "lg" ? "800px"
: size;

const modal = (
<div
className={styles.backdrop}
onClick={handleBackdropClick}
role="dialog"
>
<GlassCard
as="div"
className={`${styles.modal} ${className}`}
style={{
flex: "0 0 auto",
width: width,
...style,
}}
>
{showCloseButton && (
<button
className={`button ${styles.closeButton}`}
onClick={onClose}
aria-label="Close modal"
>
<X size={20} />
</button>
)}
{children}
</GlassCard>
</div>
);

return createPortal(modal, document.body);
}
43 changes: 43 additions & 0 deletions example-apps/react-js/src/components/GlassModal.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.backdrop {
position: fixed;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
animation: fadeIn 0.2s ease forwards;
}

.modal {
position: relative;
border-radius: 1rem;
background: var(--color-bg);
padding: 1.5rem;
box-shadow: 0 8px 32px rgba(0,0,0,0.25);
animation: scaleIn 0.2s ease forwards;
max-height: 90vh;
overflow-y: auto;
z-index: 1001;
}

.closeButton {
position: absolute;
top: 0.5rem;
right: 0.5rem;
border: none;
cursor: pointer;
padding: 0.25rem;
display: flex;
align-items: center;
justify-content: center;
}

@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}

@keyframes scaleIn {
from { transform: scale(0.95); opacity: 0; }
to { transform: scale(1); opacity: 1; }
}
Comment thread
Ryan-Millard marked this conversation as resolved.
Resolved
84 changes: 84 additions & 0 deletions example-apps/react-js/src/components/HamburgerMenu.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import React, { useEffect, useRef, useState } from "react";
import { Menu, X } from "lucide-react";
import Tooltip from "@components/Tooltip";
import styles from "./HamburgerMenu.module.css";

export default function HamburgerMenu({
children,
className = "",
style = {},
OpenMenuIcon = <X size={20} />,
CloseMenuIcon = <Menu size={20} />,
Comment thread
Ryan-Millard marked this conversation as resolved.
Resolved
}) {
const [isOpen, setIsOpen] = useState(false);
const menuRef = useRef(null);

const toggle = () => setIsOpen((v) => !v);
const close = () => setIsOpen(false);

// close on escape
useEffect(() => {
if (!isOpen) return;
const onKey = (e) => {
if (e.key === "Escape") close();
};
document.addEventListener("keydown", onKey);
return () => document.removeEventListener("keydown", onKey);
}, [isOpen]);

// Close when clicking outside
useEffect(() => {
if (!isOpen) return;
const onClickOutside = (e) => {
if (menuRef.current && !menuRef.current.contains(e.target)) {
close();
}
};
document.addEventListener("mousedown", onClickOutside);
return () => document.removeEventListener("mousedown", onClickOutside);
}, [isOpen]);
Comment thread
Ryan-Millard marked this conversation as resolved.
Resolved

// close on navigation (optional): when any link inside menu is clicked, close it.
useEffect(() => {
const node = menuRef.current;
if (!node) return;
const onClick = (e) => {
const a = e.target.closest("a");
if (a && node.contains(a)) close();
};
node.addEventListener("click", onClick);
return () => node.removeEventListener("click", onClick);
}, []);

return (
<>
<Tooltip content={isOpen ? "Close menu" : "Open menu"}>
<button
className={styles.menuToggle}
onClick={toggle}
aria-expanded={isOpen}
aria-controls="nav-menu"
aria-label={isOpen ? "Close menu" : "Open menu"}
type="button"
>
{isOpen ? OpenMenuIcon : CloseMenuIcon}
</button>
</Tooltip>

{/* The list — desktop: visible inline; mobile: dropdown controlled by `.open` */}
<ul
id="nav-menu"
ref={menuRef}
className={`${styles.navList} ${isOpen ? styles.open : ""} ${className}`}
style={style}
role="menubar"
>
{React.Children.map(children, (child) =>
React.cloneElement(child, {
className: "button"
})
)}
Comment thread
Ryan-Millard marked this conversation as resolved.
Resolved
</ul>
</>
);
}
121 changes: 121 additions & 0 deletions example-apps/react-js/src/components/HamburgerMenu.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/* ===== MENU WRAPPER =====
This wrapper holds the toggle button and the inline nav list.
Desktop: toggle hidden, nav shown inline.
Mobile: toggle visible, nav becomes an absolute dropdown and is hidden until `.open`.
*/

/* ===== MENU TOGGLE (hidden on desktop) ===== */
.menuToggle {
display: none;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
padding: 0;
background: transparent;
border: 1px solid var(--glass-border);
border-radius: var(--radius-md);
color: var(--color-text);
cursor: pointer;
transition:
background 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
transform 0.2s ease;
}

.menuToggle:hover,
.menuToggle:focus-visible {
background: var(--glass-bg);
outline: none;
}

/* ===== NAV LIST (desktop baseline) ===== */
.navList {
display: flex;
align-items: center;
list-style: none;
margin: 0;
padding: 0;
}

/* The open class only affects mobile dropdown visibility */
.open {
opacity: 1;
visibility: visible;
transform: translateY(0);
}

/* ========== MOBILE (responsive) ========== */
@media (max-width: 900px) {
/* show toggle on mobile */
.menuToggle {
display: flex;
}

/* nav becomes a column dropdown and is hidden by default */
.navList {
position: absolute;
top: calc(100% + var(--spacing-sm));
left: var(--spacing-sm);
right: var(--spacing-sm);
flex-direction: column;
gap: 6px;
padding: 12px;
background: var(--color-bg);
border: 1px solid rgba(215, 164, 125, 0.2);
border-radius: 20px;
box-shadow:
0 20px 50px rgba(83, 46, 26, 0.4),
0 0 0 1px rgba(248, 234, 205, 0.05) inset;
opacity: 0;
visibility: hidden;
transform: translateY(-8px);
z-index: 999;
transition:
opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
visibility 0.4s;
}

/* when open, reveal the dropdown */
.navList.open {
opacity: 1;
visibility: visible;
transform: translateY(0);
}

/* list items animation */
.navList li {
width: 100%;
opacity: 1;
transform: translateX(0);
transition:
opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tweak descendant anchor/link styles for mobile (these target plain <a> / link elements inside the menu)
This ensures mobile-specific visual changes apply regardless of which CSS module provided the .button class.
*/
#nav-menu a,
#nav-menu a:link,
#nav-menu a:visited {
width: 100%;
padding: 14px 16px;
justify-content: flex-start;
display: inline-flex;
align-items: center;
border-radius: 12px;
background: transparent;
border: none;
text-decoration: none;
}

/* small divider after the internal links group (if you rely on nth-child split) */
.navList li:nth-child(3)::after {
content: "";
display: block;
height: 1px;
background: linear-gradient(90deg, transparent 20%, var(--color-primary), transparent 80%);
margin-top: 6px;
}
}
Loading
Loading