Make ToastContainer compatible with RTL layout (#8230)

* Fix _ToastContainer.scss

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

* Improve existing rules

- Use properties available for flexbox
- Align the title of the toast to the center

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

* Set the count indicator on the end side of the div

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

* Remove the vertical-align property since it has no longer effect

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
pull/21833/head
Suguru Hirahara 2022-04-14 20:35:52 +00:00 committed by GitHub
parent 08a2d81d6b
commit eb1d9b8f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 12 deletions

View File

@ -108,26 +108,25 @@ limitations under the License.
} }
.mx_Toast_title { .mx_Toast_title {
display: flex;
align-items: center;
column-gap: 8px;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
h2 { h2 {
grid-column: 1 / 3;
grid-row: 1;
margin: 0; margin: 0;
font-size: $font-15px; font-size: $font-15px;
font-weight: 600; font-weight: 600;
display: inline; display: inline;
width: auto; width: auto;
vertical-align: middle;
} }
span { .mx_Toast_title_countIndicator {
padding-left: 8px;
float: right;
font-size: $font-12px; font-size: $font-12px;
line-height: $font-22px; line-height: $font-22px;
color: $secondary-content; color: $secondary-content;
margin-inline-start: auto; // on the end side of the div
} }
} }
@ -137,17 +136,14 @@ limitations under the License.
} }
.mx_Toast_buttons { .mx_Toast_buttons {
float: right;
display: flex; display: flex;
justify-content: flex-end;
column-gap: 5px;
.mx_AccessibleButton { .mx_AccessibleButton {
min-width: 96px; min-width: 96px;
box-sizing: border-box; box-sizing: border-box;
} }
.mx_AccessibleButton + .mx_AccessibleButton {
margin-left: 5px;
}
} }
.mx_Toast_description { .mx_Toast_description {

View File

@ -79,7 +79,7 @@ export default class ToastContainer extends React.Component<{}, IState> {
titleElement = ( titleElement = (
<div className="mx_Toast_title"> <div className="mx_Toast_title">
<h2>{ title }</h2> <h2>{ title }</h2>
<span>{ countIndicator }</span> <span className="mx_Toast_title_countIndicator">{ countIndicator }</span>
</div> </div>
); );
} }