parent
71149e87d3
commit
e75c264258
|
@ -130,7 +130,7 @@ private extension IPView {
|
|||
|
||||
func row(forRoute route: Route, removeAction: @escaping () -> Void) -> some View {
|
||||
ThemeRemovableItemRow(isEditing: true) {
|
||||
ThemeCopiableText(value: route.localizedDescription)
|
||||
ThemeCopiableText(value: route.localizedDescription, isMultiLine: true)
|
||||
} removeAction: {
|
||||
removeAction()
|
||||
}
|
||||
|
@ -226,8 +226,8 @@ private extension IPView {
|
|||
])
|
||||
module.ipv6 = IPSettings(subnet: nil)
|
||||
.including(routes: [
|
||||
.init(defaultWithGateway: .ip("::4", .v6)),
|
||||
.init(.init(rawValue: "::1/24"), nil)
|
||||
.init(defaultWithGateway: .ip("fe80::1032:2a6b:fec:f49e", .v6)),
|
||||
.init(.init(rawValue: "fe80:1032:2a6b:fec::/24"), .init(rawValue: "fe80:1032:2a6b:fec::1"))
|
||||
])
|
||||
return module.preview()
|
||||
}
|
||||
|
|
|
@ -386,6 +386,8 @@ struct ThemeCopiableText: View {
|
|||
|
||||
let value: String
|
||||
|
||||
var isMultiLine = false
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
if let title {
|
||||
|
@ -394,7 +396,7 @@ struct ThemeCopiableText: View {
|
|||
}
|
||||
Text(value)
|
||||
.foregroundStyle(title == nil ? theme.titleColor : theme.valueColor)
|
||||
.themeTruncating()
|
||||
.themeMultiLine(isMultiLine)
|
||||
if title == nil {
|
||||
Spacer()
|
||||
}
|
||||
|
|
|
@ -178,6 +178,15 @@ extension View {
|
|||
modifier(ThemeManualInputModifier())
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
public func themeMultiLine(_ isMultiLine: Bool) -> some View {
|
||||
if isMultiLine {
|
||||
multilineTextAlignment(.leading)
|
||||
} else {
|
||||
themeTruncating()
|
||||
}
|
||||
}
|
||||
|
||||
public func themeTruncating(_ mode: Text.TruncationMode = .middle) -> some View {
|
||||
lineLimit(1)
|
||||
.truncationMode(mode)
|
||||
|
|
Loading…
Reference in New Issue