Skip to content

Commit

Permalink
adjust number of lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Momo Ozawa committed Oct 18, 2023
1 parent c96c43f commit a6762dc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions WordPress/Classes/ViewRelated/Post/PostListCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,23 @@ final class PostListCell: UITableViewCell, Reusable {
func configure(with viewModel: PostListItemViewModel) {
headerView.configure(with: viewModel)

if let title = viewModel.title {
if let title = viewModel.title, !title.isEmpty {
titleLabel.text = title
titleLabel.isHidden = false
} else {
titleLabel.isHidden = true
}

if let snippet = viewModel.snippet {
if let snippet = viewModel.snippet, !snippet.isEmpty {
snippetLabel.text = snippet
snippetLabel.isHidden = false
} else {
snippetLabel.isHidden = true
}

titleLabel.numberOfLines = snippetLabel.isHidden ? 3 : 2
snippetLabel.numberOfLines = titleLabel.isHidden ? 3 : 2

imageLoader.prepareForReuse()
featuredImageView.isHidden = viewModel.imageURL == nil
if let imageURL = viewModel.imageURL {
Expand Down

0 comments on commit a6762dc

Please sign in to comment.