Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix: align base card close button to the right always (#11861)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerry authored Nov 13, 2023
1 parent cda17d5 commit a3f0633
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
6 changes: 5 additions & 1 deletion res/css/views/right_panel/_BaseCard.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ limitations under the License.
display: flex;
align-items: center;
justify-content: space-between;
width: calc(100% - 38px);
height: 24px;
flex: 1;

Expand Down Expand Up @@ -157,6 +156,7 @@ limitations under the License.

.mx_BaseCard_back,
.mx_BaseCard_close {
flex-shrink: 0;
position: relative;
background-color: var(--cpd-color-bg-subtle-secondary);
width: var(--BaseCard_header-button-size);
Expand Down Expand Up @@ -226,3 +226,7 @@ limitations under the License.
}
}
}

.mx_BaseCard_headerProp {
flex: 1 1 100%;
}
4 changes: 0 additions & 4 deletions res/css/views/right_panel/_RoomSummaryCard.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ limitations under the License.

.mx_RoomSummaryCard_header {
padding: 15px 12px;

.mx_BaseCard_close {
flex-shrink: 0;
}
}

.mx_RoomSummaryCard_search input {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/right_panel/BaseCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const BaseCard: React.FC<IProps> = forwardRef<HTMLDivElement, IProps>(
<div className="mx_BaseCard_header">
{backButton}
{closeButton}
{header}
<div className="mx_BaseCard_headerProp">{header}</div>
</div>
)}
{children}
Expand Down
32 changes: 18 additions & 14 deletions test/components/views/elements/__snapshots__/AppTile-test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,26 @@ exports[`AppTile destroys non-persisted right panel widget on room change 1`] =
title="Close"
/>
<div
class="mx_BaseCard_header_title"
class="mx_BaseCard_headerProp"
>
<h4
class="mx_Heading_h4 mx_BaseCard_header_title_heading"
>
Example 1
</h4>
<div
aria-expanded="false"
aria-haspopup="true"
aria-label="Options"
class="mx_AccessibleButton mx_BaseCard_header_title_button--option"
role="button"
tabindex="0"
title="Options"
/>
class="mx_BaseCard_header_title"
>
<h4
class="mx_Heading_h4 mx_BaseCard_header_title_heading"
>
Example 1
</h4>
<div
aria-expanded="false"
aria-haspopup="true"
aria-label="Options"
class="mx_AccessibleButton mx_BaseCard_header_title_button--option"
role="button"
tabindex="0"
title="Options"
/>
</div>
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ exports[`<UserInfo /> with crypto enabled renders <BasicUserInfo /> 1`] = `
tabindex="0"
title="Close"
/>
<span />
<div
class="mx_BaseCard_headerProp"
>
<span />
</div>
</div>
<div
class="mx_AutoHideScrollbar"
Expand Down

0 comments on commit a3f0633

Please sign in to comment.