Skip to content

Commit e67ee75

Browse files
committed
feat: make social icons bouncy
1 parent 291878d commit e67ee75

File tree

1 file changed

+75
-30
lines changed

1 file changed

+75
-30
lines changed

composeApp/src/wasmJsMain/kotlin/org/nsh07/nsh07/ui/homeScreen/HomeScreenContent.kt

Lines changed: 75 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.nsh07.nsh07.ui.homeScreen
22

33
import androidx.compose.foundation.clickable
4+
import androidx.compose.foundation.interaction.MutableInteractionSource
45
import androidx.compose.foundation.layout.*
56
import androidx.compose.foundation.lazy.LazyListScope
67
import androidx.compose.foundation.lazy.items
@@ -9,6 +10,7 @@ import androidx.compose.material3.*
910
import androidx.compose.material3.MaterialTheme.colorScheme
1011
import androidx.compose.material3.MaterialTheme.typography
1112
import androidx.compose.runtime.Composable
13+
import androidx.compose.runtime.remember
1214
import androidx.compose.ui.Alignment
1315
import androidx.compose.ui.Modifier
1416
import androidx.compose.ui.platform.LocalUriHandler
@@ -45,41 +47,84 @@ fun NameAndDesc(horizontalPadding: Dp = 0.dp) {
4547
)
4648
}
4749

50+
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
4851
@Composable
4952
fun SocialIcons(modifier: Modifier = Modifier) {
5053
val uriHandler = LocalUriHandler.current
51-
Row(
52-
verticalAlignment = Alignment.CenterVertically,
54+
val interactionSources = remember { List(4) { MutableInteractionSource() } }
55+
ButtonGroup(
56+
overflowIndicator = {},
57+
horizontalArrangement = Arrangement.Start,
5358
modifier = modifier
5459
) {
55-
IconButton(onClick = { uriHandler.openUri("https://github.com/nsh07") }) {
56-
Icon(
57-
painterResource(Res.drawable.github),
58-
contentDescription = null,
59-
modifier = Modifier.size(24.dp)
60-
)
61-
}
62-
IconButton(onClick = { uriHandler.openUri("https://gitlab.com/nsh07") }) {
63-
Icon(
64-
painterResource(Res.drawable.gitlab),
65-
contentDescription = null,
66-
modifier = Modifier.size(24.dp)
67-
)
68-
}
69-
IconButton(onClick = { uriHandler.openUri("https://www.linkedin.com/in/nsh07/") }) {
70-
Icon(
71-
painterResource(Res.drawable.linkedin),
72-
contentDescription = null,
73-
modifier = Modifier.size(24.dp)
74-
)
75-
}
76-
IconButton(onClick = { uriHandler.openUri("mailto:[email protected]") }) {
77-
Icon(
78-
painterResource(Res.drawable.email),
79-
contentDescription = null,
80-
modifier = Modifier.size(24.dp)
81-
)
82-
}
60+
customItem(
61+
buttonGroupContent = {
62+
IconButton(
63+
onClick = { uriHandler.openUri("https://github.com/nsh07") },
64+
interactionSource = interactionSources[0],
65+
shapes = IconButtonDefaults.shapes(),
66+
modifier = Modifier.width(52.dp).animateWidth(interactionSources[0])
67+
) {
68+
Icon(
69+
painterResource(Res.drawable.github),
70+
contentDescription = null,
71+
modifier = Modifier.size(24.dp)
72+
)
73+
}
74+
},
75+
menuContent = {}
76+
)
77+
customItem(
78+
buttonGroupContent = {
79+
IconButton(
80+
onClick = { uriHandler.openUri("https://gitlab.com/nsh07") },
81+
interactionSource = interactionSources[1],
82+
shapes = IconButtonDefaults.shapes(),
83+
modifier = Modifier.width(52.dp).animateWidth(interactionSources[1])
84+
) {
85+
Icon(
86+
painterResource(Res.drawable.gitlab),
87+
contentDescription = null,
88+
modifier = Modifier.size(24.dp)
89+
)
90+
}
91+
},
92+
menuContent = {}
93+
)
94+
customItem(
95+
buttonGroupContent = {
96+
IconButton(
97+
onClick = { uriHandler.openUri("https://www.linkedin.com/in/nsh07/") },
98+
interactionSource = interactionSources[2],
99+
shapes = IconButtonDefaults.shapes(),
100+
modifier = Modifier.width(52.dp).animateWidth(interactionSources[2])
101+
) {
102+
Icon(
103+
painterResource(Res.drawable.linkedin),
104+
contentDescription = null,
105+
modifier = Modifier.size(24.dp)
106+
)
107+
}
108+
},
109+
menuContent = {}
110+
)
111+
customItem(
112+
buttonGroupContent = {
113+
IconButton(
114+
onClick = { uriHandler.openUri("mailto:[email protected]") },
115+
interactionSource = interactionSources[3],
116+
shapes = IconButtonDefaults.shapes(),
117+
modifier = Modifier.width(52.dp).animateWidth(interactionSources[3])
118+
) {
119+
Icon(
120+
painterResource(Res.drawable.email),
121+
contentDescription = null,
122+
modifier = Modifier.size(24.dp)
123+
)
124+
}
125+
},
126+
menuContent = {}
127+
)
83128
}
84129
}
85130

0 commit comments

Comments
 (0)