Add room topic and animation (#11352)

* Create useRoomName hook

Mark RoomName component as deprecated

* Pass out-of-band data to relevant RoomHeader component

* Mark LegacyRoomHeader as deprecated

* Fix incorrect search&replace in _RoomHeader.pcss

* lintfix

* Mark room as optional in room topic hook

* Fix i18n

* Discard use of useCallback

* Change export of useRoomName

* fix ts issue

* lints

* Add room topic to room header

* lintfix

* lintfix & clamp to one line

* Revert optimisations to DecoratedRoomAvatar

* Add test for opening the room summary

* Make transition honour prefer-reduced-motion

* Fallback when room is undefined

* fix snapshot
This commit is contained in:
Germain 2023-08-02 11:54:06 +01:00 committed by GitHub
parent 8166306e0f
commit 33299af5c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 123 additions and 40 deletions

View file

@ -14,40 +14,45 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
:root {
--RoomHeader-indicator-dot-size: 8px;
--RoomHeader-indicator-dot-offset: -3px;
--RoomHeader-indicator-pulseColor: $alert;
}
.mx_RoomHeader {
flex: 0 0 50px;
border-bottom: 1px solid $primary-hairline-color;
background-color: $background;
}
.mx_RoomHeader_wrapper {
height: 44px;
display: flex;
align-items: center;
min-width: 0;
margin: 0 20px 0 16px;
padding-top: 6px;
height: 64px;
gap: var(--cpd-space-3x);
padding: 0 var(--cpd-space-3x);
border-bottom: 1px solid $separator;
background-color: $background;
&:hover {
cursor: pointer;
}
}
/* To remove when compound is integrated */
.mx_RoomHeader_name {
flex: 0 1 auto;
overflow: hidden;
color: $primary-content;
font: var(--cpd-font-heading-sm-semibold);
font-weight: var(--cpd-font-weight-semibold);
min-height: 24px;
align-items: center;
border-radius: 6px;
margin: 0 3px;
padding: 1px 4px;
display: flex;
user-select: none;
cursor: pointer;
font: var(--cpd-font-body-lg-semibold);
}
.mx_RoomHeader_topic {
/* To remove when compound is integrated */
font: var(--cpd-font-body-sm-regular);
height: 0;
opacity: 0;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-all;
text-overflow: ellipsis;
transition: all var(--transition-standard) ease;
}
.mx_RoomHeader:hover .mx_RoomHeader_topic {
/* height needed to compute the transition, it equals to the `line-height`
value in pixels */
height: calc($font-13px * 1.5);
opacity: 1;
}