-
Notifications
You must be signed in to change notification settings - Fork 1
/
VoyageTopAppBar.kt
40 lines (38 loc) · 1.24 KB
/
VoyageTopAppBar.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.dluvian.voyage.ui.components.bar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.text.style.TextOverflow
import com.dluvian.voyage.core.OnUpdate
import com.dluvian.voyage.ui.components.button.GoBackIconButton
import com.dluvian.voyage.ui.components.iconButton.SearchIconButton
import com.dluvian.voyage.ui.components.indicator.TopBarCircleProgressIndicator
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun VoyageTopAppBar(
title: String? = null,
showGoBack: Boolean = false,
isLoading: Boolean = false,
hasSearch: Boolean = false,
onUpdate: OnUpdate = {}
) {
TopAppBar(
title = {
title?.let {
Text(
text = title,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
},
navigationIcon = {
if (showGoBack) GoBackIconButton(onUpdate = onUpdate)
},
actions = {
if (hasSearch) SearchIconButton(onUpdate = onUpdate)
if (isLoading) TopBarCircleProgressIndicator()
}
)
}