-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #866: feat CircleShapeBorderButton
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...tune/src/main/java/org/sopt/official/feature/fortune/component/CircleShapeBorderButton.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
) | ||
} | ||
) { } | ||
} | ||
} |