Skip to content

Commit

Permalink
chore : 리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
Gael-Android committed Jan 14, 2025
1 parent 88229d7 commit 127b8bc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 33 deletions.
15 changes: 8 additions & 7 deletions app/src/main/kotlin/com/yourssu/handy/demo/NavigationPreview.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,31 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.yourssu.handy.compose.BottomNavItem
import com.yourssu.handy.compose.Navigation
import com.yourssu.handy.compose.R
import com.yourssu.handy.compose.icons.HandyIcons
import com.yourssu.handy.compose.icons.filled.Home

@Preview(showBackground = true)
@Composable
fun NavigationPreview() {
val items = listOf(
BottomNavItem(
icon = R.drawable.home,
label = "Label"
icon = HandyIcons.Filled.Home,
label = null
),
BottomNavItem(
icon = R.drawable.home,
icon = HandyIcons.Filled.Home,
label = "Label"
),
BottomNavItem(
icon = R.drawable.home,
icon = HandyIcons.Filled.Home,
label = "Label"
),
BottomNavItem(
icon = R.drawable.home,
icon = HandyIcons.Filled.Home,
label = "Label"
),
BottomNavItem(
icon = R.drawable.home,
icon = HandyIcons.Filled.Home,
label = "Label"
),
)
Expand Down
42 changes: 16 additions & 26 deletions compose/src/main/kotlin/com/yourssu/handy/compose/Navigation.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.yourssu.handy.compose

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
Expand All @@ -9,19 +8,13 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.yourssu.handy.compose.foundation.HandyTypography

/**
* BottomNavItem : 하단 네비게이션 바의 아이템을 정의하는 데이터 클래스 입니다.
Expand All @@ -30,24 +23,24 @@ import androidx.compose.ui.unit.sp
* @param label 아이템의 라벨
*/
data class BottomNavItem(
val icon: Int,
val label: String
val icon: ImageVector,
val label: String?
)

/**
* BottomNavItem : 하단 네비게이션 바의 아이템 Composable 함수 입니다.
*
* @param item 하단 네비게이션 바의 아이템
* @param isSelected 선택되었는지 여부
* @param modifier Modifier
* @param onClick 클릭 시 실행되는 함수
* @param modifier Modifier
*/
@Composable
private fun BottomNavItem(
item: BottomNavItem,
isSelected: Boolean,
modifier: Modifier = Modifier,
onClick: () -> Unit
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
val color =
if (isSelected) HandyTheme.colors.textBasicPrimary else HandyTheme.colors.textBasicDisabled
Expand All @@ -63,20 +56,17 @@ private fun BottomNavItem(
verticalArrangement = Arrangement.Center
) {
Icon(
painter = painterResource(id = item.icon),
contentDescription = item.label,
tint = color,
modifier = Modifier.size(24.dp)
item.icon,
iconSize = IconSize.M,
)

Text(
text = item.label,
fontSize = 11.dp,
lineHeight = 16.dp,
fontWeight = FontWeight(400),
color = color,
textAlign = TextAlign.Center
)
if (item.label != null) {
Text(
text = item.label,
style = HandyTypography.C1Rg11,
color = color
)
}
}
}

Expand Down

0 comments on commit 127b8bc

Please sign in to comment.