Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@
dark:bg-neutral-900/40;
}

/*
* A top-level return (not nested inside a `.children` group) attaches to the
* items above it as a full-bleed footer: it bleeds past the container padding
* and is separated by a divider rather than floating on its own.
*/
.return:not(:first-child, .children .return) {
@apply -mx-4
-mb-3
rounded-t-none
border-t
border-neutral-200
dark:border-neutral-900;
}

.children {
@apply relative
flex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ const SignatureRoot: FC<PropsWithChildren<SignatureRootProps>> = ({
const titleId = useId();

return (
<section className={styles.container} aria-labelledby={titleId}>
<div className={styles.title} id={titleId}>
{title}
</div>
<section
className={styles.container}
aria-labelledby={title ? titleId : undefined}
>
{title && (
<div className={styles.title} id={titleId}>
{title}
</div>
)}
<div className={styles.root}>{children}</div>
</section>
);
Expand Down
4 changes: 3 additions & 1 deletion packages/ui-components/src/Common/Signature/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const Signature: FC<PropsWithChildren<SignatureProps>> = ({
title,
children,
}) => {
if (title) {
// A Signature without its own name or type is the grouping container, with
// an optional title. Everything else renders as an individual item.
if (!name && !type) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing name and type misroutes

Medium Severity

Routing entries with neither name nor type to SignatureRoot drops description, kind, and optional, and nests a full section inside the list. FunctionSignature items used to always render as SignatureItem because they never carried title.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bc10063. Configure here.

return <SignatureRoot title={title}>{children}</SignatureRoot>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,10 @@ const renderSignature = (param: SignatureDefinition, index: number) => (
</Signature>
);

const FunctionSignature: FC<FunctionSignatureProps> = ({ title, items }) => {
if (title) {
const attributes: Array<SignatureDefinition> = [];
const returnTypes: Array<SignatureDefinition> = [];

for (const item of items) {
const target = item.kind === 'return' ? returnTypes : attributes;

target.push(item);
}

return (
<>
<Signature title={title}>
{attributes.map((param, i) => renderSignature(param, i))}
</Signature>

{returnTypes.length > 0 &&
returnTypes.map((param, i) =>
renderSignature(param, attributes.length + i)
)}
</>
);
}

return items.map((param, i) => renderSignature(param, i));
};
const FunctionSignature: FC<FunctionSignatureProps> = ({ title, items }) => (
<Signature title={title}>
{items.map((param, i) => renderSignature(param, i))}
</Signature>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty signature renders bordered box

Medium Severity

When FunctionSignature is called with no title and an empty items array, it still renders a Signature wrapper, which produces an empty bordered container. Previously an empty list rendered nothing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bc10063. Configure here.

);

export default FunctionSignature;
Loading