fun SourceAlertBanner()

in android/source/src/main/kotlin/com/gu/source/components/banner/SourceAlertBanner.kt [153:209]


fun SourceAlertBanner(
    messageText: AnnotatedString,
    priority: SourceAlertBanner.Priority,
    onMessageClick: () -> Unit,
    onDismiss: () -> Unit,
    modifier: Modifier = Modifier,
) {
    Row(modifier = modifier.background(priority.backgroundColour.current)) {
        Row(
            modifier = Modifier
                .weight(1f)
                .clickable(
                    interactionSource = remember { MutableInteractionSource() },
                    indication = ripple(color = priority.contentColour.current),
                    onClick = onMessageClick,
                )
                .padding(
                    top = SourceAlertBanner.Style.ContentPaddingVertical,
                    bottom = SourceAlertBanner.Style.ContentPaddingVertical,
                    start = SourceAlertBanner.Style.ContentPaddingHorizontal,
                ),
        ) {
            priority.icon?.let {
                Icon(
                    imageVector = it,
                    tint = priority.iconTint.current,
                    contentDescription = null,
                )

                Spacer(modifier = Modifier.width(SourceAlertBanner.Style.iconTextSpacing))
            }

            Text(
                text = messageText,
                style = SourceAlertBanner.Style.textStyle,
                color = priority.contentColour.current,
            )
        }

        Spacer(modifier = Modifier.width(SourceAlertBanner.Style.closeTextSpacing))

        IconButton(
            onClick = onDismiss,
            modifier = Modifier.padding(
                end = SourceAlertBanner.Style.ContentPaddingHorizontal,
                top = SourceAlertBanner.Style.CloseIconButtonPaddingVertical,
                bottom = SourceAlertBanner.Style.CloseIconButtonPaddingVertical,
            ),
        ) {
            Icon(
                imageVector = Source.Icons.Base.Cross,
                tint = priority.contentColour.current,
                contentDescription = null,
            )
        }
    }
}