mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
add actions lambda to bottom bar and replace hard-coded strings
This commit is contained in:
parent
5da9097547
commit
1a86883ec0
1 changed files with 17 additions and 7 deletions
|
|
@ -9,26 +9,33 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import fr.free.nrw.commons.R
|
||||||
import fr.free.nrw.commons.ui.theme.CommonsTheme
|
import fr.free.nrw.commons.ui.theme.CommonsTheme
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CustomSelectorBottomBar(modifier: Modifier = Modifier) {
|
fun CustomSelectorBottomBar(
|
||||||
|
onPrimaryAction: ()-> Unit,
|
||||||
|
onSecondaryAction: ()-> Unit,
|
||||||
|
modifier: Modifier = Modifier
|
||||||
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
) {
|
) {
|
||||||
SecondaryButton(
|
SecondaryButton(
|
||||||
text = "Mark as\nnot for upload".uppercase(),
|
text = stringResource(R.string.mark_as_not_for_upload).uppercase(),
|
||||||
onClick = { /*TODO*/ },
|
onClick = onSecondaryAction,
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
)
|
)
|
||||||
|
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
text = "Upload".uppercase(),
|
text = stringResource(R.string.upload).uppercase(),
|
||||||
onClick = { /*TODO*/ },
|
onClick = onPrimaryAction,
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
.height(IntrinsicSize.Max)
|
.height(IntrinsicSize.Max)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +47,10 @@ private fun CustomSelectorBottomBarPreview() {
|
||||||
CommonsTheme {
|
CommonsTheme {
|
||||||
Surface(tonalElevation = 3.dp) {
|
Surface(tonalElevation = 3.dp) {
|
||||||
CustomSelectorBottomBar(
|
CustomSelectorBottomBar(
|
||||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
onPrimaryAction = { },
|
||||||
|
onSecondaryAction = { },
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue