-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[개선] feature 모듈별 컴포넌트 분리
- Loading branch information
Showing
18 changed files
with
1,089 additions
and
873 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
86 changes: 86 additions & 0 deletions
86
...okmark/src/main/java/com/droidknights/app/feature/bookmark/component/BookmarkTopAppBar.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.droidknights.app.feature.bookmark.component | ||
|
||
import androidx.compose.animation.animateColorAsState | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.droidknights.app.core.designsystem.theme.Gray | ||
import com.droidknights.app.core.designsystem.theme.KnightsTheme | ||
import com.droidknights.app.core.designsystem.theme.Purple01 | ||
import com.droidknights.app.feature.bookmark.R | ||
|
||
@Composable | ||
internal fun BookmarkTopAppBar( | ||
modifier: Modifier = Modifier, | ||
isEditMode: Boolean, | ||
onClickEditButton: () -> Unit, | ||
) { | ||
val editButtonColor by animateColorAsState( | ||
label = "Edit Button Color Animation", | ||
targetValue = if (isEditMode) { | ||
Purple01 | ||
} else { | ||
Gray | ||
} | ||
) | ||
|
||
Box( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.height(48.dp) | ||
) { | ||
Text( | ||
modifier = Modifier.align(Alignment.Center), | ||
text = stringResource(id = R.string.book_mark_top_bar_title), | ||
style = KnightsTheme.typography.titleSmallM, | ||
color = MaterialTheme.colorScheme.onSurface | ||
) | ||
|
||
Text( | ||
modifier = Modifier | ||
.align(Alignment.CenterEnd) | ||
.clickable(onClick = onClickEditButton) | ||
.padding(horizontal = 12.dp), | ||
text = if (isEditMode) { | ||
stringResource(id = R.string.edit_button_confirm_label) | ||
} else { | ||
stringResource(id = R.string.edit_button_edit_label) | ||
}, | ||
style = KnightsTheme.typography.titleSmallM, | ||
color = editButtonColor | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun BookmarkTopAppBarPreview() { | ||
KnightsTheme { | ||
BookmarkTopAppBar( | ||
isEditMode = false, | ||
onClickEditButton = {} | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun BookmarkTopAppBarEditModePreview() { | ||
KnightsTheme { | ||
BookmarkTopAppBar( | ||
isEditMode = true, | ||
onClickEditButton = {} | ||
) | ||
} | ||
} |
Oops, something went wrong.