Skip to content

Conversation

@arsen-afaunov
Copy link
Contributor

No description provided.

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@gravity-ui-bot
Copy link
Contributor

Playwright Test Component is ready.

{typeof topAlert === 'function' ? (
topAlert()
) : (
<TopAlert className={b('top-alert')} alert={topAlert} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

The base TopAlert component uses the useTopAlertHeight hook to send up information about its height, but this does not happen for the function (the --gn-top-alert-height variable remains equal to 0). Consistency of logic is violated. What can we do about it?

Copy link
Contributor Author

@arsen-afaunov arsen-afaunov Nov 17, 2025

Choose a reason for hiding this comment

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

Absolutely. I'll figure something out. Thank you for noticing.

await expectScreenshot();
});

test('render story: <CustomTopAlert>', async ({mount, expectScreenshot}) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

telegram-cloud-photo-size-2-5249280790221229729-x

I suggest calling stories in the same style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I'll rename the story.

@DarkGenius
Copy link
Collaborator

Screenshot 2025-11-19 at 17 21 58 Something's wrong with the layout.

onCloseTopAlert?: () => void;
}

export interface TopAlertProps extends TopAlertBaseProps {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The updated TopAlertProps interface still requires message, yet the component explicitly supports a render function that can render arbitrary content. Making message mandatory in the type system forces callers who only want a custom renderer to pass meaningless placeholder text to satisfy the compiler. This should be modeled as a union or by making message optional when render is provided.

}, [opened, updateTopSize]);

if (!alert || !alert.message) {
return null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems better to make message optional if the render is set.

@arsen-afaunov arsen-afaunov merged commit 7790d8c into main Nov 21, 2025
5 checks passed
@arsen-afaunov arsen-afaunov deleted the support-function-type-for-PageLayout-topAlert-prop branch November 21, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants