Skip to content

Commit 168666f

Browse files
committed
[TF-350] Only reserve gutter space when the description has comments
A description with no inline comments no longer gets the left gutter inset; the gutter and its reserved padding appear only once at least one anchored comment exists.
1 parent 7e67e39 commit 168666f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

web/src/components/workitems/DescriptionWithInlineComments.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,14 @@ export function DescriptionWithInlineComments({
269269
[composer, createInline, onOpenThread],
270270
)
271271

272+
// The gutter and its reserved space only exist once the description has at
273+
// least one anchored comment — an empty description gets no left inset.
274+
const hasInlineComments = roots.length > 0
275+
272276
return (
273277
// -ml-2 cancels the description box's left padding so the gutter sits
274-
// flush against the box edge.
275-
<div ref={wrapperRef} className="relative -ml-2">
278+
// flush against the box edge (only when there is a gutter to show).
279+
<div ref={wrapperRef} className={`relative ${hasInlineComments ? '-ml-2' : ''}`}>
276280
{/* Left gutter with a comment marker per anchored line. */}
277281
<div className="absolute left-0 top-0 bottom-0 w-6" aria-hidden={gutter.length === 0}>
278282
{gutter.map((m) => (
@@ -303,7 +307,7 @@ export function DescriptionWithInlineComments({
303307
<div
304308
ref={proseRef}
305309
data-testid="description-body"
306-
className="prose prose-sm dark:prose-invert max-w-none text-gray-700 dark:text-gray-300 break-words pl-9"
310+
className={`prose prose-sm dark:prose-invert max-w-none text-gray-700 dark:text-gray-300 break-words ${hasInlineComments ? 'pl-9' : ''}`}
307311
>
308312
<Markdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeSourcePos]} components={baseComponents}>
309313
{description}

0 commit comments

Comments
 (0)