Skip to content

Commit 3cf9800

Browse files
committed
Improve room closing UI
1 parent 90dcedc commit 3cf9800

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/UI/components/RoomListComponent.tsx

+6-7
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function RoomListComponent(
3737
className="relative flex w-full cursor-pointer"
3838
>
3939
<div
40-
className={' flex flex-row hover-color w-full ' + (
40+
className={'flex flex-row hover-color w-full overflow-clip ' + (
4141
ID === room?.ID ?
4242
' bg-gray-451 dark:bg-gray-450 dark:hover:bg-gray-450 ' :
4343
mentions > 0 || unread > 0 ?
@@ -51,9 +51,8 @@ export function RoomListComponent(
5151
<span className="rounded-full bg-white text-white text-xs p-1 h-1 w-1 absolute top-1/2 transform -translate-x-1/2 -translate-y-1/2" />
5252
) :
5353
null}
54-
{/** Room name */}
5554
<button
56-
className={'rounded p-1 flex flex-row basis-full items-center h-auto mr-2 ml-2 '}
55+
className={'rounded p-1 flex flex-row basis-full items-center truncate h-auto mr-2 ml-2 '}
5756
onClick={() => {
5857
notificationsEngine.askPermission();
5958
setRoom(ID);
@@ -75,20 +74,20 @@ export function RoomListComponent(
7574
</button>
7675
{
7776
/* Should display closing button?*/
78-
(room?.ID === ID && room?.ID !== 'home') ?
79-
<ClosingButton room={room.ID} /> :
77+
(ID !== 'home') ?
78+
<ClosingButton room={ID} current={ID === room?.ID} /> :
8079
''
8180
}
8281
</div>
8382
</div>
8483
);
8584
}
8685

87-
function ClosingButton({ room }: Readonly<{ room: string }>) {
86+
function ClosingButton({ room, current }: Readonly<{ room: string, current: boolean }>) {
8887
const { client } = useClientContext();
8988
return (
9089
<button className="p-1" onClick={() => client.leaveRoom(room)}>
91-
<AiOutlineClose className='hover:text-red-600' opacity={0.4} />
90+
<AiOutlineClose className='hover:text-red-600 hover:opacity-100' opacity={current ? 0.8 : 0.2} />
9291
</button>
9392
);
9493
}

0 commit comments

Comments
 (0)