diff --git a/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnoteSideColumn.tsx b/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnoteSideColumn.tsx
index 7ab0a2fc..cdfaca37 100644
--- a/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnoteSideColumn.tsx
+++ b/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnoteSideColumn.tsx
@@ -4,6 +4,7 @@ import { useCallback } from "react";
import { PublishedFootnote } from "./PublishedFootnotes";
import { TextBlockCore } from "../Blocks/TextBlockCore";
import { FootnoteSideColumnLayout } from "components/Footnotes/FootnoteSideColumnLayout";
+import { FootnoteItemLayout } from "components/Footnotes/FootnoteItemLayout";
type PublishedFootnoteItem = PublishedFootnote & {
id: string;
@@ -24,25 +25,20 @@ export function PublishedFootnoteSideColumn(props: {
let renderItem = useCallback(
(item: PublishedFootnoteItem & { top: number }) => (
- <>
-
- {item.index}.
- {" "}
-
- {item.contentPlaintext ? (
-
- ) : (
- Empty footnote
- )}
-
- >
+
+ {item.contentPlaintext ? (
+
+ ) : (
+ Empty footnote
+ )}
+
),
[],
);
diff --git a/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotes.tsx b/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotes.tsx
index f7feca84..86fd9e56 100644
--- a/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotes.tsx
+++ b/app/lish/[did]/[publication]/[rkey]/Footnotes/PublishedFootnotes.tsx
@@ -8,6 +8,10 @@ import {
PubLeafletPagesLinearDocument,
} from "lexicons/api";
import { TextBlockCore } from "../Blocks/TextBlockCore";
+import {
+ FootnoteItemLayout,
+ FootnoteSectionLayout,
+} from "components/Footnotes/FootnoteItemLayout";
export type PublishedFootnote = {
footnoteId: string;
@@ -74,43 +78,43 @@ export function PublishedFootnoteSection(props: {
if (props.footnotes.length === 0) return null;
return (
-
-
-
- {props.footnotes.map((fn) => (
-
- ))}
-
-
+
+ {props.footnotes.map((fn) => (
+
+ ))}
+
+ );
+}
+
+export function PublishedFootnoteItem(props: {
+ footnote: PublishedFootnote;
+}) {
+ let fn = props.footnote;
+ return (
+
);
}
diff --git a/components/Footnotes/FootnoteEditor.tsx b/components/Footnotes/FootnoteEditor.tsx
index 659c9303..1b56edcc 100644
--- a/components/Footnotes/FootnoteEditor.tsx
+++ b/components/Footnotes/FootnoteEditor.tsx
@@ -12,6 +12,7 @@ import {
trackUndoRedo,
} from "components/Blocks/TextBlock/mountProsemirror";
import { CloseTiny } from "components/Icons/CloseTiny";
+import { FootnoteItemLayout } from "./FootnoteItemLayout";
export function FootnoteEditor(props: {
footnoteEntityID: string;
@@ -97,36 +98,33 @@ export function FootnoteEditor(props: {
}, [props.footnoteEntityID, value, props.editable, props.autoFocus, rep.undoManager]);
return (
-
-
+
{
+ let ref = document.querySelector(
+ `.footnote-ref[data-footnote-id="${props.footnoteEntityID}"]`,
+ );
+ if (ref) {
+ ref.scrollIntoView({ behavior: "smooth", block: "center" });
+ }
+ }}
+ trailing={
+ props.editable && props.onDelete ? (
+
+ ) : undefined
+ }
+ >
- {props.editable && props.onDelete && (
-
- )}
-
+
);
}
diff --git a/components/Footnotes/FootnoteItemLayout.tsx b/components/Footnotes/FootnoteItemLayout.tsx
new file mode 100644
index 00000000..5fea30d6
--- /dev/null
+++ b/components/Footnotes/FootnoteItemLayout.tsx
@@ -0,0 +1,56 @@
+import { ReactNode } from "react";
+
+export function FootnoteItemLayout(props: {
+ index: number;
+ indexAction?: () => void;
+ indexHref?: string;
+ children: ReactNode;
+ trailing?: ReactNode;
+ id?: string;
+ className?: string;
+}) {
+ let indexClassName =
+ "text-accent-contrast font-medium shrink-0 text-xs leading-normal no-underline hover:underline cursor-pointer";
+
+ let indexContent = <>{props.index}.>;
+
+ return (
+
+ {props.indexHref ? (
+
+ {indexContent}
+
+ ) : (
+
+ )}
+
+ {props.children}
+
+ {props.trailing}
+
+ );
+}
+
+export function FootnoteSectionLayout(props: {
+ children: ReactNode;
+ className?: string;
+}) {
+ return (
+
+ );
+}
diff --git a/components/Footnotes/FootnoteSection.tsx b/components/Footnotes/FootnoteSection.tsx
index 460f2e05..b230d150 100644
--- a/components/Footnotes/FootnoteSection.tsx
+++ b/components/Footnotes/FootnoteSection.tsx
@@ -3,6 +3,7 @@ import { FootnoteEditor } from "./FootnoteEditor";
import { useReplicache } from "src/replicache";
import { useEntitySetContext } from "components/EntitySetProvider";
import { deleteFootnoteFromBlock } from "./deleteFootnoteFromBlock";
+import { FootnoteSectionLayout } from "./FootnoteItemLayout";
export function FootnoteSection(props: { hiddenOnDesktop?: boolean }) {
let { footnotes } = useFootnoteContext();
@@ -12,29 +13,26 @@ export function FootnoteSection(props: { hiddenOnDesktop?: boolean }) {
if (footnotes.length === 0) return null;
return (
-
-
-
- {footnotes.map((fn) => (
- {
- deleteFootnoteFromBlock(
- fn.footnoteEntityID,
- fn.blockID,
- rep.rep,
- );
- }
- : undefined
- }
- />
- ))}
-
-
+
+ {footnotes.map((fn) => (
+ {
+ deleteFootnoteFromBlock(
+ fn.footnoteEntityID,
+ fn.blockID,
+ rep.rep,
+ );
+ }
+ : undefined
+ }
+ />
+ ))}
+
);
}