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

[UI/#48] 온보딩 뷰 / UI 구현 #70

Merged
merged 32 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a9861ef
[UI/#48] StartScreen UI 구현
leeeyubin Jul 11, 2024
78e6f62
[FEAT/#48] 애니메이션 구현
leeeyubin Jul 11, 2024
ee773f6
[FEAT/#48] solving conflict
leeeyubin Jul 11, 2024
145076b
[FEAT/#48] TopAppBar 수정
leeeyubin Jul 11, 2024
1d01e28
[ADD/#48] Filtering Screen 추가
leeeyubin Jul 11, 2024
3823413
[FEAT/#48] TerningBasicImage 구현
leeeyubin Jul 11, 2024
d1b435d
[FEAT/#48] Text 구현
leeeyubin Jul 11, 2024
b7fe480
[FEAT/#48] string 추출
leeeyubin Jul 11, 2024
b40a191
[FEAT/#48] solving conflict
leeeyubin Jul 11, 2024
d395dbc
[FEAT/#48] FilteringButton 구현
leeeyubin Jul 11, 2024
d5149d1
[FEAT/#48] FilteringButton 구현
leeeyubin Jul 12, 2024
c43e4b9
[UI/#48] FilteringOneScreen UI 구현
leeeyubin Jul 12, 2024
3c4ab6b
[FEAT/#48] Filtering 버튼 연결
leeeyubin Jul 12, 2024
a3b3183
[UI/#48] FilteringTwoScreen UI 구현
leeeyubin Jul 12, 2024
7569fec
[UI/#48] FilteringTwoScreen UI 구현
leeeyubin Jul 12, 2024
e3b7d1c
[FEAT/#48] navigation 연결
leeeyubin Jul 12, 2024
ab9dd9f
[FEAT/#48] button3_a 추가
leeeyubin Jul 12, 2024
6f334c3
[FEAT/#48] padding vertical 수정
leeeyubin Jul 12, 2024
08ad2bb
[FEAT/#48] Calendar 구현
leeeyubin Jul 12, 2024
93cb52f
[FEAT/#48] solving conflict
leeeyubin Jul 12, 2024
16c1646
[FEAT/#48] solving conflict
leeeyubin Jul 12, 2024
e05f2c8
[FEAT/#48] StartHomeScreen 추가
leeeyubin Jul 12, 2024
c4adc81
[FEAT/#48] 스크롤 시 버튼 활성화 구현
leeeyubin Jul 12, 2024
439eb06
[FEAT/#48] 데이트 피커 구현
leeeyubin Jul 12, 2024
6e7565b
[FEAT/#48] pull from develop
leeeyubin Jul 12, 2024
965cb71
[FEAT/#48] pull from develop
leeeyubin Jul 12, 2024
1b2e0d5
[FIX/#48] 마지막 아이템 선택 이슈 해결
leeeyubin Jul 12, 2024
8fc7213
[FEAT/#48] StartHomeScreen 구현
leeeyubin Jul 12, 2024
a06c968
[FEAT/#48] string에 년, 월 추가
leeeyubin Jul 13, 2024
3e8d879
[CHORE/#48] startDestination 수정
leeeyubin Jul 13, 2024
d3b69e9
[CHORE/#48] MONTH 상수화
leeeyubin Jul 13, 2024
72d1d53
Merge branch 'develop' of https://github.com/teamterning/Terning-Andr…
leeeyubin Jul 13, 2024
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
1 change: 1 addition & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ dependencies {

//ThirdPartyDependencies
implementation(libs.compose.coil)
implementation(libs.okhttp)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.terning.core.designsystem.component.button

import androidx.annotation.StringRes
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningSub1
import com.terning.core.designsystem.theme.TerningSub3
import com.terning.core.designsystem.theme.TerningSub4
import com.terning.core.designsystem.theme.TerningSub5
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.core.util.NoRippleTheme

@Composable
fun FilteringButton(
isSelected: Boolean,
@StringRes text: Int,
cornerRadius: Dp,
paddingVertical: Dp,
onButtonClick: () -> Unit,
modifier: Modifier = Modifier,
) {
val interactionSource = remember { MutableInteractionSource() }
val isPressed by interactionSource.collectIsPressedAsState()
val backgroundColor = when {
!isSelected && !isPressed -> White
!isSelected && isPressed -> TerningSub5
isSelected && !isPressed -> TerningSub4
else -> TerningSub3
}
val textColor = when {
!isSelected -> Grey400
else -> TerningMain
}
val borderColor = when {
!isSelected -> TerningMain
else -> TerningSub1
}

CompositionLocalProvider(LocalRippleTheme provides NoRippleTheme) {
Button(
contentPadding = PaddingValues(paddingVertical),
modifier = modifier.fillMaxWidth(),
interactionSource = interactionSource,
colors = ButtonDefaults.buttonColors(
containerColor = backgroundColor,
contentColor = textColor,
),
border = BorderStroke(
width = 1.dp,
color = borderColor
),
shape = RoundedCornerShape(cornerRadius),
onClick = { onButtonClick() }
) {
Text(
text = stringResource(id = text),
style = TerningTheme.typography.button3_a,
textAlign = TextAlign.Center
)
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

진짜 고생 많았다,,,,,,,

Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
package com.terning.core.designsystem.component.datepicker

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.HorizontalDivider
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.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.Grey500
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme
import okhttp3.internal.toImmutableList

private const val START_YEAR = 2023
private const val END_YEAR = 2025
private const val START_MONTH = 1
private const val END_MONTH = 12
private val years =
(listOf("") + (START_YEAR..END_YEAR).map { it.toString() } + listOf("") + listOf("")).toImmutableList()
private val monthsNumber =
(listOf("") + (START_MONTH..END_MONTH).map { it.toString() } + listOf("") + listOf("")).toImmutableList()

@Composable
fun DatePickerUI(
chosenYear: Int,
chosenMonth: Int,
onYearChosen: (Int) -> Unit = {},
onMonthChosen: (Int) -> Unit = {},
) {

Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxWidth()
) {
DateSelectionSection(
chosenYear = chosenYear,
chosenMonth = chosenMonth,
onYearChosen = { onYearChosen(it.toInt()) },
onMonthChosen = { onMonthChosen(it.toInt()) },
)
}
}

@Composable
fun DateSelectionSection(
chosenYear: Int,
chosenMonth: Int,
onYearChosen: (String) -> Unit,
onMonthChosen: (String) -> Unit,
) {
Row(
horizontalArrangement = Arrangement.Center,
modifier = Modifier.fillMaxWidth()
) {
DateItemsPicker(
items = years.toImmutableList(),
firstIndex = (chosenYear - START_YEAR),
onItemSelected = onYearChosen,
isYear = true
)
Spacer(modifier = Modifier.width(25.dp))
DateItemsPicker(
items = monthsNumber.toImmutableList(),
firstIndex = chosenMonth,
onItemSelected = onMonthChosen,
isYear = false
)
}
}

@Composable
fun DateItemsPicker(
items: List<String>,
firstIndex: Int,
onItemSelected: (String) -> Unit,
modifier: Modifier = Modifier,
isYear: Boolean
) {
val listState = rememberLazyListState(firstIndex)
val currentValue = remember { mutableStateOf("") }

LaunchedEffect(!listState.isScrollInProgress) {
onItemSelected(currentValue.value)
listState.animateScrollToItem(index = listState.firstVisibleItemIndex)
}

Box(
modifier = Modifier.height(108.dp),
contentAlignment = Alignment.Center
) {
Column(
modifier = modifier.fillMaxHeight(),
verticalArrangement = Arrangement.SpaceEvenly
) {
HorizontalDivider(
modifier = Modifier.size(height = 1.dp, width = 71.dp),
color = TerningMain
)
HorizontalDivider(
modifier = Modifier.size(height = 1.dp, width = 71.dp),
color = TerningMain
)
}
LazyColumn(
modifier = modifier,
horizontalAlignment = Alignment.CenterHorizontally,
state = listState,
) {
items(items.size) {
val index = it % items.size
val firstVisibleItemIndex by remember {
derivedStateOf { listState.firstVisibleItemIndex }
}
if (it == firstVisibleItemIndex + 1) {
currentValue.value = items[index]
}
Spacer(modifier = Modifier.height(6.dp))
Text(
text =
when (isYear) {
true -> if (items[index].isNotEmpty()) "${items[index]}년" else ""
false -> if (items[index].isNotEmpty()) "${items[index]}월" else ""
},
style = TerningTheme.typography.title3,
color = if (it == firstVisibleItemIndex + 1) Grey500 else Grey300,
textAlign = TextAlign.Center
)
Spacer(modifier = Modifier.height(6.dp))
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.terning.core.designsystem.component.image

import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.terning.core.R
import com.terning.core.designsystem.theme.TerningPointTheme

@Composable
fun TerningImage(
painter: Int,
modifier: Modifier = Modifier
) {
Image(
painter = painterResource(id = painter),
contentDescription = stringResource(id = R.string.image_content_descriptin),
modifier = modifier
)
}

@Preview(showBackground = true)
@Composable
fun TerningBasicImagePreview() {
TerningPointTheme {
TerningImage(
painter = R.drawable.ic_back
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import androidx.compose.ui.Modifier

@Composable
fun BackButtonTopAppBar(
title: String,
modifier: Modifier,
modifier: Modifier = Modifier,
title: String = "",
onBackButtonClick: (() -> Unit),
actions: List<@Composable () -> Unit> = emptyList(),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ fun TerningBasicTopAppBar(
) {
CenterAlignedTopAppBar(
title = {

Text(
text = title,
textAlign = TextAlign.Center,
style = TerningTheme.typography.title2
)

},
modifier = modifier,
navigationIcon = {
if (showBackButton) {
IconButton(
Expand Down
13 changes: 13 additions & 0 deletions core/src/main/java/com/terning/core/designsystem/theme/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TerningTypography internal constructor(
button1: TextStyle,
button2: TextStyle,
button3: TextStyle,
button3_a: TextStyle,
button4: TextStyle,
button5: TextStyle,
button6: TextStyle,
Expand Down Expand Up @@ -88,6 +89,8 @@ class TerningTypography internal constructor(
private set
var button3: TextStyle by mutableStateOf(button3)
private set
var button3_a: TextStyle by mutableStateOf(button3_a)
private set
var button4: TextStyle by mutableStateOf(button4)
private set
var button5: TextStyle by mutableStateOf(button5)
Expand Down Expand Up @@ -129,6 +132,7 @@ class TerningTypography internal constructor(
button1: TextStyle = this.button1,
button2: TextStyle = this.button2,
button3: TextStyle = this.button3,
button3_a: TextStyle = this.button3_a,
button4: TextStyle = this.button4,
button5: TextStyle = this.button5,
button6: TextStyle = this.button6,
Expand Down Expand Up @@ -159,6 +163,7 @@ class TerningTypography internal constructor(
button1,
button2,
button3,
button3_a,
button4,
button5,
button6,
Expand Down Expand Up @@ -191,6 +196,7 @@ class TerningTypography internal constructor(
button1 = other.button1
button2 = other.button2
button3 = other.button3
button3_a = other.button3_a
button4 = other.button4
button5 = other.button5
button6 = other.button6
Expand Down Expand Up @@ -340,6 +346,13 @@ fun TerningTypography(): TerningTypography {
letterSpacing = (0.002).em,
lineHeight = (15.6).sp,
),
button3_a = TextStyle(
fontFamily = PretendardMedium,
fontWeight = FontWeight.Medium,
fontSize = 13.sp,
letterSpacing = (0.002).em,
lineHeight = (19.6).sp,
),
button4 = TextStyle(
fontFamily = PretendardMedium,
fontWeight = FontWeight.Medium,
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@
<string name="intern_info_d_day">서류 마감</string>
<string name="intern_info_working">근무 기간</string>
<string name="intern_info_start_date">근무 시작</string>

<!--image-->
<string name="image_content_descriptin">TerningBasicImage</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fun InternScreen(
offsetY = 2.dp
),
onBackButtonClick = {},
listOf(
actions = listOf(
{},
{
IconButton(onClick = {}) {
Expand Down
Loading
Loading