Skip to content

Commit

Permalink
feat(MyKSuite): Add first chip components
Browse files Browse the repository at this point in the history
feat(MyKSuite): Fix chips
  • Loading branch information
FabianDevel committed Jan 27, 2025
1 parent 2f99eb7 commit fade8f9
Showing 1 changed file with 75 additions and 0 deletions.
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 {}
}
}
}
}

0 comments on commit fade8f9

Please sign in to comment.