Skip to content

Commit bc07cbf

Browse files
authored
Refactor handleTitleAdditions to remove layout parameter and adjust container classes for title additions. Update PublishNodeTitleButton and renderLinkedReferenceAdditions to reflect these changes. (#1228)
1 parent 69f7d22 commit bc07cbf

3 files changed

Lines changed: 1 addition & 11 deletions

File tree

apps/roam/src/components/PublishNodeTitleButton.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,5 @@ export const renderPublishNodeTitleButton = ({
4848
handleTitleAdditions(
4949
h1,
5050
<PublishNodeTitleButton uid={uid} title={title} nodeType={nodeType} />,
51-
{ layout: "inline" },
5251
);
5352
};

apps/roam/src/utils/handleTitleAdditions.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,10 @@ import ReactDOM from "react-dom";
33

44
const ROAM_TITLE_CONTAINER_CLASS = "rm-title-display-container";
55
const ADDITIONS_CONTAINER_CLASS = "discourse-graph-title-additions";
6-
const ADDITIONS_CONTAINER_CLASSES = `${ADDITIONS_CONTAINER_CLASS} flex flex-wrap items-start gap-x-2 gap-y-2`;
7-
const INLINE_ADDITION_CLASSES = "min-w-0 flex-none";
8-
const BLOCK_ADDITION_CLASSES = "min-w-0 basis-full grow shrink-0";
9-
10-
type TitleAdditionLayout = "inline" | "block";
116

127
export const handleTitleAdditions = (
138
h1: HTMLHeadingElement,
149
element: React.ReactNode,
15-
{ layout = "block" }: { layout?: TitleAdditionLayout } = {},
1610
): void => {
1711
const titleDisplayContainer =
1812
h1.closest(`.${ROAM_TITLE_CONTAINER_CLASS}`) ||
@@ -31,7 +25,7 @@ export const handleTitleAdditions = (
3125
if (!parent) return;
3226

3327
container = document.createElement("div");
34-
container.className = ADDITIONS_CONTAINER_CLASSES;
28+
container.className = `${ADDITIONS_CONTAINER_CLASS} flex flex-col`;
3529

3630
const oldMarginBottom = getComputedStyle(h1).marginBottom;
3731
const oldMarginBottomNum = Number.isFinite(parseFloat(oldMarginBottom))
@@ -51,8 +45,6 @@ export const handleTitleAdditions = (
5145

5246
if (React.isValidElement(element)) {
5347
const renderContainer = document.createElement("div");
54-
renderContainer.className =
55-
layout === "inline" ? INLINE_ADDITION_CLASSES : BLOCK_ADDITION_CLASSES;
5648
container.appendChild(renderContainer);
5749
// eslint-disable-next-line react/no-deprecated
5850
ReactDOM.render(element, renderContainer);

apps/roam/src/utils/renderLinkedReferenceAdditions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export const renderDiscourseContext = ({
2020
uid,
2121
id: nanoid(),
2222
}),
23-
{ layout: "inline" },
2423
);
2524
h1.setAttribute("data-roamjs-top-discourse-context", "true");
2625
};

0 commit comments

Comments
 (0)