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

공통 Compose 컴포넌트 구조 개선 #65

Merged
merged 6 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.goalpanzi.mission_mate.core.designsystem.theme.component
package com.goalpanzi.mission_mate.core.designsystem.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -127,4 +127,4 @@ fun AppTopBarNonePreview() {
}
}
)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.goalpanzi.mission_mate.feature.onboarding.component
package com.goalpanzi.mission_mate.core.designsystem.component

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
Expand All @@ -7,12 +7,10 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.text.TextStyle
Expand All @@ -24,7 +22,7 @@ import com.goalpanzi.mission_mate.core.designsystem.theme.ColorWhite_FFFFFFFF
import com.goalpanzi.mission_mate.core.designsystem.theme.MissionMateTypography

@Composable
fun OutlinedTextBox(
fun OutlinedTextChip(
text: String,
modifier: Modifier = Modifier,
borderStroke: BorderStroke = BorderStroke(1.dp, ColorOrange_FFFF5732),
Expand All @@ -48,7 +46,7 @@ fun OutlinedTextBox(
}

@Composable
fun OutlinedBox(
fun OutlinedChip(
modifier: Modifier = Modifier,
backgroundColor: Color = ColorGray1_FF404249,
borderStroke: BorderStroke = BorderStroke((0.5f).dp, ColorWhite_FFFFFFFF),
Expand All @@ -70,7 +68,7 @@ fun OutlinedBox(
@Preview
@Composable
private fun PreviewOutlinedBox() {
OutlinedBox {
OutlinedChip {
Text("test")
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.goalpanzi.mission_mate.feature.onboarding.component
package com.goalpanzi.mission_mate.core.designsystem.component

import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
Expand All @@ -21,4 +21,4 @@ fun StableImage (
contentScale = contentScale,
contentDescription = description
)
}
}
1 change: 1 addition & 0 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ dependencies {
implementation(libs.hilt.android)
ksp(libs.hilt.compiler)

implementation(project(":core:designsystem"))
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.goalpanzi.mission_mate.feature.onboarding.component
package com.goalpanzi.mission_mate.core.ui.component

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
Expand All @@ -32,7 +30,6 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorDisabled_FFB3B3B3
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorGray1_FF404249
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorGray3_FF727484
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorGray4_FFE5E5E5
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorGray5_FFF5F6F9
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorRed_FFFF5858
Expand Down Expand Up @@ -114,4 +111,4 @@ fun InvitationCodeTextField(

}
)
}
}
2 changes: 1 addition & 1 deletion feature/board/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ dependencies {
implementation(project(":core:domain:setting"))
implementation(project(":core:domain:mission"))
implementation(project(":core:domain:common"))

implementation(project(":core:ui"))
implementation(project(":feature:onboarding"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.goalpanzi.mission_mate.core.designsystem.theme.MissionMateTypography
import com.goalpanzi.mission_mate.feature.board.R
import com.goalpanzi.mission_mate.feature.board.model.BlockEventType
import com.goalpanzi.mission_mate.feature.board.model.BlockType
import com.goalpanzi.mission_mate.feature.onboarding.component.StableImage
import com.goalpanzi.mission_mate.core.designsystem.component.StableImage

@Composable
fun Block(
Expand Down Expand Up @@ -139,4 +139,4 @@ fun BlockImage(
)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.goalpanzi.mission_mate.core.designsystem.theme.MissionMateTypography
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionDetail
import com.goalpanzi.mission_mate.feature.board.R
import com.goalpanzi.mission_mate.feature.board.model.MissionState
import com.goalpanzi.mission_mate.feature.onboarding.component.StableImage
import com.goalpanzi.mission_mate.core.designsystem.component.StableImage
import com.goalpanzi.mission_mate.feature.onboarding.model.VerificationTimeType

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ import androidx.compose.ui.draw.paint
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.goalpanzi.mission_mate.core.designsystem.component.StableImage
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorGray1_FF404249
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorGray5_FFF5F6F9
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorOrange_FFFF5732
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorWhite_FFFFFFFF
import com.goalpanzi.mission_mate.core.designsystem.theme.MissionMateTypography
import com.goalpanzi.mission_mate.core.designsystem.theme.MissionmateTheme
import com.goalpanzi.mission_mate.core.designsystem.theme.OrangeGradient_FFFF5F3C_FFFFAE50
import com.goalpanzi.mission_mate.feature.board.model.CharacterUiModel
import com.goalpanzi.mission_mate.feature.board.model.MissionState
import com.goalpanzi.mission_mate.feature.board.model.UserStory

Expand All @@ -56,7 +60,6 @@ fun BoardTopStory(
items(userList) { userStory ->
UserStoryItem(
userStory = userStory,
missionState = missionState,
onClickStory = onClickStory
)
}
Expand All @@ -76,19 +79,18 @@ fun BoardTopStory(
@Composable
fun UserStoryItem(
userStory: UserStory,
missionState : MissionState,
onClickStory: (UserStory) -> Unit,
modifier: Modifier = Modifier,
onClickStory: (UserStory) -> Unit
) {
Box(
modifier = modifier
.height(98.dp)
.widthIn(min = 70.dp),
contentAlignment = Alignment.TopCenter
) {
Image(
painter = painterResource(id = userStory.characterUiModelType.imageId),
contentDescription = null,
StableImage(
drawableResId = userStory.characterUiModelType.imageId,
description = null,
modifier = Modifier
.padding(top = 8.dp)
.height(64.dp)
Expand All @@ -105,7 +107,7 @@ fun UserStoryItem(
} else {
Modifier
.border(3.dp, ColorWhite_FFFFFFFF, CircleShape)
.alpha(if(userStory.isMe) 1f else 0.5f)
.alpha(if (userStory.isMe) 1f else 0.5f)
}
)
.paint(
Expand Down Expand Up @@ -151,3 +153,81 @@ fun UserStoryItem(
}
}

@Preview
@Composable
private fun VerifiedUserStoryItemPreview() {
MissionmateTheme {
UserStoryItem(
userStory = UserStory(
nickname = "닉네임",
characterUiModelType = CharacterUiModel.CAT,
imageUrl = "",
isVerified = true,
verifiedAt = ""
),
onClickStory = {

}
)
}
}

@Preview
@Composable
private fun NotVerifiedUserStoryItemPreview() {
MissionmateTheme {
UserStoryItem(
userStory = UserStory(
nickname = "닉네임",
characterUiModelType = CharacterUiModel.CAT,
imageUrl = "",
isVerified = false,
verifiedAt = ""
),
onClickStory = {

}
)
}
}


@Preview
@Composable
private fun MyVerifiedUserStoryItemPreview() {
MissionmateTheme {
UserStoryItem(
userStory = UserStory(
nickname = "닉네임",
characterUiModelType = CharacterUiModel.CAT,
imageUrl = "",
isVerified = true,
verifiedAt = "",
isMe = true
),
onClickStory = {

}
)
}
}

@Preview
@Composable
private fun MyNotVerifiedUserStoryItemPreview() {
MissionmateTheme {
UserStoryItem(
userStory = UserStory(
nickname = "닉네임",
characterUiModelType = CharacterUiModel.CAT,
imageUrl = "",
isVerified = false,
verifiedAt = "",
isMe = true
),
onClickStory = {

}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorGray1_FF404249
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorWhite_FFFFFFFF
import com.goalpanzi.mission_mate.core.designsystem.theme.component.MissionMateTopAppBar
import com.goalpanzi.mission_mate.core.designsystem.theme.component.NavigationType
import com.goalpanzi.mission_mate.core.designsystem.component.MissionMateTopAppBar
import com.goalpanzi.mission_mate.core.designsystem.component.NavigationType
import com.goalpanzi.mission_mate.feature.board.R
import com.goalpanzi.mission_mate.feature.board.model.MissionState
import com.goalpanzi.mission_mate.feature.board.model.UserStory
import com.goalpanzi.mission_mate.feature.onboarding.component.StableImage
import com.goalpanzi.mission_mate.core.designsystem.component.StableImage


@SuppressLint("UnrememberedMutableInteractionSource")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
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.draw.clip
Expand All @@ -40,8 +35,8 @@ import com.goalpanzi.mission_mate.core.designsystem.theme.MissionMateTypography
import com.goalpanzi.mission_mate.feature.board.model.BoardPiece
import com.goalpanzi.mission_mate.feature.board.model.BoardPieceType
import com.goalpanzi.mission_mate.feature.board.util.PieceGenerator
import com.goalpanzi.mission_mate.feature.onboarding.component.OutlinedBox
import com.goalpanzi.mission_mate.feature.onboarding.component.StableImage
import com.goalpanzi.mission_mate.core.designsystem.component.OutlinedChip
import com.goalpanzi.mission_mate.core.designsystem.component.StableImage

@Composable
fun BoxScope.Piece(
Expand Down Expand Up @@ -151,7 +146,7 @@ fun PieceCountChip(
modifier: Modifier = Modifier,
textStyle : TextStyle = MissionMateTypography.body_md_bold
){
OutlinedBox(
OutlinedChip(
modifier = modifier
){
Row(
Expand All @@ -171,4 +166,4 @@ fun PieceCountChip(
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import com.goalpanzi.mission_mate.core.designsystem.theme.MissionMateTypography
import com.goalpanzi.mission_mate.core.domain.mission.model.BoardReward
import com.goalpanzi.mission_mate.feature.board.R
import com.goalpanzi.mission_mate.feature.board.model.toEventType
import com.goalpanzi.mission_mate.feature.onboarding.component.StableImage
import com.goalpanzi.mission_mate.core.designsystem.component.StableImage

@SuppressLint("UnrememberedMutableInteractionSource")
@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.goalpanzi.mission_mate.feature.board.component
package com.goalpanzi.mission_mate.feature.board.component.dialog

import android.content.ClipData
import android.content.ClipboardManager
Expand All @@ -25,7 +25,7 @@ import com.goalpanzi.mission_mate.core.designsystem.theme.ColorGray2_FF4F505C
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorOrange_FFFF5732
import com.goalpanzi.mission_mate.core.designsystem.theme.MissionMateTypography
import com.goalpanzi.mission_mate.feature.board.R
import com.goalpanzi.mission_mate.feature.onboarding.component.InvitationCodeTextField
import com.goalpanzi.mission_mate.core.ui.component.InvitationCodeTextField
import com.goalpanzi.mission_mate.feature.onboarding.util.styledTextWithHighlights

@Composable
Expand Down Expand Up @@ -120,4 +120,4 @@ private fun PreviewInvitationCodeDialog() {
code = "ABCD",
onDismissRequest = {}
)
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.goalpanzi.mission_mate.feature.board.component
package com.goalpanzi.mission_mate.feature.board.component.dialog

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.window.DialogProperties
import com.goalpanzi.mission_mate.core.designsystem.component.MissionMateDialog
import com.goalpanzi.mission_mate.feature.board.R

Expand Down Expand Up @@ -32,4 +31,4 @@ private fun PreviewRequestDeleteMissionDialog() {
onDismissRequest = {}
)

}
}
Loading
Loading