Skip to content

Commit

Permalink
Merge pull request #45 from team-haribo/feature/44-publishing-student…
Browse files Browse the repository at this point in the history
…-management

🔀 :: (#44) - publishing student management
  • Loading branch information
diejdkll authored Feb 11, 2024
2 parents 792dd2c + bde345c commit 5af08ea
Show file tree
Hide file tree
Showing 18 changed files with 702 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import com.goms.main.navigation.mainScreen
import com.goms.main.navigation.navigateToLateList
import com.goms.main.navigation.navigateToMain
import com.goms.main.navigation.navigateToOutingStatus
import com.goms.main.navigation.navigateToStudentManagement
import com.goms.main.navigation.outingStatusScreen
import com.goms.main.navigation.studentManagementScreen
import com.goms.sign_up.navigation.navigateToNumber
import com.goms.sign_up.navigation.navigateToPassword
import com.goms.sign_up.navigation.navigateToSignUp
Expand Down Expand Up @@ -63,7 +65,8 @@ fun GomsNavHost(
mainScreen(
viewModelStoreOwner = mainViewModelStoreOwner,
onOutingStatusClick = navController::navigateToOutingStatus,
onLateListClick = navController::navigateToLateList
onLateListClick = navController::navigateToLateList,
onStudentManagementClick = navController::navigateToStudentManagement
)
outingStatusScreen(
viewModelStoreOwner = mainViewModelStoreOwner,
Expand All @@ -73,5 +76,9 @@ fun GomsNavHost(
viewModelStoreOwner = mainViewModelStoreOwner,
onBackClick = navController::popBackStack
)
studentManagementScreen(
viewModelStoreOwner = mainViewModelStoreOwner,
onBackClick = navController::popBackStack
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
package com.goms.design_system.component.bottomsheet

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import com.goms.design_system.component.button.AdminBottomSheetButton
import com.goms.design_system.theme.GomsTheme

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MultipleSelectorBottomSheet(
modifier: Modifier,
title: String,
subTitle1: String,
list1: List<String>,
selected1: String,
itemChange1: (String) -> Unit,
subTitle2: String,
list2: List<String>,
selected2: String,
itemChange2: (String) -> Unit,
subTitle3: String,
list3: List<String>,
selected3: String,
itemChange3: (String) -> Unit,
closeSheet: () -> Unit
) {
var componentWidth by remember { mutableStateOf( 0.dp ) }
val density = LocalDensity.current

val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)

GomsTheme { colors, typography ->
ModalBottomSheet(
onDismissRequest = { closeSheet() },
sheetState = sheetState,
shape = RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp),
containerColor = colors.G1
) {
Column(
modifier = modifier
.fillMaxWidth()
.padding(start = 20.dp, end = 20.dp, bottom = 16.dp)
.onGloballyPositioned {
componentWidth = with(density) {
it.size.width.toDp()
}
},
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
BottomSheetHeader(
modifier = Modifier,
title = title,
closeSheet = closeSheet
)
Text(
text = subTitle1,
style = typography.titleSmall,
fontWeight = FontWeight.SemiBold,
color = colors.WHITE
)
LazyRow(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
items(list1.size) {
AdminBottomSheetButton(
modifier = Modifier.widthIn((componentWidth - 16.dp * list1.lastIndex) / list1.size),
text = list1[it],
selected = selected1 == list1[it]
) {
itemChange1(list1[it])
}
}
}
Spacer(modifier = Modifier.height(8.dp))
Text(
text = subTitle2,
style = typography.titleSmall,
fontWeight = FontWeight.SemiBold,
color = colors.WHITE
)
LazyRow(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
items(list2.size) {
AdminBottomSheetButton(
modifier = Modifier.widthIn((componentWidth - 16.dp * list2.lastIndex) / list2.size),
text = list2[it],
selected = selected2 == list2[it]
) {
itemChange2(list2[it])
}
}
}
Spacer(modifier = Modifier.height(8.dp))
Text(
text = subTitle3,
style = typography.titleSmall,
fontWeight = FontWeight.SemiBold,
color = colors.WHITE
)
LazyRow(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
items(list3.size) {
AdminBottomSheetButton(
modifier = Modifier.widthIn((componentWidth - 16.dp * list3.lastIndex) / list3.size),
text = list3[it],
selected = selected3 == list3[it]
) {
itemChange3(list3[it])
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
package com.goms.design_system.component.bottomsheet

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.shape.RoundedCornerShape
Expand All @@ -22,15 +16,13 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import com.goms.design_system.component.button.AdminBottomSheetButton
import com.goms.design_system.component.button.BottomSheetButton
import com.goms.design_system.component.modifier.gomsClickable
import com.goms.design_system.icon.CloseIcon
import com.goms.design_system.theme.GomsTheme

@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -87,4 +79,68 @@ fun SelectorBottomSheet(
}
}
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun AdminSelectorBottomSheet(
modifier: Modifier,
title: String,
subTitle: String,
list: List<String>,
selected: String,
itemChange: (String) -> Unit,
closeSheet: () -> Unit
) {
var componentWidth by remember { mutableStateOf( 0.dp ) }
val density = LocalDensity.current

val sheetState = rememberModalBottomSheetState()

GomsTheme { colors, typography ->
ModalBottomSheet(
onDismissRequest = { closeSheet() },
sheetState = sheetState,
shape = RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp),
containerColor = colors.G1
) {
Column(
modifier = modifier
.fillMaxWidth()
.padding(start = 20.dp, end = 20.dp, bottom = 16.dp)
.onGloballyPositioned {
componentWidth = with(density) {
it.size.width.toDp()
}
},
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
BottomSheetHeader(
modifier = Modifier,
title = title,
closeSheet = closeSheet
)
Text(
text = subTitle,
style = typography.titleSmall,
fontWeight = FontWeight.SemiBold,
color = colors.WHITE
)
LazyRow(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
items(list.size) {
AdminBottomSheetButton(
modifier = Modifier.widthIn((componentWidth - 16.dp * list.lastIndex) / list.size),
text = list[it],
selected = selected == list[it]
) {
itemChange(list[it])
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,37 @@ fun BottomSheetButton(
}
}

@Composable
fun AdminBottomSheetButton(
modifier: Modifier = Modifier,
text: String,
selected: Boolean,
onClick: () -> Unit
) {
GomsTheme { colors, typography ->
Box(
modifier = modifier
.height(56.dp)
.clip(RoundedCornerShape(12.dp))
.background(if (selected) colors.A7.copy(0.25f) else colors.G1)
.border(
width = 1.dp,
color = if (selected) Color.Transparent else colors.WHITE.copy(0.15f),
shape = RoundedCornerShape(12.dp)
)
.gomsClickable { onClick() }
) {
Text(
modifier = Modifier.align(Alignment.Center),
text = text,
style = typography.buttonMedium,
fontWeight = FontWeight.SemiBold,
color = if (selected) colors.A7 else colors.G7
)
}
}
}

@Composable
@Preview(showBackground = true)
fun GomsButtonPreview() {
Expand Down Expand Up @@ -157,5 +188,10 @@ fun GomsButtonPreview() {
text = "버튼",
selected = false,
) {}
AdminBottomSheetButton(
modifier = Modifier.fillMaxWidth(),
text = "버튼",
selected = true,
) {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,15 @@ fun DeleteIcon(
contentDescription = "Delete Icon",
modifier = modifier
)
}

@Composable
fun WriteIcon(
modifier: Modifier = Modifier
) {
Image(
painter = painterResource(id = R.drawable.ic_write),
contentDescription = "Write Icon",
modifier = modifier
)
}
9 changes: 9 additions & 0 deletions core/design-system/src/main/res/drawable/ic_write.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M15.891,3.048C17.288,1.651 19.554,1.651 20.952,3.048C22.349,4.445 22.349,6.711 20.952,8.109L20.06,9.001L15,3.94L15.891,3.048ZM13.939,5.001L3.941,15C3.535,15.406 3.249,15.917 3.116,16.476L2.02,21.078C1.96,21.331 2.036,21.598 2.22,21.782C2.404,21.966 2.67,22.041 2.924,21.981L7.525,20.885C8.084,20.752 8.595,20.467 9.002,20.06L19,10.061L13.939,5.001Z"
android:fillColor="#2573F3"/>
</vector>
8 changes: 8 additions & 0 deletions core/model/src/main/java/com/goms/model/enum/Class.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.goms.model.enum

enum class Class(val value: String, val enum: Int) {
FIRST("1반", 1),
SECOND("2반", 2),
THIRD("3반", 3),
FOURTH("4반", 4)
}
7 changes: 7 additions & 0 deletions core/model/src/main/java/com/goms/model/enum/Grade.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.goms.model.enum

enum class Grade(val value: String, val enum: Int) {
FIRST_GRADE("1학년", 1),
SECOND_GRADE("2학년", 2),
THIRD_GRADE("3학년", 3)
}
7 changes: 7 additions & 0 deletions core/model/src/main/java/com/goms/model/enum/Status.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.goms.model.enum

enum class Status(val value: String) {
ROLE_STUDENT("학생"),
ROLE_STUDENT_COUNCIL("학생회"),
BLACK_LIST("외출 금지")
}
Loading

0 comments on commit 5af08ea

Please sign in to comment.