Skip to content

Commit

Permalink
PersonView design tweaks (#1412)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf authored Nov 1, 2024
1 parent cf9cc2d commit d72c745
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Mlem/App/Views/Pages/Person/PersonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ struct PersonView: View {
@ViewBuilder
func content(person: any Person) -> some View {
FancyScrollView {
VStack(spacing: Constants.main.standardSpacing) {
VStack(spacing: 0) {
VStack(spacing: Constants.main.standardSpacing) {
ProfileHeaderView(person, fallback: .person)
bio(person: person)
Expand All @@ -133,7 +133,6 @@ struct PersonView: View {
.transition(.opacity)
} else {
VStack(spacing: 0) {
Divider()
ProgressView()
.padding(.top)
}
Expand All @@ -149,34 +148,34 @@ struct PersonView: View {
@ViewBuilder
func bio(person: any Person) -> some View {
if let bio = person.description_ {
Divider()
VStack(spacing: Constants.main.standardSpacing) {
let blocks: [BlockNode] = .init(bio)
if blocks.isSimpleParagraphs, bio.count < 300 {
MarkdownText(blocks, configuration: .default)
.multilineTextAlignment(.center)
.padding(.horizontal, Constants.main.standardSpacing)
dateLabel(person: person)
.frame(maxWidth: .infinity, alignment: .center)
} else {
Markdown(blocks, configuration: .default)
.padding(.horizontal, Constants.main.standardSpacing)
dateLabel(person: person)
.frame(maxWidth: .infinity, alignment: .leading)
}
}
.padding(Constants.main.standardSpacing)
.background(palette.secondaryGroupedBackground, in: .rect(cornerRadius: Constants.main.standardSpacing))
.paletteBorder(cornerRadius: Constants.main.standardSpacing)
.padding(.top, Constants.main.halfSpacing)
} else {
dateLabel(person: person)
.frame(maxWidth: .infinity, alignment: .center)
.padding(.bottom, Constants.main.halfSpacing)
}
}

@ViewBuilder
func dateLabel(person: any Person) -> some View {
ProfileDateView(profilable: person)
.padding(.horizontal, Constants.main.standardSpacing)
.padding(.vertical, 2)
}

@ViewBuilder
Expand Down

0 comments on commit d72c745

Please sign in to comment.