Skip to content

Commit e1ce0b4

Browse files
committed
feat: icon visibility
1 parent 239370e commit e1ce0b4

File tree

1 file changed

+10
-9
lines changed
  • app/src/main/java/to/bitkit/ui/components

1 file changed

+10
-9
lines changed

app/src/main/java/to/bitkit/ui/components/Tag.kt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package to.bitkit.ui.components
22

3-
import to.bitkit.R
43
import androidx.compose.foundation.border
54
import androidx.compose.foundation.clickable
65
import androidx.compose.foundation.layout.Arrangement
76
import androidx.compose.foundation.layout.Column
87
import androidx.compose.foundation.layout.ExperimentalLayoutApi
9-
import androidx.compose.foundation.layout.FlowRow
108
import androidx.compose.foundation.layout.Row
119
import androidx.compose.foundation.layout.padding
1210
import androidx.compose.foundation.layout.wrapContentWidth
@@ -21,6 +19,7 @@ import androidx.compose.ui.res.painterResource
2119
import androidx.compose.ui.text.font.FontWeight
2220
import androidx.compose.ui.tooling.preview.Preview
2321
import androidx.compose.ui.unit.dp
22+
import to.bitkit.R
2423
import to.bitkit.ui.theme.AppThemeSurface
2524
import to.bitkit.ui.theme.Colors
2625

@@ -54,11 +53,13 @@ fun TagButton(
5453
fontWeight = FontWeight.Medium,
5554
)
5655

57-
Icon(
58-
painter = painterResource(R.drawable.ic_x),
59-
contentDescription = null,
60-
tint = Colors.White
61-
)
56+
if (displayIconClose) {
57+
Icon(
58+
painter = painterResource(R.drawable.ic_x),
59+
contentDescription = null,
60+
tint = Colors.White
61+
)
62+
}
6263
}
6364
}
6465

@@ -71,8 +72,8 @@ private fun Preview() {
7172
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
7273
TagButton("Selected", isSelected = true, onClick = {})
7374
TagButton("Not Selected", isSelected = false, onClick = {})
74-
TagButton("Selected With icon close", isSelected = true, onClick = {})
75-
TagButton("Not Selected With icon close", isSelected = false, onClick = {})
75+
TagButton("Selected With icon close", displayIconClose = true, isSelected = true, onClick = {})
76+
TagButton("Not Selected With icon close", displayIconClose = true, isSelected = false, onClick = {})
7677
}
7778
}
7879
}

0 commit comments

Comments
 (0)