Skip to content

Commit 4be08ee

Browse files
authored
ui(editor): fix conflicting border colors by adding fern-border (#4643)
Fixes FER- ## Short description of the changes made - noticed that contentful had funny borders appear on custom elements - this adds in a new color token (`--fern-border`) so that we can use this when there is room for colors to conflict _before (uses --border):_ ![Screenshot 2025-10-31 at 1.42.13 PM.png](https://app.graphite.dev/user-attachments/assets/fe72cc6b-792f-4347-8e67-decf223e2288.png) _after (uses --fern-border):_ ![Screenshot 2025-10-31 at 1.42.01 PM.png](https://app.graphite.dev/user-attachments/assets/6acae8c7-b0ba-4388-96a7-330f16f259d1.png) ## What was the motivation & context behind this PR? - improve intended coloring of editor ## How has this PR been tested? - tested locally with contentful
1 parent 25ab1db commit 4be08ee

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

packages/fern-dashboard/src/app/[orgName]/(visual-editor)/editor/[docsUrl]/[branch]/[...slug]/PageContents.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as FernNavigation from "@fern-api/fdr-sdk/navigation";
44
import { FernBreadcrumbs } from "@fern-docs/components/FernBreadcrumbs";
55
import type { SerializableFoundNode } from "@fern-docs/components/navigation";
66
import type { MdxToHtmlResponse } from "@fern-docs/mdx";
7-
7+
import { cn } from "@/utils/utils";
88
import PageEditor from "./PageEditor";
99
import PageSubtitle from "./PageSubtitle";
1010
import PageTitle from "./PageTitle";
@@ -21,13 +21,13 @@ export declare namespace PageContents {
2121
export default function PageContents({ filename, initialHtml, initialFrontmatter, foundNode }: PageContents.Props) {
2222
const { title, subtitle, layout } = initialFrontmatter ?? {};
2323

24-
const hidePageHeader = layout === "custom";
24+
const isCustomLayout = layout === "custom";
2525

2626
const breadcrumb = foundNode ? FernNavigation.utils.createBreadcrumb(foundNode.parents) : [];
2727

2828
return (
2929
<div className="max-w-content-width-wide mx-auto w-full pb-64">
30-
{!hidePageHeader && (
30+
{!isCustomLayout && (
3131
<div className="mx-5 not-prose">
3232
{breadcrumb.length > 0 && (
3333
<div className="mb-2">
@@ -42,7 +42,12 @@ export default function PageContents({ filename, initialHtml, initialFrontmatter
4242
/>
4343
</div>
4444
)}
45-
<PageEditor className="-m-2 w-full p-3" filename={filename} initialHtml={initialHtml} />
45+
{/* NOTE: We add extra padding for custom layouts so that +/drag controls don't get cut off */}
46+
<PageEditor
47+
className={cn("-m-2 w-full p-3", isCustomLayout && "px-12")}
48+
filename={filename}
49+
initialHtml={initialHtml}
50+
/>
4651
</div>
4752
);
4853
}

packages/fern-dashboard/src/app/globals.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
--yellow-1200: #403c23;
114114

115115
--fern-green-300: #dbfdd3;
116+
--fern-border: var(--gray-500);
116117
}
117118

118119
.dark {
@@ -213,6 +214,8 @@
213214
--yellow-1000: #ece4ab;
214215
--yellow-1100: #ebe196;
215216
--yellow-1200: #f6eeb4;
217+
218+
--fern-border: var(--gray-300);
216219
}
217220

218221
@theme inline {

packages/fern-dashboard/src/components/editor/NodeHoverWrapper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ const NodeHoverWrapper = ({ name, children, icon, actions }: NodeHoverWrapperPro
1818
<div className="absolute -top-14 left-0 right-0 h-16 z-10" />
1919

2020
{/* Hover outline - only visible on group hover */}
21-
<div className="pointer-events-none absolute -inset-2 hidden rounded-lg border-2 border-border border-dashed group-hover:block" />
21+
<div className="pointer-events-none absolute -inset-2 hidden rounded-lg border-2 border-[var(--fern-border)] border-dashed group-hover:block" />
2222

2323
<div className="absolute right-0 -top-13 z-10 items-center hidden gap-2 group-hover:flex">
24-
<div className="flex items-center gap-1 rounded-[10px] border border-border bg-popover p-1 text-sm shadow-lg">
24+
<div className="flex items-center gap-1 rounded-[10px] border border-[var(--fern-border)] bg-popover p-1 text-sm shadow-lg">
2525
<div className="bg-[var(--fern-green-300)] h-[32px] p-1 px-2.5 rounded-md flex gap-2 items-center text-primary font-normal">
2626
{icon}
2727
{name}

0 commit comments

Comments
 (0)