From 36d9f05bf304552d4da58cd6778fbd1b73f7dcee Mon Sep 17 00:00:00 2001 From: Mateusz Armatys Date: Tue, 12 Nov 2024 12:17:43 +0100 Subject: [PATCH] feat(presentation-compose): Add `ProtonCloseButton`. --- .../compose/component/ProtonCloseButton.kt | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 presentation-compose/src/main/kotlin/me/proton/core/compose/component/ProtonCloseButton.kt diff --git a/presentation-compose/src/main/kotlin/me/proton/core/compose/component/ProtonCloseButton.kt b/presentation-compose/src/main/kotlin/me/proton/core/compose/component/ProtonCloseButton.kt new file mode 100644 index 000000000..572f691c8 --- /dev/null +++ b/presentation-compose/src/main/kotlin/me/proton/core/compose/component/ProtonCloseButton.kt @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Proton AG + * This file is part of Proton AG and ProtonCore. + * + * ProtonCore is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonCore is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonCore. If not, see . + */ + +package me.proton.core.compose.component + +import androidx.compose.material.Icon +import androidx.compose.material.IconButton +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import me.proton.core.compose.theme.ProtonTheme +import me.proton.core.presentation.R + +@Composable +fun ProtonCloseButton( + modifier: Modifier = Modifier, + onCloseClicked: () -> Unit = {} +) { + IconButton( + modifier = modifier, + onClick = onCloseClicked + ) { + Icon( + painterResource(id = R.drawable.ic_proton_close), + contentDescription = stringResource(id = R.string.presentation_close) + ) + } +} + +@Preview +@Composable +fun ProtonCloseButtonPreview() { + ProtonTheme { + ProtonCloseButton() + } +}