-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from TimerTiTi/50-log-screen
close #50 log screen
- Loading branch information
Showing
32 changed files
with
1,938 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
core/designsystem/src/main/kotlin/com/titi/app/core/designsystem/component/TdsColorRow.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.titi.app.core.designsystem.component | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.BoxWithConstraints | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import com.titi.app.core.designsystem.theme.TdsColor | ||
import com.titi.app.core.designsystem.theme.TiTiTheme | ||
|
||
@Composable | ||
fun TdsColorRow(modifier: Modifier = Modifier, onClick: (Int) -> Unit) { | ||
val tdsColors = listOf( | ||
TdsColor.D1, | ||
TdsColor.D2, | ||
TdsColor.D3, | ||
TdsColor.D4, | ||
TdsColor.D5, | ||
TdsColor.D6, | ||
TdsColor.D7, | ||
TdsColor.D8, | ||
TdsColor.D9, | ||
TdsColor.D11, | ||
TdsColor.D12, | ||
) | ||
|
||
BoxWithConstraints(modifier = modifier) { | ||
val width = maxWidth / 16 | ||
|
||
Row( | ||
modifier = Modifier.fillMaxWidth(), | ||
horizontalArrangement = Arrangement.SpaceBetween, | ||
) { | ||
tdsColors.forEachIndexed { index, tdsColor -> | ||
Box( | ||
modifier = Modifier | ||
.size(width) | ||
.clip(RoundedCornerShape(width / 8)) | ||
.background(tdsColor.getColor()) | ||
.clickable { onClick(index) }, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun TdsColorRowPreview() { | ||
TiTiTheme { | ||
TdsColorRow(modifier = Modifier.fillMaxWidth()) { | ||
} | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
core/designsystem/src/main/kotlin/com/titi/app/core/designsystem/component/TdsFilledCard.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.titi.app.core.designsystem.component | ||
|
||
import android.content.res.Configuration | ||
import androidx.compose.foundation.BorderStroke | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.BoxWithConstraints | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.layout.wrapContentHeight | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.OutlinedCard | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.titi.app.core.designsystem.theme.TdsColor | ||
import com.titi.app.core.designsystem.theme.TiTiTheme | ||
|
||
@Composable | ||
fun TdsFilledCard(modifier: Modifier = Modifier, content: @Composable () -> Unit) { | ||
BoxWithConstraints( | ||
modifier = modifier.padding(vertical = 10.dp), | ||
contentAlignment = Alignment.Center, | ||
) { | ||
val width = if (maxWidth >= 365.dp) 345.dp else maxWidth - 20.dp | ||
|
||
OutlinedCard( | ||
modifier = Modifier | ||
.width(width) | ||
.wrapContentHeight(), | ||
shape = RoundedCornerShape(25.dp), | ||
colors = CardDefaults.cardColors( | ||
containerColor = TdsColor.BACKGROUND.getColor(), | ||
), | ||
elevation = CardDefaults.outlinedCardElevation( | ||
defaultElevation = 5.dp, | ||
), | ||
border = BorderStroke( | ||
width = 3.dp, | ||
TdsColor.SHADOW.getColor(), | ||
), | ||
) { | ||
content() | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun TdsCard(modifier: Modifier = Modifier, content: @Composable () -> Unit) { | ||
OutlinedCard( | ||
modifier = modifier, | ||
shape = RoundedCornerShape(25.dp), | ||
colors = CardDefaults.cardColors( | ||
containerColor = TdsColor.BACKGROUND.getColor(), | ||
), | ||
elevation = CardDefaults.outlinedCardElevation( | ||
defaultElevation = 5.dp, | ||
), | ||
border = BorderStroke( | ||
width = 3.dp, | ||
TdsColor.SHADOW.getColor(), | ||
), | ||
) { | ||
Box( | ||
modifier = Modifier.fillMaxSize(), | ||
contentAlignment = Alignment.Center, | ||
) { | ||
content() | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) | ||
@Composable | ||
private fun TdsFilledCardPreview() { | ||
TiTiTheme { | ||
TdsFilledCard(modifier = Modifier.fillMaxSize()) { | ||
Box(modifier = Modifier.size(100.dp)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.