File tree Expand file tree Collapse file tree 4 files changed +17
-15
lines changed
demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo
commonMain/kotlin/com/huanshankeji/compose/material3
composeUiMain/kotlin/com/huanshankeji/compose/material3
jsMain/kotlin/com/huanshankeji/compose/material3 Expand file tree Collapse file tree 4 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -306,12 +306,9 @@ fun Material3(/*modifier: Modifier = Modifier*/
306306
307307 // Badge
308308 Row {
309- Badge {
310- TaglessText (" 3" )
311- }
312- Badge {
313- TaglessText (" New" )
314- }
309+ // not shown at the right position
310+ Badge (content = " 3" )
311+ Badge (content = " New" )
315312 }
316313
317314 // Chips - showing all 4 types as per M3 design
Original file line number Diff line number Diff line change @@ -11,8 +11,13 @@ import com.huanshankeji.compose.ui.Modifier
1111 * @see <a href="https://m3.material.io/components/badge/overview">Material Design badge</a>
1212 * @see androidx.compose.material3.Badge
1313 */
14+ @Deprecated(
15+ " This component is not displayed correctly on JS DOM. " +
16+ " It seems to be displayed with absolute position. " +
17+ " See https://github.com/material-components/material-web/blob/main/labs/badge/internal/_badge.scss#L40."
18+ )
1419@Composable
1520expect fun Badge (
1621 modifier : Modifier = Modifier ,
17- content : @Composable (() -> Unit ) ? = null
22+ content : String
1823)
Original file line number Diff line number Diff line change 11package com.huanshankeji.compose.material3
22
3+ import androidx.compose.material3.Text
34import androidx.compose.runtime.Composable
45import com.huanshankeji.compose.ui.Modifier
56
67@Composable
78actual fun Badge (
89 modifier : Modifier ,
9- content : @Composable (() -> Unit ) ?
10+ content : String
1011) =
1112 androidx.compose.material3.Badge (
12- modifier.platformModifier,
13- content = content?.let { { it() } }
14- )
13+ modifier.platformModifier
14+ ) { Text (content) }
Original file line number Diff line number Diff line change 11package com.huanshankeji.compose.material3
22
33import androidx.compose.runtime.Composable
4- import com.huanshankeji.compose.html.material3.MdBadge
54import com.huanshankeji.compose.html.material3.MaterialWebLabsApi
5+ import com.huanshankeji.compose.html.material3.MdBadge
66import com.huanshankeji.compose.ui.Modifier
77import com.huanshankeji.compose.ui.toAttrs
88
99@MaterialWebLabsApi
1010@Composable
1111actual fun Badge (
1212 modifier : Modifier ,
13- content : @Composable (() -> Unit ) ?
13+ content : String
1414) =
1515 MdBadge (
16- attrs = modifier.toAttrs() ,
17- content = content?. let { { it() } }
16+ content ,
17+ modifier.toAttrs()
1818 )
You can’t perform that action at this time.
0 commit comments