Skip to content

Commit

Permalink
feature #866: feat CircleShapeBorderButton
Browse files Browse the repository at this point in the history
  • Loading branch information
chattymin committed Sep 23, 2024
1 parent a092ec3 commit 38df657
Showing 1 changed file with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.sopt.official.feature.fortune.component

import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import org.sopt.official.designsystem.SoptTheme

@Composable
fun CircleShapeBorderButton(
content: @Composable BoxScope.() -> Unit,
modifier: Modifier = Modifier,
borderWidth: Dp = 1.dp,
borderColor: Color = SoptTheme.colors.primary,
contentAlignment: Alignment = Alignment.Center,
onClick: () -> Unit = {},
) {
Box(
modifier = modifier
.border(
width = borderWidth,
color = borderColor,
shape = CircleShape
)
.clickable(onClick = onClick),
contentAlignment = contentAlignment
) {
content()
}
}

@Preview
@Composable
fun RoundedCornerButtonPreview() {
SoptTheme {
CircleShapeBorderButton(
content = {
Text(
text = "홈으로 돌아가기",
style = SoptTheme.typography.label18SB,
color = SoptTheme.colors.onBackground,
modifier = Modifier.padding(horizontal = 20.dp, vertical = 12.dp)
)
}
) { }
}
}

0 comments on commit 38df657

Please sign in to comment.