Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Migrate the themes components to align with Phlex conversions #170

Merged

Conversation

karinevieira
Copy link
Contributor

Phlex 2.0 follows a specific folder structure and naming convention for views and components.
For views, they should be placed in the app/views directory under the Views namespace, and must inherit from Views::Base.

# frozen_string_literal: true
class Views::Articles::Index < Views::Base
  def view_template
    h1 { "Articles" }
  end
end

For components, they should be placed in the app/components directory under the Components namespace, and must inherit from Components::Base.

class Components::Button < Components::Base
  def view_template
    button { "Click me" }
  end
end

This pull request continues the migration of the components that are currently in the app/views folder to app/components, in accordance with the Phlex conventions.

module Grid
class Card < Components::Base
def view_template
RubyUI::Card(class: "w-full") do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases, I needed to specify the module for the components because Zeitwerk was getting confused, causing the page to take too long to load. To resolve this, I added the RubyUI module to the necessary components.

@stephannv stephannv merged commit 634ba80 into ruby-ui:main Feb 19, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants