Build pages with Phlex

Here's what a page might look like in Phlex

# ./app/views/profile.rb
class Views::Profile < PageView
  def initialize(user:)
    @user = user
  end

  def view_template
    div class: "grid grid-cols-2 gap-8" do
      render TailwindNav.new do |it|
        it.item("/password") { "Change password" }
        it.item("/logout") { "Log out" }
        it.item("/settings") { "Settings" }
      end

      main do
        h1 { "Hi #{@user.name} "}
      end
    end
  end
end
16 / 39