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

[feat #82] :: 홈 화면 퍼블리싱 #83

Merged
merged 11 commits into from
Nov 28, 2024
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package team.aliens.dms.kmp.di

import org.koin.dsl.module
import team.aliens.dms.kmp.feature.home.di.homeModule
import team.aliens.dms.kmp.feature.signin.di.signInModule
import team.aliens.dms.kmp.feature.signup.di.signUpModule
import team.aliens.dms.kmp.feature.splash.di.splashModule
Expand All @@ -10,5 +11,6 @@ internal val featureModule = module {
splashModule,
signInModule,
signUpModule,
homeModule,
)
}
1 change: 1 addition & 0 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ kotlin {
implementation(libs.lifecycle.viewmodel.compose)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(libs.kotlinx.datetime)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package team.aliens.dms.kmp.core.common.utils

import kotlinx.datetime.Clock
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.LocalTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime

val today: LocalDate
inline get() = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault()).date

val now: LocalDateTime
inline get() = Clock.System.now().toLocalDateTime(TimeZone.UTC)

val timeNow: LocalTime
inline get() = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault()).time
1 change: 1 addition & 0 deletions core/design-system/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ kotlin {
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.kottie)
implementation(libs.kotlinx.datetime)

implementation(projects.core.common)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="18dp"
android:viewportWidth="18"
android:viewportHeight="18">
<group>
<clip-path
android:pathData="M0,0h18v18h-18z"/>
<path
android:pathData="M6.776,9L12.2,14.425C12.337,14.562 12.406,14.731 12.409,14.933C12.411,15.135 12.344,15.304 12.208,15.44C12.071,15.577 11.902,15.645 11.7,15.645C11.498,15.645 11.329,15.577 11.192,15.44L5.608,9.849C5.485,9.725 5.397,9.592 5.344,9.449C5.291,9.306 5.264,9.156 5.264,9C5.264,8.845 5.291,8.695 5.344,8.552C5.397,8.409 5.485,8.276 5.608,8.152L11.192,2.568C11.329,2.431 11.497,2.362 11.696,2.359C11.896,2.357 12.064,2.424 12.2,2.561C12.337,2.697 12.405,2.866 12.405,3.068C12.405,3.27 12.337,3.439 12.2,3.576L6.776,9Z"
android:fillColor="#121212"/>
</group>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="18dp"
android:viewportWidth="18"
android:viewportHeight="18">
<group>
<clip-path
android:pathData="M0,0h18v18h-18z"/>
<path
android:pathData="M10.317,9L4.892,3.575C4.756,3.439 4.686,3.271 4.684,3.071C4.682,2.872 4.749,2.704 4.885,2.567C5.022,2.431 5.19,2.362 5.389,2.362C5.589,2.362 5.757,2.431 5.893,2.567L11.485,8.152C11.608,8.275 11.696,8.408 11.749,8.551C11.802,8.695 11.828,8.844 11.828,9C11.828,9.156 11.802,9.305 11.749,9.448C11.696,9.592 11.608,9.725 11.485,9.848L5.9,15.433C5.764,15.569 5.595,15.639 5.393,15.641C5.191,15.643 5.022,15.576 4.885,15.44C4.749,15.303 4.68,15.135 4.68,14.936C4.68,14.736 4.749,14.568 4.885,14.432L10.317,9Z"
android:fillColor="#121212"/>
</group>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M5.25,18.885C5.037,18.885 4.859,18.813 4.716,18.669C4.572,18.525 4.5,18.347 4.5,18.134C4.5,17.922 4.572,17.744 4.716,17.6C4.859,17.456 5.037,17.385 5.25,17.385H6.308V9.923C6.308,8.578 6.723,7.389 7.553,6.356C8.383,5.322 9.449,4.661 10.75,4.373V3.75C10.75,3.403 10.871,3.108 11.114,2.865C11.357,2.622 11.652,2.5 11.999,2.5C12.346,2.5 12.641,2.622 12.884,2.865C13.128,3.108 13.25,3.403 13.25,3.75V4.373C14.551,4.661 15.617,5.322 16.447,6.356C17.277,7.389 17.692,8.578 17.692,9.923V17.385H18.75C18.962,17.385 19.141,17.457 19.284,17.6C19.428,17.744 19.5,17.922 19.5,18.135C19.5,18.347 19.428,18.526 19.284,18.669C19.141,18.813 18.962,18.885 18.75,18.885H5.25ZM11.998,21.692C11.501,21.692 11.075,21.515 10.722,21.161C10.369,20.807 10.192,20.382 10.192,19.885H13.808C13.808,20.383 13.631,20.809 13.276,21.163C12.922,21.516 12.496,21.692 11.998,21.692ZM7.808,17.385H16.192V9.923C16.192,8.765 15.783,7.777 14.965,6.959C14.146,6.14 13.158,5.731 12,5.731C10.842,5.731 9.854,6.14 9.035,6.959C8.217,7.777 7.808,8.765 7.808,9.923V17.385Z"
android:fillColor="#000000"/>
</group>
</vector>
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package team.aliens.dms.kmp.core.designsystem.appbar

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
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.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.jetbrains.compose.resources.painterResource
import team.aliens.dms.kmp.core.designsystem.button.DmsIconButton
import team.aliens.dms.kmp.core.designsystem.foundation.DmsIcon
import team.aliens.dms.kmp.core.designsystem.foundation.DmsTheme
Expand All @@ -20,8 +24,10 @@ import team.aliens.dms.kmp.core.designsystem.text.DmsText
@Composable
fun DmsTopAppBar(
modifier: Modifier = Modifier,
showLogo: Boolean = false,
onBackPressed: (() -> Unit)? = null,
title: String,
actions: (@Composable RowScope.() -> Unit)? = null,
title: String? = null,
) {
Box(
modifier = modifier
Expand All @@ -33,20 +39,42 @@ fun DmsTopAppBar(
Row(
modifier = Modifier
.fillMaxWidth(),
horizontalArrangement = if (showLogo || onBackPressed != null) Arrangement.SpaceBetween else Arrangement.End,
verticalAlignment = Alignment.CenterVertically,
) {
if (showLogo) {
Image(
painter = painterResource(
if (isSystemInDarkTheme()) {
DmsIcon.SymbolDark
} else {
DmsIcon.SymbolLight
},
),
contentDescription = null,
)
}
onBackPressed?.let {
DmsIconButton(
resource = DmsIcon.ArrowBack,
tint = DmsTheme.colors.surfaceContainerLow,
onClick = it,
)
}
actions?.let {
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
content = it,
)
}
}
title?.let {
DmsText(
text = it,
style = DmsTypography.SubtitleSemiBold,
)
}
DmsText(
text = title,
style = DmsTypography.SubtitleSemiBold,
)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package team.aliens.dms.kmp.core.designsystem.calendar

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import kotlinx.datetime.LocalDate

@Composable
fun DmsCalendar(
modifier: Modifier = Modifier,
selectDate: LocalDate,
onSelectedDateChange: (newDate: LocalDate) -> Unit,
) {
// TODO: Calender 커스텀 하기
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import dmskmp.core.design_system.generated.resources.ic_add_notes
import dmskmp.core.design_system.generated.resources.ic_add_notes_fill
import dmskmp.core.design_system.generated.resources.ic_alarm
import dmskmp.core.design_system.generated.resources.ic_arrow_back
import dmskmp.core.design_system.generated.resources.ic_backward
import dmskmp.core.design_system.generated.resources.ic_breaking_news
import dmskmp.core.design_system.generated.resources.ic_breaking_news_fill
import dmskmp.core.design_system.generated.resources.ic_cancel
import dmskmp.core.design_system.generated.resources.ic_check
import dmskmp.core.design_system.generated.resources.ic_delete
import dmskmp.core.design_system.generated.resources.ic_edit
import dmskmp.core.design_system.generated.resources.ic_forward
import dmskmp.core.design_system.generated.resources.ic_home
import dmskmp.core.design_system.generated.resources.ic_home_fill
import dmskmp.core.design_system.generated.resources.ic_notification
import dmskmp.core.design_system.generated.resources.ic_person
import dmskmp.core.design_system.generated.resources.ic_person_fill
import dmskmp.core.design_system.generated.resources.ic_refresh
Expand Down Expand Up @@ -41,4 +44,7 @@ object DmsIcon {
val AddNotesFill = Res.drawable.ic_add_notes_fill
val BreakingNewsFill = Res.drawable.ic_breaking_news_fill
val PersonFill = Res.drawable.ic_person_fill
val Notification = Res.drawable.ic_notification
val Backward = Res.drawable.ic_backward
val Forward = Res.drawable.ic_forward
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fun DmsText(
maxLines: Int = Int.MAX_VALUE,
textAlign: TextAlign? = null,
textDecoration: TextDecoration = TextDecoration.None,
softWrap: Boolean = true,
) {
Text(
modifier = modifier,
Expand All @@ -30,5 +31,6 @@ fun DmsText(
maxLines = maxLines,
textAlign = textAlign,
textDecoration = textDecoration,
softWrap = softWrap,
)
}
9 changes: 9 additions & 0 deletions feature/home/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ kotlin {
implementation(compose.material)
implementation(compose.material3)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(libs.navigation.compose)
implementation(libs.kotlinx.datetime)

implementation(libs.koin.core)
implementation(libs.koin.compose)
implementation(libs.koin.compose.viewmodel)

implementation(projects.core.designSystem)
implementation(projects.core.common)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package team.aliens.dms.kmp.feature.home.di

import org.koin.core.module.dsl.viewModelOf
import org.koin.dsl.module
import team.aliens.dms.kmp.feature.home.viewmodel.HomeViewModel

val homeModule = module {
viewModelOf(::HomeViewModel)
}
Loading
Loading