From 26798799fc9ad994c356f8f797ef69a57b054abe Mon Sep 17 00:00:00 2001 From: Charly Nguyen Date: Wed, 8 Nov 2023 12:30:33 +0100 Subject: [PATCH] Adapt the rendering of extra icons in the room header Signed-off-by: Charly Nguyen --- src/components/views/rooms/LegacyRoomHeader.tsx | 2 +- src/components/views/rooms/RoomHeader.tsx | 2 +- test/components/views/rooms/LegacyRoomHeader-test.tsx | 4 ++-- test/components/views/rooms/RoomHeader-test.tsx | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/views/rooms/LegacyRoomHeader.tsx b/src/components/views/rooms/LegacyRoomHeader.tsx index ab9107446903..ceba6928406f 100644 --- a/src/components/views/rooms/LegacyRoomHeader.tsx +++ b/src/components/views/rooms/LegacyRoomHeader.tsx @@ -684,7 +684,7 @@ export default class RoomHeader extends React.Component { }} title={label} > - {props.icon} + {props.icon()} ); diff --git a/src/components/views/rooms/RoomHeader.tsx b/src/components/views/rooms/RoomHeader.tsx index 3fc0998ccaf2..cb082797a4ef 100644 --- a/src/components/views/rooms/RoomHeader.tsx +++ b/src/components/views/rooms/RoomHeader.tsx @@ -188,7 +188,7 @@ export default function RoomHeader({ props.onClick(); }} > - {props.icon} + {props.icon()} ); diff --git a/test/components/views/rooms/LegacyRoomHeader-test.tsx b/test/components/views/rooms/LegacyRoomHeader-test.tsx index 3038fa0d499f..69c7ba910fcb 100644 --- a/test/components/views/rooms/LegacyRoomHeader-test.tsx +++ b/test/components/views/rooms/LegacyRoomHeader-test.tsx @@ -743,7 +743,7 @@ describe("LegacyRoomHeader", () => { it("renders additionalButtons", async () => { const additionalButtons: ViewRoomOpts["buttons"] = [ { - icon: <>test-icon, + icon: () => <>test-icon, id: "test-id", label: () => "test-label", onClick: () => {}, @@ -757,7 +757,7 @@ describe("LegacyRoomHeader", () => { const callback = jest.fn(); const additionalButtons: ViewRoomOpts["buttons"] = [ { - icon: <>test-icon, + icon: () => <>test-icon, id: "test-id", label: () => "test-label", onClick: callback, diff --git a/test/components/views/rooms/RoomHeader-test.tsx b/test/components/views/rooms/RoomHeader-test.tsx index f354ae934a2a..43505c5af387 100644 --- a/test/components/views/rooms/RoomHeader-test.tsx +++ b/test/components/views/rooms/RoomHeader-test.tsx @@ -522,7 +522,7 @@ describe("RoomHeader", () => { it("renders additionalButtons", async () => { const additionalButtons: ViewRoomOpts["buttons"] = [ { - icon: <>test-icon, + icon: () => <>test-icon, id: "test-id", label: () => "test-label", onClick: () => {}, @@ -539,7 +539,7 @@ describe("RoomHeader", () => { const callback = jest.fn(); const additionalButtons: ViewRoomOpts["buttons"] = [ { - icon: <>test-icon, + icon: () => <>test-icon, id: "test-id", label: () => "test-label", onClick: callback,