ClassicCard.kt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) Milan Jurkulák 2024.
  3. * Contact:
  4. * e: mimoccc@gmail.com
  5. * e: mj@mjdev.org
  6. * w: https://mjdev.org
  7. */
  8. package eu.mjdev.desktop.components.card
  9. import androidx.compose.desktop.ui.tooling.preview.Preview
  10. import androidx.compose.foundation.interaction.MutableInteractionSource
  11. import androidx.compose.foundation.layout.*
  12. import androidx.compose.runtime.Composable
  13. import androidx.compose.ui.Modifier
  14. import eu.mjdev.desktop.components.card.base.*
  15. @Suppress("unused")
  16. @Composable
  17. fun ClassicCard(
  18. onClick: () -> Unit = {},
  19. image: @Composable BoxScope.() -> Unit = {},
  20. title: @Composable () -> Unit = {},
  21. modifier: Modifier = Modifier,
  22. onLongClick: (() -> Unit)? = null,
  23. subtitle: @Composable () -> Unit = {},
  24. description: @Composable () -> Unit = {},
  25. shape: CardShape = CardDefaults.shape(),
  26. colors: CardColors = CardDefaults.colors(),
  27. scale: CardScale = CardDefaults.scale(),
  28. border: CardBorder = CardDefaults.border(),
  29. glow: CardGlow = CardDefaults.glow(),
  30. contentPadding: PaddingValues = PaddingValues(),
  31. interactionSource: MutableInteractionSource? = null
  32. ) = Card(
  33. onClick = onClick,
  34. onLongClick = onLongClick,
  35. modifier = modifier,
  36. interactionSource = interactionSource,
  37. shape = shape,
  38. colors = colors,
  39. scale = scale,
  40. border = border,
  41. glow = glow
  42. ) {
  43. Column(modifier = Modifier.padding(contentPadding)) {
  44. Box(contentAlignment = CardDefaults.ContentImageAlignment, content = image)
  45. Column { CardContent(title = title, subtitle = subtitle, description = description) }
  46. }
  47. }
  48. @Preview
  49. @Composable
  50. fun ClassicCardPreview() = ClassicCard()