Skip to content

Commit

Permalink
Compact spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf committed Sep 18, 2024
1 parent b9bab05 commit ad57016
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Mlem/App/Models/Settings/Options/PostSize.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ enum PostSize: String, CaseIterable, Codable {
}
}

var sectionSpacing: CGFloat {
switch self {
case .compact: Constants.main.halfSpacing
default: Constants.main.standardSpacing
}
}

func icon(filled: Bool) -> String {
switch self {
case .compact: filled ? Icons.compactPostFill : Icons.compactPost
Expand Down
2 changes: 1 addition & 1 deletion Mlem/App/Views/Shared/ExpandedPost/ExpandedPostView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct ExpandedPostView: View {
FancyScrollView {
LazyVStack(
alignment: .leading,
spacing: Constants.main.standardSpacing
spacing: compactComments ? Constants.main.halfSpacing : Constants.main.standardSpacing
) {
LargePostView(post: post, isExpanded: true)
.clipShape(.rect(cornerRadius: 10))
Expand Down
2 changes: 1 addition & 1 deletion Mlem/App/Views/Shared/PersonContentGridView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct PersonContentGridView: View {

var content: some View {
VStack(spacing: 0) {
LazyVGrid(columns: columns, spacing: Constants.main.standardSpacing) {
LazyVGrid(columns: columns, spacing: postSize.sectionSpacing) {
ForEach(items, id: \.hashValue) { item in
personContentItem(item)
.buttonStyle(EmptyButtonStyle())
Expand Down
2 changes: 1 addition & 1 deletion Mlem/App/Views/Shared/PostGridView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct PostGridView: View {

var content: some View {
VStack(spacing: 0) {
LazyVGrid(columns: columns, spacing: Constants.main.standardSpacing) {
LazyVGrid(columns: columns, spacing: postSize.sectionSpacing) {
ForEach(Array(postFeedLoader.items.enumerated()), id: \.element.hashValue) { index, post in
if !post.creator.blocked, !post.community.blocked, !post.hidden {
NavigationLink(.post(post, communityContext: communityContext, navigationNamespace: navigationNamespace)) {
Expand Down

0 comments on commit ad57016

Please sign in to comment.