-
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.
feat(m3): be able to create a new comment.
- Loading branch information
1 parent
3993f18
commit efe1240
Showing
10 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
openfeedback-m3/src/main/kotlin/io/openfeedback/android/m3/CommentInput.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,57 @@ | ||
package io.openfeedback.android.m3 | ||
|
||
import androidx.compose.foundation.text.KeyboardActions | ||
import androidx.compose.foundation.text.KeyboardOptions | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.outlined.Send | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TextField | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.input.ImeAction | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import io.openfeedback.android.R | ||
|
||
@Composable | ||
fun CommentInput( | ||
value: String, | ||
onValueChange: (String) -> Unit, | ||
onSubmit: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
enabled: Boolean = true | ||
) { | ||
TextField( | ||
value = value, | ||
onValueChange = onValueChange, | ||
modifier = modifier, | ||
label = { Text(text = stringResource(id = R.string.openfeedback_comments_title_input)) }, | ||
trailingIcon = { | ||
IconButton(onClick = onSubmit) { | ||
Icon( | ||
imageVector = Icons.Outlined.Send, | ||
contentDescription = stringResource(id = R.string.openfeedback_comments_send) | ||
) | ||
} | ||
}, | ||
enabled = enabled, | ||
keyboardActions = KeyboardActions(onDone = { onSubmit() }), | ||
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), | ||
maxLines = 5 | ||
) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun CommentInputPreview() { | ||
MaterialTheme { | ||
CommentInput( | ||
value = "My comment", | ||
onValueChange = {}, | ||
onSubmit = {} | ||
) | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="openfeedback_comments_title">Commentaires</string> | ||
<string name="openfeedback_comments_title_input">Votre commentaire</string> | ||
<string name="openfeedback_comments_send">Soumettre votre commentaire</string> | ||
<string name="openfeedback_comments_upvotes">%d votes</string> | ||
<string name="powered_by">Proposé par</string> | ||
</resources> |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="openfeedback_comments_title">Comments</string> | ||
<string name="openfeedback_comments_title_input">Your comment</string> | ||
<string name="openfeedback_comments_send">Submit comment</string> | ||
<string name="openfeedback_comments_upvotes">%d votes</string> | ||
<string name="powered_by">Powered by</string> | ||
</resources> |