Skip to content
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

fix(Alert): fix close button width #1542

Merged
merged 2 commits into from
Apr 23, 2024
Merged
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
4 changes: 4 additions & 0 deletions src/components/Alert/Alert.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ $block: '.#{variables.$ns}alert';
&__actions_minContent {
width: min-content;
}

&__close-btn {
flex-shrink: 0;
}
}
1 change: 1 addition & 0 deletions src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const Alert = (props: AlertProps) => {
{onClose && (
<Button
view="flat"
className={bAlert('close-btn')}
onClick={onClose}
extraProps={{
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

on each render created new object. You think better to leave it as it is?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, the i18n call must be inside the component. Otherwise dynamic language change will not work.

'aria-label': i18n('label_close'),
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/__snapshots__/Alert.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exports[`Alert has predicted styles if inline layout rendered 1`] = `
</div>
<button
aria-label="Close"
class="g-button g-button_view_flat g-button_size_m g-button_pin_round-round"
class="g-button g-button_view_flat g-button_size_m g-button_pin_round-round g-alert__close-btn"
type="button"
>
<span
Expand Down
Loading