-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(MyKSuite): Add first chip components
feat(MyKSuite): Fix chips
- Loading branch information
1 parent
2f99eb7
commit fade8f9
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
MykSuite/src/main/java/com/infomaniak/lib/myksuite/ui/components/MyKSuiteChips.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Infomaniak Core - Android | ||
* Copyright (C) 2025 Infomaniak Network SA | ||
* | ||
* This program 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. | ||
* | ||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.infomaniak.lib.myksuite.ui.components | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.material3.SuggestionChip | ||
import androidx.compose.material3.SuggestionChipDefaults | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.res.vectorResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import com.infomaniak.lib.myksuite.R | ||
import com.infomaniak.lib.myksuite.ui.theme.MyKSuiteTheme | ||
|
||
@Composable | ||
fun MyKSuitePlusChip(modifier: Modifier = Modifier, onClick: () -> Unit) { | ||
Chip( | ||
modifier = modifier, | ||
onClick = onClick, | ||
label = { Image(ImageVector.vectorResource(R.drawable.ic_logo_my_ksuite_plus), contentDescription = "My kSuite +") }, | ||
) | ||
} | ||
|
||
@Composable | ||
fun MyKSuiteChip(modifier: Modifier = Modifier, onClick: () -> Unit) { | ||
Chip( | ||
modifier = modifier, | ||
onClick = onClick, | ||
label = { Image(ImageVector.vectorResource(R.drawable.ic_logo_my_ksuite), contentDescription = "My kSuite") }, | ||
) | ||
} | ||
|
||
@Composable | ||
private fun Chip(modifier: Modifier = Modifier, onClick: () -> Unit, label: @Composable () -> Unit) { | ||
SuggestionChip( | ||
modifier = modifier, | ||
onClick = onClick, | ||
label = label, | ||
border = null, | ||
colors = SuggestionChipDefaults.suggestionChipColors( | ||
containerColor = MyKSuiteTheme.colors.chipBackground, | ||
), | ||
) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun Preview() { | ||
MyKSuiteTheme { | ||
Surface { | ||
Column { | ||
MyKSuitePlusChip {} | ||
MyKSuiteChip {} | ||
} | ||
} | ||
} | ||
} |