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