I would like to propose an enhancement to PhlexUI that simplifies the syntax for rendering components. The current syntax is verbose and can be made more concise and readable by utilizing Phlex::Kit.
Current Syntax
The current syntax for rendering an Accordion with an AccordionItem is as follows:
render PhlexUI::Accordion.new do
render PhlexUI::Accordion::Item.new do
render PhlexUI::AccordionDefaultTrigger.new { "Title" }
render PhlexUI::AccordionDefaultContent.new { "Content" }
end
end
Proposed Syntax
The proposed syntax aims to streamline the rendering process, making it more intuitive and easier to read:
PhlexUI.Accordion do
PhlexUI.AccordionItem do
PhlexUI.AccordionDefaultTrigger { "Title" }
PhlexUI.AccordionDefaultContent { "Content" }
end
end
Benefits
Improved Readability: The new syntax is cleaner and more readable, which will be beneficial for both new and experienced users.
Conciseness: Reduces the amount of boilerplate code, making the components easier to use and less error-prone.
Implementation
The proposed change can be achieved by leveraging Phlex::Kit to define the components in a more concise manner. This would involve updating the component definitions and the way they are instantiated within PhlexUI.
This issue is related to https://github.com/PhlexUI/phlex_ui/pull/53
Description
I would like to propose an enhancement to PhlexUI that simplifies the syntax for rendering components. The current syntax is verbose and can be made more concise and readable by utilizing
Phlex::Kit
.Current Syntax
The current syntax for rendering an
Accordion
with anAccordionItem
is as follows:Proposed Syntax
The proposed syntax aims to streamline the rendering process, making it more intuitive and easier to read:
Benefits
Implementation
The proposed change can be achieved by leveraging
Phlex::Kit
to define the components in a more concise manner. This would involve updating the component definitions and the way they are instantiated within PhlexUI.