1+ package com.flipcash.app.core.ui
2+
3+ import androidx.compose.foundation.Image
4+ import androidx.compose.foundation.layout.Arrangement
5+ import androidx.compose.foundation.layout.Box
6+ import androidx.compose.foundation.layout.Row
7+ import androidx.compose.foundation.layout.fillMaxWidth
8+ import androidx.compose.foundation.layout.width
9+ import androidx.compose.foundation.layout.wrapContentHeight
10+ import androidx.compose.foundation.shape.CircleShape
11+ import androidx.compose.runtime.Composable
12+ import androidx.compose.ui.Alignment
13+ import androidx.compose.ui.Modifier
14+ import androidx.compose.ui.draw.clip
15+ import androidx.compose.ui.res.painterResource
16+ import com.getcode.opencode.model.financial.Token
17+ import com.getcode.theme.CodeTheme
18+ import com.getcode.ui.core.R
19+ import com.getcode.ui.core.debugBounds
20+ import com.getcode.ui.core.rememberedClickable
21+
22+ @Composable
23+ fun TokenSelectionPill (token : Token ? , onClick : () -> Unit ) {
24+ Box (
25+ modifier = Modifier
26+ .fillMaxWidth()
27+ .wrapContentHeight(),
28+ contentAlignment = Alignment .Center
29+ ) {
30+ Row (
31+ modifier = Modifier
32+ .clip(CircleShape )
33+ .rememberedClickable { onClick() },
34+ verticalAlignment = Alignment .CenterVertically ,
35+ horizontalArrangement = Arrangement .spacedBy(
36+ space = CodeTheme .dimens.grid.x1,
37+ alignment = Alignment .CenterHorizontally
38+ )
39+ ) {
40+ token?.let {
41+ TokenIconWithName (
42+ token = token,
43+ imageSize = CodeTheme .dimens.staticGrid.x5,
44+ spacing = CodeTheme .dimens.grid.x1,
45+ )
46+
47+ Image (
48+ modifier = Modifier
49+ .width(CodeTheme .dimens.grid.x4),
50+ painter = painterResource(R .drawable.ic_dropdown),
51+ contentDescription = " "
52+ )
53+ }
54+
55+ }
56+ }
57+ }
58+
59+ @Composable
60+ fun TokenSelectionPill (
61+ tokenName : String ,
62+ tokenImageUrl : String? ,
63+ tokenSymbol : String ,
64+ onClick : () -> Unit
65+ ) {
66+ Box (
67+ modifier = Modifier
68+ .fillMaxWidth()
69+ .wrapContentHeight(),
70+ contentAlignment = Alignment .Center
71+ ) {
72+ Row (
73+ modifier = Modifier
74+ .clip(CircleShape )
75+ .rememberedClickable { onClick() },
76+ verticalAlignment = Alignment .CenterVertically ,
77+ horizontalArrangement = Arrangement .spacedBy(
78+ space = CodeTheme .dimens.grid.x1,
79+ alignment = Alignment .CenterHorizontally
80+ )
81+ ) {
82+ TokenIconWithName (
83+ tokenName = tokenName,
84+ tokenImageUrl = tokenImageUrl,
85+ tokenSymbol = tokenSymbol,
86+ imageSize = CodeTheme .dimens.staticGrid.x5,
87+ spacing = CodeTheme .dimens.grid.x1,
88+ )
89+
90+ Image (
91+ modifier = Modifier
92+ .width(CodeTheme .dimens.grid.x4),
93+ painter = painterResource(R .drawable.ic_dropdown),
94+ contentDescription = " "
95+ )
96+ }
97+ }
98+ }
0 commit comments