Create PreviewData with sample of UGC used for preview.

Fix preview issue where username was used for room/avatar name.
This commit is contained in:
Benoit Marty 2026-05-06 17:44:37 +02:00
parent 6ef9315468
commit 2a694f6dfd
31 changed files with 214 additions and 110 deletions

View file

@ -8,10 +8,12 @@
package io.element.android.libraries.designsystem.components.avatar
import io.element.android.libraries.designsystem.preview.USER_NAME_ALICE
fun anAvatarData(
// Let's the id not start with a 'a'.
// Let the id not start with a 'a'.
id: String = "@id_of_alice:server.org",
name: String? = "Alice",
name: String? = USER_NAME_ALICE,
url: String? = null,
size: AvatarSize = AvatarSize.RoomListItem,
) = AvatarData(

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.libraries.designsystem.preview
const val USER_NAME_ALICE = "Alice"
const val USER_NAME_BOB = "Bob"
const val USER_NAME_CHARLIE = "Charlie"
const val USER_NAME_CAROL = "Carol"
const val USER_NAME_DAVID = "David"
const val USER_NAME_EVE = "Eve"
const val USER_NAME_JOHN_DOE = "John Doe"
const val USER_NAME_JUSTIN = "Justin"
const val USER_NAME_MALLORY = "Mallory"
const val USER_NAME_SUSIE = "Susie"
const val USER_NAME_VICTOR = "Victor"
const val USER_NAME_WALTER = "Walter"
const val ROOM_NAME = "Room name"
const val SPACE_NAME = "Space name"
const val LAST_MESSAGE = "Last message"