Skip to content

Commit

Permalink
Updated init StateEmptyView
Browse files Browse the repository at this point in the history
#18 DONE
  • Loading branch information
gemdev111 committed Jun 7, 2024
1 parent f2c0e48 commit 8c0103d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions Packages/Components/Sources/StateView/StateEmptyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@ public struct StateEmptyView: View {
descriptionTextStyle: TextStyle = TextStyle(font: .footnote, color: Colors.secondaryText),
image: Image? = nil
) {
var titleValue = TextValue(text: title, style: titleTextStyle)
var descriptionValue: TextValue?
if let description = description {
descriptionValue = TextValue(text: description, style: descriptionTextStyle)
}
// set regular font if we have only title
let titleStyle = (image == nil && description == nil) ? TextStyle(font: .body, color: titleTextStyle.color) : titleTextStyle
let titleValue = TextValue(text: title, style: titleStyle)
let descriptionValue = description.map { TextValue(text: $0, style: descriptionTextStyle) }

if image == nil && description == nil {
// set regular font if we have only title
titleValue = TextValue(text: titleValue.text, style: TextStyle(font: .body, color: titleValue.style.color))
}
self.init(titleValue: titleValue, descriptionValue: descriptionValue, image: image)
}

Expand Down

0 comments on commit 8c0103d

Please sign in to comment.