@@ -198,16 +198,25 @@ export const togetherModeParticipantDisplayName = (
198
198
isParticipantHovered : boolean ,
199
199
participantSeatingWidth : number ,
200
200
color : string
201
- ) : CSSProperties => {
202
- const MIN_DISPLAY_NAME_WIDTH = 100 ;
201
+ ) : React . CSSProperties => {
202
+ const width =
203
+ isParticipantHovered || participantSeatingWidth * 16 > 100
204
+ ? 'fit-content'
205
+ : _pxToRem ( 0.7 * participantSeatingWidth * 16 ) ;
206
+
207
+ const display = isParticipantHovered || participantSeatingWidth * 16 > 150 ? 'inline-block' : 'none' ;
208
+
203
209
return {
204
210
textOverflow : 'ellipsis' ,
205
- flexGrow : 1 , // Allow text to grow within available space
206
- overflow : isParticipantHovered ? 'visible' : 'hidden' ,
207
211
whiteSpace : 'nowrap' ,
208
212
textAlign : 'center' ,
209
213
color,
210
- display : isParticipantHovered || participantSeatingWidth > MIN_DISPLAY_NAME_WIDTH ? 'inline-block' : 'none' // Completely remove the element when hidden
214
+ overflow : isParticipantHovered ? 'visible' : 'hidden' ,
215
+ width,
216
+ display,
217
+ fontSize : `${ _pxToRem ( 13 ) } ` ,
218
+ lineHeight : `${ _pxToRem ( 20 ) } ` ,
219
+ maxWidth : isParticipantHovered ? 'fit-content' : _pxToRem ( 0.7 * participantSeatingWidth * 16 )
211
220
} ;
212
221
} ;
213
222
@@ -221,11 +230,28 @@ export const togetherModeParticipantEmojiSpriteStyle = (
221
230
participantSeatWidth : string
222
231
) : CSSProperties => {
223
232
const participantSeatWidthInPixel = parseFloat ( participantSeatWidth ) * REM_TO_PX_MULTIPLIER ;
224
- const emojiScaledSizeInPercent = ( emojiScaledSize / participantSeatWidthInPixel ) * 100 ;
233
+ const emojiScaledSizeInPercent = 100 - ( emojiScaledSize / participantSeatWidthInPixel ) * 100 ;
225
234
return {
226
235
width : `${ emojiSize } ` ,
227
236
position : 'absolute' ,
228
237
// Center the emoji sprite within the participant seat
229
- left : `${ emojiScaledSizeInPercent / 2 } %`
238
+ left : `${ emojiScaledSizeInPercent / 2 } %` ,
239
+ zIndex : 3
230
240
} ;
231
241
} ;
242
+
243
+ /**
244
+ * The style for the transition of the participant status container in Together Mode.
245
+ * @private
246
+ */
247
+ export const participantStatusTransitionStyle : CSSProperties = {
248
+ position : 'absolute' ,
249
+ bottom : `${ _pxToRem ( 2 ) } ` ,
250
+ width : 'fit-content' ,
251
+ textAlign : 'center' ,
252
+ border : '1px solid white' ,
253
+ transform : 'translate(-50%)' ,
254
+ transition : 'width 0.3s ease, transform 0.3s ease' ,
255
+ left : '50%' ,
256
+ zIndex : 0
257
+ } ;
0 commit comments