Skip to content

Force modal's content take all available width #79

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 28, 2025

Conversation

mikhailChelbaev
Copy link
Collaborator

Previously, if the content's width was smaller than the modal's width, it would align to the left. With this fix, the content now uses the full available width and centers itself.

Here's a sample code to test it:

struct App: View {
  @State var isModalPresented = false
  
  var body: some View {
    SUButton(model: .init {
      $0.title = "Show Modal"
    }) {
      isModalPresented = true
    }
    .bottomModal(
      isPresented: $isModalPresented,
      model: .init(),
      header: {
        Text("Header")
      },
      body: {
        Text("Body content goes here")
      },
      footer: {
        SUButton(model: .init {
          $0.title = "Close"
        }) {
          isModalPresented = false
        }
      }
    )
  }
}

@mikhailChelbaev mikhailChelbaev self-assigned this Mar 28, 2025
@mikhailChelbaev mikhailChelbaev merged commit fa88454 into dev Mar 28, 2025
1 check passed
@mikhailChelbaev mikhailChelbaev deleted the fix-sumodal-layout branch March 28, 2025 11:54
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants