Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FloatingActionButton 구현 #12

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

FloatingActionButton 구현 #12

wants to merge 31 commits into from

Conversation

kangyuri1114
Copy link
Member

작업내용

FAB 구현했습니다

image

material3의 FAB은 FAB 컴포넌트는 버튼처럼 구현 후 Scaffold의 속성(floatingActionButton = )을 이용하여 화면 전체에서 Bottom 위치에 사용할 수 있는데, 지금 Handy는 Scaffold가 없어서 Scaffold도 직접 구현할지 아니라면 어떻게 사용해야 할지 고민입니다.

…ein/FAB

# Conflicts:
#	compose/src/main/kotlin/com/yourssu/handy/compose/Surface.kt
Copy link
Member

@leeeyubin leeeyubin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다! 저도 스낵바를 만들면서 Scaffold를 구현해야되나 고민이 많았는데 이 부분은 회의 때 같이 얘기해보아요!

Comment on lines +56 to +58
val contentColor by containerColor.contentColor(enabled)
val borderColor = containerColor.borderColor()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위 변수에는 by 넣어주고 아래에는 안 넣어준 이유가 있나용..?

Comment on lines +61 to +63
Surface(
onClick = onClick,
modifier = modifier.semantics { role = Role.Button },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semantics를 사용한 이유는 버튼임을 알리기 위함인가요.....??

Comment on lines +42 to +52
@Composable
fun FloatingActionButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
shape: Shape = CircleShape,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
icon: ImageVector = HandyIcons.Line.ExternalLink,
sizeType: FloatingActionButtonSize = FloatingActionButtonSize.S,
floatingActionButtonType: FloatingActionButtonType = FloatingActionButtonType.Primary,
) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엇 그리구 컴포넌트에 대한 설명이 빠진 것 같아요..!

Comment on lines +96 to +106
private fun boxButtonSizeStateBySize(
size: FloatingActionButtonSize,
): FloatingActionButtonSizeState = when (size) {
FloatingActionButtonSize.S -> FloatingActionButtonSizeState(
containerSize = FloatingActionButtonSize.S,
)

FloatingActionButtonSize.L -> FloatingActionButtonSizeState(
containerSize = FloatingActionButtonSize.L,
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 따로 함수로 빼신 이유가 있을까요?

아마 YDS를 참고해서 만드신 것 같은데, YDS에서는 이 구조가 최선이었어서.. 여기서는 딱히 이렇게 해야 할 이유가 없어보여요.
그 이유라는 건 별거 없긴 한데 말씀드린 적이 없는 것 같아서 다음 핸디 회의 때 말씀드릴게요.

더 간단하게, 직관적으로 상태를 관리/표현할 방법은 없는지 고민해주시면 좋을 것 같습니다!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 구현하면서 똑같은 생각이 들긴했었는데요 ..

사실 YDS, Mateiral 에서의 디자인 시스템 보다 핸디가 속성과 옵션이 적어서 대부분 함수화를 하지 않는 것이 더 직관적이긴 했어요
그런데 최종적으로 함수화를 한 이유는 확장 가능성을 생각하긴 했었습니다..!
추후에 사이즈나 종류가 추가된다거나 같은 부분이요,,
FloatingActionButtonSizeState도 마찬가지로 오히려 data class를 생성하면서 조금 복잡한 구조를 가지게 되긴 해서

상태가 적지만 확장가능성이 있는.. Handy상태 관리에 대해서 좀 더 고민해보겠습니당

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants