-
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 remote-tracking branch 'origin/develop' into ui/#37-calendar-scrap
# Conflicts: # core/src/main/res/values/strings.xml
- Loading branch information
Showing
68 changed files
with
1,676 additions
and
243 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
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
12 changes: 12 additions & 0 deletions
12
core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortBy.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,12 @@ | ||
package com.terning.core.designsystem.component.bottomsheet | ||
|
||
import androidx.annotation.StringRes | ||
import com.terning.core.R | ||
|
||
enum class SortBy(@StringRes val type: Int) { | ||
EARLIEST(R.string.sort_by_earliest), | ||
SHORTEST(R.string.sort_by_shortest), | ||
LONGEST(R.string.sort_by_longest), | ||
SCRAP(R.string.sort_by_scrap), | ||
VIEW_COUNT(R.string.sort_by_view_count), | ||
} |
94 changes: 94 additions & 0 deletions
94
core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SortingBottomSheet.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,94 @@ | ||
package com.terning.core.designsystem.component.bottomsheet | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.rememberModalBottomSheetState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.MutableState | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.runtime.setValue | ||
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 com.terning.core.R | ||
import com.terning.core.designsystem.theme.Black | ||
import com.terning.core.designsystem.theme.Grey200 | ||
import com.terning.core.designsystem.theme.Grey400 | ||
import com.terning.core.designsystem.theme.TerningMain | ||
import com.terning.core.designsystem.theme.TerningTheme | ||
import com.terning.core.extension.noRippleClickable | ||
import kotlinx.coroutines.launch | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun SortingBottomSheet( | ||
onDismiss: () -> Unit, | ||
currentSortBy: Int, | ||
modifier: Modifier = Modifier, | ||
newSortBy: MutableState<Int> = mutableStateOf(currentSortBy), | ||
) { | ||
val scope = rememberCoroutineScope() | ||
val sheetState = rememberModalBottomSheetState() | ||
var currentSortBy by remember { mutableStateOf(currentSortBy) } | ||
|
||
TerningBasicBottomSheet( | ||
content = { | ||
Text( | ||
text = stringResource(id = R.string.sort_bottom_sheet_title), | ||
style = TerningTheme.typography.title2, | ||
color = Black, | ||
modifier = modifier | ||
.padding(start = 27.dp, bottom = 16.dp) | ||
) | ||
|
||
HorizontalDivider( | ||
thickness = 1.dp, | ||
color = Grey200, | ||
modifier = modifier.padding(horizontal = 24.dp) | ||
) | ||
|
||
LazyColumn( | ||
modifier = modifier | ||
.padding(top = 12.dp, bottom = 19.dp) | ||
.padding(horizontal = 24.dp), | ||
verticalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
items(sortByCount) { sortIndex -> | ||
Text( | ||
text = stringResource(id = SortBy.entries[sortIndex].type), | ||
style = TerningTheme.typography.button3, | ||
color = if (currentSortBy == sortIndex) TerningMain else Grey400, | ||
textAlign = TextAlign.Start, | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.padding(start = 3.dp) | ||
.padding(vertical = 12.dp) | ||
.noRippleClickable { | ||
newSortBy.value = sortIndex | ||
scope | ||
.launch { sheetState.hide() } | ||
.invokeOnCompletion { | ||
if (!sheetState.isVisible) { | ||
onDismiss() | ||
} | ||
} | ||
} | ||
) | ||
} | ||
} | ||
}, | ||
onDismissRequest = { onDismiss() }, | ||
sheetState = sheetState | ||
) | ||
} | ||
|
||
private const val sortByCount = 5 |
11 changes: 5 additions & 6 deletions
11
.../main/java/com/terning/core/designsystem/component/bottomsheet/TerningBasicBottomSheet.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
49 changes: 49 additions & 0 deletions
49
core/src/main/java/com/terning/core/designsystem/component/button/SortingButton.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,49 @@ | ||
package com.terning.core.designsystem.component.button | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Text | ||
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.unit.dp | ||
import com.terning.core.R | ||
import com.terning.core.designsystem.component.bottomsheet.SortBy | ||
import com.terning.core.designsystem.theme.Black | ||
import com.terning.core.designsystem.theme.TerningTheme | ||
import com.terning.core.extension.noRippleClickable | ||
|
||
@Composable | ||
fun SortingButton( | ||
sortBy: Int = 0, | ||
modifier: Modifier = Modifier, | ||
onCLick: () -> Unit, | ||
) { | ||
Row( | ||
modifier = modifier | ||
.noRippleClickable { onCLick() } | ||
) { | ||
Text( | ||
text = stringResource( | ||
id = SortBy.entries[sortBy].type | ||
), | ||
style = TerningTheme.typography.button3, | ||
color = Black, | ||
modifier = modifier | ||
.padding( | ||
top = 6.dp, | ||
bottom = 5.dp, | ||
start = 12.dp, | ||
) | ||
) | ||
Image( | ||
painter = painterResource(id = R.drawable.ic_down), | ||
contentDescription = stringResource(id = R.string.sort_button_description), | ||
modifier = modifier | ||
.padding(vertical = 5.dp) | ||
.padding(end = 2.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
13 changes: 7 additions & 6 deletions
13
core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.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
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.