blob: c073331957ac33d7308a8106f82620dcc49a4942 [file] [log] [blame]
package com.airbnb.lottie.sample.compose.examples
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
@Composable
fun ExampleCard(
name: String,
description: String,
content: @Composable () -> Unit,
) {
Surface(
shape = RoundedCornerShape(6.dp),
elevation = 8.dp,
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(bottom = 16.dp)
.padding(horizontal = 48.dp)
) {
Column {
Box(
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f)
.background(Color.Gray)
) {
content()
}
Text(
name,
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(top = 16.dp, bottom = 4.dp)
)
Text(
description,
color = Color.Gray,
fontSize = 12.sp,
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(bottom = 16.dp)
)
}
}
}