-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from SOPT-all/feat-#41-grouplist-ui
[Feat/#41] "채우기 뷰" UI를 구현합니다.
- Loading branch information
Showing
9 changed files
with
592 additions
and
51 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -20,5 +20,8 @@ enum class GroupCategoryType( | |
), | ||
OTHERS( | ||
description = "기타" | ||
), | ||
ALL( | ||
description = "전체" | ||
) | ||
} |
92 changes: 92 additions & 0 deletions
92
app/src/main/java/com/sopt/gongbaek/presentation/ui/grouplist/component/CategoryBar.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,92 @@ | ||
package com.sopt.gongbaek.presentation.ui.grouplist.component | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.lazy.LazyRow | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
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 com.sopt.gongbaek.domain.type.GroupCategoryType | ||
import com.sopt.gongbaek.presentation.util.extension.clickableWithoutRipple | ||
import com.sopt.gongbaek.ui.theme.GONGBAEKTheme | ||
import com.sopt.gongbaek.ui.theme.GongBaekTheme | ||
|
||
@Composable | ||
fun CategoryBar( | ||
modifier: Modifier = Modifier, | ||
selectedIndex: Int = 0, | ||
onIndexSelected: (Int) -> Unit = {} | ||
) { | ||
val contentLists = listOf( | ||
GroupCategoryType.ALL.description, | ||
GroupCategoryType.STUDY.description, | ||
GroupCategoryType.DINING.description, | ||
GroupCategoryType.EXERCISE.description, | ||
GroupCategoryType.PLAYING.description, | ||
GroupCategoryType.NETWORKING.description, | ||
GroupCategoryType.OTHERS.description | ||
) | ||
|
||
LazyRow( | ||
modifier = modifier | ||
.fillMaxWidth(), | ||
horizontalArrangement = Arrangement.spacedBy(9.dp), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
items(contentLists.size) { index -> | ||
if (index == 0) { | ||
Spacer(Modifier.width(16.dp)) | ||
} | ||
|
||
Box( | ||
modifier = Modifier | ||
.border( | ||
width = 1.dp, | ||
color = if (selectedIndex == index) Color.Transparent else GongBaekTheme.colors.gray02, | ||
shape = RoundedCornerShape(4.dp) | ||
) | ||
.background( | ||
color = if (selectedIndex == index) GongBaekTheme.colors.gray09 else GongBaekTheme.colors.white, | ||
shape = RoundedCornerShape(4.dp) | ||
) | ||
.padding( | ||
horizontal = 12.dp, | ||
vertical = 6.dp | ||
) | ||
.clickableWithoutRipple { | ||
onIndexSelected(index) | ||
}, | ||
contentAlignment = Alignment.Center | ||
) { | ||
Text( | ||
text = contentLists[index], | ||
style = GongBaekTheme.typography.caption1.m13, | ||
color = if (selectedIndex == index) GongBaekTheme.colors.white else GongBaekTheme.colors.gray06 | ||
) | ||
} | ||
|
||
if (index == contentLists.size - 1) { | ||
Spacer(Modifier.width(16.dp)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun PreviewCategoryBar() { | ||
GONGBAEKTheme { | ||
CategoryBar() | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...n/java/com/sopt/gongbaek/presentation/ui/grouplist/component/CycleBottomSheetPresenter.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,51 @@ | ||
package com.sopt.gongbaek.presentation.ui.grouplist.component | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Icon | ||
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.vector.ImageVector | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.res.vectorResource | ||
import androidx.compose.ui.unit.dp | ||
import com.sopt.gongbaek.R | ||
import com.sopt.gongbaek.presentation.util.extension.clickableWithoutRipple | ||
import com.sopt.gongbaek.ui.theme.GongBaekTheme | ||
|
||
@Composable | ||
fun CycleBottomSheetPresenter( | ||
modifier: Modifier = Modifier, | ||
onClick: () -> Unit = {} | ||
) { | ||
Row( | ||
modifier = modifier | ||
.background( | ||
color = GongBaekTheme.colors.gray01, | ||
shape = RoundedCornerShape(20.dp) | ||
) | ||
.padding(horizontal = 12.dp, vertical = 6.dp) | ||
.clickableWithoutRipple { | ||
onClick() | ||
}, | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Text( | ||
text = stringResource(R.string.grouplist_cycle_all), | ||
color = GongBaekTheme.colors.gray10, | ||
style = GongBaekTheme.typography.caption1.m13 | ||
) | ||
Spacer(Modifier.width(6.dp)) | ||
|
||
Icon( | ||
imageVector = ImageVector.vectorResource(R.drawable.ic_arrow_bottom_18), | ||
contentDescription = null | ||
) | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
app/src/main/java/com/sopt/gongbaek/presentation/ui/grouplist/component/DayOfWeekBar.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,83 @@ | ||
package com.sopt.gongbaek.presentation.ui.grouplist.component | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalConfiguration | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.sopt.gongbaek.domain.type.DayOfWeekType | ||
import com.sopt.gongbaek.presentation.util.extension.clickableWithoutRipple | ||
import com.sopt.gongbaek.ui.theme.GONGBAEKTheme | ||
import com.sopt.gongbaek.ui.theme.GongBaekTheme | ||
|
||
@Composable | ||
fun DayOfWeekBar( | ||
modifier: Modifier = Modifier, | ||
selectedIndex: Int = 0, | ||
onIndexSelected: (Int) -> Unit = {} | ||
) { | ||
val contentLists = listOf( | ||
DayOfWeekType.ALL.description, | ||
DayOfWeekType.MON.description, | ||
DayOfWeekType.TUE.description, | ||
DayOfWeekType.WED.description, | ||
DayOfWeekType.THU.description, | ||
DayOfWeekType.FRI.description | ||
) | ||
|
||
Row( | ||
modifier = modifier | ||
.padding(horizontal = 16.dp) | ||
.fillMaxWidth() | ||
.background( | ||
color = GongBaekTheme.colors.gray01, | ||
shape = RoundedCornerShape(4.dp) | ||
) | ||
.padding(vertical = 2.dp, horizontal = 3.dp), | ||
horizontalArrangement = Arrangement.SpaceBetween, | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
contentLists.forEachIndexed { index, content -> | ||
Box( | ||
modifier = modifier | ||
.height((LocalConfiguration.current.screenHeightDp * 0.04f).dp) | ||
.background( | ||
color = if (selectedIndex == index) GongBaekTheme.colors.white else GongBaekTheme.colors.gray01, | ||
shape = RoundedCornerShape(2.dp) | ||
) | ||
.padding( | ||
horizontal = if (index == 0) 12.dp else 9.dp, | ||
vertical = 8.dp | ||
) | ||
.clickableWithoutRipple { | ||
// onIndexSelected(index) | ||
}, | ||
contentAlignment = Alignment.Center | ||
) { | ||
Text( | ||
text = content, | ||
color = if (selectedIndex == index) GongBaekTheme.colors.mainOrange else GongBaekTheme.colors.gray06, | ||
style = GongBaekTheme.typography.caption1.sb13 | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun PreviewDayOfWeekBar() { | ||
GONGBAEKTheme { | ||
DayOfWeekBar() | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
...c/main/java/com/sopt/gongbaek/presentation/ui/grouplist/component/GongBaekToggleButton.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,80 @@ | ||
package com.sopt.gongbaek.presentation.ui.grouplist.component | ||
|
||
import androidx.compose.animation.core.animateFloatAsState | ||
import androidx.compose.animation.core.tween | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.aspectRatio | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.offset | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalConfiguration | ||
import androidx.compose.ui.platform.LocalDensity | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.IntOffset | ||
import androidx.compose.ui.unit.dp | ||
import com.sopt.gongbaek.R | ||
import com.sopt.gongbaek.presentation.util.extension.clickableWithoutRipple | ||
import com.sopt.gongbaek.ui.theme.GongBaekTheme | ||
import kotlin.math.roundToInt | ||
|
||
@Composable | ||
fun GongBaekToggleButton( | ||
checkedState: Boolean, | ||
onClick: () -> Unit, | ||
modifier: Modifier = Modifier | ||
) { | ||
val density = LocalDensity.current | ||
val minBound = with(density) { 0.dp.toPx() } | ||
val maxBound = with(density) { (LocalConfiguration.current.screenWidthDp * 0.06f).dp.toPx() } | ||
val state by animateFloatAsState( | ||
targetValue = if (checkedState) maxBound else minBound, | ||
animationSpec = tween(durationMillis = 300) | ||
) | ||
Row( | ||
modifier = modifier, | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Text( | ||
text = stringResource(if (checkedState) R.string.grouplist_gongbaek_duplicate else R.string.grouplist_gongbaek_all), | ||
color = GongBaekTheme.colors.gray06, | ||
style = GongBaekTheme.typography.caption2.r12 | ||
) | ||
Spacer(Modifier.width(6.dp)) | ||
|
||
Box( | ||
modifier = modifier | ||
.aspectRatio(42f / 24f) | ||
.height((LocalConfiguration.current.screenHeightDp * 0.03f).dp) | ||
.background( | ||
color = if (checkedState) GongBaekTheme.colors.mainOrange else GongBaekTheme.colors.gray06, | ||
shape = RoundedCornerShape(20.dp) | ||
) | ||
.padding(3.5.dp) | ||
.clickableWithoutRipple { | ||
// onClick() | ||
} | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.offset { IntOffset(state.roundToInt(), 0) } | ||
.aspectRatio(1f / 1f) | ||
.height((LocalConfiguration.current.screenHeightDp * 0.02f).dp) | ||
.background( | ||
color = GongBaekTheme.colors.white, | ||
shape = CircleShape | ||
) | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.