This commit is contained in:
Michael Zhang 2024-05-27 20:38:18 -05:00
parent 81dc41bf4c
commit 4f503ac1a3
4 changed files with 32 additions and 9 deletions

View file

@ -24,4 +24,10 @@
flex-grow: 1; flex-grow: 1;
flex-basis: auto; flex-basis: auto;
overflow-x: scroll; overflow-x: scroll;
// Cribbed from https://www.magicpattern.design/tools/css-backgrounds
background-color: #e5e5f7;
opacity: 0.8;
background-image: radial-gradient(#444cf7 0.5px, #e5e5f7 0.5px);
background-size: 10px 10px;
} }

View file

@ -13,6 +13,10 @@
flex-direction: column; flex-direction: column;
resize: horizontal; resize: horizontal;
background-color: rgba(255, 255, 255, 0.5);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
} }
.header { .header {

View file

@ -4,7 +4,14 @@
flex-direction: column; flex-direction: column;
} }
.title { .titleContainer,
.titleEditorForm {
display: flex;
}
.title,
.titleEditor {
flex-grow: 1;
padding: 12px; padding: 12px;
border: none; border: none;
border-bottom: 1px solid lightgray; border-bottom: 1px solid lightgray;

View file

@ -33,7 +33,6 @@ export default function JournalPage({ id, data }: JournalPageProps) {
useEffect(() => { useEffect(() => {
if (changed) { if (changed) {
// console.log("OLD", previous, "NEW", valueToSave);
(async () => { (async () => {
console.log("Saving..."); console.log("Saving...");
const resp = await fetch(`http://localhost:5195/node/${id}`, { const resp = await fetch(`http://localhost:5195/node/${id}`, {
@ -72,27 +71,34 @@ export default function JournalPage({ id, data }: JournalPageProps) {
<> <>
{isEditingTitle ? ( {isEditingTitle ? (
<form <form
className={styles.titleEditorForm}
onSubmit={(evt) => { onSubmit={(evt) => {
evt.preventDefault(); evt.preventDefault();
saveChangedTitle(); saveChangedTitle();
}} }}
> >
<input <input
className={styles.title} className={styles.titleEditor}
type="text" type="text"
value={title} value={title}
onChange={(evt) => setTitle(evt.target.value)} onChange={(evt) => {
let newTitle = evt.target.value;
if (newTitle.trim().length === 0) newTitle = null;
setTitle(newTitle);
}}
onBlur={() => saveChangedTitle()} onBlur={() => saveChangedTitle()}
// biome-ignore lint/a11y/noAutofocus: <explanation> // biome-ignore lint/a11y/noAutofocus: <explanation>
autoFocus autoFocus
/> />
</form> </form>
) : ( ) : (
<div <div className={styles.titleContainer}>
className={styles.title} <div
onDoubleClick={() => setIsEditingTitle(true)} className={styles.title}
> onDoubleClick={() => setIsEditingTitle(true)}
{title ?? <span className={styles.untitled}>(untitled)</span>} >
{title ?? <span className={styles.untitled}>(untitled)</span>}
</div>
</div> </div>
)} )}
<div data-color-mode="light" className={styles.container}> <div data-color-mode="light" className={styles.container}>