Skip to content

feat(Alert): add size props; add css-api; refactor component #2146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

benax-se
Copy link
Contributor

@benax-se benax-se commented Mar 5, 2025

No description provided.

@benax-se benax-se requested a review from IsaevAlexandr as a code owner March 5, 2025 10:51
@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@gravity-ui-bot
Copy link
Contributor

Visual Tests Report is ready.

@benax-se benax-se force-pushed the feat/alert-sizes-and-css-api branch 6 times, most recently from f08a52c to 353afc1 Compare March 11, 2025 10:53
color: var(--g-alert-title-color, var(--g-color-text-primary));
font-size: var(--g-alert-title-font-size, var(--_--title-font-size));
font-weight: var(--g-alert-title-font-weight, var(--_--title-font-weight));
line-height: var(--g-alert-title-line-height, var(--_--title-line-height));
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need of font weight CSS vars, user can do the following:

<Alert title={<MyBoldTitle/>} />

Let's keep only font-size and line-height

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

}

&__title {
color: var(--g-alert-title-color, var(--g-color-text-primary));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
color: var(--g-alert-title-color, var(--g-color-text-primary));
color: var(--g-alert-title-text-color, var(--g-color-text-primary));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

}

&__message {
color: var(--g-alert-message-color, var(--g-color-text-complementary));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
color: var(--g-alert-message-color, var(--g-color-text-complementary));
color: var(--g-alert-message-text-color, var(--g-color-text-complementary));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -17,5 +134,6 @@ $block: '.#{variables.$ns}alert';

&__close-btn {
flex-shrink: 0;
margin-inline-start: var(--g-alert-close-btn-indent, var(--_--close-btn-indent));
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the purpose of manipulating both margin and relative position? There are already usage of --_--close-btn-offset above.

Copy link
Contributor Author

@benax-se benax-se Mar 17, 2025

Choose a reason for hiding this comment

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

after discussion with the designer we decided to remove additional offset

&__main {
flex-grow: 1;
display: flex;
gap: var(--g-alert-content-gap, var(--_--content-gap));
Copy link
Contributor

Choose a reason for hiding this comment

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

We should specify in CSS API only the parts we publically declare. The content name is the internal structure. This should be variables like: g-alert-message-margin, g-alert-actions-margin and so on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

layout = 'vertical',
closeBtnSize = 'm',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
closeBtnSize = 'm',
closeButttonSize = 'm',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

}

&__icon {
vertical-align: text-bottom;
Copy link
Contributor

Choose a reason for hiding this comment

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

Icon is now not aligned properly with the title. Icon should be a bit under the text baseline

@benax-se benax-se force-pushed the feat/alert-sizes-and-css-api branch from 353afc1 to 2710b80 Compare March 12, 2025 14:54
@benax-se benax-se force-pushed the feat/alert-sizes-and-css-api branch from 06c4405 to 3854a73 Compare March 17, 2025 11:35
@benax-se benax-se requested a review from amje March 17, 2025 12:20
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.

3 participants