|
|
|
@ -15,19 +15,14 @@ import androidx.compose.material3.MaterialTheme
@@ -15,19 +15,14 @@ import androidx.compose.material3.MaterialTheme
|
|
|
|
|
import androidx.compose.runtime.Composable |
|
|
|
|
import androidx.compose.ui.Alignment |
|
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
|
import androidx.compose.ui.graphics.Color |
|
|
|
|
import androidx.compose.ui.graphics.vector.ImageVector |
|
|
|
|
import androidx.compose.ui.text.style.TextAlign |
|
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
|
import io.element.android.compound.theme.ElementTheme |
|
|
|
|
import io.element.android.compound.tokens.generated.CompoundIcons |
|
|
|
|
import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtom |
|
|
|
|
import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtomSize |
|
|
|
|
import io.element.android.libraries.designsystem.icons.CompoundDrawables |
|
|
|
|
import io.element.android.libraries.designsystem.components.BigIcon |
|
|
|
|
import io.element.android.libraries.designsystem.preview.ElementPreview |
|
|
|
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight |
|
|
|
|
import io.element.android.libraries.designsystem.theme.components.Text |
|
|
|
|
import io.element.android.libraries.designsystem.theme.temporaryColorBgSpecial |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* IconTitleSubtitleMolecule is a molecule which displays an icon, a title and a subtitle. |
|
|
|
@ -35,30 +30,19 @@ import io.element.android.libraries.designsystem.theme.temporaryColorBgSpecial
@@ -35,30 +30,19 @@ import io.element.android.libraries.designsystem.theme.temporaryColorBgSpecial
|
|
|
|
|
* @param title the title to display |
|
|
|
|
* @param subTitle the subtitle to display |
|
|
|
|
* @param modifier the modifier to apply to this layout |
|
|
|
|
* @param iconResourceId the resource id of the icon to display, exclusive with [iconImageVector] |
|
|
|
|
* @param iconImageVector the image vector of the icon to display, exclusive with [iconResourceId] |
|
|
|
|
* @param iconTint the tint to apply to the icon |
|
|
|
|
* @param iconBackgroundTint the tint to apply to the icon background |
|
|
|
|
* @param iconStyle the style of the [BigIcon] to display |
|
|
|
|
*/ |
|
|
|
|
@Composable |
|
|
|
|
fun IconTitleSubtitleMolecule( |
|
|
|
|
title: String, |
|
|
|
|
subTitle: String?, |
|
|
|
|
iconStyle: BigIcon.Style, |
|
|
|
|
modifier: Modifier = Modifier, |
|
|
|
|
iconResourceId: Int? = null, |
|
|
|
|
iconImageVector: ImageVector? = null, |
|
|
|
|
iconTint: Color = MaterialTheme.colorScheme.primary, |
|
|
|
|
iconBackgroundTint: Color = ElementTheme.colors.temporaryColorBgSpecial, |
|
|
|
|
) { |
|
|
|
|
Column(modifier) { |
|
|
|
|
RoundedIconAtom( |
|
|
|
|
modifier = Modifier |
|
|
|
|
.align(Alignment.CenterHorizontally), |
|
|
|
|
size = RoundedIconAtomSize.Large, |
|
|
|
|
resourceId = iconResourceId, |
|
|
|
|
imageVector = iconImageVector, |
|
|
|
|
tint = iconTint, |
|
|
|
|
backgroundTint = iconBackgroundTint, |
|
|
|
|
BigIcon( |
|
|
|
|
modifier = Modifier.align(Alignment.CenterHorizontally), |
|
|
|
|
style = iconStyle, |
|
|
|
|
) |
|
|
|
|
Spacer(modifier = Modifier.height(16.dp)) |
|
|
|
|
Text( |
|
|
|
@ -86,18 +70,7 @@ fun IconTitleSubtitleMolecule(
@@ -86,18 +70,7 @@ fun IconTitleSubtitleMolecule(
|
|
|
|
|
@Composable |
|
|
|
|
internal fun IconTitleSubtitleMoleculePreview() = ElementPreview { |
|
|
|
|
IconTitleSubtitleMolecule( |
|
|
|
|
iconImageVector = CompoundIcons.Chat(), |
|
|
|
|
title = "Title", |
|
|
|
|
subTitle = "Subtitle", |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PreviewsDayNight |
|
|
|
|
@Composable |
|
|
|
|
internal fun IconTitleSubtitleMoleculeWithResIconPreview() = ElementPreview { |
|
|
|
|
IconTitleSubtitleMolecule( |
|
|
|
|
iconResourceId = CompoundDrawables.ic_compound_admin, |
|
|
|
|
iconTint = Color.Black, |
|
|
|
|
iconStyle = BigIcon.Style.Default(CompoundIcons.Chat()), |
|
|
|
|
title = "Title", |
|
|
|
|
subTitle = "Subtitle", |
|
|
|
|
) |
|
|
|
|