Skip to content

Commit

Permalink
[Merge] #18 -> develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeeum authored Jul 6, 2024
2 parents 3aea6fd + 8a0be75 commit 447af40
Show file tree
Hide file tree
Showing 17 changed files with 475 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class HankkiTypography internal constructor(
h1: TextStyle,
h2: TextStyle,
suitH1: TextStyle,
suitH2: TextStyle,
sub1: TextStyle,
sub2: TextStyle,
sub3: TextStyle,
Expand All @@ -47,6 +48,8 @@ class HankkiTypography internal constructor(
private set
var suitH1: TextStyle by mutableStateOf(suitH1)
private set
var suitH2: TextStyle by mutableStateOf(suitH2)
private set
var sub1: TextStyle by mutableStateOf(sub1)
private set
var sub2: TextStyle by mutableStateOf(sub2)
Expand Down Expand Up @@ -80,6 +83,7 @@ class HankkiTypography internal constructor(
h1: TextStyle = this.h1,
h2: TextStyle = this.h2,
suitH1: TextStyle = this.suitH1,
suitH2: TextStyle = this.suitH2,
sub1: TextStyle = this.sub1,
sub2: TextStyle = this.sub2,
sub3: TextStyle = this.sub3,
Expand All @@ -98,6 +102,7 @@ class HankkiTypography internal constructor(
h1,
h2,
suitH1,
suitH2,
sub1,
sub2,
sub3,
Expand All @@ -118,6 +123,7 @@ class HankkiTypography internal constructor(
h1 = other.h1
h2 = other.h2
suitH1 = other.suitH1
suitH2 = other.suitH2
sub1 = other.sub1
sub2 = other.sub2
sub3 = other.sub3
Expand Down Expand Up @@ -156,6 +162,12 @@ fun hankkiTypography(): HankkiTypography {
fontSize = 24.sp,
lineHeight = 36.sp
),
suitH2 = TextStyle(
fontFamily = SuiteBold,
fontWeight = FontWeight.Bold,
fontSize = 20.sp,
lineHeight = 30.sp
),
sub1 = TextStyle(
fontFamily = PretendardSemiBold,
fontWeight = FontWeight.SemiBold,
Expand Down
1 change: 1 addition & 0 deletions domain/my/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
4 changes: 4 additions & 0 deletions domain/my/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// domain
plugins {
alias(libs.plugins.hankki.kotlin)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.hankki.domain.my.entity

data class UserInfoEntity (
val name : String,
val image : String
)
10 changes: 9 additions & 1 deletion feature/my/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ android {
setNamespace("feature.my")
}

dependencies {}
dependencies {
//domain
implementation(projects.domain.my)

//other
implementation(libs.coil.compose)
}


167 changes: 160 additions & 7 deletions feature/my/src/main/java/com/hankki/feature/my/MyRoute.kt
Original file line number Diff line number Diff line change
@@ -1,28 +1,181 @@
package com.hankki.feature.my

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import coil.compose.AsyncImage
import com.hankki.core.common.extension.noRippleClickable
import com.hankki.core.designsystem.theme.Gray400
import com.hankki.core.designsystem.theme.Gray900
import com.hankki.core.designsystem.theme.HankkiTheme
import com.hankki.core.designsystem.theme.HankkijogboTheme
import com.hankki.core.designsystem.theme.Red
import com.hankki.core.designsystem.theme.White
import com.hankki.feature.my.component.ButtonWithArrowIcon
import com.hankki.feature.my.component.ButtonWithImageAndBorder
import com.hankki.feature.my.component.MyTitle

@Composable
fun MyRoute(paddingValues: PaddingValues, navigateToDummy: () -> Unit) {
MyScreen(paddingValues, navigateToDummy = navigateToDummy)
fun MyRoute(
paddingValues: PaddingValues,
navigateToDummy: () -> Unit,
myViewModel: MyViewModel = hiltViewModel()
) {
val myState by myViewModel.myState.collectAsStateWithLifecycle()

LaunchedEffect(true) {
myViewModel.loadMockInformation()
}

MyScreen(
paddingValues = paddingValues,
navigateToDummy = navigateToDummy,
userName = myState.userState.name,
userImage = myState.userState.image
)
}

@Composable
fun MyScreen(
paddingValues: PaddingValues,
navigateToDummy: () -> Unit,
userName: String,
userImage: String
) {
Column(modifier = Modifier.padding(paddingValues)) {
Text(text = "My")
val scrollState = rememberScrollState()

Column(
modifier = Modifier
.padding(paddingValues)
.padding(horizontal = 22.dp)
.fillMaxSize()
.verticalScroll(scrollState),
horizontalAlignment = Alignment.CenterHorizontally
) {
MyTitle(title = stringResource(R.string.my))

Spacer(modifier = Modifier.height(15.dp))

AsyncImage(
modifier = Modifier
.size(98.dp)
.clip(CircleShape),
model = userImage,
contentDescription = stringResource(R.string.profile_image),
contentScale = ContentScale.None
)

Spacer(modifier = Modifier.height(10.dp))

Text(
text = stringResource(R.string.message_user_name, userName),
color = Gray900,
style = HankkiTheme.typography.suitH2,
textAlign = TextAlign.Center
)

Spacer(modifier = Modifier.height(19.dp))

Button(onClick = navigateToDummy) {
Text(text = "Go to Dummy")
Row(
modifier = Modifier
.fillMaxWidth()
.background(
Red,
shape = RoundedCornerShape(12.dp)
)
.clip(RoundedCornerShape(12.dp))
.padding(start = 28.dp, end = 29.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
) {
Text(
text = stringResource(R.string.my_jogbo),
style = HankkiTheme.typography.sub1,
color = White,
)
Image(
painter = painterResource(id = R.drawable.ic_mygraphic),
contentDescription = null,
)
}

Spacer(modifier = Modifier.height(19.dp))

Row {
ButtonWithImageAndBorder(
R.drawable.ic_report,
stringResource(R.string.description_store_report),
Modifier.weight(1f)
)
Spacer(modifier = Modifier.width(18.dp))
ButtonWithImageAndBorder(
R.drawable.ic_good,
stringResource(R.string.description_store_like),
Modifier.weight(1f)
)
}

ButtonWithArrowIcon(stringResource(R.string.faq), navigateToDummy)

ButtonWithArrowIcon(stringResource(R.string.inquiry), navigateToDummy)

ButtonWithArrowIcon(stringResource(R.string.logout), navigateToDummy)

Box(
modifier = Modifier
.fillMaxWidth(),
contentAlignment = Alignment.CenterEnd
) {
Text(
text = stringResource(R.string.quit),
modifier = Modifier
.noRippleClickable(onClick = navigateToDummy)
.padding(top = 14.dp, start = 15.dp, bottom = 13.dp),
textAlign = TextAlign.End,
style = HankkiTheme.typography.body4,
color = Gray400,
)
}
}
}


@Preview(showBackground = true)
@Composable
fun MyScreenPreview() {
HankkijogboTheme {
MyScreen(
paddingValues = PaddingValues(), navigateToDummy = {}, userName = "", userImage = ""
)
}
}
7 changes: 7 additions & 0 deletions feature/my/src/main/java/com/hankki/feature/my/MyState.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.hankki.feature.my

import com.hankki.domain.my.entity.UserInfoEntity

data class MyState(
val userState : UserInfoEntity = UserInfoEntity("","")
)
29 changes: 29 additions & 0 deletions feature/my/src/main/java/com/hankki/feature/my/MyViewModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.hankki.feature.my

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.hankki.domain.my.entity.UserInfoEntity
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class MyViewModel @Inject constructor() : ViewModel() {
private val _myState = MutableStateFlow(MyState())
val myState: StateFlow<MyState>
get() = _myState.asStateFlow()

fun loadMockInformation() {
viewModelScope.launch {
val mockUserName = "송한끼"
val mockUserImage = ""
val mockUserInformation = UserInfoEntity(mockUserName, mockUserImage)
_myState.value = _myState.value.copy(
userState = mockUserInformation
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.hankki.feature.my.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.hankki.core.common.extension.noRippleClickable
import com.hankki.core.designsystem.theme.Gray200
import com.hankki.core.designsystem.theme.Gray900
import com.hankki.core.designsystem.theme.HankkiTheme
import com.hankki.core.designsystem.theme.HankkijogboTheme
import com.hankki.feature.my.R

@Composable
fun ButtonWithArrowIcon(
itemTitle: String,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
Row(
modifier
.fillMaxWidth()
.padding(vertical = 18.dp)
.noRippleClickable(onClick = onClick),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = itemTitle,
style = HankkiTheme.typography.body3,
color = Gray900
)
Image(painterResource(id = R.drawable.ic_arrow_right), "ic_arrow_right")
}
HorizontalDivider(thickness = 1.dp, color = Gray200)
}

@Composable
@Preview
fun ItemWithArrowPreview() {
HankkijogboTheme {
ButtonWithArrowIcon(itemTitle = "title", onClick = {}, modifier = Modifier)
}
}
Loading

0 comments on commit 447af40

Please sign in to comment.