Skip to content

Commit

Permalink
Merge pull request #43 from NeoUtils/release/v2.1.3
Browse files Browse the repository at this point in the history
Release v2.1.3 - Web target hotfixes
  • Loading branch information
Irineu333 authored Oct 7, 2024
2 parents ac333f1 + 0092cc4 commit 77c4fe6
Show file tree
Hide file tree
Showing 5 changed files with 275 additions and 124 deletions.
2 changes: 1 addition & 1 deletion build-logic/src/main/kotlin/extension/Project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ val config = Config(
version = Config.Version(
major = 2,
minor = 1,
patch = 2,
patch = 3,
phase = Config.Phase.RELEASE
),
android = Config.Android(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,87 +229,3 @@ actual fun TextEditor(
}
}
}

@Composable
private fun MatchDetails(
match: Match,
modifier: Modifier = Modifier,
textStyle: TextStyle = typography.bodyLarge
) = Surface(
modifier = modifier,
shape = RectangleShape,
shadowElevation = dimensions.small
) {
Row(
horizontalArrangement = Arrangement.SpaceAround,
) {

Column(
modifier = Modifier
.padding(dimensions.default)
.weight(weight = 1f)
) {
Text(
text = "match ${match.number}",
style = textStyle.copy(
fontWeight = FontWeight.Bold
)
)

HorizontalDivider(
modifier = Modifier.padding(
vertical = dimensions.small,
)
)

Text(
text = buildAnnotatedString {
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) {
append("range: ")
}
withStyle(SpanStyle(fontWeight = FontWeight.Normal)) {
append(match.range.toString())
}
},
style = textStyle
)
}

if (match.groups.isNotEmpty()) {
Column(
modifier = Modifier
.padding(dimensions.default)
.weight(weight = 1f)
) {
Text(
text = "groups",
style = textStyle.copy(
fontWeight = FontWeight.Bold
)
)

HorizontalDivider(
modifier = Modifier.padding(
vertical = dimensions.small,
)
)

match.groups.forEachIndexed { index, group ->
Text(
text = buildAnnotatedString {
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) {
append("$index: ")
}
withStyle(SpanStyle(fontWeight = FontWeight.Normal)) {
append(group)
}
},
style = textStyle,
overflow = TextOverflow.Ellipsis,
maxLines = 1
)
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* NeoRegex.
*
* Copyright (C) 2024 Irineu A. Silva.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package com.neo.regex.core.sharedui.component

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.text.withStyle
import com.neo.regex.core.designsystem.theme.NeoTheme.dimensions
import com.neo.regex.core.sharedui.model.Match

@Composable
fun MatchDetails(
match: Match,
modifier: Modifier = Modifier,
textStyle: TextStyle = TextStyle()
) = Surface(
modifier = modifier,
shape = RectangleShape,
shadowElevation = dimensions.small
) {

val mergedTextStyle = typography.bodyLarge.merge(textStyle)

Row(
horizontalArrangement = Arrangement.SpaceAround,
) {

Column(
modifier = Modifier
.padding(dimensions.default)
.weight(weight = 1f)
) {
Text(
text = "match ${match.number}",
style = mergedTextStyle.copy(
fontWeight = FontWeight.Bold
)
)

HorizontalDivider(
modifier = Modifier.padding(
vertical = dimensions.small,
)
)

Text(
text = buildAnnotatedString {
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) {
append("range: ")
}
withStyle(SpanStyle(fontWeight = FontWeight.Normal)) {
append(match.range.toString())
}
},
style = mergedTextStyle
)
}

if (match.groups.isNotEmpty()) {
Column(
modifier = Modifier
.padding(dimensions.default)
.weight(weight = 1f)
) {
Text(
text = "groups",
style = mergedTextStyle.copy(
fontWeight = FontWeight.Bold
)
)

HorizontalDivider(
modifier = Modifier.padding(
vertical = dimensions.small,
)
)

match.groups.forEachIndexed { index, group ->
Text(
text = buildAnnotatedString {
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) {
append("$index: ")
}
withStyle(SpanStyle(fontWeight = FontWeight.Normal)) {
append(group)
}
},
style = mergedTextStyle,
overflow = TextOverflow.Ellipsis,
maxLines = 1
)
}
}
}
}
}
Loading

0 comments on commit 77c4fe6

Please sign in to comment.