feat: Enhance note dialog layouts, improve text wrapping, and refine component styling.

This commit is contained in:
2025-12-29 14:23:19 +01:00
parent 5634555d89
commit 68a11ea551
5 changed files with 20 additions and 21 deletions

View File

@@ -49,7 +49,7 @@ export function Editor({ value, onChange, placeholder, className }: EditorProps)
editorProps: { editorProps: {
attributes: { attributes: {
class: cn( class: cn(
"min-h-[100px] max-h-[400px] overflow-y-auto w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 prose dark:prose-invert max-w-none", "min-h-[100px] max-h-[400px] overflow-y-auto w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 prose dark:prose-invert max-w-none break-all min-w-0",
className className
), ),
}, },

View File

@@ -165,21 +165,23 @@ export function NoteCard({ note }: NoteCardProps) {
</Card> </Card>
<Dialog open={editing} onOpenChange={setEditing}> <Dialog open={editing} onOpenChange={setEditing}>
<DialogContent> <DialogContent className="max-w-3xl max-h-[85vh] flex flex-col p-6 gap-0 overflow-hidden">
<DialogHeader> <DialogHeader className="pb-4 shrink-0">
<DialogTitle>{t("Edit Note")}</DialogTitle> <DialogTitle>{t("Edit Note")}</DialogTitle>
</DialogHeader> </DialogHeader>
<NoteForm <div className="flex-1 min-h-0 overflow-y-auto -mx-6 px-6">
defaultValues={{ <NoteForm
title: note.title, defaultValues={{
content: note.content, title: note.title,
is_pinned: note.is_pinned, content: note.content,
color: note.color, is_pinned: note.is_pinned,
tags: note.tags.map(t => t.name).join(", "), color: note.color,
}} tags: note.tags.map(t => t.name).join(", "),
onSubmit={handleEdit} }}
submitLabel={t("Update")} onSubmit={handleEdit}
/> submitLabel={t("Update")}
/>
</div>
</DialogContent> </DialogContent>
</Dialog> </Dialog>

View File

@@ -43,7 +43,7 @@ export function NoteForm({ defaultValues, onSubmit, isLoading, submitLabel = "Sa
return ( return (
<Form {...form}> <Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit as any)} className="space-y-4"> <form onSubmit={form.handleSubmit(onSubmit as any)} className="w-full flex flex-col gap-4">
<FormField <FormField
control={form.control as any} control={form.control as any}
name="title" name="title"

View File

@@ -27,12 +27,9 @@ export function NoteViewDialog({ note, open, onOpenChange, onEdit, onSelectNote
<DialogContent className={clsx("max-w-3xl max-h-[85vh] flex flex-col p-6 gap-0 overflow-hidden", colorClass)}> <DialogContent className={clsx("max-w-3xl max-h-[85vh] flex flex-col p-6 gap-0 overflow-hidden", colorClass)}>
<DialogHeader className="pb-4 shrink-0"> <DialogHeader className="pb-4 shrink-0">
<div className="flex justify-between items-start gap-4"> <div className="flex justify-between items-start gap-4">
<DialogTitle className="text-2xl font-bold leading-tight break-words"> <DialogTitle className="text-2xl font-bold leading-tight wrap-break-word">
{note.title} {note.title}
</DialogTitle> </DialogTitle>
{note.is_pinned && (
<Pin className="h-5 w-5 text-primary rotate-45 shrink-0" />
)}
</div> </div>
<div className="flex items-center text-sm text-muted-foreground gap-2 mt-1"> <div className="flex items-center text-sm text-muted-foreground gap-2 mt-1">
<Calendar className="h-3.5 w-3.5" /> <Calendar className="h-3.5 w-3.5" />
@@ -41,7 +38,7 @@ export function NoteViewDialog({ note, open, onOpenChange, onEdit, onSelectNote
</DialogHeader> </DialogHeader>
<div className="flex-1 min-h-0 overflow-y-auto -mx-6 px-6"> <div className="flex-1 min-h-0 overflow-y-auto -mx-6 px-6">
<div className="prose dark:prose-invert max-w-none text-base leading-relaxed break-words pb-6"> <div className="prose dark:prose-invert max-w-none text-base leading-relaxed wrap-break-word pb-6">
<ReactMarkdown remarkPlugins={[remarkGfm]}>{note.content}</ReactMarkdown> <ReactMarkdown remarkPlugins={[remarkGfm]}>{note.content}</ReactMarkdown>
</div> </div>

View File

@@ -81,7 +81,7 @@ export default function DashboardPage() {
return ( return (
<Masonry <Masonry
breakpointCols={masonryBreakpoints} breakpointCols={masonryBreakpoints}
className="flex -ml-4 w-auto" className="flex w-auto"
columnClassName="pl-4 bg-clip-padding" columnClassName="pl-4 bg-clip-padding"
> >
{notesList.map((note: Note) => ( {notesList.map((note: Note) => (