-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor profile and add setings feature
- Loading branch information
Showing
29 changed files
with
620 additions
and
67 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
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
61 changes: 61 additions & 0 deletions
61
core/ui/src/commonMain/kotlin/com/stslex/core/ui/components/AppToolbar.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,61 @@ | ||
package com.stslex.core.ui.components | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowLeft | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import com.stslex.core.ui.theme.AppDimension | ||
|
||
@Composable | ||
fun AppToolbar( | ||
title: String, | ||
modifier: Modifier = Modifier, | ||
onBackClick: (() -> Unit)? = null, | ||
actionIcon: @Composable (() -> Unit)? = null, | ||
isActionVisible: Boolean = actionIcon != null, | ||
) { | ||
Box( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.background(color = MaterialTheme.colorScheme.background) | ||
.padding(horizontal = AppDimension.Padding.medium), | ||
) { | ||
if (onBackClick != null) { | ||
IconButton( | ||
modifier = Modifier.align(Alignment.CenterStart), | ||
onClick = onBackClick, | ||
) { | ||
Icon( | ||
imageVector = Icons.AutoMirrored.Filled.KeyboardArrowLeft, | ||
contentDescription = "Back", | ||
tint = MaterialTheme.colorScheme.onBackground, | ||
) | ||
} | ||
} | ||
Text( | ||
modifier = Modifier.align(Alignment.Center), | ||
text = title, | ||
style = MaterialTheme.typography.headlineSmall, | ||
maxLines = 1, | ||
overflow = TextOverflow.Ellipsis, | ||
textAlign = TextAlign.Center | ||
) | ||
if (isActionVisible && actionIcon != null) | ||
Box( | ||
modifier = Modifier.align(Alignment.CenterEnd) | ||
) { | ||
actionIcon() | ||
} | ||
} | ||
} |
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
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
27 changes: 0 additions & 27 deletions
27
...ile/src/commonMain/kotlin/com/stslex/feature/profile/ui/components/ProfileLogoutButton.kt
This file was deleted.
Oops, something went wrong.
30 changes: 13 additions & 17 deletions
30
...le/src/commonMain/kotlin/com/stslex/feature/profile/ui/components/ProfileScreenContent.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
37 changes: 37 additions & 0 deletions
37
...le/src/commonMain/kotlin/com/stslex/feature/profile/ui/components/ProfileScreenToolbar.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,37 @@ | ||
package com.stslex.feature.profile.ui.components | ||
|
||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Settings | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import com.stslex.core.ui.components.AppToolbar | ||
|
||
@Composable | ||
fun ProfileScreenToolbar( | ||
nickname: String, | ||
isCurrentUser: Boolean, | ||
onSettingsClick: () -> Unit, | ||
onBackClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
AppToolbar( | ||
modifier = modifier, | ||
title = nickname, | ||
onBackClick = onBackClick, | ||
isActionVisible = isCurrentUser, | ||
actionIcon = { | ||
IconButton( | ||
onClick = onSettingsClick | ||
) { | ||
Icon( | ||
imageVector = Icons.Default.Settings, | ||
contentDescription = "Settings", | ||
tint = MaterialTheme.colorScheme.onBackground, | ||
) | ||
} | ||
} | ||
) | ||
} |
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
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 @@ | ||
/build |
Oops, something went wrong.