feat: typography overhaul, custom scrollbars, import/export, settings UI
Includes changes from prior sessions: Epilogue + Space Mono fonts, OverlayScrollbars integration, markdown editor fixes, settings dialog, import/export buttons, and various UI refinements.
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
import { useState, useRef, useEffect, useCallback } from "react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import remarkGfm from "remark-gfm";
|
||||
import { OverlayScrollbarsComponent } from "overlayscrollbars-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useBoardStore } from "@/stores/board-store";
|
||||
|
||||
const OS_OPTIONS = {
|
||||
scrollbars: { theme: "os-theme-pylon" as const, autoHide: "scroll" as const, autoHideDelay: 600, clickScroll: true },
|
||||
};
|
||||
|
||||
interface MarkdownEditorProps {
|
||||
cardId: string;
|
||||
value: string;
|
||||
@@ -21,10 +26,13 @@ export function MarkdownEditor({ cardId, value }: MarkdownEditorProps) {
|
||||
setDraft(value);
|
||||
}, [value]);
|
||||
|
||||
// Auto-focus textarea when switching to edit mode
|
||||
// Auto-focus and auto-size textarea when switching to edit mode
|
||||
useEffect(() => {
|
||||
if (mode === "edit" && textareaRef.current) {
|
||||
textareaRef.current.focus();
|
||||
const el = textareaRef.current;
|
||||
el.style.height = "auto";
|
||||
el.style.height = el.scrollHeight + "px";
|
||||
el.focus();
|
||||
}
|
||||
}, [mode]);
|
||||
|
||||
@@ -41,6 +49,10 @@ export function MarkdownEditor({ cardId, value }: MarkdownEditorProps) {
|
||||
const text = e.target.value;
|
||||
setDraft(text);
|
||||
|
||||
// Auto-size textarea to fit content (parent OverlayScrollbars handles overflow)
|
||||
e.target.style.height = "auto";
|
||||
e.target.style.height = e.target.scrollHeight + "px";
|
||||
|
||||
// Debounced auto-save
|
||||
if (debounceRef.current) clearTimeout(debounceRef.current);
|
||||
debounceRef.current = setTimeout(() => {
|
||||
@@ -90,17 +102,25 @@ export function MarkdownEditor({ cardId, value }: MarkdownEditorProps) {
|
||||
|
||||
{/* Editor / Preview */}
|
||||
{mode === "edit" ? (
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
value={draft}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
placeholder="Add a description... (Markdown supported)"
|
||||
className="min-h-[100px] max-h-[160px] w-full resize-y rounded-md border border-pylon-text-secondary/20 bg-pylon-surface px-3 py-2 text-sm text-pylon-text outline-none placeholder:text-pylon-text-secondary/60 focus:border-pylon-accent focus:ring-1 focus:ring-pylon-accent"
|
||||
/>
|
||||
<OverlayScrollbarsComponent
|
||||
className="max-h-[160px] rounded-md border border-pylon-text-secondary/20 bg-pylon-surface focus-within:border-pylon-accent focus-within:ring-1 focus-within:ring-pylon-accent"
|
||||
options={{ ...OS_OPTIONS, overflow: { x: "hidden" as const } }}
|
||||
defer
|
||||
>
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
value={draft}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
placeholder="Add a description... (Markdown supported)"
|
||||
className="min-h-[100px] w-full resize-none overflow-hidden bg-transparent px-3 py-2 text-sm text-pylon-text outline-none placeholder:text-pylon-text-secondary/60"
|
||||
/>
|
||||
</OverlayScrollbarsComponent>
|
||||
) : (
|
||||
<div
|
||||
className="min-h-[100px] max-h-[160px] overflow-y-auto cursor-pointer rounded-md border border-transparent px-1 py-1 transition-colors hover:border-pylon-text-secondary/20"
|
||||
<OverlayScrollbarsComponent
|
||||
className="min-h-[100px] max-h-[160px] cursor-pointer rounded-md border border-transparent px-1 py-1 transition-colors hover:border-pylon-text-secondary/20"
|
||||
options={{ ...OS_OPTIONS, overflow: { x: "hidden" as const } }}
|
||||
defer
|
||||
onClick={() => setMode("edit")}
|
||||
>
|
||||
{draft ? (
|
||||
@@ -114,7 +134,7 @@ export function MarkdownEditor({ cardId, value }: MarkdownEditorProps) {
|
||||
Click to add a description...
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</OverlayScrollbarsComponent>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user